aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-07-12 08:59:24 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-07-12 08:59:24 -0400
commitcda390bb8f0fc751194ef5f4c691ca8d3ff91009 (patch)
tree9739758690c5107b73a09f632ae2f8fc2507db09 /arch
parent9a2c33a422d60e8e55c5aff6752522dc39993b16 (diff)
parent449fd15fbcde239875031d70fd06abb4a0e1ed09 (diff)
Merge branch 'kprobes-test-fixes' of git://git.linaro.org/people/tixy/kernel into fixes
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig20
-rw-r--r--arch/arm/boot/dts/armada-375-db.dts2
-rw-r--r--arch/arm/boot/dts/armada-385-db.dts2
-rw-r--r--arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts2
-rw-r--r--arch/arm/configs/multi_v7_defconfig1
-rw-r--r--arch/arm/configs/omap2plus_defconfig1
-rw-r--r--arch/arm/include/asm/ftrace.h2
-rw-r--r--arch/arm/kernel/kprobes-test-arm.c30
-rw-r--r--arch/arm/kernel/kprobes-test.c10
-rw-r--r--arch/arm/kernel/probes-arm.c6
-rw-r--r--arch/arm/mach-bcm/Kconfig7
-rw-r--r--arch/arm/mach-berlin/Kconfig6
-rw-r--r--arch/arm/mach-cns3xxx/Kconfig7
-rw-r--r--arch/arm/mach-davinci/Kconfig1
-rw-r--r--arch/arm/mach-exynos/Kconfig7
-rw-r--r--arch/arm/mach-exynos/common.h1
-rw-r--r--arch/arm/mach-exynos/exynos.c31
-rw-r--r--arch/arm/mach-exynos/platsmp.c26
-rw-r--r--arch/arm/mach-highbank/Kconfig1
-rw-r--r--arch/arm/mach-imx/Kconfig10
-rw-r--r--arch/arm/mach-integrator/Kconfig2
-rw-r--r--arch/arm/mach-integrator/impd1.c12
-rw-r--r--arch/arm/mach-keystone/Kconfig1
-rw-r--r--arch/arm/mach-moxart/Kconfig2
-rw-r--r--arch/arm/mach-mvebu/Kconfig7
-rw-r--r--arch/arm/mach-nomadik/Kconfig4
-rw-r--r--arch/arm/mach-omap2/Kconfig7
-rw-r--r--arch/arm/mach-omap2/common.h7
-rw-r--r--arch/arm/mach-prima2/Kconfig6
-rw-r--r--arch/arm/mach-qcom/Kconfig6
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig2
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig4
-rw-r--r--arch/arm/mach-s5p64x0/Kconfig6
-rw-r--r--arch/arm/mach-s5pc100/Kconfig3
-rw-r--r--arch/arm/mach-s5pv210/Kconfig3
-rw-r--r--arch/arm/mach-shmobile/Kconfig6
-rw-r--r--arch/arm/mach-spear/Kconfig1
-rw-r--r--arch/arm/mach-sti/Kconfig2
-rw-r--r--arch/arm/mach-tegra/Kconfig8
-rw-r--r--arch/arm/mach-u300/Kconfig6
-rw-r--r--arch/arm/mach-ux500/Kconfig7
-rw-r--r--arch/arm/mach-vexpress/Kconfig8
-rw-r--r--arch/arm/mach-vt8500/Kconfig1
-rw-r--r--arch/arm/mach-zynq/Kconfig1
-rw-r--r--arch/arm/plat-samsung/Kconfig28
-rw-r--r--arch/arm64/Kconfig3
-rw-r--r--arch/arm64/boot/dts/apm-mustang.dts4
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi36
-rw-r--r--arch/arm64/configs/defconfig15
-rw-r--r--arch/arm64/crypto/ghash-ce-core.S92
-rw-r--r--arch/arm64/crypto/ghash-ce-glue.c5
-rw-r--r--arch/arm64/include/asm/Kbuild1
-rw-r--r--arch/arm64/include/asm/dma-mapping.h2
-rw-r--r--arch/arm64/include/asm/pgtable.h2
-rw-r--r--arch/arm64/include/uapi/asm/posix_types.h10
-rw-r--r--arch/arm64/include/uapi/asm/sigcontext.h2
-rw-r--r--arch/arm64/kernel/entry-ftrace.S2
-rw-r--r--arch/arm64/kernel/entry.S1
-rw-r--r--arch/arm64/kernel/ptrace.c32
-rw-r--r--arch/arm64/mm/init.c10
-rw-r--r--arch/ia64/hp/common/sba_iommu.c64
-rw-r--r--arch/s390/configs/default_defconfig5
-rw-r--r--arch/s390/configs/gcov_defconfig5
-rw-r--r--arch/s390/configs/performance_defconfig5
-rw-r--r--arch/s390/configs/zfcpdump_defconfig3
-rw-r--r--arch/s390/defconfig8
-rw-r--r--arch/s390/include/asm/mmu_context.h33
-rw-r--r--arch/s390/include/asm/switch_to.h4
-rw-r--r--arch/s390/include/uapi/asm/ucontext.h8
-rw-r--r--arch/s390/kernel/compat_linux.h4
-rw-r--r--arch/sparc/crypto/aes_glue.c6
-rw-r--r--arch/sparc/include/asm/atomic_32.h8
-rw-r--r--arch/sparc/include/asm/atomic_64.h18
-rw-r--r--arch/sparc/include/asm/auxio.h7
-rw-r--r--arch/sparc/include/asm/auxio_32.h6
-rw-r--r--arch/sparc/include/asm/auxio_64.h6
-rw-r--r--arch/sparc/include/asm/bitext.h6
-rw-r--r--arch/sparc/include/asm/bitops_32.h6
-rw-r--r--arch/sparc/include/asm/bitops_64.h24
-rw-r--r--arch/sparc/include/asm/btext.h2
-rw-r--r--arch/sparc/include/asm/bug.h4
-rw-r--r--arch/sparc/include/asm/cacheflush_32.h8
-rw-r--r--arch/sparc/include/asm/cacheflush_64.h24
-rw-r--r--arch/sparc/include/asm/checksum_32.h4
-rw-r--r--arch/sparc/include/asm/checksum_64.h32
-rw-r--r--arch/sparc/include/asm/cmpxchg_32.h6
-rw-r--r--arch/sparc/include/asm/cmpxchg_64.h4
-rw-r--r--arch/sparc/include/asm/cpudata.h10
-rw-r--r--arch/sparc/include/asm/cpudata_64.h5
-rw-r--r--arch/sparc/include/asm/delay_32.h4
-rw-r--r--arch/sparc/include/asm/delay_64.h4
-rw-r--r--arch/sparc/include/asm/device.h2
-rw-r--r--arch/sparc/include/asm/dma-mapping.h2
-rw-r--r--arch/sparc/include/asm/ebus_dma.h16
-rw-r--r--arch/sparc/include/asm/floppy_32.h14
-rw-r--r--arch/sparc/include/asm/floppy_64.h2
-rw-r--r--arch/sparc/include/asm/ftrace.h6
-rw-r--r--arch/sparc/include/asm/highmem.h10
-rw-r--r--arch/sparc/include/asm/hvtramp.h2
-rw-r--r--arch/sparc/include/asm/hypervisor.h325
-rw-r--r--arch/sparc/include/asm/idprom.h2
-rw-r--r--arch/sparc/include/asm/io-unit.h2
-rw-r--r--arch/sparc/include/asm/io_32.h299
-rw-r--r--arch/sparc/include/asm/io_64.h21
-rw-r--r--arch/sparc/include/asm/iommu_32.h10
-rw-r--r--arch/sparc/include/asm/iommu_64.h6
-rw-r--r--arch/sparc/include/asm/irq_32.h3
-rw-r--r--arch/sparc/include/asm/irq_64.h44
-rw-r--r--arch/sparc/include/asm/irqflags_32.h6
-rw-r--r--arch/sparc/include/asm/kdebug_64.h2
-rw-r--r--arch/sparc/include/asm/kgdb.h5
-rw-r--r--arch/sparc/include/asm/kprobes.h8
-rw-r--r--arch/sparc/include/asm/ldc.h66
-rw-r--r--arch/sparc/include/asm/leon.h54
-rw-r--r--arch/sparc/include/asm/leon_pci.h4
-rw-r--r--arch/sparc/include/asm/mc146818rtc.h5
-rw-r--r--arch/sparc/include/asm/mdesc.h32
-rw-r--r--arch/sparc/include/asm/mmu_64.h6
-rw-r--r--arch/sparc/include/asm/mmu_context_64.h24
-rw-r--r--arch/sparc/include/asm/nmi.h10
-rw-r--r--arch/sparc/include/asm/oplib_32.h68
-rw-r--r--arch/sparc/include/asm/oplib_64.h112
-rw-r--r--arch/sparc/include/asm/page.h3
-rw-r--r--arch/sparc/include/asm/page_64.h8
-rw-r--r--arch/sparc/include/asm/pci_64.h14
-rw-r--r--arch/sparc/include/asm/pcic.h8
-rw-r--r--arch/sparc/include/asm/pcr.h6
-rw-r--r--arch/sparc/include/asm/pgalloc_32.h2
-rw-r--r--arch/sparc/include/asm/pgalloc_64.h16
-rw-r--r--arch/sparc/include/asm/pgtable_32.h11
-rw-r--r--arch/sparc/include/asm/pgtable_64.h58
-rw-r--r--arch/sparc/include/asm/processor_32.h5
-rw-r--r--arch/sparc/include/asm/processor_64.h6
-rw-r--r--arch/sparc/include/asm/prom.h24
-rw-r--r--arch/sparc/include/asm/ptrace.h2
-rw-r--r--arch/sparc/include/asm/setup.h39
-rw-r--r--arch/sparc/include/asm/sfp-machine_32.h28
-rw-r--r--arch/sparc/include/asm/smp_32.h6
-rw-r--r--arch/sparc/include/asm/smp_64.h24
-rw-r--r--arch/sparc/include/asm/spitfire.h2
-rw-r--r--arch/sparc/include/asm/stacktrace.h2
-rw-r--r--arch/sparc/include/asm/starfire.h8
-rw-r--r--arch/sparc/include/asm/string_32.h12
-rw-r--r--arch/sparc/include/asm/string_64.h12
-rw-r--r--arch/sparc/include/asm/switch_to_32.h6
-rw-r--r--arch/sparc/include/asm/switch_to_64.h4
-rw-r--r--arch/sparc/include/asm/syscalls.h8
-rw-r--r--arch/sparc/include/asm/timer_32.h6
-rw-r--r--arch/sparc/include/asm/timer_64.h6
-rw-r--r--arch/sparc/include/asm/tlb_64.h8
-rw-r--r--arch/sparc/include/asm/tlbflush_64.h22
-rw-r--r--arch/sparc/include/asm/topology_64.h2
-rw-r--r--arch/sparc/include/asm/trap_block.h6
-rw-r--r--arch/sparc/include/asm/uaccess.h2
-rw-r--r--arch/sparc/include/asm/uaccess_32.h14
-rw-r--r--arch/sparc/include/asm/uaccess_64.h50
-rw-r--r--arch/sparc/include/asm/vio.h36
-rw-r--r--arch/sparc/include/asm/visasm.h3
-rw-r--r--arch/sparc/include/asm/xor_64.h28
-rw-r--r--arch/sparc/kernel/Makefile1
-rw-r--r--arch/sparc/kernel/audit.c8
-rw-r--r--arch/sparc/kernel/auxio_32.c9
-rw-r--r--arch/sparc/kernel/btext.c2
-rw-r--r--arch/sparc/kernel/compat_audit.c1
-rw-r--r--arch/sparc/kernel/cpu.c1
-rw-r--r--arch/sparc/kernel/cpumap.h4
-rw-r--r--arch/sparc/kernel/devices.c12
-rw-r--r--arch/sparc/kernel/entry.h259
-rw-r--r--arch/sparc/kernel/iommu.c3
-rw-r--r--arch/sparc/kernel/iommu_common.h14
-rw-r--r--arch/sparc/kernel/ioport.c6
-rw-r--r--arch/sparc/kernel/irq.h11
-rw-r--r--arch/sparc/kernel/irq_32.c1
-rw-r--r--arch/sparc/kernel/kernel.h124
-rw-r--r--arch/sparc/kernel/kgdb_64.c2
-rw-r--r--arch/sparc/kernel/kprobes.c5
-rw-r--r--arch/sparc/kernel/leon_kernel.c10
-rw-r--r--arch/sparc/kernel/leon_pci.c79
-rw-r--r--arch/sparc/kernel/leon_pci_grpci1.c16
-rw-r--r--arch/sparc/kernel/leon_pci_grpci2.c22
-rw-r--r--arch/sparc/kernel/leon_pmc.c8
-rw-r--r--arch/sparc/kernel/leon_smp.c13
-rw-r--r--arch/sparc/kernel/of_device_common.c4
-rw-r--r--arch/sparc/kernel/pci.c1
-rw-r--r--arch/sparc/kernel/pci_impl.h30
-rw-r--r--arch/sparc/kernel/pci_sun4v.h156
-rw-r--r--arch/sparc/kernel/pcic.c116
-rw-r--r--arch/sparc/kernel/perf_event.c23
-rw-r--r--arch/sparc/kernel/process_32.c12
-rw-r--r--arch/sparc/kernel/process_64.c2
-rw-r--r--arch/sparc/kernel/prom.h2
-rw-r--r--arch/sparc/kernel/prom_64.c5
-rw-r--r--arch/sparc/kernel/psycho_common.h22
-rw-r--r--arch/sparc/kernel/ptrace_32.c2
-rw-r--r--arch/sparc/kernel/setup_32.c4
-rw-r--r--arch/sparc/kernel/signal32.c56
-rw-r--r--arch/sparc/kernel/signal_32.c11
-rw-r--r--arch/sparc/kernel/signal_64.c6
-rw-r--r--arch/sparc/kernel/smp_32.c13
-rw-r--r--arch/sparc/kernel/smp_64.c16
-rw-r--r--arch/sparc/kernel/sun4d_irq.c17
-rw-r--r--arch/sparc/kernel/sys_sparc32.c2
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c10
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c1
-rw-r--r--arch/sparc/kernel/systbls.h124
-rw-r--r--arch/sparc/kernel/tadpole.c126
-rw-r--r--arch/sparc/kernel/time_32.c8
-rw-r--r--arch/sparc/kernel/traps_32.c4
-rw-r--r--arch/sparc/kernel/traps_64.c11
-rw-r--r--arch/sparc/kernel/unaligned_32.c4
-rw-r--r--arch/sparc/kernel/unaligned_64.c2
-rw-r--r--arch/sparc/kernel/windows.c3
-rw-r--r--arch/sparc/lib/Makefile2
-rw-r--r--arch/sparc/math-emu/sfp-util_32.h20
-rw-r--r--arch/sparc/math-emu/sfp-util_64.h12
-rw-r--r--arch/sparc/mm/fault_32.c9
-rw-r--r--arch/sparc/mm/fault_64.c4
-rw-r--r--arch/sparc/mm/init_32.c7
-rw-r--r--arch/sparc/mm/init_64.c9
-rw-r--r--arch/sparc/mm/init_64.h4
-rw-r--r--arch/sparc/mm/io-unit.c21
-rw-r--r--arch/sparc/mm/iommu.c25
-rw-r--r--arch/sparc/mm/leon_mm.c4
-rw-r--r--arch/sparc/mm/mm_32.h24
-rw-r--r--arch/sparc/mm/srmmu.c13
-rw-r--r--arch/sparc/mm/srmmu.h4
-rw-r--r--arch/sparc/mm/tsb.c1
-rw-r--r--arch/sparc/prom/misc_64.c5
-rw-r--r--arch/unicore32/Kconfig6
-rw-r--r--arch/unicore32/include/asm/io.h27
-rw-r--r--arch/unicore32/include/asm/pgtable.h10
-rw-r--r--arch/unicore32/include/asm/ptrace.h1
-rw-r--r--arch/unicore32/kernel/clock.c8
-rw-r--r--arch/unicore32/kernel/ksyms.c41
-rw-r--r--arch/unicore32/kernel/ksyms.h2
-rw-r--r--arch/unicore32/kernel/module.c11
-rw-r--r--arch/unicore32/kernel/process.c1
-rw-r--r--arch/unicore32/kernel/setup.c4
-rw-r--r--arch/unicore32/mm/alignment.c1
-rw-r--r--arch/unicore32/mm/proc-syms.c2
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/boot/compressed/aslr.c9
-rw-r--r--arch/x86/kernel/traps.c7
-rw-r--r--arch/x86/xen/enlighten.c5
-rw-r--r--arch/x86/xen/setup.c60
-rw-r--r--arch/x86/xen/xen-ops.h1
246 files changed, 2045 insertions, 2248 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 87b63fde06d7..245058b3b0ef 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -175,13 +175,6 @@ config ARCH_HAS_ILOG2_U32
175config ARCH_HAS_ILOG2_U64 175config ARCH_HAS_ILOG2_U64
176 bool 176 bool
177 177
178config ARCH_HAS_CPUFREQ
179 bool
180 help
181 Internal node to signify that the ARCH has CPUFREQ support
182 and that the relevant menu configurations are displayed for
183 it.
184
185config ARCH_HAS_BANDGAP 178config ARCH_HAS_BANDGAP
186 bool 179 bool
187 180
@@ -318,7 +311,6 @@ config ARCH_MULTIPLATFORM
318 311
319config ARCH_INTEGRATOR 312config ARCH_INTEGRATOR
320 bool "ARM Ltd. Integrator family" 313 bool "ARM Ltd. Integrator family"
321 select ARCH_HAS_CPUFREQ
322 select ARM_AMBA 314 select ARM_AMBA
323 select ARM_PATCH_PHYS_VIRT 315 select ARM_PATCH_PHYS_VIRT
324 select AUTO_ZRELADDR 316 select AUTO_ZRELADDR
@@ -538,7 +530,6 @@ config ARCH_DOVE
538 530
539config ARCH_KIRKWOOD 531config ARCH_KIRKWOOD
540 bool "Marvell Kirkwood" 532 bool "Marvell Kirkwood"
541 select ARCH_HAS_CPUFREQ
542 select ARCH_REQUIRE_GPIOLIB 533 select ARCH_REQUIRE_GPIOLIB
543 select CPU_FEROCEON 534 select CPU_FEROCEON
544 select GENERIC_CLOCKEVENTS 535 select GENERIC_CLOCKEVENTS
@@ -637,7 +628,6 @@ config ARCH_LPC32XX
637config ARCH_PXA 628config ARCH_PXA
638 bool "PXA2xx/PXA3xx-based" 629 bool "PXA2xx/PXA3xx-based"
639 depends on MMU 630 depends on MMU
640 select ARCH_HAS_CPUFREQ
641 select ARCH_MTD_XIP 631 select ARCH_MTD_XIP
642 select ARCH_REQUIRE_GPIOLIB 632 select ARCH_REQUIRE_GPIOLIB
643 select ARM_CPU_SUSPEND if PM 633 select ARM_CPU_SUSPEND if PM
@@ -707,7 +697,6 @@ config ARCH_RPC
707 697
708config ARCH_SA1100 698config ARCH_SA1100
709 bool "SA1100-based" 699 bool "SA1100-based"
710 select ARCH_HAS_CPUFREQ
711 select ARCH_MTD_XIP 700 select ARCH_MTD_XIP
712 select ARCH_REQUIRE_GPIOLIB 701 select ARCH_REQUIRE_GPIOLIB
713 select ARCH_SPARSEMEM_ENABLE 702 select ARCH_SPARSEMEM_ENABLE
@@ -725,7 +714,6 @@ config ARCH_SA1100
725 714
726config ARCH_S3C24XX 715config ARCH_S3C24XX
727 bool "Samsung S3C24XX SoCs" 716 bool "Samsung S3C24XX SoCs"
728 select ARCH_HAS_CPUFREQ
729 select ARCH_REQUIRE_GPIOLIB 717 select ARCH_REQUIRE_GPIOLIB
730 select ATAGS 718 select ATAGS
731 select CLKDEV_LOOKUP 719 select CLKDEV_LOOKUP
@@ -746,7 +734,6 @@ config ARCH_S3C24XX
746 734
747config ARCH_S3C64XX 735config ARCH_S3C64XX
748 bool "Samsung S3C64XX" 736 bool "Samsung S3C64XX"
749 select ARCH_HAS_CPUFREQ
750 select ARCH_REQUIRE_GPIOLIB 737 select ARCH_REQUIRE_GPIOLIB
751 select ARM_AMBA 738 select ARM_AMBA
752 select ARM_VIC 739 select ARM_VIC
@@ -809,7 +796,6 @@ config ARCH_S5PC100
809 796
810config ARCH_S5PV210 797config ARCH_S5PV210
811 bool "Samsung S5PV210/S5PC110" 798 bool "Samsung S5PV210/S5PC110"
812 select ARCH_HAS_CPUFREQ
813 select ARCH_HAS_HOLES_MEMORYMODEL 799 select ARCH_HAS_HOLES_MEMORYMODEL
814 select ARCH_SPARSEMEM_ENABLE 800 select ARCH_SPARSEMEM_ENABLE
815 select ATAGS 801 select ATAGS
@@ -845,7 +831,6 @@ config ARCH_DAVINCI
845config ARCH_OMAP1 831config ARCH_OMAP1
846 bool "TI OMAP1" 832 bool "TI OMAP1"
847 depends on MMU 833 depends on MMU
848 select ARCH_HAS_CPUFREQ
849 select ARCH_HAS_HOLES_MEMORYMODEL 834 select ARCH_HAS_HOLES_MEMORYMODEL
850 select ARCH_OMAP 835 select ARCH_OMAP
851 select ARCH_REQUIRE_GPIOLIB 836 select ARCH_REQUIRE_GPIOLIB
@@ -1009,8 +994,6 @@ source "arch/arm/mach-rockchip/Kconfig"
1009 994
1010source "arch/arm/mach-sa1100/Kconfig" 995source "arch/arm/mach-sa1100/Kconfig"
1011 996
1012source "arch/arm/plat-samsung/Kconfig"
1013
1014source "arch/arm/mach-socfpga/Kconfig" 997source "arch/arm/mach-socfpga/Kconfig"
1015 998
1016source "arch/arm/mach-spear/Kconfig" 999source "arch/arm/mach-spear/Kconfig"
@@ -1028,6 +1011,7 @@ source "arch/arm/mach-s5pc100/Kconfig"
1028source "arch/arm/mach-s5pv210/Kconfig" 1011source "arch/arm/mach-s5pv210/Kconfig"
1029 1012
1030source "arch/arm/mach-exynos/Kconfig" 1013source "arch/arm/mach-exynos/Kconfig"
1014source "arch/arm/plat-samsung/Kconfig"
1031 1015
1032source "arch/arm/mach-shmobile/Kconfig" 1016source "arch/arm/mach-shmobile/Kconfig"
1033 1017
@@ -2109,9 +2093,7 @@ endmenu
2109 2093
2110menu "CPU Power Management" 2094menu "CPU Power Management"
2111 2095
2112if ARCH_HAS_CPUFREQ
2113source "drivers/cpufreq/Kconfig" 2096source "drivers/cpufreq/Kconfig"
2114endif
2115 2097
2116source "drivers/cpuidle/Kconfig" 2098source "drivers/cpuidle/Kconfig"
2117 2099
diff --git a/arch/arm/boot/dts/armada-375-db.dts b/arch/arm/boot/dts/armada-375-db.dts
index 772fec2d26ce..1e2919d43d78 100644
--- a/arch/arm/boot/dts/armada-375-db.dts
+++ b/arch/arm/boot/dts/armada-375-db.dts
@@ -91,6 +91,8 @@
91 marvell,nand-keep-config; 91 marvell,nand-keep-config;
92 marvell,nand-enable-arbiter; 92 marvell,nand-enable-arbiter;
93 nand-on-flash-bbt; 93 nand-on-flash-bbt;
94 nand-ecc-strength = <4>;
95 nand-ecc-step-size = <512>;
94 96
95 partition@0 { 97 partition@0 {
96 label = "U-Boot"; 98 label = "U-Boot";
diff --git a/arch/arm/boot/dts/armada-385-db.dts b/arch/arm/boot/dts/armada-385-db.dts
index ff9637dd8d0f..5bae4731828b 100644
--- a/arch/arm/boot/dts/armada-385-db.dts
+++ b/arch/arm/boot/dts/armada-385-db.dts
@@ -98,6 +98,8 @@
98 marvell,nand-keep-config; 98 marvell,nand-keep-config;
99 marvell,nand-enable-arbiter; 99 marvell,nand-enable-arbiter;
100 nand-on-flash-bbt; 100 nand-on-flash-bbt;
101 nand-ecc-strength = <4>;
102 nand-ecc-step-size = <512>;
101 103
102 partition@0 { 104 partition@0 {
103 label = "U-Boot"; 105 label = "U-Boot";
diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
index e5c6a0492ca0..4e5a59ee1501 100644
--- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
+++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
@@ -25,7 +25,7 @@
25 25
26 memory { 26 memory {
27 device_type = "memory"; 27 device_type = "memory";
28 reg = <0 0x00000000 0 0xC0000000>; /* 3 GB */ 28 reg = <0 0x00000000 0 0x40000000>; /* 1 GB soldered on */
29 }; 29 };
30 30
31 soc { 31 soc {
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index e2d62048e198..17d9462b9fb9 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -300,6 +300,7 @@ CONFIG_MMC=y
300CONFIG_MMC_BLOCK_MINORS=16 300CONFIG_MMC_BLOCK_MINORS=16
301CONFIG_MMC_ARMMMCI=y 301CONFIG_MMC_ARMMMCI=y
302CONFIG_MMC_SDHCI=y 302CONFIG_MMC_SDHCI=y
303CONFIG_MMC_SDHCI_PLTFM=y
303CONFIG_MMC_SDHCI_OF_ARASAN=y 304CONFIG_MMC_SDHCI_OF_ARASAN=y
304CONFIG_MMC_SDHCI_ESDHC_IMX=y 305CONFIG_MMC_SDHCI_ESDHC_IMX=y
305CONFIG_MMC_SDHCI_DOVE=y 306CONFIG_MMC_SDHCI_DOVE=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 59066cf0271a..536a137863cb 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -32,6 +32,7 @@ CONFIG_SOC_OMAP5=y
32CONFIG_SOC_AM33XX=y 32CONFIG_SOC_AM33XX=y
33CONFIG_SOC_AM43XX=y 33CONFIG_SOC_AM43XX=y
34CONFIG_SOC_DRA7XX=y 34CONFIG_SOC_DRA7XX=y
35CONFIG_CACHE_L2X0=y
35CONFIG_ARM_THUMBEE=y 36CONFIG_ARM_THUMBEE=y
36CONFIG_ARM_ERRATA_411920=y 37CONFIG_ARM_ERRATA_411920=y
37CONFIG_SMP=y 38CONFIG_SMP=y
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index eb577f4f5f70..39eb16b0066f 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -52,7 +52,7 @@ extern inline void *return_address(unsigned int level)
52 52
53#endif 53#endif
54 54
55#define ftrace_return_addr(n) return_address(n) 55#define ftrace_return_address(n) return_address(n)
56 56
57#endif /* ifndef __ASSEMBLY__ */ 57#endif /* ifndef __ASSEMBLY__ */
58 58
diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c
index 9db4b659d03e..cb1424240ff6 100644
--- a/arch/arm/kernel/kprobes-test-arm.c
+++ b/arch/arm/kernel/kprobes-test-arm.c
@@ -74,8 +74,6 @@ void kprobe_arm_test_cases(void)
74 TEST_RRR( op "lt" s " r11, r",11,VAL1,", r",14,N(val),", asr r",7, 6,"")\ 74 TEST_RRR( op "lt" s " r11, r",11,VAL1,", r",14,N(val),", asr r",7, 6,"")\
75 TEST_RR( op "gt" s " r12, r13" ", r",14,val, ", ror r",14,7,"")\ 75 TEST_RR( op "gt" s " r12, r13" ", r",14,val, ", ror r",14,7,"")\
76 TEST_RR( op "le" s " r14, r",0, val, ", r13" ", lsl r",14,8,"")\ 76 TEST_RR( op "le" s " r14, r",0, val, ", r13" ", lsl r",14,8,"")\
77 TEST_RR( op s " r12, pc" ", r",14,val, ", ror r",14,7,"")\
78 TEST_RR( op s " r14, r",0, val, ", pc" ", lsl r",14,8,"")\
79 TEST_R( op "eq" s " r0, r",11,VAL1,", #0xf5") \ 77 TEST_R( op "eq" s " r0, r",11,VAL1,", #0xf5") \
80 TEST_R( op "ne" s " r11, r",0, VAL1,", #0xf5000000") \ 78 TEST_R( op "ne" s " r11, r",0, VAL1,", #0xf5000000") \
81 TEST_R( op s " r7, r",8, VAL2,", #0x000af000") \ 79 TEST_R( op s " r7, r",8, VAL2,", #0x000af000") \
@@ -103,8 +101,6 @@ void kprobe_arm_test_cases(void)
103 TEST_RRR( op "ge r",11,VAL1,", r",14,N(val),", asr r",7, 6,"") \ 101 TEST_RRR( op "ge r",11,VAL1,", r",14,N(val),", asr r",7, 6,"") \
104 TEST_RR( op "le r13" ", r",14,val, ", ror r",14,7,"") \ 102 TEST_RR( op "le r13" ", r",14,val, ", ror r",14,7,"") \
105 TEST_RR( op "gt r",0, val, ", r13" ", lsl r",14,8,"") \ 103 TEST_RR( op "gt r",0, val, ", r13" ", lsl r",14,8,"") \
106 TEST_RR( op " pc" ", r",14,val, ", ror r",14,7,"") \
107 TEST_RR( op " r",0, val, ", pc" ", lsl r",14,8,"") \
108 TEST_R( op "eq r",11,VAL1,", #0xf5") \ 104 TEST_R( op "eq r",11,VAL1,", #0xf5") \
109 TEST_R( op "ne r",0, VAL1,", #0xf5000000") \ 105 TEST_R( op "ne r",0, VAL1,", #0xf5000000") \
110 TEST_R( op " r",8, VAL2,", #0x000af000") 106 TEST_R( op " r",8, VAL2,", #0x000af000")
@@ -125,7 +121,6 @@ void kprobe_arm_test_cases(void)
125 TEST_RR( op "ge" s " r11, r",11,N(val),", asr r",7, 6,"") \ 121 TEST_RR( op "ge" s " r11, r",11,N(val),", asr r",7, 6,"") \
126 TEST_RR( op "lt" s " r12, r",11,val, ", ror r",14,7,"") \ 122 TEST_RR( op "lt" s " r12, r",11,val, ", ror r",14,7,"") \
127 TEST_R( op "gt" s " r14, r13" ", lsl r",14,8,"") \ 123 TEST_R( op "gt" s " r14, r13" ", lsl r",14,8,"") \
128 TEST_R( op "le" s " r14, pc" ", lsl r",14,8,"") \
129 TEST( op "eq" s " r0, #0xf5") \ 124 TEST( op "eq" s " r0, #0xf5") \
130 TEST( op "ne" s " r11, #0xf5000000") \ 125 TEST( op "ne" s " r11, #0xf5000000") \
131 TEST( op s " r7, #0x000af000") \ 126 TEST( op s " r7, #0x000af000") \
@@ -159,12 +154,19 @@ void kprobe_arm_test_cases(void)
159 TEST_SUPPORTED("cmp pc, #0x1000"); 154 TEST_SUPPORTED("cmp pc, #0x1000");
160 TEST_SUPPORTED("cmp sp, #0x1000"); 155 TEST_SUPPORTED("cmp sp, #0x1000");
161 156
162 /* Data-processing with PC as shift*/ 157 /* Data-processing with PC and a shift count in a register */
163 TEST_UNSUPPORTED(__inst_arm(0xe15c0f1e) " @ cmp r12, r14, asl pc") 158 TEST_UNSUPPORTED(__inst_arm(0xe15c0f1e) " @ cmp r12, r14, asl pc")
164 TEST_UNSUPPORTED(__inst_arm(0xe1a0cf1e) " @ mov r12, r14, asl pc") 159 TEST_UNSUPPORTED(__inst_arm(0xe1a0cf1e) " @ mov r12, r14, asl pc")
165 TEST_UNSUPPORTED(__inst_arm(0xe08caf1e) " @ add r10, r12, r14, asl pc") 160 TEST_UNSUPPORTED(__inst_arm(0xe08caf1e) " @ add r10, r12, r14, asl pc")
166 161 TEST_UNSUPPORTED(__inst_arm(0xe151021f) " @ cmp r1, pc, lsl r2")
167 /* Data-processing with PC as shift*/ 162 TEST_UNSUPPORTED(__inst_arm(0xe17f0211) " @ cmn pc, r1, lsl r2")
163 TEST_UNSUPPORTED(__inst_arm(0xe1a0121f) " @ mov r1, pc, lsl r2")
164 TEST_UNSUPPORTED(__inst_arm(0xe1a0f211) " @ mov pc, r1, lsl r2")
165 TEST_UNSUPPORTED(__inst_arm(0xe042131f) " @ sub r1, r2, pc, lsl r3")
166 TEST_UNSUPPORTED(__inst_arm(0xe1cf1312) " @ bic r1, pc, r2, lsl r3")
167 TEST_UNSUPPORTED(__inst_arm(0xe081f312) " @ add pc, r1, r2, lsl r3")
168
169 /* Data-processing with PC as a target and status registers updated */
168 TEST_UNSUPPORTED("movs pc, r1") 170 TEST_UNSUPPORTED("movs pc, r1")
169 TEST_UNSUPPORTED("movs pc, r1, lsl r2") 171 TEST_UNSUPPORTED("movs pc, r1, lsl r2")
170 TEST_UNSUPPORTED("movs pc, #0x10000") 172 TEST_UNSUPPORTED("movs pc, #0x10000")
@@ -187,14 +189,14 @@ void kprobe_arm_test_cases(void)
187 TEST_BF_R ("add pc, pc, r",14,2f-1f-8,"") 189 TEST_BF_R ("add pc, pc, r",14,2f-1f-8,"")
188 TEST_BF_R ("add pc, r",14,2f-1f-8,", pc") 190 TEST_BF_R ("add pc, r",14,2f-1f-8,", pc")
189 TEST_BF_R ("mov pc, r",0,2f,"") 191 TEST_BF_R ("mov pc, r",0,2f,"")
190 TEST_BF_RR("mov pc, r",0,2f,", asl r",1,0,"") 192 TEST_BF_R ("add pc, pc, r",14,(2f-1f-8)*2,", asr #1")
191 TEST_BB( "sub pc, pc, #1b-2b+8") 193 TEST_BB( "sub pc, pc, #1b-2b+8")
192#if __LINUX_ARM_ARCH__ == 6 && !defined(CONFIG_CPU_V7) 194#if __LINUX_ARM_ARCH__ == 6 && !defined(CONFIG_CPU_V7)
193 TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before and after ARMv6 */ 195 TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before and after ARMv6 */
194#endif 196#endif
195 TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"") 197 TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"")
196 TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc") 198 TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc")
197 TEST_RR( "add pc, pc, r",10,-2,", asl r",11,1,"") 199 TEST_R( "add pc, pc, r",10,-2,", asl #1")
198#ifdef CONFIG_THUMB2_KERNEL 200#ifdef CONFIG_THUMB2_KERNEL
199 TEST_ARM_TO_THUMB_INTERWORK_R("add pc, pc, r",0,3f-1f-8+1,"") 201 TEST_ARM_TO_THUMB_INTERWORK_R("add pc, pc, r",0,3f-1f-8+1,"")
200 TEST_ARM_TO_THUMB_INTERWORK_R("sub pc, r",0,3f+8+1,", #8") 202 TEST_ARM_TO_THUMB_INTERWORK_R("sub pc, r",0,3f+8+1,", #8")
@@ -216,6 +218,7 @@ void kprobe_arm_test_cases(void)
216 TEST_BB_R("bx r",7,2f,"") 218 TEST_BB_R("bx r",7,2f,"")
217 TEST_BF_R("bxeq r",14,2f,"") 219 TEST_BF_R("bxeq r",14,2f,"")
218 220
221#if __LINUX_ARM_ARCH__ >= 5
219 TEST_R("clz r0, r",0, 0x0,"") 222 TEST_R("clz r0, r",0, 0x0,"")
220 TEST_R("clzeq r7, r",14,0x1,"") 223 TEST_R("clzeq r7, r",14,0x1,"")
221 TEST_R("clz lr, r",7, 0xffffffff,"") 224 TEST_R("clz lr, r",7, 0xffffffff,"")
@@ -337,6 +340,7 @@ void kprobe_arm_test_cases(void)
337 TEST_UNSUPPORTED(__inst_arm(0xe16f02e1) " @ smultt pc, r1, r2") 340 TEST_UNSUPPORTED(__inst_arm(0xe16f02e1) " @ smultt pc, r1, r2")
338 TEST_UNSUPPORTED(__inst_arm(0xe16002ef) " @ smultt r0, pc, r2") 341 TEST_UNSUPPORTED(__inst_arm(0xe16002ef) " @ smultt r0, pc, r2")
339 TEST_UNSUPPORTED(__inst_arm(0xe1600fe1) " @ smultt r0, r1, pc") 342 TEST_UNSUPPORTED(__inst_arm(0xe1600fe1) " @ smultt r0, r1, pc")
343#endif
340 344
341 TEST_GROUP("Multiply and multiply-accumulate") 345 TEST_GROUP("Multiply and multiply-accumulate")
342 346
@@ -559,6 +563,7 @@ void kprobe_arm_test_cases(void)
559 TEST_UNSUPPORTED("ldrsht r1, [r2], #48") 563 TEST_UNSUPPORTED("ldrsht r1, [r2], #48")
560#endif 564#endif
561 565
566#if __LINUX_ARM_ARCH__ >= 5
562 TEST_RPR( "strd r",0, VAL1,", [r",1, 48,", -r",2,24,"]") 567 TEST_RPR( "strd r",0, VAL1,", [r",1, 48,", -r",2,24,"]")
563 TEST_RPR( "strccd r",8, VAL2,", [r",13,0, ", r",12,48,"]") 568 TEST_RPR( "strccd r",8, VAL2,", [r",13,0, ", r",12,48,"]")
564 TEST_RPR( "strd r",4, VAL1,", [r",2, 24,", r",3, 48,"]!") 569 TEST_RPR( "strd r",4, VAL1,", [r",2, 24,", r",3, 48,"]!")
@@ -595,6 +600,7 @@ void kprobe_arm_test_cases(void)
595 TEST_UNSUPPORTED(__inst_arm(0xe1efc3d0) " @ ldrd r12, [pc, #48]!") 600 TEST_UNSUPPORTED(__inst_arm(0xe1efc3d0) " @ ldrd r12, [pc, #48]!")
596 TEST_UNSUPPORTED(__inst_arm(0xe0c9f3d0) " @ ldrd pc, [r9], #48") 601 TEST_UNSUPPORTED(__inst_arm(0xe0c9f3d0) " @ ldrd pc, [r9], #48")
597 TEST_UNSUPPORTED(__inst_arm(0xe0c9e3d0) " @ ldrd lr, [r9], #48") 602 TEST_UNSUPPORTED(__inst_arm(0xe0c9e3d0) " @ ldrd lr, [r9], #48")
603#endif
598 604
599 TEST_GROUP("Miscellaneous") 605 TEST_GROUP("Miscellaneous")
600 606
@@ -1227,7 +1233,9 @@ void kprobe_arm_test_cases(void)
1227 TEST_COPROCESSOR( "mrc"two" 0, 0, r0, cr0, cr0, 0") 1233 TEST_COPROCESSOR( "mrc"two" 0, 0, r0, cr0, cr0, 0")
1228 1234
1229 COPROCESSOR_INSTRUCTIONS_ST_LD("",e) 1235 COPROCESSOR_INSTRUCTIONS_ST_LD("",e)
1236#if __LINUX_ARM_ARCH__ >= 5
1230 COPROCESSOR_INSTRUCTIONS_MC_MR("",e) 1237 COPROCESSOR_INSTRUCTIONS_MC_MR("",e)
1238#endif
1231 TEST_UNSUPPORTED("svc 0") 1239 TEST_UNSUPPORTED("svc 0")
1232 TEST_UNSUPPORTED("svc 0xffffff") 1240 TEST_UNSUPPORTED("svc 0xffffff")
1233 1241
@@ -1287,7 +1295,9 @@ void kprobe_arm_test_cases(void)
1287 TEST( "blx __dummy_thumb_subroutine_odd") 1295 TEST( "blx __dummy_thumb_subroutine_odd")
1288#endif /* __LINUX_ARM_ARCH__ >= 6 */ 1296#endif /* __LINUX_ARM_ARCH__ >= 6 */
1289 1297
1298#if __LINUX_ARM_ARCH__ >= 5
1290 COPROCESSOR_INSTRUCTIONS_ST_LD("2",f) 1299 COPROCESSOR_INSTRUCTIONS_ST_LD("2",f)
1300#endif
1291#if __LINUX_ARM_ARCH__ >= 6 1301#if __LINUX_ARM_ARCH__ >= 6
1292 COPROCESSOR_INSTRUCTIONS_MC_MR("2",f) 1302 COPROCESSOR_INSTRUCTIONS_MC_MR("2",f)
1293#endif 1303#endif
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 379639998d5a..08d731294bcd 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -225,6 +225,7 @@ static int pre_handler_called;
225static int post_handler_called; 225static int post_handler_called;
226static int jprobe_func_called; 226static int jprobe_func_called;
227static int kretprobe_handler_called; 227static int kretprobe_handler_called;
228static int tests_failed;
228 229
229#define FUNC_ARG1 0x12345678 230#define FUNC_ARG1 0x12345678
230#define FUNC_ARG2 0xabcdef 231#define FUNC_ARG2 0xabcdef
@@ -461,6 +462,13 @@ static int run_api_tests(long (*func)(long, long))
461 462
462 pr_info(" jprobe\n"); 463 pr_info(" jprobe\n");
463 ret = test_jprobe(func); 464 ret = test_jprobe(func);
465#if defined(CONFIG_THUMB2_KERNEL) && !defined(MODULE)
466 if (ret == -EINVAL) {
467 pr_err("FAIL: Known longtime bug with jprobe on Thumb kernels\n");
468 tests_failed = ret;
469 ret = 0;
470 }
471#endif
464 if (ret < 0) 472 if (ret < 0)
465 return ret; 473 return ret;
466 474
@@ -1672,6 +1680,8 @@ static int __init run_all_tests(void)
1672 1680
1673out: 1681out:
1674 if (ret == 0) 1682 if (ret == 0)
1683 ret = tests_failed;
1684 if (ret == 0)
1675 pr_info("Finished kprobe tests OK\n"); 1685 pr_info("Finished kprobe tests OK\n");
1676 else 1686 else
1677 pr_err("kprobe tests failed\n"); 1687 pr_err("kprobe tests failed\n");
diff --git a/arch/arm/kernel/probes-arm.c b/arch/arm/kernel/probes-arm.c
index 51a13a027989..8eaef81d8344 100644
--- a/arch/arm/kernel/probes-arm.c
+++ b/arch/arm/kernel/probes-arm.c
@@ -341,12 +341,12 @@ static const union decode_item arm_cccc_000x_table[] = {
341 /* CMP (reg-shift reg) cccc 0001 0101 xxxx xxxx xxxx 0xx1 xxxx */ 341 /* CMP (reg-shift reg) cccc 0001 0101 xxxx xxxx xxxx 0xx1 xxxx */
342 /* CMN (reg-shift reg) cccc 0001 0111 xxxx xxxx xxxx 0xx1 xxxx */ 342 /* CMN (reg-shift reg) cccc 0001 0111 xxxx xxxx xxxx 0xx1 xxxx */
343 DECODE_EMULATEX (0x0f900090, 0x01100010, PROBES_DATA_PROCESSING_REG, 343 DECODE_EMULATEX (0x0f900090, 0x01100010, PROBES_DATA_PROCESSING_REG,
344 REGS(ANY, 0, NOPC, 0, ANY)), 344 REGS(NOPC, 0, NOPC, 0, NOPC)),
345 345
346 /* MOV (reg-shift reg) cccc 0001 101x xxxx xxxx xxxx 0xx1 xxxx */ 346 /* MOV (reg-shift reg) cccc 0001 101x xxxx xxxx xxxx 0xx1 xxxx */
347 /* MVN (reg-shift reg) cccc 0001 111x xxxx xxxx xxxx 0xx1 xxxx */ 347 /* MVN (reg-shift reg) cccc 0001 111x xxxx xxxx xxxx 0xx1 xxxx */
348 DECODE_EMULATEX (0x0fa00090, 0x01a00010, PROBES_DATA_PROCESSING_REG, 348 DECODE_EMULATEX (0x0fa00090, 0x01a00010, PROBES_DATA_PROCESSING_REG,
349 REGS(0, ANY, NOPC, 0, ANY)), 349 REGS(0, NOPC, NOPC, 0, NOPC)),
350 350
351 /* AND (reg-shift reg) cccc 0000 000x xxxx xxxx xxxx 0xx1 xxxx */ 351 /* AND (reg-shift reg) cccc 0000 000x xxxx xxxx xxxx 0xx1 xxxx */
352 /* EOR (reg-shift reg) cccc 0000 001x xxxx xxxx xxxx 0xx1 xxxx */ 352 /* EOR (reg-shift reg) cccc 0000 001x xxxx xxxx xxxx 0xx1 xxxx */
@@ -359,7 +359,7 @@ static const union decode_item arm_cccc_000x_table[] = {
359 /* ORR (reg-shift reg) cccc 0001 100x xxxx xxxx xxxx 0xx1 xxxx */ 359 /* ORR (reg-shift reg) cccc 0001 100x xxxx xxxx xxxx 0xx1 xxxx */
360 /* BIC (reg-shift reg) cccc 0001 110x xxxx xxxx xxxx 0xx1 xxxx */ 360 /* BIC (reg-shift reg) cccc 0001 110x xxxx xxxx xxxx 0xx1 xxxx */
361 DECODE_EMULATEX (0x0e000090, 0x00000010, PROBES_DATA_PROCESSING_REG, 361 DECODE_EMULATEX (0x0e000090, 0x00000010, PROBES_DATA_PROCESSING_REG,
362 REGS(ANY, ANY, NOPC, 0, ANY)), 362 REGS(NOPC, NOPC, NOPC, 0, NOPC)),
363 363
364 DECODE_END 364 DECODE_END
365}; 365};
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 9bc6db1c1348..41c839167e87 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -1,10 +1,9 @@
1config ARCH_BCM 1menuconfig ARCH_BCM
2 bool "Broadcom SoC Support" if ARCH_MULTI_V6_V7 2 bool "Broadcom SoC Support" if ARCH_MULTI_V6_V7
3 help 3 help
4 This enables support for Broadcom ARM based SoC chips 4 This enables support for Broadcom ARM based SoC chips
5 5
6menu "Broadcom SoC Selection" 6if ARCH_BCM
7 depends on ARCH_BCM
8 7
9config ARCH_BCM_MOBILE 8config ARCH_BCM_MOBILE
10 bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7 9 bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7
@@ -88,4 +87,4 @@ config ARCH_BCM_5301X
88 different SoC or with the older BCM47XX and BCM53XX based 87 different SoC or with the older BCM47XX and BCM53XX based
89 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx 88 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx
90 89
91endmenu 90endif
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
index 101e0f356730..2631cfc5ab0d 100644
--- a/arch/arm/mach-berlin/Kconfig
+++ b/arch/arm/mach-berlin/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_BERLIN 1menuconfig ARCH_BERLIN
2 bool "Marvell Berlin SoCs" if ARCH_MULTI_V7 2 bool "Marvell Berlin SoCs" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARM_GIC 4 select ARM_GIC
@@ -9,8 +9,6 @@ config ARCH_BERLIN
9 9
10if ARCH_BERLIN 10if ARCH_BERLIN
11 11
12menu "Marvell Berlin SoC variants"
13
14config MACH_BERLIN_BG2 12config MACH_BERLIN_BG2
15 bool "Marvell Armada 1500 (BG2)" 13 bool "Marvell Armada 1500 (BG2)"
16 select CACHE_L2X0 14 select CACHE_L2X0
@@ -30,6 +28,4 @@ config MACH_BERLIN_BG2Q
30 select HAVE_ARM_TWD if SMP 28 select HAVE_ARM_TWD if SMP
31 select PINCTRL_BERLIN_BG2Q 29 select PINCTRL_BERLIN_BG2Q
32 30
33endmenu
34
35endif 31endif
diff --git a/arch/arm/mach-cns3xxx/Kconfig b/arch/arm/mach-cns3xxx/Kconfig
index 66838f42037f..3c22a1990ecd 100644
--- a/arch/arm/mach-cns3xxx/Kconfig
+++ b/arch/arm/mach-cns3xxx/Kconfig
@@ -1,12 +1,11 @@
1config ARCH_CNS3XXX 1menuconfig ARCH_CNS3XXX
2 bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6 2 bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6
3 select ARM_GIC 3 select ARM_GIC
4 select PCI_DOMAINS if PCI 4 select PCI_DOMAINS if PCI
5 help 5 help
6 Support for Cavium Networks CNS3XXX platform. 6 Support for Cavium Networks CNS3XXX platform.
7 7
8menu "CNS3XXX platform type" 8if ARCH_CNS3XXX
9 depends on ARCH_CNS3XXX
10 9
11config MACH_CNS3420VB 10config MACH_CNS3420VB
12 bool "Support for CNS3420 Validation Board" 11 bool "Support for CNS3420 Validation Board"
@@ -17,4 +16,4 @@ config MACH_CNS3420VB
17 This is a platform with an on-board ARM11 MPCore and has support 16 This is a platform with an on-board ARM11 MPCore and has support
18 for USB, USB-OTG, MMC/SD/SDIO, SATA, PCI-E, etc. 17 for USB, USB-OTG, MMC/SD/SDIO, SATA, PCI-E, etc.
19 18
20endmenu 19endif
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index db18ef866593..584e8d4e2892 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -39,7 +39,6 @@ config ARCH_DAVINCI_DA830
39config ARCH_DAVINCI_DA850 39config ARCH_DAVINCI_DA850
40 bool "DA850/OMAP-L138/AM18x based system" 40 bool "DA850/OMAP-L138/AM18x based system"
41 select ARCH_DAVINCI_DA8XX 41 select ARCH_DAVINCI_DA8XX
42 select ARCH_HAS_CPUFREQ
43 select CP_INTC 42 select CP_INTC
44 43
45config ARCH_DAVINCI_DA8XX 44config ARCH_DAVINCI_DA8XX
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index d58995c9a95a..8f9b66c4ac78 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -7,10 +7,9 @@
7 7
8# Configuration options for the EXYNOS4 8# Configuration options for the EXYNOS4
9 9
10config ARCH_EXYNOS 10menuconfig ARCH_EXYNOS
11 bool "Samsung EXYNOS" if ARCH_MULTI_V7 11 bool "Samsung EXYNOS" if ARCH_MULTI_V7
12 select ARCH_HAS_BANDGAP 12 select ARCH_HAS_BANDGAP
13 select ARCH_HAS_CPUFREQ
14 select ARCH_HAS_HOLES_MEMORYMODEL 13 select ARCH_HAS_HOLES_MEMORYMODEL
15 select ARCH_REQUIRE_GPIOLIB 14 select ARCH_REQUIRE_GPIOLIB
16 select ARM_AMBA 15 select ARM_AMBA
@@ -30,8 +29,6 @@ config ARCH_EXYNOS
30 29
31if ARCH_EXYNOS 30if ARCH_EXYNOS
32 31
33menu "SAMSUNG EXYNOS SoCs Support"
34
35config ARCH_EXYNOS3 32config ARCH_EXYNOS3
36 bool "SAMSUNG EXYNOS3" 33 bool "SAMSUNG EXYNOS3"
37 select ARM_CPU_SUSPEND if PM 34 select ARM_CPU_SUSPEND if PM
@@ -118,8 +115,6 @@ config SOC_EXYNOS5800
118 default y 115 default y
119 depends on SOC_EXYNOS5420 116 depends on SOC_EXYNOS5420
120 117
121endmenu
122
123config EXYNOS5420_MCPM 118config EXYNOS5420_MCPM
124 bool "Exynos5420 Multi-Cluster PM support" 119 bool "Exynos5420 Multi-Cluster PM support"
125 depends on MCPM && SOC_EXYNOS5420 120 depends on MCPM && SOC_EXYNOS5420
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 16617bdb37a9..1ee91763fa7c 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -118,6 +118,7 @@ extern void __iomem *sysram_ns_base_addr;
118extern void __iomem *sysram_base_addr; 118extern void __iomem *sysram_base_addr;
119void exynos_init_io(void); 119void exynos_init_io(void);
120void exynos_restart(enum reboot_mode mode, const char *cmd); 120void exynos_restart(enum reboot_mode mode, const char *cmd);
121void exynos_sysram_init(void);
121void exynos_cpuidle_init(void); 122void exynos_cpuidle_init(void);
122void exynos_cpufreq_init(void); 123void exynos_cpufreq_init(void);
123void exynos_init_late(void); 124void exynos_init_late(void);
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 90aab4d75d08..f38cf7c110cc 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -184,6 +184,28 @@ void __init exynos_cpufreq_init(void)
184 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0); 184 platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
185} 185}
186 186
187void __iomem *sysram_base_addr;
188void __iomem *sysram_ns_base_addr;
189
190void __init exynos_sysram_init(void)
191{
192 struct device_node *node;
193
194 for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") {
195 if (!of_device_is_available(node))
196 continue;
197 sysram_base_addr = of_iomap(node, 0);
198 break;
199 }
200
201 for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") {
202 if (!of_device_is_available(node))
203 continue;
204 sysram_ns_base_addr = of_iomap(node, 0);
205 break;
206 }
207}
208
187void __init exynos_init_late(void) 209void __init exynos_init_late(void)
188{ 210{
189 if (of_machine_is_compatible("samsung,exynos5440")) 211 if (of_machine_is_compatible("samsung,exynos5440"))
@@ -198,7 +220,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
198 int depth, void *data) 220 int depth, void *data)
199{ 221{
200 struct map_desc iodesc; 222 struct map_desc iodesc;
201 __be32 *reg; 223 const __be32 *reg;
202 int len; 224 int len;
203 225
204 if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && 226 if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") &&
@@ -271,6 +293,13 @@ static void __init exynos_dt_machine_init(void)
271 } 293 }
272 } 294 }
273 295
296 /*
297 * This is called from smp_prepare_cpus if we've built for SMP, but
298 * we still need to set it up for PM and firmware ops if not.
299 */
300 if (!IS_ENABLED(SMP))
301 exynos_sysram_init();
302
274 exynos_cpuidle_init(); 303 exynos_cpuidle_init();
275 exynos_cpufreq_init(); 304 exynos_cpufreq_init();
276 305
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index ec02422e8499..1c8d31e39520 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -32,28 +32,6 @@
32 32
33extern void exynos4_secondary_startup(void); 33extern void exynos4_secondary_startup(void);
34 34
35void __iomem *sysram_base_addr;
36void __iomem *sysram_ns_base_addr;
37
38static void __init exynos_smp_prepare_sysram(void)
39{
40 struct device_node *node;
41
42 for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") {
43 if (!of_device_is_available(node))
44 continue;
45 sysram_base_addr = of_iomap(node, 0);
46 break;
47 }
48
49 for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") {
50 if (!of_device_is_available(node))
51 continue;
52 sysram_ns_base_addr = of_iomap(node, 0);
53 break;
54 }
55}
56
57static inline void __iomem *cpu_boot_reg_base(void) 35static inline void __iomem *cpu_boot_reg_base(void)
58{ 36{
59 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) 37 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1)
@@ -234,11 +212,11 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
234{ 212{
235 int i; 213 int i;
236 214
215 exynos_sysram_init();
216
237 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) 217 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
238 scu_enable(scu_base_addr()); 218 scu_enable(scu_base_addr());
239 219
240 exynos_smp_prepare_sysram();
241
242 /* 220 /*
243 * Write the address of secondary startup into the 221 * Write the address of secondary startup into the
244 * system-wide flags register. The boot monitor waits 222 * system-wide flags register. The boot monitor waits
diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index 830b76e70250..a5960e2ac090 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -1,7 +1,6 @@
1config ARCH_HIGHBANK 1config ARCH_HIGHBANK
2 bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7 2 bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7
3 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 3 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
4 select ARCH_HAS_CPUFREQ
5 select ARCH_HAS_HOLES_MEMORYMODEL 4 select ARCH_HAS_HOLES_MEMORYMODEL
6 select ARCH_HAS_OPP 5 select ARCH_HAS_OPP
7 select ARCH_SUPPORTS_BIG_ENDIAN 6 select ARCH_SUPPORTS_BIG_ENDIAN
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 606b52680f6a..4b5185748f74 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -1,6 +1,5 @@
1config ARCH_MXC 1menuconfig ARCH_MXC
2 bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 2 bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7
3 select ARCH_HAS_CPUFREQ
4 select ARCH_HAS_OPP 3 select ARCH_HAS_OPP
5 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
6 select ARM_CPU_SUSPEND if PM 5 select ARM_CPU_SUSPEND if PM
@@ -13,8 +12,7 @@ config ARCH_MXC
13 help 12 help
14 Support for Freescale MXC/iMX-based family of processors 13 Support for Freescale MXC/iMX-based family of processors
15 14
16menu "Freescale i.MX support" 15if ARCH_MXC
17 depends on ARCH_MXC
18 16
19config MXC_TZIC 17config MXC_TZIC
20 bool 18 bool
@@ -99,7 +97,6 @@ config SOC_IMX25
99 97
100config SOC_IMX27 98config SOC_IMX27
101 bool 99 bool
102 select ARCH_HAS_CPUFREQ
103 select ARCH_HAS_OPP 100 select ARCH_HAS_OPP
104 select CPU_ARM926T 101 select CPU_ARM926T
105 select IMX_HAVE_IOMUX_V1 102 select IMX_HAVE_IOMUX_V1
@@ -124,7 +121,6 @@ config SOC_IMX35
124 121
125config SOC_IMX5 122config SOC_IMX5
126 bool 123 bool
127 select ARCH_HAS_CPUFREQ
128 select ARCH_HAS_OPP 124 select ARCH_HAS_OPP
129 select ARCH_MXC_IOMUX_V3 125 select ARCH_MXC_IOMUX_V3
130 select MXC_TZIC 126 select MXC_TZIC
@@ -786,4 +782,4 @@ endif
786 782
787source "arch/arm/mach-imx/devices/Kconfig" 783source "arch/arm/mach-imx/devices/Kconfig"
788 784
789endmenu 785endif
diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index ba43321001d8..64f8e2564a37 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -28,7 +28,7 @@ config ARCH_CINTEGRATOR
28 bool 28 bool
29 29
30config INTEGRATOR_IMPD1 30config INTEGRATOR_IMPD1
31 tristate "Include support for Integrator/IM-PD1" 31 bool "Include support for Integrator/IM-PD1"
32 depends on ARCH_INTEGRATOR_AP 32 depends on ARCH_INTEGRATOR_AP
33 select ARCH_REQUIRE_GPIOLIB 33 select ARCH_REQUIRE_GPIOLIB
34 select ARM_VIC 34 select ARM_VIC
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 0e870ea818c4..3ce880729cff 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -308,7 +308,12 @@ static struct impd1_device impd1_devs[] = {
308 */ 308 */
309#define IMPD1_VALID_IRQS 0x00000bffU 309#define IMPD1_VALID_IRQS 0x00000bffU
310 310
311static int __init impd1_probe(struct lm_device *dev) 311/*
312 * As this module is bool, it is OK to have this as __init_refok() - no
313 * probe calls will be done after the initial system bootup, as devices
314 * are discovered as part of the machine startup.
315 */
316static int __init_refok impd1_probe(struct lm_device *dev)
312{ 317{
313 struct impd1_module *impd1; 318 struct impd1_module *impd1;
314 int irq_base; 319 int irq_base;
@@ -397,6 +402,11 @@ static void impd1_remove(struct lm_device *dev)
397static struct lm_driver impd1_driver = { 402static struct lm_driver impd1_driver = {
398 .drv = { 403 .drv = {
399 .name = "impd1", 404 .name = "impd1",
405 /*
406 * As we're dropping the probe() function, suppress driver
407 * binding from sysfs.
408 */
409 .suppress_bind_attrs = true,
400 }, 410 },
401 .probe = impd1_probe, 411 .probe = impd1_probe,
402 .remove = impd1_remove, 412 .remove = impd1_remove,
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index f50bc936cb84..98a156afaa94 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -1,6 +1,7 @@
1config ARCH_KEYSTONE 1config ARCH_KEYSTONE
2 bool "Texas Instruments Keystone Devices" 2 bool "Texas Instruments Keystone Devices"
3 depends on ARCH_MULTI_V7 3 depends on ARCH_MULTI_V7
4 depends on ARM_PATCH_PHYS_VIRT
4 select ARM_GIC 5 select ARM_GIC
5 select HAVE_ARM_ARCH_TIMER 6 select HAVE_ARM_ARCH_TIMER
6 select CLKSRC_MMIO 7 select CLKSRC_MMIO
diff --git a/arch/arm/mach-moxart/Kconfig b/arch/arm/mach-moxart/Kconfig
index 82a4ba8578a2..f49328c39bef 100644
--- a/arch/arm/mach-moxart/Kconfig
+++ b/arch/arm/mach-moxart/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_MOXART 1menuconfig ARCH_MOXART
2 bool "MOXA ART SoC" if ARCH_MULTI_V4 2 bool "MOXA ART SoC" if ARCH_MULTI_V4
3 select CPU_FA526 3 select CPU_FA526
4 select ARM_DMA_MEM_BUFFERABLE 4 select ARM_DMA_MEM_BUFFERABLE
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 6090b9eb00c8..4a7c250c9a30 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_MVEBU 1menuconfig ARCH_MVEBU
2 bool "Marvell Engineering Business Unit (MVEBU) SoCs" if (ARCH_MULTI_V7 || ARCH_MULTI_V5) 2 bool "Marvell Engineering Business Unit (MVEBU) SoCs" if (ARCH_MULTI_V7 || ARCH_MULTI_V5)
3 select ARCH_SUPPORTS_BIG_ENDIAN 3 select ARCH_SUPPORTS_BIG_ENDIAN
4 select CLKSRC_MMIO 4 select CLKSRC_MMIO
@@ -13,8 +13,6 @@ config ARCH_MVEBU
13 13
14if ARCH_MVEBU 14if ARCH_MVEBU
15 15
16menu "Marvell EBU SoC variants"
17
18config MACH_MVEBU_V7 16config MACH_MVEBU_V7
19 bool 17 bool
20 select ARMADA_370_XP_TIMER 18 select ARMADA_370_XP_TIMER
@@ -84,7 +82,6 @@ config MACH_DOVE
84 82
85config MACH_KIRKWOOD 83config MACH_KIRKWOOD
86 bool "Marvell Kirkwood boards" if ARCH_MULTI_V5 84 bool "Marvell Kirkwood boards" if ARCH_MULTI_V5
87 select ARCH_HAS_CPUFREQ
88 select ARCH_REQUIRE_GPIOLIB 85 select ARCH_REQUIRE_GPIOLIB
89 select CPU_FEROCEON 86 select CPU_FEROCEON
90 select KIRKWOOD_CLK 87 select KIRKWOOD_CLK
@@ -97,6 +94,4 @@ config MACH_KIRKWOOD
97 Say 'Y' here if you want your kernel to support boards based 94 Say 'Y' here if you want your kernel to support boards based
98 on the Marvell Kirkwood device tree. 95 on the Marvell Kirkwood device tree.
99 96
100endmenu
101
102endif 97endif
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index 486d301f43fd..3c61096c8627 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_NOMADIK 1menuconfig ARCH_NOMADIK
2 bool "ST-Ericsson Nomadik" 2 bool "ST-Ericsson Nomadik"
3 depends on ARCH_MULTI_V5 3 depends on ARCH_MULTI_V5
4 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
@@ -15,7 +15,6 @@ config ARCH_NOMADIK
15 Support for the Nomadik platform by ST-Ericsson 15 Support for the Nomadik platform by ST-Ericsson
16 16
17if ARCH_NOMADIK 17if ARCH_NOMADIK
18menu "Nomadik boards"
19 18
20config MACH_NOMADIK_8815NHK 19config MACH_NOMADIK_8815NHK
21 bool "ST 8815 Nomadik Hardware Kit (evaluation board)" 20 bool "ST 8815 Nomadik Hardware Kit (evaluation board)"
@@ -24,7 +23,6 @@ config MACH_NOMADIK_8815NHK
24 select I2C_ALGOBIT 23 select I2C_ALGOBIT
25 select I2C_NOMADIK 24 select I2C_NOMADIK
26 25
27endmenu
28endif 26endif
29 27
30config NOMADIK_8815 28config NOMADIK_8815
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 2ff3f23e31b0..1c1ed737f7ab 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -1,3 +1,6 @@
1menu "TI OMAP/AM/DM/DRA Family"
2 depends on ARCH_MULTI_V6 || ARCH_MULTI_V7
3
1config ARCH_OMAP 4config ARCH_OMAP
2 bool 5 bool
3 6
@@ -28,7 +31,6 @@ config ARCH_OMAP4
28 select ARM_CPU_SUSPEND if PM 31 select ARM_CPU_SUSPEND if PM
29 select ARM_ERRATA_720789 32 select ARM_ERRATA_720789
30 select ARM_GIC 33 select ARM_GIC
31 select CACHE_L2X0
32 select HAVE_ARM_SCU if SMP 34 select HAVE_ARM_SCU if SMP
33 select HAVE_ARM_TWD if SMP 35 select HAVE_ARM_TWD if SMP
34 select OMAP_INTERCONNECT 36 select OMAP_INTERCONNECT
@@ -80,7 +82,6 @@ config SOC_DRA7XX
80config ARCH_OMAP2PLUS 82config ARCH_OMAP2PLUS
81 bool 83 bool
82 select ARCH_HAS_BANDGAP 84 select ARCH_HAS_BANDGAP
83 select ARCH_HAS_CPUFREQ
84 select ARCH_HAS_HOLES_MEMORYMODEL 85 select ARCH_HAS_HOLES_MEMORYMODEL
85 select ARCH_OMAP 86 select ARCH_OMAP
86 select ARCH_REQUIRE_GPIOLIB 87 select ARCH_REQUIRE_GPIOLIB
@@ -343,3 +344,5 @@ config OMAP4_ERRATA_I688
343endmenu 344endmenu
344 345
345endif 346endif
347
348endmenu
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index ff029737c8f0..a373d508799a 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -91,7 +91,14 @@ extern void omap3_sync32k_timer_init(void);
91extern void omap3_secure_sync32k_timer_init(void); 91extern void omap3_secure_sync32k_timer_init(void);
92extern void omap3_gptimer_timer_init(void); 92extern void omap3_gptimer_timer_init(void);
93extern void omap4_local_timer_init(void); 93extern void omap4_local_timer_init(void);
94#ifdef CONFIG_CACHE_L2X0
94int omap_l2_cache_init(void); 95int omap_l2_cache_init(void);
96#else
97static inline int omap_l2_cache_init(void)
98{
99 return 0;
100}
101#endif
95extern void omap5_realtime_timer_init(void); 102extern void omap5_realtime_timer_init(void);
96 103
97void omap2420_init_early(void); 104void omap2420_init_early(void);
diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig
index e4e505f52ba0..042f693ef423 100644
--- a/arch/arm/mach-prima2/Kconfig
+++ b/arch/arm/mach-prima2/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_SIRF 1menuconfig ARCH_SIRF
2 bool "CSR SiRF" if ARCH_MULTI_V7 2 bool "CSR SiRF" if ARCH_MULTI_V7
3 select ARCH_HAS_RESET_CONTROLLER 3 select ARCH_HAS_RESET_CONTROLLER
4 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
@@ -11,7 +11,7 @@ config ARCH_SIRF
11 11
12if ARCH_SIRF 12if ARCH_SIRF
13 13
14menu "CSR SiRF atlas6/primaII/Marco/Polo Specific Features" 14comment "CSR SiRF atlas6/primaII/Marco/Polo Specific Features"
15 15
16config ARCH_ATLAS6 16config ARCH_ATLAS6
17 bool "CSR SiRFSoC ATLAS6 ARM Cortex A9 Platform" 17 bool "CSR SiRFSoC ATLAS6 ARM Cortex A9 Platform"
@@ -37,8 +37,6 @@ config ARCH_MARCO
37 help 37 help
38 Support for CSR SiRFSoC ARM Cortex A9 Platform 38 Support for CSR SiRFSoC ARM Cortex A9 Platform
39 39
40endmenu
41
42config SIRF_IRQ 40config SIRF_IRQ
43 bool 41 bool
44 42
diff --git a/arch/arm/mach-qcom/Kconfig b/arch/arm/mach-qcom/Kconfig
index fd2b99dceb89..ee5697ba05bc 100644
--- a/arch/arm/mach-qcom/Kconfig
+++ b/arch/arm/mach-qcom/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_QCOM 1menuconfig ARCH_QCOM
2 bool "Qualcomm Support" if ARCH_MULTI_V7 2 bool "Qualcomm Support" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARM_GIC 4 select ARM_GIC
@@ -11,8 +11,6 @@ config ARCH_QCOM
11 11
12if ARCH_QCOM 12if ARCH_QCOM
13 13
14menu "Qualcomm SoC Selection"
15
16config ARCH_MSM8X60 14config ARCH_MSM8X60
17 bool "Enable support for MSM8X60" 15 bool "Enable support for MSM8X60"
18 select CLKSRC_QCOM 16 select CLKSRC_QCOM
@@ -25,8 +23,6 @@ config ARCH_MSM8974
25 bool "Enable support for MSM8974" 23 bool "Enable support for MSM8974"
26 select HAVE_ARM_ARCH_TIMER 24 select HAVE_ARM_ARCH_TIMER
27 25
28endmenu
29
30config QCOM_SCM 26config QCOM_SCM
31 bool 27 bool
32 28
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 04284de7aca5..ad5316ae524e 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -117,7 +117,7 @@ config S3C24XX_SETUP_TS
117 Compile in platform device definition for Samsung TouchScreen. 117 Compile in platform device definition for Samsung TouchScreen.
118 118
119config S3C24XX_DMA 119config S3C24XX_DMA
120 bool "S3C2410 DMA support" 120 bool "S3C2410 DMA support (deprecated)"
121 select S3C_DMA 121 select S3C_DMA
122 help 122 help
123 S3C2410 DMA support. This is needed for drivers like sound which 123 S3C2410 DMA support. This is needed for drivers like sound which
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 3136d86b0d6e..26ca2427e53d 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -18,9 +18,9 @@ config CPU_S3C6410
18 Enable S3C6410 CPU support 18 Enable S3C6410 CPU support
19 19
20config S3C64XX_PL080 20config S3C64XX_PL080
21 bool "S3C64XX DMA using generic PL08x driver" 21 def_bool DMADEVICES
22 select ARM_AMBA
22 select AMBA_PL08X 23 select AMBA_PL08X
23 select SAMSUNG_DMADEV
24 24
25config S3C64XX_SETUP_SDHCI 25config S3C64XX_SETUP_SDHCI
26 bool 26 bool
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index bb2111b3751e..26003e23796d 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -9,16 +9,18 @@ if ARCH_S5P64X0
9 9
10config CPU_S5P6440 10config CPU_S5P6440
11 bool 11 bool
12 select ARM_AMBA
13 select PL330_DMA if DMADEVICES
12 select S5P_SLEEP if PM 14 select S5P_SLEEP if PM
13 select SAMSUNG_DMADEV
14 select SAMSUNG_WAKEMASK if PM 15 select SAMSUNG_WAKEMASK if PM
15 help 16 help
16 Enable S5P6440 CPU support 17 Enable S5P6440 CPU support
17 18
18config CPU_S5P6450 19config CPU_S5P6450
19 bool 20 bool
21 select ARM_AMBA
22 select PL330_DMA if DMADEVICES
20 select S5P_SLEEP if PM 23 select S5P_SLEEP if PM
21 select SAMSUNG_DMADEV
22 select SAMSUNG_WAKEMASK if PM 24 select SAMSUNG_WAKEMASK if PM
23 help 25 help
24 Enable S5P6450 CPU support 26 Enable S5P6450 CPU support
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index 15170be97a74..c5e3a969b063 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -9,8 +9,9 @@ if ARCH_S5PC100
9 9
10config CPU_S5PC100 10config CPU_S5PC100
11 bool 11 bool
12 select ARM_AMBA
13 select PL330_DMA if DMADEVICES
12 select S5P_EXT_INT 14 select S5P_EXT_INT
13 select SAMSUNG_DMADEV
14 help 15 help
15 Enable S5PC100 CPU support 16 Enable S5PC100 CPU support
16 17
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 8c3abe521757..f60f2862856d 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,10 +11,11 @@ if ARCH_S5PV210
11 11
12config CPU_S5PV210 12config CPU_S5PV210
13 bool 13 bool
14 select ARM_AMBA
15 select PL330_DMA if DMADEVICES
14 select S5P_EXT_INT 16 select S5P_EXT_INT
15 select S5P_PM if PM 17 select S5P_PM if PM
16 select S5P_SLEEP if PM 18 select S5P_SLEEP if PM
17 select SAMSUNG_DMADEV
18 help 19 help
19 Enable S5PV210 CPU support 20 Enable S5PV210 CPU support
20 21
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index dbd954e61aa7..798073057e51 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -1,7 +1,7 @@
1config ARCH_SHMOBILE 1config ARCH_SHMOBILE
2 bool 2 bool
3 3
4config ARCH_SHMOBILE_MULTI 4menuconfig ARCH_SHMOBILE_MULTI
5 bool "Renesas ARM SoCs" if ARCH_MULTI_V7 5 bool "Renesas ARM SoCs" if ARCH_MULTI_V7
6 depends on MMU 6 depends on MMU
7 select ARCH_SHMOBILE 7 select ARCH_SHMOBILE
@@ -15,7 +15,7 @@ config ARCH_SHMOBILE_MULTI
15 15
16if ARCH_SHMOBILE_MULTI 16if ARCH_SHMOBILE_MULTI
17 17
18comment "Renesas ARM SoCs System Type" 18#comment "Renesas ARM SoCs System Type"
19 19
20config ARCH_EMEV2 20config ARCH_EMEV2
21 bool "Emma Mobile EV2" 21 bool "Emma Mobile EV2"
@@ -85,7 +85,6 @@ config ARCH_R8A73A4
85 select CPU_V7 85 select CPU_V7
86 select SH_CLK_CPG 86 select SH_CLK_CPG
87 select RENESAS_IRQC 87 select RENESAS_IRQC
88 select ARCH_HAS_CPUFREQ
89 select ARCH_HAS_OPP 88 select ARCH_HAS_OPP
90 select SYS_SUPPORTS_SH_CMT 89 select SYS_SUPPORTS_SH_CMT
91 select SYS_SUPPORTS_SH_TMU 90 select SYS_SUPPORTS_SH_TMU
@@ -264,7 +263,6 @@ config MACH_KOELSCH
264config MACH_KZM9G 263config MACH_KZM9G
265 bool "KZM-A9-GT board" 264 bool "KZM-A9-GT board"
266 depends on ARCH_SH73A0 265 depends on ARCH_SH73A0
267 select ARCH_HAS_CPUFREQ
268 select ARCH_HAS_OPP 266 select ARCH_HAS_OPP
269 select ARCH_REQUIRE_GPIOLIB 267 select ARCH_REQUIRE_GPIOLIB
270 select REGULATOR_FIXED_VOLTAGE if REGULATOR 268 select REGULATOR_FIXED_VOLTAGE if REGULATOR
diff --git a/arch/arm/mach-spear/Kconfig b/arch/arm/mach-spear/Kconfig
index 0786249b2832..90df2022276a 100644
--- a/arch/arm/mach-spear/Kconfig
+++ b/arch/arm/mach-spear/Kconfig
@@ -14,7 +14,6 @@ if PLAT_SPEAR
14config ARCH_SPEAR13XX 14config ARCH_SPEAR13XX
15 bool "ST SPEAr13xx" 15 bool "ST SPEAr13xx"
16 depends on ARCH_MULTI_V7 || PLAT_SPEAR_SINGLE 16 depends on ARCH_MULTI_V7 || PLAT_SPEAR_SINGLE
17 select ARCH_HAS_CPUFREQ
18 select ARM_GIC 17 select ARM_GIC
19 select GPIO_SPEAR_SPICS 18 select GPIO_SPEAR_SPICS
20 select HAVE_ARM_SCU if SMP 19 select HAVE_ARM_SCU if SMP
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig
index 1831e9611761..878e9ec97d0f 100644
--- a/arch/arm/mach-sti/Kconfig
+++ b/arch/arm/mach-sti/Kconfig
@@ -1,5 +1,5 @@
1menuconfig ARCH_STI 1menuconfig ARCH_STI
2 bool "STMicroelectronics Consumer Electronics SOCs with Device Trees" if ARCH_MULTI_V7 2 bool "STMicroelectronics Consumer Electronics SOCs" if ARCH_MULTI_V7
3 select ARM_GIC 3 select ARM_GIC
4 select ARM_GLOBAL_TIMER 4 select ARM_GLOBAL_TIMER
5 select PINCTRL 5 select PINCTRL
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index e16999e5b735..095399618ca5 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -1,6 +1,5 @@
1config ARCH_TEGRA 1menuconfig ARCH_TEGRA
2 bool "NVIDIA Tegra" if ARCH_MULTI_V7 2 bool "NVIDIA Tegra" if ARCH_MULTI_V7
3 select ARCH_HAS_CPUFREQ
4 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
5 select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS 4 select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
6 select ARM_GIC 5 select ARM_GIC
@@ -16,8 +15,7 @@ config ARCH_TEGRA
16 help 15 help
17 This enables support for NVIDIA Tegra based systems. 16 This enables support for NVIDIA Tegra based systems.
18 17
19menu "NVIDIA Tegra options" 18if ARCH_TEGRA
20 depends on ARCH_TEGRA
21 19
22config ARCH_TEGRA_2x_SOC 20config ARCH_TEGRA_2x_SOC
23 bool "Enable support for Tegra20 family" 21 bool "Enable support for Tegra20 family"
@@ -69,4 +67,4 @@ config TEGRA_AHB
69 which controls AHB bus master arbitration and some 67 which controls AHB bus master arbitration and some
70 performance parameters(priority, prefech size). 68 performance parameters(priority, prefech size).
71 69
72endmenu 70endif
diff --git a/arch/arm/mach-u300/Kconfig b/arch/arm/mach-u300/Kconfig
index e3a96d7302e9..bc51a71394af 100644
--- a/arch/arm/mach-u300/Kconfig
+++ b/arch/arm/mach-u300/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_U300 1menuconfig ARCH_U300
2 bool "ST-Ericsson U300 Series" if ARCH_MULTI_V5 2 bool "ST-Ericsson U300 Series" if ARCH_MULTI_V5
3 depends on MMU 3 depends on MMU
4 select ARCH_REQUIRE_GPIOLIB 4 select ARCH_REQUIRE_GPIOLIB
@@ -16,8 +16,6 @@ config ARCH_U300
16 16
17if ARCH_U300 17if ARCH_U300
18 18
19menu "ST-Ericsson AB U300/U335 Platform"
20
21config MACH_U300 19config MACH_U300
22 depends on ARCH_U300 20 depends on ARCH_U300
23 bool "U300" 21 bool "U300"
@@ -43,6 +41,4 @@ config MACH_U300_SPIDUMMY
43 you don't need it. Selecting this will activate the 41 you don't need it. Selecting this will activate the
44 SPI framework and ARM PL022 support. 42 SPI framework and ARM PL022 support.
45 43
46endmenu
47
48endif 44endif
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 86f537277383..699e8601dbf0 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -1,9 +1,8 @@
1config ARCH_U8500 1menuconfig ARCH_U8500
2 bool "ST-Ericsson U8500 Series" if ARCH_MULTI_V7 2 bool "ST-Ericsson U8500 Series" if ARCH_MULTI_V7
3 depends on MMU 3 depends on MMU
4 select AB8500_CORE 4 select AB8500_CORE
5 select ABX500_CORE 5 select ABX500_CORE
6 select ARCH_HAS_CPUFREQ
7 select ARCH_REQUIRE_GPIOLIB 6 select ARCH_REQUIRE_GPIOLIB
8 select ARM_AMBA 7 select ARM_AMBA
9 select ARM_ERRATA_754322 8 select ARM_ERRATA_754322
@@ -34,8 +33,6 @@ config UX500_SOC_DB8500
34 select REGULATOR 33 select REGULATOR
35 select REGULATOR_DB8500_PRCMU 34 select REGULATOR_DB8500_PRCMU
36 35
37menu "Ux500 target platform (boards)"
38
39config MACH_MOP500 36config MACH_MOP500
40 bool "U8500 Development platform, MOP500 versions" 37 bool "U8500 Development platform, MOP500 versions"
41 select I2C 38 select I2C
@@ -68,8 +65,6 @@ config UX500_AUTO_PLATFORM
68 a working kernel. If everything else is disabled, this 65 a working kernel. If everything else is disabled, this
69 automatically enables MACH_MOP500. 66 automatically enables MACH_MOP500.
70 67
71endmenu
72
73config UX500_DEBUG_UART 68config UX500_DEBUG_UART
74 int "Ux500 UART to use for low-level debug" 69 int "Ux500 UART to use for low-level debug"
75 default 2 70 default 2
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index a423de4724ab..d8b9330f896a 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -1,4 +1,4 @@
1config ARCH_VEXPRESS 1menuconfig ARCH_VEXPRESS
2 bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7 2 bool "ARM Ltd. Versatile Express family" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARCH_SUPPORTS_BIG_ENDIAN 4 select ARCH_SUPPORTS_BIG_ENDIAN
@@ -37,8 +37,7 @@ config ARCH_VEXPRESS
37 platforms. The traditional (ATAGs) boot method is not usable on 37 platforms. The traditional (ATAGs) boot method is not usable on
38 these boards with this option. 38 these boards with this option.
39 39
40menu "Versatile Express platform type" 40if ARCH_VEXPRESS
41 depends on ARCH_VEXPRESS
42 41
43config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA 42config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
44 bool "Enable A5 and A9 only errata work-arounds" 43 bool "Enable A5 and A9 only errata work-arounds"
@@ -65,7 +64,6 @@ config ARCH_VEXPRESS_DCSCB
65 64
66config ARCH_VEXPRESS_SPC 65config ARCH_VEXPRESS_SPC
67 bool "Versatile Express Serial Power Controller (SPC)" 66 bool "Versatile Express Serial Power Controller (SPC)"
68 select ARCH_HAS_CPUFREQ
69 select ARCH_HAS_OPP 67 select ARCH_HAS_OPP
70 select PM_OPP 68 select PM_OPP
71 help 69 help
@@ -83,4 +81,4 @@ config ARCH_VEXPRESS_TC2_PM
83 Support for CPU and cluster power management on Versatile Express 81 Support for CPU and cluster power management on Versatile Express
84 with a TC2 (A15x2 A7x3) big.LITTLE core tile. 82 with a TC2 (A15x2 A7x3) big.LITTLE core tile.
85 83
86endmenu 84endif
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig
index 08f56a41cb55..aaaa24fe4d71 100644
--- a/arch/arm/mach-vt8500/Kconfig
+++ b/arch/arm/mach-vt8500/Kconfig
@@ -1,6 +1,5 @@
1config ARCH_VT8500 1config ARCH_VT8500
2 bool 2 bool
3 select ARCH_HAS_CPUFREQ
4 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
5 select CLKDEV_LOOKUP 4 select CLKDEV_LOOKUP
6 select VT8500_TIMER 5 select VT8500_TIMER
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 573e0db1d0f0..0c164f81e72d 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -1,6 +1,5 @@
1config ARCH_ZYNQ 1config ARCH_ZYNQ
2 bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7 2 bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7
3 select ARCH_HAS_CPUFREQ
4 select ARCH_HAS_OPP 3 select ARCH_HAS_OPP
5 select ARCH_SUPPORTS_BIG_ENDIAN 4 select ARCH_SUPPORTS_BIG_ENDIAN
6 select ARM_AMBA 5 select ARM_AMBA
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 243dfcb2ca0e..301b892d97d9 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -35,27 +35,15 @@ config SAMSUNG_PM
35 Base platform power management code for samsung code 35 Base platform power management code for samsung code
36 36
37if PLAT_SAMSUNG 37if PLAT_SAMSUNG
38menu "Samsung Common options"
38 39
39# boot configurations 40# boot configurations
40 41
41comment "Boot options" 42comment "Boot options"
42 43
43config S3C_BOOT_ERROR_RESET
44 bool "S3C Reboot on decompression error"
45 help
46 Say y here to use the watchdog to reset the system if the
47 kernel decompressor detects an error during decompression.
48
49config S3C_BOOT_UART_FORCE_FIFO
50 bool "Force UART FIFO on during boot process"
51 default y
52 help
53 Say Y here to force the UART FIFOs on during the kernel
54 uncompressor
55
56
57config S3C_LOWLEVEL_UART_PORT 44config S3C_LOWLEVEL_UART_PORT
58 int "S3C UART to use for low-level messages" 45 int "S3C UART to use for low-level messages"
46 depends on ARCH_S3C64XX
59 default 0 47 default 0
60 help 48 help
61 Choice of which UART port to use for the low-level messages, 49 Choice of which UART port to use for the low-level messages,
@@ -407,17 +395,16 @@ config SAMSUNG_PM_GPIO
407 Include legacy GPIO power management code for platforms not using 395 Include legacy GPIO power management code for platforms not using
408 pinctrl-samsung driver. 396 pinctrl-samsung driver.
409 397
410endif
411
412config SAMSUNG_DMADEV 398config SAMSUNG_DMADEV
413 bool 399 bool "Use legacy Samsung DMA abstraction"
414 select ARM_AMBA 400 depends on CPU_S5PV210 || CPU_S5PC100 || ARCH_S5P64X0 || ARCH_S3C64XX
415 select DMADEVICES 401 select DMADEVICES
416 select PL330_DMA if (ARCH_EXYNOS5 || ARCH_EXYNOS4 || CPU_S5PV210 || CPU_S5PC100 || \ 402 default y
417 CPU_S5P6450 || CPU_S5P6440)
418 help 403 help
419 Use DMA device engine for PL330 DMAC. 404 Use DMA device engine for PL330 DMAC.
420 405
406endif
407
421config S5P_DEV_MFC 408config S5P_DEV_MFC
422 bool 409 bool
423 help 410 help
@@ -503,4 +490,5 @@ config DEBUG_S3C_UART
503 default "2" if DEBUG_S3C_UART2 490 default "2" if DEBUG_S3C_UART2
504 default "3" if DEBUG_S3C_UART3 491 default "3" if DEBUG_S3C_UART3
505 492
493endmenu
506endif 494endif
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7295419165e1..a474de346be6 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1,8 +1,9 @@
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_USE_CMPXCHG_LOCKREF 4 select ARCH_HAS_OPP
5 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 5 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
6 select ARCH_USE_CMPXCHG_LOCKREF
6 select ARCH_WANT_OPTIONAL_GPIOLIB 7 select ARCH_WANT_OPTIONAL_GPIOLIB
7 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION 8 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
8 select ARCH_WANT_FRAME_POINTERS 9 select ARCH_WANT_FRAME_POINTERS
diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts
index 1247ca1200b1..6541962f5d70 100644
--- a/arch/arm64/boot/dts/apm-mustang.dts
+++ b/arch/arm64/boot/dts/apm-mustang.dts
@@ -24,3 +24,7 @@
24 reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */ 24 reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */
25 }; 25 };
26}; 26};
27
28&serial0 {
29 status = "ok";
30};
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
index c5f0a47a1375..40aa96ce13c4 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -273,8 +273,9 @@
273 }; 273 };
274 274
275 serial0: serial@1c020000 { 275 serial0: serial@1c020000 {
276 status = "disabled";
276 device_type = "serial"; 277 device_type = "serial";
277 compatible = "ns16550"; 278 compatible = "ns16550a";
278 reg = <0 0x1c020000 0x0 0x1000>; 279 reg = <0 0x1c020000 0x0 0x1000>;
279 reg-shift = <2>; 280 reg-shift = <2>;
280 clock-frequency = <10000000>; /* Updated by bootloader */ 281 clock-frequency = <10000000>; /* Updated by bootloader */
@@ -282,6 +283,39 @@
282 interrupts = <0x0 0x4c 0x4>; 283 interrupts = <0x0 0x4c 0x4>;
283 }; 284 };
284 285
286 serial1: serial@1c021000 {
287 status = "disabled";
288 device_type = "serial";
289 compatible = "ns16550a";
290 reg = <0 0x1c021000 0x0 0x1000>;
291 reg-shift = <2>;
292 clock-frequency = <10000000>; /* Updated by bootloader */
293 interrupt-parent = <&gic>;
294 interrupts = <0x0 0x4d 0x4>;
295 };
296
297 serial2: serial@1c022000 {
298 status = "disabled";
299 device_type = "serial";
300 compatible = "ns16550a";
301 reg = <0 0x1c022000 0x0 0x1000>;
302 reg-shift = <2>;
303 clock-frequency = <10000000>; /* Updated by bootloader */
304 interrupt-parent = <&gic>;
305 interrupts = <0x0 0x4e 0x4>;
306 };
307
308 serial3: serial@1c023000 {
309 status = "disabled";
310 device_type = "serial";
311 compatible = "ns16550a";
312 reg = <0 0x1c023000 0x0 0x1000>;
313 reg-shift = <2>;
314 clock-frequency = <10000000>; /* Updated by bootloader */
315 interrupt-parent = <&gic>;
316 interrupts = <0x0 0x4f 0x4>;
317 };
318
285 phy1: phy@1f21a000 { 319 phy1: phy@1f21a000 {
286 compatible = "apm,xgene-phy"; 320 compatible = "apm,xgene-phy";
287 reg = <0x0 0x1f21a000 0x0 0x100>; 321 reg = <0x0 0x1f21a000 0x0 0x100>;
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 157e1d8d9a47..3421f316f5dc 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -6,9 +6,18 @@ CONFIG_NO_HZ_IDLE=y
6CONFIG_HIGH_RES_TIMERS=y 6CONFIG_HIGH_RES_TIMERS=y
7CONFIG_BSD_PROCESS_ACCT=y 7CONFIG_BSD_PROCESS_ACCT=y
8CONFIG_BSD_PROCESS_ACCT_V3=y 8CONFIG_BSD_PROCESS_ACCT_V3=y
9CONFIG_TASKSTATS=y
10CONFIG_TASK_DELAY_ACCT=y
11CONFIG_TASK_XACCT=y
12CONFIG_TASK_IO_ACCOUNTING=y
9CONFIG_IKCONFIG=y 13CONFIG_IKCONFIG=y
10CONFIG_IKCONFIG_PROC=y 14CONFIG_IKCONFIG_PROC=y
11CONFIG_LOG_BUF_SHIFT=14 15CONFIG_LOG_BUF_SHIFT=14
16CONFIG_RESOURCE_COUNTERS=y
17CONFIG_MEMCG=y
18CONFIG_MEMCG_SWAP=y
19CONFIG_MEMCG_KMEM=y
20CONFIG_CGROUP_HUGETLB=y
12# CONFIG_UTS_NS is not set 21# CONFIG_UTS_NS is not set
13# CONFIG_IPC_NS is not set 22# CONFIG_IPC_NS is not set
14# CONFIG_PID_NS is not set 23# CONFIG_PID_NS is not set
@@ -27,6 +36,7 @@ CONFIG_ARCH_VEXPRESS=y
27CONFIG_ARCH_XGENE=y 36CONFIG_ARCH_XGENE=y
28CONFIG_SMP=y 37CONFIG_SMP=y
29CONFIG_PREEMPT=y 38CONFIG_PREEMPT=y
39CONFIG_KSM=y
30CONFIG_TRANSPARENT_HUGEPAGE=y 40CONFIG_TRANSPARENT_HUGEPAGE=y
31CONFIG_CMA=y 41CONFIG_CMA=y
32CONFIG_CMDLINE="console=ttyAMA0" 42CONFIG_CMDLINE="console=ttyAMA0"
@@ -45,6 +55,7 @@ CONFIG_IP_PNP_BOOTP=y
45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 55CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
46CONFIG_DEVTMPFS=y 56CONFIG_DEVTMPFS=y
47CONFIG_DMA_CMA=y 57CONFIG_DMA_CMA=y
58CONFIG_BLK_DEV_LOOP=y
48CONFIG_VIRTIO_BLK=y 59CONFIG_VIRTIO_BLK=y
49# CONFIG_SCSI_PROC_FS is not set 60# CONFIG_SCSI_PROC_FS is not set
50CONFIG_BLK_DEV_SD=y 61CONFIG_BLK_DEV_SD=y
@@ -53,6 +64,7 @@ CONFIG_ATA=y
53CONFIG_PATA_PLATFORM=y 64CONFIG_PATA_PLATFORM=y
54CONFIG_PATA_OF_PLATFORM=y 65CONFIG_PATA_OF_PLATFORM=y
55CONFIG_NETDEVICES=y 66CONFIG_NETDEVICES=y
67CONFIG_TUN=y
56CONFIG_SMC91X=y 68CONFIG_SMC91X=y
57CONFIG_SMSC911X=y 69CONFIG_SMSC911X=y
58# CONFIG_WLAN is not set 70# CONFIG_WLAN is not set
@@ -85,6 +97,8 @@ CONFIG_EXT3_FS=y
85# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 97# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
86# CONFIG_EXT3_FS_XATTR is not set 98# CONFIG_EXT3_FS_XATTR is not set
87CONFIG_EXT4_FS=y 99CONFIG_EXT4_FS=y
100CONFIG_FANOTIFY=y
101CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
88CONFIG_FUSE_FS=y 102CONFIG_FUSE_FS=y
89CONFIG_CUSE=y 103CONFIG_CUSE=y
90CONFIG_VFAT_FS=y 104CONFIG_VFAT_FS=y
@@ -104,6 +118,7 @@ CONFIG_DEBUG_KERNEL=y
104CONFIG_LOCKUP_DETECTOR=y 118CONFIG_LOCKUP_DETECTOR=y
105# CONFIG_SCHED_DEBUG is not set 119# CONFIG_SCHED_DEBUG is not set
106# CONFIG_FTRACE is not set 120# CONFIG_FTRACE is not set
121CONFIG_SECURITY=y
107CONFIG_CRYPTO_ANSI_CPRNG=y 122CONFIG_CRYPTO_ANSI_CPRNG=y
108CONFIG_ARM64_CRYPTO=y 123CONFIG_ARM64_CRYPTO=y
109CONFIG_CRYPTO_SHA1_ARM64_CE=y 124CONFIG_CRYPTO_SHA1_ARM64_CE=y
diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S
index b9e6eaf41c9b..dc457015884e 100644
--- a/arch/arm64/crypto/ghash-ce-core.S
+++ b/arch/arm64/crypto/ghash-ce-core.S
@@ -3,14 +3,6 @@
3 * 3 *
4 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org> 4 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
5 * 5 *
6 * Based on arch/x86/crypto/ghash-pmullni-intel_asm.S
7 *
8 * Copyright (c) 2009 Intel Corp.
9 * Author: Huang Ying <ying.huang@intel.com>
10 * Vinodh Gopal
11 * Erdinc Ozturk
12 * Deniz Karakoyunlu
13 *
14 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License version 2 as published 7 * under the terms of the GNU General Public License version 2 as published
16 * by the Free Software Foundation. 8 * by the Free Software Foundation.
@@ -19,13 +11,15 @@
19#include <linux/linkage.h> 11#include <linux/linkage.h>
20#include <asm/assembler.h> 12#include <asm/assembler.h>
21 13
22 DATA .req v0 14 SHASH .req v0
23 SHASH .req v1 15 SHASH2 .req v1
24 IN1 .req v2
25 T1 .req v2 16 T1 .req v2
26 T2 .req v3 17 T2 .req v3
27 T3 .req v4 18 MASK .req v4
28 VZR .req v5 19 XL .req v5
20 XM .req v6
21 XH .req v7
22 IN1 .req v7
29 23
30 .text 24 .text
31 .arch armv8-a+crypto 25 .arch armv8-a+crypto
@@ -35,61 +29,51 @@
35 * struct ghash_key const *k, const char *head) 29 * struct ghash_key const *k, const char *head)
36 */ 30 */
37ENTRY(pmull_ghash_update) 31ENTRY(pmull_ghash_update)
38 ld1 {DATA.16b}, [x1]
39 ld1 {SHASH.16b}, [x3] 32 ld1 {SHASH.16b}, [x3]
40 eor VZR.16b, VZR.16b, VZR.16b 33 ld1 {XL.16b}, [x1]
34 movi MASK.16b, #0xe1
35 ext SHASH2.16b, SHASH.16b, SHASH.16b, #8
36 shl MASK.2d, MASK.2d, #57
37 eor SHASH2.16b, SHASH2.16b, SHASH.16b
41 38
42 /* do the head block first, if supplied */ 39 /* do the head block first, if supplied */
43 cbz x4, 0f 40 cbz x4, 0f
44 ld1 {IN1.2d}, [x4] 41 ld1 {T1.2d}, [x4]
45 b 1f 42 b 1f
46 43
470: ld1 {IN1.2d}, [x2], #16 440: ld1 {T1.2d}, [x2], #16
48 sub w0, w0, #1 45 sub w0, w0, #1
491: ext IN1.16b, IN1.16b, IN1.16b, #8
50CPU_LE( rev64 IN1.16b, IN1.16b )
51 eor DATA.16b, DATA.16b, IN1.16b
52 46
53 /* multiply DATA by SHASH in GF(2^128) */ 471: /* multiply XL by SHASH in GF(2^128) */
54 ext T2.16b, DATA.16b, DATA.16b, #8 48CPU_LE( rev64 T1.16b, T1.16b )
55 ext T3.16b, SHASH.16b, SHASH.16b, #8
56 eor T2.16b, T2.16b, DATA.16b
57 eor T3.16b, T3.16b, SHASH.16b
58 49
59 pmull2 T1.1q, SHASH.2d, DATA.2d // a1 * b1 50 ext T2.16b, XL.16b, XL.16b, #8
60 pmull DATA.1q, SHASH.1d, DATA.1d // a0 * b0 51 ext IN1.16b, T1.16b, T1.16b, #8
61 pmull T2.1q, T2.1d, T3.1d // (a1 + a0)(b1 + b0) 52 eor T1.16b, T1.16b, T2.16b
62 eor T2.16b, T2.16b, T1.16b // (a0 * b1) + (a1 * b0) 53 eor XL.16b, XL.16b, IN1.16b
63 eor T2.16b, T2.16b, DATA.16b
64 54
65 ext T3.16b, VZR.16b, T2.16b, #8 55 pmull2 XH.1q, SHASH.2d, XL.2d // a1 * b1
66 ext T2.16b, T2.16b, VZR.16b, #8 56 eor T1.16b, T1.16b, XL.16b
67 eor DATA.16b, DATA.16b, T3.16b 57 pmull XL.1q, SHASH.1d, XL.1d // a0 * b0
68 eor T1.16b, T1.16b, T2.16b // <T1:DATA> is result of 58 pmull XM.1q, SHASH2.1d, T1.1d // (a1 + a0)(b1 + b0)
69 // carry-less multiplication
70 59
71 /* first phase of the reduction */ 60 ext T1.16b, XL.16b, XH.16b, #8
72 shl T3.2d, DATA.2d, #1 61 eor T2.16b, XL.16b, XH.16b
73 eor T3.16b, T3.16b, DATA.16b 62 eor XM.16b, XM.16b, T1.16b
74 shl T3.2d, T3.2d, #5 63 eor XM.16b, XM.16b, T2.16b
75 eor T3.16b, T3.16b, DATA.16b 64 pmull T2.1q, XL.1d, MASK.1d
76 shl T3.2d, T3.2d, #57
77 ext T2.16b, VZR.16b, T3.16b, #8
78 ext T3.16b, T3.16b, VZR.16b, #8
79 eor DATA.16b, DATA.16b, T2.16b
80 eor T1.16b, T1.16b, T3.16b
81 65
82 /* second phase of the reduction */ 66 mov XH.d[0], XM.d[1]
83 ushr T2.2d, DATA.2d, #5 67 mov XM.d[1], XL.d[0]
84 eor T2.16b, T2.16b, DATA.16b 68
85 ushr T2.2d, T2.2d, #1 69 eor XL.16b, XM.16b, T2.16b
86 eor T2.16b, T2.16b, DATA.16b 70 ext T2.16b, XL.16b, XL.16b, #8
87 ushr T2.2d, T2.2d, #1 71 pmull XL.1q, XL.1d, MASK.1d
88 eor T1.16b, T1.16b, T2.16b 72 eor T2.16b, T2.16b, XH.16b
89 eor DATA.16b, DATA.16b, T1.16b 73 eor XL.16b, XL.16b, T2.16b
90 74
91 cbnz w0, 0b 75 cbnz w0, 0b
92 76
93 st1 {DATA.16b}, [x1] 77 st1 {XL.16b}, [x1]
94 ret 78 ret
95ENDPROC(pmull_ghash_update) 79ENDPROC(pmull_ghash_update)
diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
index b92baf3f68c7..833ec1e3f3e9 100644
--- a/arch/arm64/crypto/ghash-ce-glue.c
+++ b/arch/arm64/crypto/ghash-ce-glue.c
@@ -67,11 +67,12 @@ static int ghash_update(struct shash_desc *desc, const u8 *src,
67 blocks = len / GHASH_BLOCK_SIZE; 67 blocks = len / GHASH_BLOCK_SIZE;
68 len %= GHASH_BLOCK_SIZE; 68 len %= GHASH_BLOCK_SIZE;
69 69
70 kernel_neon_begin_partial(6); 70 kernel_neon_begin_partial(8);
71 pmull_ghash_update(blocks, ctx->digest, src, key, 71 pmull_ghash_update(blocks, ctx->digest, src, key,
72 partial ? ctx->buf : NULL); 72 partial ? ctx->buf : NULL);
73 kernel_neon_end(); 73 kernel_neon_end();
74 src += blocks * GHASH_BLOCK_SIZE; 74 src += blocks * GHASH_BLOCK_SIZE;
75 partial = 0;
75 } 76 }
76 if (len) 77 if (len)
77 memcpy(ctx->buf + partial, src, len); 78 memcpy(ctx->buf + partial, src, len);
@@ -88,7 +89,7 @@ static int ghash_final(struct shash_desc *desc, u8 *dst)
88 89
89 memset(ctx->buf + partial, 0, GHASH_BLOCK_SIZE - partial); 90 memset(ctx->buf + partial, 0, GHASH_BLOCK_SIZE - partial);
90 91
91 kernel_neon_begin_partial(6); 92 kernel_neon_begin_partial(8);
92 pmull_ghash_update(1, ctx->digest, ctx->buf, key, NULL); 93 pmull_ghash_update(1, ctx->digest, ctx->buf, key, NULL);
93 kernel_neon_end(); 94 kernel_neon_end();
94 } 95 }
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 42c7eecd2bb6..0b3fcf86e6ba 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -30,7 +30,6 @@ generic-y += msgbuf.h
30generic-y += mutex.h 30generic-y += mutex.h
31generic-y += pci.h 31generic-y += pci.h
32generic-y += poll.h 32generic-y += poll.h
33generic-y += posix_types.h
34generic-y += preempt.h 33generic-y += preempt.h
35generic-y += resource.h 34generic-y += resource.h
36generic-y += rwsem.h 35generic-y += rwsem.h
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index 3a4572ec3273..dc82e52acdb3 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -26,8 +26,6 @@
26#include <xen/xen.h> 26#include <xen/xen.h>
27#include <asm/xen/hypervisor.h> 27#include <asm/xen/hypervisor.h>
28 28
29#define ARCH_HAS_DMA_GET_REQUIRED_MASK
30
31#define DMA_ERROR_CODE (~(dma_addr_t)0) 29#define DMA_ERROR_CODE (~(dma_addr_t)0)
32extern struct dma_map_ops *dma_ops; 30extern struct dma_map_ops *dma_ops;
33extern struct dma_map_ops coherent_swiotlb_dma_ops; 31extern struct dma_map_ops coherent_swiotlb_dma_ops;
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 598cc384fc1c..579702086488 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -246,7 +246,7 @@ static inline pmd_t pte_pmd(pte_t pte)
246#define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd))) 246#define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd)))
247#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd))) 247#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd)))
248#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd))) 248#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))
249#define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) &= ~PMD_TYPE_MASK)) 249#define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) & ~PMD_TYPE_MASK))
250 250
251#define __HAVE_ARCH_PMD_WRITE 251#define __HAVE_ARCH_PMD_WRITE
252#define pmd_write(pmd) pte_write(pmd_pte(pmd)) 252#define pmd_write(pmd) pte_write(pmd_pte(pmd))
diff --git a/arch/arm64/include/uapi/asm/posix_types.h b/arch/arm64/include/uapi/asm/posix_types.h
new file mode 100644
index 000000000000..7985ff60ca3f
--- /dev/null
+++ b/arch/arm64/include/uapi/asm/posix_types.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_POSIX_TYPES_H
2#define __ASM_POSIX_TYPES_H
3
4typedef unsigned short __kernel_old_uid_t;
5typedef unsigned short __kernel_old_gid_t;
6#define __kernel_old_uid_t __kernel_old_uid_t
7
8#include <asm-generic/posix_types.h>
9
10#endif /* __ASM_POSIX_TYPES_H */
diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h
index b72cf405b3fe..ee469be1ae1d 100644
--- a/arch/arm64/include/uapi/asm/sigcontext.h
+++ b/arch/arm64/include/uapi/asm/sigcontext.h
@@ -58,7 +58,7 @@ struct fpsimd_context {
58 58
59struct esr_context { 59struct esr_context {
60 struct _aarch64_ctx head; 60 struct _aarch64_ctx head;
61 u64 esr; 61 __u64 esr;
62}; 62};
63 63
64#endif /* _UAPI__ASM_SIGCONTEXT_H */ 64#endif /* _UAPI__ASM_SIGCONTEXT_H */
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index b051871f2965..aa5f9fcbf9ee 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -205,7 +205,7 @@ ENDPROC(ftrace_graph_caller)
205 * 205 *
206 * Run ftrace_return_to_handler() before going back to parent. 206 * Run ftrace_return_to_handler() before going back to parent.
207 * @fp is checked against the value passed by ftrace_graph_caller() 207 * @fp is checked against the value passed by ftrace_graph_caller()
208 * only when CONFIG_FUNCTION_GRAPH_FP_TEST is enabled. 208 * only when CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST is enabled.
209 */ 209 */
210ENTRY(return_to_handler) 210ENTRY(return_to_handler)
211 str x0, [sp, #-16]! 211 str x0, [sp, #-16]!
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index bf017f4ffb4f..9ce04ba6bcb0 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -279,7 +279,6 @@ el1_sp_pc:
279 */ 279 */
280 mrs x0, far_el1 280 mrs x0, far_el1
281 enable_dbg 281 enable_dbg
282 mov x1, x25
283 mov x2, sp 282 mov x2, sp
284 b do_sp_pc_abort 283 b do_sp_pc_abort
285el1_undef: 284el1_undef:
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 3e926b9c0641..9fde010c945f 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -655,11 +655,16 @@ static int compat_gpr_get(struct task_struct *target,
655 reg = task_pt_regs(target)->regs[idx]; 655 reg = task_pt_regs(target)->regs[idx];
656 } 656 }
657 657
658 ret = copy_to_user(ubuf, &reg, sizeof(reg)); 658 if (kbuf) {
659 if (ret) 659 memcpy(kbuf, &reg, sizeof(reg));
660 break; 660 kbuf += sizeof(reg);
661 661 } else {
662 ubuf += sizeof(reg); 662 ret = copy_to_user(ubuf, &reg, sizeof(reg));
663 if (ret)
664 break;
665
666 ubuf += sizeof(reg);
667 }
663 } 668 }
664 669
665 return ret; 670 return ret;
@@ -689,11 +694,16 @@ static int compat_gpr_set(struct task_struct *target,
689 unsigned int idx = start + i; 694 unsigned int idx = start + i;
690 compat_ulong_t reg; 695 compat_ulong_t reg;
691 696
692 ret = copy_from_user(&reg, ubuf, sizeof(reg)); 697 if (kbuf) {
693 if (ret) 698 memcpy(&reg, kbuf, sizeof(reg));
694 return ret; 699 kbuf += sizeof(reg);
700 } else {
701 ret = copy_from_user(&reg, ubuf, sizeof(reg));
702 if (ret)
703 return ret;
695 704
696 ubuf += sizeof(reg); 705 ubuf += sizeof(reg);
706 }
697 707
698 switch (idx) { 708 switch (idx) {
699 case 15: 709 case 15:
@@ -827,6 +837,7 @@ static int compat_ptrace_write_user(struct task_struct *tsk, compat_ulong_t off,
827 compat_ulong_t val) 837 compat_ulong_t val)
828{ 838{
829 int ret; 839 int ret;
840 mm_segment_t old_fs = get_fs();
830 841
831 if (off & 3 || off >= COMPAT_USER_SZ) 842 if (off & 3 || off >= COMPAT_USER_SZ)
832 return -EIO; 843 return -EIO;
@@ -834,10 +845,13 @@ static int compat_ptrace_write_user(struct task_struct *tsk, compat_ulong_t off,
834 if (off >= sizeof(compat_elf_gregset_t)) 845 if (off >= sizeof(compat_elf_gregset_t))
835 return 0; 846 return 0;
836 847
848 set_fs(KERNEL_DS);
837 ret = copy_regset_from_user(tsk, &user_aarch32_view, 849 ret = copy_regset_from_user(tsk, &user_aarch32_view,
838 REGSET_COMPAT_GPR, off, 850 REGSET_COMPAT_GPR, off,
839 sizeof(compat_ulong_t), 851 sizeof(compat_ulong_t),
840 &val); 852 &val);
853 set_fs(old_fs);
854
841 return ret; 855 return ret;
842} 856}
843 857
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 091d428d64ac..f43db8a69262 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -71,7 +71,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
71 /* 4GB maximum for 32-bit only capable devices */ 71 /* 4GB maximum for 32-bit only capable devices */
72 if (IS_ENABLED(CONFIG_ZONE_DMA)) { 72 if (IS_ENABLED(CONFIG_ZONE_DMA)) {
73 unsigned long max_dma_phys = 73 unsigned long max_dma_phys =
74 (unsigned long)dma_to_phys(NULL, DMA_BIT_MASK(32) + 1); 74 (unsigned long)(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1);
75 max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); 75 max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT));
76 zone_size[ZONE_DMA] = max_dma - min; 76 zone_size[ZONE_DMA] = max_dma - min;
77 } 77 }
@@ -126,6 +126,8 @@ static void arm64_memory_present(void)
126 126
127void __init arm64_memblock_init(void) 127void __init arm64_memblock_init(void)
128{ 128{
129 phys_addr_t dma_phys_limit = 0;
130
129 /* Register the kernel text, kernel data and initrd with memblock */ 131 /* Register the kernel text, kernel data and initrd with memblock */
130 memblock_reserve(__pa(_text), _end - _text); 132 memblock_reserve(__pa(_text), _end - _text);
131#ifdef CONFIG_BLK_DEV_INITRD 133#ifdef CONFIG_BLK_DEV_INITRD
@@ -141,7 +143,11 @@ void __init arm64_memblock_init(void)
141 memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE); 143 memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE);
142 144
143 early_init_fdt_scan_reserved_mem(); 145 early_init_fdt_scan_reserved_mem();
144 dma_contiguous_reserve(0); 146
147 /* 4GB maximum for 32-bit only capable devices */
148 if (IS_ENABLED(CONFIG_ZONE_DMA))
149 dma_phys_limit = dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1;
150 dma_contiguous_reserve(dma_phys_limit);
145 151
146 memblock_allow_resize(); 152 memblock_allow_resize();
147 memblock_dump_all(); 153 memblock_dump_all();
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 1a871b78e570..344387a55406 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -242,7 +242,7 @@ struct ioc {
242 struct pci_dev *sac_only_dev; 242 struct pci_dev *sac_only_dev;
243}; 243};
244 244
245static struct ioc *ioc_list; 245static struct ioc *ioc_list, *ioc_found;
246static int reserve_sba_gart = 1; 246static int reserve_sba_gart = 1;
247 247
248static SBA_INLINE void sba_mark_invalid(struct ioc *, dma_addr_t, size_t); 248static SBA_INLINE void sba_mark_invalid(struct ioc *, dma_addr_t, size_t);
@@ -1809,20 +1809,13 @@ static struct ioc_iommu ioc_iommu_info[] __initdata = {
1809 { SX2000_IOC_ID, "sx2000", NULL }, 1809 { SX2000_IOC_ID, "sx2000", NULL },
1810}; 1810};
1811 1811
1812static struct ioc * 1812static void ioc_init(unsigned long hpa, struct ioc *ioc)
1813ioc_init(unsigned long hpa, void *handle)
1814{ 1813{
1815 struct ioc *ioc;
1816 struct ioc_iommu *info; 1814 struct ioc_iommu *info;
1817 1815
1818 ioc = kzalloc(sizeof(*ioc), GFP_KERNEL);
1819 if (!ioc)
1820 return NULL;
1821
1822 ioc->next = ioc_list; 1816 ioc->next = ioc_list;
1823 ioc_list = ioc; 1817 ioc_list = ioc;
1824 1818
1825 ioc->handle = handle;
1826 ioc->ioc_hpa = ioremap(hpa, 0x1000); 1819 ioc->ioc_hpa = ioremap(hpa, 0x1000);
1827 1820
1828 ioc->func_id = READ_REG(ioc->ioc_hpa + IOC_FUNC_ID); 1821 ioc->func_id = READ_REG(ioc->ioc_hpa + IOC_FUNC_ID);
@@ -1863,8 +1856,6 @@ ioc_init(unsigned long hpa, void *handle)
1863 "%s %d.%d HPA 0x%lx IOVA space %dMb at 0x%lx\n", 1856 "%s %d.%d HPA 0x%lx IOVA space %dMb at 0x%lx\n",
1864 ioc->name, (ioc->rev >> 4) & 0xF, ioc->rev & 0xF, 1857 ioc->name, (ioc->rev >> 4) & 0xF, ioc->rev & 0xF,
1865 hpa, ioc->iov_size >> 20, ioc->ibase); 1858 hpa, ioc->iov_size >> 20, ioc->ibase);
1866
1867 return ioc;
1868} 1859}
1869 1860
1870 1861
@@ -2031,22 +2022,21 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
2031#endif 2022#endif
2032} 2023}
2033 2024
2034static int 2025static void acpi_sba_ioc_add(struct ioc *ioc)
2035acpi_sba_ioc_add(struct acpi_device *device,
2036 const struct acpi_device_id *not_used)
2037{ 2026{
2038 struct ioc *ioc; 2027 acpi_handle handle = ioc->handle;
2039 acpi_status status; 2028 acpi_status status;
2040 u64 hpa, length; 2029 u64 hpa, length;
2041 struct acpi_device_info *adi; 2030 struct acpi_device_info *adi;
2042 2031
2043 status = hp_acpi_csr_space(device->handle, &hpa, &length); 2032 ioc_found = ioc->next;
2033 status = hp_acpi_csr_space(handle, &hpa, &length);
2044 if (ACPI_FAILURE(status)) 2034 if (ACPI_FAILURE(status))
2045 return 1; 2035 goto err;
2046 2036
2047 status = acpi_get_object_info(device->handle, &adi); 2037 status = acpi_get_object_info(handle, &adi);
2048 if (ACPI_FAILURE(status)) 2038 if (ACPI_FAILURE(status))
2049 return 1; 2039 goto err;
2050 2040
2051 /* 2041 /*
2052 * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI 2042 * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI
@@ -2067,13 +2057,13 @@ acpi_sba_ioc_add(struct acpi_device *device,
2067 if (!iovp_shift) 2057 if (!iovp_shift)
2068 iovp_shift = 12; 2058 iovp_shift = 12;
2069 2059
2070 ioc = ioc_init(hpa, device->handle); 2060 ioc_init(hpa, ioc);
2071 if (!ioc)
2072 return 1;
2073
2074 /* setup NUMA node association */ 2061 /* setup NUMA node association */
2075 sba_map_ioc_to_node(ioc, device->handle); 2062 sba_map_ioc_to_node(ioc, handle);
2076 return 0; 2063 return;
2064
2065 err:
2066 kfree(ioc);
2077} 2067}
2078 2068
2079static const struct acpi_device_id hp_ioc_iommu_device_ids[] = { 2069static const struct acpi_device_id hp_ioc_iommu_device_ids[] = {
@@ -2081,9 +2071,26 @@ static const struct acpi_device_id hp_ioc_iommu_device_ids[] = {
2081 {"HWP0004", 0}, 2071 {"HWP0004", 0},
2082 {"", 0}, 2072 {"", 0},
2083}; 2073};
2074
2075static int acpi_sba_ioc_attach(struct acpi_device *device,
2076 const struct acpi_device_id *not_used)
2077{
2078 struct ioc *ioc;
2079
2080 ioc = kzalloc(sizeof(*ioc), GFP_KERNEL);
2081 if (!ioc)
2082 return -ENOMEM;
2083
2084 ioc->next = ioc_found;
2085 ioc_found = ioc;
2086 ioc->handle = device->handle;
2087 return 1;
2088}
2089
2090
2084static struct acpi_scan_handler acpi_sba_ioc_handler = { 2091static struct acpi_scan_handler acpi_sba_ioc_handler = {
2085 .ids = hp_ioc_iommu_device_ids, 2092 .ids = hp_ioc_iommu_device_ids,
2086 .attach = acpi_sba_ioc_add, 2093 .attach = acpi_sba_ioc_attach,
2087}; 2094};
2088 2095
2089static int __init acpi_sba_ioc_init_acpi(void) 2096static int __init acpi_sba_ioc_init_acpi(void)
@@ -2118,9 +2125,12 @@ sba_init(void)
2118#endif 2125#endif
2119 2126
2120 /* 2127 /*
2121 * ioc_list should be populated by the acpi_sba_ioc_handler's .attach() 2128 * ioc_found should be populated by the acpi_sba_ioc_handler's .attach()
2122 * routine, but that only happens if acpi_scan_init() has already run. 2129 * routine, but that only happens if acpi_scan_init() has already run.
2123 */ 2130 */
2131 while (ioc_found)
2132 acpi_sba_ioc_add(ioc_found);
2133
2124 if (!ioc_list) { 2134 if (!ioc_list) {
2125#ifdef CONFIG_IA64_GENERIC 2135#ifdef CONFIG_IA64_GENERIC
2126 /* 2136 /*
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
index 8df022c43af7..fd09a10a2b53 100644
--- a/arch/s390/configs/default_defconfig
+++ b/arch/s390/configs/default_defconfig
@@ -45,7 +45,8 @@ CONFIG_SOLARIS_X86_PARTITION=y
45CONFIG_UNIXWARE_DISKLABEL=y 45CONFIG_UNIXWARE_DISKLABEL=y
46CONFIG_CFQ_GROUP_IOSCHED=y 46CONFIG_CFQ_GROUP_IOSCHED=y
47CONFIG_DEFAULT_DEADLINE=y 47CONFIG_DEFAULT_DEADLINE=y
48CONFIG_MARCH_Z9_109=y 48CONFIG_MARCH_Z196=y
49CONFIG_TUNE_ZEC12=y
49CONFIG_NR_CPUS=256 50CONFIG_NR_CPUS=256
50CONFIG_PREEMPT=y 51CONFIG_PREEMPT=y
51CONFIG_HZ_100=y 52CONFIG_HZ_100=y
@@ -240,7 +241,6 @@ CONFIG_IP_VS_PE_SIP=m
240CONFIG_NF_CONNTRACK_IPV4=m 241CONFIG_NF_CONNTRACK_IPV4=m
241# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set 242# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
242CONFIG_NF_TABLES_IPV4=m 243CONFIG_NF_TABLES_IPV4=m
243CONFIG_NFT_REJECT_IPV4=m
244CONFIG_NFT_CHAIN_ROUTE_IPV4=m 244CONFIG_NFT_CHAIN_ROUTE_IPV4=m
245CONFIG_NFT_CHAIN_NAT_IPV4=m 245CONFIG_NFT_CHAIN_NAT_IPV4=m
246CONFIG_NF_TABLES_ARP=m 246CONFIG_NF_TABLES_ARP=m
@@ -456,6 +456,7 @@ CONFIG_TN3270_FS=y
456CONFIG_WATCHDOG=y 456CONFIG_WATCHDOG=y
457CONFIG_WATCHDOG_NOWAYOUT=y 457CONFIG_WATCHDOG_NOWAYOUT=y
458CONFIG_SOFT_WATCHDOG=m 458CONFIG_SOFT_WATCHDOG=m
459CONFIG_DIAG288_WATCHDOG=m
459# CONFIG_HID is not set 460# CONFIG_HID is not set
460# CONFIG_USB_SUPPORT is not set 461# CONFIG_USB_SUPPORT is not set
461CONFIG_INFINIBAND=m 462CONFIG_INFINIBAND=m
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
index c81a74e3e25a..b061180d3544 100644
--- a/arch/s390/configs/gcov_defconfig
+++ b/arch/s390/configs/gcov_defconfig
@@ -45,7 +45,8 @@ CONFIG_SOLARIS_X86_PARTITION=y
45CONFIG_UNIXWARE_DISKLABEL=y 45CONFIG_UNIXWARE_DISKLABEL=y
46CONFIG_CFQ_GROUP_IOSCHED=y 46CONFIG_CFQ_GROUP_IOSCHED=y
47CONFIG_DEFAULT_DEADLINE=y 47CONFIG_DEFAULT_DEADLINE=y
48CONFIG_MARCH_Z9_109=y 48CONFIG_MARCH_Z196=y
49CONFIG_TUNE_ZEC12=y
49CONFIG_NR_CPUS=256 50CONFIG_NR_CPUS=256
50CONFIG_HZ_100=y 51CONFIG_HZ_100=y
51CONFIG_MEMORY_HOTPLUG=y 52CONFIG_MEMORY_HOTPLUG=y
@@ -238,7 +239,6 @@ CONFIG_IP_VS_PE_SIP=m
238CONFIG_NF_CONNTRACK_IPV4=m 239CONFIG_NF_CONNTRACK_IPV4=m
239# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set 240# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
240CONFIG_NF_TABLES_IPV4=m 241CONFIG_NF_TABLES_IPV4=m
241CONFIG_NFT_REJECT_IPV4=m
242CONFIG_NFT_CHAIN_ROUTE_IPV4=m 242CONFIG_NFT_CHAIN_ROUTE_IPV4=m
243CONFIG_NFT_CHAIN_NAT_IPV4=m 243CONFIG_NFT_CHAIN_NAT_IPV4=m
244CONFIG_NF_TABLES_ARP=m 244CONFIG_NF_TABLES_ARP=m
@@ -453,6 +453,7 @@ CONFIG_TN3270_FS=y
453CONFIG_WATCHDOG=y 453CONFIG_WATCHDOG=y
454CONFIG_WATCHDOG_NOWAYOUT=y 454CONFIG_WATCHDOG_NOWAYOUT=y
455CONFIG_SOFT_WATCHDOG=m 455CONFIG_SOFT_WATCHDOG=m
456CONFIG_DIAG288_WATCHDOG=m
456# CONFIG_HID is not set 457# CONFIG_HID is not set
457# CONFIG_USB_SUPPORT is not set 458# CONFIG_USB_SUPPORT is not set
458CONFIG_INFINIBAND=m 459CONFIG_INFINIBAND=m
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index b5ba8fe1cc64..d279baa08014 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -43,7 +43,8 @@ CONFIG_SOLARIS_X86_PARTITION=y
43CONFIG_UNIXWARE_DISKLABEL=y 43CONFIG_UNIXWARE_DISKLABEL=y
44CONFIG_CFQ_GROUP_IOSCHED=y 44CONFIG_CFQ_GROUP_IOSCHED=y
45CONFIG_DEFAULT_DEADLINE=y 45CONFIG_DEFAULT_DEADLINE=y
46CONFIG_MARCH_Z9_109=y 46CONFIG_MARCH_Z196=y
47CONFIG_TUNE_ZEC12=y
47CONFIG_NR_CPUS=256 48CONFIG_NR_CPUS=256
48CONFIG_HZ_100=y 49CONFIG_HZ_100=y
49CONFIG_MEMORY_HOTPLUG=y 50CONFIG_MEMORY_HOTPLUG=y
@@ -236,7 +237,6 @@ CONFIG_IP_VS_PE_SIP=m
236CONFIG_NF_CONNTRACK_IPV4=m 237CONFIG_NF_CONNTRACK_IPV4=m
237# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set 238# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
238CONFIG_NF_TABLES_IPV4=m 239CONFIG_NF_TABLES_IPV4=m
239CONFIG_NFT_REJECT_IPV4=m
240CONFIG_NFT_CHAIN_ROUTE_IPV4=m 240CONFIG_NFT_CHAIN_ROUTE_IPV4=m
241CONFIG_NFT_CHAIN_NAT_IPV4=m 241CONFIG_NFT_CHAIN_NAT_IPV4=m
242CONFIG_NF_TABLES_ARP=m 242CONFIG_NF_TABLES_ARP=m
@@ -451,6 +451,7 @@ CONFIG_TN3270_FS=y
451CONFIG_WATCHDOG=y 451CONFIG_WATCHDOG=y
452CONFIG_WATCHDOG_NOWAYOUT=y 452CONFIG_WATCHDOG_NOWAYOUT=y
453CONFIG_SOFT_WATCHDOG=m 453CONFIG_SOFT_WATCHDOG=m
454CONFIG_DIAG288_WATCHDOG=m
454# CONFIG_HID is not set 455# CONFIG_HID is not set
455# CONFIG_USB_SUPPORT is not set 456# CONFIG_USB_SUPPORT is not set
456CONFIG_INFINIBAND=m 457CONFIG_INFINIBAND=m
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig
index cef073ca1f07..948e0e057a23 100644
--- a/arch/s390/configs/zfcpdump_defconfig
+++ b/arch/s390/configs/zfcpdump_defconfig
@@ -8,7 +8,8 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
8CONFIG_PARTITION_ADVANCED=y 8CONFIG_PARTITION_ADVANCED=y
9CONFIG_IBM_PARTITION=y 9CONFIG_IBM_PARTITION=y
10CONFIG_DEFAULT_DEADLINE=y 10CONFIG_DEFAULT_DEADLINE=y
11CONFIG_MARCH_Z9_109=y 11CONFIG_MARCH_Z196=y
12CONFIG_TUNE_ZEC12=y
12# CONFIG_COMPAT is not set 13# CONFIG_COMPAT is not set
13CONFIG_NR_CPUS=2 14CONFIG_NR_CPUS=2
14# CONFIG_HOTPLUG_CPU is not set 15# CONFIG_HOTPLUG_CPU is not set
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 4557cb7ffddf..2e56498a40df 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -135,8 +135,8 @@ CONFIG_PROVE_LOCKING=y
135CONFIG_LOCK_STAT=y 135CONFIG_LOCK_STAT=y
136CONFIG_DEBUG_LOCKDEP=y 136CONFIG_DEBUG_LOCKDEP=y
137CONFIG_DEBUG_ATOMIC_SLEEP=y 137CONFIG_DEBUG_ATOMIC_SLEEP=y
138CONFIG_DEBUG_WRITECOUNT=y
139CONFIG_DEBUG_LIST=y 138CONFIG_DEBUG_LIST=y
139CONFIG_DEBUG_PI_LIST=y
140CONFIG_DEBUG_SG=y 140CONFIG_DEBUG_SG=y
141CONFIG_DEBUG_NOTIFIERS=y 141CONFIG_DEBUG_NOTIFIERS=y
142CONFIG_PROVE_RCU=y 142CONFIG_PROVE_RCU=y
@@ -199,4 +199,10 @@ CONFIG_CRYPTO_SHA512_S390=m
199CONFIG_CRYPTO_DES_S390=m 199CONFIG_CRYPTO_DES_S390=m
200CONFIG_CRYPTO_AES_S390=m 200CONFIG_CRYPTO_AES_S390=m
201CONFIG_CRC7=m 201CONFIG_CRC7=m
202# CONFIG_XZ_DEC_X86 is not set
203# CONFIG_XZ_DEC_POWERPC is not set
204# CONFIG_XZ_DEC_IA64 is not set
205# CONFIG_XZ_DEC_ARM is not set
206# CONFIG_XZ_DEC_ARMTHUMB is not set
207# CONFIG_XZ_DEC_SPARC is not set
202CONFIG_CMM=m 208CONFIG_CMM=m
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index c28f32a45af5..3815bfea1b2d 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -33,10 +33,9 @@ static inline int init_new_context(struct task_struct *tsk,
33 33
34static inline void set_user_asce(struct mm_struct *mm) 34static inline void set_user_asce(struct mm_struct *mm)
35{ 35{
36 pgd_t *pgd = mm->pgd; 36 S390_lowcore.user_asce = mm->context.asce_bits | __pa(mm->pgd);
37 37 if (current->thread.mm_segment.ar4)
38 S390_lowcore.user_asce = mm->context.asce_bits | __pa(pgd); 38 __ctl_load(S390_lowcore.user_asce, 7, 7);
39 set_fs(current->thread.mm_segment);
40 set_cpu_flag(CIF_ASCE); 39 set_cpu_flag(CIF_ASCE);
41} 40}
42 41
@@ -70,12 +69,11 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
70 /* Clear old ASCE by loading the kernel ASCE. */ 69 /* Clear old ASCE by loading the kernel ASCE. */
71 __ctl_load(S390_lowcore.kernel_asce, 1, 1); 70 __ctl_load(S390_lowcore.kernel_asce, 1, 1);
72 __ctl_load(S390_lowcore.kernel_asce, 7, 7); 71 __ctl_load(S390_lowcore.kernel_asce, 7, 7);
73 /* Delay loading of the new ASCE to control registers CR1 & CR7 */
74 set_cpu_flag(CIF_ASCE);
75 atomic_inc(&next->context.attach_count); 72 atomic_inc(&next->context.attach_count);
76 atomic_dec(&prev->context.attach_count); 73 atomic_dec(&prev->context.attach_count);
77 if (MACHINE_HAS_TLB_LC) 74 if (MACHINE_HAS_TLB_LC)
78 cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); 75 cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask);
76 S390_lowcore.user_asce = next->context.asce_bits | __pa(next->pgd);
79} 77}
80 78
81#define finish_arch_post_lock_switch finish_arch_post_lock_switch 79#define finish_arch_post_lock_switch finish_arch_post_lock_switch
@@ -84,17 +82,18 @@ static inline void finish_arch_post_lock_switch(void)
84 struct task_struct *tsk = current; 82 struct task_struct *tsk = current;
85 struct mm_struct *mm = tsk->mm; 83 struct mm_struct *mm = tsk->mm;
86 84
87 if (!mm) 85 load_kernel_asce();
88 return; 86 if (mm) {
89 preempt_disable(); 87 preempt_disable();
90 while (atomic_read(&mm->context.attach_count) >> 16) 88 while (atomic_read(&mm->context.attach_count) >> 16)
91 cpu_relax(); 89 cpu_relax();
92 90
93 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); 91 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
94 set_user_asce(mm); 92 if (mm->context.flush_mm)
95 if (mm->context.flush_mm) 93 __tlb_flush_mm(mm);
96 __tlb_flush_mm(mm); 94 preempt_enable();
97 preempt_enable(); 95 }
96 set_fs(current->thread.mm_segment);
98} 97}
99 98
100#define enter_lazy_tlb(mm,tsk) do { } while (0) 99#define enter_lazy_tlb(mm,tsk) do { } while (0)
diff --git a/arch/s390/include/asm/switch_to.h b/arch/s390/include/asm/switch_to.h
index 29c81f82705e..df38c70cd59e 100644
--- a/arch/s390/include/asm/switch_to.h
+++ b/arch/s390/include/asm/switch_to.h
@@ -134,8 +134,4 @@ static inline void restore_access_regs(unsigned int *acrs)
134 prev = __switch_to(prev,next); \ 134 prev = __switch_to(prev,next); \
135} while (0) 135} while (0)
136 136
137#define finish_arch_switch(prev) do { \
138 set_fs(current->thread.mm_segment); \
139} while (0)
140
141#endif /* __ASM_SWITCH_TO_H */ 137#endif /* __ASM_SWITCH_TO_H */
diff --git a/arch/s390/include/uapi/asm/ucontext.h b/arch/s390/include/uapi/asm/ucontext.h
index 200e06325c6a..3e077b2a4705 100644
--- a/arch/s390/include/uapi/asm/ucontext.h
+++ b/arch/s390/include/uapi/asm/ucontext.h
@@ -16,7 +16,9 @@ struct ucontext_extended {
16 struct ucontext *uc_link; 16 struct ucontext *uc_link;
17 stack_t uc_stack; 17 stack_t uc_stack;
18 _sigregs uc_mcontext; 18 _sigregs uc_mcontext;
19 unsigned long uc_sigmask[2]; 19 sigset_t uc_sigmask;
20 /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
21 unsigned char __unused[128 - sizeof(sigset_t)];
20 unsigned long uc_gprs_high[16]; 22 unsigned long uc_gprs_high[16];
21}; 23};
22 24
@@ -27,7 +29,9 @@ struct ucontext {
27 struct ucontext *uc_link; 29 struct ucontext *uc_link;
28 stack_t uc_stack; 30 stack_t uc_stack;
29 _sigregs uc_mcontext; 31 _sigregs uc_mcontext;
30 sigset_t uc_sigmask; /* mask last for extensibility */ 32 sigset_t uc_sigmask;
33 /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
34 unsigned char __unused[128 - sizeof(sigset_t)];
31}; 35};
32 36
33#endif /* !_ASM_S390_UCONTEXT_H */ 37#endif /* !_ASM_S390_UCONTEXT_H */
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 39ddfdb40ae8..70d4b7c4beaa 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -69,7 +69,9 @@ struct ucontext32 {
69 __u32 uc_link; /* pointer */ 69 __u32 uc_link; /* pointer */
70 compat_stack_t uc_stack; 70 compat_stack_t uc_stack;
71 _sigregs32 uc_mcontext; 71 _sigregs32 uc_mcontext;
72 compat_sigset_t uc_sigmask; /* mask last for extensibility */ 72 compat_sigset_t uc_sigmask;
73 /* Allow for uc_sigmask growth. Glibc uses a 1024-bit sigset_t. */
74 unsigned char __unused[128 - sizeof(compat_sigset_t)];
73}; 75};
74 76
75struct stat64_emu31; 77struct stat64_emu31;
diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c
index 503e6d96ad4e..df922f52d76d 100644
--- a/arch/sparc/crypto/aes_glue.c
+++ b/arch/sparc/crypto/aes_glue.c
@@ -124,7 +124,7 @@ extern void aes_sparc64_ctr_crypt_256(const u64 *key, const u64 *input,
124 u64 *output, unsigned int len, 124 u64 *output, unsigned int len,
125 u64 *iv); 125 u64 *iv);
126 126
127struct aes_ops aes128_ops = { 127static struct aes_ops aes128_ops = {
128 .encrypt = aes_sparc64_encrypt_128, 128 .encrypt = aes_sparc64_encrypt_128,
129 .decrypt = aes_sparc64_decrypt_128, 129 .decrypt = aes_sparc64_decrypt_128,
130 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_128, 130 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_128,
@@ -136,7 +136,7 @@ struct aes_ops aes128_ops = {
136 .ctr_crypt = aes_sparc64_ctr_crypt_128, 136 .ctr_crypt = aes_sparc64_ctr_crypt_128,
137}; 137};
138 138
139struct aes_ops aes192_ops = { 139static struct aes_ops aes192_ops = {
140 .encrypt = aes_sparc64_encrypt_192, 140 .encrypt = aes_sparc64_encrypt_192,
141 .decrypt = aes_sparc64_decrypt_192, 141 .decrypt = aes_sparc64_decrypt_192,
142 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_192, 142 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_192,
@@ -148,7 +148,7 @@ struct aes_ops aes192_ops = {
148 .ctr_crypt = aes_sparc64_ctr_crypt_192, 148 .ctr_crypt = aes_sparc64_ctr_crypt_192,
149}; 149};
150 150
151struct aes_ops aes256_ops = { 151static struct aes_ops aes256_ops = {
152 .encrypt = aes_sparc64_encrypt_256, 152 .encrypt = aes_sparc64_encrypt_256,
153 .decrypt = aes_sparc64_decrypt_256, 153 .decrypt = aes_sparc64_decrypt_256,
154 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_256, 154 .load_encrypt_keys = aes_sparc64_load_encrypt_keys_256,
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h
index f08fe51b264d..7aed2be45b44 100644
--- a/arch/sparc/include/asm/atomic_32.h
+++ b/arch/sparc/include/asm/atomic_32.h
@@ -20,11 +20,11 @@
20 20
21#define ATOMIC_INIT(i) { (i) } 21#define ATOMIC_INIT(i) { (i) }
22 22
23extern int __atomic_add_return(int, atomic_t *); 23int __atomic_add_return(int, atomic_t *);
24extern int atomic_cmpxchg(atomic_t *, int, int); 24int atomic_cmpxchg(atomic_t *, int, int);
25#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 25#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
26extern int __atomic_add_unless(atomic_t *, int, int); 26int __atomic_add_unless(atomic_t *, int, int);
27extern void atomic_set(atomic_t *, int); 27void atomic_set(atomic_t *, int);
28 28
29#define atomic_read(v) (*(volatile int *)&(v)->counter) 29#define atomic_read(v) (*(volatile int *)&(v)->counter)
30 30
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index 8b2f1bde2889..bb894c8bec56 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -20,15 +20,15 @@
20#define atomic_set(v, i) (((v)->counter) = i) 20#define atomic_set(v, i) (((v)->counter) = i)
21#define atomic64_set(v, i) (((v)->counter) = i) 21#define atomic64_set(v, i) (((v)->counter) = i)
22 22
23extern void atomic_add(int, atomic_t *); 23void atomic_add(int, atomic_t *);
24extern void atomic64_add(long, atomic64_t *); 24void atomic64_add(long, atomic64_t *);
25extern void atomic_sub(int, atomic_t *); 25void atomic_sub(int, atomic_t *);
26extern void atomic64_sub(long, atomic64_t *); 26void atomic64_sub(long, atomic64_t *);
27 27
28extern int atomic_add_ret(int, atomic_t *); 28int atomic_add_ret(int, atomic_t *);
29extern long atomic64_add_ret(long, atomic64_t *); 29long atomic64_add_ret(long, atomic64_t *);
30extern int atomic_sub_ret(int, atomic_t *); 30int atomic_sub_ret(int, atomic_t *);
31extern long atomic64_sub_ret(long, atomic64_t *); 31long atomic64_sub_ret(long, atomic64_t *);
32 32
33#define atomic_dec_return(v) atomic_sub_ret(1, v) 33#define atomic_dec_return(v) atomic_sub_ret(1, v)
34#define atomic64_dec_return(v) atomic64_sub_ret(1, v) 34#define atomic64_dec_return(v) atomic64_sub_ret(1, v)
@@ -107,6 +107,6 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
107 107
108#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 108#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
109 109
110extern long atomic64_dec_if_positive(atomic64_t *v); 110long atomic64_dec_if_positive(atomic64_t *v);
111 111
112#endif /* !(__ARCH_SPARC64_ATOMIC__) */ 112#endif /* !(__ARCH_SPARC64_ATOMIC__) */
diff --git a/arch/sparc/include/asm/auxio.h b/arch/sparc/include/asm/auxio.h
index 13dc67f03011..3e09a07b77e9 100644
--- a/arch/sparc/include/asm/auxio.h
+++ b/arch/sparc/include/asm/auxio.h
@@ -1,5 +1,12 @@
1#ifndef ___ASM_SPARC_AUXIO_H 1#ifndef ___ASM_SPARC_AUXIO_H
2#define ___ASM_SPARC_AUXIO_H 2#define ___ASM_SPARC_AUXIO_H
3
4#ifndef __ASSEMBLY__
5
6extern void __iomem *auxio_register;
7
8#endif /* ifndef __ASSEMBLY__ */
9
3#if defined(__sparc__) && defined(__arch64__) 10#if defined(__sparc__) && defined(__arch64__)
4#include <asm/auxio_64.h> 11#include <asm/auxio_64.h>
5#else 12#else
diff --git a/arch/sparc/include/asm/auxio_32.h b/arch/sparc/include/asm/auxio_32.h
index 3a319775ae37..5d685df427b4 100644
--- a/arch/sparc/include/asm/auxio_32.h
+++ b/arch/sparc/include/asm/auxio_32.h
@@ -34,8 +34,8 @@
34 * NOTE: these routines are implementation dependent-- 34 * NOTE: these routines are implementation dependent--
35 * understand the hardware you are querying! 35 * understand the hardware you are querying!
36 */ 36 */
37extern void set_auxio(unsigned char bits_on, unsigned char bits_off); 37void set_auxio(unsigned char bits_on, unsigned char bits_off);
38extern unsigned char get_auxio(void); /* .../asm/floppy.h */ 38unsigned char get_auxio(void); /* .../asm/floppy.h */
39 39
40/* 40/*
41 * The following routines are provided for driver-compatibility 41 * The following routines are provided for driver-compatibility
@@ -78,7 +78,7 @@ do { \
78 78
79 79
80/* AUXIO2 (Power Off Control) */ 80/* AUXIO2 (Power Off Control) */
81extern __volatile__ unsigned char * auxio_power_register; 81extern volatile u8 __iomem *auxio_power_register;
82 82
83#define AUXIO_POWER_DETECT_FAILURE 32 83#define AUXIO_POWER_DETECT_FAILURE 32
84#define AUXIO_POWER_CLEAR_FAILURE 2 84#define AUXIO_POWER_CLEAR_FAILURE 2
diff --git a/arch/sparc/include/asm/auxio_64.h b/arch/sparc/include/asm/auxio_64.h
index f61cd1e3e395..6079e59a7ad1 100644
--- a/arch/sparc/include/asm/auxio_64.h
+++ b/arch/sparc/include/asm/auxio_64.h
@@ -75,8 +75,6 @@
75 75
76#ifndef __ASSEMBLY__ 76#ifndef __ASSEMBLY__
77 77
78extern void __iomem *auxio_register;
79
80#define AUXIO_LTE_ON 1 78#define AUXIO_LTE_ON 1
81#define AUXIO_LTE_OFF 0 79#define AUXIO_LTE_OFF 0
82 80
@@ -84,7 +82,7 @@ extern void __iomem *auxio_register;
84 * 82 *
85 * on - AUXIO_LTE_ON or AUXIO_LTE_OFF 83 * on - AUXIO_LTE_ON or AUXIO_LTE_OFF
86 */ 84 */
87extern void auxio_set_lte(int on); 85void auxio_set_lte(int on);
88 86
89#define AUXIO_LED_ON 1 87#define AUXIO_LED_ON 1
90#define AUXIO_LED_OFF 0 88#define AUXIO_LED_OFF 0
@@ -93,7 +91,7 @@ extern void auxio_set_lte(int on);
93 * 91 *
94 * on - AUXIO_LED_ON or AUXIO_LED_OFF 92 * on - AUXIO_LED_ON or AUXIO_LED_OFF
95 */ 93 */
96extern void auxio_set_led(int on); 94void auxio_set_led(int on);
97 95
98#endif /* ifndef __ASSEMBLY__ */ 96#endif /* ifndef __ASSEMBLY__ */
99 97
diff --git a/arch/sparc/include/asm/bitext.h b/arch/sparc/include/asm/bitext.h
index 297b2f2fcb49..9c988bf3adb6 100644
--- a/arch/sparc/include/asm/bitext.h
+++ b/arch/sparc/include/asm/bitext.h
@@ -20,8 +20,8 @@ struct bit_map {
20 int num_colors; 20 int num_colors;
21}; 21};
22 22
23extern int bit_map_string_get(struct bit_map *t, int len, int align); 23int bit_map_string_get(struct bit_map *t, int len, int align);
24extern void bit_map_clear(struct bit_map *t, int offset, int len); 24void bit_map_clear(struct bit_map *t, int offset, int len);
25extern void bit_map_init(struct bit_map *t, unsigned long *map, int size); 25void bit_map_init(struct bit_map *t, unsigned long *map, int size);
26 26
27#endif /* defined(_SPARC_BITEXT_H) */ 27#endif /* defined(_SPARC_BITEXT_H) */
diff --git a/arch/sparc/include/asm/bitops_32.h b/arch/sparc/include/asm/bitops_32.h
index 88c9a962502c..600ed1d9c8c8 100644
--- a/arch/sparc/include/asm/bitops_32.h
+++ b/arch/sparc/include/asm/bitops_32.h
@@ -18,9 +18,9 @@
18#error only <linux/bitops.h> can be included directly 18#error only <linux/bitops.h> can be included directly
19#endif 19#endif
20 20
21extern unsigned long ___set_bit(unsigned long *addr, unsigned long mask); 21unsigned long ___set_bit(unsigned long *addr, unsigned long mask);
22extern unsigned long ___clear_bit(unsigned long *addr, unsigned long mask); 22unsigned long ___clear_bit(unsigned long *addr, unsigned long mask);
23extern unsigned long ___change_bit(unsigned long *addr, unsigned long mask); 23unsigned long ___change_bit(unsigned long *addr, unsigned long mask);
24 24
25/* 25/*
26 * Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0' 26 * Set bit 'nr' in 32-bit quantity at address 'addr' where bit '0'
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
index f1a051ca301a..2d522402a937 100644
--- a/arch/sparc/include/asm/bitops_64.h
+++ b/arch/sparc/include/asm/bitops_64.h
@@ -15,12 +15,12 @@
15#include <asm/byteorder.h> 15#include <asm/byteorder.h>
16#include <asm/barrier.h> 16#include <asm/barrier.h>
17 17
18extern int test_and_set_bit(unsigned long nr, volatile unsigned long *addr); 18int test_and_set_bit(unsigned long nr, volatile unsigned long *addr);
19extern int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr); 19int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr);
20extern int test_and_change_bit(unsigned long nr, volatile unsigned long *addr); 20int test_and_change_bit(unsigned long nr, volatile unsigned long *addr);
21extern void set_bit(unsigned long nr, volatile unsigned long *addr); 21void set_bit(unsigned long nr, volatile unsigned long *addr);
22extern void clear_bit(unsigned long nr, volatile unsigned long *addr); 22void clear_bit(unsigned long nr, volatile unsigned long *addr);
23extern void change_bit(unsigned long nr, volatile unsigned long *addr); 23void change_bit(unsigned long nr, volatile unsigned long *addr);
24 24
25#include <asm-generic/bitops/non-atomic.h> 25#include <asm-generic/bitops/non-atomic.h>
26 26
@@ -30,8 +30,8 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr);
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32 32
33extern int ffs(int x); 33int ffs(int x);
34extern unsigned long __ffs(unsigned long); 34unsigned long __ffs(unsigned long);
35 35
36#include <asm-generic/bitops/ffz.h> 36#include <asm-generic/bitops/ffz.h>
37#include <asm-generic/bitops/sched.h> 37#include <asm-generic/bitops/sched.h>
@@ -41,10 +41,10 @@ extern unsigned long __ffs(unsigned long);
41 * of bits set) of a N-bit word 41 * of bits set) of a N-bit word
42 */ 42 */
43 43
44extern unsigned long __arch_hweight64(__u64 w); 44unsigned long __arch_hweight64(__u64 w);
45extern unsigned int __arch_hweight32(unsigned int w); 45unsigned int __arch_hweight32(unsigned int w);
46extern unsigned int __arch_hweight16(unsigned int w); 46unsigned int __arch_hweight16(unsigned int w);
47extern unsigned int __arch_hweight8(unsigned int w); 47unsigned int __arch_hweight8(unsigned int w);
48 48
49#include <asm-generic/bitops/const_hweight.h> 49#include <asm-generic/bitops/const_hweight.h>
50#include <asm-generic/bitops/lock.h> 50#include <asm-generic/bitops/lock.h>
diff --git a/arch/sparc/include/asm/btext.h b/arch/sparc/include/asm/btext.h
index 9b2bc6b6ed0a..75a32b109e15 100644
--- a/arch/sparc/include/asm/btext.h
+++ b/arch/sparc/include/asm/btext.h
@@ -1,6 +1,6 @@
1#ifndef _SPARC_BTEXT_H 1#ifndef _SPARC_BTEXT_H
2#define _SPARC_BTEXT_H 2#define _SPARC_BTEXT_H
3 3
4extern int btext_find_display(void); 4int btext_find_display(void);
5 5
6#endif /* _SPARC_BTEXT_H */ 6#endif /* _SPARC_BTEXT_H */
diff --git a/arch/sparc/include/asm/bug.h b/arch/sparc/include/asm/bug.h
index 6bd9f43cb5a5..eaa8f8d38125 100644
--- a/arch/sparc/include/asm/bug.h
+++ b/arch/sparc/include/asm/bug.h
@@ -5,7 +5,7 @@
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7#ifdef CONFIG_DEBUG_BUGVERBOSE 7#ifdef CONFIG_DEBUG_BUGVERBOSE
8extern void do_BUG(const char *file, int line); 8void do_BUG(const char *file, int line);
9#define BUG() do { \ 9#define BUG() do { \
10 do_BUG(__FILE__, __LINE__); \ 10 do_BUG(__FILE__, __LINE__); \
11 __builtin_trap(); \ 11 __builtin_trap(); \
@@ -20,6 +20,6 @@ extern void do_BUG(const char *file, int line);
20#include <asm-generic/bug.h> 20#include <asm-generic/bug.h>
21 21
22struct pt_regs; 22struct pt_regs;
23extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); 23void __noreturn die_if_kernel(char *str, struct pt_regs *regs);
24 24
25#endif 25#endif
diff --git a/arch/sparc/include/asm/cacheflush_32.h b/arch/sparc/include/asm/cacheflush_32.h
index bb014c24f318..12164006181c 100644
--- a/arch/sparc/include/asm/cacheflush_32.h
+++ b/arch/sparc/include/asm/cacheflush_32.h
@@ -36,7 +36,7 @@
36#define flush_page_for_dma(addr) \ 36#define flush_page_for_dma(addr) \
37 sparc32_cachetlb_ops->page_for_dma(addr) 37 sparc32_cachetlb_ops->page_for_dma(addr)
38 38
39extern void sparc_flush_page_to_ram(struct page *page); 39void sparc_flush_page_to_ram(struct page *page);
40 40
41#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 41#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
42#define flush_dcache_page(page) sparc_flush_page_to_ram(page) 42#define flush_dcache_page(page) sparc_flush_page_to_ram(page)
@@ -51,8 +51,8 @@ extern void sparc_flush_page_to_ram(struct page *page);
51 * way the windows are all clean for the next process and the stack 51 * way the windows are all clean for the next process and the stack
52 * frames are up to date. 52 * frames are up to date.
53 */ 53 */
54extern void flush_user_windows(void); 54void flush_user_windows(void);
55extern void kill_user_windows(void); 55void kill_user_windows(void);
56extern void flushw_all(void); 56void flushw_all(void);
57 57
58#endif /* _SPARC_CACHEFLUSH_H */ 58#endif /* _SPARC_CACHEFLUSH_H */
diff --git a/arch/sparc/include/asm/cacheflush_64.h b/arch/sparc/include/asm/cacheflush_64.h
index 301736d9e7a1..38965379e350 100644
--- a/arch/sparc/include/asm/cacheflush_64.h
+++ b/arch/sparc/include/asm/cacheflush_64.h
@@ -10,7 +10,7 @@
10/* Cache flush operations. */ 10/* Cache flush operations. */
11#define flushw_all() __asm__ __volatile__("flushw") 11#define flushw_all() __asm__ __volatile__("flushw")
12 12
13extern void __flushw_user(void); 13void __flushw_user(void);
14#define flushw_user() __flushw_user() 14#define flushw_user() __flushw_user()
15 15
16#define flush_user_windows flushw_user 16#define flush_user_windows flushw_user
@@ -30,29 +30,29 @@ extern void __flushw_user(void);
30 * use block commit stores (which invalidate icache lines) during 30 * use block commit stores (which invalidate icache lines) during
31 * module load, so we need this. 31 * module load, so we need this.
32 */ 32 */
33extern void flush_icache_range(unsigned long start, unsigned long end); 33void flush_icache_range(unsigned long start, unsigned long end);
34extern void __flush_icache_page(unsigned long); 34void __flush_icache_page(unsigned long);
35 35
36extern void __flush_dcache_page(void *addr, int flush_icache); 36void __flush_dcache_page(void *addr, int flush_icache);
37extern void flush_dcache_page_impl(struct page *page); 37void flush_dcache_page_impl(struct page *page);
38#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
39extern void smp_flush_dcache_page_impl(struct page *page, int cpu); 39void smp_flush_dcache_page_impl(struct page *page, int cpu);
40extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page); 40void flush_dcache_page_all(struct mm_struct *mm, struct page *page);
41#else 41#else
42#define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page) 42#define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page)
43#define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page) 43#define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page)
44#endif 44#endif
45 45
46extern void __flush_dcache_range(unsigned long start, unsigned long end); 46void __flush_dcache_range(unsigned long start, unsigned long end);
47#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 47#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
48extern void flush_dcache_page(struct page *page); 48void flush_dcache_page(struct page *page);
49 49
50#define flush_icache_page(vma, pg) do { } while(0) 50#define flush_icache_page(vma, pg) do { } while(0)
51#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) 51#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
52 52
53extern void flush_ptrace_access(struct vm_area_struct *, struct page *, 53void flush_ptrace_access(struct vm_area_struct *, struct page *,
54 unsigned long uaddr, void *kaddr, 54 unsigned long uaddr, void *kaddr,
55 unsigned long len, int write); 55 unsigned long len, int write);
56 56
57#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 57#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
58 do { \ 58 do { \
diff --git a/arch/sparc/include/asm/checksum_32.h b/arch/sparc/include/asm/checksum_32.h
index 04471dc64847..426b2389a1c2 100644
--- a/arch/sparc/include/asm/checksum_32.h
+++ b/arch/sparc/include/asm/checksum_32.h
@@ -29,7 +29,7 @@
29 * 29 *
30 * it's best to have buff aligned on a 32-bit boundary 30 * it's best to have buff aligned on a 32-bit boundary
31 */ 31 */
32extern __wsum csum_partial(const void *buff, int len, __wsum sum); 32__wsum csum_partial(const void *buff, int len, __wsum sum);
33 33
34/* the same as csum_partial, but copies from fs:src while it 34/* the same as csum_partial, but copies from fs:src while it
35 * checksums 35 * checksums
@@ -38,7 +38,7 @@ extern __wsum csum_partial(const void *buff, int len, __wsum sum);
38 * better 64-bit) boundary 38 * better 64-bit) boundary
39 */ 39 */
40 40
41extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *); 41unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *);
42 42
43static inline __wsum 43static inline __wsum
44csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) 44csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
diff --git a/arch/sparc/include/asm/checksum_64.h b/arch/sparc/include/asm/checksum_64.h
index 2ff81ae8f3af..b8779a6a5911 100644
--- a/arch/sparc/include/asm/checksum_64.h
+++ b/arch/sparc/include/asm/checksum_64.h
@@ -29,7 +29,7 @@
29 * 29 *
30 * it's best to have buff aligned on a 32-bit boundary 30 * it's best to have buff aligned on a 32-bit boundary
31 */ 31 */
32extern __wsum csum_partial(const void * buff, int len, __wsum sum); 32__wsum csum_partial(const void * buff, int len, __wsum sum);
33 33
34/* the same as csum_partial, but copies from user space while it 34/* the same as csum_partial, but copies from user space while it
35 * checksums 35 * checksums
@@ -37,12 +37,12 @@ extern __wsum csum_partial(const void * buff, int len, __wsum sum);
37 * here even more important to align src and dst on a 32-bit (or even 37 * here even more important to align src and dst on a 32-bit (or even
38 * better 64-bit) boundary 38 * better 64-bit) boundary
39 */ 39 */
40extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, 40__wsum csum_partial_copy_nocheck(const void *src, void *dst,
41 int len, __wsum sum); 41 int len, __wsum sum);
42 42
43extern long __csum_partial_copy_from_user(const void __user *src, 43long __csum_partial_copy_from_user(const void __user *src,
44 void *dst, int len, 44 void *dst, int len,
45 __wsum sum); 45 __wsum sum);
46 46
47static inline __wsum 47static inline __wsum
48csum_partial_copy_from_user(const void __user *src, 48csum_partial_copy_from_user(const void __user *src,
@@ -59,9 +59,9 @@ csum_partial_copy_from_user(const void __user *src,
59 * Copy and checksum to user 59 * Copy and checksum to user
60 */ 60 */
61#define HAVE_CSUM_COPY_USER 61#define HAVE_CSUM_COPY_USER
62extern long __csum_partial_copy_to_user(const void *src, 62long __csum_partial_copy_to_user(const void *src,
63 void __user *dst, int len, 63 void __user *dst, int len,
64 __wsum sum); 64 __wsum sum);
65 65
66static inline __wsum 66static inline __wsum
67csum_and_copy_to_user(const void *src, 67csum_and_copy_to_user(const void *src,
@@ -77,7 +77,7 @@ csum_and_copy_to_user(const void *src,
77/* ihl is always 5 or greater, almost always is 5, and iph is word aligned 77/* ihl is always 5 or greater, almost always is 5, and iph is word aligned
78 * the majority of the time. 78 * the majority of the time.
79 */ 79 */
80extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); 80__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
81 81
82/* Fold a partial checksum without adding pseudo headers. */ 82/* Fold a partial checksum without adding pseudo headers. */
83static inline __sum16 csum_fold(__wsum sum) 83static inline __sum16 csum_fold(__wsum sum)
@@ -96,9 +96,9 @@ static inline __sum16 csum_fold(__wsum sum)
96} 96}
97 97
98static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 98static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
99 unsigned int len, 99 unsigned int len,
100 unsigned short proto, 100 unsigned short proto,
101 __wsum sum) 101 __wsum sum)
102{ 102{
103 __asm__ __volatile__( 103 __asm__ __volatile__(
104" addcc %1, %0, %0\n" 104" addcc %1, %0, %0\n"
@@ -116,9 +116,9 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
116 * returns a 16-bit checksum, already complemented 116 * returns a 16-bit checksum, already complemented
117 */ 117 */
118static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 118static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
119 unsigned short len, 119 unsigned short len,
120 unsigned short proto, 120 unsigned short proto,
121 __wsum sum) 121 __wsum sum)
122{ 122{
123 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 123 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
124} 124}
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h
index 1fae1a02e3c2..32c29a133f9d 100644
--- a/arch/sparc/include/asm/cmpxchg_32.h
+++ b/arch/sparc/include/asm/cmpxchg_32.h
@@ -20,7 +20,7 @@ static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned lon
20 return val; 20 return val;
21} 21}
22 22
23extern void __xchg_called_with_bad_pointer(void); 23void __xchg_called_with_bad_pointer(void);
24 24
25static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) 25static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size)
26{ 26{
@@ -45,9 +45,9 @@ static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int
45#define __HAVE_ARCH_CMPXCHG 1 45#define __HAVE_ARCH_CMPXCHG 1
46 46
47/* bug catcher for when unsupported size is used - won't link */ 47/* bug catcher for when unsupported size is used - won't link */
48extern void __cmpxchg_called_with_bad_pointer(void); 48void __cmpxchg_called_with_bad_pointer(void);
49/* we only need to support cmpxchg of a u32 on sparc */ 49/* we only need to support cmpxchg of a u32 on sparc */
50extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); 50unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_);
51 51
52/* don't worry...optimizer will get rid of most of this */ 52/* don't worry...optimizer will get rid of most of this */
53static inline unsigned long 53static inline unsigned long
diff --git a/arch/sparc/include/asm/cmpxchg_64.h b/arch/sparc/include/asm/cmpxchg_64.h
index 4adefe8e2885..0e1ed6cfbf68 100644
--- a/arch/sparc/include/asm/cmpxchg_64.h
+++ b/arch/sparc/include/asm/cmpxchg_64.h
@@ -42,7 +42,7 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long
42 42
43#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) 43#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
44 44
45extern void __xchg_called_with_bad_pointer(void); 45void __xchg_called_with_bad_pointer(void);
46 46
47static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, 47static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr,
48 int size) 48 int size)
@@ -91,7 +91,7 @@ __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
91 91
92/* This function doesn't exist, so you'll get a linker error 92/* This function doesn't exist, so you'll get a linker error
93 if something tries to do an invalid cmpxchg(). */ 93 if something tries to do an invalid cmpxchg(). */
94extern void __cmpxchg_called_with_bad_pointer(void); 94void __cmpxchg_called_with_bad_pointer(void);
95 95
96static inline unsigned long 96static inline unsigned long
97__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 97__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
index b5976de7cacd..128b56b08676 100644
--- a/arch/sparc/include/asm/cpudata.h
+++ b/arch/sparc/include/asm/cpudata.h
@@ -1,5 +1,15 @@
1#ifndef ___ASM_SPARC_CPUDATA_H 1#ifndef ___ASM_SPARC_CPUDATA_H
2#define ___ASM_SPARC_CPUDATA_H 2#define ___ASM_SPARC_CPUDATA_H
3
4#ifndef __ASSEMBLY__
5
6#include <linux/threads.h>
7#include <linux/percpu.h>
8
9extern const struct seq_operations cpuinfo_op;
10
11#endif /* !(__ASSEMBLY__) */
12
3#if defined(__sparc__) && defined(__arch64__) 13#if defined(__sparc__) && defined(__arch64__)
4#include <asm/cpudata_64.h> 14#include <asm/cpudata_64.h>
5#else 15#else
diff --git a/arch/sparc/include/asm/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h
index 050ef35b9dcf..0e594076912c 100644
--- a/arch/sparc/include/asm/cpudata_64.h
+++ b/arch/sparc/include/asm/cpudata_64.h
@@ -8,9 +8,6 @@
8 8
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
10 10
11#include <linux/percpu.h>
12#include <linux/threads.h>
13
14typedef struct { 11typedef struct {
15 /* Dcache line 1 */ 12 /* Dcache line 1 */
16 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ 13 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */
@@ -35,8 +32,6 @@ DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
35#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu)) 32#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu))
36#define local_cpu_data() __get_cpu_var(__cpu_data) 33#define local_cpu_data() __get_cpu_var(__cpu_data)
37 34
38extern const struct seq_operations cpuinfo_op;
39
40#endif /* !(__ASSEMBLY__) */ 35#endif /* !(__ASSEMBLY__) */
41 36
42#include <asm/trap_block.h> 37#include <asm/trap_block.h>
diff --git a/arch/sparc/include/asm/delay_32.h b/arch/sparc/include/asm/delay_32.h
index bc9aba2bead6..3fb8ca144b4f 100644
--- a/arch/sparc/include/asm/delay_32.h
+++ b/arch/sparc/include/asm/delay_32.h
@@ -20,8 +20,8 @@ static inline void __delay(unsigned long loops)
20} 20}
21 21
22/* This is too messy with inline asm on the Sparc. */ 22/* This is too messy with inline asm on the Sparc. */
23extern void __udelay(unsigned long usecs, unsigned long lpj); 23void __udelay(unsigned long usecs, unsigned long lpj);
24extern void __ndelay(unsigned long nsecs, unsigned long lpj); 24void __ndelay(unsigned long nsecs, unsigned long lpj);
25 25
26#ifdef CONFIG_SMP 26#ifdef CONFIG_SMP
27#define __udelay_val cpu_data(smp_processor_id()).udelay_val 27#define __udelay_val cpu_data(smp_processor_id()).udelay_val
diff --git a/arch/sparc/include/asm/delay_64.h b/arch/sparc/include/asm/delay_64.h
index a77aa622d762..0ba5424856d8 100644
--- a/arch/sparc/include/asm/delay_64.h
+++ b/arch/sparc/include/asm/delay_64.h
@@ -8,8 +8,8 @@
8 8
9#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
10 10
11extern void __delay(unsigned long loops); 11void __delay(unsigned long loops);
12extern void udelay(unsigned long usecs); 12void udelay(unsigned long usecs);
13#define mdelay(n) udelay((n) * 1000) 13#define mdelay(n) udelay((n) * 1000)
14 14
15#endif /* !__ASSEMBLY__ */ 15#endif /* !__ASSEMBLY__ */
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index daa6a8a5e9cd..bb3f0b0c6754 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -19,7 +19,7 @@ struct dev_archdata {
19 int numa_node; 19 int numa_node;
20}; 20};
21 21
22extern void of_propagate_archdata(struct platform_device *bus); 22void of_propagate_archdata(struct platform_device *bus);
23 23
24struct pdev_archdata { 24struct pdev_archdata {
25 struct resource resource[PROMREG_MAX]; 25 struct resource resource[PROMREG_MAX];
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 05fe53f5346e..1ee02710b2dc 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -7,7 +7,7 @@
7 7
8#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 8#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
9 9
10extern int dma_supported(struct device *dev, u64 mask); 10int dma_supported(struct device *dev, u64 mask);
11 11
12#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 12#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
diff --git a/arch/sparc/include/asm/ebus_dma.h b/arch/sparc/include/asm/ebus_dma.h
index f07a5b541c98..fcfb4948147f 100644
--- a/arch/sparc/include/asm/ebus_dma.h
+++ b/arch/sparc/include/asm/ebus_dma.h
@@ -22,14 +22,14 @@ struct ebus_dma_info {
22 unsigned char name[64]; 22 unsigned char name[64];
23}; 23};
24 24
25extern int ebus_dma_register(struct ebus_dma_info *p); 25int ebus_dma_register(struct ebus_dma_info *p);
26extern int ebus_dma_irq_enable(struct ebus_dma_info *p, int on); 26int ebus_dma_irq_enable(struct ebus_dma_info *p, int on);
27extern void ebus_dma_unregister(struct ebus_dma_info *p); 27void ebus_dma_unregister(struct ebus_dma_info *p);
28extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr, 28int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,
29 size_t len); 29 size_t len);
30extern void ebus_dma_prepare(struct ebus_dma_info *p, int write); 30void ebus_dma_prepare(struct ebus_dma_info *p, int write);
31extern unsigned int ebus_dma_residue(struct ebus_dma_info *p); 31unsigned int ebus_dma_residue(struct ebus_dma_info *p);
32extern unsigned int ebus_dma_addr(struct ebus_dma_info *p); 32unsigned int ebus_dma_addr(struct ebus_dma_info *p);
33extern void ebus_dma_enable(struct ebus_dma_info *p, int on); 33void ebus_dma_enable(struct ebus_dma_info *p, int on);
34 34
35#endif /* __ASM_SPARC_EBUS_DMA_H */ 35#endif /* __ASM_SPARC_EBUS_DMA_H */
diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h
index fb3f16954c69..071b83e52f15 100644
--- a/arch/sparc/include/asm/floppy_32.h
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -9,11 +9,12 @@
9#include <linux/of.h> 9#include <linux/of.h>
10#include <linux/of_device.h> 10#include <linux/of_device.h>
11 11
12#include <asm/page.h>
13#include <asm/pgtable.h> 12#include <asm/pgtable.h>
14#include <asm/idprom.h> 13#include <asm/idprom.h>
15#include <asm/oplib.h> 14#include <asm/oplib.h>
16#include <asm/auxio.h> 15#include <asm/auxio.h>
16#include <asm/setup.h>
17#include <asm/page.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
18 19
19/* We don't need no stinkin' I/O port allocation crap. */ 20/* We don't need no stinkin' I/O port allocation crap. */
@@ -49,7 +50,6 @@ struct sun_flpy_controller {
49 50
50/* You'll only ever find one controller on a SparcStation anyways. */ 51/* You'll only ever find one controller on a SparcStation anyways. */
51static struct sun_flpy_controller *sun_fdc = NULL; 52static struct sun_flpy_controller *sun_fdc = NULL;
52extern volatile unsigned char *fdc_status;
53 53
54struct sun_floppy_ops { 54struct sun_floppy_ops {
55 unsigned char (*fd_inb)(int port); 55 unsigned char (*fd_inb)(int port);
@@ -212,13 +212,6 @@ static void sun_82077_fd_outb(unsigned char value, int port)
212 * underruns. If non-zero, doing_pdma encodes the direction of 212 * underruns. If non-zero, doing_pdma encodes the direction of
213 * the transfer for debugging. 1=read 2=write 213 * the transfer for debugging. 1=read 2=write
214 */ 214 */
215extern char *pdma_vaddr;
216extern unsigned long pdma_size;
217extern volatile int doing_pdma;
218
219/* This is software state */
220extern char *pdma_base;
221extern unsigned long pdma_areasize;
222 215
223/* Common routines to all controller types on the Sparc. */ 216/* Common routines to all controller types on the Sparc. */
224static inline void virtual_dma_init(void) 217static inline void virtual_dma_init(void)
@@ -263,8 +256,7 @@ static inline void sun_fd_enable_dma(void)
263 pdma_areasize = pdma_size; 256 pdma_areasize = pdma_size;
264} 257}
265 258
266extern int sparc_floppy_request_irq(unsigned int irq, 259int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler);
267 irq_handler_t irq_handler);
268 260
269static int sun_fd_request_irq(void) 261static int sun_fd_request_irq(void)
270{ 262{
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index 7c90c50c200d..625756406a7e 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -296,7 +296,7 @@ struct sun_pci_dma_op {
296static struct sun_pci_dma_op sun_pci_dma_current = { -1U, 0, 0, NULL}; 296static struct sun_pci_dma_op sun_pci_dma_current = { -1U, 0, 0, NULL};
297static struct sun_pci_dma_op sun_pci_dma_pending = { -1U, 0, 0, NULL}; 297static struct sun_pci_dma_op sun_pci_dma_pending = { -1U, 0, 0, NULL};
298 298
299extern irqreturn_t floppy_interrupt(int irq, void *dev_id); 299irqreturn_t floppy_interrupt(int irq, void *dev_id);
300 300
301static unsigned char sun_pci_fd_inb(unsigned long port) 301static unsigned char sun_pci_fd_inb(unsigned long port)
302{ 302{
diff --git a/arch/sparc/include/asm/ftrace.h b/arch/sparc/include/asm/ftrace.h
index b0f18e9893db..9ec94ad116fb 100644
--- a/arch/sparc/include/asm/ftrace.h
+++ b/arch/sparc/include/asm/ftrace.h
@@ -6,7 +6,7 @@
6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ 6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
7 7
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9extern void _mcount(void); 9void _mcount(void);
10#endif 10#endif
11 11
12#endif 12#endif
@@ -22,4 +22,8 @@ struct dyn_arch_ftrace {
22}; 22};
23#endif /* CONFIG_DYNAMIC_FTRACE */ 23#endif /* CONFIG_DYNAMIC_FTRACE */
24 24
25unsigned long prepare_ftrace_return(unsigned long parent,
26 unsigned long self_addr,
27 unsigned long frame_pointer);
28
25#endif /* _ASM_SPARC64_FTRACE */ 29#endif /* _ASM_SPARC64_FTRACE */
diff --git a/arch/sparc/include/asm/highmem.h b/arch/sparc/include/asm/highmem.h
index 4f9e15c757e2..92ded294a4ec 100644
--- a/arch/sparc/include/asm/highmem.h
+++ b/arch/sparc/include/asm/highmem.h
@@ -31,7 +31,7 @@ extern unsigned long highstart_pfn, highend_pfn;
31extern pgprot_t kmap_prot; 31extern pgprot_t kmap_prot;
32extern pte_t *pkmap_page_table; 32extern pte_t *pkmap_page_table;
33 33
34extern void kmap_init(void) __init; 34void kmap_init(void) __init;
35 35
36/* 36/*
37 * Right now we initialize only a single pte table. It can be extended 37 * Right now we initialize only a single pte table. It can be extended
@@ -49,8 +49,8 @@ extern void kmap_init(void) __init;
49 49
50#define PKMAP_END (PKMAP_ADDR(LAST_PKMAP)) 50#define PKMAP_END (PKMAP_ADDR(LAST_PKMAP))
51 51
52extern void *kmap_high(struct page *page); 52void *kmap_high(struct page *page);
53extern void kunmap_high(struct page *page); 53void kunmap_high(struct page *page);
54 54
55static inline void *kmap(struct page *page) 55static inline void *kmap(struct page *page)
56{ 56{
@@ -68,8 +68,8 @@ static inline void kunmap(struct page *page)
68 kunmap_high(page); 68 kunmap_high(page);
69} 69}
70 70
71extern void *kmap_atomic(struct page *page); 71void *kmap_atomic(struct page *page);
72extern void __kunmap_atomic(void *kvaddr); 72void __kunmap_atomic(void *kvaddr);
73 73
74#define flush_cache_kmaps() flush_cache_all() 74#define flush_cache_kmaps() flush_cache_all()
75 75
diff --git a/arch/sparc/include/asm/hvtramp.h b/arch/sparc/include/asm/hvtramp.h
index b2b9b947b3a4..04b56f862bbe 100644
--- a/arch/sparc/include/asm/hvtramp.h
+++ b/arch/sparc/include/asm/hvtramp.h
@@ -19,7 +19,7 @@ struct hvtramp_descr {
19 struct hvtramp_mapping maps[1]; 19 struct hvtramp_mapping maps[1];
20}; 20};
21 21
22extern void hv_cpu_startup(unsigned long hvdescr_pa); 22void hv_cpu_startup(unsigned long hvdescr_pa);
23 23
24#endif 24#endif
25 25
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h
index ca121f0fa3ec..94b39caea3eb 100644
--- a/arch/sparc/include/asm/hypervisor.h
+++ b/arch/sparc/include/asm/hypervisor.h
@@ -98,7 +98,7 @@
98#define HV_FAST_MACH_EXIT 0x00 98#define HV_FAST_MACH_EXIT 0x00
99 99
100#ifndef __ASSEMBLY__ 100#ifndef __ASSEMBLY__
101extern void sun4v_mach_exit(unsigned long exit_code); 101void sun4v_mach_exit(unsigned long exit_code);
102#endif 102#endif
103 103
104/* Domain services. */ 104/* Domain services. */
@@ -127,9 +127,9 @@ extern void sun4v_mach_exit(unsigned long exit_code);
127#define HV_FAST_MACH_DESC 0x01 127#define HV_FAST_MACH_DESC 0x01
128 128
129#ifndef __ASSEMBLY__ 129#ifndef __ASSEMBLY__
130extern unsigned long sun4v_mach_desc(unsigned long buffer_pa, 130unsigned long sun4v_mach_desc(unsigned long buffer_pa,
131 unsigned long buf_len, 131 unsigned long buf_len,
132 unsigned long *real_buf_len); 132 unsigned long *real_buf_len);
133#endif 133#endif
134 134
135/* mach_sir() 135/* mach_sir()
@@ -148,7 +148,7 @@ extern unsigned long sun4v_mach_desc(unsigned long buffer_pa,
148#define HV_FAST_MACH_SIR 0x02 148#define HV_FAST_MACH_SIR 0x02
149 149
150#ifndef __ASSEMBLY__ 150#ifndef __ASSEMBLY__
151extern void sun4v_mach_sir(void); 151void sun4v_mach_sir(void);
152#endif 152#endif
153 153
154/* mach_set_watchdog() 154/* mach_set_watchdog()
@@ -204,8 +204,8 @@ extern void sun4v_mach_sir(void);
204#define HV_FAST_MACH_SET_WATCHDOG 0x05 204#define HV_FAST_MACH_SET_WATCHDOG 0x05
205 205
206#ifndef __ASSEMBLY__ 206#ifndef __ASSEMBLY__
207extern unsigned long sun4v_mach_set_watchdog(unsigned long timeout, 207unsigned long sun4v_mach_set_watchdog(unsigned long timeout,
208 unsigned long *orig_timeout); 208 unsigned long *orig_timeout);
209#endif 209#endif
210 210
211/* CPU services. 211/* CPU services.
@@ -250,10 +250,10 @@ extern unsigned long sun4v_mach_set_watchdog(unsigned long timeout,
250#define HV_FAST_CPU_START 0x10 250#define HV_FAST_CPU_START 0x10
251 251
252#ifndef __ASSEMBLY__ 252#ifndef __ASSEMBLY__
253extern unsigned long sun4v_cpu_start(unsigned long cpuid, 253unsigned long sun4v_cpu_start(unsigned long cpuid,
254 unsigned long pc, 254 unsigned long pc,
255 unsigned long rtba, 255 unsigned long rtba,
256 unsigned long arg0); 256 unsigned long arg0);
257#endif 257#endif
258 258
259/* cpu_stop() 259/* cpu_stop()
@@ -278,7 +278,7 @@ extern unsigned long sun4v_cpu_start(unsigned long cpuid,
278#define HV_FAST_CPU_STOP 0x11 278#define HV_FAST_CPU_STOP 0x11
279 279
280#ifndef __ASSEMBLY__ 280#ifndef __ASSEMBLY__
281extern unsigned long sun4v_cpu_stop(unsigned long cpuid); 281unsigned long sun4v_cpu_stop(unsigned long cpuid);
282#endif 282#endif
283 283
284/* cpu_yield() 284/* cpu_yield()
@@ -295,7 +295,7 @@ extern unsigned long sun4v_cpu_stop(unsigned long cpuid);
295#define HV_FAST_CPU_YIELD 0x12 295#define HV_FAST_CPU_YIELD 0x12
296 296
297#ifndef __ASSEMBLY__ 297#ifndef __ASSEMBLY__
298extern unsigned long sun4v_cpu_yield(void); 298unsigned long sun4v_cpu_yield(void);
299#endif 299#endif
300 300
301/* cpu_qconf() 301/* cpu_qconf()
@@ -341,9 +341,9 @@ extern unsigned long sun4v_cpu_yield(void);
341#define HV_CPU_QUEUE_NONRES_ERROR 0x3f 341#define HV_CPU_QUEUE_NONRES_ERROR 0x3f
342 342
343#ifndef __ASSEMBLY__ 343#ifndef __ASSEMBLY__
344extern unsigned long sun4v_cpu_qconf(unsigned long type, 344unsigned long sun4v_cpu_qconf(unsigned long type,
345 unsigned long queue_paddr, 345 unsigned long queue_paddr,
346 unsigned long num_queue_entries); 346 unsigned long num_queue_entries);
347#endif 347#endif
348 348
349/* cpu_qinfo() 349/* cpu_qinfo()
@@ -394,7 +394,9 @@ extern unsigned long sun4v_cpu_qconf(unsigned long type,
394#define HV_FAST_CPU_MONDO_SEND 0x42 394#define HV_FAST_CPU_MONDO_SEND 0x42
395 395
396#ifndef __ASSEMBLY__ 396#ifndef __ASSEMBLY__
397extern unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, unsigned long cpu_list_pa, unsigned long mondo_block_pa); 397unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count,
398 unsigned long cpu_list_pa,
399 unsigned long mondo_block_pa);
398#endif 400#endif
399 401
400/* cpu_myid() 402/* cpu_myid()
@@ -425,7 +427,7 @@ extern unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, unsigned long
425#define HV_CPU_STATE_ERROR 0x03 427#define HV_CPU_STATE_ERROR 0x03
426 428
427#ifndef __ASSEMBLY__ 429#ifndef __ASSEMBLY__
428extern long sun4v_cpu_state(unsigned long cpuid); 430long sun4v_cpu_state(unsigned long cpuid);
429#endif 431#endif
430 432
431/* cpu_set_rtba() 433/* cpu_set_rtba()
@@ -625,8 +627,8 @@ struct hv_fault_status {
625#define HV_FAST_MMU_TSB_CTX0 0x20 627#define HV_FAST_MMU_TSB_CTX0 0x20
626 628
627#ifndef __ASSEMBLY__ 629#ifndef __ASSEMBLY__
628extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions, 630unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions,
629 unsigned long tsb_desc_ra); 631 unsigned long tsb_desc_ra);
630#endif 632#endif
631 633
632/* mmu_tsb_ctxnon0() 634/* mmu_tsb_ctxnon0()
@@ -710,7 +712,7 @@ extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions,
710#define HV_FAST_MMU_DEMAP_ALL 0x24 712#define HV_FAST_MMU_DEMAP_ALL 0x24
711 713
712#ifndef __ASSEMBLY__ 714#ifndef __ASSEMBLY__
713extern void sun4v_mmu_demap_all(void); 715void sun4v_mmu_demap_all(void);
714#endif 716#endif
715 717
716/* mmu_map_perm_addr() 718/* mmu_map_perm_addr()
@@ -740,10 +742,10 @@ extern void sun4v_mmu_demap_all(void);
740#define HV_FAST_MMU_MAP_PERM_ADDR 0x25 742#define HV_FAST_MMU_MAP_PERM_ADDR 0x25
741 743
742#ifndef __ASSEMBLY__ 744#ifndef __ASSEMBLY__
743extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr, 745unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr,
744 unsigned long set_to_zero, 746 unsigned long set_to_zero,
745 unsigned long tte, 747 unsigned long tte,
746 unsigned long flags); 748 unsigned long flags);
747#endif 749#endif
748 750
749/* mmu_fault_area_conf() 751/* mmu_fault_area_conf()
@@ -945,7 +947,7 @@ extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr,
945#define HV_FAST_TOD_GET 0x50 947#define HV_FAST_TOD_GET 0x50
946 948
947#ifndef __ASSEMBLY__ 949#ifndef __ASSEMBLY__
948extern unsigned long sun4v_tod_get(unsigned long *time); 950unsigned long sun4v_tod_get(unsigned long *time);
949#endif 951#endif
950 952
951/* tod_set() 953/* tod_set()
@@ -962,7 +964,7 @@ extern unsigned long sun4v_tod_get(unsigned long *time);
962#define HV_FAST_TOD_SET 0x51 964#define HV_FAST_TOD_SET 0x51
963 965
964#ifndef __ASSEMBLY__ 966#ifndef __ASSEMBLY__
965extern unsigned long sun4v_tod_set(unsigned long time); 967unsigned long sun4v_tod_set(unsigned long time);
966#endif 968#endif
967 969
968/* Console services */ 970/* Console services */
@@ -1038,14 +1040,14 @@ extern unsigned long sun4v_tod_set(unsigned long time);
1038#define HV_FAST_CONS_WRITE 0x63 1040#define HV_FAST_CONS_WRITE 0x63
1039 1041
1040#ifndef __ASSEMBLY__ 1042#ifndef __ASSEMBLY__
1041extern long sun4v_con_getchar(long *status); 1043long sun4v_con_getchar(long *status);
1042extern long sun4v_con_putchar(long c); 1044long sun4v_con_putchar(long c);
1043extern long sun4v_con_read(unsigned long buffer, 1045long sun4v_con_read(unsigned long buffer,
1044 unsigned long size, 1046 unsigned long size,
1045 unsigned long *bytes_read); 1047 unsigned long *bytes_read);
1046extern unsigned long sun4v_con_write(unsigned long buffer, 1048unsigned long sun4v_con_write(unsigned long buffer,
1047 unsigned long size, 1049 unsigned long size,
1048 unsigned long *bytes_written); 1050 unsigned long *bytes_written);
1049#endif 1051#endif
1050 1052
1051/* mach_set_soft_state() 1053/* mach_set_soft_state()
@@ -1080,8 +1082,8 @@ extern unsigned long sun4v_con_write(unsigned long buffer,
1080#define HV_SOFT_STATE_TRANSITION 0x02 1082#define HV_SOFT_STATE_TRANSITION 0x02
1081 1083
1082#ifndef __ASSEMBLY__ 1084#ifndef __ASSEMBLY__
1083extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state, 1085unsigned long sun4v_mach_set_soft_state(unsigned long soft_state,
1084 unsigned long msg_string_ra); 1086 unsigned long msg_string_ra);
1085#endif 1087#endif
1086 1088
1087/* mach_get_soft_state() 1089/* mach_get_soft_state()
@@ -1159,20 +1161,20 @@ extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state,
1159#define HV_FAST_SVC_CLRSTATUS 0x84 1161#define HV_FAST_SVC_CLRSTATUS 0x84
1160 1162
1161#ifndef __ASSEMBLY__ 1163#ifndef __ASSEMBLY__
1162extern unsigned long sun4v_svc_send(unsigned long svc_id, 1164unsigned long sun4v_svc_send(unsigned long svc_id,
1163 unsigned long buffer, 1165 unsigned long buffer,
1164 unsigned long buffer_size, 1166 unsigned long buffer_size,
1165 unsigned long *sent_bytes); 1167 unsigned long *sent_bytes);
1166extern unsigned long sun4v_svc_recv(unsigned long svc_id, 1168unsigned long sun4v_svc_recv(unsigned long svc_id,
1167 unsigned long buffer, 1169 unsigned long buffer,
1168 unsigned long buffer_size, 1170 unsigned long buffer_size,
1169 unsigned long *recv_bytes); 1171 unsigned long *recv_bytes);
1170extern unsigned long sun4v_svc_getstatus(unsigned long svc_id, 1172unsigned long sun4v_svc_getstatus(unsigned long svc_id,
1171 unsigned long *status_bits); 1173 unsigned long *status_bits);
1172extern unsigned long sun4v_svc_setstatus(unsigned long svc_id, 1174unsigned long sun4v_svc_setstatus(unsigned long svc_id,
1173 unsigned long status_bits); 1175 unsigned long status_bits);
1174extern unsigned long sun4v_svc_clrstatus(unsigned long svc_id, 1176unsigned long sun4v_svc_clrstatus(unsigned long svc_id,
1175 unsigned long status_bits); 1177 unsigned long status_bits);
1176#endif 1178#endif
1177 1179
1178/* Trap trace services. 1180/* Trap trace services.
@@ -1458,8 +1460,8 @@ struct hv_trap_trace_entry {
1458#define HV_FAST_INTR_DEVINO2SYSINO 0xa0 1460#define HV_FAST_INTR_DEVINO2SYSINO 0xa0
1459 1461
1460#ifndef __ASSEMBLY__ 1462#ifndef __ASSEMBLY__
1461extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle, 1463unsigned long sun4v_devino_to_sysino(unsigned long devhandle,
1462 unsigned long devino); 1464 unsigned long devino);
1463#endif 1465#endif
1464 1466
1465/* intr_getenabled() 1467/* intr_getenabled()
@@ -1476,7 +1478,7 @@ extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle,
1476#define HV_FAST_INTR_GETENABLED 0xa1 1478#define HV_FAST_INTR_GETENABLED 0xa1
1477 1479
1478#ifndef __ASSEMBLY__ 1480#ifndef __ASSEMBLY__
1479extern unsigned long sun4v_intr_getenabled(unsigned long sysino); 1481unsigned long sun4v_intr_getenabled(unsigned long sysino);
1480#endif 1482#endif
1481 1483
1482/* intr_setenabled() 1484/* intr_setenabled()
@@ -1492,7 +1494,8 @@ extern unsigned long sun4v_intr_getenabled(unsigned long sysino);
1492#define HV_FAST_INTR_SETENABLED 0xa2 1494#define HV_FAST_INTR_SETENABLED 0xa2
1493 1495
1494#ifndef __ASSEMBLY__ 1496#ifndef __ASSEMBLY__
1495extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long intr_enabled); 1497unsigned long sun4v_intr_setenabled(unsigned long sysino,
1498 unsigned long intr_enabled);
1496#endif 1499#endif
1497 1500
1498/* intr_getstate() 1501/* intr_getstate()
@@ -1508,7 +1511,7 @@ extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long i
1508#define HV_FAST_INTR_GETSTATE 0xa3 1511#define HV_FAST_INTR_GETSTATE 0xa3
1509 1512
1510#ifndef __ASSEMBLY__ 1513#ifndef __ASSEMBLY__
1511extern unsigned long sun4v_intr_getstate(unsigned long sysino); 1514unsigned long sun4v_intr_getstate(unsigned long sysino);
1512#endif 1515#endif
1513 1516
1514/* intr_setstate() 1517/* intr_setstate()
@@ -1528,7 +1531,7 @@ extern unsigned long sun4v_intr_getstate(unsigned long sysino);
1528#define HV_FAST_INTR_SETSTATE 0xa4 1531#define HV_FAST_INTR_SETSTATE 0xa4
1529 1532
1530#ifndef __ASSEMBLY__ 1533#ifndef __ASSEMBLY__
1531extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state); 1534unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state);
1532#endif 1535#endif
1533 1536
1534/* intr_gettarget() 1537/* intr_gettarget()
@@ -1546,7 +1549,7 @@ extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long int
1546#define HV_FAST_INTR_GETTARGET 0xa5 1549#define HV_FAST_INTR_GETTARGET 0xa5
1547 1550
1548#ifndef __ASSEMBLY__ 1551#ifndef __ASSEMBLY__
1549extern unsigned long sun4v_intr_gettarget(unsigned long sysino); 1552unsigned long sun4v_intr_gettarget(unsigned long sysino);
1550#endif 1553#endif
1551 1554
1552/* intr_settarget() 1555/* intr_settarget()
@@ -1563,7 +1566,7 @@ extern unsigned long sun4v_intr_gettarget(unsigned long sysino);
1563#define HV_FAST_INTR_SETTARGET 0xa6 1566#define HV_FAST_INTR_SETTARGET 0xa6
1564 1567
1565#ifndef __ASSEMBLY__ 1568#ifndef __ASSEMBLY__
1566extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid); 1569unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid);
1567#endif 1570#endif
1568 1571
1569/* vintr_get_cookie() 1572/* vintr_get_cookie()
@@ -1647,30 +1650,30 @@ extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cp
1647#define HV_FAST_VINTR_SET_TARGET 0xae 1650#define HV_FAST_VINTR_SET_TARGET 0xae
1648 1651
1649#ifndef __ASSEMBLY__ 1652#ifndef __ASSEMBLY__
1650extern unsigned long sun4v_vintr_get_cookie(unsigned long dev_handle, 1653unsigned long sun4v_vintr_get_cookie(unsigned long dev_handle,
1651 unsigned long dev_ino, 1654 unsigned long dev_ino,
1652 unsigned long *cookie); 1655 unsigned long *cookie);
1653extern unsigned long sun4v_vintr_set_cookie(unsigned long dev_handle, 1656unsigned long sun4v_vintr_set_cookie(unsigned long dev_handle,
1654 unsigned long dev_ino, 1657 unsigned long dev_ino,
1655 unsigned long cookie); 1658 unsigned long cookie);
1656extern unsigned long sun4v_vintr_get_valid(unsigned long dev_handle, 1659unsigned long sun4v_vintr_get_valid(unsigned long dev_handle,
1657 unsigned long dev_ino, 1660 unsigned long dev_ino,
1658 unsigned long *valid); 1661 unsigned long *valid);
1659extern unsigned long sun4v_vintr_set_valid(unsigned long dev_handle, 1662unsigned long sun4v_vintr_set_valid(unsigned long dev_handle,
1660 unsigned long dev_ino, 1663 unsigned long dev_ino,
1661 unsigned long valid); 1664 unsigned long valid);
1662extern unsigned long sun4v_vintr_get_state(unsigned long dev_handle, 1665unsigned long sun4v_vintr_get_state(unsigned long dev_handle,
1663 unsigned long dev_ino, 1666 unsigned long dev_ino,
1664 unsigned long *state); 1667 unsigned long *state);
1665extern unsigned long sun4v_vintr_set_state(unsigned long dev_handle, 1668unsigned long sun4v_vintr_set_state(unsigned long dev_handle,
1666 unsigned long dev_ino, 1669 unsigned long dev_ino,
1667 unsigned long state); 1670 unsigned long state);
1668extern unsigned long sun4v_vintr_get_target(unsigned long dev_handle, 1671unsigned long sun4v_vintr_get_target(unsigned long dev_handle,
1669 unsigned long dev_ino, 1672 unsigned long dev_ino,
1670 unsigned long *cpuid); 1673 unsigned long *cpuid);
1671extern unsigned long sun4v_vintr_set_target(unsigned long dev_handle, 1674unsigned long sun4v_vintr_set_target(unsigned long dev_handle,
1672 unsigned long dev_ino, 1675 unsigned long dev_ino,
1673 unsigned long cpuid); 1676 unsigned long cpuid);
1674#endif 1677#endif
1675 1678
1676/* PCI IO services. 1679/* PCI IO services.
@@ -2627,50 +2630,50 @@ struct ldc_mtable_entry {
2627#define HV_FAST_LDC_REVOKE 0xef 2630#define HV_FAST_LDC_REVOKE 0xef
2628 2631
2629#ifndef __ASSEMBLY__ 2632#ifndef __ASSEMBLY__
2630extern unsigned long sun4v_ldc_tx_qconf(unsigned long channel, 2633unsigned long sun4v_ldc_tx_qconf(unsigned long channel,
2631 unsigned long ra, 2634 unsigned long ra,
2632 unsigned long num_entries); 2635 unsigned long num_entries);
2633extern unsigned long sun4v_ldc_tx_qinfo(unsigned long channel, 2636unsigned long sun4v_ldc_tx_qinfo(unsigned long channel,
2634 unsigned long *ra, 2637 unsigned long *ra,
2635 unsigned long *num_entries); 2638 unsigned long *num_entries);
2636extern unsigned long sun4v_ldc_tx_get_state(unsigned long channel, 2639unsigned long sun4v_ldc_tx_get_state(unsigned long channel,
2637 unsigned long *head_off, 2640 unsigned long *head_off,
2638 unsigned long *tail_off, 2641 unsigned long *tail_off,
2639 unsigned long *chan_state); 2642 unsigned long *chan_state);
2640extern unsigned long sun4v_ldc_tx_set_qtail(unsigned long channel, 2643unsigned long sun4v_ldc_tx_set_qtail(unsigned long channel,
2641 unsigned long tail_off); 2644 unsigned long tail_off);
2642extern unsigned long sun4v_ldc_rx_qconf(unsigned long channel, 2645unsigned long sun4v_ldc_rx_qconf(unsigned long channel,
2643 unsigned long ra, 2646 unsigned long ra,
2644 unsigned long num_entries); 2647 unsigned long num_entries);
2645extern unsigned long sun4v_ldc_rx_qinfo(unsigned long channel, 2648unsigned long sun4v_ldc_rx_qinfo(unsigned long channel,
2646 unsigned long *ra, 2649 unsigned long *ra,
2647 unsigned long *num_entries); 2650 unsigned long *num_entries);
2648extern unsigned long sun4v_ldc_rx_get_state(unsigned long channel, 2651unsigned long sun4v_ldc_rx_get_state(unsigned long channel,
2649 unsigned long *head_off, 2652 unsigned long *head_off,
2650 unsigned long *tail_off, 2653 unsigned long *tail_off,
2651 unsigned long *chan_state); 2654 unsigned long *chan_state);
2652extern unsigned long sun4v_ldc_rx_set_qhead(unsigned long channel, 2655unsigned long sun4v_ldc_rx_set_qhead(unsigned long channel,
2653 unsigned long head_off); 2656 unsigned long head_off);
2654extern unsigned long sun4v_ldc_set_map_table(unsigned long channel, 2657unsigned long sun4v_ldc_set_map_table(unsigned long channel,
2655 unsigned long ra, 2658 unsigned long ra,
2656 unsigned long num_entries); 2659 unsigned long num_entries);
2657extern unsigned long sun4v_ldc_get_map_table(unsigned long channel, 2660unsigned long sun4v_ldc_get_map_table(unsigned long channel,
2658 unsigned long *ra, 2661 unsigned long *ra,
2659 unsigned long *num_entries); 2662 unsigned long *num_entries);
2660extern unsigned long sun4v_ldc_copy(unsigned long channel, 2663unsigned long sun4v_ldc_copy(unsigned long channel,
2661 unsigned long dir_code, 2664 unsigned long dir_code,
2662 unsigned long tgt_raddr, 2665 unsigned long tgt_raddr,
2663 unsigned long lcl_raddr, 2666 unsigned long lcl_raddr,
2664 unsigned long len, 2667 unsigned long len,
2665 unsigned long *actual_len); 2668 unsigned long *actual_len);
2666extern unsigned long sun4v_ldc_mapin(unsigned long channel, 2669unsigned long sun4v_ldc_mapin(unsigned long channel,
2667 unsigned long cookie, 2670 unsigned long cookie,
2668 unsigned long *ra, 2671 unsigned long *ra,
2669 unsigned long *perm); 2672 unsigned long *perm);
2670extern unsigned long sun4v_ldc_unmap(unsigned long ra); 2673unsigned long sun4v_ldc_unmap(unsigned long ra);
2671extern unsigned long sun4v_ldc_revoke(unsigned long channel, 2674unsigned long sun4v_ldc_revoke(unsigned long channel,
2672 unsigned long cookie, 2675 unsigned long cookie,
2673 unsigned long mte_cookie); 2676 unsigned long mte_cookie);
2674#endif 2677#endif
2675 2678
2676/* Performance counter services. */ 2679/* Performance counter services. */
@@ -2727,14 +2730,14 @@ extern unsigned long sun4v_ldc_revoke(unsigned long channel,
2727#define HV_FAST_N2_SET_PERFREG 0x105 2730#define HV_FAST_N2_SET_PERFREG 0x105
2728 2731
2729#ifndef __ASSEMBLY__ 2732#ifndef __ASSEMBLY__
2730extern unsigned long sun4v_niagara_getperf(unsigned long reg, 2733unsigned long sun4v_niagara_getperf(unsigned long reg,
2731 unsigned long *val); 2734 unsigned long *val);
2732extern unsigned long sun4v_niagara_setperf(unsigned long reg, 2735unsigned long sun4v_niagara_setperf(unsigned long reg,
2733 unsigned long val); 2736 unsigned long val);
2734extern unsigned long sun4v_niagara2_getperf(unsigned long reg, 2737unsigned long sun4v_niagara2_getperf(unsigned long reg,
2735 unsigned long *val); 2738 unsigned long *val);
2736extern unsigned long sun4v_niagara2_setperf(unsigned long reg, 2739unsigned long sun4v_niagara2_setperf(unsigned long reg,
2737 unsigned long val); 2740 unsigned long val);
2738#endif 2741#endif
2739 2742
2740/* MMU statistics services. 2743/* MMU statistics services.
@@ -2829,8 +2832,8 @@ struct hv_mmu_statistics {
2829#define HV_FAST_MMUSTAT_INFO 0x103 2832#define HV_FAST_MMUSTAT_INFO 0x103
2830 2833
2831#ifndef __ASSEMBLY__ 2834#ifndef __ASSEMBLY__
2832extern unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra); 2835unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra);
2833extern unsigned long sun4v_mmustat_info(unsigned long *ra); 2836unsigned long sun4v_mmustat_info(unsigned long *ra);
2834#endif 2837#endif
2835 2838
2836/* NCS crypto services */ 2839/* NCS crypto services */
@@ -2919,9 +2922,9 @@ struct hv_ncs_qtail_update_arg {
2919#define HV_FAST_NCS_REQUEST 0x110 2922#define HV_FAST_NCS_REQUEST 0x110
2920 2923
2921#ifndef __ASSEMBLY__ 2924#ifndef __ASSEMBLY__
2922extern unsigned long sun4v_ncs_request(unsigned long request, 2925unsigned long sun4v_ncs_request(unsigned long request,
2923 unsigned long arg_ra, 2926 unsigned long arg_ra,
2924 unsigned long arg_size); 2927 unsigned long arg_size);
2925#endif 2928#endif
2926 2929
2927#define HV_FAST_FIRE_GET_PERFREG 0x120 2930#define HV_FAST_FIRE_GET_PERFREG 0x120
@@ -2930,18 +2933,18 @@ extern unsigned long sun4v_ncs_request(unsigned long request,
2930#define HV_FAST_REBOOT_DATA_SET 0x172 2933#define HV_FAST_REBOOT_DATA_SET 0x172
2931 2934
2932#ifndef __ASSEMBLY__ 2935#ifndef __ASSEMBLY__
2933extern unsigned long sun4v_reboot_data_set(unsigned long ra, 2936unsigned long sun4v_reboot_data_set(unsigned long ra,
2934 unsigned long len); 2937 unsigned long len);
2935#endif 2938#endif
2936 2939
2937#define HV_FAST_VT_GET_PERFREG 0x184 2940#define HV_FAST_VT_GET_PERFREG 0x184
2938#define HV_FAST_VT_SET_PERFREG 0x185 2941#define HV_FAST_VT_SET_PERFREG 0x185
2939 2942
2940#ifndef __ASSEMBLY__ 2943#ifndef __ASSEMBLY__
2941extern unsigned long sun4v_vt_get_perfreg(unsigned long reg_num, 2944unsigned long sun4v_vt_get_perfreg(unsigned long reg_num,
2942 unsigned long *reg_val); 2945 unsigned long *reg_val);
2943extern unsigned long sun4v_vt_set_perfreg(unsigned long reg_num, 2946unsigned long sun4v_vt_set_perfreg(unsigned long reg_num,
2944 unsigned long reg_val); 2947 unsigned long reg_val);
2945#endif 2948#endif
2946 2949
2947/* Function numbers for HV_CORE_TRAP. */ 2950/* Function numbers for HV_CORE_TRAP. */
@@ -2978,21 +2981,21 @@ extern unsigned long sun4v_vt_set_perfreg(unsigned long reg_num,
2978#define HV_GRP_DIAG 0x0300 2981#define HV_GRP_DIAG 0x0300
2979 2982
2980#ifndef __ASSEMBLY__ 2983#ifndef __ASSEMBLY__
2981extern unsigned long sun4v_get_version(unsigned long group, 2984unsigned long sun4v_get_version(unsigned long group,
2982 unsigned long *major, 2985 unsigned long *major,
2983 unsigned long *minor); 2986 unsigned long *minor);
2984extern unsigned long sun4v_set_version(unsigned long group, 2987unsigned long sun4v_set_version(unsigned long group,
2985 unsigned long major, 2988 unsigned long major,
2986 unsigned long minor, 2989 unsigned long minor,
2987 unsigned long *actual_minor); 2990 unsigned long *actual_minor);
2988 2991
2989extern int sun4v_hvapi_register(unsigned long group, unsigned long major, 2992int sun4v_hvapi_register(unsigned long group, unsigned long major,
2990 unsigned long *minor); 2993 unsigned long *minor);
2991extern void sun4v_hvapi_unregister(unsigned long group); 2994void sun4v_hvapi_unregister(unsigned long group);
2992extern int sun4v_hvapi_get(unsigned long group, 2995int sun4v_hvapi_get(unsigned long group,
2993 unsigned long *major, 2996 unsigned long *major,
2994 unsigned long *minor); 2997 unsigned long *minor);
2995extern void sun4v_hvapi_init(void); 2998void sun4v_hvapi_init(void);
2996#endif 2999#endif
2997 3000
2998#endif /* !(_SPARC64_HYPERVISOR_H) */ 3001#endif /* !(_SPARC64_HYPERVISOR_H) */
diff --git a/arch/sparc/include/asm/idprom.h b/arch/sparc/include/asm/idprom.h
index 6976aa2439c6..3793f7f91c42 100644
--- a/arch/sparc/include/asm/idprom.h
+++ b/arch/sparc/include/asm/idprom.h
@@ -20,6 +20,6 @@ struct idprom {
20}; 20};
21 21
22extern struct idprom *idprom; 22extern struct idprom *idprom;
23extern void idprom_init(void); 23void idprom_init(void);
24 24
25#endif /* !(_SPARC_IDPROM_H) */ 25#endif /* !(_SPARC_IDPROM_H) */
diff --git a/arch/sparc/include/asm/io-unit.h b/arch/sparc/include/asm/io-unit.h
index 01ab2f613e91..04a9701e7202 100644
--- a/arch/sparc/include/asm/io-unit.h
+++ b/arch/sparc/include/asm/io-unit.h
@@ -43,7 +43,7 @@
43struct iounit_struct { 43struct iounit_struct {
44 unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)]; 44 unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)];
45 spinlock_t lock; 45 spinlock_t lock;
46 iopte_t *page_table; 46 iopte_t __iomem *page_table;
47 unsigned long rotor[3]; 47 unsigned long rotor[3];
48 unsigned long limit[4]; 48 unsigned long limit[4];
49}; 49};
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index c1acbd891cbc..9f532902627c 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -2,191 +2,94 @@
2#define __SPARC_IO_H 2#define __SPARC_IO_H
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/types.h>
6#include <linux/ioport.h> /* struct resource */ 5#include <linux/ioport.h> /* struct resource */
7 6
8#include <asm/page.h> /* IO address mapping routines need this */ 7#define readb_relaxed(__addr) readb(__addr)
9#include <asm-generic/pci_iomap.h> 8#define readw_relaxed(__addr) readw(__addr)
10 9#define readl_relaxed(__addr) readl(__addr)
11#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
12
13static inline u32 flip_dword (u32 l)
14{
15 return ((l&0xff)<<24) | (((l>>8)&0xff)<<16) | (((l>>16)&0xff)<<8)| ((l>>24)&0xff);
16}
17
18static inline u16 flip_word (u16 w)
19{
20 return ((w&0xff) << 8) | ((w>>8)&0xff);
21}
22
23#define mmiowb()
24
25/*
26 * Memory mapped I/O to PCI
27 */
28
29static inline u8 __raw_readb(const volatile void __iomem *addr)
30{
31 return *(__force volatile u8 *)addr;
32}
33
34static inline u16 __raw_readw(const volatile void __iomem *addr)
35{
36 return *(__force volatile u16 *)addr;
37}
38
39static inline u32 __raw_readl(const volatile void __iomem *addr)
40{
41 return *(__force volatile u32 *)addr;
42}
43 10
44static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 11#define IO_SPACE_LIMIT 0xffffffff
45{
46 *(__force volatile u8 *)addr = b;
47}
48 12
49static inline void __raw_writew(u16 w, volatile void __iomem *addr) 13#define memset_io(d,c,sz) _memset_io(d,c,sz)
50{ 14#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz)
51 *(__force volatile u16 *)addr = w; 15#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
52}
53 16
54static inline void __raw_writel(u32 l, volatile void __iomem *addr) 17#include <asm-generic/io.h>
55{
56 *(__force volatile u32 *)addr = l;
57}
58 18
59static inline u8 __readb(const volatile void __iomem *addr) 19static inline void _memset_io(volatile void __iomem *dst,
20 int c, __kernel_size_t n)
60{ 21{
61 return *(__force volatile u8 *)addr; 22 volatile void __iomem *d = dst;
62}
63 23
64static inline u16 __readw(const volatile void __iomem *addr) 24 while (n--) {
65{ 25 writeb(c, d);
66 return flip_word(*(__force volatile u16 *)addr); 26 d++;
27 }
67} 28}
68 29
69static inline u32 __readl(const volatile void __iomem *addr) 30static inline void _memcpy_fromio(void *dst, const volatile void __iomem *src,
31 __kernel_size_t n)
70{ 32{
71 return flip_dword(*(__force volatile u32 *)addr); 33 char *d = dst;
72}
73 34
74static inline void __writeb(u8 b, volatile void __iomem *addr) 35 while (n--) {
75{ 36 char tmp = readb(src);
76 *(__force volatile u8 *)addr = b; 37 *d++ = tmp;
38 src++;
39 }
77} 40}
78 41
79static inline void __writew(u16 w, volatile void __iomem *addr) 42static inline void _memcpy_toio(volatile void __iomem *dst, const void *src,
43 __kernel_size_t n)
80{ 44{
81 *(__force volatile u16 *)addr = flip_word(w); 45 const char *s = src;
82} 46 volatile void __iomem *d = dst;
83 47
84static inline void __writel(u32 l, volatile void __iomem *addr) 48 while (n--) {
85{ 49 char tmp = *s++;
86 *(__force volatile u32 *)addr = flip_dword(l); 50 writeb(tmp, d);
51 d++;
52 }
87} 53}
88 54
89#define readb(__addr) __readb(__addr)
90#define readw(__addr) __readw(__addr)
91#define readl(__addr) __readl(__addr)
92#define readb_relaxed(__addr) readb(__addr)
93#define readw_relaxed(__addr) readw(__addr)
94#define readl_relaxed(__addr) readl(__addr)
95
96#define writeb(__b, __addr) __writeb((__b),(__addr))
97#define writew(__w, __addr) __writew((__w),(__addr))
98#define writel(__l, __addr) __writel((__l),(__addr))
99
100/*
101 * I/O space operations
102 *
103 * Arrangement on a Sun is somewhat complicated.
104 *
105 * First of all, we want to use standard Linux drivers
106 * for keyboard, PC serial, etc. These drivers think
107 * they access I/O space and use inb/outb.
108 * On the other hand, EBus bridge accepts PCI *memory*
109 * cycles and converts them into ISA *I/O* cycles.
110 * Ergo, we want inb & outb to generate PCI memory cycles.
111 *
112 * If we want to issue PCI *I/O* cycles, we do this
113 * with a low 64K fixed window in PCIC. This window gets
114 * mapped somewhere into virtual kernel space and we
115 * can use inb/outb again.
116 */
117#define inb_local(__addr) __readb((void __iomem *)(unsigned long)(__addr))
118#define inb(__addr) __readb((void __iomem *)(unsigned long)(__addr))
119#define inw(__addr) __readw((void __iomem *)(unsigned long)(__addr))
120#define inl(__addr) __readl((void __iomem *)(unsigned long)(__addr))
121
122#define outb_local(__b, __addr) __writeb(__b, (void __iomem *)(unsigned long)(__addr))
123#define outb(__b, __addr) __writeb(__b, (void __iomem *)(unsigned long)(__addr))
124#define outw(__w, __addr) __writew(__w, (void __iomem *)(unsigned long)(__addr))
125#define outl(__l, __addr) __writel(__l, (void __iomem *)(unsigned long)(__addr))
126
127#define inb_p(__addr) inb(__addr)
128#define outb_p(__b, __addr) outb(__b, __addr)
129#define inw_p(__addr) inw(__addr)
130#define outw_p(__w, __addr) outw(__w, __addr)
131#define inl_p(__addr) inl(__addr)
132#define outl_p(__l, __addr) outl(__l, __addr)
133
134void outsb(unsigned long addr, const void *src, unsigned long cnt);
135void outsw(unsigned long addr, const void *src, unsigned long cnt);
136void outsl(unsigned long addr, const void *src, unsigned long cnt);
137void insb(unsigned long addr, void *dst, unsigned long count);
138void insw(unsigned long addr, void *dst, unsigned long count);
139void insl(unsigned long addr, void *dst, unsigned long count);
140
141#define IO_SPACE_LIMIT 0xffffffff
142
143/* 55/*
144 * SBus accessors. 56 * SBus accessors.
145 * 57 *
146 * SBus has only one, memory mapped, I/O space. 58 * SBus has only one, memory mapped, I/O space.
147 * We do not need to flip bytes for SBus of course. 59 * We do not need to flip bytes for SBus of course.
148 */ 60 */
149static inline u8 _sbus_readb(const volatile void __iomem *addr) 61static inline u8 sbus_readb(const volatile void __iomem *addr)
150{ 62{
151 return *(__force volatile u8 *)addr; 63 return *(__force volatile u8 *)addr;
152} 64}
153 65
154static inline u16 _sbus_readw(const volatile void __iomem *addr) 66static inline u16 sbus_readw(const volatile void __iomem *addr)
155{ 67{
156 return *(__force volatile u16 *)addr; 68 return *(__force volatile u16 *)addr;
157} 69}
158 70
159static inline u32 _sbus_readl(const volatile void __iomem *addr) 71static inline u32 sbus_readl(const volatile void __iomem *addr)
160{ 72{
161 return *(__force volatile u32 *)addr; 73 return *(__force volatile u32 *)addr;
162} 74}
163 75
164static inline void _sbus_writeb(u8 b, volatile void __iomem *addr) 76static inline void sbus_writeb(u8 b, volatile void __iomem *addr)
165{ 77{
166 *(__force volatile u8 *)addr = b; 78 *(__force volatile u8 *)addr = b;
167} 79}
168 80
169static inline void _sbus_writew(u16 w, volatile void __iomem *addr) 81static inline void sbus_writew(u16 w, volatile void __iomem *addr)
170{ 82{
171 *(__force volatile u16 *)addr = w; 83 *(__force volatile u16 *)addr = w;
172} 84}
173 85
174static inline void _sbus_writel(u32 l, volatile void __iomem *addr) 86static inline void sbus_writel(u32 l, volatile void __iomem *addr)
175{ 87{
176 *(__force volatile u32 *)addr = l; 88 *(__force volatile u32 *)addr = l;
177} 89}
178 90
179/* 91static inline void sbus_memset_io(volatile void __iomem *__dst, int c,
180 * The only reason for #define's is to hide casts to unsigned long. 92 __kernel_size_t n)
181 */
182#define sbus_readb(__addr) _sbus_readb(__addr)
183#define sbus_readw(__addr) _sbus_readw(__addr)
184#define sbus_readl(__addr) _sbus_readl(__addr)
185#define sbus_writeb(__b, __addr) _sbus_writeb(__b, __addr)
186#define sbus_writew(__w, __addr) _sbus_writew(__w, __addr)
187#define sbus_writel(__l, __addr) _sbus_writel(__l, __addr)
188
189static inline void sbus_memset_io(volatile void __iomem *__dst, int c, __kernel_size_t n)
190{ 93{
191 while(n--) { 94 while(n--) {
192 sbus_writeb(c, __dst); 95 sbus_writeb(c, __dst);
@@ -194,22 +97,9 @@ static inline void sbus_memset_io(volatile void __iomem *__dst, int c, __kernel_
194 } 97 }
195} 98}
196 99
197static inline void 100static inline void sbus_memcpy_fromio(void *dst,
198_memset_io(volatile void __iomem *dst, int c, __kernel_size_t n) 101 const volatile void __iomem *src,
199{ 102 __kernel_size_t n)
200 volatile void __iomem *d = dst;
201
202 while (n--) {
203 writeb(c, d);
204 d++;
205 }
206}
207
208#define memset_io(d,c,sz) _memset_io(d,c,sz)
209
210static inline void
211_sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
212 __kernel_size_t n)
213{ 103{
214 char *d = dst; 104 char *d = dst;
215 105
@@ -220,25 +110,9 @@ _sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
220 } 110 }
221} 111}
222 112
223#define sbus_memcpy_fromio(d, s, sz) _sbus_memcpy_fromio(d, s, sz) 113static inline void sbus_memcpy_toio(volatile void __iomem *dst,
224 114 const void *src,
225static inline void 115 __kernel_size_t n)
226_memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
227{
228 char *d = dst;
229
230 while (n--) {
231 char tmp = readb(src);
232 *d++ = tmp;
233 src++;
234 }
235}
236
237#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz)
238
239static inline void
240_sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
241 __kernel_size_t n)
242{ 116{
243 const char *s = src; 117 const char *s = src;
244 volatile void __iomem *d = dst; 118 volatile void __iomem *d = dst;
@@ -250,81 +124,26 @@ _sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
250 } 124 }
251} 125}
252 126
253#define sbus_memcpy_toio(d, s, sz) _sbus_memcpy_toio(d, s, sz)
254
255static inline void
256_memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
257{
258 const char *s = src;
259 volatile void __iomem *d = dst;
260
261 while (n--) {
262 char tmp = *s++;
263 writeb(tmp, d);
264 d++;
265 }
266}
267
268#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
269
270#ifdef __KERNEL__ 127#ifdef __KERNEL__
271 128
272/* 129/*
273 * Bus number may be embedded in the higher bits of the physical address. 130 * Bus number may be embedded in the higher bits of the physical address.
274 * This is why we have no bus number argument to ioremap(). 131 * This is why we have no bus number argument to ioremap().
275 */ 132 */
276extern void __iomem *ioremap(unsigned long offset, unsigned long size); 133void __iomem *ioremap(unsigned long offset, unsigned long size);
277#define ioremap_nocache(X,Y) ioremap((X),(Y)) 134#define ioremap_nocache(X,Y) ioremap((X),(Y))
278#define ioremap_wc(X,Y) ioremap((X),(Y)) 135#define ioremap_wc(X,Y) ioremap((X),(Y))
279extern void iounmap(volatile void __iomem *addr); 136void iounmap(volatile void __iomem *addr);
280
281#define ioread8(X) readb(X)
282#define ioread16(X) readw(X)
283#define ioread16be(X) __raw_readw(X)
284#define ioread32(X) readl(X)
285#define ioread32be(X) __raw_readl(X)
286#define iowrite8(val,X) writeb(val,X)
287#define iowrite16(val,X) writew(val,X)
288#define iowrite16be(val,X) __raw_writew(val,X)
289#define iowrite32(val,X) writel(val,X)
290#define iowrite32be(val,X) __raw_writel(val,X)
291
292static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count)
293{
294 insb((unsigned long __force)port, buf, count);
295}
296static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count)
297{
298 insw((unsigned long __force)port, buf, count);
299}
300
301static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count)
302{
303 insl((unsigned long __force)port, buf, count);
304}
305
306static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count)
307{
308 outsb((unsigned long __force)port, buf, count);
309}
310
311static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count)
312{
313 outsw((unsigned long __force)port, buf, count);
314}
315
316static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count)
317{
318 outsl((unsigned long __force)port, buf, count);
319}
320 137
321/* Create a virtual mapping cookie for an IO port range */ 138/* Create a virtual mapping cookie for an IO port range */
322extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 139void __iomem *ioport_map(unsigned long port, unsigned int nr);
323extern void ioport_unmap(void __iomem *); 140void ioport_unmap(void __iomem *);
324 141
325/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 142/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
326struct pci_dev; 143struct pci_dev;
327extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 144void pci_iounmap(struct pci_dev *dev, void __iomem *);
145
146
328 147
329/* 148/*
330 * At the moment, we do not use CMOS_READ anywhere outside of rtc.c, 149 * At the moment, we do not use CMOS_READ anywhere outside of rtc.c,
@@ -343,21 +162,11 @@ static inline int sbus_can_burst64(void)
343 return 0; /* actually, sparc_cpu_model==sun4d */ 162 return 0; /* actually, sparc_cpu_model==sun4d */
344} 163}
345struct device; 164struct device;
346extern void sbus_set_sbus64(struct device *, int); 165void sbus_set_sbus64(struct device *, int);
347 166
348#endif 167#endif
349 168
350#define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 169#define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1
351 170
352/*
353 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
354 * access
355 */
356#define xlate_dev_mem_ptr(p) __va(p)
357
358/*
359 * Convert a virtual cached pointer to an uncached pointer
360 */
361#define xlate_dev_kmem_ptr(p) p
362 171
363#endif /* !(__SPARC_IO_H) */ 172#endif /* !(__SPARC_IO_H) */
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 09b0b88aeb2a..05381c3a4228 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -15,7 +15,6 @@
15 15
16/* BIO layer definitions. */ 16/* BIO layer definitions. */
17extern unsigned long kern_base, kern_size; 17extern unsigned long kern_base, kern_size;
18#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
19 18
20static inline u8 _inb(unsigned long addr) 19static inline u8 _inb(unsigned long addr)
21{ 20{
@@ -91,12 +90,12 @@ static inline void _outl(u32 l, unsigned long addr)
91#define inl_p(__addr) inl(__addr) 90#define inl_p(__addr) inl(__addr)
92#define outl_p(__l, __addr) outl(__l, __addr) 91#define outl_p(__l, __addr) outl(__l, __addr)
93 92
94extern void outsb(unsigned long, const void *, unsigned long); 93void outsb(unsigned long, const void *, unsigned long);
95extern void outsw(unsigned long, const void *, unsigned long); 94void outsw(unsigned long, const void *, unsigned long);
96extern void outsl(unsigned long, const void *, unsigned long); 95void outsl(unsigned long, const void *, unsigned long);
97extern void insb(unsigned long, void *, unsigned long); 96void insb(unsigned long, void *, unsigned long);
98extern void insw(unsigned long, void *, unsigned long); 97void insw(unsigned long, void *, unsigned long);
99extern void insl(unsigned long, void *, unsigned long); 98void insl(unsigned long, void *, unsigned long);
100 99
101static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) 100static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count)
102{ 101{
@@ -509,12 +508,12 @@ static inline void iounmap(volatile void __iomem *addr)
509#define iowrite32be(val,X) __raw_writel(val,X) 508#define iowrite32be(val,X) __raw_writel(val,X)
510 509
511/* Create a virtual mapping cookie for an IO port range */ 510/* Create a virtual mapping cookie for an IO port range */
512extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 511void __iomem *ioport_map(unsigned long port, unsigned int nr);
513extern void ioport_unmap(void __iomem *); 512void ioport_unmap(void __iomem *);
514 513
515/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 514/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
516struct pci_dev; 515struct pci_dev;
517extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 516void pci_iounmap(struct pci_dev *dev, void __iomem *);
518 517
519static inline int sbus_can_dma_64bit(void) 518static inline int sbus_can_dma_64bit(void)
520{ 519{
@@ -525,7 +524,7 @@ static inline int sbus_can_burst64(void)
525 return 1; 524 return 1;
526} 525}
527struct device; 526struct device;
528extern void sbus_set_sbus64(struct device *, int); 527void sbus_set_sbus64(struct device *, int);
529 528
530/* 529/*
531 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 530 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
diff --git a/arch/sparc/include/asm/iommu_32.h b/arch/sparc/include/asm/iommu_32.h
index 70c589c05a10..f6c066b52fd6 100644
--- a/arch/sparc/include/asm/iommu_32.h
+++ b/arch/sparc/include/asm/iommu_32.h
@@ -99,7 +99,7 @@ struct iommu_regs {
99#define IOPTE_WAZ 0x00000001 /* Write as zeros */ 99#define IOPTE_WAZ 0x00000001 /* Write as zeros */
100 100
101struct iommu_struct { 101struct iommu_struct {
102 struct iommu_regs *regs; 102 struct iommu_regs __iomem *regs;
103 iopte_t *page_table; 103 iopte_t *page_table;
104 /* For convenience */ 104 /* For convenience */
105 unsigned long start; /* First managed virtual address */ 105 unsigned long start; /* First managed virtual address */
@@ -108,14 +108,14 @@ struct iommu_struct {
108 struct bit_map usemap; 108 struct bit_map usemap;
109}; 109};
110 110
111static inline void iommu_invalidate(struct iommu_regs *regs) 111static inline void iommu_invalidate(struct iommu_regs __iomem *regs)
112{ 112{
113 regs->tlbflush = 0; 113 sbus_writel(0, &regs->tlbflush);
114} 114}
115 115
116static inline void iommu_invalidate_page(struct iommu_regs *regs, unsigned long ba) 116static inline void iommu_invalidate_page(struct iommu_regs __iomem *regs, unsigned long ba)
117{ 117{
118 regs->pageflush = (ba & PAGE_MASK); 118 sbus_writel(ba & PAGE_MASK, &regs->pageflush);
119} 119}
120 120
121#endif /* !(_SPARC_IOMMU_H) */ 121#endif /* !(_SPARC_IOMMU_H) */
diff --git a/arch/sparc/include/asm/iommu_64.h b/arch/sparc/include/asm/iommu_64.h
index caf798b56191..2b9321ab064d 100644
--- a/arch/sparc/include/asm/iommu_64.h
+++ b/arch/sparc/include/asm/iommu_64.h
@@ -58,8 +58,8 @@ struct strbuf {
58 volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)]; 58 volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)];
59}; 59};
60 60
61extern int iommu_table_init(struct iommu *iommu, int tsbsize, 61int iommu_table_init(struct iommu *iommu, int tsbsize,
62 u32 dma_offset, u32 dma_addr_mask, 62 u32 dma_offset, u32 dma_addr_mask,
63 int numa_node); 63 int numa_node);
64 64
65#endif /* !(_SPARC64_IOMMU_H) */ 65#endif /* !(_SPARC64_IOMMU_H) */
diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h
index 2ae3acaeb1b3..eecd3d8442c9 100644
--- a/arch/sparc/include/asm/irq_32.h
+++ b/arch/sparc/include/asm/irq_32.h
@@ -16,7 +16,8 @@
16 16
17#define irq_canonicalize(irq) (irq) 17#define irq_canonicalize(irq) (irq)
18 18
19extern void __init init_IRQ(void); 19void __init init_IRQ(void);
20void __init sun4d_init_sbi_irq(void);
20 21
21#define NO_IRQ 0xffffffff 22#define NO_IRQ 0xffffffff
22 23
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h
index abf6afe82ca8..375cffcf7dbd 100644
--- a/arch/sparc/include/asm/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
@@ -39,32 +39,32 @@
39 */ 39 */
40#define NR_IRQS 255 40#define NR_IRQS 255
41 41
42extern void irq_install_pre_handler(int irq, 42void irq_install_pre_handler(int irq,
43 void (*func)(unsigned int, void *, void *), 43 void (*func)(unsigned int, void *, void *),
44 void *arg1, void *arg2); 44 void *arg1, void *arg2);
45#define irq_canonicalize(irq) (irq) 45#define irq_canonicalize(irq) (irq)
46extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap); 46unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap);
47extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino); 47unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino);
48extern unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino); 48unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino);
49extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *irq_p, 49unsigned int sun4v_build_msi(u32 devhandle, unsigned int *irq_p,
50 unsigned int msi_devino_start, 50 unsigned int msi_devino_start,
51 unsigned int msi_devino_end); 51 unsigned int msi_devino_end);
52extern void sun4v_destroy_msi(unsigned int irq); 52void sun4v_destroy_msi(unsigned int irq);
53extern unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p, 53unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p,
54 unsigned int msi_devino_start, 54 unsigned int msi_devino_start,
55 unsigned int msi_devino_end, 55 unsigned int msi_devino_end,
56 unsigned long imap_base, 56 unsigned long imap_base,
57 unsigned long iclr_base); 57 unsigned long iclr_base);
58extern void sun4u_destroy_msi(unsigned int irq); 58void sun4u_destroy_msi(unsigned int irq);
59 59
60extern unsigned char irq_alloc(unsigned int dev_handle, 60unsigned char irq_alloc(unsigned int dev_handle,
61 unsigned int dev_ino); 61 unsigned int dev_ino);
62#ifdef CONFIG_PCI_MSI 62#ifdef CONFIG_PCI_MSI
63extern void irq_free(unsigned int irq); 63void irq_free(unsigned int irq);
64#endif 64#endif
65 65
66extern void __init init_IRQ(void); 66void __init init_IRQ(void);
67extern void fixup_irqs(void); 67void fixup_irqs(void);
68 68
69static inline void set_softint(unsigned long bits) 69static inline void set_softint(unsigned long bits)
70{ 70{
diff --git a/arch/sparc/include/asm/irqflags_32.h b/arch/sparc/include/asm/irqflags_32.h
index e414c06615c1..71cc284f55c5 100644
--- a/arch/sparc/include/asm/irqflags_32.h
+++ b/arch/sparc/include/asm/irqflags_32.h
@@ -15,9 +15,9 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <asm/psr.h> 16#include <asm/psr.h>
17 17
18extern void arch_local_irq_restore(unsigned long); 18void arch_local_irq_restore(unsigned long);
19extern unsigned long arch_local_irq_save(void); 19unsigned long arch_local_irq_save(void);
20extern void arch_local_irq_enable(void); 20void arch_local_irq_enable(void);
21 21
22static inline notrace unsigned long arch_local_save_flags(void) 22static inline notrace unsigned long arch_local_save_flags(void)
23{ 23{
diff --git a/arch/sparc/include/asm/kdebug_64.h b/arch/sparc/include/asm/kdebug_64.h
index feb3578e12c4..04465de8f3b5 100644
--- a/arch/sparc/include/asm/kdebug_64.h
+++ b/arch/sparc/include/asm/kdebug_64.h
@@ -3,7 +3,7 @@
3 3
4struct pt_regs; 4struct pt_regs;
5 5
6extern void bad_trap(struct pt_regs *, long); 6void bad_trap(struct pt_regs *, long);
7 7
8/* Grossly misnamed. */ 8/* Grossly misnamed. */
9enum die_val { 9enum die_val {
diff --git a/arch/sparc/include/asm/kgdb.h b/arch/sparc/include/asm/kgdb.h
index b6ef301d05bf..47366af7a589 100644
--- a/arch/sparc/include/asm/kgdb.h
+++ b/arch/sparc/include/asm/kgdb.h
@@ -28,9 +28,12 @@ enum regnames {
28#define NUMREGBYTES ((GDB_CSR + 1) * 4) 28#define NUMREGBYTES ((GDB_CSR + 1) * 4)
29#else 29#else
30#define NUMREGBYTES ((GDB_Y + 1) * 8) 30#define NUMREGBYTES ((GDB_Y + 1) * 8)
31
32struct pt_regs;
33asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs);
31#endif 34#endif
32 35
33extern void arch_kgdb_breakpoint(void); 36void arch_kgdb_breakpoint(void);
34 37
35#define BREAK_INSTR_SIZE 4 38#define BREAK_INSTR_SIZE 4
36#define CACHE_FLUSH_IS_SAFE 1 39#define CACHE_FLUSH_IS_SAFE 1
diff --git a/arch/sparc/include/asm/kprobes.h b/arch/sparc/include/asm/kprobes.h
index 5879d71afdaa..a145d798e112 100644
--- a/arch/sparc/include/asm/kprobes.h
+++ b/arch/sparc/include/asm/kprobes.h
@@ -43,7 +43,9 @@ struct kprobe_ctlblk {
43 struct prev_kprobe prev_kprobe; 43 struct prev_kprobe prev_kprobe;
44}; 44};
45 45
46extern int kprobe_exceptions_notify(struct notifier_block *self, 46int kprobe_exceptions_notify(struct notifier_block *self,
47 unsigned long val, void *data); 47 unsigned long val, void *data);
48extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 48int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
49asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
50 struct pt_regs *regs);
49#endif /* _SPARC64_KPROBES_H */ 51#endif /* _SPARC64_KPROBES_H */
diff --git a/arch/sparc/include/asm/ldc.h b/arch/sparc/include/asm/ldc.h
index bdb524a7b814..c8c67f621f4f 100644
--- a/arch/sparc/include/asm/ldc.h
+++ b/arch/sparc/include/asm/ldc.h
@@ -4,9 +4,9 @@
4#include <asm/hypervisor.h> 4#include <asm/hypervisor.h>
5 5
6extern int ldom_domaining_enabled; 6extern int ldom_domaining_enabled;
7extern void ldom_set_var(const char *var, const char *value); 7void ldom_set_var(const char *var, const char *value);
8extern void ldom_reboot(const char *boot_command); 8void ldom_reboot(const char *boot_command);
9extern void ldom_power_off(void); 9void ldom_power_off(void);
10 10
11/* The event handler will be evoked when link state changes 11/* The event handler will be evoked when link state changes
12 * or data becomes available on the receive side. 12 * or data becomes available on the receive side.
@@ -51,30 +51,30 @@ struct ldc_channel_config {
51struct ldc_channel; 51struct ldc_channel;
52 52
53/* Allocate state for a channel. */ 53/* Allocate state for a channel. */
54extern struct ldc_channel *ldc_alloc(unsigned long id, 54struct ldc_channel *ldc_alloc(unsigned long id,
55 const struct ldc_channel_config *cfgp, 55 const struct ldc_channel_config *cfgp,
56 void *event_arg); 56 void *event_arg);
57 57
58/* Shut down and free state for a channel. */ 58/* Shut down and free state for a channel. */
59extern void ldc_free(struct ldc_channel *lp); 59void ldc_free(struct ldc_channel *lp);
60 60
61/* Register TX and RX queues of the link with the hypervisor. */ 61/* Register TX and RX queues of the link with the hypervisor. */
62extern int ldc_bind(struct ldc_channel *lp, const char *name); 62int ldc_bind(struct ldc_channel *lp, const char *name);
63 63
64/* For non-RAW protocols we need to complete a handshake before 64/* For non-RAW protocols we need to complete a handshake before
65 * communication can proceed. ldc_connect() does that, if the 65 * communication can proceed. ldc_connect() does that, if the
66 * handshake completes successfully, an LDC_EVENT_UP event will 66 * handshake completes successfully, an LDC_EVENT_UP event will
67 * be sent up to the driver. 67 * be sent up to the driver.
68 */ 68 */
69extern int ldc_connect(struct ldc_channel *lp); 69int ldc_connect(struct ldc_channel *lp);
70extern int ldc_disconnect(struct ldc_channel *lp); 70int ldc_disconnect(struct ldc_channel *lp);
71 71
72extern int ldc_state(struct ldc_channel *lp); 72int ldc_state(struct ldc_channel *lp);
73 73
74/* Read and write operations. Only valid when the link is up. */ 74/* Read and write operations. Only valid when the link is up. */
75extern int ldc_write(struct ldc_channel *lp, const void *buf, 75int ldc_write(struct ldc_channel *lp, const void *buf,
76 unsigned int size); 76 unsigned int size);
77extern int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size); 77int ldc_read(struct ldc_channel *lp, void *buf, unsigned int size);
78 78
79#define LDC_MAP_SHADOW 0x01 79#define LDC_MAP_SHADOW 0x01
80#define LDC_MAP_DIRECT 0x02 80#define LDC_MAP_DIRECT 0x02
@@ -92,22 +92,22 @@ struct ldc_trans_cookie {
92}; 92};
93 93
94struct scatterlist; 94struct scatterlist;
95extern int ldc_map_sg(struct ldc_channel *lp, 95int ldc_map_sg(struct ldc_channel *lp,
96 struct scatterlist *sg, int num_sg, 96 struct scatterlist *sg, int num_sg,
97 struct ldc_trans_cookie *cookies, int ncookies, 97 struct ldc_trans_cookie *cookies, int ncookies,
98 unsigned int map_perm); 98 unsigned int map_perm);
99 99
100extern int ldc_map_single(struct ldc_channel *lp, 100int ldc_map_single(struct ldc_channel *lp,
101 void *buf, unsigned int len, 101 void *buf, unsigned int len,
102 struct ldc_trans_cookie *cookies, int ncookies, 102 struct ldc_trans_cookie *cookies, int ncookies,
103 unsigned int map_perm); 103 unsigned int map_perm);
104 104
105extern void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies, 105void ldc_unmap(struct ldc_channel *lp, struct ldc_trans_cookie *cookies,
106 int ncookies); 106 int ncookies);
107 107
108extern int ldc_copy(struct ldc_channel *lp, int copy_dir, 108int ldc_copy(struct ldc_channel *lp, int copy_dir,
109 void *buf, unsigned int len, unsigned long offset, 109 void *buf, unsigned int len, unsigned long offset,
110 struct ldc_trans_cookie *cookies, int ncookies); 110 struct ldc_trans_cookie *cookies, int ncookies);
111 111
112static inline int ldc_get_dring_entry(struct ldc_channel *lp, 112static inline int ldc_get_dring_entry(struct ldc_channel *lp,
113 void *buf, unsigned int len, 113 void *buf, unsigned int len,
@@ -127,12 +127,12 @@ static inline int ldc_put_dring_entry(struct ldc_channel *lp,
127 return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies); 127 return ldc_copy(lp, LDC_COPY_OUT, buf, len, offset, cookies, ncookies);
128} 128}
129 129
130extern void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len, 130void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len,
131 struct ldc_trans_cookie *cookies, 131 struct ldc_trans_cookie *cookies,
132 int *ncookies, unsigned int map_perm); 132 int *ncookies, unsigned int map_perm);
133 133
134extern void ldc_free_exp_dring(struct ldc_channel *lp, void *buf, 134void ldc_free_exp_dring(struct ldc_channel *lp, void *buf,
135 unsigned int len, 135 unsigned int len,
136 struct ldc_trans_cookie *cookies, int ncookies); 136 struct ldc_trans_cookie *cookies, int ncookies);
137 137
138#endif /* _SPARC64_LDC_H */ 138#endif /* _SPARC64_LDC_H */
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index c2f6ff6d7a35..204771cd74a5 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -82,8 +82,8 @@ static inline unsigned long leon_load_reg(unsigned long paddr)
82#define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x)) 82#define LEON_BYPASS_LOAD_PA(x) leon_load_reg((unsigned long)(x))
83#define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v)) 83#define LEON_BYPASS_STORE_PA(x, v) leon_store_reg((unsigned long)(x), (unsigned long)(v))
84 84
85extern void leon_switch_mm(void); 85void leon_switch_mm(void);
86extern void leon_init_IRQ(void); 86void leon_init_IRQ(void);
87 87
88static inline unsigned long sparc_leon3_get_dcachecfg(void) 88static inline unsigned long sparc_leon3_get_dcachecfg(void)
89{ 89{
@@ -196,14 +196,14 @@ static inline int sparc_leon3_cpuid(void)
196#ifndef __ASSEMBLY__ 196#ifndef __ASSEMBLY__
197struct vm_area_struct; 197struct vm_area_struct;
198 198
199extern unsigned long leon_swprobe(unsigned long vaddr, unsigned long *paddr); 199unsigned long leon_swprobe(unsigned long vaddr, unsigned long *paddr);
200extern void leon_flush_icache_all(void); 200void leon_flush_icache_all(void);
201extern void leon_flush_dcache_all(void); 201void leon_flush_dcache_all(void);
202extern void leon_flush_cache_all(void); 202void leon_flush_cache_all(void);
203extern void leon_flush_tlb_all(void); 203void leon_flush_tlb_all(void);
204extern int leon_flush_during_switch; 204extern int leon_flush_during_switch;
205extern int leon_flush_needed(void); 205int leon_flush_needed(void);
206extern void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page); 206void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page);
207 207
208/* struct that hold LEON3 cache configuration registers */ 208/* struct that hold LEON3 cache configuration registers */
209struct leon3_cacheregs { 209struct leon3_cacheregs {
@@ -217,29 +217,29 @@ struct leon3_cacheregs {
217 217
218struct device_node; 218struct device_node;
219struct task_struct; 219struct task_struct;
220extern unsigned int leon_build_device_irq(unsigned int real_irq, 220unsigned int leon_build_device_irq(unsigned int real_irq,
221 irq_flow_handler_t flow_handler, 221 irq_flow_handler_t flow_handler,
222 const char *name, int do_ack); 222 const char *name, int do_ack);
223extern void leon_update_virq_handling(unsigned int virq, 223void leon_update_virq_handling(unsigned int virq,
224 irq_flow_handler_t flow_handler, 224 irq_flow_handler_t flow_handler,
225 const char *name, int do_ack); 225 const char *name, int do_ack);
226extern void leon_init_timers(void); 226void leon_init_timers(void);
227extern void leon_trans_init(struct device_node *dp); 227void leon_trans_init(struct device_node *dp);
228extern void leon_node_init(struct device_node *dp, struct device_node ***nextp); 228void leon_node_init(struct device_node *dp, struct device_node ***nextp);
229extern void init_leon(void); 229void init_leon(void);
230extern void poke_leonsparc(void); 230void poke_leonsparc(void);
231extern void leon3_getCacheRegs(struct leon3_cacheregs *regs); 231void leon3_getCacheRegs(struct leon3_cacheregs *regs);
232extern int leon3_ticker_irq; 232extern int leon3_ticker_irq;
233 233
234#ifdef CONFIG_SMP 234#ifdef CONFIG_SMP
235extern int leon_smp_nrcpus(void); 235int leon_smp_nrcpus(void);
236extern void leon_clear_profile_irq(int cpu); 236void leon_clear_profile_irq(int cpu);
237extern void leon_smp_done(void); 237void leon_smp_done(void);
238extern void leon_boot_cpus(void); 238void leon_boot_cpus(void);
239extern int leon_boot_one_cpu(int i, struct task_struct *); 239int leon_boot_one_cpu(int i, struct task_struct *);
240void leon_init_smp(void); 240void leon_init_smp(void);
241void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu); 241void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu);
242extern irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused); 242irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused);
243 243
244extern unsigned int smpleon_ipi[]; 244extern unsigned int smpleon_ipi[];
245extern unsigned int linux_trap_ipi15_leon[]; 245extern unsigned int linux_trap_ipi15_leon[];
diff --git a/arch/sparc/include/asm/leon_pci.h b/arch/sparc/include/asm/leon_pci.h
index bfd3ab3092b5..049d067ed8be 100644
--- a/arch/sparc/include/asm/leon_pci.h
+++ b/arch/sparc/include/asm/leon_pci.h
@@ -16,7 +16,7 @@ struct leon_pci_info {
16 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); 16 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
17}; 17};
18 18
19extern void leon_pci_init(struct platform_device *ofdev, 19void leon_pci_init(struct platform_device *ofdev,
20 struct leon_pci_info *info); 20 struct leon_pci_info *info);
21 21
22#endif /* _ASM_LEON_PCI_H_ */ 22#endif /* _ASM_LEON_PCI_H_ */
diff --git a/arch/sparc/include/asm/mc146818rtc.h b/arch/sparc/include/asm/mc146818rtc.h
index 67ed9e3a0235..d8e72f37dc4b 100644
--- a/arch/sparc/include/asm/mc146818rtc.h
+++ b/arch/sparc/include/asm/mc146818rtc.h
@@ -1,5 +1,10 @@
1#ifndef ___ASM_SPARC_MC146818RTC_H 1#ifndef ___ASM_SPARC_MC146818RTC_H
2#define ___ASM_SPARC_MC146818RTC_H 2#define ___ASM_SPARC_MC146818RTC_H
3
4#include <linux/spinlock.h>
5
6extern spinlock_t rtc_lock;
7
3#if defined(__sparc__) && defined(__arch64__) 8#if defined(__sparc__) && defined(__arch64__)
4#include <asm/mc146818rtc_64.h> 9#include <asm/mc146818rtc_64.h>
5#else 10#else
diff --git a/arch/sparc/include/asm/mdesc.h b/arch/sparc/include/asm/mdesc.h
index 139097f3a67b..aebeb88f70db 100644
--- a/arch/sparc/include/asm/mdesc.h
+++ b/arch/sparc/include/asm/mdesc.h
@@ -12,13 +12,13 @@ struct mdesc_handle;
12 * the first argument to all of the operational calls that work 12 * the first argument to all of the operational calls that work
13 * on mdescs. 13 * on mdescs.
14 */ 14 */
15extern struct mdesc_handle *mdesc_grab(void); 15struct mdesc_handle *mdesc_grab(void);
16extern void mdesc_release(struct mdesc_handle *); 16void mdesc_release(struct mdesc_handle *);
17 17
18#define MDESC_NODE_NULL (~(u64)0) 18#define MDESC_NODE_NULL (~(u64)0)
19 19
20extern u64 mdesc_node_by_name(struct mdesc_handle *handle, 20u64 mdesc_node_by_name(struct mdesc_handle *handle,
21 u64 from_node, const char *name); 21 u64 from_node, const char *name);
22#define mdesc_for_each_node_by_name(__hdl, __node, __name) \ 22#define mdesc_for_each_node_by_name(__hdl, __node, __name) \
23 for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \ 23 for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \
24 (__node) != MDESC_NODE_NULL; \ 24 (__node) != MDESC_NODE_NULL; \
@@ -34,9 +34,9 @@ extern u64 mdesc_node_by_name(struct mdesc_handle *handle,
34 * 34 *
35 * These same rules apply to mdesc_node_name(). 35 * These same rules apply to mdesc_node_name().
36 */ 36 */
37extern const void *mdesc_get_property(struct mdesc_handle *handle, 37const void *mdesc_get_property(struct mdesc_handle *handle,
38 u64 node, const char *name, int *lenp); 38 u64 node, const char *name, int *lenp);
39extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node); 39const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
40 40
41/* MD arc iteration, the standard sequence is: 41/* MD arc iteration, the standard sequence is:
42 * 42 *
@@ -50,16 +50,16 @@ extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
50#define MDESC_ARC_TYPE_FWD "fwd" 50#define MDESC_ARC_TYPE_FWD "fwd"
51#define MDESC_ARC_TYPE_BACK "back" 51#define MDESC_ARC_TYPE_BACK "back"
52 52
53extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from, 53u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
54 const char *arc_type); 54 const char *arc_type);
55#define mdesc_for_each_arc(__arc, __hdl, __node, __type) \ 55#define mdesc_for_each_arc(__arc, __hdl, __node, __type) \
56 for (__arc = mdesc_next_arc(__hdl, __node, __type); \ 56 for (__arc = mdesc_next_arc(__hdl, __node, __type); \
57 (__arc) != MDESC_NODE_NULL; \ 57 (__arc) != MDESC_NODE_NULL; \
58 __arc = mdesc_next_arc(__hdl, __arc, __type)) 58 __arc = mdesc_next_arc(__hdl, __arc, __type))
59 59
60extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc); 60u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc);
61 61
62extern void mdesc_update(void); 62void mdesc_update(void);
63 63
64struct mdesc_notifier_client { 64struct mdesc_notifier_client {
65 void (*add)(struct mdesc_handle *handle, u64 node); 65 void (*add)(struct mdesc_handle *handle, u64 node);
@@ -69,12 +69,12 @@ struct mdesc_notifier_client {
69 struct mdesc_notifier_client *next; 69 struct mdesc_notifier_client *next;
70}; 70};
71 71
72extern void mdesc_register_notifier(struct mdesc_notifier_client *client); 72void mdesc_register_notifier(struct mdesc_notifier_client *client);
73 73
74extern void mdesc_fill_in_cpu_data(cpumask_t *mask); 74void mdesc_fill_in_cpu_data(cpumask_t *mask);
75extern void mdesc_populate_present_mask(cpumask_t *mask); 75void mdesc_populate_present_mask(cpumask_t *mask);
76extern void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask); 76void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask);
77 77
78extern void sun4v_mdesc_init(void); 78void sun4v_mdesc_init(void);
79 79
80#endif 80#endif
diff --git a/arch/sparc/include/asm/mmu_64.h b/arch/sparc/include/asm/mmu_64.h
index f668797ae234..70067ce184b1 100644
--- a/arch/sparc/include/asm/mmu_64.h
+++ b/arch/sparc/include/asm/mmu_64.h
@@ -67,9 +67,9 @@ struct tsb {
67 unsigned long pte; 67 unsigned long pte;
68} __attribute__((aligned(TSB_ENTRY_ALIGNMENT))); 68} __attribute__((aligned(TSB_ENTRY_ALIGNMENT)));
69 69
70extern void __tsb_insert(unsigned long ent, unsigned long tag, unsigned long pte); 70void __tsb_insert(unsigned long ent, unsigned long tag, unsigned long pte);
71extern void tsb_flush(unsigned long ent, unsigned long tag); 71void tsb_flush(unsigned long ent, unsigned long tag);
72extern void tsb_init(struct tsb *tsb, unsigned long size); 72void tsb_init(struct tsb *tsb, unsigned long size);
73 73
74struct tsb_config { 74struct tsb_config {
75 struct tsb *tsb; 75 struct tsb *tsb;
diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h
index 3d528f06e4b0..b84be675e507 100644
--- a/arch/sparc/include/asm/mmu_context_64.h
+++ b/arch/sparc/include/asm/mmu_context_64.h
@@ -17,20 +17,20 @@ extern spinlock_t ctx_alloc_lock;
17extern unsigned long tlb_context_cache; 17extern unsigned long tlb_context_cache;
18extern unsigned long mmu_context_bmap[]; 18extern unsigned long mmu_context_bmap[];
19 19
20extern void get_new_mmu_context(struct mm_struct *mm); 20void get_new_mmu_context(struct mm_struct *mm);
21#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
22extern void smp_new_mmu_context_version(void); 22void smp_new_mmu_context_version(void);
23#else 23#else
24#define smp_new_mmu_context_version() do { } while (0) 24#define smp_new_mmu_context_version() do { } while (0)
25#endif 25#endif
26 26
27extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); 27int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
28extern void destroy_context(struct mm_struct *mm); 28void destroy_context(struct mm_struct *mm);
29 29
30extern void __tsb_context_switch(unsigned long pgd_pa, 30void __tsb_context_switch(unsigned long pgd_pa,
31 struct tsb_config *tsb_base, 31 struct tsb_config *tsb_base,
32 struct tsb_config *tsb_huge, 32 struct tsb_config *tsb_huge,
33 unsigned long tsb_descr_pa); 33 unsigned long tsb_descr_pa);
34 34
35static inline void tsb_context_switch(struct mm_struct *mm) 35static inline void tsb_context_switch(struct mm_struct *mm)
36{ 36{
@@ -46,9 +46,11 @@ static inline void tsb_context_switch(struct mm_struct *mm)
46 , __pa(&mm->context.tsb_descr[0])); 46 , __pa(&mm->context.tsb_descr[0]));
47} 47}
48 48
49extern void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long mm_rss); 49void tsb_grow(struct mm_struct *mm,
50 unsigned long tsb_index,
51 unsigned long mm_rss);
50#ifdef CONFIG_SMP 52#ifdef CONFIG_SMP
51extern void smp_tsb_sync(struct mm_struct *mm); 53void smp_tsb_sync(struct mm_struct *mm);
52#else 54#else
53#define smp_tsb_sync(__mm) do { } while (0) 55#define smp_tsb_sync(__mm) do { } while (0)
54#endif 56#endif
@@ -66,7 +68,7 @@ extern void smp_tsb_sync(struct mm_struct *mm);
66 : "r" (CTX_HWBITS((__mm)->context)), \ 68 : "r" (CTX_HWBITS((__mm)->context)), \
67 "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_MMU)) 69 "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_MMU))
68 70
69extern void __flush_tlb_mm(unsigned long, unsigned long); 71void __flush_tlb_mm(unsigned long, unsigned long);
70 72
71/* Switch the current MM context. */ 73/* Switch the current MM context. */
72static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) 74static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk)
diff --git a/arch/sparc/include/asm/nmi.h b/arch/sparc/include/asm/nmi.h
index 72e6500e7ab0..26ad2b2607c6 100644
--- a/arch/sparc/include/asm/nmi.h
+++ b/arch/sparc/include/asm/nmi.h
@@ -1,13 +1,13 @@
1#ifndef __NMI_H 1#ifndef __NMI_H
2#define __NMI_H 2#define __NMI_H
3 3
4extern int __init nmi_init(void); 4int __init nmi_init(void);
5extern void perfctr_irq(int irq, struct pt_regs *regs); 5void perfctr_irq(int irq, struct pt_regs *regs);
6extern void nmi_adjust_hz(unsigned int new_hz); 6void nmi_adjust_hz(unsigned int new_hz);
7 7
8extern atomic_t nmi_active; 8extern atomic_t nmi_active;
9 9
10extern void start_nmi_watchdog(void *unused); 10void start_nmi_watchdog(void *unused);
11extern void stop_nmi_watchdog(void *unused); 11void stop_nmi_watchdog(void *unused);
12 12
13#endif /* __NMI_H */ 13#endif /* __NMI_H */
diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h
index c72f3045820c..56a09b9d7b1b 100644
--- a/arch/sparc/include/asm/oplib_32.h
+++ b/arch/sparc/include/asm/oplib_32.h
@@ -43,28 +43,28 @@ extern struct linux_nodeops *prom_nodeops;
43/* You must call prom_init() before using any of the library services, 43/* You must call prom_init() before using any of the library services,
44 * preferably as early as possible. Pass it the romvec pointer. 44 * preferably as early as possible. Pass it the romvec pointer.
45 */ 45 */
46extern void prom_init(struct linux_romvec *rom_ptr); 46void prom_init(struct linux_romvec *rom_ptr);
47 47
48/* Boot argument acquisition, returns the boot command line string. */ 48/* Boot argument acquisition, returns the boot command line string. */
49extern char *prom_getbootargs(void); 49char *prom_getbootargs(void);
50 50
51/* Miscellaneous routines, don't really fit in any category per se. */ 51/* Miscellaneous routines, don't really fit in any category per se. */
52 52
53/* Reboot the machine with the command line passed. */ 53/* Reboot the machine with the command line passed. */
54extern void prom_reboot(char *boot_command); 54void prom_reboot(char *boot_command);
55 55
56/* Evaluate the forth string passed. */ 56/* Evaluate the forth string passed. */
57extern void prom_feval(char *forth_string); 57void prom_feval(char *forth_string);
58 58
59/* Enter the prom, with possibility of continuation with the 'go' 59/* Enter the prom, with possibility of continuation with the 'go'
60 * command in newer proms. 60 * command in newer proms.
61 */ 61 */
62extern void prom_cmdline(void); 62void prom_cmdline(void);
63 63
64/* Enter the prom, with no chance of continuation for the stand-alone 64/* Enter the prom, with no chance of continuation for the stand-alone
65 * which calls this. 65 * which calls this.
66 */ 66 */
67extern void __noreturn prom_halt(void); 67void __noreturn prom_halt(void);
68 68
69/* Set the PROM 'sync' callback function to the passed function pointer. 69/* Set the PROM 'sync' callback function to the passed function pointer.
70 * When the user gives the 'sync' command at the prom prompt while the 70 * When the user gives the 'sync' command at the prom prompt while the
@@ -73,37 +73,37 @@ extern void __noreturn prom_halt(void);
73 * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX 73 * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX
74 */ 74 */
75typedef void (*sync_func_t)(void); 75typedef void (*sync_func_t)(void);
76extern void prom_setsync(sync_func_t func_ptr); 76void prom_setsync(sync_func_t func_ptr);
77 77
78/* Acquire the IDPROM of the root node in the prom device tree. This 78/* Acquire the IDPROM of the root node in the prom device tree. This
79 * gets passed a buffer where you would like it stuffed. The return value 79 * gets passed a buffer where you would like it stuffed. The return value
80 * is the format type of this idprom or 0xff on error. 80 * is the format type of this idprom or 0xff on error.
81 */ 81 */
82extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); 82unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);
83 83
84/* Get the prom major version. */ 84/* Get the prom major version. */
85extern int prom_version(void); 85int prom_version(void);
86 86
87/* Get the prom plugin revision. */ 87/* Get the prom plugin revision. */
88extern int prom_getrev(void); 88int prom_getrev(void);
89 89
90/* Get the prom firmware revision. */ 90/* Get the prom firmware revision. */
91extern int prom_getprev(void); 91int prom_getprev(void);
92 92
93/* Write a buffer of characters to the console. */ 93/* Write a buffer of characters to the console. */
94extern void prom_console_write_buf(const char *buf, int len); 94void prom_console_write_buf(const char *buf, int len);
95 95
96/* Prom's internal routines, don't use in kernel/boot code. */ 96/* Prom's internal routines, don't use in kernel/boot code. */
97extern __printf(1, 2) void prom_printf(const char *fmt, ...); 97__printf(1, 2) void prom_printf(const char *fmt, ...);
98extern void prom_write(const char *buf, unsigned int len); 98void prom_write(const char *buf, unsigned int len);
99 99
100/* Multiprocessor operations... */ 100/* Multiprocessor operations... */
101 101
102/* Start the CPU with the given device tree node, context table, and context 102/* Start the CPU with the given device tree node, context table, and context
103 * at the passed program counter. 103 * at the passed program counter.
104 */ 104 */
105extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, 105int prom_startcpu(int cpunode, struct linux_prom_registers *context_table,
106 int context, char *program_counter); 106 int context, char *program_counter);
107 107
108/* Initialize the memory lists based upon the prom version. */ 108/* Initialize the memory lists based upon the prom version. */
109void prom_meminit(void); 109void prom_meminit(void);
@@ -111,65 +111,65 @@ void prom_meminit(void);
111/* PROM device tree traversal functions... */ 111/* PROM device tree traversal functions... */
112 112
113/* Get the child node of the given node, or zero if no child exists. */ 113/* Get the child node of the given node, or zero if no child exists. */
114extern phandle prom_getchild(phandle parent_node); 114phandle prom_getchild(phandle parent_node);
115 115
116/* Get the next sibling node of the given node, or zero if no further 116/* Get the next sibling node of the given node, or zero if no further
117 * siblings exist. 117 * siblings exist.
118 */ 118 */
119extern phandle prom_getsibling(phandle node); 119phandle prom_getsibling(phandle node);
120 120
121/* Get the length, at the passed node, of the given property type. 121/* Get the length, at the passed node, of the given property type.
122 * Returns -1 on error (ie. no such property at this node). 122 * Returns -1 on error (ie. no such property at this node).
123 */ 123 */
124extern int prom_getproplen(phandle thisnode, const char *property); 124int prom_getproplen(phandle thisnode, const char *property);
125 125
126/* Fetch the requested property using the given buffer. Returns 126/* Fetch the requested property using the given buffer. Returns
127 * the number of bytes the prom put into your buffer or -1 on error. 127 * the number of bytes the prom put into your buffer or -1 on error.
128 */ 128 */
129extern int __must_check prom_getproperty(phandle thisnode, const char *property, 129int __must_check prom_getproperty(phandle thisnode, const char *property,
130 char *prop_buffer, int propbuf_size); 130 char *prop_buffer, int propbuf_size);
131 131
132/* Acquire an integer property. */ 132/* Acquire an integer property. */
133extern int prom_getint(phandle node, char *property); 133int prom_getint(phandle node, char *property);
134 134
135/* Acquire an integer property, with a default value. */ 135/* Acquire an integer property, with a default value. */
136extern int prom_getintdefault(phandle node, char *property, int defval); 136int prom_getintdefault(phandle node, char *property, int defval);
137 137
138/* Acquire a boolean property, 0=FALSE 1=TRUE. */ 138/* Acquire a boolean property, 0=FALSE 1=TRUE. */
139extern int prom_getbool(phandle node, char *prop); 139int prom_getbool(phandle node, char *prop);
140 140
141/* Acquire a string property, null string on error. */ 141/* Acquire a string property, null string on error. */
142extern void prom_getstring(phandle node, char *prop, char *buf, int bufsize); 142void prom_getstring(phandle node, char *prop, char *buf, int bufsize);
143 143
144/* Search all siblings starting at the passed node for "name" matching 144/* Search all siblings starting at the passed node for "name" matching
145 * the given string. Returns the node on success, zero on failure. 145 * the given string. Returns the node on success, zero on failure.
146 */ 146 */
147extern phandle prom_searchsiblings(phandle node_start, char *name); 147phandle prom_searchsiblings(phandle node_start, char *name);
148 148
149/* Returns the next property after the passed property for the given 149/* Returns the next property after the passed property for the given
150 * node. Returns null string on failure. 150 * node. Returns null string on failure.
151 */ 151 */
152extern char *prom_nextprop(phandle node, char *prev_property, char *buffer); 152char *prom_nextprop(phandle node, char *prev_property, char *buffer);
153 153
154/* Returns phandle of the path specified */ 154/* Returns phandle of the path specified */
155extern phandle prom_finddevice(char *name); 155phandle prom_finddevice(char *name);
156 156
157/* Set the indicated property at the given node with the passed value. 157/* Set the indicated property at the given node with the passed value.
158 * Returns the number of bytes of your value that the prom took. 158 * Returns the number of bytes of your value that the prom took.
159 */ 159 */
160extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, 160int prom_setprop(phandle node, const char *prop_name, char *prop_value,
161 int value_size); 161 int value_size);
162 162
163extern phandle prom_inst2pkg(int); 163phandle prom_inst2pkg(int);
164 164
165/* Dorking with Bus ranges... */ 165/* Dorking with Bus ranges... */
166 166
167/* Apply promlib probes OBIO ranges to registers. */ 167/* Apply promlib probes OBIO ranges to registers. */
168extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); 168void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs);
169 169
170/* Apply ranges of any prom node (and optionally parent node as well) to registers. */ 170/* Apply ranges of any prom node (and optionally parent node as well) to registers. */
171extern void prom_apply_generic_ranges(phandle node, phandle parent, 171void prom_apply_generic_ranges(phandle node, phandle parent,
172 struct linux_prom_registers *sbusregs, int nregs); 172 struct linux_prom_registers *sbusregs, int nregs);
173 173
174void prom_ranges_init(void); 174void prom_ranges_init(void);
175 175
diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h
index a12dbe3b7762..f34682430fcf 100644
--- a/arch/sparc/include/asm/oplib_64.h
+++ b/arch/sparc/include/asm/oplib_64.h
@@ -62,100 +62,100 @@ struct linux_mem_p1275 {
62/* You must call prom_init() before using any of the library services, 62/* You must call prom_init() before using any of the library services,
63 * preferably as early as possible. Pass it the romvec pointer. 63 * preferably as early as possible. Pass it the romvec pointer.
64 */ 64 */
65extern void prom_init(void *cif_handler, void *cif_stack); 65void prom_init(void *cif_handler, void *cif_stack);
66 66
67/* Boot argument acquisition, returns the boot command line string. */ 67/* Boot argument acquisition, returns the boot command line string. */
68extern char *prom_getbootargs(void); 68char *prom_getbootargs(void);
69 69
70/* Miscellaneous routines, don't really fit in any category per se. */ 70/* Miscellaneous routines, don't really fit in any category per se. */
71 71
72/* Reboot the machine with the command line passed. */ 72/* Reboot the machine with the command line passed. */
73extern void prom_reboot(const char *boot_command); 73void prom_reboot(const char *boot_command);
74 74
75/* Evaluate the forth string passed. */ 75/* Evaluate the forth string passed. */
76extern void prom_feval(const char *forth_string); 76void prom_feval(const char *forth_string);
77 77
78/* Enter the prom, with possibility of continuation with the 'go' 78/* Enter the prom, with possibility of continuation with the 'go'
79 * command in newer proms. 79 * command in newer proms.
80 */ 80 */
81extern void prom_cmdline(void); 81void prom_cmdline(void);
82 82
83/* Enter the prom, with no chance of continuation for the stand-alone 83/* Enter the prom, with no chance of continuation for the stand-alone
84 * which calls this. 84 * which calls this.
85 */ 85 */
86extern void prom_halt(void) __attribute__ ((noreturn)); 86void prom_halt(void) __attribute__ ((noreturn));
87 87
88/* Halt and power-off the machine. */ 88/* Halt and power-off the machine. */
89extern void prom_halt_power_off(void) __attribute__ ((noreturn)); 89void prom_halt_power_off(void) __attribute__ ((noreturn));
90 90
91/* Acquire the IDPROM of the root node in the prom device tree. This 91/* Acquire the IDPROM of the root node in the prom device tree. This
92 * gets passed a buffer where you would like it stuffed. The return value 92 * gets passed a buffer where you would like it stuffed. The return value
93 * is the format type of this idprom or 0xff on error. 93 * is the format type of this idprom or 0xff on error.
94 */ 94 */
95extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); 95unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);
96 96
97/* Write a buffer of characters to the console. */ 97/* Write a buffer of characters to the console. */
98extern void prom_console_write_buf(const char *buf, int len); 98void prom_console_write_buf(const char *buf, int len);
99 99
100/* Prom's internal routines, don't use in kernel/boot code. */ 100/* Prom's internal routines, don't use in kernel/boot code. */
101extern __printf(1, 2) void prom_printf(const char *fmt, ...); 101__printf(1, 2) void prom_printf(const char *fmt, ...);
102extern void prom_write(const char *buf, unsigned int len); 102void prom_write(const char *buf, unsigned int len);
103 103
104/* Multiprocessor operations... */ 104/* Multiprocessor operations... */
105#ifdef CONFIG_SMP 105#ifdef CONFIG_SMP
106/* Start the CPU with the given device tree node at the passed program 106/* Start the CPU with the given device tree node at the passed program
107 * counter with the given arg passed in via register %o0. 107 * counter with the given arg passed in via register %o0.
108 */ 108 */
109extern void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg); 109void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg);
110 110
111/* Start the CPU with the given cpu ID at the passed program 111/* Start the CPU with the given cpu ID at the passed program
112 * counter with the given arg passed in via register %o0. 112 * counter with the given arg passed in via register %o0.
113 */ 113 */
114extern void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg); 114void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg);
115 115
116/* Stop the CPU with the given cpu ID. */ 116/* Stop the CPU with the given cpu ID. */
117extern void prom_stopcpu_cpuid(int cpuid); 117void prom_stopcpu_cpuid(int cpuid);
118 118
119/* Stop the current CPU. */ 119/* Stop the current CPU. */
120extern void prom_stopself(void); 120void prom_stopself(void);
121 121
122/* Idle the current CPU. */ 122/* Idle the current CPU. */
123extern void prom_idleself(void); 123void prom_idleself(void);
124 124
125/* Resume the CPU with the passed device tree node. */ 125/* Resume the CPU with the passed device tree node. */
126extern void prom_resumecpu(int cpunode); 126void prom_resumecpu(int cpunode);
127#endif 127#endif
128 128
129/* Power management interfaces. */ 129/* Power management interfaces. */
130 130
131/* Put the current CPU to sleep. */ 131/* Put the current CPU to sleep. */
132extern void prom_sleepself(void); 132void prom_sleepself(void);
133 133
134/* Put the entire system to sleep. */ 134/* Put the entire system to sleep. */
135extern int prom_sleepsystem(void); 135int prom_sleepsystem(void);
136 136
137/* Initiate a wakeup event. */ 137/* Initiate a wakeup event. */
138extern int prom_wakeupsystem(void); 138int prom_wakeupsystem(void);
139 139
140/* MMU and memory related OBP interfaces. */ 140/* MMU and memory related OBP interfaces. */
141 141
142/* Get unique string identifying SIMM at given physical address. */ 142/* Get unique string identifying SIMM at given physical address. */
143extern int prom_getunumber(int syndrome_code, 143int prom_getunumber(int syndrome_code,
144 unsigned long phys_addr, 144 unsigned long phys_addr,
145 char *buf, int buflen); 145 char *buf, int buflen);
146 146
147/* Retain physical memory to the caller across soft resets. */ 147/* Retain physical memory to the caller across soft resets. */
148extern int prom_retain(const char *name, unsigned long size, 148int prom_retain(const char *name, unsigned long size,
149 unsigned long align, unsigned long *paddr); 149 unsigned long align, unsigned long *paddr);
150 150
151/* Load explicit I/D TLB entries into the calling processor. */ 151/* Load explicit I/D TLB entries into the calling processor. */
152extern long prom_itlb_load(unsigned long index, 152long prom_itlb_load(unsigned long index,
153 unsigned long tte_data, 153 unsigned long tte_data,
154 unsigned long vaddr); 154 unsigned long vaddr);
155 155
156extern long prom_dtlb_load(unsigned long index, 156long prom_dtlb_load(unsigned long index,
157 unsigned long tte_data, 157 unsigned long tte_data,
158 unsigned long vaddr); 158 unsigned long vaddr);
159 159
160/* Map/Unmap client program address ranges. First the format of 160/* Map/Unmap client program address ranges. First the format of
161 * the mapping mode argument. 161 * the mapping mode argument.
@@ -170,81 +170,81 @@ extern long prom_dtlb_load(unsigned long index,
170#define PROM_MAP_IE 0x0100 /* Invert-Endianness */ 170#define PROM_MAP_IE 0x0100 /* Invert-Endianness */
171#define PROM_MAP_DEFAULT (PROM_MAP_WRITE | PROM_MAP_READ | PROM_MAP_EXEC | PROM_MAP_CACHED) 171#define PROM_MAP_DEFAULT (PROM_MAP_WRITE | PROM_MAP_READ | PROM_MAP_EXEC | PROM_MAP_CACHED)
172 172
173extern int prom_map(int mode, unsigned long size, 173int prom_map(int mode, unsigned long size,
174 unsigned long vaddr, unsigned long paddr); 174 unsigned long vaddr, unsigned long paddr);
175extern void prom_unmap(unsigned long size, unsigned long vaddr); 175void prom_unmap(unsigned long size, unsigned long vaddr);
176 176
177 177
178/* PROM device tree traversal functions... */ 178/* PROM device tree traversal functions... */
179 179
180/* Get the child node of the given node, or zero if no child exists. */ 180/* Get the child node of the given node, or zero if no child exists. */
181extern phandle prom_getchild(phandle parent_node); 181phandle prom_getchild(phandle parent_node);
182 182
183/* Get the next sibling node of the given node, or zero if no further 183/* Get the next sibling node of the given node, or zero if no further
184 * siblings exist. 184 * siblings exist.
185 */ 185 */
186extern phandle prom_getsibling(phandle node); 186phandle prom_getsibling(phandle node);
187 187
188/* Get the length, at the passed node, of the given property type. 188/* Get the length, at the passed node, of the given property type.
189 * Returns -1 on error (ie. no such property at this node). 189 * Returns -1 on error (ie. no such property at this node).
190 */ 190 */
191extern int prom_getproplen(phandle thisnode, const char *property); 191int prom_getproplen(phandle thisnode, const char *property);
192 192
193/* Fetch the requested property using the given buffer. Returns 193/* Fetch the requested property using the given buffer. Returns
194 * the number of bytes the prom put into your buffer or -1 on error. 194 * the number of bytes the prom put into your buffer or -1 on error.
195 */ 195 */
196extern int prom_getproperty(phandle thisnode, const char *property, 196int prom_getproperty(phandle thisnode, const char *property,
197 char *prop_buffer, int propbuf_size); 197 char *prop_buffer, int propbuf_size);
198 198
199/* Acquire an integer property. */ 199/* Acquire an integer property. */
200extern int prom_getint(phandle node, const char *property); 200int prom_getint(phandle node, const char *property);
201 201
202/* Acquire an integer property, with a default value. */ 202/* Acquire an integer property, with a default value. */
203extern int prom_getintdefault(phandle node, const char *property, int defval); 203int prom_getintdefault(phandle node, const char *property, int defval);
204 204
205/* Acquire a boolean property, 0=FALSE 1=TRUE. */ 205/* Acquire a boolean property, 0=FALSE 1=TRUE. */
206extern int prom_getbool(phandle node, const char *prop); 206int prom_getbool(phandle node, const char *prop);
207 207
208/* Acquire a string property, null string on error. */ 208/* Acquire a string property, null string on error. */
209extern void prom_getstring(phandle node, const char *prop, char *buf, 209void prom_getstring(phandle node, const char *prop, char *buf,
210 int bufsize); 210 int bufsize);
211 211
212/* Does the passed node have the given "name"? YES=1 NO=0 */ 212/* Does the passed node have the given "name"? YES=1 NO=0 */
213extern int prom_nodematch(phandle thisnode, const char *name); 213int prom_nodematch(phandle thisnode, const char *name);
214 214
215/* Search all siblings starting at the passed node for "name" matching 215/* Search all siblings starting at the passed node for "name" matching
216 * the given string. Returns the node on success, zero on failure. 216 * the given string. Returns the node on success, zero on failure.
217 */ 217 */
218extern phandle prom_searchsiblings(phandle node_start, const char *name); 218phandle prom_searchsiblings(phandle node_start, const char *name);
219 219
220/* Return the first property type, as a string, for the given node. 220/* Return the first property type, as a string, for the given node.
221 * Returns a null string on error. Buffer should be at least 32B long. 221 * Returns a null string on error. Buffer should be at least 32B long.
222 */ 222 */
223extern char *prom_firstprop(phandle node, char *buffer); 223char *prom_firstprop(phandle node, char *buffer);
224 224
225/* Returns the next property after the passed property for the given 225/* Returns the next property after the passed property for the given
226 * node. Returns null string on failure. Buffer should be at least 32B long. 226 * node. Returns null string on failure. Buffer should be at least 32B long.
227 */ 227 */
228extern char *prom_nextprop(phandle node, const char *prev_property, char *buf); 228char *prom_nextprop(phandle node, const char *prev_property, char *buf);
229 229
230/* Returns 1 if the specified node has given property. */ 230/* Returns 1 if the specified node has given property. */
231extern int prom_node_has_property(phandle node, const char *property); 231int prom_node_has_property(phandle node, const char *property);
232 232
233/* Returns phandle of the path specified */ 233/* Returns phandle of the path specified */
234extern phandle prom_finddevice(const char *name); 234phandle prom_finddevice(const char *name);
235 235
236/* Set the indicated property at the given node with the passed value. 236/* Set the indicated property at the given node with the passed value.
237 * Returns the number of bytes of your value that the prom took. 237 * Returns the number of bytes of your value that the prom took.
238 */ 238 */
239extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, 239int prom_setprop(phandle node, const char *prop_name, char *prop_value,
240 int value_size); 240 int value_size);
241 241
242extern phandle prom_inst2pkg(int); 242phandle prom_inst2pkg(int);
243extern void prom_sun4v_guest_soft_state(void); 243void prom_sun4v_guest_soft_state(void);
244 244
245extern int prom_ihandle2path(int handle, char *buffer, int bufsize); 245int prom_ihandle2path(int handle, char *buffer, int bufsize);
246 246
247/* Client interface level routines. */ 247/* Client interface level routines. */
248extern void p1275_cmd_direct(unsigned long *); 248void p1275_cmd_direct(unsigned long *);
249 249
250#endif /* !(__SPARC64_OPLIB_H) */ 250#endif /* !(__SPARC64_OPLIB_H) */
diff --git a/arch/sparc/include/asm/page.h b/arch/sparc/include/asm/page.h
index f21de0349025..1be2fdec6268 100644
--- a/arch/sparc/include/asm/page.h
+++ b/arch/sparc/include/asm/page.h
@@ -1,5 +1,8 @@
1#ifndef ___ASM_SPARC_PAGE_H 1#ifndef ___ASM_SPARC_PAGE_H
2#define ___ASM_SPARC_PAGE_H 2#define ___ASM_SPARC_PAGE_H
3
4#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
5
3#if defined(__sparc__) && defined(__arch64__) 6#if defined(__sparc__) && defined(__arch64__)
4#include <asm/page_64.h> 7#include <asm/page_64.h>
5#else 8#else
diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h
index aac53fcea807..bf109984a032 100644
--- a/arch/sparc/include/asm/page_64.h
+++ b/arch/sparc/include/asm/page_64.h
@@ -31,17 +31,17 @@
31 31
32#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE) 32#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
33struct pt_regs; 33struct pt_regs;
34extern void hugetlb_setup(struct pt_regs *regs); 34void hugetlb_setup(struct pt_regs *regs);
35#endif 35#endif
36 36
37#define WANT_PAGE_VIRTUAL 37#define WANT_PAGE_VIRTUAL
38 38
39extern void _clear_page(void *page); 39void _clear_page(void *page);
40#define clear_page(X) _clear_page((void *)(X)) 40#define clear_page(X) _clear_page((void *)(X))
41struct page; 41struct page;
42extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page); 42void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
43#define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE) 43#define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE)
44extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage); 44void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage);
45 45
46/* Unlike sparc32, sparc64's parameter passing API is more 46/* Unlike sparc32, sparc64's parameter passing API is more
47 * sane in that structures which as small enough are passed 47 * sane in that structures which as small enough are passed
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index c6c7396e7627..bd00a6226169 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -52,7 +52,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
52 52
53/* Return the index of the PCI controller for device PDEV. */ 53/* Return the index of the PCI controller for device PDEV. */
54 54
55extern int pci_domain_nr(struct pci_bus *bus); 55int pci_domain_nr(struct pci_bus *bus);
56static inline int pci_proc_domain(struct pci_bus *bus) 56static inline int pci_proc_domain(struct pci_bus *bus)
57{ 57{
58 return 1; 58 return 1;
@@ -64,9 +64,9 @@ static inline int pci_proc_domain(struct pci_bus *bus)
64#define HAVE_ARCH_PCI_GET_UNMAPPED_AREA 64#define HAVE_ARCH_PCI_GET_UNMAPPED_AREA
65#define get_pci_unmapped_area get_fb_unmapped_area 65#define get_pci_unmapped_area get_fb_unmapped_area
66 66
67extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 67int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
68 enum pci_mmap_state mmap_state, 68 enum pci_mmap_state mmap_state,
69 int write_combine); 69 int write_combine);
70 70
71static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 71static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
72{ 72{
@@ -74,9 +74,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
74} 74}
75 75
76#define HAVE_ARCH_PCI_RESOURCE_TO_USER 76#define HAVE_ARCH_PCI_RESOURCE_TO_USER
77extern void pci_resource_to_user(const struct pci_dev *dev, int bar, 77void pci_resource_to_user(const struct pci_dev *dev, int bar,
78 const struct resource *rsrc, 78 const struct resource *rsrc,
79 resource_size_t *start, resource_size_t *end); 79 resource_size_t *start, resource_size_t *end);
80#endif /* __KERNEL__ */ 80#endif /* __KERNEL__ */
81 81
82#endif /* __SPARC64_PCI_H */ 82#endif /* __SPARC64_PCI_H */
diff --git a/arch/sparc/include/asm/pcic.h b/arch/sparc/include/asm/pcic.h
index 6676cbcc8b6a..f41706792592 100644
--- a/arch/sparc/include/asm/pcic.h
+++ b/arch/sparc/include/asm/pcic.h
@@ -30,10 +30,10 @@ struct linux_pcic {
30}; 30};
31 31
32#ifdef CONFIG_PCIC_PCI 32#ifdef CONFIG_PCIC_PCI
33extern int pcic_present(void); 33int pcic_present(void);
34extern int pcic_probe(void); 34int pcic_probe(void);
35extern void pci_time_init(void); 35void pci_time_init(void);
36extern void sun4m_pci_init_IRQ(void); 36void sun4m_pci_init_IRQ(void);
37#else 37#else
38static inline int pcic_present(void) { return 0; } 38static inline int pcic_present(void) { return 0; }
39static inline int pcic_probe(void) { return 0; } 39static inline int pcic_probe(void) { return 0; }
diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h
index 942bb17f60cd..cdf800c3326c 100644
--- a/arch/sparc/include/asm/pcr.h
+++ b/arch/sparc/include/asm/pcr.h
@@ -12,8 +12,8 @@ struct pcr_ops {
12}; 12};
13extern const struct pcr_ops *pcr_ops; 13extern const struct pcr_ops *pcr_ops;
14 14
15extern void deferred_pcr_work_irq(int irq, struct pt_regs *regs); 15void deferred_pcr_work_irq(int irq, struct pt_regs *regs);
16extern void schedule_deferred_pcr_work(void); 16void schedule_deferred_pcr_work(void);
17 17
18#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */ 18#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */
19#define PCR_STRACE 0x00000002 /* Trace supervisor events */ 19#define PCR_STRACE 0x00000002 /* Trace supervisor events */
@@ -45,6 +45,6 @@ extern void schedule_deferred_pcr_work(void);
45#define PCR_N4_PICNHT 0x00020000 /* PIC non-hypervisor trap */ 45#define PCR_N4_PICNHT 0x00020000 /* PIC non-hypervisor trap */
46#define PCR_N4_NTC 0x00040000 /* Next-To-Commit wrap */ 46#define PCR_N4_NTC 0x00040000 /* Next-To-Commit wrap */
47 47
48extern int pcr_arch_init(void); 48int pcr_arch_init(void);
49 49
50#endif /* __PCR_H */ 50#endif /* __PCR_H */
diff --git a/arch/sparc/include/asm/pgalloc_32.h b/arch/sparc/include/asm/pgalloc_32.h
index 9b1c36de0f18..a3890da94428 100644
--- a/arch/sparc/include/asm/pgalloc_32.h
+++ b/arch/sparc/include/asm/pgalloc_32.h
@@ -14,6 +14,8 @@ struct page;
14void *srmmu_get_nocache(int size, int align); 14void *srmmu_get_nocache(int size, int align);
15void srmmu_free_nocache(void *addr, int size); 15void srmmu_free_nocache(void *addr, int size);
16 16
17extern struct resource sparc_iomap;
18
17#define check_pgt_cache() do { } while (0) 19#define check_pgt_cache() do { } while (0)
18 20
19pgd_t *get_pgd_fast(void); 21pgd_t *get_pgd_fast(void);
diff --git a/arch/sparc/include/asm/pgalloc_64.h b/arch/sparc/include/asm/pgalloc_64.h
index bcfe063bce23..39a7ac49b00c 100644
--- a/arch/sparc/include/asm/pgalloc_64.h
+++ b/arch/sparc/include/asm/pgalloc_64.h
@@ -38,12 +38,12 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
38 kmem_cache_free(pgtable_cache, pmd); 38 kmem_cache_free(pgtable_cache, pmd);
39} 39}
40 40
41extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 41pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
42 unsigned long address); 42 unsigned long address);
43extern pgtable_t pte_alloc_one(struct mm_struct *mm, 43pgtable_t pte_alloc_one(struct mm_struct *mm,
44 unsigned long address); 44 unsigned long address);
45extern void pte_free_kernel(struct mm_struct *mm, pte_t *pte); 45void pte_free_kernel(struct mm_struct *mm, pte_t *pte);
46extern void pte_free(struct mm_struct *mm, pgtable_t ptepage); 46void pte_free(struct mm_struct *mm, pgtable_t ptepage);
47 47
48#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(MM, PMD, PTE) 48#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(MM, PMD, PTE)
49#define pmd_populate(MM, PMD, PTE) pmd_set(MM, PMD, PTE) 49#define pmd_populate(MM, PMD, PTE) pmd_set(MM, PMD, PTE)
@@ -51,12 +51,12 @@ extern void pte_free(struct mm_struct *mm, pgtable_t ptepage);
51 51
52#define check_pgt_cache() do { } while (0) 52#define check_pgt_cache() do { } while (0)
53 53
54extern void pgtable_free(void *table, bool is_page); 54void pgtable_free(void *table, bool is_page);
55 55
56#ifdef CONFIG_SMP 56#ifdef CONFIG_SMP
57 57
58struct mmu_gather; 58struct mmu_gather;
59extern void tlb_remove_table(struct mmu_gather *, void *); 59void tlb_remove_table(struct mmu_gather *, void *);
60 60
61static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page) 61static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, bool is_page)
62{ 62{
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index 502f632f6cc7..b9b91ae19fe1 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -25,8 +25,9 @@
25struct vm_area_struct; 25struct vm_area_struct;
26struct page; 26struct page;
27 27
28extern void load_mmu(void); 28void load_mmu(void);
29extern unsigned long calc_highpages(void); 29unsigned long calc_highpages(void);
30unsigned long __init bootmem_init(unsigned long *pages_avail);
30 31
31#define pte_ERROR(e) __builtin_trap() 32#define pte_ERROR(e) __builtin_trap()
32#define pmd_ERROR(e) __builtin_trap() 33#define pmd_ERROR(e) __builtin_trap()
@@ -56,7 +57,7 @@ extern unsigned long calc_highpages(void);
56 * srmmu.c will assign the real one (which is dynamically sized) */ 57 * srmmu.c will assign the real one (which is dynamically sized) */
57#define swapper_pg_dir NULL 58#define swapper_pg_dir NULL
58 59
59extern void paging_init(void); 60void paging_init(void);
60 61
61extern unsigned long ptr_in_current_pgd; 62extern unsigned long ptr_in_current_pgd;
62 63
@@ -428,8 +429,8 @@ extern unsigned long *sparc_valid_addr_bitmap;
428#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) 429#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
429#define GET_PFN(pfn) (pfn & 0x0fffffffUL) 430#define GET_PFN(pfn) (pfn & 0x0fffffffUL)
430 431
431extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, 432int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long,
432 unsigned long, pgprot_t); 433 unsigned long, pgprot_t);
433 434
434static inline int io_remap_pfn_range(struct vm_area_struct *vma, 435static inline int io_remap_pfn_range(struct vm_area_struct *vma,
435 unsigned long from, unsigned long pfn, 436 unsigned long from, unsigned long pfn,
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 1a49ffdf9da9..3770bf5c6e1b 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -210,9 +210,9 @@ static inline bool kern_addr_valid(unsigned long addr)
210 210
211#ifndef __ASSEMBLY__ 211#ifndef __ASSEMBLY__
212 212
213extern pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long); 213pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long);
214 214
215extern unsigned long pte_sz_bits(unsigned long size); 215unsigned long pte_sz_bits(unsigned long size);
216 216
217extern pgprot_t PAGE_KERNEL; 217extern pgprot_t PAGE_KERNEL;
218extern pgprot_t PAGE_KERNEL_LOCKED; 218extern pgprot_t PAGE_KERNEL_LOCKED;
@@ -780,8 +780,8 @@ static inline int pmd_present(pmd_t pmd)
780 !__kern_addr_valid(pud_val(pud))) 780 !__kern_addr_valid(pud_val(pud)))
781 781
782#ifdef CONFIG_TRANSPARENT_HUGEPAGE 782#ifdef CONFIG_TRANSPARENT_HUGEPAGE
783extern void set_pmd_at(struct mm_struct *mm, unsigned long addr, 783void set_pmd_at(struct mm_struct *mm, unsigned long addr,
784 pmd_t *pmdp, pmd_t pmd); 784 pmd_t *pmdp, pmd_t pmd);
785#else 785#else
786static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, 786static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
787 pmd_t *pmdp, pmd_t pmd) 787 pmd_t *pmdp, pmd_t pmd)
@@ -840,8 +840,8 @@ static inline unsigned long __pmd_page(pmd_t pmd)
840#define pte_unmap(pte) do { } while (0) 840#define pte_unmap(pte) do { } while (0)
841 841
842/* Actual page table PTE updates. */ 842/* Actual page table PTE updates. */
843extern void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, 843void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr,
844 pte_t *ptep, pte_t orig, int fullmm); 844 pte_t *ptep, pte_t orig, int fullmm);
845 845
846#define __HAVE_ARCH_PMDP_GET_AND_CLEAR 846#define __HAVE_ARCH_PMDP_GET_AND_CLEAR
847static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm, 847static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
@@ -900,28 +900,28 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
900extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 900extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
901extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD]; 901extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD];
902 902
903extern void paging_init(void); 903void paging_init(void);
904extern unsigned long find_ecache_flush_span(unsigned long size); 904unsigned long find_ecache_flush_span(unsigned long size);
905 905
906struct seq_file; 906struct seq_file;
907extern void mmu_info(struct seq_file *); 907void mmu_info(struct seq_file *);
908 908
909struct vm_area_struct; 909struct vm_area_struct;
910extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); 910void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
911#ifdef CONFIG_TRANSPARENT_HUGEPAGE 911#ifdef CONFIG_TRANSPARENT_HUGEPAGE
912extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, 912void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
913 pmd_t *pmd); 913 pmd_t *pmd);
914 914
915#define __HAVE_ARCH_PMDP_INVALIDATE 915#define __HAVE_ARCH_PMDP_INVALIDATE
916extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, 916extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
917 pmd_t *pmdp); 917 pmd_t *pmdp);
918 918
919#define __HAVE_ARCH_PGTABLE_DEPOSIT 919#define __HAVE_ARCH_PGTABLE_DEPOSIT
920extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, 920void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
921 pgtable_t pgtable); 921 pgtable_t pgtable);
922 922
923#define __HAVE_ARCH_PGTABLE_WITHDRAW 923#define __HAVE_ARCH_PGTABLE_WITHDRAW
924extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); 924pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
925#endif 925#endif
926 926
927/* Encode and de-code a swap entry */ 927/* Encode and de-code a swap entry */
@@ -937,12 +937,12 @@ extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
937#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 937#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
938 938
939/* File offset in PTE support. */ 939/* File offset in PTE support. */
940extern unsigned long pte_file(pte_t); 940unsigned long pte_file(pte_t);
941#define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT) 941#define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT)
942extern pte_t pgoff_to_pte(unsigned long); 942pte_t pgoff_to_pte(unsigned long);
943#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) 943#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL)
944 944
945extern int page_in_phys_avail(unsigned long paddr); 945int page_in_phys_avail(unsigned long paddr);
946 946
947/* 947/*
948 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in 948 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in
@@ -952,8 +952,8 @@ extern int page_in_phys_avail(unsigned long paddr);
952#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4)) 952#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
953#define GET_PFN(pfn) (pfn & 0x0fffffffffffffffUL) 953#define GET_PFN(pfn) (pfn & 0x0fffffffffffffffUL)
954 954
955extern int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, 955int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long,
956 unsigned long, pgprot_t); 956 unsigned long, pgprot_t);
957 957
958static inline int io_remap_pfn_range(struct vm_area_struct *vma, 958static inline int io_remap_pfn_range(struct vm_area_struct *vma,
959 unsigned long from, unsigned long pfn, 959 unsigned long from, unsigned long pfn,
@@ -981,20 +981,20 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
981/* We provide a special get_unmapped_area for framebuffer mmaps to try and use 981/* We provide a special get_unmapped_area for framebuffer mmaps to try and use
982 * the largest alignment possible such that larget PTEs can be used. 982 * the largest alignment possible such that larget PTEs can be used.
983 */ 983 */
984extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, 984unsigned long get_fb_unmapped_area(struct file *filp, unsigned long,
985 unsigned long, unsigned long, 985 unsigned long, unsigned long,
986 unsigned long); 986 unsigned long);
987#define HAVE_ARCH_FB_UNMAPPED_AREA 987#define HAVE_ARCH_FB_UNMAPPED_AREA
988 988
989extern void pgtable_cache_init(void); 989void pgtable_cache_init(void);
990extern void sun4v_register_fault_status(void); 990void sun4v_register_fault_status(void);
991extern void sun4v_ktsb_register(void); 991void sun4v_ktsb_register(void);
992extern void __init cheetah_ecache_flush_init(void); 992void __init cheetah_ecache_flush_init(void);
993extern void sun4v_patch_tlb_handlers(void); 993void sun4v_patch_tlb_handlers(void);
994 994
995extern unsigned long cmdline_memory_size; 995extern unsigned long cmdline_memory_size;
996 996
997extern asmlinkage void do_sparc64_fault(struct pt_regs *regs); 997asmlinkage void do_sparc64_fault(struct pt_regs *regs);
998 998
999#endif /* !(__ASSEMBLY__) */ 999#endif /* !(__ASSEMBLY__) */
1000 1000
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h
index 2c7baa4c4505..a564817bbc2e 100644
--- a/arch/sparc/include/asm/processor_32.h
+++ b/arch/sparc/include/asm/processor_32.h
@@ -74,7 +74,7 @@ struct thread_struct {
74} 74}
75 75
76/* Return saved PC of a blocked thread. */ 76/* Return saved PC of a blocked thread. */
77extern unsigned long thread_saved_pc(struct task_struct *t); 77unsigned long thread_saved_pc(struct task_struct *t);
78 78
79/* Do necessary setup to start up a newly executed thread. */ 79/* Do necessary setup to start up a newly executed thread. */
80static inline void start_thread(struct pt_regs * regs, unsigned long pc, 80static inline void start_thread(struct pt_regs * regs, unsigned long pc,
@@ -107,7 +107,7 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
107/* Free all resources held by a thread. */ 107/* Free all resources held by a thread. */
108#define release_thread(tsk) do { } while(0) 108#define release_thread(tsk) do { } while(0)
109 109
110extern unsigned long get_wchan(struct task_struct *); 110unsigned long get_wchan(struct task_struct *);
111 111
112#define task_pt_regs(tsk) ((tsk)->thread.kregs) 112#define task_pt_regs(tsk) ((tsk)->thread.kregs)
113#define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc) 113#define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc)
@@ -116,6 +116,7 @@ extern unsigned long get_wchan(struct task_struct *);
116#ifdef __KERNEL__ 116#ifdef __KERNEL__
117 117
118extern struct task_struct *last_task_used_math; 118extern struct task_struct *last_task_used_math;
119int do_mathemu(struct pt_regs *regs, struct task_struct *fpt);
119 120
120#define cpu_relax() barrier() 121#define cpu_relax() barrier()
121extern void (*sparc_idle)(void); 122extern void (*sparc_idle)(void);
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h
index 4c3f7f01c709..7028fe1a7c04 100644
--- a/arch/sparc/include/asm/processor_64.h
+++ b/arch/sparc/include/asm/processor_64.h
@@ -95,7 +95,7 @@ struct thread_struct {
95 95
96/* Return saved PC of a blocked thread. */ 96/* Return saved PC of a blocked thread. */
97struct task_struct; 97struct task_struct;
98extern unsigned long thread_saved_pc(struct task_struct *); 98unsigned long thread_saved_pc(struct task_struct *);
99 99
100/* On Uniprocessor, even in RMO processes see TSO semantics */ 100/* On Uniprocessor, even in RMO processes see TSO semantics */
101#ifdef CONFIG_SMP 101#ifdef CONFIG_SMP
@@ -194,7 +194,7 @@ do { \
194/* Free all resources held by a thread. */ 194/* Free all resources held by a thread. */
195#define release_thread(tsk) do { } while (0) 195#define release_thread(tsk) do { } while (0)
196 196
197extern unsigned long get_wchan(struct task_struct *task); 197unsigned long get_wchan(struct task_struct *task);
198 198
199#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) 199#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)
200#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc) 200#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)
@@ -253,6 +253,8 @@ static inline void prefetchw(const void *x)
253 253
254#define HAVE_ARCH_PICK_MMAP_LAYOUT 254#define HAVE_ARCH_PICK_MMAP_LAYOUT
255 255
256int do_mathemu(struct pt_regs *regs, struct fpustate *f, bool illegal_insn_trap);
257
256#endif /* !(__ASSEMBLY__) */ 258#endif /* !(__ASSEMBLY__) */
257 259
258#endif /* !(__ASM_SPARC64_PROCESSOR_H) */ 260#endif /* !(__ASM_SPARC64_PROCESSOR_H) */
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 11ebd659e7b6..d955c8df62d6 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -36,28 +36,28 @@ struct of_irq_controller {
36 void *data; 36 void *data;
37}; 37};
38 38
39extern struct device_node *of_find_node_by_cpuid(int cpuid); 39struct device_node *of_find_node_by_cpuid(int cpuid);
40extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 40int of_set_property(struct device_node *node, const char *name, void *val, int len);
41extern struct mutex of_set_property_mutex; 41extern struct mutex of_set_property_mutex;
42extern int of_getintprop_default(struct device_node *np, 42int of_getintprop_default(struct device_node *np,
43 const char *name, 43 const char *name,
44 int def); 44 int def);
45extern int of_find_in_proplist(const char *list, const char *match, int len); 45int of_find_in_proplist(const char *list, const char *match, int len);
46 46
47extern void prom_build_devicetree(void); 47void prom_build_devicetree(void);
48extern void of_populate_present_mask(void); 48void of_populate_present_mask(void);
49extern void of_fill_in_cpu_data(void); 49void of_fill_in_cpu_data(void);
50 50
51struct resource; 51struct resource;
52extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); 52void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
53extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); 53void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
54 54
55extern struct device_node *of_console_device; 55extern struct device_node *of_console_device;
56extern char *of_console_path; 56extern char *of_console_path;
57extern char *of_console_options; 57extern char *of_console_options;
58 58
59extern void irq_trans_init(struct device_node *dp); 59void irq_trans_init(struct device_node *dp);
60extern char *build_path_component(struct device_node *dp); 60char *build_path_component(struct device_node *dp);
61 61
62#endif /* __KERNEL__ */ 62#endif /* __KERNEL__ */
63#endif /* _SPARC_PROM_H */ 63#endif /* _SPARC_PROM_H */
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h
index bdfafd7af46f..bac6a946ee00 100644
--- a/arch/sparc/include/asm/ptrace.h
+++ b/arch/sparc/include/asm/ptrace.h
@@ -73,7 +73,7 @@ static inline long regs_return_value(struct pt_regs *regs)
73 return regs->u_regs[UREG_I0]; 73 return regs->u_regs[UREG_I0];
74} 74}
75#ifdef CONFIG_SMP 75#ifdef CONFIG_SMP
76extern unsigned long profile_pc(struct pt_regs *); 76unsigned long profile_pc(struct pt_regs *);
77#else 77#else
78#define profile_pc(regs) instruction_pointer(regs) 78#define profile_pc(regs) instruction_pointer(regs)
79#endif 79#endif
diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h
index 5e35e0517318..f5fffd84d0dd 100644
--- a/arch/sparc/include/asm/setup.h
+++ b/arch/sparc/include/asm/setup.h
@@ -4,8 +4,9 @@
4#ifndef _SPARC_SETUP_H 4#ifndef _SPARC_SETUP_H
5#define _SPARC_SETUP_H 5#define _SPARC_SETUP_H
6 6
7#include <uapi/asm/setup.h> 7#include <linux/interrupt.h>
8 8
9#include <uapi/asm/setup.h>
9 10
10extern char reboot_command[]; 11extern char reboot_command[];
11 12
@@ -22,9 +23,43 @@ static inline int con_is_present(void)
22{ 23{
23 return serial_console ? 0 : 1; 24 return serial_console ? 0 : 1;
24} 25}
26
27/* from irq_32.c */
28extern volatile unsigned char *fdc_status;
29extern char *pdma_vaddr;
30extern unsigned long pdma_size;
31extern volatile int doing_pdma;
32
33/* This is software state */
34extern char *pdma_base;
35extern unsigned long pdma_areasize;
36
37int sparc_floppy_request_irq(unsigned int irq, irq_handler_t irq_handler);
38
39/* setup_32.c */
40extern unsigned long cmdline_memory_size;
41
42/* devices.c */
43void __init device_scan(void);
44
45/* unaligned_32.c */
46unsigned long safe_compute_effective_address(struct pt_regs *, unsigned int);
47
48#endif
49
50#ifdef CONFIG_SPARC64
51/* unaligned_64.c */
52int handle_ldf_stq(u32 insn, struct pt_regs *regs);
53void handle_ld_nf(u32 insn, struct pt_regs *regs);
54
55/* init_64.c */
56extern atomic_t dcpage_flushes;
57extern atomic_t dcpage_flushes_xcall;
58
59extern int sysctl_tsb_ratio;
25#endif 60#endif
26 61
27extern void sun_do_break(void); 62void sun_do_break(void);
28extern int stop_a_enabled; 63extern int stop_a_enabled;
29extern int scons_pwroff; 64extern int scons_pwroff;
30 65
diff --git a/arch/sparc/include/asm/sfp-machine_32.h b/arch/sparc/include/asm/sfp-machine_32.h
index 01d9c3b5a73b..838c9d58f3b4 100644
--- a/arch/sparc/include/asm/sfp-machine_32.h
+++ b/arch/sparc/include/asm/sfp-machine_32.h
@@ -79,9 +79,9 @@
79 __asm__ ("addcc %r7,%8,%2\n\t" \ 79 __asm__ ("addcc %r7,%8,%2\n\t" \
80 "addxcc %r5,%6,%1\n\t" \ 80 "addxcc %r5,%6,%1\n\t" \
81 "addx %r3,%4,%0\n" \ 81 "addx %r3,%4,%0\n" \
82 : "=r" ((USItype)(r2)), \ 82 : "=r" (r2), \
83 "=&r" ((USItype)(r1)), \ 83 "=&r" (r1), \
84 "=&r" ((USItype)(r0)) \ 84 "=&r" (r0) \
85 : "%rJ" ((USItype)(x2)), \ 85 : "%rJ" ((USItype)(x2)), \
86 "rI" ((USItype)(y2)), \ 86 "rI" ((USItype)(y2)), \
87 "%rJ" ((USItype)(x1)), \ 87 "%rJ" ((USItype)(x1)), \
@@ -94,9 +94,9 @@
94 __asm__ ("subcc %r7,%8,%2\n\t" \ 94 __asm__ ("subcc %r7,%8,%2\n\t" \
95 "subxcc %r5,%6,%1\n\t" \ 95 "subxcc %r5,%6,%1\n\t" \
96 "subx %r3,%4,%0\n" \ 96 "subx %r3,%4,%0\n" \
97 : "=r" ((USItype)(r2)), \ 97 : "=r" (r2), \
98 "=&r" ((USItype)(r1)), \ 98 "=&r" (r1), \
99 "=&r" ((USItype)(r0)) \ 99 "=&r" (r0) \
100 : "%rJ" ((USItype)(x2)), \ 100 : "%rJ" ((USItype)(x2)), \
101 "rI" ((USItype)(y2)), \ 101 "rI" ((USItype)(y2)), \
102 "%rJ" ((USItype)(x1)), \ 102 "%rJ" ((USItype)(x1)), \
@@ -115,8 +115,8 @@
115 "addxcc %r6,%7,%0\n\t" \ 115 "addxcc %r6,%7,%0\n\t" \
116 "addxcc %r4,%5,%%g2\n\t" \ 116 "addxcc %r4,%5,%%g2\n\t" \
117 "addx %r2,%3,%%g1\n\t" \ 117 "addx %r2,%3,%%g1\n\t" \
118 : "=&r" ((USItype)(r1)), \ 118 : "=&r" (r1), \
119 "=&r" ((USItype)(r0)) \ 119 "=&r" (r0) \
120 : "%rJ" ((USItype)(x3)), \ 120 : "%rJ" ((USItype)(x3)), \
121 "rI" ((USItype)(y3)), \ 121 "rI" ((USItype)(y3)), \
122 "%rJ" ((USItype)(x2)), \ 122 "%rJ" ((USItype)(x2)), \
@@ -140,8 +140,8 @@
140 "subxcc %r6,%7,%0\n\t" \ 140 "subxcc %r6,%7,%0\n\t" \
141 "subxcc %r4,%5,%%g2\n\t" \ 141 "subxcc %r4,%5,%%g2\n\t" \
142 "subx %r2,%3,%%g1\n\t" \ 142 "subx %r2,%3,%%g1\n\t" \
143 : "=&r" ((USItype)(r1)), \ 143 : "=&r" (r1), \
144 "=&r" ((USItype)(r0)) \ 144 "=&r" (r0) \
145 : "%rJ" ((USItype)(x3)), \ 145 : "%rJ" ((USItype)(x3)), \
146 "rI" ((USItype)(y3)), \ 146 "rI" ((USItype)(y3)), \
147 "%rJ" ((USItype)(x2)), \ 147 "%rJ" ((USItype)(x2)), \
@@ -164,10 +164,10 @@
164 "addxcc %2,%%g0,%2\n\t" \ 164 "addxcc %2,%%g0,%2\n\t" \
165 "addxcc %1,%%g0,%1\n\t" \ 165 "addxcc %1,%%g0,%1\n\t" \
166 "addx %0,%%g0,%0\n\t" \ 166 "addx %0,%%g0,%0\n\t" \
167 : "=&r" ((USItype)(x3)), \ 167 : "=&r" (x3), \
168 "=&r" ((USItype)(x2)), \ 168 "=&r" (x2), \
169 "=&r" ((USItype)(x1)), \ 169 "=&r" (x1), \
170 "=&r" ((USItype)(x0)) \ 170 "=&r" (x0) \
171 : "rI" ((USItype)(i)), \ 171 : "rI" ((USItype)(i)), \
172 "0" ((USItype)(x3)), \ 172 "0" ((USItype)(x3)), \
173 "1" ((USItype)(x2)), \ 173 "1" ((USItype)(x2)), \
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h
index 3c8917f054de..7c24e08a88d2 100644
--- a/arch/sparc/include/asm/smp_32.h
+++ b/arch/sparc/include/asm/smp_32.h
@@ -93,15 +93,15 @@ static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2,
93 arg1, arg2, arg3, arg4); 93 arg1, arg2, arg3, arg4);
94} 94}
95 95
96extern void arch_send_call_function_single_ipi(int cpu); 96void arch_send_call_function_single_ipi(int cpu);
97extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 97void arch_send_call_function_ipi_mask(const struct cpumask *mask);
98 98
99static inline int cpu_logical_map(int cpu) 99static inline int cpu_logical_map(int cpu)
100{ 100{
101 return cpu; 101 return cpu;
102} 102}
103 103
104extern int hard_smp_processor_id(void); 104int hard_smp_processor_id(void);
105 105
106#define raw_smp_processor_id() (current_thread_info()->cpu) 106#define raw_smp_processor_id() (current_thread_info()->cpu)
107 107
diff --git a/arch/sparc/include/asm/smp_64.h b/arch/sparc/include/asm/smp_64.h
index 05710393959f..26d9e7726867 100644
--- a/arch/sparc/include/asm/smp_64.h
+++ b/arch/sparc/include/asm/smp_64.h
@@ -33,29 +33,35 @@
33DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 33DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
34extern cpumask_t cpu_core_map[NR_CPUS]; 34extern cpumask_t cpu_core_map[NR_CPUS];
35 35
36extern void arch_send_call_function_single_ipi(int cpu); 36void arch_send_call_function_single_ipi(int cpu);
37extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 37void arch_send_call_function_ipi_mask(const struct cpumask *mask);
38 38
39/* 39/*
40 * General functions that each host system must provide. 40 * General functions that each host system must provide.
41 */ 41 */
42 42
43extern int hard_smp_processor_id(void); 43int hard_smp_processor_id(void);
44#define raw_smp_processor_id() (current_thread_info()->cpu) 44#define raw_smp_processor_id() (current_thread_info()->cpu)
45 45
46extern void smp_fill_in_sib_core_maps(void); 46void smp_fill_in_sib_core_maps(void);
47extern void cpu_play_dead(void); 47void cpu_play_dead(void);
48 48
49extern void smp_fetch_global_regs(void); 49void smp_fetch_global_regs(void);
50extern void smp_fetch_global_pmu(void); 50void smp_fetch_global_pmu(void);
51 51
52struct seq_file; 52struct seq_file;
53void smp_bogo(struct seq_file *); 53void smp_bogo(struct seq_file *);
54void smp_info(struct seq_file *); 54void smp_info(struct seq_file *);
55 55
56void smp_callin(void);
57void cpu_panic(void);
58void smp_synchronize_tick_client(void);
59void smp_capture(void);
60void smp_release(void);
61
56#ifdef CONFIG_HOTPLUG_CPU 62#ifdef CONFIG_HOTPLUG_CPU
57extern int __cpu_disable(void); 63int __cpu_disable(void);
58extern void __cpu_die(unsigned int cpu); 64void __cpu_die(unsigned int cpu);
59#endif 65#endif
60 66
61#endif /* !(__ASSEMBLY__) */ 67#endif /* !(__ASSEMBLY__) */
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 6b67e50fb9b4..3fc58691dbd0 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -62,7 +62,7 @@ extern enum ultra_tlb_layout tlb_type;
62extern int sun4v_chip_type; 62extern int sun4v_chip_type;
63 63
64extern int cheetah_pcache_forced_on; 64extern int cheetah_pcache_forced_on;
65extern void cheetah_enable_pcache(void); 65void cheetah_enable_pcache(void);
66 66
67#define sparc64_highest_locked_tlbent() \ 67#define sparc64_highest_locked_tlbent() \
68 (tlb_type == spitfire ? \ 68 (tlb_type == spitfire ? \
diff --git a/arch/sparc/include/asm/stacktrace.h b/arch/sparc/include/asm/stacktrace.h
index 6cee39adf6d6..c30d066f3048 100644
--- a/arch/sparc/include/asm/stacktrace.h
+++ b/arch/sparc/include/asm/stacktrace.h
@@ -1,6 +1,6 @@
1#ifndef _SPARC64_STACKTRACE_H 1#ifndef _SPARC64_STACKTRACE_H
2#define _SPARC64_STACKTRACE_H 2#define _SPARC64_STACKTRACE_H
3 3
4extern void stack_trace_flush(void); 4void stack_trace_flush(void);
5 5
6#endif /* _SPARC64_STACKTRACE_H */ 6#endif /* _SPARC64_STACKTRACE_H */
diff --git a/arch/sparc/include/asm/starfire.h b/arch/sparc/include/asm/starfire.h
index d56ce60a5992..c100dc27a0a9 100644
--- a/arch/sparc/include/asm/starfire.h
+++ b/arch/sparc/include/asm/starfire.h
@@ -11,10 +11,10 @@
11 11
12extern int this_is_starfire; 12extern int this_is_starfire;
13 13
14extern void check_if_starfire(void); 14void check_if_starfire(void);
15extern int starfire_hard_smp_processor_id(void); 15int starfire_hard_smp_processor_id(void);
16extern void starfire_hookup(int); 16void starfire_hookup(int);
17extern unsigned int starfire_translate(unsigned long imap, unsigned int upaid); 17unsigned int starfire_translate(unsigned long imap, unsigned int upaid);
18 18
19#endif 19#endif
20#endif 20#endif
diff --git a/arch/sparc/include/asm/string_32.h b/arch/sparc/include/asm/string_32.h
index 12f67857152e..69974e924611 100644
--- a/arch/sparc/include/asm/string_32.h
+++ b/arch/sparc/include/asm/string_32.h
@@ -15,7 +15,7 @@
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18extern void __memmove(void *,const void *,__kernel_size_t); 18void __memmove(void *,const void *,__kernel_size_t);
19 19
20#ifndef EXPORT_SYMTAB_STROPS 20#ifndef EXPORT_SYMTAB_STROPS
21 21
@@ -40,8 +40,8 @@ extern void __memmove(void *,const void *,__kernel_size_t);
40#undef memscan 40#undef memscan
41#define memscan(__arg0, __char, __arg2) \ 41#define memscan(__arg0, __char, __arg2) \
42({ \ 42({ \
43 extern void *__memscan_zero(void *, size_t); \ 43 void *__memscan_zero(void *, size_t); \
44 extern void *__memscan_generic(void *, int, size_t); \ 44 void *__memscan_generic(void *, int, size_t); \
45 void *__retval, *__addr = (__arg0); \ 45 void *__retval, *__addr = (__arg0); \
46 size_t __size = (__arg2); \ 46 size_t __size = (__arg2); \
47 \ 47 \
@@ -54,14 +54,14 @@ extern void __memmove(void *,const void *,__kernel_size_t);
54}) 54})
55 55
56#define __HAVE_ARCH_MEMCMP 56#define __HAVE_ARCH_MEMCMP
57extern int memcmp(const void *,const void *,__kernel_size_t); 57int memcmp(const void *,const void *,__kernel_size_t);
58 58
59/* Now the str*() stuff... */ 59/* Now the str*() stuff... */
60#define __HAVE_ARCH_STRLEN 60#define __HAVE_ARCH_STRLEN
61extern __kernel_size_t strlen(const char *); 61__kernel_size_t strlen(const char *);
62 62
63#define __HAVE_ARCH_STRNCMP 63#define __HAVE_ARCH_STRNCMP
64extern int strncmp(const char *, const char *, __kernel_size_t); 64int strncmp(const char *, const char *, __kernel_size_t);
65 65
66#endif /* !EXPORT_SYMTAB_STROPS */ 66#endif /* !EXPORT_SYMTAB_STROPS */
67 67
diff --git a/arch/sparc/include/asm/string_64.h b/arch/sparc/include/asm/string_64.h
index 9623bc213158..5936b8ff3c05 100644
--- a/arch/sparc/include/asm/string_64.h
+++ b/arch/sparc/include/asm/string_64.h
@@ -19,7 +19,7 @@
19 19
20/* First the mem*() things. */ 20/* First the mem*() things. */
21#define __HAVE_ARCH_MEMMOVE 21#define __HAVE_ARCH_MEMMOVE
22extern void *memmove(void *, const void *, __kernel_size_t); 22void *memmove(void *, const void *, __kernel_size_t);
23 23
24#define __HAVE_ARCH_MEMCPY 24#define __HAVE_ARCH_MEMCPY
25#define memcpy(t, f, n) __builtin_memcpy(t, f, n) 25#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
@@ -32,8 +32,8 @@ extern void *memmove(void *, const void *, __kernel_size_t);
32#undef memscan 32#undef memscan
33#define memscan(__arg0, __char, __arg2) \ 33#define memscan(__arg0, __char, __arg2) \
34({ \ 34({ \
35 extern void *__memscan_zero(void *, size_t); \ 35 void *__memscan_zero(void *, size_t); \
36 extern void *__memscan_generic(void *, int, size_t); \ 36 void *__memscan_generic(void *, int, size_t); \
37 void *__retval, *__addr = (__arg0); \ 37 void *__retval, *__addr = (__arg0); \
38 size_t __size = (__arg2); \ 38 size_t __size = (__arg2); \
39 \ 39 \
@@ -46,14 +46,14 @@ extern void *memmove(void *, const void *, __kernel_size_t);
46}) 46})
47 47
48#define __HAVE_ARCH_MEMCMP 48#define __HAVE_ARCH_MEMCMP
49extern int memcmp(const void *,const void *,__kernel_size_t); 49int memcmp(const void *,const void *,__kernel_size_t);
50 50
51/* Now the str*() stuff... */ 51/* Now the str*() stuff... */
52#define __HAVE_ARCH_STRLEN 52#define __HAVE_ARCH_STRLEN
53extern __kernel_size_t strlen(const char *); 53__kernel_size_t strlen(const char *);
54 54
55#define __HAVE_ARCH_STRNCMP 55#define __HAVE_ARCH_STRNCMP
56extern int strncmp(const char *, const char *, __kernel_size_t); 56int strncmp(const char *, const char *, __kernel_size_t);
57 57
58#endif /* !EXPORT_SYMTAB_STROPS */ 58#endif /* !EXPORT_SYMTAB_STROPS */
59 59
diff --git a/arch/sparc/include/asm/switch_to_32.h b/arch/sparc/include/asm/switch_to_32.h
index e32e82b76eed..16f10374feb3 100644
--- a/arch/sparc/include/asm/switch_to_32.h
+++ b/arch/sparc/include/asm/switch_to_32.h
@@ -99,8 +99,8 @@ extern struct thread_info *current_set[NR_CPUS];
99 "o0", "o1", "o2", "o3", "o7"); \ 99 "o0", "o1", "o2", "o3", "o7"); \
100 } while(0) 100 } while(0)
101 101
102extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 102void fpsave(unsigned long *fpregs, unsigned long *fsr,
103 void *fpqueue, unsigned long *fpqdepth); 103 void *fpqueue, unsigned long *fpqdepth);
104extern void synchronize_user_stack(void); 104void synchronize_user_stack(void);
105 105
106#endif /* __SPARC_SWITCH_TO_H */ 106#endif /* __SPARC_SWITCH_TO_H */
diff --git a/arch/sparc/include/asm/switch_to_64.h b/arch/sparc/include/asm/switch_to_64.h
index 8d284801f232..10e76332dc99 100644
--- a/arch/sparc/include/asm/switch_to_64.h
+++ b/arch/sparc/include/asm/switch_to_64.h
@@ -65,7 +65,7 @@ do { save_and_clear_fpu(); \
65 "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \ 65 "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \
66} while(0) 66} while(0)
67 67
68extern void synchronize_user_stack(void); 68void synchronize_user_stack(void);
69extern void fault_in_user_windows(void); 69void fault_in_user_windows(void);
70 70
71#endif /* __SPARC64_SWITCH_TO_64_H */ 71#endif /* __SPARC64_SWITCH_TO_64_H */
diff --git a/arch/sparc/include/asm/syscalls.h b/arch/sparc/include/asm/syscalls.h
index bf8972adea17..b0a0db8ea61a 100644
--- a/arch/sparc/include/asm/syscalls.h
+++ b/arch/sparc/include/asm/syscalls.h
@@ -3,9 +3,9 @@
3 3
4struct pt_regs; 4struct pt_regs;
5 5
6extern asmlinkage long sparc_do_fork(unsigned long clone_flags, 6asmlinkage long sparc_do_fork(unsigned long clone_flags,
7 unsigned long stack_start, 7 unsigned long stack_start,
8 struct pt_regs *regs, 8 struct pt_regs *regs,
9 unsigned long stack_size); 9 unsigned long stack_size);
10 10
11#endif /* _SPARC64_SYSCALLS_H */ 11#endif /* _SPARC64_SYSCALLS_H */
diff --git a/arch/sparc/include/asm/timer_32.h b/arch/sparc/include/asm/timer_32.h
index 72f40a546de3..f8e708a0aa58 100644
--- a/arch/sparc/include/asm/timer_32.h
+++ b/arch/sparc/include/asm/timer_32.h
@@ -32,13 +32,13 @@ static inline unsigned int timer_value(unsigned int value)
32 return (value + 1) << TIMER_VALUE_SHIFT; 32 return (value + 1) << TIMER_VALUE_SHIFT;
33} 33}
34 34
35extern __volatile__ unsigned int *master_l10_counter; 35extern volatile u32 __iomem *master_l10_counter;
36 36
37extern irqreturn_t notrace timer_interrupt(int dummy, void *dev_id); 37irqreturn_t notrace timer_interrupt(int dummy, void *dev_id);
38 38
39#ifdef CONFIG_SMP 39#ifdef CONFIG_SMP
40DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent); 40DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent);
41extern void register_percpu_ce(int cpu); 41void register_percpu_ce(int cpu);
42#endif 42#endif
43 43
44#endif /* !(_SPARC_TIMER_H) */ 44#endif /* !(_SPARC_TIMER_H) */
diff --git a/arch/sparc/include/asm/timer_64.h b/arch/sparc/include/asm/timer_64.h
index 01197d8215c4..fce415034000 100644
--- a/arch/sparc/include/asm/timer_64.h
+++ b/arch/sparc/include/asm/timer_64.h
@@ -23,8 +23,8 @@ struct sparc64_tick_ops {
23 23
24extern struct sparc64_tick_ops *tick_ops; 24extern struct sparc64_tick_ops *tick_ops;
25 25
26extern unsigned long sparc64_get_clock_tick(unsigned int cpu); 26unsigned long sparc64_get_clock_tick(unsigned int cpu);
27extern void setup_sparc64_timer(void); 27void setup_sparc64_timer(void);
28extern void __init time_init(void); 28void __init time_init(void);
29 29
30#endif /* _SPARC64_TIMER_H */ 30#endif /* _SPARC64_TIMER_H */
diff --git a/arch/sparc/include/asm/tlb_64.h b/arch/sparc/include/asm/tlb_64.h
index 190e18913cc6..4cb392f75d2b 100644
--- a/arch/sparc/include/asm/tlb_64.h
+++ b/arch/sparc/include/asm/tlb_64.h
@@ -8,19 +8,19 @@
8#include <asm/mmu_context.h> 8#include <asm/mmu_context.h>
9 9
10#ifdef CONFIG_SMP 10#ifdef CONFIG_SMP
11extern void smp_flush_tlb_pending(struct mm_struct *, 11void smp_flush_tlb_pending(struct mm_struct *,
12 unsigned long, unsigned long *); 12 unsigned long, unsigned long *);
13#endif 13#endif
14 14
15#ifdef CONFIG_SMP 15#ifdef CONFIG_SMP
16extern void smp_flush_tlb_mm(struct mm_struct *mm); 16void smp_flush_tlb_mm(struct mm_struct *mm);
17#define do_flush_tlb_mm(mm) smp_flush_tlb_mm(mm) 17#define do_flush_tlb_mm(mm) smp_flush_tlb_mm(mm)
18#else 18#else
19#define do_flush_tlb_mm(mm) __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT) 19#define do_flush_tlb_mm(mm) __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT)
20#endif 20#endif
21 21
22extern void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *); 22void __flush_tlb_pending(unsigned long, unsigned long, unsigned long *);
23extern void flush_tlb_pending(void); 23void flush_tlb_pending(void);
24 24
25#define tlb_start_vma(tlb, vma) do { } while (0) 25#define tlb_start_vma(tlb, vma) do { } while (0)
26#define tlb_end_vma(tlb, vma) do { } while (0) 26#define tlb_end_vma(tlb, vma) do { } while (0)
diff --git a/arch/sparc/include/asm/tlbflush_64.h b/arch/sparc/include/asm/tlbflush_64.h
index 3c3c89f52643..816d8202fa0a 100644
--- a/arch/sparc/include/asm/tlbflush_64.h
+++ b/arch/sparc/include/asm/tlbflush_64.h
@@ -14,9 +14,9 @@ struct tlb_batch {
14 unsigned long vaddrs[TLB_BATCH_NR]; 14 unsigned long vaddrs[TLB_BATCH_NR];
15}; 15};
16 16
17extern void flush_tsb_kernel_range(unsigned long start, unsigned long end); 17void flush_tsb_kernel_range(unsigned long start, unsigned long end);
18extern void flush_tsb_user(struct tlb_batch *tb); 18void flush_tsb_user(struct tlb_batch *tb);
19extern void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr); 19void flush_tsb_user_page(struct mm_struct *mm, unsigned long vaddr);
20 20
21/* TLB flush operations. */ 21/* TLB flush operations. */
22 22
@@ -36,15 +36,15 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
36 36
37#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 37#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
38 38
39extern void flush_tlb_pending(void); 39void flush_tlb_pending(void);
40extern void arch_enter_lazy_mmu_mode(void); 40void arch_enter_lazy_mmu_mode(void);
41extern void arch_leave_lazy_mmu_mode(void); 41void arch_leave_lazy_mmu_mode(void);
42#define arch_flush_lazy_mmu_mode() do {} while (0) 42#define arch_flush_lazy_mmu_mode() do {} while (0)
43 43
44/* Local cpu only. */ 44/* Local cpu only. */
45extern void __flush_tlb_all(void); 45void __flush_tlb_all(void);
46extern void __flush_tlb_page(unsigned long context, unsigned long vaddr); 46void __flush_tlb_page(unsigned long context, unsigned long vaddr);
47extern void __flush_tlb_kernel_range(unsigned long start, unsigned long end); 47void __flush_tlb_kernel_range(unsigned long start, unsigned long end);
48 48
49#ifndef CONFIG_SMP 49#ifndef CONFIG_SMP
50 50
@@ -60,8 +60,8 @@ static inline void global_flush_tlb_page(struct mm_struct *mm, unsigned long vad
60 60
61#else /* CONFIG_SMP */ 61#else /* CONFIG_SMP */
62 62
63extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); 63void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end);
64extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr); 64void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr);
65 65
66#define flush_tlb_kernel_range(start, end) \ 66#define flush_tlb_kernel_range(start, end) \
67do { flush_tsb_kernel_range(start,end); \ 67do { flush_tsb_kernel_range(start,end); \
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index a2d10fc64faf..ed8f071132e4 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -18,7 +18,7 @@ static inline int cpu_to_node(int cpu)
18 18
19struct pci_bus; 19struct pci_bus;
20#ifdef CONFIG_PCI 20#ifdef CONFIG_PCI
21extern int pcibus_to_node(struct pci_bus *pbus); 21int pcibus_to_node(struct pci_bus *pbus);
22#else 22#else
23static inline int pcibus_to_node(struct pci_bus *pbus) 23static inline int pcibus_to_node(struct pci_bus *pbus)
24{ 24{
diff --git a/arch/sparc/include/asm/trap_block.h b/arch/sparc/include/asm/trap_block.h
index 7e26b2db6211..6fd4436d32f0 100644
--- a/arch/sparc/include/asm/trap_block.h
+++ b/arch/sparc/include/asm/trap_block.h
@@ -51,11 +51,11 @@ struct trap_per_cpu {
51 unsigned long __per_cpu_base; 51 unsigned long __per_cpu_base;
52} __attribute__((aligned(64))); 52} __attribute__((aligned(64)));
53extern struct trap_per_cpu trap_block[NR_CPUS]; 53extern struct trap_per_cpu trap_block[NR_CPUS];
54extern void init_cur_cpu_trap(struct thread_info *); 54void init_cur_cpu_trap(struct thread_info *);
55extern void setup_tba(void); 55void setup_tba(void);
56extern int ncpus_probed; 56extern int ncpus_probed;
57 57
58extern unsigned long real_hard_smp_processor_id(void); 58unsigned long real_hard_smp_processor_id(void);
59 59
60struct cpuid_patch_entry { 60struct cpuid_patch_entry {
61 unsigned int addr; 61 unsigned int addr;
diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h
index 0167d26d0d1d..bd56c28fff9f 100644
--- a/arch/sparc/include/asm/uaccess.h
+++ b/arch/sparc/include/asm/uaccess.h
@@ -9,6 +9,6 @@
9#define user_addr_max() \ 9#define user_addr_max() \
10 (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) 10 (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)
11 11
12extern long strncpy_from_user(char *dest, const char __user *src, long count); 12long strncpy_from_user(char *dest, const char __user *src, long count);
13 13
14#endif 14#endif
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h
index 53a28dd59f59..9634d086fc56 100644
--- a/arch/sparc/include/asm/uaccess_32.h
+++ b/arch/sparc/include/asm/uaccess_32.h
@@ -78,9 +78,9 @@ struct exception_table_entry
78}; 78};
79 79
80/* Returns 0 if exception not found and fixup otherwise. */ 80/* Returns 0 if exception not found and fixup otherwise. */
81extern unsigned long search_extables_range(unsigned long addr, unsigned long *g2); 81unsigned long search_extables_range(unsigned long addr, unsigned long *g2);
82 82
83extern void __ret_efault(void); 83void __ret_efault(void);
84 84
85/* Uh, these should become the main single-value transfer routines.. 85/* Uh, these should become the main single-value transfer routines..
86 * They automatically use the right size if we just have the right 86 * They automatically use the right size if we just have the right
@@ -152,7 +152,7 @@ __asm__ __volatile__( \
152 : "=&r" (ret) : "r" (x), "m" (*__m(addr)), \ 152 : "=&r" (ret) : "r" (x), "m" (*__m(addr)), \
153 "i" (-EFAULT)) 153 "i" (-EFAULT))
154 154
155extern int __put_user_bad(void); 155int __put_user_bad(void);
156 156
157#define __get_user_check(x,addr,size,type) ({ \ 157#define __get_user_check(x,addr,size,type) ({ \
158register int __gu_ret; \ 158register int __gu_ret; \
@@ -244,9 +244,9 @@ __asm__ __volatile__( \
244 ".previous\n\t" \ 244 ".previous\n\t" \
245 : "=&r" (x) : "m" (*__m(addr)), "i" (retval)) 245 : "=&r" (x) : "m" (*__m(addr)), "i" (retval))
246 246
247extern int __get_user_bad(void); 247int __get_user_bad(void);
248 248
249extern unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size); 249unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size);
250 250
251static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) 251static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
252{ 252{
@@ -306,8 +306,8 @@ static inline unsigned long clear_user(void __user *addr, unsigned long n)
306 return n; 306 return n;
307} 307}
308 308
309extern __must_check long strlen_user(const char __user *str); 309__must_check long strlen_user(const char __user *str);
310extern __must_check long strnlen_user(const char __user *str, long n); 310__must_check long strnlen_user(const char __user *str, long n);
311 311
312#endif /* __ASSEMBLY__ */ 312#endif /* __ASSEMBLY__ */
313 313
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index ad7e178337f1..c990a5e577f0 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -76,8 +76,8 @@ struct exception_table_entry {
76 unsigned int insn, fixup; 76 unsigned int insn, fixup;
77}; 77};
78 78
79extern void __ret_efault(void); 79void __ret_efault(void);
80extern void __retl_efault(void); 80void __retl_efault(void);
81 81
82/* Uh, these should become the main single-value transfer routines.. 82/* Uh, these should become the main single-value transfer routines..
83 * They automatically use the right size if we just have the right 83 * They automatically use the right size if we just have the right
@@ -134,7 +134,7 @@ __asm__ __volatile__( \
134 : "=r" (ret) : "r" (x), "r" (__m(addr)), \ 134 : "=r" (ret) : "r" (x), "r" (__m(addr)), \
135 "i" (-EFAULT)) 135 "i" (-EFAULT))
136 136
137extern int __put_user_bad(void); 137int __put_user_bad(void);
138 138
139#define __get_user_nocheck(data,addr,size,type) ({ \ 139#define __get_user_nocheck(data,addr,size,type) ({ \
140register int __gu_ret; \ 140register int __gu_ret; \
@@ -204,13 +204,13 @@ __asm__ __volatile__( \
204 ".previous\n\t" \ 204 ".previous\n\t" \
205 : "=r" (x) : "r" (__m(addr)), "i" (retval)) 205 : "=r" (x) : "r" (__m(addr)), "i" (retval))
206 206
207extern int __get_user_bad(void); 207int __get_user_bad(void);
208 208
209extern unsigned long __must_check ___copy_from_user(void *to, 209unsigned long __must_check ___copy_from_user(void *to,
210 const void __user *from, 210 const void __user *from,
211 unsigned long size); 211 unsigned long size);
212extern unsigned long copy_from_user_fixup(void *to, const void __user *from, 212unsigned long copy_from_user_fixup(void *to, const void __user *from,
213 unsigned long size); 213 unsigned long size);
214static inline unsigned long __must_check 214static inline unsigned long __must_check
215copy_from_user(void *to, const void __user *from, unsigned long size) 215copy_from_user(void *to, const void __user *from, unsigned long size)
216{ 216{
@@ -223,11 +223,11 @@ copy_from_user(void *to, const void __user *from, unsigned long size)
223} 223}
224#define __copy_from_user copy_from_user 224#define __copy_from_user copy_from_user
225 225
226extern unsigned long __must_check ___copy_to_user(void __user *to, 226unsigned long __must_check ___copy_to_user(void __user *to,
227 const void *from, 227 const void *from,
228 unsigned long size); 228 unsigned long size);
229extern unsigned long copy_to_user_fixup(void __user *to, const void *from, 229unsigned long copy_to_user_fixup(void __user *to, const void *from,
230 unsigned long size); 230 unsigned long size);
231static inline unsigned long __must_check 231static inline unsigned long __must_check
232copy_to_user(void __user *to, const void *from, unsigned long size) 232copy_to_user(void __user *to, const void *from, unsigned long size)
233{ 233{
@@ -239,11 +239,11 @@ copy_to_user(void __user *to, const void *from, unsigned long size)
239} 239}
240#define __copy_to_user copy_to_user 240#define __copy_to_user copy_to_user
241 241
242extern unsigned long __must_check ___copy_in_user(void __user *to, 242unsigned long __must_check ___copy_in_user(void __user *to,
243 const void __user *from, 243 const void __user *from,
244 unsigned long size); 244 unsigned long size);
245extern unsigned long copy_in_user_fixup(void __user *to, void __user *from, 245unsigned long copy_in_user_fixup(void __user *to, void __user *from,
246 unsigned long size); 246 unsigned long size);
247static inline unsigned long __must_check 247static inline unsigned long __must_check
248copy_in_user(void __user *to, void __user *from, unsigned long size) 248copy_in_user(void __user *to, void __user *from, unsigned long size)
249{ 249{
@@ -255,20 +255,20 @@ copy_in_user(void __user *to, void __user *from, unsigned long size)
255} 255}
256#define __copy_in_user copy_in_user 256#define __copy_in_user copy_in_user
257 257
258extern unsigned long __must_check __clear_user(void __user *, unsigned long); 258unsigned long __must_check __clear_user(void __user *, unsigned long);
259 259
260#define clear_user __clear_user 260#define clear_user __clear_user
261 261
262extern __must_check long strlen_user(const char __user *str); 262__must_check long strlen_user(const char __user *str);
263extern __must_check long strnlen_user(const char __user *str, long n); 263__must_check long strnlen_user(const char __user *str, long n);
264 264
265#define __copy_to_user_inatomic __copy_to_user 265#define __copy_to_user_inatomic __copy_to_user
266#define __copy_from_user_inatomic __copy_from_user 266#define __copy_from_user_inatomic __copy_from_user
267 267
268struct pt_regs; 268struct pt_regs;
269extern unsigned long compute_effective_address(struct pt_regs *, 269unsigned long compute_effective_address(struct pt_regs *,
270 unsigned int insn, 270 unsigned int insn,
271 unsigned int rd); 271 unsigned int rd);
272 272
273#endif /* __ASSEMBLY__ */ 273#endif /* __ASSEMBLY__ */
274 274
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h
index 432afa838861..e0f6c399f1d0 100644
--- a/arch/sparc/include/asm/vio.h
+++ b/arch/sparc/include/asm/vio.h
@@ -372,14 +372,14 @@ do { if (vio->debug & VIO_DEBUG_##TYPE) \
372 vio->vdev->channel_id, ## a); \ 372 vio->vdev->channel_id, ## a); \
373} while (0) 373} while (0)
374 374
375extern int __vio_register_driver(struct vio_driver *drv, struct module *owner, 375int __vio_register_driver(struct vio_driver *drv, struct module *owner,
376 const char *mod_name); 376 const char *mod_name);
377/* 377/*
378 * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded 378 * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded
379 */ 379 */
380#define vio_register_driver(driver) \ 380#define vio_register_driver(driver) \
381 __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) 381 __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
382extern void vio_unregister_driver(struct vio_driver *drv); 382void vio_unregister_driver(struct vio_driver *drv);
383 383
384static inline struct vio_driver *to_vio_driver(struct device_driver *drv) 384static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
385{ 385{
@@ -391,21 +391,21 @@ static inline struct vio_dev *to_vio_dev(struct device *dev)
391 return container_of(dev, struct vio_dev, dev); 391 return container_of(dev, struct vio_dev, dev);
392} 392}
393 393
394extern int vio_ldc_send(struct vio_driver_state *vio, void *data, int len); 394int vio_ldc_send(struct vio_driver_state *vio, void *data, int len);
395extern void vio_link_state_change(struct vio_driver_state *vio, int event); 395void vio_link_state_change(struct vio_driver_state *vio, int event);
396extern void vio_conn_reset(struct vio_driver_state *vio); 396void vio_conn_reset(struct vio_driver_state *vio);
397extern int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt); 397int vio_control_pkt_engine(struct vio_driver_state *vio, void *pkt);
398extern int vio_validate_sid(struct vio_driver_state *vio, 398int vio_validate_sid(struct vio_driver_state *vio,
399 struct vio_msg_tag *tp); 399 struct vio_msg_tag *tp);
400extern u32 vio_send_sid(struct vio_driver_state *vio); 400u32 vio_send_sid(struct vio_driver_state *vio);
401extern int vio_ldc_alloc(struct vio_driver_state *vio, 401int vio_ldc_alloc(struct vio_driver_state *vio,
402 struct ldc_channel_config *base_cfg, void *event_arg); 402 struct ldc_channel_config *base_cfg, void *event_arg);
403extern void vio_ldc_free(struct vio_driver_state *vio); 403void vio_ldc_free(struct vio_driver_state *vio);
404extern int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev, 404int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
405 u8 dev_class, struct vio_version *ver_table, 405 u8 dev_class, struct vio_version *ver_table,
406 int ver_table_size, struct vio_driver_ops *ops, 406 int ver_table_size, struct vio_driver_ops *ops,
407 char *name); 407 char *name);
408 408
409extern void vio_port_up(struct vio_driver_state *vio); 409void vio_port_up(struct vio_driver_state *vio);
410 410
411#endif /* _SPARC64_VIO_H */ 411#endif /* _SPARC64_VIO_H */
diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h
index 39ca301920db..b26673759283 100644
--- a/arch/sparc/include/asm/visasm.h
+++ b/arch/sparc/include/asm/visasm.h
@@ -57,7 +57,8 @@ static inline void save_and_clear_fpu(void) {
57" " : : "i" (FPRS_FEF|FPRS_DU) : 57" " : : "i" (FPRS_FEF|FPRS_DU) :
58 "o5", "g1", "g2", "g3", "g7", "cc"); 58 "o5", "g1", "g2", "g3", "g7", "cc");
59} 59}
60extern int vis_emul(struct pt_regs *, unsigned int); 60
61int vis_emul(struct pt_regs *, unsigned int);
61#endif 62#endif
62 63
63#endif /* _SPARC64_ASI_H */ 64#endif /* _SPARC64_ASI_H */
diff --git a/arch/sparc/include/asm/xor_64.h b/arch/sparc/include/asm/xor_64.h
index ee8edc68423e..50c882856031 100644
--- a/arch/sparc/include/asm/xor_64.h
+++ b/arch/sparc/include/asm/xor_64.h
@@ -20,13 +20,13 @@
20 20
21#include <asm/spitfire.h> 21#include <asm/spitfire.h>
22 22
23extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); 23void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
24extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, 24void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
25 unsigned long *); 25 unsigned long *);
26extern void xor_vis_4(unsigned long, unsigned long *, unsigned long *, 26void xor_vis_4(unsigned long, unsigned long *, unsigned long *,
27 unsigned long *, unsigned long *); 27 unsigned long *, unsigned long *);
28extern void xor_vis_5(unsigned long, unsigned long *, unsigned long *, 28void xor_vis_5(unsigned long, unsigned long *, unsigned long *,
29 unsigned long *, unsigned long *, unsigned long *); 29 unsigned long *, unsigned long *, unsigned long *);
30 30
31/* XXX Ugh, write cheetah versions... -DaveM */ 31/* XXX Ugh, write cheetah versions... -DaveM */
32 32
@@ -38,13 +38,13 @@ static struct xor_block_template xor_block_VIS = {
38 .do_5 = xor_vis_5, 38 .do_5 = xor_vis_5,
39}; 39};
40 40
41extern void xor_niagara_2(unsigned long, unsigned long *, unsigned long *); 41void xor_niagara_2(unsigned long, unsigned long *, unsigned long *);
42extern void xor_niagara_3(unsigned long, unsigned long *, unsigned long *, 42void xor_niagara_3(unsigned long, unsigned long *, unsigned long *,
43 unsigned long *); 43 unsigned long *);
44extern void xor_niagara_4(unsigned long, unsigned long *, unsigned long *, 44void xor_niagara_4(unsigned long, unsigned long *, unsigned long *,
45 unsigned long *, unsigned long *); 45 unsigned long *, unsigned long *);
46extern void xor_niagara_5(unsigned long, unsigned long *, unsigned long *, 46void xor_niagara_5(unsigned long, unsigned long *, unsigned long *,
47 unsigned long *, unsigned long *, unsigned long *); 47 unsigned long *, unsigned long *, unsigned long *);
48 48
49static struct xor_block_template xor_block_niagara = { 49static struct xor_block_template xor_block_niagara = {
50 .name = "Niagara", 50 .name = "Niagara",
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index d15cc1794b0e..7cf9c6ea3f1f 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -42,7 +42,6 @@ obj-y += time_$(BITS).o
42obj-$(CONFIG_SPARC32) += windows.o 42obj-$(CONFIG_SPARC32) += windows.o
43obj-y += cpu.o 43obj-y += cpu.o
44obj-$(CONFIG_SPARC32) += devices.o 44obj-$(CONFIG_SPARC32) += devices.o
45obj-$(CONFIG_SPARC32) += tadpole.o
46obj-y += ptrace_$(BITS).o 45obj-y += ptrace_$(BITS).o
47obj-y += unaligned_$(BITS).o 46obj-y += unaligned_$(BITS).o
48obj-y += una_asm_$(BITS).o 47obj-y += una_asm_$(BITS).o
diff --git a/arch/sparc/kernel/audit.c b/arch/sparc/kernel/audit.c
index 8fff0ac63d56..24361b494a93 100644
--- a/arch/sparc/kernel/audit.c
+++ b/arch/sparc/kernel/audit.c
@@ -3,6 +3,8 @@
3#include <linux/audit.h> 3#include <linux/audit.h>
4#include <asm/unistd.h> 4#include <asm/unistd.h>
5 5
6#include "kernel.h"
7
6static unsigned dir_class[] = { 8static unsigned dir_class[] = {
7#include <asm-generic/audit_dir_write.h> 9#include <asm-generic/audit_dir_write.h>
8~0U 10~0U
@@ -40,7 +42,6 @@ int audit_classify_arch(int arch)
40int audit_classify_syscall(int abi, unsigned syscall) 42int audit_classify_syscall(int abi, unsigned syscall)
41{ 43{
42#ifdef CONFIG_COMPAT 44#ifdef CONFIG_COMPAT
43 extern int sparc32_classify_syscall(unsigned);
44 if (abi == AUDIT_ARCH_SPARC) 45 if (abi == AUDIT_ARCH_SPARC)
45 return sparc32_classify_syscall(syscall); 46 return sparc32_classify_syscall(syscall);
46#endif 47#endif
@@ -61,11 +62,6 @@ int audit_classify_syscall(int abi, unsigned syscall)
61static int __init audit_classes_init(void) 62static int __init audit_classes_init(void)
62{ 63{
63#ifdef CONFIG_COMPAT 64#ifdef CONFIG_COMPAT
64 extern __u32 sparc32_dir_class[];
65 extern __u32 sparc32_write_class[];
66 extern __u32 sparc32_read_class[];
67 extern __u32 sparc32_chattr_class[];
68 extern __u32 sparc32_signal_class[];
69 audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class); 65 audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class);
70 audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class); 66 audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class);
71 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class); 67 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class);
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
index e20cc55fb768..ae88c223e4d3 100644
--- a/arch/sparc/kernel/auxio_32.c
+++ b/arch/sparc/kernel/auxio_32.c
@@ -9,12 +9,15 @@
9#include <linux/of.h> 9#include <linux/of.h>
10#include <linux/of_device.h> 10#include <linux/of_device.h>
11#include <linux/export.h> 11#include <linux/export.h>
12
12#include <asm/oplib.h> 13#include <asm/oplib.h>
13#include <asm/io.h> 14#include <asm/io.h>
14#include <asm/auxio.h> 15#include <asm/auxio.h>
15#include <asm/string.h> /* memset(), Linux has no bzero() */ 16#include <asm/string.h> /* memset(), Linux has no bzero() */
16#include <asm/cpu_type.h> 17#include <asm/cpu_type.h>
17 18
19#include "kernel.h"
20
18/* Probe and map in the Auxiliary I/O register */ 21/* Probe and map in the Auxiliary I/O register */
19 22
20/* auxio_register is not static because it is referenced 23/* auxio_register is not static because it is referenced
@@ -103,7 +106,7 @@ EXPORT_SYMBOL(set_auxio);
103 106
104/* sun4m power control register (AUXIO2) */ 107/* sun4m power control register (AUXIO2) */
105 108
106volatile unsigned char * auxio_power_register = NULL; 109volatile u8 __iomem *auxio_power_register = NULL;
107 110
108void __init auxio_power_probe(void) 111void __init auxio_power_probe(void)
109{ 112{
@@ -127,8 +130,8 @@ void __init auxio_power_probe(void)
127 r.flags = regs.which_io & 0xF; 130 r.flags = regs.which_io & 0xF;
128 r.start = regs.phys_addr; 131 r.start = regs.phys_addr;
129 r.end = regs.phys_addr + regs.reg_size - 1; 132 r.end = regs.phys_addr + regs.reg_size - 1;
130 auxio_power_register = (unsigned char *) of_ioremap(&r, 0, 133 auxio_power_register =
131 regs.reg_size, "auxpower"); 134 (u8 __iomem *)of_ioremap(&r, 0, regs.reg_size, "auxpower");
132 135
133 /* Display a quick message on the console. */ 136 /* Display a quick message on the console. */
134 if (auxio_power_register) 137 if (auxio_power_register)
diff --git a/arch/sparc/kernel/btext.c b/arch/sparc/kernel/btext.c
index 57073e56ba9e..987f7ec497cc 100644
--- a/arch/sparc/kernel/btext.c
+++ b/arch/sparc/kernel/btext.c
@@ -137,7 +137,7 @@ static void scrollscreen(void)
137} 137}
138#endif /* ndef NO_SCROLL */ 138#endif /* ndef NO_SCROLL */
139 139
140void btext_drawchar(char c) 140static void btext_drawchar(char c)
141{ 141{
142 int cline = 0; 142 int cline = 0;
143#ifdef NO_SCROLL 143#ifdef NO_SCROLL
diff --git a/arch/sparc/kernel/compat_audit.c b/arch/sparc/kernel/compat_audit.c
index d865575b25bf..7062263d09c1 100644
--- a/arch/sparc/kernel/compat_audit.c
+++ b/arch/sparc/kernel/compat_audit.c
@@ -1,5 +1,6 @@
1#define __32bit_syscall_numbers__ 1#define __32bit_syscall_numbers__
2#include <asm/unistd.h> 2#include <asm/unistd.h>
3#include "kernel.h"
3 4
4unsigned sparc32_dir_class[] = { 5unsigned sparc32_dir_class[] = {
5#include <asm-generic/audit_dir_write.h> 6#include <asm-generic/audit_dir_write.h>
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 5c5125895db8..82a3a71c451e 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -22,6 +22,7 @@
22#include <asm/cpudata.h> 22#include <asm/cpudata.h>
23 23
24#include "kernel.h" 24#include "kernel.h"
25#include "entry.h"
25 26
26DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; 27DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
27EXPORT_PER_CPU_SYMBOL(__cpu_data); 28EXPORT_PER_CPU_SYMBOL(__cpu_data);
diff --git a/arch/sparc/kernel/cpumap.h b/arch/sparc/kernel/cpumap.h
index e639880ab864..9dac398c434a 100644
--- a/arch/sparc/kernel/cpumap.h
+++ b/arch/sparc/kernel/cpumap.h
@@ -2,8 +2,8 @@
2#define _CPUMAP_H 2#define _CPUMAP_H
3 3
4#ifdef CONFIG_SMP 4#ifdef CONFIG_SMP
5extern void cpu_map_rebuild(void); 5void cpu_map_rebuild(void);
6extern int map_to_cpu(unsigned int index); 6int map_to_cpu(unsigned int index);
7#define cpu_map_init() cpu_map_rebuild() 7#define cpu_map_init() cpu_map_rebuild()
8#else 8#else
9#define cpu_map_init() do {} while (0) 9#define cpu_map_init() do {} while (0)
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index 3d465e87f7e2..8d5d09f09caf 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -19,8 +19,9 @@
19#include <asm/smp.h> 19#include <asm/smp.h>
20#include <asm/cpudata.h> 20#include <asm/cpudata.h>
21#include <asm/cpu_type.h> 21#include <asm/cpu_type.h>
22#include <asm/setup.h>
22 23
23extern void clock_stop_probe(void); /* tadpole.c */ 24#include "kernel.h"
24 25
25static char *cpu_mid_prop(void) 26static char *cpu_mid_prop(void)
26{ 27{
@@ -131,11 +132,6 @@ void __init device_scan(void)
131 } 132 }
132#endif /* !CONFIG_SMP */ 133#endif /* !CONFIG_SMP */
133 134
134 { 135 auxio_probe();
135 extern void auxio_probe(void); 136 auxio_power_probe();
136 extern void auxio_power_probe(void);
137 auxio_probe();
138 auxio_power_probe();
139 }
140 clock_stop_probe();
141} 137}
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index 140966fbd303..ebaba6167dd4 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -6,40 +6,39 @@
6#include <linux/init.h> 6#include <linux/init.h>
7 7
8/* irq */ 8/* irq */
9extern void handler_irq(int irq, struct pt_regs *regs); 9void handler_irq(int irq, struct pt_regs *regs);
10 10
11#ifdef CONFIG_SPARC32 11#ifdef CONFIG_SPARC32
12/* traps */ 12/* traps */
13extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type); 13void do_hw_interrupt(struct pt_regs *regs, unsigned long type);
14extern void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, 14void do_illegal_instruction(struct pt_regs *regs, unsigned long pc,
15 unsigned long npc, unsigned long psr); 15 unsigned long npc, unsigned long psr);
16 16
17extern void do_priv_instruction(struct pt_regs *regs, unsigned long pc, 17void do_priv_instruction(struct pt_regs *regs, unsigned long pc,
18 unsigned long npc, unsigned long psr); 18 unsigned long npc, unsigned long psr);
19extern void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, 19void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc,
20 unsigned long npc, 20 unsigned long npc, unsigned long psr);
21 unsigned long psr); 21void do_fpd_trap(struct pt_regs *regs, unsigned long pc,
22extern void do_fpd_trap(struct pt_regs *regs, unsigned long pc, 22 unsigned long npc, unsigned long psr);
23void do_fpe_trap(struct pt_regs *regs, unsigned long pc,
24 unsigned long npc, unsigned long psr);
25void handle_tag_overflow(struct pt_regs *regs, unsigned long pc,
26 unsigned long npc, unsigned long psr);
27void handle_watchpoint(struct pt_regs *regs, unsigned long pc,
28 unsigned long npc, unsigned long psr);
29void handle_reg_access(struct pt_regs *regs, unsigned long pc,
30 unsigned long npc, unsigned long psr);
31void handle_cp_disabled(struct pt_regs *regs, unsigned long pc,
23 unsigned long npc, unsigned long psr); 32 unsigned long npc, unsigned long psr);
24extern void do_fpe_trap(struct pt_regs *regs, unsigned long pc, 33void handle_cp_exception(struct pt_regs *regs, unsigned long pc,
25 unsigned long npc, unsigned long psr); 34 unsigned long npc, unsigned long psr);
26extern void handle_tag_overflow(struct pt_regs *regs, unsigned long pc,
27 unsigned long npc, unsigned long psr);
28extern void handle_watchpoint(struct pt_regs *regs, unsigned long pc,
29 unsigned long npc, unsigned long psr);
30extern void handle_reg_access(struct pt_regs *regs, unsigned long pc,
31 unsigned long npc, unsigned long psr);
32extern void handle_cp_disabled(struct pt_regs *regs, unsigned long pc,
33 unsigned long npc, unsigned long psr);
34extern void handle_cp_exception(struct pt_regs *regs, unsigned long pc,
35 unsigned long npc, unsigned long psr);
36 35
37 36
38 37
39/* entry.S */ 38/* entry.S */
40extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 39void fpsave(unsigned long *fpregs, unsigned long *fsr,
41 void *fpqueue, unsigned long *fpqdepth); 40 void *fpqueue, unsigned long *fpqdepth);
42extern void fpload(unsigned long *fpregs, unsigned long *fsr); 41void fpload(unsigned long *fpregs, unsigned long *fsr);
43 42
44#else /* CONFIG_SPARC32 */ 43#else /* CONFIG_SPARC32 */
45 44
@@ -66,123 +65,123 @@ struct pause_patch_entry {
66extern struct pause_patch_entry __pause_3insn_patch, 65extern struct pause_patch_entry __pause_3insn_patch,
67 __pause_3insn_patch_end; 66 __pause_3insn_patch_end;
68 67
69extern void __init per_cpu_patch(void); 68void __init per_cpu_patch(void);
70extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, 69void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *,
71 struct sun4v_1insn_patch_entry *); 70 struct sun4v_1insn_patch_entry *);
72extern void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, 71void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *,
73 struct sun4v_2insn_patch_entry *); 72 struct sun4v_2insn_patch_entry *);
74extern void __init sun4v_patch(void); 73void __init sun4v_patch(void);
75extern void __init boot_cpu_id_too_large(int cpu); 74void __init boot_cpu_id_too_large(int cpu);
76extern unsigned int dcache_parity_tl1_occurred; 75extern unsigned int dcache_parity_tl1_occurred;
77extern unsigned int icache_parity_tl1_occurred; 76extern unsigned int icache_parity_tl1_occurred;
78 77
79extern asmlinkage void sparc_breakpoint(struct pt_regs *regs); 78asmlinkage void sparc_breakpoint(struct pt_regs *regs);
80extern void timer_interrupt(int irq, struct pt_regs *regs); 79void timer_interrupt(int irq, struct pt_regs *regs);
81 80
82extern void do_notify_resume(struct pt_regs *regs, 81void do_notify_resume(struct pt_regs *regs,
83 unsigned long orig_i0, 82 unsigned long orig_i0,
84 unsigned long thread_info_flags); 83 unsigned long thread_info_flags);
85 84
86extern asmlinkage int syscall_trace_enter(struct pt_regs *regs); 85asmlinkage int syscall_trace_enter(struct pt_regs *regs);
87extern asmlinkage void syscall_trace_leave(struct pt_regs *regs); 86asmlinkage void syscall_trace_leave(struct pt_regs *regs);
88 87
89extern void bad_trap_tl1(struct pt_regs *regs, long lvl); 88void bad_trap_tl1(struct pt_regs *regs, long lvl);
90 89
91extern void do_fpieee(struct pt_regs *regs); 90void do_fpieee(struct pt_regs *regs);
92extern void do_fpother(struct pt_regs *regs); 91void do_fpother(struct pt_regs *regs);
93extern void do_tof(struct pt_regs *regs); 92void do_tof(struct pt_regs *regs);
94extern void do_div0(struct pt_regs *regs); 93void do_div0(struct pt_regs *regs);
95extern void do_illegal_instruction(struct pt_regs *regs); 94void do_illegal_instruction(struct pt_regs *regs);
96extern void mem_address_unaligned(struct pt_regs *regs, 95void mem_address_unaligned(struct pt_regs *regs,
97 unsigned long sfar, 96 unsigned long sfar,
98 unsigned long sfsr); 97 unsigned long sfsr);
99extern void sun4v_do_mna(struct pt_regs *regs, 98void sun4v_do_mna(struct pt_regs *regs,
100 unsigned long addr, 99 unsigned long addr,
101 unsigned long type_ctx); 100 unsigned long type_ctx);
102extern void do_privop(struct pt_regs *regs); 101void do_privop(struct pt_regs *regs);
103extern void do_privact(struct pt_regs *regs); 102void do_privact(struct pt_regs *regs);
104extern void do_cee(struct pt_regs *regs); 103void do_cee(struct pt_regs *regs);
105extern void do_cee_tl1(struct pt_regs *regs); 104void do_cee_tl1(struct pt_regs *regs);
106extern void do_dae_tl1(struct pt_regs *regs); 105void do_dae_tl1(struct pt_regs *regs);
107extern void do_iae_tl1(struct pt_regs *regs); 106void do_iae_tl1(struct pt_regs *regs);
108extern void do_div0_tl1(struct pt_regs *regs); 107void do_div0_tl1(struct pt_regs *regs);
109extern void do_fpdis_tl1(struct pt_regs *regs); 108void do_fpdis_tl1(struct pt_regs *regs);
110extern void do_fpieee_tl1(struct pt_regs *regs); 109void do_fpieee_tl1(struct pt_regs *regs);
111extern void do_fpother_tl1(struct pt_regs *regs); 110void do_fpother_tl1(struct pt_regs *regs);
112extern void do_ill_tl1(struct pt_regs *regs); 111void do_ill_tl1(struct pt_regs *regs);
113extern void do_irq_tl1(struct pt_regs *regs); 112void do_irq_tl1(struct pt_regs *regs);
114extern void do_lddfmna_tl1(struct pt_regs *regs); 113void do_lddfmna_tl1(struct pt_regs *regs);
115extern void do_stdfmna_tl1(struct pt_regs *regs); 114void do_stdfmna_tl1(struct pt_regs *regs);
116extern void do_paw(struct pt_regs *regs); 115void do_paw(struct pt_regs *regs);
117extern void do_paw_tl1(struct pt_regs *regs); 116void do_paw_tl1(struct pt_regs *regs);
118extern void do_vaw(struct pt_regs *regs); 117void do_vaw(struct pt_regs *regs);
119extern void do_vaw_tl1(struct pt_regs *regs); 118void do_vaw_tl1(struct pt_regs *regs);
120extern void do_tof_tl1(struct pt_regs *regs); 119void do_tof_tl1(struct pt_regs *regs);
121extern void do_getpsr(struct pt_regs *regs); 120void do_getpsr(struct pt_regs *regs);
122 121
123extern void spitfire_insn_access_exception(struct pt_regs *regs, 122void spitfire_insn_access_exception(struct pt_regs *regs,
124 unsigned long sfsr, 123 unsigned long sfsr,
125 unsigned long sfar); 124 unsigned long sfar);
126extern void spitfire_insn_access_exception_tl1(struct pt_regs *regs, 125void spitfire_insn_access_exception_tl1(struct pt_regs *regs,
127 unsigned long sfsr, 126 unsigned long sfsr,
128 unsigned long sfar); 127 unsigned long sfar);
129extern void spitfire_data_access_exception(struct pt_regs *regs, 128void spitfire_data_access_exception(struct pt_regs *regs,
130 unsigned long sfsr, 129 unsigned long sfsr,
131 unsigned long sfar); 130 unsigned long sfar);
132extern void spitfire_data_access_exception_tl1(struct pt_regs *regs, 131void spitfire_data_access_exception_tl1(struct pt_regs *regs,
133 unsigned long sfsr, 132 unsigned long sfsr,
134 unsigned long sfar); 133 unsigned long sfar);
135extern void spitfire_access_error(struct pt_regs *regs, 134void spitfire_access_error(struct pt_regs *regs,
136 unsigned long status_encoded, 135 unsigned long status_encoded,
137 unsigned long afar); 136 unsigned long afar);
138 137
139extern void cheetah_fecc_handler(struct pt_regs *regs, 138void cheetah_fecc_handler(struct pt_regs *regs,
140 unsigned long afsr, 139 unsigned long afsr,
141 unsigned long afar); 140 unsigned long afar);
142extern void cheetah_cee_handler(struct pt_regs *regs, 141void cheetah_cee_handler(struct pt_regs *regs,
143 unsigned long afsr, 142 unsigned long afsr,
144 unsigned long afar); 143 unsigned long afar);
145extern void cheetah_deferred_handler(struct pt_regs *regs, 144void cheetah_deferred_handler(struct pt_regs *regs,
146 unsigned long afsr, 145 unsigned long afsr,
147 unsigned long afar); 146 unsigned long afar);
148extern void cheetah_plus_parity_error(int type, struct pt_regs *regs); 147void cheetah_plus_parity_error(int type, struct pt_regs *regs);
149 148
150extern void sun4v_insn_access_exception(struct pt_regs *regs, 149void sun4v_insn_access_exception(struct pt_regs *regs,
151 unsigned long addr, 150 unsigned long addr,
152 unsigned long type_ctx); 151 unsigned long type_ctx);
153extern void sun4v_insn_access_exception_tl1(struct pt_regs *regs, 152void sun4v_insn_access_exception_tl1(struct pt_regs *regs,
154 unsigned long addr, 153 unsigned long addr,
155 unsigned long type_ctx); 154 unsigned long type_ctx);
156extern void sun4v_data_access_exception(struct pt_regs *regs, 155void sun4v_data_access_exception(struct pt_regs *regs,
157 unsigned long addr, 156 unsigned long addr,
158 unsigned long type_ctx); 157 unsigned long type_ctx);
159extern void sun4v_data_access_exception_tl1(struct pt_regs *regs, 158void sun4v_data_access_exception_tl1(struct pt_regs *regs,
160 unsigned long addr, 159 unsigned long addr,
161 unsigned long type_ctx); 160 unsigned long type_ctx);
162extern void sun4v_resum_error(struct pt_regs *regs, 161void sun4v_resum_error(struct pt_regs *regs,
163 unsigned long offset); 162 unsigned long offset);
164extern void sun4v_resum_overflow(struct pt_regs *regs); 163void sun4v_resum_overflow(struct pt_regs *regs);
165extern void sun4v_nonresum_error(struct pt_regs *regs, 164void sun4v_nonresum_error(struct pt_regs *regs,
166 unsigned long offset); 165 unsigned long offset);
167extern void sun4v_nonresum_overflow(struct pt_regs *regs); 166void sun4v_nonresum_overflow(struct pt_regs *regs);
168 167
169extern unsigned long sun4v_err_itlb_vaddr; 168extern unsigned long sun4v_err_itlb_vaddr;
170extern unsigned long sun4v_err_itlb_ctx; 169extern unsigned long sun4v_err_itlb_ctx;
171extern unsigned long sun4v_err_itlb_pte; 170extern unsigned long sun4v_err_itlb_pte;
172extern unsigned long sun4v_err_itlb_error; 171extern unsigned long sun4v_err_itlb_error;
173 172
174extern void sun4v_itlb_error_report(struct pt_regs *regs, int tl); 173void sun4v_itlb_error_report(struct pt_regs *regs, int tl);
175 174
176extern unsigned long sun4v_err_dtlb_vaddr; 175extern unsigned long sun4v_err_dtlb_vaddr;
177extern unsigned long sun4v_err_dtlb_ctx; 176extern unsigned long sun4v_err_dtlb_ctx;
178extern unsigned long sun4v_err_dtlb_pte; 177extern unsigned long sun4v_err_dtlb_pte;
179extern unsigned long sun4v_err_dtlb_error; 178extern unsigned long sun4v_err_dtlb_error;
180 179
181extern void sun4v_dtlb_error_report(struct pt_regs *regs, int tl); 180void sun4v_dtlb_error_report(struct pt_regs *regs, int tl);
182extern void hypervisor_tlbop_error(unsigned long err, 181void hypervisor_tlbop_error(unsigned long err,
183 unsigned long op); 182 unsigned long op);
184extern void hypervisor_tlbop_error_xcall(unsigned long err, 183void hypervisor_tlbop_error_xcall(unsigned long err,
185 unsigned long op); 184 unsigned long op);
186 185
187/* WARNING: The error trap handlers in assembly know the precise 186/* WARNING: The error trap handlers in assembly know the precise
188 * layout of the following structure. 187 * layout of the following structure.
@@ -248,8 +247,8 @@ struct ino_bucket {
248extern struct ino_bucket *ivector_table; 247extern struct ino_bucket *ivector_table;
249extern unsigned long ivector_table_pa; 248extern unsigned long ivector_table_pa;
250 249
251extern void init_irqwork_curcpu(void); 250void init_irqwork_curcpu(void);
252extern void sun4v_register_mondo_queues(int this_cpu); 251void sun4v_register_mondo_queues(int this_cpu);
253 252
254#endif /* CONFIG_SPARC32 */ 253#endif /* CONFIG_SPARC32 */
255#endif /* _ENTRY_H */ 254#endif /* _ENTRY_H */
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 76663b019eb5..bfa4d0c2df42 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -21,6 +21,7 @@
21#include <asm/iommu.h> 21#include <asm/iommu.h>
22 22
23#include "iommu_common.h" 23#include "iommu_common.h"
24#include "kernel.h"
24 25
25#define STC_CTXMATCH_ADDR(STC, CTX) \ 26#define STC_CTXMATCH_ADDR(STC, CTX) \
26 ((STC)->strbuf_ctxmatch_base + ((CTX) << 3)) 27 ((STC)->strbuf_ctxmatch_base + ((CTX) << 3))
@@ -840,8 +841,6 @@ static struct dma_map_ops sun4u_dma_ops = {
840struct dma_map_ops *dma_ops = &sun4u_dma_ops; 841struct dma_map_ops *dma_ops = &sun4u_dma_ops;
841EXPORT_SYMBOL(dma_ops); 842EXPORT_SYMBOL(dma_ops);
842 843
843extern int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask);
844
845int dma_supported(struct device *dev, u64 device_mask) 844int dma_supported(struct device *dev, u64 device_mask)
846{ 845{
847 struct iommu *iommu = dev->archdata.iommu; 846 struct iommu *iommu = dev->archdata.iommu;
diff --git a/arch/sparc/kernel/iommu_common.h b/arch/sparc/kernel/iommu_common.h
index 591f5879039c..1ec0de4156e7 100644
--- a/arch/sparc/kernel/iommu_common.h
+++ b/arch/sparc/kernel/iommu_common.h
@@ -48,12 +48,12 @@ static inline int is_span_boundary(unsigned long entry,
48 return iommu_is_span_boundary(entry, nr, shift, boundary_size); 48 return iommu_is_span_boundary(entry, nr, shift, boundary_size);
49} 49}
50 50
51extern unsigned long iommu_range_alloc(struct device *dev, 51unsigned long iommu_range_alloc(struct device *dev,
52 struct iommu *iommu, 52 struct iommu *iommu,
53 unsigned long npages, 53 unsigned long npages,
54 unsigned long *handle); 54 unsigned long *handle);
55extern void iommu_range_free(struct iommu *iommu, 55void iommu_range_free(struct iommu *iommu,
56 dma_addr_t dma_addr, 56 dma_addr_t dma_addr,
57 unsigned long npages); 57 unsigned long npages);
58 58
59#endif /* _IOMMU_COMMON_H */ 59#endif /* _IOMMU_COMMON_H */
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index e7e215dfa866..7f08ec8a7c68 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -186,7 +186,7 @@ static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
186 186
187 if (name == NULL) name = "???"; 187 if (name == NULL) name = "???";
188 188
189 if ((xres = xres_alloc()) != 0) { 189 if ((xres = xres_alloc()) != NULL) {
190 tack = xres->xname; 190 tack = xres->xname;
191 res = &xres->xres; 191 res = &xres->xres;
192 } else { 192 } else {
@@ -400,7 +400,7 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
400 BUG(); 400 BUG();
401} 401}
402 402
403struct dma_map_ops sbus_dma_ops = { 403static struct dma_map_ops sbus_dma_ops = {
404 .alloc = sbus_alloc_coherent, 404 .alloc = sbus_alloc_coherent,
405 .free = sbus_free_coherent, 405 .free = sbus_free_coherent,
406 .map_page = sbus_map_page, 406 .map_page = sbus_map_page,
@@ -681,7 +681,7 @@ static int sparc_io_proc_show(struct seq_file *m, void *v)
681 const char *nm; 681 const char *nm;
682 682
683 for (r = root->child; r != NULL; r = r->sibling) { 683 for (r = root->child; r != NULL; r = r->sibling) {
684 if ((nm = r->name) == 0) nm = "???"; 684 if ((nm = r->name) == NULL) nm = "???";
685 seq_printf(m, "%016llx-%016llx: %s\n", 685 seq_printf(m, "%016llx-%016llx: %s\n",
686 (unsigned long long)r->start, 686 (unsigned long long)r->start,
687 (unsigned long long)r->end, nm); 687 (unsigned long long)r->end, nm);
diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h
index b66b6aad1d6d..70a0b8ddd0ba 100644
--- a/arch/sparc/kernel/irq.h
+++ b/arch/sparc/kernel/irq.h
@@ -82,11 +82,20 @@ void handler_irq(unsigned int pil, struct pt_regs *regs);
82 82
83unsigned long leon_get_irqmask(unsigned int irq); 83unsigned long leon_get_irqmask(unsigned int irq);
84 84
85/* irq_32.c */
86void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs);
87
88/* sun4m_irq.c */
89void sun4m_nmi(struct pt_regs *regs);
90
91/* sun4d_irq.c */
92void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs);
93
85#ifdef CONFIG_SMP 94#ifdef CONFIG_SMP
86 95
87/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ 96/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */
88#define SUN4D_IPI_IRQ 13 97#define SUN4D_IPI_IRQ 13
89 98
90extern void sun4d_ipi_interrupt(void); 99void sun4d_ipi_interrupt(void);
91 100
92#endif 101#endif
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index c145f6fd123b..a979e99f8751 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -17,6 +17,7 @@
17 17
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/cpudata.h> 19#include <asm/cpudata.h>
20#include <asm/setup.h>
20#include <asm/pcic.h> 21#include <asm/pcic.h>
21#include <asm/leon.h> 22#include <asm/leon.h>
22 23
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
index a702d9ab019c..e7f652be9e61 100644
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -2,6 +2,7 @@
2#define __SPARC_KERNEL_H 2#define __SPARC_KERNEL_H
3 3
4#include <linux/interrupt.h> 4#include <linux/interrupt.h>
5#include <linux/ftrace.h>
5 6
6#include <asm/traps.h> 7#include <asm/traps.h>
7#include <asm/head.h> 8#include <asm/head.h>
@@ -15,62 +16,111 @@ extern int ncpus_probed;
15#ifdef CONFIG_SPARC64 16#ifdef CONFIG_SPARC64
16/* setup_64.c */ 17/* setup_64.c */
17struct seq_file; 18struct seq_file;
18extern void cpucap_info(struct seq_file *); 19void cpucap_info(struct seq_file *);
19 20
20static inline unsigned long kimage_addr_to_ra(const char *p) 21static inline unsigned long kimage_addr_to_ra(const void *p)
21{ 22{
22 unsigned long val = (unsigned long) p; 23 unsigned long val = (unsigned long) p;
23 24
24 return kern_base + (val - KERNBASE); 25 return kern_base + (val - KERNBASE);
25} 26}
27
28/* sys_sparc_64.c */
29asmlinkage long sys_kern_features(void);
30
31/* unaligned_64.c */
32asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
33int handle_popc(u32 insn, struct pt_regs *regs);
34void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr);
35void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr);
36
37/* smp_64.c */
38void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs);
39void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs);
40void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs);
41void __irq_entry smp_penguin_jailcell(int irq, struct pt_regs *regs);
42void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs);
43
44/* kgdb_64.c */
45void __irq_entry smp_kgdb_capture_client(int irq, struct pt_regs *regs);
46
47/* pci.c */
48int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask);
49
50/* signal32.c */
51void do_sigreturn32(struct pt_regs *regs);
52asmlinkage void do_rt_sigreturn32(struct pt_regs *regs);
53void do_signal32(struct pt_regs * regs);
54asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp);
55
56/* compat_audit.c */
57extern unsigned sparc32_dir_class[];
58extern unsigned sparc32_chattr_class[];
59extern unsigned sparc32_write_class[];
60extern unsigned sparc32_read_class[];
61extern unsigned sparc32_signal_class[];
62int sparc32_classify_syscall(unsigned syscall);
26#endif 63#endif
27 64
28#ifdef CONFIG_SPARC32 65#ifdef CONFIG_SPARC32
29/* setup_32.c */ 66/* setup_32.c */
67struct linux_romvec;
30void sparc32_start_kernel(struct linux_romvec *rp); 68void sparc32_start_kernel(struct linux_romvec *rp);
31 69
32/* cpu.c */ 70/* cpu.c */
33extern void cpu_probe(void); 71void cpu_probe(void);
34 72
35/* traps_32.c */ 73/* traps_32.c */
36extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, 74void handle_hw_divzero(struct pt_regs *regs, unsigned long pc,
37 unsigned long npc, unsigned long psr); 75 unsigned long npc, unsigned long psr);
38/* irq_32.c */ 76/* irq_32.c */
39extern struct irqaction static_irqaction[]; 77extern struct irqaction static_irqaction[];
40extern int static_irq_count; 78extern int static_irq_count;
41extern spinlock_t irq_action_lock; 79extern spinlock_t irq_action_lock;
42 80
43extern void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); 81void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs);
44extern void init_IRQ(void); 82void init_IRQ(void);
45 83
46/* sun4m_irq.c */ 84/* sun4m_irq.c */
47extern void sun4m_init_IRQ(void); 85void sun4m_init_IRQ(void);
48extern void sun4m_unmask_profile_irq(void); 86void sun4m_unmask_profile_irq(void);
49extern void sun4m_clear_profile_irq(int cpu); 87void sun4m_clear_profile_irq(int cpu);
50 88
51/* sun4m_smp.c */ 89/* sun4m_smp.c */
52void sun4m_cpu_pre_starting(void *arg); 90void sun4m_cpu_pre_starting(void *arg);
53void sun4m_cpu_pre_online(void *arg); 91void sun4m_cpu_pre_online(void *arg);
92void __init smp4m_boot_cpus(void);
93int smp4m_boot_one_cpu(int i, struct task_struct *idle);
94void __init smp4m_smp_done(void);
95void smp4m_cross_call_irq(void);
96void smp4m_percpu_timer_interrupt(struct pt_regs *regs);
54 97
55/* sun4d_irq.c */ 98/* sun4d_irq.c */
56extern spinlock_t sun4d_imsk_lock; 99extern spinlock_t sun4d_imsk_lock;
57 100
58extern void sun4d_init_IRQ(void); 101void sun4d_init_IRQ(void);
59extern int sun4d_request_irq(unsigned int irq, 102int sun4d_request_irq(unsigned int irq,
60 irq_handler_t handler, 103 irq_handler_t handler,
61 unsigned long irqflags, 104 unsigned long irqflags,
62 const char *devname, void *dev_id); 105 const char *devname, void *dev_id);
63extern int show_sun4d_interrupts(struct seq_file *, void *); 106int show_sun4d_interrupts(struct seq_file *, void *);
64extern void sun4d_distribute_irqs(void); 107void sun4d_distribute_irqs(void);
65extern void sun4d_free_irq(unsigned int irq, void *dev_id); 108void sun4d_free_irq(unsigned int irq, void *dev_id);
66 109
67/* sun4d_smp.c */ 110/* sun4d_smp.c */
68void sun4d_cpu_pre_starting(void *arg); 111void sun4d_cpu_pre_starting(void *arg);
69void sun4d_cpu_pre_online(void *arg); 112void sun4d_cpu_pre_online(void *arg);
113void __init smp4d_boot_cpus(void);
114int smp4d_boot_one_cpu(int i, struct task_struct *idle);
115void __init smp4d_smp_done(void);
116void smp4d_cross_call_irq(void);
117void smp4d_percpu_timer_interrupt(struct pt_regs *regs);
70 118
71/* leon_smp.c */ 119/* leon_smp.c */
72void leon_cpu_pre_starting(void *arg); 120void leon_cpu_pre_starting(void *arg);
73void leon_cpu_pre_online(void *arg); 121void leon_cpu_pre_online(void *arg);
122void leonsmp_ipi_interrupt(void);
123void leon_cross_call_irq(void);
74 124
75/* head_32.S */ 125/* head_32.S */
76extern unsigned int t_nmi[]; 126extern unsigned int t_nmi[];
@@ -89,12 +139,48 @@ extern unsigned int real_irq_entry[];
89extern unsigned int smp4d_ticker[]; 139extern unsigned int smp4d_ticker[];
90extern unsigned int patchme_maybe_smp_msg[]; 140extern unsigned int patchme_maybe_smp_msg[];
91 141
92extern void floppy_hardint(void); 142void floppy_hardint(void);
93 143
94/* trampoline_32.S */ 144/* trampoline_32.S */
95extern unsigned long sun4m_cpu_startup; 145extern unsigned long sun4m_cpu_startup;
96extern unsigned long sun4d_cpu_startup; 146extern unsigned long sun4d_cpu_startup;
97 147
148/* process_32.c */
149asmlinkage int sparc_do_fork(unsigned long clone_flags,
150 unsigned long stack_start,
151 struct pt_regs *regs,
152 unsigned long stack_size);
153
154/* signal_32.c */
155asmlinkage void do_sigreturn(struct pt_regs *regs);
156asmlinkage void do_rt_sigreturn(struct pt_regs *regs);
157void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
158 unsigned long thread_info_flags);
159asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr,
160 struct sigstack __user *ossptr,
161 unsigned long sp);
162
163/* ptrace_32.c */
164asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p);
165
166/* unaligned_32.c */
167asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
168asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn);
169
170/* windows.c */
171void try_to_clear_window_buffer(struct pt_regs *regs, int who);
172
173/* auxio_32.c */
174void __init auxio_probe(void);
175void __init auxio_power_probe(void);
176
177/* pcic.c */
178extern void __iomem *pcic_regs;
179void pcic_nmi(unsigned int pend, struct pt_regs *regs);
180
181/* time_32.c */
182void __init time_init(void);
183
98#else /* CONFIG_SPARC32 */ 184#else /* CONFIG_SPARC32 */
99#endif /* CONFIG_SPARC32 */ 185#endif /* CONFIG_SPARC32 */
100#endif /* !(__SPARC_KERNEL_H) */ 186#endif /* !(__SPARC_KERNEL_H) */
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c
index b45fe3fb4d2c..cbf21d0870e0 100644
--- a/arch/sparc/kernel/kgdb_64.c
+++ b/arch/sparc/kernel/kgdb_64.c
@@ -13,6 +13,8 @@
13#include <asm/ptrace.h> 13#include <asm/ptrace.h>
14#include <asm/irq.h> 14#include <asm/irq.h>
15 15
16#include "kernel.h"
17
16void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 18void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
17{ 19{
18 struct reg_window *win; 20 struct reg_window *win;
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 1b0973503197..98d712843413 100644
--- a/arch/sparc/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
@@ -512,7 +512,8 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
512/* 512/*
513 * Called when the probe at kretprobe trampoline is hit 513 * Called when the probe at kretprobe trampoline is hit
514 */ 514 */
515int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 515static int __kprobes trampoline_probe_handler(struct kprobe *p,
516 struct pt_regs *regs)
516{ 517{
517 struct kretprobe_instance *ri = NULL; 518 struct kretprobe_instance *ri = NULL;
518 struct hlist_head *head, empty_rp; 519 struct hlist_head *head, empty_rp;
@@ -576,7 +577,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
576 return 1; 577 return 1;
577} 578}
578 579
579void kretprobe_trampoline_holder(void) 580static void __used kretprobe_trampoline_holder(void)
580{ 581{
581 asm volatile(".global kretprobe_trampoline\n" 582 asm volatile(".global kretprobe_trampoline\n"
582 "kretprobe_trampoline:\n" 583 "kretprobe_trampoline:\n"
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index b7c68976cbc7..683c4af999de 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -32,12 +32,12 @@ struct leon3_gptimer_regs_map *leon3_gptimer_regs; /* timer controller base addr
32 32
33int leondebug_irq_disable; 33int leondebug_irq_disable;
34int leon_debug_irqout; 34int leon_debug_irqout;
35static int dummy_master_l10_counter; 35static volatile u32 dummy_master_l10_counter;
36unsigned long amba_system_id; 36unsigned long amba_system_id;
37static DEFINE_SPINLOCK(leon_irq_lock); 37static DEFINE_SPINLOCK(leon_irq_lock);
38 38
39static unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
39unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ 40unsigned long leon3_gptimer_irq; /* interrupt controller irq number */
40unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
41unsigned int sparc_leon_eirq; 41unsigned int sparc_leon_eirq;
42#define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu]) 42#define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu])
43#define LEON_IACK (&leon3_irqctrl_regs->iclear) 43#define LEON_IACK (&leon3_irqctrl_regs->iclear)
@@ -65,7 +65,7 @@ static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)
65} 65}
66 66
67/* The extended IRQ controller has been found, this function registers it */ 67/* The extended IRQ controller has been found, this function registers it */
68void leon_eirq_setup(unsigned int eirq) 68static void leon_eirq_setup(unsigned int eirq)
69{ 69{
70 unsigned long mask, oldmask; 70 unsigned long mask, oldmask;
71 unsigned int veirq; 71 unsigned int veirq;
@@ -270,7 +270,7 @@ static u32 leon_cycles_offset(void)
270#ifdef CONFIG_SMP 270#ifdef CONFIG_SMP
271 271
272/* smp clockevent irq */ 272/* smp clockevent irq */
273irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused) 273static irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused)
274{ 274{
275 struct clock_event_device *ce; 275 struct clock_event_device *ce;
276 int cpu = smp_processor_id(); 276 int cpu = smp_processor_id();
@@ -313,7 +313,7 @@ void __init leon_init_timers(void)
313 313
314 leondebug_irq_disable = 0; 314 leondebug_irq_disable = 0;
315 leon_debug_irqout = 0; 315 leon_debug_irqout = 0;
316 master_l10_counter = (unsigned int *)&dummy_master_l10_counter; 316 master_l10_counter = (u32 __iomem *)&dummy_master_l10_counter;
317 dummy_master_l10_counter = 0; 317 dummy_master_l10_counter = 0;
318 318
319 rootnp = of_find_node_by_path("/ambapp0"); 319 rootnp = of_find_node_by_path("/ambapp0");
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index e16c4157e1ae..899b7203a4e4 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -98,82 +98,3 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
98{ 98{
99 return res->start; 99 return res->start;
100} 100}
101
102/* in/out routines taken from pcic.c
103 *
104 * This probably belongs here rather than ioport.c because
105 * we do not want this crud linked into SBus kernels.
106 * Also, think for a moment about likes of floppy.c that
107 * include architecture specific parts. They may want to redefine ins/outs.
108 *
109 * We do not use horrible macros here because we want to
110 * advance pointer by sizeof(size).
111 */
112void outsb(unsigned long addr, const void *src, unsigned long count)
113{
114 while (count) {
115 count -= 1;
116 outb(*(const char *)src, addr);
117 src += 1;
118 /* addr += 1; */
119 }
120}
121EXPORT_SYMBOL(outsb);
122
123void outsw(unsigned long addr, const void *src, unsigned long count)
124{
125 while (count) {
126 count -= 2;
127 outw(*(const short *)src, addr);
128 src += 2;
129 /* addr += 2; */
130 }
131}
132EXPORT_SYMBOL(outsw);
133
134void outsl(unsigned long addr, const void *src, unsigned long count)
135{
136 while (count) {
137 count -= 4;
138 outl(*(const long *)src, addr);
139 src += 4;
140 /* addr += 4; */
141 }
142}
143EXPORT_SYMBOL(outsl);
144
145void insb(unsigned long addr, void *dst, unsigned long count)
146{
147 while (count) {
148 count -= 1;
149 *(unsigned char *)dst = inb(addr);
150 dst += 1;
151 /* addr += 1; */
152 }
153}
154EXPORT_SYMBOL(insb);
155
156void insw(unsigned long addr, void *dst, unsigned long count)
157{
158 while (count) {
159 count -= 2;
160 *(unsigned short *)dst = inw(addr);
161 dst += 2;
162 /* addr += 2; */
163 }
164}
165EXPORT_SYMBOL(insw);
166
167void insl(unsigned long addr, void *dst, unsigned long count)
168{
169 while (count) {
170 count -= 4;
171 /*
172 * XXX I am sure we are in for an unaligned trap here.
173 */
174 *(unsigned long *)dst = inl(addr);
175 dst += 4;
176 /* addr += 4; */
177 }
178}
179EXPORT_SYMBOL(insl);
diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c
index 6df26e37f879..c8bf26edfa7c 100644
--- a/arch/sparc/kernel/leon_pci_grpci1.c
+++ b/arch/sparc/kernel/leon_pci_grpci1.c
@@ -80,7 +80,7 @@ struct grpci1_regs {
80 80
81struct grpci1_priv { 81struct grpci1_priv {
82 struct leon_pci_info info; /* must be on top of this structure */ 82 struct leon_pci_info info; /* must be on top of this structure */
83 struct grpci1_regs *regs; /* GRPCI register map */ 83 struct grpci1_regs __iomem *regs; /* GRPCI register map */
84 struct device *dev; 84 struct device *dev;
85 int pci_err_mask; /* STATUS register error mask */ 85 int pci_err_mask; /* STATUS register error mask */
86 int irq; /* LEON irqctrl GRPCI IRQ */ 86 int irq; /* LEON irqctrl GRPCI IRQ */
@@ -101,7 +101,7 @@ static struct grpci1_priv *grpci1priv;
101static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus, 101static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus,
102 unsigned int devfn, int where, u32 val); 102 unsigned int devfn, int where, u32 val);
103 103
104int grpci1_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 104static int grpci1_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
105{ 105{
106 struct grpci1_priv *priv = dev->bus->sysdata; 106 struct grpci1_priv *priv = dev->bus->sysdata;
107 int irq_group; 107 int irq_group;
@@ -144,7 +144,7 @@ static int grpci1_cfg_r32(struct grpci1_priv *priv, unsigned int bus,
144 grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp); 144 grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp);
145 } else { 145 } else {
146 /* Bus always little endian (unaffected by byte-swapping) */ 146 /* Bus always little endian (unaffected by byte-swapping) */
147 *val = flip_dword(tmp); 147 *val = swab32(tmp);
148 } 148 }
149 149
150 return 0; 150 return 0;
@@ -197,7 +197,7 @@ static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus,
197 197
198 pci_conf = (unsigned int *) (priv->pci_conf | 198 pci_conf = (unsigned int *) (priv->pci_conf |
199 (devfn << 8) | (where & 0xfc)); 199 (devfn << 8) | (where & 0xfc));
200 LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); 200 LEON3_BYPASS_STORE_PA(pci_conf, swab32(val));
201 201
202 return 0; 202 return 0;
203} 203}
@@ -417,10 +417,10 @@ out:
417 * BAR1: peripheral DMA to host's memory (size at least 256MByte) 417 * BAR1: peripheral DMA to host's memory (size at least 256MByte)
418 * BAR2..BAR5: not implemented in hardware 418 * BAR2..BAR5: not implemented in hardware
419 */ 419 */
420void grpci1_hw_init(struct grpci1_priv *priv) 420static void grpci1_hw_init(struct grpci1_priv *priv)
421{ 421{
422 u32 ahbadr, bar_sz, data, pciadr; 422 u32 ahbadr, bar_sz, data, pciadr;
423 struct grpci1_regs *regs = priv->regs; 423 struct grpci1_regs __iomem *regs = priv->regs;
424 424
425 /* set 1:1 mapping between AHB -> PCI memory space */ 425 /* set 1:1 mapping between AHB -> PCI memory space */
426 REGSTORE(regs->cfg_stat, priv->pci_area & 0xf0000000); 426 REGSTORE(regs->cfg_stat, priv->pci_area & 0xf0000000);
@@ -509,7 +509,7 @@ static irqreturn_t grpci1_err_interrupt(int irq, void *arg)
509 509
510static int grpci1_of_probe(struct platform_device *ofdev) 510static int grpci1_of_probe(struct platform_device *ofdev)
511{ 511{
512 struct grpci1_regs *regs; 512 struct grpci1_regs __iomem *regs;
513 struct grpci1_priv *priv; 513 struct grpci1_priv *priv;
514 int err, len; 514 int err, len;
515 const int *tmp; 515 const int *tmp;
@@ -690,7 +690,7 @@ err3:
690err2: 690err2:
691 release_resource(&priv->info.mem_space); 691 release_resource(&priv->info.mem_space);
692err1: 692err1:
693 iounmap((void *)priv->pci_io_va); 693 iounmap((void __iomem *)priv->pci_io_va);
694 grpci1priv = NULL; 694 grpci1priv = NULL;
695 return err; 695 return err;
696} 696}
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c
index 24d6a4446349..e433a4d69fe0 100644
--- a/arch/sparc/kernel/leon_pci_grpci2.c
+++ b/arch/sparc/kernel/leon_pci_grpci2.c
@@ -191,7 +191,7 @@ struct grpci2_cap_first {
191 191
192struct grpci2_priv { 192struct grpci2_priv {
193 struct leon_pci_info info; /* must be on top of this structure */ 193 struct leon_pci_info info; /* must be on top of this structure */
194 struct grpci2_regs *regs; 194 struct grpci2_regs __iomem *regs;
195 char irq; 195 char irq;
196 char irq_mode; /* IRQ Mode from CAPSTS REG */ 196 char irq_mode; /* IRQ Mode from CAPSTS REG */
197 char bt_enabled; 197 char bt_enabled;
@@ -215,10 +215,10 @@ struct grpci2_priv {
215 struct grpci2_barcfg tgtbars[6]; 215 struct grpci2_barcfg tgtbars[6];
216}; 216};
217 217
218DEFINE_SPINLOCK(grpci2_dev_lock); 218static DEFINE_SPINLOCK(grpci2_dev_lock);
219struct grpci2_priv *grpci2priv; 219static struct grpci2_priv *grpci2priv;
220 220
221int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 221static int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
222{ 222{
223 struct grpci2_priv *priv = dev->bus->sysdata; 223 struct grpci2_priv *priv = dev->bus->sysdata;
224 int irq_group; 224 int irq_group;
@@ -270,7 +270,7 @@ static int grpci2_cfg_r32(struct grpci2_priv *priv, unsigned int bus,
270 *val = 0xffffffff; 270 *val = 0xffffffff;
271 } else { 271 } else {
272 /* Bus always little endian (unaffected by byte-swapping) */ 272 /* Bus always little endian (unaffected by byte-swapping) */
273 *val = flip_dword(tmp); 273 *val = swab32(tmp);
274 } 274 }
275 275
276 return 0; 276 return 0;
@@ -328,7 +328,7 @@ static int grpci2_cfg_w32(struct grpci2_priv *priv, unsigned int bus,
328 328
329 pci_conf = (unsigned int *) (priv->pci_conf | 329 pci_conf = (unsigned int *) (priv->pci_conf |
330 (devfn << 8) | (where & 0xfc)); 330 (devfn << 8) | (where & 0xfc));
331 LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); 331 LEON3_BYPASS_STORE_PA(pci_conf, swab32(val));
332 332
333 /* Wait until GRPCI2 signals that CFG access is done, it should be 333 /* Wait until GRPCI2 signals that CFG access is done, it should be
334 * done instantaneously unless a DMA operation is ongoing... 334 * done instantaneously unless a DMA operation is ongoing...
@@ -561,10 +561,10 @@ out:
561 return virq; 561 return virq;
562} 562}
563 563
564void grpci2_hw_init(struct grpci2_priv *priv) 564static void grpci2_hw_init(struct grpci2_priv *priv)
565{ 565{
566 u32 ahbadr, pciadr, bar_sz, capptr, io_map, data; 566 u32 ahbadr, pciadr, bar_sz, capptr, io_map, data;
567 struct grpci2_regs *regs = priv->regs; 567 struct grpci2_regs __iomem *regs = priv->regs;
568 int i; 568 int i;
569 struct grpci2_barcfg *barcfg = priv->tgtbars; 569 struct grpci2_barcfg *barcfg = priv->tgtbars;
570 570
@@ -655,7 +655,7 @@ static irqreturn_t grpci2_jump_interrupt(int irq, void *arg)
655static irqreturn_t grpci2_err_interrupt(int irq, void *arg) 655static irqreturn_t grpci2_err_interrupt(int irq, void *arg)
656{ 656{
657 struct grpci2_priv *priv = arg; 657 struct grpci2_priv *priv = arg;
658 struct grpci2_regs *regs = priv->regs; 658 struct grpci2_regs __iomem *regs = priv->regs;
659 unsigned int status; 659 unsigned int status;
660 660
661 status = REGLOAD(regs->sts_cap); 661 status = REGLOAD(regs->sts_cap);
@@ -682,7 +682,7 @@ static irqreturn_t grpci2_err_interrupt(int irq, void *arg)
682 682
683static int grpci2_of_probe(struct platform_device *ofdev) 683static int grpci2_of_probe(struct platform_device *ofdev)
684{ 684{
685 struct grpci2_regs *regs; 685 struct grpci2_regs __iomem *regs;
686 struct grpci2_priv *priv; 686 struct grpci2_priv *priv;
687 int err, i, len; 687 int err, i, len;
688 const int *tmp; 688 const int *tmp;
@@ -878,7 +878,7 @@ err4:
878 release_resource(&priv->info.mem_space); 878 release_resource(&priv->info.mem_space);
879err3: 879err3:
880 err = -ENOMEM; 880 err = -ENOMEM;
881 iounmap((void *)priv->pci_io_va); 881 iounmap((void __iomem *)priv->pci_io_va);
882err2: 882err2:
883 kfree(priv); 883 kfree(priv);
884err1: 884err1:
diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c
index b0b3967a2dd2..ddcf950282ed 100644
--- a/arch/sparc/kernel/leon_pmc.c
+++ b/arch/sparc/kernel/leon_pmc.c
@@ -12,14 +12,14 @@
12#include <asm/processor.h> 12#include <asm/processor.h>
13 13
14/* List of Systems that need fixup instructions around power-down instruction */ 14/* List of Systems that need fixup instructions around power-down instruction */
15unsigned int pmc_leon_fixup_ids[] = { 15static unsigned int pmc_leon_fixup_ids[] = {
16 AEROFLEX_UT699, 16 AEROFLEX_UT699,
17 GAISLER_GR712RC, 17 GAISLER_GR712RC,
18 LEON4_NEXTREME1, 18 LEON4_NEXTREME1,
19 0 19 0
20}; 20};
21 21
22int pmc_leon_need_fixup(void) 22static int pmc_leon_need_fixup(void)
23{ 23{
24 unsigned int systemid = amba_system_id >> 16; 24 unsigned int systemid = amba_system_id >> 16;
25 unsigned int *id; 25 unsigned int *id;
@@ -38,7 +38,7 @@ int pmc_leon_need_fixup(void)
38 * CPU idle callback function for systems that need some extra handling 38 * CPU idle callback function for systems that need some extra handling
39 * See .../arch/sparc/kernel/process.c 39 * See .../arch/sparc/kernel/process.c
40 */ 40 */
41void pmc_leon_idle_fixup(void) 41static void pmc_leon_idle_fixup(void)
42{ 42{
43 /* Prepare an address to a non-cachable region. APB is always 43 /* Prepare an address to a non-cachable region. APB is always
44 * none-cachable. One instruction is executed after the Sleep 44 * none-cachable. One instruction is executed after the Sleep
@@ -62,7 +62,7 @@ void pmc_leon_idle_fixup(void)
62 * CPU idle callback function 62 * CPU idle callback function
63 * See .../arch/sparc/kernel/process.c 63 * See .../arch/sparc/kernel/process.c
64 */ 64 */
65void pmc_leon_idle(void) 65static void pmc_leon_idle(void)
66{ 66{
67 /* Interrupts need to be enabled to not hang the CPU */ 67 /* Interrupts need to be enabled to not hang the CPU */
68 local_irq_enable(); 68 local_irq_enable();
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 6edf955f987c..018ef11f57df 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -130,7 +130,7 @@ void leon_configure_cache_smp(void)
130 local_ops->tlb_all(); 130 local_ops->tlb_all();
131} 131}
132 132
133void leon_smp_setbroadcast(unsigned int mask) 133static void leon_smp_setbroadcast(unsigned int mask)
134{ 134{
135 int broadcast = 135 int broadcast =
136 ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >> 136 ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >>
@@ -148,13 +148,6 @@ void leon_smp_setbroadcast(unsigned int mask)
148 LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask); 148 LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask);
149} 149}
150 150
151unsigned int leon_smp_getbroadcast(void)
152{
153 unsigned int mask;
154 mask = LEON_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpbroadcast));
155 return mask;
156}
157
158int leon_smp_nrcpus(void) 151int leon_smp_nrcpus(void)
159{ 152{
160 int nrcpu = 153 int nrcpu =
@@ -266,10 +259,6 @@ void __init leon_smp_done(void)
266 259
267} 260}
268 261
269void leon_irq_rotate(int cpu)
270{
271}
272
273struct leon_ipi_work { 262struct leon_ipi_work {
274 int single; 263 int single;
275 int msk; 264 int msk;
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 3241f56331c2..de0ee3971f00 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -5,8 +5,10 @@
5#include <linux/mod_devicetable.h> 5#include <linux/mod_devicetable.h>
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/irq.h> 7#include <linux/irq.h>
8#include <linux/of_device.h>
9#include <linux/of_platform.h> 8#include <linux/of_platform.h>
9#include <linux/of_address.h>
10#include <linux/of_device.h>
11#include <linux/of_irq.h>
10 12
11#include "of_device_common.h" 13#include "of_device_common.h"
12 14
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 857ad77df9c0..539babf00bb2 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -28,6 +28,7 @@
28#include <asm/apb.h> 28#include <asm/apb.h>
29 29
30#include "pci_impl.h" 30#include "pci_impl.h"
31#include "kernel.h"
31 32
32/* List of all PCI controllers found in the system. */ 33/* List of all PCI controllers found in the system. */
33struct pci_pbm_info *pci_pbm_root = NULL; 34struct pci_pbm_info *pci_pbm_root = NULL;
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 5f688531f48c..75803c780af3 100644
--- a/arch/sparc/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
@@ -48,8 +48,8 @@ struct sparc64_msiq_ops {
48 unsigned long devino); 48 unsigned long devino);
49}; 49};
50 50
51extern void sparc64_pbm_msi_init(struct pci_pbm_info *pbm, 51void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
52 const struct sparc64_msiq_ops *ops); 52 const struct sparc64_msiq_ops *ops);
53 53
54struct sparc64_msiq_cookie { 54struct sparc64_msiq_cookie {
55 struct pci_pbm_info *pbm; 55 struct pci_pbm_info *pbm;
@@ -158,23 +158,23 @@ extern struct pci_pbm_info *pci_pbm_root;
158extern int pci_num_pbms; 158extern int pci_num_pbms;
159 159
160/* PCI bus scanning and fixup support. */ 160/* PCI bus scanning and fixup support. */
161extern void pci_get_pbm_props(struct pci_pbm_info *pbm); 161void pci_get_pbm_props(struct pci_pbm_info *pbm);
162extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, 162struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
163 struct device *parent); 163 struct device *parent);
164extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm); 164void pci_determine_mem_io_space(struct pci_pbm_info *pbm);
165 165
166/* Error reporting support. */ 166/* Error reporting support. */
167extern void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *); 167void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *);
168extern void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *); 168void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *);
169extern void pci_scan_for_parity_error(struct pci_pbm_info *, struct pci_bus *); 169void pci_scan_for_parity_error(struct pci_pbm_info *, struct pci_bus *);
170 170
171/* Configuration space access. */ 171/* Configuration space access. */
172extern void pci_config_read8(u8 *addr, u8 *ret); 172void pci_config_read8(u8 *addr, u8 *ret);
173extern void pci_config_read16(u16 *addr, u16 *ret); 173void pci_config_read16(u16 *addr, u16 *ret);
174extern void pci_config_read32(u32 *addr, u32 *ret); 174void pci_config_read32(u32 *addr, u32 *ret);
175extern void pci_config_write8(u8 *addr, u8 val); 175void pci_config_write8(u8 *addr, u8 val);
176extern void pci_config_write16(u16 *addr, u16 val); 176void pci_config_write16(u16 *addr, u16 val);
177extern void pci_config_write32(u32 *addr, u32 val); 177void pci_config_write32(u32 *addr, u32 val);
178 178
179extern struct pci_ops sun4u_pci_ops; 179extern struct pci_ops sun4u_pci_ops;
180extern struct pci_ops sun4v_pci_ops; 180extern struct pci_ops sun4v_pci_ops;
diff --git a/arch/sparc/kernel/pci_sun4v.h b/arch/sparc/kernel/pci_sun4v.h
index 8e9fc3a5b4f5..5642212390b2 100644
--- a/arch/sparc/kernel/pci_sun4v.h
+++ b/arch/sparc/kernel/pci_sun4v.h
@@ -6,87 +6,87 @@
6#ifndef _PCI_SUN4V_H 6#ifndef _PCI_SUN4V_H
7#define _PCI_SUN4V_H 7#define _PCI_SUN4V_H
8 8
9extern long pci_sun4v_iommu_map(unsigned long devhandle, 9long pci_sun4v_iommu_map(unsigned long devhandle,
10 unsigned long tsbid, 10 unsigned long tsbid,
11 unsigned long num_ttes, 11 unsigned long num_ttes,
12 unsigned long io_attributes, 12 unsigned long io_attributes,
13 unsigned long io_page_list_pa); 13 unsigned long io_page_list_pa);
14extern unsigned long pci_sun4v_iommu_demap(unsigned long devhandle, 14unsigned long pci_sun4v_iommu_demap(unsigned long devhandle,
15 unsigned long tsbid, 15 unsigned long tsbid,
16 unsigned long num_ttes); 16 unsigned long num_ttes);
17extern unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle, 17unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle,
18 unsigned long tsbid, 18 unsigned long tsbid,
19 unsigned long *io_attributes, 19 unsigned long *io_attributes,
20 unsigned long *real_address); 20 unsigned long *real_address);
21extern unsigned long pci_sun4v_config_get(unsigned long devhandle, 21unsigned long pci_sun4v_config_get(unsigned long devhandle,
22 unsigned long pci_device, 22 unsigned long pci_device,
23 unsigned long config_offset, 23 unsigned long config_offset,
24 unsigned long size); 24 unsigned long size);
25extern int pci_sun4v_config_put(unsigned long devhandle, 25int pci_sun4v_config_put(unsigned long devhandle,
26 unsigned long pci_device, 26 unsigned long pci_device,
27 unsigned long config_offset, 27 unsigned long config_offset,
28 unsigned long size, 28 unsigned long size,
29 unsigned long data); 29 unsigned long data);
30 30
31extern unsigned long pci_sun4v_msiq_conf(unsigned long devhandle, 31unsigned long pci_sun4v_msiq_conf(unsigned long devhandle,
32 unsigned long msiqid, 32 unsigned long msiqid,
33 unsigned long msiq_paddr, 33 unsigned long msiq_paddr,
34 unsigned long num_entries); 34 unsigned long num_entries);
35extern unsigned long pci_sun4v_msiq_info(unsigned long devhandle, 35unsigned long pci_sun4v_msiq_info(unsigned long devhandle,
36 unsigned long msiqid, 36 unsigned long msiqid,
37 unsigned long *msiq_paddr, 37 unsigned long *msiq_paddr,
38 unsigned long *num_entries); 38 unsigned long *num_entries);
39extern unsigned long pci_sun4v_msiq_getvalid(unsigned long devhandle, 39unsigned long pci_sun4v_msiq_getvalid(unsigned long devhandle,
40 unsigned long msiqid, 40 unsigned long msiqid,
41 unsigned long *valid); 41 unsigned long *valid);
42extern unsigned long pci_sun4v_msiq_setvalid(unsigned long devhandle, 42unsigned long pci_sun4v_msiq_setvalid(unsigned long devhandle,
43 unsigned long msiqid, 43 unsigned long msiqid,
44 unsigned long valid); 44 unsigned long valid);
45extern unsigned long pci_sun4v_msiq_getstate(unsigned long devhandle, 45unsigned long pci_sun4v_msiq_getstate(unsigned long devhandle,
46 unsigned long msiqid, 46 unsigned long msiqid,
47 unsigned long *state); 47 unsigned long *state);
48extern unsigned long pci_sun4v_msiq_setstate(unsigned long devhandle, 48unsigned long pci_sun4v_msiq_setstate(unsigned long devhandle,
49 unsigned long msiqid, 49 unsigned long msiqid,
50 unsigned long state); 50 unsigned long state);
51extern unsigned long pci_sun4v_msiq_gethead(unsigned long devhandle, 51unsigned long pci_sun4v_msiq_gethead(unsigned long devhandle,
52 unsigned long msiqid, 52 unsigned long msiqid,
53 unsigned long *head); 53 unsigned long *head);
54extern unsigned long pci_sun4v_msiq_sethead(unsigned long devhandle, 54unsigned long pci_sun4v_msiq_sethead(unsigned long devhandle,
55 unsigned long msiqid, 55 unsigned long msiqid,
56 unsigned long head); 56 unsigned long head);
57extern unsigned long pci_sun4v_msiq_gettail(unsigned long devhandle, 57unsigned long pci_sun4v_msiq_gettail(unsigned long devhandle,
58 unsigned long msiqid, 58 unsigned long msiqid,
59 unsigned long *head); 59 unsigned long *head);
60extern unsigned long pci_sun4v_msi_getvalid(unsigned long devhandle, 60unsigned long pci_sun4v_msi_getvalid(unsigned long devhandle,
61 unsigned long msinum, 61 unsigned long msinum,
62 unsigned long *valid); 62 unsigned long *valid);
63extern unsigned long pci_sun4v_msi_setvalid(unsigned long devhandle, 63unsigned long pci_sun4v_msi_setvalid(unsigned long devhandle,
64 unsigned long msinum, 64 unsigned long msinum,
65 unsigned long valid); 65 unsigned long valid);
66extern unsigned long pci_sun4v_msi_getmsiq(unsigned long devhandle, 66unsigned long pci_sun4v_msi_getmsiq(unsigned long devhandle,
67 unsigned long msinum, 67 unsigned long msinum,
68 unsigned long *msiq); 68 unsigned long *msiq);
69extern unsigned long pci_sun4v_msi_setmsiq(unsigned long devhandle, 69unsigned long pci_sun4v_msi_setmsiq(unsigned long devhandle,
70 unsigned long msinum, 70 unsigned long msinum,
71 unsigned long msiq, 71 unsigned long msiq,
72 unsigned long msitype); 72 unsigned long msitype);
73extern unsigned long pci_sun4v_msi_getstate(unsigned long devhandle, 73unsigned long pci_sun4v_msi_getstate(unsigned long devhandle,
74 unsigned long msinum, 74 unsigned long msinum,
75 unsigned long *state); 75 unsigned long *state);
76extern unsigned long pci_sun4v_msi_setstate(unsigned long devhandle, 76unsigned long pci_sun4v_msi_setstate(unsigned long devhandle,
77 unsigned long msinum, 77 unsigned long msinum,
78 unsigned long state); 78 unsigned long state);
79extern unsigned long pci_sun4v_msg_getmsiq(unsigned long devhandle, 79unsigned long pci_sun4v_msg_getmsiq(unsigned long devhandle,
80 unsigned long msinum, 80 unsigned long msinum,
81 unsigned long *msiq); 81 unsigned long *msiq);
82extern unsigned long pci_sun4v_msg_setmsiq(unsigned long devhandle, 82unsigned long pci_sun4v_msg_setmsiq(unsigned long devhandle,
83 unsigned long msinum, 83 unsigned long msinum,
84 unsigned long msiq); 84 unsigned long msiq);
85extern unsigned long pci_sun4v_msg_getvalid(unsigned long devhandle, 85unsigned long pci_sun4v_msg_getvalid(unsigned long devhandle,
86 unsigned long msinum, 86 unsigned long msinum,
87 unsigned long *valid); 87 unsigned long *valid);
88extern unsigned long pci_sun4v_msg_setvalid(unsigned long devhandle, 88unsigned long pci_sun4v_msg_setvalid(unsigned long devhandle,
89 unsigned long msinum, 89 unsigned long msinum,
90 unsigned long valid); 90 unsigned long valid);
91 91
92#endif /* !(_PCI_SUN4V_H) */ 92#endif /* !(_PCI_SUN4V_H) */
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 09f4fdd8d808..6cc78c213c01 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -36,6 +36,7 @@
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/irq_regs.h> 37#include <asm/irq_regs.h>
38 38
39#include "kernel.h"
39#include "irq.h" 40#include "irq.h"
40 41
41/* 42/*
@@ -162,8 +163,8 @@ static int pcic0_up;
162static struct linux_pcic pcic0; 163static struct linux_pcic pcic0;
163 164
164void __iomem *pcic_regs; 165void __iomem *pcic_regs;
165volatile int pcic_speculative; 166static volatile int pcic_speculative;
166volatile int pcic_trapped; 167static volatile int pcic_trapped;
167 168
168/* forward */ 169/* forward */
169unsigned int pcic_build_device_irq(struct platform_device *op, 170unsigned int pcic_build_device_irq(struct platform_device *op,
@@ -329,7 +330,7 @@ int __init pcic_probe(void)
329 330
330 pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr"; 331 pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr";
331 if ((pcic->pcic_config_space_addr = 332 if ((pcic->pcic_config_space_addr =
332 ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == 0) { 333 ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == NULL) {
333 prom_printf("PCIC: Error, cannot map " 334 prom_printf("PCIC: Error, cannot map "
334 "PCI Configuration Space Address.\n"); 335 "PCI Configuration Space Address.\n");
335 prom_halt(); 336 prom_halt();
@@ -341,7 +342,7 @@ int __init pcic_probe(void)
341 */ 342 */
342 pcic->pcic_res_cfg_data.name = "pcic_cfg_data"; 343 pcic->pcic_res_cfg_data.name = "pcic_cfg_data";
343 if ((pcic->pcic_config_space_data = 344 if ((pcic->pcic_config_space_data =
344 ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == 0) { 345 ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == NULL) {
345 prom_printf("PCIC: Error, cannot map " 346 prom_printf("PCIC: Error, cannot map "
346 "PCI Configuration Space Data.\n"); 347 "PCI Configuration Space Data.\n");
347 prom_halt(); 348 prom_halt();
@@ -353,7 +354,6 @@ int __init pcic_probe(void)
353 strcpy(pbm->prom_name, namebuf); 354 strcpy(pbm->prom_name, namebuf);
354 355
355 { 356 {
356 extern volatile int t_nmi[4];
357 extern int pcic_nmi_trap_patch[4]; 357 extern int pcic_nmi_trap_patch[4];
358 358
359 t_nmi[0] = pcic_nmi_trap_patch[0]; 359 t_nmi[0] = pcic_nmi_trap_patch[0];
@@ -536,7 +536,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
536 prom_getstring(node, "name", namebuf, sizeof(namebuf)); 536 prom_getstring(node, "name", namebuf, sizeof(namebuf));
537 } 537 }
538 538
539 if ((p = pcic->pcic_imap) == 0) { 539 if ((p = pcic->pcic_imap) == NULL) {
540 dev->irq = 0; 540 dev->irq = 0;
541 return; 541 return;
542 } 542 }
@@ -670,30 +670,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
670 } 670 }
671} 671}
672 672
673/*
674 * pcic_pin_to_irq() is exported to bus probing code
675 */
676unsigned int
677pcic_pin_to_irq(unsigned int pin, const char *name)
678{
679 struct linux_pcic *pcic = &pcic0;
680 unsigned int irq;
681 unsigned int ivec;
682
683 if (pin < 4) {
684 ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_LO);
685 irq = ivec >> (pin << 2) & 0xF;
686 } else if (pin < 8) {
687 ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_HI);
688 irq = ivec >> ((pin-4) << 2) & 0xF;
689 } else { /* Corrupted map */
690 printk("PCIC: BAD PIN %d FOR %s\n", pin, name);
691 for (;;) {} /* XXX Cannot panic properly in case of PROLL */
692 }
693/* P3 */ /* printk("PCIC: dev %s pin %d ivec 0x%x irq %x\n", name, pin, ivec, irq); */
694 return irq;
695}
696
697/* Makes compiler happy */ 673/* Makes compiler happy */
698static volatile int pcic_timer_dummy; 674static volatile int pcic_timer_dummy;
699 675
@@ -783,7 +759,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask)
783void pcic_nmi(unsigned int pend, struct pt_regs *regs) 759void pcic_nmi(unsigned int pend, struct pt_regs *regs)
784{ 760{
785 761
786 pend = flip_dword(pend); 762 pend = swab32(pend);
787 763
788 if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) { 764 if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) {
789 /* 765 /*
@@ -875,82 +851,4 @@ void __init sun4m_pci_init_IRQ(void)
875 sparc_config.load_profile_irq = pcic_load_profile_irq; 851 sparc_config.load_profile_irq = pcic_load_profile_irq;
876} 852}
877 853
878/*
879 * This probably belongs here rather than ioport.c because
880 * we do not want this crud linked into SBus kernels.
881 * Also, think for a moment about likes of floppy.c that
882 * include architecture specific parts. They may want to redefine ins/outs.
883 *
884 * We do not use horrible macros here because we want to
885 * advance pointer by sizeof(size).
886 */
887void outsb(unsigned long addr, const void *src, unsigned long count)
888{
889 while (count) {
890 count -= 1;
891 outb(*(const char *)src, addr);
892 src += 1;
893 /* addr += 1; */
894 }
895}
896EXPORT_SYMBOL(outsb);
897
898void outsw(unsigned long addr, const void *src, unsigned long count)
899{
900 while (count) {
901 count -= 2;
902 outw(*(const short *)src, addr);
903 src += 2;
904 /* addr += 2; */
905 }
906}
907EXPORT_SYMBOL(outsw);
908
909void outsl(unsigned long addr, const void *src, unsigned long count)
910{
911 while (count) {
912 count -= 4;
913 outl(*(const long *)src, addr);
914 src += 4;
915 /* addr += 4; */
916 }
917}
918EXPORT_SYMBOL(outsl);
919
920void insb(unsigned long addr, void *dst, unsigned long count)
921{
922 while (count) {
923 count -= 1;
924 *(unsigned char *)dst = inb(addr);
925 dst += 1;
926 /* addr += 1; */
927 }
928}
929EXPORT_SYMBOL(insb);
930
931void insw(unsigned long addr, void *dst, unsigned long count)
932{
933 while (count) {
934 count -= 2;
935 *(unsigned short *)dst = inw(addr);
936 dst += 2;
937 /* addr += 2; */
938 }
939}
940EXPORT_SYMBOL(insw);
941
942void insl(unsigned long addr, void *dst, unsigned long count)
943{
944 while (count) {
945 count -= 4;
946 /*
947 * XXX I am sure we are in for an unaligned trap here.
948 */
949 *(unsigned long *)dst = inl(addr);
950 dst += 4;
951 /* addr += 4; */
952 }
953}
954EXPORT_SYMBOL(insl);
955
956subsys_initcall(pcic_init); 854subsys_initcall(pcic_init);
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index b5c38faa4ead..8efd33753ad3 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -110,7 +110,7 @@ struct cpu_hw_events {
110 110
111 unsigned int group_flag; 111 unsigned int group_flag;
112}; 112};
113DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; 113static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, };
114 114
115/* An event map describes the characteristics of a performance 115/* An event map describes the characteristics of a performance
116 * counter event. In particular it gives the encoding as well as 116 * counter event. In particular it gives the encoding as well as
@@ -1153,7 +1153,7 @@ static void perf_stop_nmi_watchdog(void *unused)
1153 cpuc->pcr[i] = pcr_ops->read_pcr(i); 1153 cpuc->pcr[i] = pcr_ops->read_pcr(i);
1154} 1154}
1155 1155
1156void perf_event_grab_pmc(void) 1156static void perf_event_grab_pmc(void)
1157{ 1157{
1158 if (atomic_inc_not_zero(&active_events)) 1158 if (atomic_inc_not_zero(&active_events))
1159 return; 1159 return;
@@ -1169,7 +1169,7 @@ void perf_event_grab_pmc(void)
1169 mutex_unlock(&pmc_grab_mutex); 1169 mutex_unlock(&pmc_grab_mutex);
1170} 1170}
1171 1171
1172void perf_event_release_pmc(void) 1172static void perf_event_release_pmc(void)
1173{ 1173{
1174 if (atomic_dec_and_mutex_lock(&active_events, &pmc_grab_mutex)) { 1174 if (atomic_dec_and_mutex_lock(&active_events, &pmc_grab_mutex)) {
1175 if (atomic_read(&nmi_active) == 0) 1175 if (atomic_read(&nmi_active) == 0)
@@ -1669,7 +1669,7 @@ static bool __init supported_pmu(void)
1669 return false; 1669 return false;
1670} 1670}
1671 1671
1672int __init init_hw_perf_events(void) 1672static int __init init_hw_perf_events(void)
1673{ 1673{
1674 pr_info("Performance events: "); 1674 pr_info("Performance events: ");
1675 1675
@@ -1742,10 +1742,11 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
1742 1742
1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS; 1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
1744 do { 1744 do {
1745 struct sparc_stackf *usf, sf; 1745 struct sparc_stackf __user *usf;
1746 struct sparc_stackf sf;
1746 unsigned long pc; 1747 unsigned long pc;
1747 1748
1748 usf = (struct sparc_stackf *) ufp; 1749 usf = (struct sparc_stackf __user *)ufp;
1749 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1750 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1750 break; 1751 break;
1751 1752
@@ -1765,17 +1766,19 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1765 unsigned long pc; 1766 unsigned long pc;
1766 1767
1767 if (thread32_stack_is_64bit(ufp)) { 1768 if (thread32_stack_is_64bit(ufp)) {
1768 struct sparc_stackf *usf, sf; 1769 struct sparc_stackf __user *usf;
1770 struct sparc_stackf sf;
1769 1771
1770 ufp += STACK_BIAS; 1772 ufp += STACK_BIAS;
1771 usf = (struct sparc_stackf *) ufp; 1773 usf = (struct sparc_stackf __user *)ufp;
1772 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1774 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1773 break; 1775 break;
1774 pc = sf.callers_pc & 0xffffffff; 1776 pc = sf.callers_pc & 0xffffffff;
1775 ufp = ((unsigned long) sf.fp) & 0xffffffff; 1777 ufp = ((unsigned long) sf.fp) & 0xffffffff;
1776 } else { 1778 } else {
1777 struct sparc_stackf32 *usf, sf; 1779 struct sparc_stackf32 __user *usf;
1778 usf = (struct sparc_stackf32 *) ufp; 1780 struct sparc_stackf32 sf;
1781 usf = (struct sparc_stackf32 __user *)ufp;
1779 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1782 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1780 break; 1783 break;
1781 pc = sf.callers_pc; 1784 pc = sf.callers_pc;
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 510baec1b69b..50e7b626afe8 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -10,6 +10,7 @@
10 10
11#include <stdarg.h> 11#include <stdarg.h>
12 12
13#include <linux/elfcore.h>
13#include <linux/errno.h> 14#include <linux/errno.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
@@ -23,6 +24,7 @@
23#include <linux/delay.h> 24#include <linux/delay.h>
24#include <linux/pm.h> 25#include <linux/pm.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/cpu.h>
26 28
27#include <asm/auxio.h> 29#include <asm/auxio.h>
28#include <asm/oplib.h> 30#include <asm/oplib.h>
@@ -38,6 +40,8 @@
38#include <asm/unistd.h> 40#include <asm/unistd.h>
39#include <asm/setup.h> 41#include <asm/setup.h>
40 42
43#include "kernel.h"
44
41/* 45/*
42 * Power management idle function 46 * Power management idle function
43 * Set in pm platform drivers (apc.c and pmc.c) 47 * Set in pm platform drivers (apc.c and pmc.c)
@@ -102,8 +106,12 @@ void machine_restart(char * cmd)
102void machine_power_off(void) 106void machine_power_off(void)
103{ 107{
104 if (auxio_power_register && 108 if (auxio_power_register &&
105 (strcmp(of_console_device->type, "serial") || scons_pwroff)) 109 (strcmp(of_console_device->type, "serial") || scons_pwroff)) {
106 *auxio_power_register |= AUXIO_POWER_OFF; 110 u8 power_register = sbus_readb(auxio_power_register);
111 power_register |= AUXIO_POWER_OFF;
112 sbus_writeb(power_register, auxio_power_register);
113 }
114
107 machine_halt(); 115 machine_halt();
108} 116}
109 117
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index d7b4967f8fa6..b2988f25e230 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -88,7 +88,7 @@ void arch_cpu_idle(void)
88} 88}
89 89
90#ifdef CONFIG_HOTPLUG_CPU 90#ifdef CONFIG_HOTPLUG_CPU
91void arch_cpu_idle_dead() 91void arch_cpu_idle_dead(void)
92{ 92{
93 sched_preempt_enable_no_resched(); 93 sched_preempt_enable_no_resched();
94 cpu_play_dead(); 94 cpu_play_dead();
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index cf5fe1c0b024..890281b12b28 100644
--- a/arch/sparc/kernel/prom.h
+++ b/arch/sparc/kernel/prom.h
@@ -4,7 +4,7 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <asm/prom.h> 5#include <asm/prom.h>
6 6
7extern void of_console_init(void); 7void of_console_init(void);
8 8
9extern unsigned int prom_early_allocated; 9extern unsigned int prom_early_allocated;
10 10
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index 9a690d39c01b..20cc5d80a471 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -15,11 +15,12 @@
15 * 2 of the License, or (at your option) any later version. 15 * 2 of the License, or (at your option) any later version.
16 */ 16 */
17 17
18#include <linux/memblock.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/types.h>
22#include <linux/cpu.h>
21#include <linux/mm.h> 23#include <linux/mm.h>
22#include <linux/memblock.h>
23#include <linux/of.h> 24#include <linux/of.h>
24 25
25#include <asm/prom.h> 26#include <asm/prom.h>
diff --git a/arch/sparc/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h
index 590b4ed8ab5e..05a6e30a928e 100644
--- a/arch/sparc/kernel/psycho_common.h
+++ b/arch/sparc/kernel/psycho_common.h
@@ -30,19 +30,19 @@ enum psycho_error_type {
30 UE_ERR, CE_ERR, PCI_ERR 30 UE_ERR, CE_ERR, PCI_ERR
31}; 31};
32 32
33extern void psycho_check_iommu_error(struct pci_pbm_info *pbm, 33void psycho_check_iommu_error(struct pci_pbm_info *pbm,
34 unsigned long afsr, 34 unsigned long afsr,
35 unsigned long afar, 35 unsigned long afar,
36 enum psycho_error_type type); 36 enum psycho_error_type type);
37 37
38extern irqreturn_t psycho_pcierr_intr(int irq, void *dev_id); 38irqreturn_t psycho_pcierr_intr(int irq, void *dev_id);
39 39
40extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize, 40int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
41 u32 dvma_offset, u32 dma_mask, 41 u32 dvma_offset, u32 dma_mask,
42 unsigned long write_complete_offset); 42 unsigned long write_complete_offset);
43 43
44extern void psycho_pbm_init_common(struct pci_pbm_info *pbm, 44void psycho_pbm_init_common(struct pci_pbm_info *pbm,
45 struct platform_device *op, 45 struct platform_device *op,
46 const char *chip_name, int chip_type); 46 const char *chip_name, int chip_type);
47 47
48#endif /* _PSYCHO_COMMON_H */ 48#endif /* _PSYCHO_COMMON_H */
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
index 896ba7c5cd8e..a331fdc11a2c 100644
--- a/arch/sparc/kernel/ptrace_32.c
+++ b/arch/sparc/kernel/ptrace_32.c
@@ -26,6 +26,8 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
28 28
29#include "kernel.h"
30
29/* #define ALLOW_INIT_TRACING */ 31/* #define ALLOW_INIT_TRACING */
30 32
31/* 33/*
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index 1434526970a6..baef495c06bd 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -267,7 +267,7 @@ static __init void leon_patch(void)
267} 267}
268 268
269struct tt_entry *sparc_ttable; 269struct tt_entry *sparc_ttable;
270struct pt_regs fake_swapper_regs; 270static struct pt_regs fake_swapper_regs;
271 271
272/* Called from head_32.S - before we have setup anything 272/* Called from head_32.S - before we have setup anything
273 * in the kernel. Be very careful with what you do here. 273 * in the kernel. Be very careful with what you do here.
@@ -365,7 +365,7 @@ void __init setup_arch(char **cmdline_p)
365 365
366 prom_setsync(prom_sync_me); 366 prom_setsync(prom_sync_me);
367 367
368 if((boot_flags&BOOTME_DEBUG) && (linux_dbvec!=0) && 368 if((boot_flags & BOOTME_DEBUG) && (linux_dbvec != NULL) &&
369 ((*(short *)linux_dbvec) != -1)) { 369 ((*(short *)linux_dbvec) != -1)) {
370 printk("Booted under KADB. Syncing trap table.\n"); 370 printk("Booted under KADB. Syncing trap table.\n");
371 (*(linux_dbvec->teach_debugger))(); 371 (*(linux_dbvec->teach_debugger))();
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index ee789d2ef05d..62deba7be1a9 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -31,6 +31,7 @@
31#include <asm/switch_to.h> 31#include <asm/switch_to.h>
32 32
33#include "sigutil.h" 33#include "sigutil.h"
34#include "kernel.h"
34 35
35/* This magic should be in g_upper[0] for all upper parts 36/* This magic should be in g_upper[0] for all upper parts
36 * to be valid. 37 * to be valid.
@@ -145,7 +146,7 @@ void do_sigreturn32(struct pt_regs *regs)
145 unsigned int psr; 146 unsigned int psr;
146 unsigned pc, npc; 147 unsigned pc, npc;
147 sigset_t set; 148 sigset_t set;
148 unsigned seta[_COMPAT_NSIG_WORDS]; 149 compat_sigset_t seta;
149 int err, i; 150 int err, i;
150 151
151 /* Always make any pending restarted system calls return -EINTR */ 152 /* Always make any pending restarted system calls return -EINTR */
@@ -209,17 +210,13 @@ void do_sigreturn32(struct pt_regs *regs)
209 if (restore_rwin_state(compat_ptr(rwin_save))) 210 if (restore_rwin_state(compat_ptr(rwin_save)))
210 goto segv; 211 goto segv;
211 } 212 }
212 err |= __get_user(seta[0], &sf->info.si_mask); 213 err |= __get_user(seta.sig[0], &sf->info.si_mask);
213 err |= copy_from_user(seta+1, &sf->extramask, 214 err |= copy_from_user(&seta.sig[1], &sf->extramask,
214 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 215 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
215 if (err) 216 if (err)
216 goto segv; 217 goto segv;
217 switch (_NSIG_WORDS) { 218
218 case 4: set.sig[3] = seta[6] + (((long)seta[7]) << 32); 219 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
219 case 3: set.sig[2] = seta[4] + (((long)seta[5]) << 32);
220 case 2: set.sig[1] = seta[2] + (((long)seta[3]) << 32);
221 case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32);
222 }
223 set_current_blocked(&set); 220 set_current_blocked(&set);
224 return; 221 return;
225 222
@@ -303,12 +300,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
303 goto segv; 300 goto segv;
304 } 301 }
305 302
306 switch (_NSIG_WORDS) { 303 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
307 case 4: set.sig[3] = seta.sig[6] + (((long)seta.sig[7]) << 32);
308 case 3: set.sig[2] = seta.sig[4] + (((long)seta.sig[5]) << 32);
309 case 2: set.sig[1] = seta.sig[2] + (((long)seta.sig[3]) << 32);
310 case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
311 }
312 set_current_blocked(&set); 304 set_current_blocked(&set);
313 return; 305 return;
314segv: 306segv:
@@ -417,7 +409,7 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
417 void __user *tail; 409 void __user *tail;
418 int sigframe_size; 410 int sigframe_size;
419 u32 psr; 411 u32 psr;
420 unsigned int seta[_COMPAT_NSIG_WORDS]; 412 compat_sigset_t seta;
421 413
422 /* 1. Make sure everything is clean */ 414 /* 1. Make sure everything is clean */
423 synchronize_user_stack(); 415 synchronize_user_stack();
@@ -481,18 +473,14 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
481 err |= __put_user(0, &sf->rwin_save); 473 err |= __put_user(0, &sf->rwin_save);
482 } 474 }
483 475
484 switch (_NSIG_WORDS) { 476 /* If these change we need to know - assignments to seta relies on these sizes */
485 case 4: seta[7] = (oldset->sig[3] >> 32); 477 BUILD_BUG_ON(_NSIG_WORDS != 1);
486 seta[6] = oldset->sig[3]; 478 BUILD_BUG_ON(_COMPAT_NSIG_WORDS != 2);
487 case 3: seta[5] = (oldset->sig[2] >> 32); 479 seta.sig[1] = (oldset->sig[0] >> 32);
488 seta[4] = oldset->sig[2]; 480 seta.sig[0] = oldset->sig[0];
489 case 2: seta[3] = (oldset->sig[1] >> 32); 481
490 seta[2] = oldset->sig[1]; 482 err |= __put_user(seta.sig[0], &sf->info.si_mask);
491 case 1: seta[1] = (oldset->sig[0] >> 32); 483 err |= __copy_to_user(sf->extramask, &seta.sig[1],
492 seta[0] = oldset->sig[0];
493 }
494 err |= __put_user(seta[0], &sf->info.si_mask);
495 err |= __copy_to_user(sf->extramask, seta + 1,
496 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 484 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
497 485
498 if (!wsaved) { 486 if (!wsaved) {
@@ -622,16 +610,8 @@ static int setup_rt_frame32(struct ksignal *ksig, struct pt_regs *regs,
622 /* Setup sigaltstack */ 610 /* Setup sigaltstack */
623 err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]); 611 err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]);
624 612
625 switch (_NSIG_WORDS) { 613 seta.sig[1] = (oldset->sig[0] >> 32);
626 case 4: seta.sig[7] = (oldset->sig[3] >> 32); 614 seta.sig[0] = oldset->sig[0];
627 seta.sig[6] = oldset->sig[3];
628 case 3: seta.sig[5] = (oldset->sig[2] >> 32);
629 seta.sig[4] = oldset->sig[2];
630 case 2: seta.sig[3] = (oldset->sig[1] >> 32);
631 seta.sig[2] = oldset->sig[1];
632 case 1: seta.sig[1] = (oldset->sig[0] >> 32);
633 seta.sig[0] = oldset->sig[0];
634 }
635 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t)); 615 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t));
636 616
637 if (!wsaved) { 617 if (!wsaved) {
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 7d5d8e1f8415..9ee72fc8e0e4 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -28,6 +28,7 @@
28#include <asm/switch_to.h> 28#include <asm/switch_to.h>
29 29
30#include "sigutil.h" 30#include "sigutil.h"
31#include "kernel.h"
31 32
32extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 33extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
33 void *fpqueue, unsigned long *fpqdepth); 34 void *fpqueue, unsigned long *fpqdepth);
@@ -341,7 +342,7 @@ static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
341 err |= __put_user(0, &sf->extra_size); 342 err |= __put_user(0, &sf->extra_size);
342 343
343 if (psr & PSR_EF) { 344 if (psr & PSR_EF) {
344 __siginfo_fpu_t *fp = tail; 345 __siginfo_fpu_t __user *fp = tail;
345 tail += sizeof(*fp); 346 tail += sizeof(*fp);
346 err |= save_fpu_state(regs, fp); 347 err |= save_fpu_state(regs, fp);
347 err |= __put_user(fp, &sf->fpu_save); 348 err |= __put_user(fp, &sf->fpu_save);
@@ -349,7 +350,7 @@ static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
349 err |= __put_user(0, &sf->fpu_save); 350 err |= __put_user(0, &sf->fpu_save);
350 } 351 }
351 if (wsaved) { 352 if (wsaved) {
352 __siginfo_rwin_t *rwp = tail; 353 __siginfo_rwin_t __user *rwp = tail;
353 tail += sizeof(*rwp); 354 tail += sizeof(*rwp);
354 err |= save_rwin_state(wsaved, rwp); 355 err |= save_rwin_state(wsaved, rwp);
355 err |= __put_user(rwp, &sf->rwin_save); 356 err |= __put_user(rwp, &sf->rwin_save);
@@ -517,9 +518,9 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
517 } 518 }
518} 519}
519 520
520asmlinkage int 521asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr,
521do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr, 522 struct sigstack __user *ossptr,
522 unsigned long sp) 523 unsigned long sp)
523{ 524{
524 int ret = -EFAULT; 525 int ret = -EFAULT;
525 526
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index cd91d010e6d3..1a6999868031 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -35,9 +35,10 @@
35#include <asm/switch_to.h> 35#include <asm/switch_to.h>
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37 37
38#include "entry.h"
39#include "systbls.h"
40#include "sigutil.h" 38#include "sigutil.h"
39#include "systbls.h"
40#include "kernel.h"
41#include "entry.h"
41 42
42/* {set, get}context() needed for 64-bit SparcLinux userland. */ 43/* {set, get}context() needed for 64-bit SparcLinux userland. */
43asmlinkage void sparc64_set_context(struct pt_regs *regs) 44asmlinkage void sparc64_set_context(struct pt_regs *regs)
@@ -492,7 +493,6 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
492 493
493#ifdef CONFIG_COMPAT 494#ifdef CONFIG_COMPAT
494 if (test_thread_flag(TIF_32BIT)) { 495 if (test_thread_flag(TIF_32BIT)) {
495 extern void do_signal32(struct pt_regs *);
496 do_signal32(regs); 496 do_signal32(regs);
497 return; 497 return;
498 } 498 }
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index a102bfba6ea8..7958242d63c5 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -20,6 +20,7 @@
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/cache.h> 21#include <linux/cache.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/profile.h>
23#include <linux/cpu.h> 24#include <linux/cpu.h>
24 25
25#include <asm/ptrace.h> 26#include <asm/ptrace.h>
@@ -75,8 +76,6 @@ void smp_store_cpu_info(int id)
75 76
76void __init smp_cpus_done(unsigned int max_cpus) 77void __init smp_cpus_done(unsigned int max_cpus)
77{ 78{
78 extern void smp4m_smp_done(void);
79 extern void smp4d_smp_done(void);
80 unsigned long bogosum = 0; 79 unsigned long bogosum = 0;
81 int cpu, num = 0; 80 int cpu, num = 0;
82 81
@@ -183,8 +182,6 @@ int setup_profiling_timer(unsigned int multiplier)
183 182
184void __init smp_prepare_cpus(unsigned int max_cpus) 183void __init smp_prepare_cpus(unsigned int max_cpus)
185{ 184{
186 extern void __init smp4m_boot_cpus(void);
187 extern void __init smp4d_boot_cpus(void);
188 int i, cpuid, extra; 185 int i, cpuid, extra;
189 186
190 printk("Entering SMP Mode...\n"); 187 printk("Entering SMP Mode...\n");
@@ -261,8 +258,6 @@ void __init smp_prepare_boot_cpu(void)
261 258
262int __cpu_up(unsigned int cpu, struct task_struct *tidle) 259int __cpu_up(unsigned int cpu, struct task_struct *tidle)
263{ 260{
264 extern int smp4m_boot_one_cpu(int, struct task_struct *);
265 extern int smp4d_boot_one_cpu(int, struct task_struct *);
266 int ret=0; 261 int ret=0;
267 262
268 switch(sparc_cpu_model) { 263 switch(sparc_cpu_model) {
@@ -297,7 +292,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
297 return ret; 292 return ret;
298} 293}
299 294
300void arch_cpu_pre_starting(void *arg) 295static void arch_cpu_pre_starting(void *arg)
301{ 296{
302 local_ops->cache_all(); 297 local_ops->cache_all();
303 local_ops->tlb_all(); 298 local_ops->tlb_all();
@@ -317,7 +312,7 @@ void arch_cpu_pre_starting(void *arg)
317 } 312 }
318} 313}
319 314
320void arch_cpu_pre_online(void *arg) 315static void arch_cpu_pre_online(void *arg)
321{ 316{
322 unsigned int cpuid = hard_smp_processor_id(); 317 unsigned int cpuid = hard_smp_processor_id();
323 318
@@ -344,7 +339,7 @@ void arch_cpu_pre_online(void *arg)
344 } 339 }
345} 340}
346 341
347void sparc_start_secondary(void *arg) 342static void sparc_start_secondary(void *arg)
348{ 343{
349 unsigned int cpu; 344 unsigned int cpu;
350 345
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 745a3633ce14..41aa2478f3ca 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -25,6 +25,7 @@
25#include <linux/ftrace.h> 25#include <linux/ftrace.h>
26#include <linux/cpu.h> 26#include <linux/cpu.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/kgdb.h>
28 29
29#include <asm/head.h> 30#include <asm/head.h>
30#include <asm/ptrace.h> 31#include <asm/ptrace.h>
@@ -35,6 +36,7 @@
35#include <asm/hvtramp.h> 36#include <asm/hvtramp.h>
36#include <asm/io.h> 37#include <asm/io.h>
37#include <asm/timer.h> 38#include <asm/timer.h>
39#include <asm/setup.h>
38 40
39#include <asm/irq.h> 41#include <asm/irq.h>
40#include <asm/irq_regs.h> 42#include <asm/irq_regs.h>
@@ -52,6 +54,7 @@
52#include <asm/pcr.h> 54#include <asm/pcr.h>
53 55
54#include "cpumap.h" 56#include "cpumap.h"
57#include "kernel.h"
55 58
56DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; 59DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
57cpumask_t cpu_core_map[NR_CPUS] __read_mostly = 60cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
@@ -272,14 +275,6 @@ static void smp_synchronize_one_tick(int cpu)
272} 275}
273 276
274#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) 277#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
275/* XXX Put this in some common place. XXX */
276static unsigned long kimage_addr_to_ra(void *p)
277{
278 unsigned long val = (unsigned long) p;
279
280 return kern_base + (val - KERNBASE);
281}
282
283static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg, 278static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg,
284 void **descrp) 279 void **descrp)
285{ 280{
@@ -867,11 +862,6 @@ extern unsigned long xcall_flush_dcache_page_cheetah;
867#endif 862#endif
868extern unsigned long xcall_flush_dcache_page_spitfire; 863extern unsigned long xcall_flush_dcache_page_spitfire;
869 864
870#ifdef CONFIG_DEBUG_DCFLUSH
871extern atomic_t dcpage_flushes;
872extern atomic_t dcpage_flushes_xcall;
873#endif
874
875static inline void __local_flush_dcache_page(struct page *page) 865static inline void __local_flush_dcache_page(struct page *page)
876{ 866{
877#ifdef DCACHE_ALIASING_POSSIBLE 867#ifdef DCACHE_ALIASING_POSSIBLE
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index f8933be3ca8b..a1bb2675b280 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -143,7 +143,7 @@ static void sun4d_sbus_handler_irq(int sbusl)
143 } 143 }
144} 144}
145 145
146void sun4d_handler_irq(int pil, struct pt_regs *regs) 146void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs)
147{ 147{
148 struct pt_regs *old_regs; 148 struct pt_regs *old_regs;
149 /* SBUS IRQ level (1 - 7) */ 149 /* SBUS IRQ level (1 - 7) */
@@ -236,7 +236,7 @@ static void sun4d_shutdown_irq(struct irq_data *data)
236 irq_unlink(data->irq); 236 irq_unlink(data->irq);
237} 237}
238 238
239struct irq_chip sun4d_irq = { 239static struct irq_chip sun4d_irq = {
240 .name = "sun4d", 240 .name = "sun4d",
241 .irq_startup = sun4d_startup_irq, 241 .irq_startup = sun4d_startup_irq,
242 .irq_shutdown = sun4d_shutdown_irq, 242 .irq_shutdown = sun4d_shutdown_irq,
@@ -285,9 +285,9 @@ static void __init sun4d_load_profile_irqs(void)
285 } 285 }
286} 286}
287 287
288unsigned int _sun4d_build_device_irq(unsigned int real_irq, 288static unsigned int _sun4d_build_device_irq(unsigned int real_irq,
289 unsigned int pil, 289 unsigned int pil,
290 unsigned int board) 290 unsigned int board)
291{ 291{
292 struct sun4d_handler_data *handler_data; 292 struct sun4d_handler_data *handler_data;
293 unsigned int irq; 293 unsigned int irq;
@@ -320,8 +320,8 @@ err_out:
320 320
321 321
322 322
323unsigned int sun4d_build_device_irq(struct platform_device *op, 323static unsigned int sun4d_build_device_irq(struct platform_device *op,
324 unsigned int real_irq) 324 unsigned int real_irq)
325{ 325{
326 struct device_node *dp = op->dev.of_node; 326 struct device_node *dp = op->dev.of_node;
327 struct device_node *board_parent, *bus = dp->parent; 327 struct device_node *board_parent, *bus = dp->parent;
@@ -383,7 +383,8 @@ err_out:
383 return irq; 383 return irq;
384} 384}
385 385
386unsigned int sun4d_build_timer_irq(unsigned int board, unsigned int real_irq) 386static unsigned int sun4d_build_timer_irq(unsigned int board,
387 unsigned int real_irq)
387{ 388{
388 return _sun4d_build_device_irq(real_irq, real_irq, board); 389 return _sun4d_build_device_irq(real_irq, real_irq, board);
389} 390}
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 71368850dfc0..022c30c72ebd 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -49,6 +49,8 @@
49#include <asm/mmu_context.h> 49#include <asm/mmu_context.h>
50#include <asm/compat_signal.h> 50#include <asm/compat_signal.h>
51 51
52#include "systbls.h"
53
52asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) 54asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
53{ 55{
54 if ((int)high < 0) 56 if ((int)high < 0)
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 3a8d1844402e..646988d4c1a3 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -24,6 +24,8 @@
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/unistd.h> 25#include <asm/unistd.h>
26 26
27#include "systbls.h"
28
27/* #define DEBUG_UNIMP_SYSCALL */ 29/* #define DEBUG_UNIMP_SYSCALL */
28 30
29/* XXX Make this per-binary type, this way we can detect the type of 31/* XXX Make this per-binary type, this way we can detect the type of
@@ -68,7 +70,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
68 * sys_pipe() is the normal C calling standard for creating 70 * sys_pipe() is the normal C calling standard for creating
69 * a pipe. It's not the way unix traditionally does this, though. 71 * a pipe. It's not the way unix traditionally does this, though.
70 */ 72 */
71asmlinkage int sparc_pipe(struct pt_regs *regs) 73asmlinkage long sparc_pipe(struct pt_regs *regs)
72{ 74{
73 int fd[2]; 75 int fd[2];
74 int error; 76 int error;
@@ -93,7 +95,7 @@ int sparc_mmap_check(unsigned long addr, unsigned long len)
93 95
94/* Linux version of mmap */ 96/* Linux version of mmap */
95 97
96asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, 98asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
97 unsigned long prot, unsigned long flags, unsigned long fd, 99 unsigned long prot, unsigned long flags, unsigned long fd,
98 unsigned long pgoff) 100 unsigned long pgoff)
99{ 101{
@@ -103,7 +105,7 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
103 pgoff >> (PAGE_SHIFT - 12)); 105 pgoff >> (PAGE_SHIFT - 12));
104} 106}
105 107
106asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, 108asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
107 unsigned long prot, unsigned long flags, unsigned long fd, 109 unsigned long prot, unsigned long flags, unsigned long fd,
108 unsigned long off) 110 unsigned long off)
109{ 111{
@@ -197,7 +199,7 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig,
197 return ret; 199 return ret;
198} 200}
199 201
200asmlinkage int sys_getdomainname(char __user *name, int len) 202asmlinkage long sys_getdomainname(char __user *name, int len)
201{ 203{
202 int nlen, err; 204 int nlen, err;
203 205
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index beb0b5a5f21f..c85403d0496c 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -31,6 +31,7 @@
31#include <asm/unistd.h> 31#include <asm/unistd.h>
32 32
33#include "entry.h" 33#include "entry.h"
34#include "kernel.h"
34#include "systbls.h" 35#include "systbls.h"
35 36
36/* #define DEBUG_UNIMP_SYSCALL */ 37/* #define DEBUG_UNIMP_SYSCALL */
diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h
index 26e6dd72e92a..2dab8236d490 100644
--- a/arch/sparc/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
@@ -1,41 +1,103 @@
1#ifndef _SYSTBLS_H 1#ifndef _SYSTBLS_H
2#define _SYSTBLS_H 2#define _SYSTBLS_H
3 3
4#include <linux/signal.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/compat.h>
5#include <linux/types.h> 7#include <linux/types.h>
6#include <linux/signal.h> 8
7#include <asm/utrap.h> 9#include <asm/utrap.h>
8 10
9extern asmlinkage unsigned long sys_getpagesize(void); 11asmlinkage unsigned long sys_getpagesize(void);
10extern asmlinkage long sparc_pipe(struct pt_regs *regs); 12asmlinkage long sparc_pipe(struct pt_regs *regs);
11extern asmlinkage long sys_sparc_ipc(unsigned int call, int first, 13asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs);
12 unsigned long second, 14asmlinkage long sys_getdomainname(char __user *name, int len);
13 unsigned long third, 15void do_rt_sigreturn(struct pt_regs *regs);
14 void __user *ptr, long fifth); 16asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
15extern asmlinkage long sparc64_personality(unsigned long personality); 17 unsigned long prot, unsigned long flags,
16extern asmlinkage long sys64_munmap(unsigned long addr, size_t len); 18 unsigned long fd, unsigned long off);
17extern asmlinkage unsigned long sys64_mremap(unsigned long addr, 19asmlinkage void sparc_breakpoint(struct pt_regs *regs);
18 unsigned long old_len, 20
19 unsigned long new_len, 21#ifdef CONFIG_SPARC32
20 unsigned long flags, 22asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
21 unsigned long new_addr); 23 unsigned long prot, unsigned long flags,
22extern asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs); 24 unsigned long fd, unsigned long pgoff);
23extern asmlinkage long sys_getdomainname(char __user *name, int len); 25long sparc_remap_file_pages(unsigned long start, unsigned long size,
24extern asmlinkage long sys_utrap_install(utrap_entry_t type, 26 unsigned long prot, unsigned long pgoff,
25 utrap_handler_t new_p, 27 unsigned long flags);
26 utrap_handler_t new_d,
27 utrap_handler_t __user *old_p,
28 utrap_handler_t __user *old_d);
29extern asmlinkage long sparc_memory_ordering(unsigned long model,
30 struct pt_regs *regs);
31extern asmlinkage long sys_rt_sigaction(int sig,
32 const struct sigaction __user *act,
33 struct sigaction __user *oact,
34 void __user *restorer,
35 size_t sigsetsize);
36 28
37extern asmlinkage void sparc64_set_context(struct pt_regs *regs); 29#endif /* CONFIG_SPARC32 */
38extern asmlinkage void sparc64_get_context(struct pt_regs *regs);
39extern void do_rt_sigreturn(struct pt_regs *regs);
40 30
31#ifdef CONFIG_SPARC64
32asmlinkage long sys_sparc_ipc(unsigned int call, int first,
33 unsigned long second,
34 unsigned long third,
35 void __user *ptr, long fifth);
36asmlinkage long sparc64_personality(unsigned long personality);
37asmlinkage long sys64_munmap(unsigned long addr, size_t len);
38asmlinkage unsigned long sys64_mremap(unsigned long addr,
39 unsigned long old_len,
40 unsigned long new_len,
41 unsigned long flags,
42 unsigned long new_addr);
43asmlinkage long sys_utrap_install(utrap_entry_t type,
44 utrap_handler_t new_p,
45 utrap_handler_t new_d,
46 utrap_handler_t __user *old_p,
47 utrap_handler_t __user *old_d);
48asmlinkage long sparc_memory_ordering(unsigned long model,
49 struct pt_regs *regs);
50asmlinkage void sparc64_set_context(struct pt_regs *regs);
51asmlinkage void sparc64_get_context(struct pt_regs *regs);
52asmlinkage long sys32_truncate64(const char __user * path,
53 unsigned long high,
54 unsigned long low);
55asmlinkage long sys32_ftruncate64(unsigned int fd,
56 unsigned long high,
57 unsigned long low);
58struct compat_stat64;
59asmlinkage long compat_sys_stat64(const char __user * filename,
60 struct compat_stat64 __user *statbuf);
61asmlinkage long compat_sys_lstat64(const char __user * filename,
62 struct compat_stat64 __user *statbuf);
63asmlinkage long compat_sys_fstat64(unsigned int fd,
64 struct compat_stat64 __user * statbuf);
65asmlinkage long compat_sys_fstatat64(unsigned int dfd,
66 const char __user *filename,
67 struct compat_stat64 __user * statbuf, int flag);
68asmlinkage compat_ssize_t sys32_pread64(unsigned int fd,
69 char __user *ubuf,
70 compat_size_t count,
71 unsigned long poshi,
72 unsigned long poslo);
73asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd,
74 char __user *ubuf,
75 compat_size_t count,
76 unsigned long poshi,
77 unsigned long poslo);
78asmlinkage long compat_sys_readahead(int fd,
79 unsigned long offhi,
80 unsigned long offlo,
81 compat_size_t count);
82long compat_sys_fadvise64(int fd,
83 unsigned long offhi,
84 unsigned long offlo,
85 compat_size_t len, int advice);
86long compat_sys_fadvise64_64(int fd,
87 unsigned long offhi, unsigned long offlo,
88 unsigned long lenhi, unsigned long lenlo,
89 int advice);
90long sys32_sync_file_range(unsigned int fd,
91 unsigned long off_high, unsigned long off_low,
92 unsigned long nb_high, unsigned long nb_low,
93 unsigned int flags);
94asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo,
95 u32 lenhi, u32 lenlo);
96asmlinkage long compat_sys_fstat64(unsigned int fd,
97 struct compat_stat64 __user * statbuf);
98asmlinkage long compat_sys_fstatat64(unsigned int dfd,
99 const char __user *filename,
100 struct compat_stat64 __user * statbuf,
101 int flag);
102#endif /* CONFIG_SPARC64 */
41#endif /* _SYSTBLS_H */ 103#endif /* _SYSTBLS_H */
diff --git a/arch/sparc/kernel/tadpole.c b/arch/sparc/kernel/tadpole.c
deleted file mode 100644
index 9aba8bd5a78b..000000000000
--- a/arch/sparc/kernel/tadpole.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/* tadpole.c: Probing for the tadpole clock stopping h/w at boot time.
2 *
3 * Copyright (C) 1996 David Redman (djhr@tadpole.co.uk)
4 */
5
6#include <linux/string.h>
7#include <linux/kernel.h>
8#include <linux/sched.h>
9#include <linux/init.h>
10
11#include <asm/asi.h>
12#include <asm/oplib.h>
13#include <asm/io.h>
14
15#define MACIO_SCSI_CSR_ADDR 0x78400000
16#define MACIO_EN_DMA 0x00000200
17#define CLOCK_INIT_DONE 1
18
19static int clk_state;
20static volatile unsigned char *clk_ctrl;
21void (*cpu_pwr_save)(void);
22
23static inline unsigned int ldphys(unsigned int addr)
24{
25 unsigned long data;
26
27 __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" :
28 "=r" (data) :
29 "r" (addr), "i" (ASI_M_BYPASS));
30 return data;
31}
32
33static void clk_init(void)
34{
35 __asm__ __volatile__("mov 0x6c, %%g1\n\t"
36 "mov 0x4c, %%g2\n\t"
37 "mov 0xdf, %%g3\n\t"
38 "stb %%g1, [%0+3]\n\t"
39 "stb %%g2, [%0+3]\n\t"
40 "stb %%g3, [%0+3]\n\t" : :
41 "r" (clk_ctrl) :
42 "g1", "g2", "g3");
43}
44
45static void clk_slow(void)
46{
47 __asm__ __volatile__("mov 0xcc, %%g2\n\t"
48 "mov 0x4c, %%g3\n\t"
49 "mov 0xcf, %%g4\n\t"
50 "mov 0xdf, %%g5\n\t"
51 "stb %%g2, [%0+3]\n\t"
52 "stb %%g3, [%0+3]\n\t"
53 "stb %%g4, [%0+3]\n\t"
54 "stb %%g5, [%0+3]\n\t" : :
55 "r" (clk_ctrl) :
56 "g2", "g3", "g4", "g5");
57}
58
59/*
60 * Tadpole is guaranteed to be UP, using local_irq_save.
61 */
62static void tsu_clockstop(void)
63{
64 unsigned int mcsr;
65 unsigned long flags;
66
67 if (!clk_ctrl)
68 return;
69 if (!(clk_state & CLOCK_INIT_DONE)) {
70 local_irq_save(flags);
71 clk_init();
72 clk_state |= CLOCK_INIT_DONE; /* all done */
73 local_irq_restore(flags);
74 return;
75 }
76 if (!(clk_ctrl[2] & 1))
77 return; /* no speed up yet */
78
79 local_irq_save(flags);
80
81 /* if SCSI DMA in progress, don't slow clock */
82 mcsr = ldphys(MACIO_SCSI_CSR_ADDR);
83 if ((mcsr&MACIO_EN_DMA) != 0) {
84 local_irq_restore(flags);
85 return;
86 }
87 /* TODO... the minimum clock setting ought to increase the
88 * memory refresh interval..
89 */
90 clk_slow();
91 local_irq_restore(flags);
92}
93
94static void swift_clockstop(void)
95{
96 if (!clk_ctrl)
97 return;
98 clk_ctrl[0] = 0;
99}
100
101void __init clock_stop_probe(void)
102{
103 phandle node, clk_nd;
104 char name[20];
105
106 prom_getstring(prom_root_node, "name", name, sizeof(name));
107 if (strncmp(name, "Tadpole", 7))
108 return;
109 node = prom_getchild(prom_root_node);
110 node = prom_searchsiblings(node, "obio");
111 node = prom_getchild(node);
112 clk_nd = prom_searchsiblings(node, "clk-ctrl");
113 if (!clk_nd)
114 return;
115 printk("Clock Stopping h/w detected... ");
116 clk_ctrl = (char *) prom_getint(clk_nd, "address");
117 clk_state = 0;
118 if (name[10] == '\0') {
119 cpu_pwr_save = tsu_clockstop;
120 printk("enabled (S3)\n");
121 } else if ((name[10] == 'X') || (name[10] == 'G')) {
122 cpu_pwr_save = swift_clockstop;
123 printk("enabled (%s)\n",name+7);
124 } else
125 printk("disabled %s\n",name+7);
126}
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index c4c27b0f9063..5923d1e4e7c9 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -36,6 +36,7 @@
36#include <linux/of_device.h> 36#include <linux/of_device.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38 38
39#include <asm/mc146818rtc.h>
39#include <asm/oplib.h> 40#include <asm/oplib.h>
40#include <asm/timex.h> 41#include <asm/timex.h>
41#include <asm/timer.h> 42#include <asm/timer.h>
@@ -47,6 +48,7 @@
47#include <asm/irq_regs.h> 48#include <asm/irq_regs.h>
48#include <asm/setup.h> 49#include <asm/setup.h>
49 50
51#include "kernel.h"
50#include "irq.h" 52#include "irq.h"
51 53
52static __cacheline_aligned_in_smp DEFINE_SEQLOCK(timer_cs_lock); 54static __cacheline_aligned_in_smp DEFINE_SEQLOCK(timer_cs_lock);
@@ -83,7 +85,7 @@ unsigned long profile_pc(struct pt_regs *regs)
83 85
84EXPORT_SYMBOL(profile_pc); 86EXPORT_SYMBOL(profile_pc);
85 87
86__volatile__ unsigned int *master_l10_counter; 88volatile u32 __iomem *master_l10_counter;
87 89
88int update_persistent_clock(struct timespec now) 90int update_persistent_clock(struct timespec now)
89{ 91{
@@ -143,9 +145,9 @@ static __init void setup_timer_ce(void)
143 145
144static unsigned int sbus_cycles_offset(void) 146static unsigned int sbus_cycles_offset(void)
145{ 147{
146 unsigned int val, offset; 148 u32 val, offset;
147 149
148 val = *master_l10_counter; 150 val = sbus_readl(master_l10_counter);
149 offset = (val >> TIMER_VALUE_SHIFT) & TIMER_VALUE_MASK; 151 offset = (val >> TIMER_VALUE_SHIFT) & TIMER_VALUE_MASK;
150 152
151 /* Limit hit? */ 153 /* Limit hit? */
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
index 662982946a89..6fd386c5232a 100644
--- a/arch/sparc/kernel/traps_32.c
+++ b/arch/sparc/kernel/traps_32.c
@@ -44,7 +44,7 @@ static void instruction_dump(unsigned long *pc)
44#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t") 44#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t")
45#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t") 45#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t")
46 46
47void die_if_kernel(char *str, struct pt_regs *regs) 47void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
48{ 48{
49 static int die_counter; 49 static int die_counter;
50 int count = 0; 50 int count = 0;
@@ -219,8 +219,6 @@ static unsigned long fake_fsr;
219static unsigned long fake_queue[32] __attribute__ ((aligned (8))); 219static unsigned long fake_queue[32] __attribute__ ((aligned (8)));
220static unsigned long fake_depth; 220static unsigned long fake_depth;
221 221
222extern int do_mathemu(struct pt_regs *, struct task_struct *);
223
224void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, 222void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
225 unsigned long psr) 223 unsigned long psr)
226{ 224{
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index 4ced92f05358..fb6640ec8557 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -43,8 +43,10 @@
43#include <asm/prom.h> 43#include <asm/prom.h>
44#include <asm/memctrl.h> 44#include <asm/memctrl.h>
45#include <asm/cacheflush.h> 45#include <asm/cacheflush.h>
46#include <asm/setup.h>
46 47
47#include "entry.h" 48#include "entry.h"
49#include "kernel.h"
48#include "kstack.h" 50#include "kstack.h"
49 51
50/* When an irrecoverable trap occurs at tl > 0, the trap entry 52/* When an irrecoverable trap occurs at tl > 0, the trap entry
@@ -2209,8 +2211,6 @@ out:
2209 exception_exit(prev_state); 2211 exception_exit(prev_state);
2210} 2212}
2211 2213
2212extern int do_mathemu(struct pt_regs *, struct fpustate *, bool);
2213
2214void do_fpother(struct pt_regs *regs) 2214void do_fpother(struct pt_regs *regs)
2215{ 2215{
2216 enum ctx_state prev_state = exception_enter(); 2216 enum ctx_state prev_state = exception_enter();
@@ -2383,7 +2383,7 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2383 return (struct reg_window *) (fp + STACK_BIAS); 2383 return (struct reg_window *) (fp + STACK_BIAS);
2384} 2384}
2385 2385
2386void die_if_kernel(char *str, struct pt_regs *regs) 2386void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
2387{ 2387{
2388 static int die_counter; 2388 static int die_counter;
2389 int count = 0; 2389 int count = 0;
@@ -2433,9 +2433,6 @@ EXPORT_SYMBOL(die_if_kernel);
2433#define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19)) 2433#define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19))
2434#define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19)) 2434#define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19))
2435 2435
2436extern int handle_popc(u32 insn, struct pt_regs *regs);
2437extern int handle_ldf_stq(u32 insn, struct pt_regs *regs);
2438
2439void do_illegal_instruction(struct pt_regs *regs) 2436void do_illegal_instruction(struct pt_regs *regs)
2440{ 2437{
2441 enum ctx_state prev_state = exception_enter(); 2438 enum ctx_state prev_state = exception_enter();
@@ -2486,8 +2483,6 @@ out:
2486 exception_exit(prev_state); 2483 exception_exit(prev_state);
2487} 2484}
2488 2485
2489extern void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
2490
2491void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) 2486void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)
2492{ 2487{
2493 enum ctx_state prev_state = exception_enter(); 2488 enum ctx_state prev_state = exception_enter();
diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c
index c0ec89786193..c5c61b3c6b56 100644
--- a/arch/sparc/kernel/unaligned_32.c
+++ b/arch/sparc/kernel/unaligned_32.c
@@ -16,6 +16,10 @@
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/perf_event.h> 17#include <linux/perf_event.h>
18 18
19#include <asm/setup.h>
20
21#include "kernel.h"
22
19enum direction { 23enum direction {
20 load, /* ld, ldd, ldh, ldsh */ 24 load, /* ld, ldd, ldh, ldsh */
21 store, /* st, std, sth, stsh */ 25 store, /* st, std, sth, stsh */
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index 35ab8b60d256..62098a89bbbf 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -24,8 +24,10 @@
24#include <linux/context_tracking.h> 24#include <linux/context_tracking.h>
25#include <asm/fpumacro.h> 25#include <asm/fpumacro.h>
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/setup.h>
27 28
28#include "entry.h" 29#include "entry.h"
30#include "kernel.h"
29 31
30enum direction { 32enum direction {
31 load, /* ld, ldd, ldh, ldsh */ 33 load, /* ld, ldd, ldh, ldsh */
diff --git a/arch/sparc/kernel/windows.c b/arch/sparc/kernel/windows.c
index 3107381e576d..87bab0a3857a 100644
--- a/arch/sparc/kernel/windows.c
+++ b/arch/sparc/kernel/windows.c
@@ -10,8 +10,11 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/smp.h> 11#include <linux/smp.h>
12 12
13#include <asm/cacheflush.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14 15
16#include "kernel.h"
17
15/* Do save's until all user register windows are out of the cpu. */ 18/* Do save's until all user register windows are out of the cpu. */
16void flush_user_windows(void) 19void flush_user_windows(void)
17{ 20{
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index dbe119b63b48..3269b0234093 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -41,7 +41,7 @@ lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o
41lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o 41lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o
42lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o 42lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o
43 43
44obj-y += iomap.o 44obj-$(CONFIG_SPARC64) += iomap.o
45obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o 45obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o
46obj-y += ksyms.o 46obj-y += ksyms.o
47obj-$(CONFIG_SPARC64) += PeeCeeI.o 47obj-$(CONFIG_SPARC64) += PeeCeeI.o
diff --git a/arch/sparc/math-emu/sfp-util_32.h b/arch/sparc/math-emu/sfp-util_32.h
index d1b2aff3c259..bb587d5f3d9d 100644
--- a/arch/sparc/math-emu/sfp-util_32.h
+++ b/arch/sparc/math-emu/sfp-util_32.h
@@ -4,20 +4,20 @@
4#include <asm/byteorder.h> 4#include <asm/byteorder.h>
5 5
6#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ 6#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
7 __asm__ ("addcc %r4,%5,%1\n\t" \ 7 __asm__ ("addcc %r4,%5,%1\n\t" \
8 "addx %r2,%3,%0\n" \ 8 "addx %r2,%3,%0\n" \
9 : "=r" ((USItype)(sh)), \ 9 : "=r" (sh), \
10 "=&r" ((USItype)(sl)) \ 10 "=&r" (sl) \
11 : "%rJ" ((USItype)(ah)), \ 11 : "%rJ" ((USItype)(ah)), \
12 "rI" ((USItype)(bh)), \ 12 "rI" ((USItype)(bh)), \
13 "%rJ" ((USItype)(al)), \ 13 "%rJ" ((USItype)(al)), \
14 "rI" ((USItype)(bl)) \ 14 "rI" ((USItype)(bl)) \
15 : "cc") 15 : "cc")
16#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ 16#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
17 __asm__ ("subcc %r4,%5,%1\n\t" \ 17 __asm__ ("subcc %r4,%5,%1\n\t" \
18 "subx %r2,%3,%0\n" \ 18 "subx %r2,%3,%0\n" \
19 : "=r" ((USItype)(sh)), \ 19 : "=r" (sh), \
20 "=&r" ((USItype)(sl)) \ 20 "=&r" (sl) \
21 : "rJ" ((USItype)(ah)), \ 21 : "rJ" ((USItype)(ah)), \
22 "rI" ((USItype)(bh)), \ 22 "rI" ((USItype)(bh)), \
23 "rJ" ((USItype)(al)), \ 23 "rJ" ((USItype)(al)), \
@@ -65,8 +65,8 @@
65 "mulscc %%g1,0,%%g1\n\t" \ 65 "mulscc %%g1,0,%%g1\n\t" \
66 "add %%g1,%%g2,%0\n\t" \ 66 "add %%g1,%%g2,%0\n\t" \
67 "rd %%y,%1\n" \ 67 "rd %%y,%1\n" \
68 : "=r" ((USItype)(w1)), \ 68 : "=r" (w1), \
69 "=r" ((USItype)(w0)) \ 69 "=r" (w0) \
70 : "%rI" ((USItype)(u)), \ 70 : "%rI" ((USItype)(u)), \
71 "r" ((USItype)(v)) \ 71 "r" ((USItype)(v)) \
72 : "%g1", "%g2", "cc") 72 : "%g1", "%g2", "cc")
@@ -98,8 +98,8 @@
98 "sub %1,%2,%1\n\t" \ 98 "sub %1,%2,%1\n\t" \
99 "3: xnor %0,0,%0\n\t" \ 99 "3: xnor %0,0,%0\n\t" \
100 "! End of inline udiv_qrnnd\n" \ 100 "! End of inline udiv_qrnnd\n" \
101 : "=&r" ((USItype)(q)), \ 101 : "=&r" (q), \
102 "=&r" ((USItype)(r)) \ 102 "=&r" (r) \
103 : "r" ((USItype)(d)), \ 103 : "r" ((USItype)(d)), \
104 "1" ((USItype)(n1)), \ 104 "1" ((USItype)(n1)), \
105 "0" ((USItype)(n0)) : "%g1", "cc") 105 "0" ((USItype)(n0)) : "%g1", "cc")
diff --git a/arch/sparc/math-emu/sfp-util_64.h b/arch/sparc/math-emu/sfp-util_64.h
index 425d3cf01af4..51320a861cc2 100644
--- a/arch/sparc/math-emu/sfp-util_64.h
+++ b/arch/sparc/math-emu/sfp-util_64.h
@@ -17,8 +17,8 @@
17 "bcs,a,pn %%xcc, 1f\n\t" \ 17 "bcs,a,pn %%xcc, 1f\n\t" \
18 "add %0, 1, %0\n" \ 18 "add %0, 1, %0\n" \
19 "1:" \ 19 "1:" \
20 : "=r" ((UDItype)(sh)), \ 20 : "=r" (sh), \
21 "=&r" ((UDItype)(sl)) \ 21 "=&r" (sl) \
22 : "r" ((UDItype)(ah)), \ 22 : "r" ((UDItype)(ah)), \
23 "r" ((UDItype)(bh)), \ 23 "r" ((UDItype)(bh)), \
24 "r" ((UDItype)(al)), \ 24 "r" ((UDItype)(al)), \
@@ -31,8 +31,8 @@
31 "bcs,a,pn %%xcc, 1f\n\t" \ 31 "bcs,a,pn %%xcc, 1f\n\t" \
32 "sub %0, 1, %0\n" \ 32 "sub %0, 1, %0\n" \
33 "1:" \ 33 "1:" \
34 : "=r" ((UDItype)(sh)), \ 34 : "=r" (sh), \
35 "=&r" ((UDItype)(sl)) \ 35 "=&r" (sl) \
36 : "r" ((UDItype)(ah)), \ 36 : "r" ((UDItype)(ah)), \
37 "r" ((UDItype)(bh)), \ 37 "r" ((UDItype)(bh)), \
38 "r" ((UDItype)(al)), \ 38 "r" ((UDItype)(al)), \
@@ -64,8 +64,8 @@
64 "sllx %3,32,%3\n\t" \ 64 "sllx %3,32,%3\n\t" \
65 "add %1,%3,%1\n\t" \ 65 "add %1,%3,%1\n\t" \
66 "add %5,%2,%0" \ 66 "add %5,%2,%0" \
67 : "=r" ((UDItype)(wh)), \ 67 : "=r" (wh), \
68 "=&r" ((UDItype)(wl)), \ 68 "=&r" (wl), \
69 "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ 69 "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \
70 : "r" ((UDItype)(u)), \ 70 : "r" ((UDItype)(u)), \
71 "r" ((UDItype)(v)) \ 71 "r" ((UDItype)(v)) \
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
index 59dbd4645725..908e8c17c902 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -26,14 +26,14 @@
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/openprom.h> 27#include <asm/openprom.h>
28#include <asm/oplib.h> 28#include <asm/oplib.h>
29#include <asm/setup.h>
29#include <asm/smp.h> 30#include <asm/smp.h>
30#include <asm/traps.h> 31#include <asm/traps.h>
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
32 33
33int show_unhandled_signals = 1; 34#include "mm_32.h"
34 35
35static void unhandled_fault(unsigned long, struct task_struct *, 36int show_unhandled_signals = 1;
36 struct pt_regs *) __attribute__ ((noreturn));
37 37
38static void __noreturn unhandled_fault(unsigned long address, 38static void __noreturn unhandled_fault(unsigned long address,
39 struct task_struct *tsk, 39 struct task_struct *tsk,
@@ -141,9 +141,6 @@ static void __do_fault_siginfo(int code, int sig, struct pt_regs *regs,
141 force_sig_info (sig, &info, current); 141 force_sig_info (sig, &info, current);
142} 142}
143 143
144extern unsigned long safe_compute_effective_address(struct pt_regs *,
145 unsigned int);
146
147static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault) 144static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)
148{ 145{
149 unsigned int insn; 146 unsigned int insn;
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 4ced3fc66130..587cd0565128 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -32,6 +32,7 @@
32#include <asm/lsu.h> 32#include <asm/lsu.h>
33#include <asm/sections.h> 33#include <asm/sections.h>
34#include <asm/mmu_context.h> 34#include <asm/mmu_context.h>
35#include <asm/setup.h>
35 36
36int show_unhandled_signals = 1; 37int show_unhandled_signals = 1;
37 38
@@ -196,9 +197,6 @@ static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
196 force_sig_info(sig, &info, current); 197 force_sig_info(sig, &info, current);
197} 198}
198 199
199extern int handle_ldf_stq(u32, struct pt_regs *);
200extern int handle_ld_nf(u32, struct pt_regs *);
201
202static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn) 200static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn)
203{ 201{
204 if (!insn) { 202 if (!insn) {
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index db6987082805..eb8287155279 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -31,10 +31,13 @@
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32#include <asm/vaddrs.h> 32#include <asm/vaddrs.h>
33#include <asm/pgalloc.h> /* bug in asm-generic/tlb.h: check_pgt_cache */ 33#include <asm/pgalloc.h> /* bug in asm-generic/tlb.h: check_pgt_cache */
34#include <asm/setup.h>
34#include <asm/tlb.h> 35#include <asm/tlb.h>
35#include <asm/prom.h> 36#include <asm/prom.h>
36#include <asm/leon.h> 37#include <asm/leon.h>
37 38
39#include "mm_32.h"
40
38unsigned long *sparc_valid_addr_bitmap; 41unsigned long *sparc_valid_addr_bitmap;
39EXPORT_SYMBOL(sparc_valid_addr_bitmap); 42EXPORT_SYMBOL(sparc_valid_addr_bitmap);
40 43
@@ -63,7 +66,6 @@ void show_mem(unsigned int filter)
63} 66}
64 67
65 68
66extern unsigned long cmdline_memory_size;
67unsigned long last_valid_pfn; 69unsigned long last_valid_pfn;
68 70
69unsigned long calc_highpages(void) 71unsigned long calc_highpages(void)
@@ -246,9 +248,6 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
246 * init routine based upon the Sun model type on the Sparc. 248 * init routine based upon the Sun model type on the Sparc.
247 * 249 *
248 */ 250 */
249extern void srmmu_paging_init(void);
250extern void device_scan(void);
251
252void __init paging_init(void) 251void __init paging_init(void)
253{ 252{
254 srmmu_paging_init(); 253 srmmu_paging_init();
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index ed3c969a5f4c..16b58ff11e65 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -47,6 +47,7 @@
47#include <asm/prom.h> 47#include <asm/prom.h>
48#include <asm/mdesc.h> 48#include <asm/mdesc.h>
49#include <asm/cpudata.h> 49#include <asm/cpudata.h>
50#include <asm/setup.h>
50#include <asm/irq.h> 51#include <asm/irq.h>
51 52
52#include "init_64.h" 53#include "init_64.h"
@@ -794,11 +795,11 @@ struct node_mem_mask {
794static struct node_mem_mask node_masks[MAX_NUMNODES]; 795static struct node_mem_mask node_masks[MAX_NUMNODES];
795static int num_node_masks; 796static int num_node_masks;
796 797
798#ifdef CONFIG_NEED_MULTIPLE_NODES
799
797int numa_cpu_lookup_table[NR_CPUS]; 800int numa_cpu_lookup_table[NR_CPUS];
798cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES]; 801cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES];
799 802
800#ifdef CONFIG_NEED_MULTIPLE_NODES
801
802struct mdesc_mblock { 803struct mdesc_mblock {
803 u64 base; 804 u64 base;
804 u64 size; 805 u64 size;
@@ -887,17 +888,21 @@ static void __init allocate_node_data(int nid)
887 888
888static void init_node_masks_nonnuma(void) 889static void init_node_masks_nonnuma(void)
889{ 890{
891#ifdef CONFIG_NEED_MULTIPLE_NODES
890 int i; 892 int i;
893#endif
891 894
892 numadbg("Initializing tables for non-numa.\n"); 895 numadbg("Initializing tables for non-numa.\n");
893 896
894 node_masks[0].mask = node_masks[0].val = 0; 897 node_masks[0].mask = node_masks[0].val = 0;
895 num_node_masks = 1; 898 num_node_masks = 1;
896 899
900#ifdef CONFIG_NEED_MULTIPLE_NODES
897 for (i = 0; i < NR_CPUS; i++) 901 for (i = 0; i < NR_CPUS; i++)
898 numa_cpu_lookup_table[i] = 0; 902 numa_cpu_lookup_table[i] = 0;
899 903
900 cpumask_setall(&numa_cpumask_lookup_table[0]); 904 cpumask_setall(&numa_cpumask_lookup_table[0]);
905#endif
901} 906}
902 907
903#ifdef CONFIG_NEED_MULTIPLE_NODES 908#ifdef CONFIG_NEED_MULTIPLE_NODES
diff --git a/arch/sparc/mm/init_64.h b/arch/sparc/mm/init_64.h
index 5d3782deb403..0668b364f44d 100644
--- a/arch/sparc/mm/init_64.h
+++ b/arch/sparc/mm/init_64.h
@@ -21,7 +21,7 @@ extern unsigned int sparc64_highest_unlocked_tlb_ent;
21extern unsigned long sparc64_kern_pri_context; 21extern unsigned long sparc64_kern_pri_context;
22extern unsigned long sparc64_kern_pri_nuc_bits; 22extern unsigned long sparc64_kern_pri_nuc_bits;
23extern unsigned long sparc64_kern_sec_context; 23extern unsigned long sparc64_kern_sec_context;
24extern void mmu_info(struct seq_file *m); 24void mmu_info(struct seq_file *m);
25 25
26struct linux_prom_translation { 26struct linux_prom_translation {
27 unsigned long virt; 27 unsigned long virt;
@@ -36,7 +36,7 @@ extern unsigned int prom_trans_ents;
36/* Exported for SMP bootup purposes. */ 36/* Exported for SMP bootup purposes. */
37extern unsigned long kern_locked_tte_data; 37extern unsigned long kern_locked_tte_data;
38 38
39extern void prom_world(int enter); 39void prom_world(int enter);
40 40
41#ifdef CONFIG_SPARSEMEM_VMEMMAP 41#ifdef CONFIG_SPARSEMEM_VMEMMAP
42#define VMEMMAP_CHUNK_SHIFT 22 42#define VMEMMAP_CHUNK_SHIFT 22
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index eb99862e9654..f311bf219016 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -25,6 +25,8 @@
25#include <asm/dma.h> 25#include <asm/dma.h>
26#include <asm/oplib.h> 26#include <asm/oplib.h>
27 27
28#include "mm_32.h"
29
28/* #define IOUNIT_DEBUG */ 30/* #define IOUNIT_DEBUG */
29#ifdef IOUNIT_DEBUG 31#ifdef IOUNIT_DEBUG
30#define IOD(x) printk(x) 32#define IOD(x) printk(x)
@@ -38,7 +40,8 @@
38static void __init iounit_iommu_init(struct platform_device *op) 40static void __init iounit_iommu_init(struct platform_device *op)
39{ 41{
40 struct iounit_struct *iounit; 42 struct iounit_struct *iounit;
41 iopte_t *xpt, *xptend; 43 iopte_t __iomem *xpt;
44 iopte_t __iomem *xptend;
42 45
43 iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); 46 iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC);
44 if (!iounit) { 47 if (!iounit) {
@@ -62,10 +65,10 @@ static void __init iounit_iommu_init(struct platform_device *op)
62 op->dev.archdata.iommu = iounit; 65 op->dev.archdata.iommu = iounit;
63 iounit->page_table = xpt; 66 iounit->page_table = xpt;
64 spin_lock_init(&iounit->lock); 67 spin_lock_init(&iounit->lock);
65 68
66 for (xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t); 69 xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t);
67 xpt < xptend;) 70 for (; xpt < xptend; xpt++)
68 iopte_val(*xpt++) = 0; 71 sbus_writel(0, xpt);
69} 72}
70 73
71static int __init iounit_init(void) 74static int __init iounit_init(void)
@@ -130,7 +133,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
130 vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK); 133 vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK);
131 for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) { 134 for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) {
132 set_bit(scan, iounit->bmap); 135 set_bit(scan, iounit->bmap);
133 iounit->page_table[scan] = iopte; 136 sbus_writel(iopte, &iounit->page_table[scan]);
134 } 137 }
135 IOD(("%08lx\n", vaddr)); 138 IOD(("%08lx\n", vaddr));
136 return vaddr; 139 return vaddr;
@@ -202,7 +205,7 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon
202 struct iounit_struct *iounit = dev->archdata.iommu; 205 struct iounit_struct *iounit = dev->archdata.iommu;
203 unsigned long page, end; 206 unsigned long page, end;
204 pgprot_t dvma_prot; 207 pgprot_t dvma_prot;
205 iopte_t *iopte; 208 iopte_t __iomem *iopte;
206 209
207 *pba = addr; 210 *pba = addr;
208 211
@@ -224,8 +227,8 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon
224 227
225 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); 228 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);
226 229
227 iopte = (iopte_t *)(iounit->page_table + i); 230 iopte = iounit->page_table + i;
228 *iopte = MKIOPTE(__pa(page)); 231 sbus_writel(MKIOPTE(__pa(page)), iopte);
229 } 232 }
230 addr += PAGE_SIZE; 233 addr += PAGE_SIZE;
231 va += PAGE_SIZE; 234 va += PAGE_SIZE;
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index 28f96f27c768..491511d37e37 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -27,6 +27,8 @@
27#include <asm/iommu.h> 27#include <asm/iommu.h>
28#include <asm/dma.h> 28#include <asm/dma.h>
29 29
30#include "mm_32.h"
31
30/* 32/*
31 * This can be sized dynamically, but we will do this 33 * This can be sized dynamically, but we will do this
32 * only when we have a guidance about actual I/O pressures. 34 * only when we have a guidance about actual I/O pressures.
@@ -37,9 +39,6 @@
37#define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 256KB */ 39#define IOMMU_NPTES (IOMMU_WINSIZE/PAGE_SIZE) /* 64K PTEs, 256KB */
38#define IOMMU_ORDER 6 /* 4096 * (1<<6) */ 40#define IOMMU_ORDER 6 /* 4096 * (1<<6) */
39 41
40/* srmmu.c */
41extern int viking_mxcc_present;
42extern int flush_page_for_dma_global;
43static int viking_flush; 42static int viking_flush;
44/* viking.S */ 43/* viking.S */
45extern void viking_flush_page(unsigned long page); 44extern void viking_flush_page(unsigned long page);
@@ -59,6 +58,8 @@ static void __init sbus_iommu_init(struct platform_device *op)
59 struct iommu_struct *iommu; 58 struct iommu_struct *iommu;
60 unsigned int impl, vers; 59 unsigned int impl, vers;
61 unsigned long *bitmap; 60 unsigned long *bitmap;
61 unsigned long control;
62 unsigned long base;
62 unsigned long tmp; 63 unsigned long tmp;
63 64
64 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); 65 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL);
@@ -73,12 +74,14 @@ static void __init sbus_iommu_init(struct platform_device *op)
73 prom_printf("Cannot map IOMMU registers\n"); 74 prom_printf("Cannot map IOMMU registers\n");
74 prom_halt(); 75 prom_halt();
75 } 76 }
76 impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28; 77
77 vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24; 78 control = sbus_readl(&iommu->regs->control);
78 tmp = iommu->regs->control; 79 impl = (control & IOMMU_CTRL_IMPL) >> 28;
79 tmp &= ~(IOMMU_CTRL_RNGE); 80 vers = (control & IOMMU_CTRL_VERS) >> 24;
80 tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); 81 control &= ~(IOMMU_CTRL_RNGE);
81 iommu->regs->control = tmp; 82 control |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB);
83 sbus_writel(control, &iommu->regs->control);
84
82 iommu_invalidate(iommu->regs); 85 iommu_invalidate(iommu->regs);
83 iommu->start = IOMMU_START; 86 iommu->start = IOMMU_START;
84 iommu->end = 0xffffffff; 87 iommu->end = 0xffffffff;
@@ -100,7 +103,9 @@ static void __init sbus_iommu_init(struct platform_device *op)
100 memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); 103 memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t));
101 flush_cache_all(); 104 flush_cache_all();
102 flush_tlb_all(); 105 flush_tlb_all();
103 iommu->regs->base = __pa((unsigned long) iommu->page_table) >> 4; 106
107 base = __pa((unsigned long)iommu->page_table) >> 4;
108 sbus_writel(base, &iommu->regs->base);
104 iommu_invalidate(iommu->regs); 109 iommu_invalidate(iommu->regs);
105 110
106 bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); 111 bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL);
diff --git a/arch/sparc/mm/leon_mm.c b/arch/sparc/mm/leon_mm.c
index 5bed085a2c17..3b17b6f7895a 100644
--- a/arch/sparc/mm/leon_mm.c
+++ b/arch/sparc/mm/leon_mm.c
@@ -15,10 +15,10 @@
15#include <asm/leon.h> 15#include <asm/leon.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17 17
18#include "srmmu.h" 18#include "mm_32.h"
19 19
20int leon_flush_during_switch = 1; 20int leon_flush_during_switch = 1;
21int srmmu_swprobe_trace; 21static int srmmu_swprobe_trace;
22 22
23static inline unsigned long leon_get_ctable_ptr(void) 23static inline unsigned long leon_get_ctable_ptr(void)
24{ 24{
diff --git a/arch/sparc/mm/mm_32.h b/arch/sparc/mm/mm_32.h
new file mode 100644
index 000000000000..a6c27ca9a721
--- /dev/null
+++ b/arch/sparc/mm/mm_32.h
@@ -0,0 +1,24 @@
1/* fault_32.c - visible as they are called from assembler */
2asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
3 unsigned long address);
4asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
5 unsigned long address);
6
7void window_overflow_fault(void);
8void window_underflow_fault(unsigned long sp);
9void window_ret_fault(struct pt_regs *regs);
10
11/* srmmu.c */
12extern char *srmmu_name;
13extern int viking_mxcc_present;
14extern int flush_page_for_dma_global;
15
16extern void (*poke_srmmu)(void);
17
18void __init srmmu_paging_init(void);
19
20/* iommu.c */
21void ld_mmu_iommu(void);
22
23/* io-unit.c */
24void ld_mmu_iounit(void);
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index cfbe53c17b0d..be65f035d18a 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -49,7 +49,7 @@
49#include <asm/mxcc.h> 49#include <asm/mxcc.h>
50#include <asm/ross.h> 50#include <asm/ross.h>
51 51
52#include "srmmu.h" 52#include "mm_32.h"
53 53
54enum mbus_module srmmu_modtype; 54enum mbus_module srmmu_modtype;
55static unsigned int hwbug_bitmask; 55static unsigned int hwbug_bitmask;
@@ -100,7 +100,6 @@ static unsigned long srmmu_nocache_end;
100#define SRMMU_NOCACHE_ALIGN_MAX (sizeof(ctxd_t)*SRMMU_MAX_CONTEXTS) 100#define SRMMU_NOCACHE_ALIGN_MAX (sizeof(ctxd_t)*SRMMU_MAX_CONTEXTS)
101 101
102void *srmmu_nocache_pool; 102void *srmmu_nocache_pool;
103void *srmmu_nocache_bitmap;
104static struct bit_map srmmu_nocache_map; 103static struct bit_map srmmu_nocache_map;
105 104
106static inline int srmmu_pmd_none(pmd_t pmd) 105static inline int srmmu_pmd_none(pmd_t pmd)
@@ -173,7 +172,7 @@ static void *__srmmu_get_nocache(int size, int align)
173 printk(KERN_ERR "srmmu: out of nocache %d: %d/%d\n", 172 printk(KERN_ERR "srmmu: out of nocache %d: %d/%d\n",
174 size, (int) srmmu_nocache_size, 173 size, (int) srmmu_nocache_size,
175 srmmu_nocache_map.used << SRMMU_NOCACHE_BITMAP_SHIFT); 174 srmmu_nocache_map.used << SRMMU_NOCACHE_BITMAP_SHIFT);
176 return 0; 175 return NULL;
177 } 176 }
178 177
179 addr = SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT); 178 addr = SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT);
@@ -269,6 +268,7 @@ static void __init srmmu_nocache_calcsize(void)
269 268
270static void __init srmmu_nocache_init(void) 269static void __init srmmu_nocache_init(void)
271{ 270{
271 void *srmmu_nocache_bitmap;
272 unsigned int bitmap_bits; 272 unsigned int bitmap_bits;
273 pgd_t *pgd; 273 pgd_t *pgd;
274 pmd_t *pmd; 274 pmd_t *pmd;
@@ -728,7 +728,7 @@ static inline unsigned long srmmu_probe(unsigned long vaddr)
728 "=r" (retval) : 728 "=r" (retval) :
729 "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE)); 729 "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE));
730 } else { 730 } else {
731 retval = leon_swprobe(vaddr, 0); 731 retval = leon_swprobe(vaddr, NULL);
732 } 732 }
733 return retval; 733 return retval;
734} 734}
@@ -865,8 +865,6 @@ static void __init map_kernel(void)
865 865
866void (*poke_srmmu)(void) = NULL; 866void (*poke_srmmu)(void) = NULL;
867 867
868extern unsigned long bootmem_init(unsigned long *pages_avail);
869
870void __init srmmu_paging_init(void) 868void __init srmmu_paging_init(void)
871{ 869{
872 int i; 870 int i;
@@ -1771,9 +1769,6 @@ static struct sparc32_cachetlb_ops smp_cachetlb_ops = {
1771/* Load up routines and constants for sun4m and sun4d mmu */ 1769/* Load up routines and constants for sun4m and sun4d mmu */
1772void __init load_mmu(void) 1770void __init load_mmu(void)
1773{ 1771{
1774 extern void ld_mmu_iommu(void);
1775 extern void ld_mmu_iounit(void);
1776
1777 /* Functions */ 1772 /* Functions */
1778 get_srmmu_type(); 1773 get_srmmu_type();
1779 1774
diff --git a/arch/sparc/mm/srmmu.h b/arch/sparc/mm/srmmu.h
deleted file mode 100644
index 5703274ccf89..000000000000
--- a/arch/sparc/mm/srmmu.h
+++ /dev/null
@@ -1,4 +0,0 @@
1/* srmmu.c */
2extern char *srmmu_name;
3
4extern void (*poke_srmmu)(void);
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
index fe19b81acc09..a06576683c38 100644
--- a/arch/sparc/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -9,6 +9,7 @@
9#include <asm/page.h> 9#include <asm/page.h>
10#include <asm/pgtable.h> 10#include <asm/pgtable.h>
11#include <asm/mmu_context.h> 11#include <asm/mmu_context.h>
12#include <asm/setup.h>
12#include <asm/tsb.h> 13#include <asm/tsb.h>
13#include <asm/tlb.h> 14#include <asm/tlb.h>
14#include <asm/oplib.h> 15#include <asm/oplib.h>
diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c
index f178b9dcc7b7..53a696d3eb3b 100644
--- a/arch/sparc/prom/misc_64.c
+++ b/arch/sparc/prom/misc_64.c
@@ -81,11 +81,6 @@ void prom_feval(const char *fstring)
81} 81}
82EXPORT_SYMBOL(prom_feval); 82EXPORT_SYMBOL(prom_feval);
83 83
84#ifdef CONFIG_SMP
85extern void smp_capture(void);
86extern void smp_release(void);
87#endif
88
89/* Drop into the prom, with the chance to continue with the 'go' 84/* Drop into the prom, with the chance to continue with the 'go'
90 * prom command. 85 * prom command.
91 */ 86 */
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index aafad6fa1667..928237a7b9ca 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -51,9 +51,6 @@ config ARCH_HAS_ILOG2_U32
51config ARCH_HAS_ILOG2_U64 51config ARCH_HAS_ILOG2_U64
52 bool 52 bool
53 53
54config ARCH_HAS_CPUFREQ
55 bool
56
57config GENERIC_HWEIGHT 54config GENERIC_HWEIGHT
58 def_bool y 55 def_bool y
59 56
@@ -87,7 +84,6 @@ config ARCH_PUV3
87 select GENERIC_CLOCKEVENTS 84 select GENERIC_CLOCKEVENTS
88 select HAVE_CLK 85 select HAVE_CLK
89 select ARCH_REQUIRE_GPIOLIB 86 select ARCH_REQUIRE_GPIOLIB
90 select ARCH_HAS_CPUFREQ
91 87
92# CONFIGs for ARCH_PUV3 88# CONFIGs for ARCH_PUV3
93 89
@@ -198,9 +194,7 @@ menu "Power management options"
198 194
199source "kernel/power/Kconfig" 195source "kernel/power/Kconfig"
200 196
201if ARCH_HAS_CPUFREQ
202source "drivers/cpufreq/Kconfig" 197source "drivers/cpufreq/Kconfig"
203endif
204 198
205config ARCH_SUSPEND_POSSIBLE 199config ARCH_SUSPEND_POSSIBLE
206 def_bool y if !ARCH_FPGA 200 def_bool y if !ARCH_FPGA
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h
index 39decb6e6f57..cb1d8fd2b16b 100644
--- a/arch/unicore32/include/asm/io.h
+++ b/arch/unicore32/include/asm/io.h
@@ -39,10 +39,37 @@ extern void __uc32_iounmap(volatile void __iomem *addr);
39#define ioremap_nocache(cookie, size) __uc32_ioremap(cookie, size) 39#define ioremap_nocache(cookie, size) __uc32_ioremap(cookie, size)
40#define iounmap(cookie) __uc32_iounmap(cookie) 40#define iounmap(cookie) __uc32_iounmap(cookie)
41 41
42#define readb_relaxed readb
43#define readw_relaxed readw
44#define readl_relaxed readl
45
42#define HAVE_ARCH_PIO_SIZE 46#define HAVE_ARCH_PIO_SIZE
43#define PIO_OFFSET (unsigned int)(PCI_IOBASE) 47#define PIO_OFFSET (unsigned int)(PCI_IOBASE)
44#define PIO_MASK (unsigned int)(IO_SPACE_LIMIT) 48#define PIO_MASK (unsigned int)(IO_SPACE_LIMIT)
45#define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1) 49#define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1)
46 50
51#ifdef CONFIG_STRICT_DEVMEM
52
53#include <linux/ioport.h>
54#include <linux/mm.h>
55
56/*
57 * devmem_is_allowed() checks to see if /dev/mem access to a certain
58 * address is valid. The argument is a physical page number.
59 * We mimic x86 here by disallowing access to system RAM as well as
60 * device-exclusive MMIO regions. This effectively disable read()/write()
61 * on /dev/mem.
62 */
63static inline int devmem_is_allowed(unsigned long pfn)
64{
65 if (iomem_is_exclusive(pfn << PAGE_SHIFT))
66 return 0;
67 if (!page_is_ram(pfn))
68 return 1;
69 return 0;
70}
71
72#endif /* CONFIG_STRICT_DEVMEM */
73
47#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
48#endif /* __UNICORE_IO_H__ */ 75#endif /* __UNICORE_IO_H__ */
diff --git a/arch/unicore32/include/asm/pgtable.h b/arch/unicore32/include/asm/pgtable.h
index 233c25880df4..ed6f7d000fba 100644
--- a/arch/unicore32/include/asm/pgtable.h
+++ b/arch/unicore32/include/asm/pgtable.h
@@ -87,16 +87,16 @@ extern pgprot_t pgprot_kernel;
87 87
88#define PAGE_NONE pgprot_user 88#define PAGE_NONE pgprot_user
89#define PAGE_SHARED __pgprot(pgprot_val(pgprot_user | PTE_READ \ 89#define PAGE_SHARED __pgprot(pgprot_val(pgprot_user | PTE_READ \
90 | PTE_WRITE) 90 | PTE_WRITE))
91#define PAGE_SHARED_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ 91#define PAGE_SHARED_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \
92 | PTE_WRITE \ 92 | PTE_WRITE \
93 | PTE_EXEC) 93 | PTE_EXEC))
94#define PAGE_COPY __pgprot(pgprot_val(pgprot_user | PTE_READ) 94#define PAGE_COPY __pgprot(pgprot_val(pgprot_user | PTE_READ)
95#define PAGE_COPY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ 95#define PAGE_COPY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \
96 | PTE_EXEC) 96 | PTE_EXEC))
97#define PAGE_READONLY __pgprot(pgprot_val(pgprot_user | PTE_READ) 97#define PAGE_READONLY __pgprot(pgprot_val(pgprot_user | PTE_READ))
98#define PAGE_READONLY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \ 98#define PAGE_READONLY_EXEC __pgprot(pgprot_val(pgprot_user | PTE_READ \
99 | PTE_EXEC) 99 | PTE_EXEC))
100#define PAGE_KERNEL pgprot_kernel 100#define PAGE_KERNEL pgprot_kernel
101#define PAGE_KERNEL_EXEC __pgprot(pgprot_val(pgprot_kernel | PTE_EXEC)) 101#define PAGE_KERNEL_EXEC __pgprot(pgprot_val(pgprot_kernel | PTE_EXEC))
102 102
diff --git a/arch/unicore32/include/asm/ptrace.h b/arch/unicore32/include/asm/ptrace.h
index 9df53d991c78..02bf5a415bf5 100644
--- a/arch/unicore32/include/asm/ptrace.h
+++ b/arch/unicore32/include/asm/ptrace.h
@@ -55,6 +55,7 @@ static inline int valid_user_regs(struct pt_regs *regs)
55 55
56#define instruction_pointer(regs) ((regs)->UCreg_pc) 56#define instruction_pointer(regs) ((regs)->UCreg_pc)
57#define user_stack_pointer(regs) ((regs)->UCreg_sp) 57#define user_stack_pointer(regs) ((regs)->UCreg_sp)
58#define profile_pc(regs) instruction_pointer(regs)
58 59
59#endif /* __ASSEMBLY__ */ 60#endif /* __ASSEMBLY__ */
60#endif 61#endif
diff --git a/arch/unicore32/kernel/clock.c b/arch/unicore32/kernel/clock.c
index 18d4563e6fa5..b1ca775f6f6e 100644
--- a/arch/unicore32/kernel/clock.c
+++ b/arch/unicore32/kernel/clock.c
@@ -179,7 +179,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
179 } 179 }
180#ifdef CONFIG_CPU_FREQ 180#ifdef CONFIG_CPU_FREQ
181 if (clk == &clk_mclk_clk) { 181 if (clk == &clk_mclk_clk) {
182 u32 pll_rate, divstatus = PM_DIVSTATUS; 182 u32 pll_rate, divstatus = readl(PM_DIVSTATUS);
183 int ret, i; 183 int ret, i;
184 184
185 /* lookup mclk_clk_table */ 185 /* lookup mclk_clk_table */
@@ -201,10 +201,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
201 / (((divstatus & 0x0000f000) >> 12) + 1); 201 / (((divstatus & 0x0000f000) >> 12) + 1);
202 202
203 /* set pll sys cfg reg. */ 203 /* set pll sys cfg reg. */
204 PM_PLLSYSCFG = pll_rate; 204 writel(pll_rate, PM_PLLSYSCFG);
205 205
206 PM_PMCR = PM_PMCR_CFBSYS; 206 writel(PM_PMCR_CFBSYS, PM_PMCR);
207 while ((PM_PLLDFCDONE & PM_PLLDFCDONE_SYSDFC) 207 while ((readl(PM_PLLDFCDONE) & PM_PLLDFCDONE_SYSDFC)
208 != PM_PLLDFCDONE_SYSDFC) 208 != PM_PLLDFCDONE_SYSDFC)
209 udelay(100); 209 udelay(100);
210 /* about 1ms */ 210 /* about 1ms */
diff --git a/arch/unicore32/kernel/ksyms.c b/arch/unicore32/kernel/ksyms.c
index d285d71cbe35..0323528a80fd 100644
--- a/arch/unicore32/kernel/ksyms.c
+++ b/arch/unicore32/kernel/ksyms.c
@@ -23,41 +23,15 @@
23 23
24#include "ksyms.h" 24#include "ksyms.h"
25 25
26EXPORT_SYMBOL(find_first_bit);
27EXPORT_SYMBOL(find_first_zero_bit);
26EXPORT_SYMBOL(find_next_zero_bit); 28EXPORT_SYMBOL(find_next_zero_bit);
27EXPORT_SYMBOL(find_next_bit); 29EXPORT_SYMBOL(find_next_bit);
28 30
29EXPORT_SYMBOL(__backtrace);
30
31 /* platform dependent support */ 31 /* platform dependent support */
32EXPORT_SYMBOL(__udelay); 32EXPORT_SYMBOL(__udelay);
33EXPORT_SYMBOL(__const_udelay); 33EXPORT_SYMBOL(__const_udelay);
34 34
35 /* networking */
36EXPORT_SYMBOL(csum_partial);
37EXPORT_SYMBOL(csum_partial_copy_from_user);
38EXPORT_SYMBOL(csum_partial_copy_nocheck);
39EXPORT_SYMBOL(__csum_ipv6_magic);
40
41 /* io */
42#ifndef __raw_readsb
43EXPORT_SYMBOL(__raw_readsb);
44#endif
45#ifndef __raw_readsw
46EXPORT_SYMBOL(__raw_readsw);
47#endif
48#ifndef __raw_readsl
49EXPORT_SYMBOL(__raw_readsl);
50#endif
51#ifndef __raw_writesb
52EXPORT_SYMBOL(__raw_writesb);
53#endif
54#ifndef __raw_writesw
55EXPORT_SYMBOL(__raw_writesw);
56#endif
57#ifndef __raw_writesl
58EXPORT_SYMBOL(__raw_writesl);
59#endif
60
61 /* string / mem functions */ 35 /* string / mem functions */
62EXPORT_SYMBOL(strchr); 36EXPORT_SYMBOL(strchr);
63EXPORT_SYMBOL(strrchr); 37EXPORT_SYMBOL(strrchr);
@@ -76,23 +50,12 @@ EXPORT_SYMBOL(__copy_from_user);
76EXPORT_SYMBOL(__copy_to_user); 50EXPORT_SYMBOL(__copy_to_user);
77EXPORT_SYMBOL(__clear_user); 51EXPORT_SYMBOL(__clear_user);
78 52
79EXPORT_SYMBOL(__get_user_1);
80EXPORT_SYMBOL(__get_user_2);
81EXPORT_SYMBOL(__get_user_4);
82
83EXPORT_SYMBOL(__put_user_1);
84EXPORT_SYMBOL(__put_user_2);
85EXPORT_SYMBOL(__put_user_4);
86EXPORT_SYMBOL(__put_user_8);
87
88EXPORT_SYMBOL(__ashldi3); 53EXPORT_SYMBOL(__ashldi3);
89EXPORT_SYMBOL(__ashrdi3); 54EXPORT_SYMBOL(__ashrdi3);
90EXPORT_SYMBOL(__divsi3); 55EXPORT_SYMBOL(__divsi3);
91EXPORT_SYMBOL(__lshrdi3); 56EXPORT_SYMBOL(__lshrdi3);
92EXPORT_SYMBOL(__modsi3); 57EXPORT_SYMBOL(__modsi3);
93EXPORT_SYMBOL(__muldi3);
94EXPORT_SYMBOL(__ucmpdi2); 58EXPORT_SYMBOL(__ucmpdi2);
95EXPORT_SYMBOL(__udivsi3); 59EXPORT_SYMBOL(__udivsi3);
96EXPORT_SYMBOL(__umodsi3); 60EXPORT_SYMBOL(__umodsi3);
97EXPORT_SYMBOL(__bswapsi2);
98 61
diff --git a/arch/unicore32/kernel/ksyms.h b/arch/unicore32/kernel/ksyms.h
index 185cdc712d03..31472ad9467a 100644
--- a/arch/unicore32/kernel/ksyms.h
+++ b/arch/unicore32/kernel/ksyms.h
@@ -8,8 +8,6 @@ extern void __ashrdi3(void);
8extern void __divsi3(void); 8extern void __divsi3(void);
9extern void __lshrdi3(void); 9extern void __lshrdi3(void);
10extern void __modsi3(void); 10extern void __modsi3(void);
11extern void __muldi3(void);
12extern void __ucmpdi2(void); 11extern void __ucmpdi2(void);
13extern void __udivsi3(void); 12extern void __udivsi3(void);
14extern void __umodsi3(void); 13extern void __umodsi3(void);
15extern void __bswapsi2(void);
diff --git a/arch/unicore32/kernel/module.c b/arch/unicore32/kernel/module.c
index 16bd1495b934..dc41f6dfedb6 100644
--- a/arch/unicore32/kernel/module.c
+++ b/arch/unicore32/kernel/module.c
@@ -24,14 +24,9 @@
24 24
25void *module_alloc(unsigned long size) 25void *module_alloc(unsigned long size)
26{ 26{
27 struct vm_struct *area; 27 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
28 28 GFP_KERNEL, PAGE_KERNEL_EXEC, NUMA_NO_NODE,
29 size = PAGE_ALIGN(size); 29 __builtin_return_address(0));
30 area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
31 if (!area)
32 return NULL;
33
34 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL_EXEC);
35} 30}
36 31
37int 32int
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index 778ebba80827..b008e9961465 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -60,6 +60,7 @@ void machine_halt(void)
60 * Function pointers to optional machine specific functions 60 * Function pointers to optional machine specific functions
61 */ 61 */
62void (*pm_power_off)(void) = NULL; 62void (*pm_power_off)(void) = NULL;
63EXPORT_SYMBOL(pm_power_off);
63 64
64void machine_power_off(void) 65void machine_power_off(void)
65{ 66{
diff --git a/arch/unicore32/kernel/setup.c b/arch/unicore32/kernel/setup.c
index 87adbf5ebfe0..3fa317f96122 100644
--- a/arch/unicore32/kernel/setup.c
+++ b/arch/unicore32/kernel/setup.c
@@ -53,6 +53,10 @@ struct stack {
53 53
54static struct stack stacks[NR_CPUS]; 54static struct stack stacks[NR_CPUS];
55 55
56#ifdef CONFIG_VGA_CONSOLE
57struct screen_info screen_info;
58#endif
59
56char elf_platform[ELF_PLATFORM_SIZE]; 60char elf_platform[ELF_PLATFORM_SIZE];
57EXPORT_SYMBOL(elf_platform); 61EXPORT_SYMBOL(elf_platform);
58 62
diff --git a/arch/unicore32/mm/alignment.c b/arch/unicore32/mm/alignment.c
index de7dc5fdd58b..24e836023e6c 100644
--- a/arch/unicore32/mm/alignment.c
+++ b/arch/unicore32/mm/alignment.c
@@ -21,6 +21,7 @@
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/uaccess.h> 22#include <linux/uaccess.h>
23 23
24#include <asm/pgtable.h>
24#include <asm/tlbflush.h> 25#include <asm/tlbflush.h>
25#include <asm/unaligned.h> 26#include <asm/unaligned.h>
26 27
diff --git a/arch/unicore32/mm/proc-syms.c b/arch/unicore32/mm/proc-syms.c
index f30071e3665d..21c00fc85c99 100644
--- a/arch/unicore32/mm/proc-syms.c
+++ b/arch/unicore32/mm/proc-syms.c
@@ -19,5 +19,7 @@
19EXPORT_SYMBOL(cpu_dcache_clean_area); 19EXPORT_SYMBOL(cpu_dcache_clean_area);
20EXPORT_SYMBOL(cpu_set_pte); 20EXPORT_SYMBOL(cpu_set_pte);
21 21
22EXPORT_SYMBOL(__cpuc_coherent_kern_range);
23
22EXPORT_SYMBOL(__cpuc_dma_flush_range); 24EXPORT_SYMBOL(__cpuc_dma_flush_range);
23EXPORT_SYMBOL(__cpuc_dma_clean_range); 25EXPORT_SYMBOL(__cpuc_dma_clean_range);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fcefdda5136d..a8f749ef0fdc 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1672,7 +1672,6 @@ config RELOCATABLE
1672config RANDOMIZE_BASE 1672config RANDOMIZE_BASE
1673 bool "Randomize the address of the kernel image" 1673 bool "Randomize the address of the kernel image"
1674 depends on RELOCATABLE 1674 depends on RELOCATABLE
1675 depends on !HIBERNATION
1676 default n 1675 default n
1677 ---help--- 1676 ---help---
1678 Randomizes the physical and virtual address at which the 1677 Randomizes the physical and virtual address at which the
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c
index 4dbf967da50d..fc6091abedb7 100644
--- a/arch/x86/boot/compressed/aslr.c
+++ b/arch/x86/boot/compressed/aslr.c
@@ -289,10 +289,17 @@ unsigned char *choose_kernel_location(unsigned char *input,
289 unsigned long choice = (unsigned long)output; 289 unsigned long choice = (unsigned long)output;
290 unsigned long random; 290 unsigned long random;
291 291
292#ifdef CONFIG_HIBERNATION
293 if (!cmdline_find_option_bool("kaslr")) {
294 debug_putstr("KASLR disabled by default...\n");
295 goto out;
296 }
297#else
292 if (cmdline_find_option_bool("nokaslr")) { 298 if (cmdline_find_option_bool("nokaslr")) {
293 debug_putstr("KASLR disabled...\n"); 299 debug_putstr("KASLR disabled by cmdline...\n");
294 goto out; 300 goto out;
295 } 301 }
302#endif
296 303
297 /* Record the various known unsafe memory ranges. */ 304 /* Record the various known unsafe memory ranges. */
298 mem_avoid_init((unsigned long)input, input_size, 305 mem_avoid_init((unsigned long)input, input_size,
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index c6eb418c5627..0d0e922fafc1 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -343,6 +343,7 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
343 if (poke_int3_handler(regs)) 343 if (poke_int3_handler(regs))
344 return; 344 return;
345 345
346 prev_state = exception_enter();
346#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP 347#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
347 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 348 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
348 SIGTRAP) == NOTIFY_STOP) 349 SIGTRAP) == NOTIFY_STOP)
@@ -351,9 +352,8 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
351 352
352#ifdef CONFIG_KPROBES 353#ifdef CONFIG_KPROBES
353 if (kprobe_int3_handler(regs)) 354 if (kprobe_int3_handler(regs))
354 return; 355 goto exit;
355#endif 356#endif
356 prev_state = exception_enter();
357 357
358 if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 358 if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
359 SIGTRAP) == NOTIFY_STOP) 359 SIGTRAP) == NOTIFY_STOP)
@@ -433,6 +433,8 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
433 unsigned long dr6; 433 unsigned long dr6;
434 int si_code; 434 int si_code;
435 435
436 prev_state = exception_enter();
437
436 get_debugreg(dr6, 6); 438 get_debugreg(dr6, 6);
437 439
438 /* Filter out all the reserved bits which are preset to 1 */ 440 /* Filter out all the reserved bits which are preset to 1 */
@@ -465,7 +467,6 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
465 if (kprobe_debug_handler(regs)) 467 if (kprobe_debug_handler(regs))
466 goto exit; 468 goto exit;
467#endif 469#endif
468 prev_state = exception_enter();
469 470
470 if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code, 471 if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code,
471 SIGTRAP) == NOTIFY_STOP) 472 SIGTRAP) == NOTIFY_STOP)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index f17b29210ac4..ffb101e45731 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1537,7 +1537,10 @@ asmlinkage __visible void __init xen_start_kernel(void)
1537 if (!xen_pvh_domain()) 1537 if (!xen_pvh_domain())
1538 pv_cpu_ops = xen_cpu_ops; 1538 pv_cpu_ops = xen_cpu_ops;
1539 1539
1540 x86_init.resources.memory_setup = xen_memory_setup; 1540 if (xen_feature(XENFEAT_auto_translated_physmap))
1541 x86_init.resources.memory_setup = xen_auto_xlated_memory_setup;
1542 else
1543 x86_init.resources.memory_setup = xen_memory_setup;
1541 x86_init.oem.arch_setup = xen_arch_setup; 1544 x86_init.oem.arch_setup = xen_arch_setup;
1542 x86_init.oem.banner = xen_banner; 1545 x86_init.oem.banner = xen_banner;
1543 1546
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 821a11ada590..2e555163c2fe 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -27,7 +27,6 @@
27#include <xen/interface/memory.h> 27#include <xen/interface/memory.h>
28#include <xen/interface/physdev.h> 28#include <xen/interface/physdev.h>
29#include <xen/features.h> 29#include <xen/features.h>
30#include "mmu.h"
31#include "xen-ops.h" 30#include "xen-ops.h"
32#include "vdso.h" 31#include "vdso.h"
33 32
@@ -82,9 +81,6 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
82 81
83 memblock_reserve(start, size); 82 memblock_reserve(start, size);
84 83
85 if (xen_feature(XENFEAT_auto_translated_physmap))
86 return;
87
88 xen_max_p2m_pfn = PFN_DOWN(start + size); 84 xen_max_p2m_pfn = PFN_DOWN(start + size);
89 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) { 85 for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) {
90 unsigned long mfn = pfn_to_mfn(pfn); 86 unsigned long mfn = pfn_to_mfn(pfn);
@@ -107,7 +103,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
107 .domid = DOMID_SELF 103 .domid = DOMID_SELF
108 }; 104 };
109 unsigned long len = 0; 105 unsigned long len = 0;
110 int xlated_phys = xen_feature(XENFEAT_auto_translated_physmap);
111 unsigned long pfn; 106 unsigned long pfn;
112 int ret; 107 int ret;
113 108
@@ -121,7 +116,7 @@ static unsigned long __init xen_do_chunk(unsigned long start,
121 continue; 116 continue;
122 frame = mfn; 117 frame = mfn;
123 } else { 118 } else {
124 if (!xlated_phys && mfn != INVALID_P2M_ENTRY) 119 if (mfn != INVALID_P2M_ENTRY)
125 continue; 120 continue;
126 frame = pfn; 121 frame = pfn;
127 } 122 }
@@ -159,13 +154,6 @@ static unsigned long __init xen_do_chunk(unsigned long start,
159static unsigned long __init xen_release_chunk(unsigned long start, 154static unsigned long __init xen_release_chunk(unsigned long start,
160 unsigned long end) 155 unsigned long end)
161{ 156{
162 /*
163 * Xen already ballooned out the E820 non RAM regions for us
164 * and set them up properly in EPT.
165 */
166 if (xen_feature(XENFEAT_auto_translated_physmap))
167 return end - start;
168
169 return xen_do_chunk(start, end, true); 157 return xen_do_chunk(start, end, true);
170} 158}
171 159
@@ -234,13 +222,7 @@ static void __init xen_set_identity_and_release_chunk(
234 * (except for the ISA region which must be 1:1 mapped) to 222 * (except for the ISA region which must be 1:1 mapped) to
235 * release the refcounts (in Xen) on the original frames. 223 * release the refcounts (in Xen) on the original frames.
236 */ 224 */
237 225 for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
238 /*
239 * PVH E820 matches the hypervisor's P2M which means we need to
240 * account for the proper values of *release and *identity.
241 */
242 for (pfn = start_pfn; !xen_feature(XENFEAT_auto_translated_physmap) &&
243 pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) {
244 pte_t pte = __pte_ma(0); 226 pte_t pte = __pte_ma(0);
245 227
246 if (pfn < PFN_UP(ISA_END_ADDRESS)) 228 if (pfn < PFN_UP(ISA_END_ADDRESS))
@@ -518,6 +500,35 @@ char * __init xen_memory_setup(void)
518} 500}
519 501
520/* 502/*
503 * Machine specific memory setup for auto-translated guests.
504 */
505char * __init xen_auto_xlated_memory_setup(void)
506{
507 static struct e820entry map[E820MAX] __initdata;
508
509 struct xen_memory_map memmap;
510 int i;
511 int rc;
512
513 memmap.nr_entries = E820MAX;
514 set_xen_guest_handle(memmap.buffer, map);
515
516 rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
517 if (rc < 0)
518 panic("No memory map (%d)\n", rc);
519
520 sanitize_e820_map(map, ARRAY_SIZE(map), &memmap.nr_entries);
521
522 for (i = 0; i < memmap.nr_entries; i++)
523 e820_add_region(map[i].addr, map[i].size, map[i].type);
524
525 memblock_reserve(__pa(xen_start_info->mfn_list),
526 xen_start_info->pt_base - xen_start_info->mfn_list);
527
528 return "Xen";
529}
530
531/*
521 * Set the bit indicating "nosegneg" library variants should be used. 532 * Set the bit indicating "nosegneg" library variants should be used.
522 * We only need to bother in pure 32-bit mode; compat 32-bit processes 533 * We only need to bother in pure 32-bit mode; compat 32-bit processes
523 * can have un-truncated segments, so wrapping around is allowed. 534 * can have un-truncated segments, so wrapping around is allowed.
@@ -590,13 +601,7 @@ void xen_enable_syscall(void)
590 } 601 }
591#endif /* CONFIG_X86_64 */ 602#endif /* CONFIG_X86_64 */
592} 603}
593void xen_enable_nmi(void) 604
594{
595#ifdef CONFIG_X86_64
596 if (register_callback(CALLBACKTYPE_nmi, (char *)nmi))
597 BUG();
598#endif
599}
600void __init xen_pvmmu_arch_setup(void) 605void __init xen_pvmmu_arch_setup(void)
601{ 606{
602 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); 607 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
@@ -611,7 +616,6 @@ void __init xen_pvmmu_arch_setup(void)
611 616
612 xen_enable_sysenter(); 617 xen_enable_sysenter();
613 xen_enable_syscall(); 618 xen_enable_syscall();
614 xen_enable_nmi();
615} 619}
616 620
617/* This function is not called for HVM domains */ 621/* This function is not called for HVM domains */
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index c834d4b231f0..97d87659f779 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -36,6 +36,7 @@ void xen_mm_unpin_all(void);
36void xen_set_pat(u64); 36void xen_set_pat(u64);
37 37
38char * __init xen_memory_setup(void); 38char * __init xen_memory_setup(void);
39char * xen_auto_xlated_memory_setup(void);
39void __init xen_arch_setup(void); 40void __init xen_arch_setup(void);
40void xen_enable_sysenter(void); 41void xen_enable_sysenter(void);
41void xen_enable_syscall(void); 42void xen_enable_syscall(void);