aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/Kconfig525
-rw-r--r--arch/sparc/Kconfig.debug26
-rw-r--r--arch/sparc/Makefile97
-rw-r--r--arch/sparc/boot/.gitignore (renamed from arch/sparc64/boot/.gitignore)4
-rw-r--r--arch/sparc/boot/Makefile38
-rw-r--r--arch/sparc/boot/piggyback_32.c (renamed from arch/sparc/boot/piggyback.c)0
-rw-r--r--arch/sparc/boot/piggyback_64.c (renamed from arch/sparc64/boot/piggyback.c)0
-rw-r--r--arch/sparc/configs/sparc32_defconfig (renamed from arch/sparc/defconfig)0
-rw-r--r--arch/sparc/configs/sparc64_defconfig (renamed from arch/sparc64/defconfig)0
-rw-r--r--arch/sparc/include/asm/Kbuild2
-rw-r--r--arch/sparc/include/asm/asm.h40
-rw-r--r--arch/sparc/include/asm/atomic_64.h7
-rw-r--r--arch/sparc/include/asm/bitops_64.h5
-rw-r--r--arch/sparc/include/asm/hypervisor.h24
-rw-r--r--arch/sparc/include/asm/irq_32.h1
-rw-r--r--arch/sparc/include/asm/irq_64.h3
-rw-r--r--arch/sparc/include/asm/irqflags_64.h6
-rw-r--r--arch/sparc/include/asm/module.h32
-rw-r--r--arch/sparc/include/asm/module_32.h7
-rw-r--r--arch/sparc/include/asm/module_64.h7
-rw-r--r--arch/sparc/include/asm/openprom_32.h6
-rw-r--r--arch/sparc/include/asm/oplib_32.h8
-rw-r--r--arch/sparc/include/asm/pil.h9
-rw-r--r--arch/sparc/include/asm/scatterlist.h33
-rw-r--r--arch/sparc/include/asm/scatterlist_32.h26
-rw-r--r--arch/sparc/include/asm/scatterlist_64.h27
-rw-r--r--arch/sparc/include/asm/sections.h16
-rw-r--r--arch/sparc/include/asm/sections_32.h6
-rw-r--r--arch/sparc/include/asm/sections_64.h9
-rw-r--r--arch/sparc/include/asm/spinlock_64.h31
-rw-r--r--arch/sparc/include/asm/spitfire.h4
-rw-r--r--arch/sparc/include/asm/system_32.h5
-rw-r--r--arch/sparc/include/asm/system_64.h46
-rw-r--r--arch/sparc/include/asm/tsb.h6
-rw-r--r--arch/sparc/include/asm/ttable.h15
-rw-r--r--arch/sparc/include/asm/unistd.h446
-rw-r--r--arch/sparc/include/asm/unistd_32.h385
-rw-r--r--arch/sparc/include/asm/unistd_64.h380
-rw-r--r--arch/sparc/kernel/.gitignore1
-rw-r--r--arch/sparc/kernel/Makefile117
-rw-r--r--arch/sparc/kernel/asm-offsets.c19
-rw-r--r--arch/sparc/kernel/audit.c (renamed from arch/sparc64/kernel/audit.c)0
-rw-r--r--arch/sparc/kernel/auxio_32.c (renamed from arch/sparc/kernel/auxio.c)0
-rw-r--r--arch/sparc/kernel/auxio_64.c (renamed from arch/sparc64/kernel/auxio.c)70
-rw-r--r--arch/sparc/kernel/central.c (renamed from arch/sparc64/kernel/central.c)0
-rw-r--r--arch/sparc/kernel/cherrs.S (renamed from arch/sparc64/kernel/cherrs.S)10
-rw-r--r--arch/sparc/kernel/chmc.c (renamed from arch/sparc64/kernel/chmc.c)0
-rw-r--r--arch/sparc/kernel/compat_audit.c (renamed from arch/sparc64/kernel/compat_audit.c)3
-rw-r--r--arch/sparc/kernel/cpu.c413
-rw-r--r--arch/sparc/kernel/devices.c2
-rw-r--r--arch/sparc/kernel/ds.c (renamed from arch/sparc64/kernel/ds.c)0
-rw-r--r--arch/sparc/kernel/dtlb_miss.S (renamed from arch/sparc64/kernel/dtlb_miss.S)0
-rw-r--r--arch/sparc/kernel/dtlb_prot.S (renamed from arch/sparc64/kernel/dtlb_prot.S)0
-rw-r--r--arch/sparc/kernel/ebus.c (renamed from arch/sparc64/kernel/ebus.c)0
-rw-r--r--arch/sparc/kernel/entry.h (renamed from arch/sparc64/kernel/entry.h)40
-rw-r--r--arch/sparc/kernel/etrap_32.S (renamed from arch/sparc/kernel/etrap.S)0
-rw-r--r--arch/sparc/kernel/etrap_64.S (renamed from arch/sparc64/kernel/etrap.S)6
-rw-r--r--arch/sparc/kernel/fpu_traps.S (renamed from arch/sparc64/kernel/fpu_traps.S)0
-rw-r--r--arch/sparc/kernel/ftrace.c (renamed from arch/sparc64/kernel/ftrace.c)0
-rw-r--r--arch/sparc/kernel/getsetcc.S (renamed from arch/sparc64/kernel/getsetcc.S)0
-rw-r--r--arch/sparc/kernel/head_32.S (renamed from arch/sparc/kernel/head.S)2
-rw-r--r--arch/sparc/kernel/head_64.S (renamed from arch/sparc64/kernel/head.S)8
-rw-r--r--arch/sparc/kernel/helpers.S (renamed from arch/sparc64/kernel/helpers.S)0
-rw-r--r--arch/sparc/kernel/hvapi.c (renamed from arch/sparc64/kernel/hvapi.c)0
-rw-r--r--arch/sparc/kernel/hvcalls.S (renamed from arch/sparc64/kernel/hvcalls.S)32
-rw-r--r--arch/sparc/kernel/hvtramp.S (renamed from arch/sparc64/kernel/hvtramp.S)5
-rw-r--r--arch/sparc/kernel/idprom.c67
-rw-r--r--arch/sparc/kernel/init_task.c3
-rw-r--r--arch/sparc/kernel/iommu.c (renamed from arch/sparc64/kernel/iommu.c)0
-rw-r--r--arch/sparc/kernel/iommu_common.h (renamed from arch/sparc64/kernel/iommu_common.h)0
-rw-r--r--arch/sparc/kernel/ioport.c4
-rw-r--r--arch/sparc/kernel/irq_32.c (renamed from arch/sparc/kernel/irq.c)7
-rw-r--r--arch/sparc/kernel/irq_64.c (renamed from arch/sparc64/kernel/irq.c)63
-rw-r--r--arch/sparc/kernel/itlb_miss.S (renamed from arch/sparc64/kernel/itlb_miss.S)0
-rw-r--r--arch/sparc/kernel/ivec.S (renamed from arch/sparc64/kernel/ivec.S)0
-rw-r--r--arch/sparc/kernel/kernel.h31
-rw-r--r--arch/sparc/kernel/kgdb_32.c (renamed from arch/sparc/kernel/kgdb.c)0
-rw-r--r--arch/sparc/kernel/kgdb_64.c (renamed from arch/sparc64/kernel/kgdb.c)0
-rw-r--r--arch/sparc/kernel/kprobes.c (renamed from arch/sparc64/kernel/kprobes.c)0
-rw-r--r--arch/sparc/kernel/kstack.h (renamed from arch/sparc64/kernel/kstack.h)0
-rw-r--r--arch/sparc/kernel/ktlb.S (renamed from arch/sparc64/kernel/ktlb.S)0
-rw-r--r--arch/sparc/kernel/ldc.c (renamed from arch/sparc64/kernel/ldc.c)0
-rw-r--r--arch/sparc/kernel/mdesc.c (renamed from arch/sparc64/kernel/mdesc.c)1
-rw-r--r--arch/sparc/kernel/misctrap.S (renamed from arch/sparc64/kernel/misctrap.S)0
-rw-r--r--arch/sparc/kernel/module.c140
-rw-r--r--arch/sparc/kernel/muldiv.c5
-rw-r--r--arch/sparc/kernel/of_device_32.c (renamed from arch/sparc/kernel/of_device.c)0
-rw-r--r--arch/sparc/kernel/of_device_64.c (renamed from arch/sparc64/kernel/of_device.c)18
-rw-r--r--arch/sparc/kernel/pci.c (renamed from arch/sparc64/kernel/pci.c)0
-rw-r--r--arch/sparc/kernel/pci_common.c (renamed from arch/sparc64/kernel/pci_common.c)0
-rw-r--r--arch/sparc/kernel/pci_fire.c (renamed from arch/sparc64/kernel/pci_fire.c)0
-rw-r--r--arch/sparc/kernel/pci_impl.h (renamed from arch/sparc64/kernel/pci_impl.h)0
-rw-r--r--arch/sparc/kernel/pci_msi.c (renamed from arch/sparc64/kernel/pci_msi.c)0
-rw-r--r--arch/sparc/kernel/pci_psycho.c (renamed from arch/sparc64/kernel/pci_psycho.c)0
-rw-r--r--arch/sparc/kernel/pci_sabre.c (renamed from arch/sparc64/kernel/pci_sabre.c)0
-rw-r--r--arch/sparc/kernel/pci_schizo.c (renamed from arch/sparc64/kernel/pci_schizo.c)0
-rw-r--r--arch/sparc/kernel/pci_sun4v.c (renamed from arch/sparc64/kernel/pci_sun4v.c)0
-rw-r--r--arch/sparc/kernel/pci_sun4v.h (renamed from arch/sparc64/kernel/pci_sun4v.h)0
-rw-r--r--arch/sparc/kernel/pci_sun4v_asm.S (renamed from arch/sparc64/kernel/pci_sun4v_asm.S)0
-rw-r--r--arch/sparc/kernel/pcic.c2
-rw-r--r--arch/sparc/kernel/pmc.c18
-rw-r--r--arch/sparc/kernel/power.c (renamed from arch/sparc64/kernel/power.c)0
-rw-r--r--arch/sparc/kernel/process_32.c (renamed from arch/sparc/kernel/process.c)2
-rw-r--r--arch/sparc/kernel/process_64.c (renamed from arch/sparc64/kernel/process.c)0
-rw-r--r--arch/sparc/kernel/prom.h29
-rw-r--r--arch/sparc/kernel/prom_32.c (renamed from arch/sparc/kernel/prom.c)287
-rw-r--r--arch/sparc/kernel/prom_64.c571
-rw-r--r--arch/sparc/kernel/prom_common.c326
-rw-r--r--arch/sparc/kernel/prom_irqtrans.c (renamed from arch/sparc64/kernel/prom.c)854
-rw-r--r--arch/sparc/kernel/psycho_common.c (renamed from arch/sparc64/kernel/psycho_common.c)0
-rw-r--r--arch/sparc/kernel/psycho_common.h (renamed from arch/sparc64/kernel/psycho_common.h)0
-rw-r--r--arch/sparc/kernel/ptrace_32.c (renamed from arch/sparc/kernel/ptrace.c)0
-rw-r--r--arch/sparc/kernel/ptrace_64.c (renamed from arch/sparc64/kernel/ptrace.c)0
-rw-r--r--arch/sparc/kernel/reboot.c (renamed from arch/sparc64/kernel/reboot.c)0
-rw-r--r--arch/sparc/kernel/rtrap_32.S (renamed from arch/sparc/kernel/rtrap.S)0
-rw-r--r--arch/sparc/kernel/rtrap_64.S (renamed from arch/sparc64/kernel/rtrap.S)20
-rw-r--r--arch/sparc/kernel/sbus.c (renamed from arch/sparc64/kernel/sbus.c)0
-rw-r--r--arch/sparc/kernel/setup_32.c (renamed from arch/sparc/kernel/setup.c)9
-rw-r--r--arch/sparc/kernel/setup_64.c (renamed from arch/sparc64/kernel/setup.c)1
-rw-r--r--arch/sparc/kernel/signal32.c (renamed from arch/sparc64/kernel/signal32.c)0
-rw-r--r--arch/sparc/kernel/signal_32.c (renamed from arch/sparc/kernel/signal.c)0
-rw-r--r--arch/sparc/kernel/signal_64.c (renamed from arch/sparc64/kernel/signal.c)0
-rw-r--r--arch/sparc/kernel/smp_32.c (renamed from arch/sparc/kernel/smp.c)0
-rw-r--r--arch/sparc/kernel/smp_64.c (renamed from arch/sparc64/kernel/smp.c)17
-rw-r--r--arch/sparc/kernel/sparc_ksyms_32.c (renamed from arch/sparc/kernel/sparc_ksyms.c)4
-rw-r--r--arch/sparc/kernel/sparc_ksyms_64.c (renamed from arch/sparc64/kernel/sparc64_ksyms.c)11
-rw-r--r--arch/sparc/kernel/spiterrs.S (renamed from arch/sparc64/kernel/spiterrs.S)2
-rw-r--r--arch/sparc/kernel/sstate.c (renamed from arch/sparc64/kernel/sstate.c)0
-rw-r--r--arch/sparc/kernel/stacktrace.c (renamed from arch/sparc64/kernel/stacktrace.c)32
-rw-r--r--arch/sparc/kernel/starfire.c (renamed from arch/sparc64/kernel/starfire.c)0
-rw-r--r--arch/sparc/kernel/sun4c_irq.c2
-rw-r--r--arch/sparc/kernel/sun4d_irq.c3
-rw-r--r--arch/sparc/kernel/sun4m_irq.c2
-rw-r--r--arch/sparc/kernel/sun4v_ivec.S (renamed from arch/sparc64/kernel/sun4v_ivec.S)8
-rw-r--r--arch/sparc/kernel/sun4v_tlb_miss.S (renamed from arch/sparc64/kernel/sun4v_tlb_miss.S)0
-rw-r--r--arch/sparc/kernel/sys32.S (renamed from arch/sparc64/kernel/sys32.S)0
-rw-r--r--arch/sparc/kernel/sys_sparc32.c (renamed from arch/sparc64/kernel/sys_sparc32.c)0
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c (renamed from arch/sparc/kernel/sys_sparc.c)0
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c (renamed from arch/sparc64/kernel/sys_sparc.c)0
-rw-r--r--arch/sparc/kernel/syscalls.S (renamed from arch/sparc64/kernel/syscalls.S)0
-rw-r--r--arch/sparc/kernel/sysfs.c (renamed from arch/sparc64/kernel/sysfs.c)1
-rw-r--r--arch/sparc/kernel/systbls.h (renamed from arch/sparc64/kernel/systbls.h)0
-rw-r--r--arch/sparc/kernel/systbls_32.S (renamed from arch/sparc/kernel/systbls.S)0
-rw-r--r--arch/sparc/kernel/systbls_64.S (renamed from arch/sparc64/kernel/systbls.S)0
-rw-r--r--arch/sparc/kernel/time_32.c (renamed from arch/sparc/kernel/time.c)0
-rw-r--r--arch/sparc/kernel/time_64.c (renamed from arch/sparc64/kernel/time.c)0
-rw-r--r--arch/sparc/kernel/trampoline_32.S (renamed from arch/sparc/kernel/trampoline.S)0
-rw-r--r--arch/sparc/kernel/trampoline_64.S (renamed from arch/sparc64/kernel/trampoline.S)4
-rw-r--r--arch/sparc/kernel/traps_32.c (renamed from arch/sparc/kernel/traps.c)34
-rw-r--r--arch/sparc/kernel/traps_64.c (renamed from arch/sparc64/kernel/traps.c)5
-rw-r--r--arch/sparc/kernel/tsb.S (renamed from arch/sparc64/kernel/tsb.S)6
-rw-r--r--arch/sparc/kernel/ttable.S (renamed from arch/sparc64/kernel/ttable.S)2
-rw-r--r--arch/sparc/kernel/una_asm_32.S (renamed from arch/sparc/kernel/una_asm.S)0
-rw-r--r--arch/sparc/kernel/una_asm_64.S (renamed from arch/sparc64/kernel/una_asm.S)0
-rw-r--r--arch/sparc/kernel/unaligned_32.c (renamed from arch/sparc/kernel/unaligned.c)0
-rw-r--r--arch/sparc/kernel/unaligned_64.c (renamed from arch/sparc64/kernel/unaligned.c)0
-rw-r--r--arch/sparc/kernel/us2e_cpufreq.c (renamed from arch/sparc64/kernel/us2e_cpufreq.c)0
-rw-r--r--arch/sparc/kernel/us3_cpufreq.c (renamed from arch/sparc64/kernel/us3_cpufreq.c)0
-rw-r--r--arch/sparc/kernel/utrap.S (renamed from arch/sparc64/kernel/utrap.S)0
-rw-r--r--arch/sparc/kernel/vio.c (renamed from arch/sparc64/kernel/vio.c)0
-rw-r--r--arch/sparc/kernel/viohs.c (renamed from arch/sparc64/kernel/viohs.c)0
-rw-r--r--arch/sparc/kernel/visemul.c (renamed from arch/sparc64/kernel/visemul.c)0
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S109
-rw-r--r--arch/sparc/kernel/winfixup.S (renamed from arch/sparc64/kernel/winfixup.S)0
-rw-r--r--arch/sparc/lib/GENbzero.S (renamed from arch/sparc64/lib/GENbzero.S)0
-rw-r--r--arch/sparc/lib/GENcopy_from_user.S (renamed from arch/sparc64/lib/GENcopy_from_user.S)0
-rw-r--r--arch/sparc/lib/GENcopy_to_user.S (renamed from arch/sparc64/lib/GENcopy_to_user.S)0
-rw-r--r--arch/sparc/lib/GENmemcpy.S (renamed from arch/sparc64/lib/GENmemcpy.S)0
-rw-r--r--arch/sparc/lib/GENpage.S (renamed from arch/sparc64/lib/GENpage.S)0
-rw-r--r--arch/sparc/lib/GENpatch.S (renamed from arch/sparc64/lib/GENpatch.S)0
-rw-r--r--arch/sparc/lib/Makefile47
-rw-r--r--arch/sparc/lib/NG2copy_from_user.S (renamed from arch/sparc64/lib/NG2copy_from_user.S)0
-rw-r--r--arch/sparc/lib/NG2copy_to_user.S (renamed from arch/sparc64/lib/NG2copy_to_user.S)0
-rw-r--r--arch/sparc/lib/NG2memcpy.S (renamed from arch/sparc64/lib/NG2memcpy.S)0
-rw-r--r--arch/sparc/lib/NG2page.S (renamed from arch/sparc64/lib/NG2page.S)0
-rw-r--r--arch/sparc/lib/NG2patch.S (renamed from arch/sparc64/lib/NG2patch.S)0
-rw-r--r--arch/sparc/lib/NGbzero.S (renamed from arch/sparc64/lib/NGbzero.S)0
-rw-r--r--arch/sparc/lib/NGcopy_from_user.S (renamed from arch/sparc64/lib/NGcopy_from_user.S)0
-rw-r--r--arch/sparc/lib/NGcopy_to_user.S (renamed from arch/sparc64/lib/NGcopy_to_user.S)0
-rw-r--r--arch/sparc/lib/NGmemcpy.S (renamed from arch/sparc64/lib/NGmemcpy.S)0
-rw-r--r--arch/sparc/lib/NGpage.S (renamed from arch/sparc64/lib/NGpage.S)0
-rw-r--r--arch/sparc/lib/NGpatch.S (renamed from arch/sparc64/lib/NGpatch.S)0
-rw-r--r--arch/sparc/lib/PeeCeeI.c (renamed from arch/sparc64/lib/PeeCeeI.c)0
-rw-r--r--arch/sparc/lib/U1copy_from_user.S (renamed from arch/sparc64/lib/U1copy_from_user.S)0
-rw-r--r--arch/sparc/lib/U1copy_to_user.S (renamed from arch/sparc64/lib/U1copy_to_user.S)0
-rw-r--r--arch/sparc/lib/U1memcpy.S (renamed from arch/sparc64/lib/U1memcpy.S)0
-rw-r--r--arch/sparc/lib/U3copy_from_user.S (renamed from arch/sparc64/lib/U3copy_from_user.S)0
-rw-r--r--arch/sparc/lib/U3copy_to_user.S (renamed from arch/sparc64/lib/U3copy_to_user.S)0
-rw-r--r--arch/sparc/lib/U3memcpy.S (renamed from arch/sparc64/lib/U3memcpy.S)0
-rw-r--r--arch/sparc/lib/U3patch.S (renamed from arch/sparc64/lib/U3patch.S)0
-rw-r--r--arch/sparc/lib/VISsave.S (renamed from arch/sparc64/lib/VISsave.S)0
-rw-r--r--arch/sparc/lib/atomic_32.S (renamed from arch/sparc/lib/atomic.S)0
-rw-r--r--arch/sparc/lib/atomic_64.S (renamed from arch/sparc64/lib/atomic.S)26
-rw-r--r--arch/sparc/lib/bitops.S (renamed from arch/sparc64/lib/bitops.S)24
-rw-r--r--arch/sparc/lib/bzero.S (renamed from arch/sparc64/lib/bzero.S)0
-rw-r--r--arch/sparc/lib/checksum_32.S (renamed from arch/sparc/lib/checksum.S)0
-rw-r--r--arch/sparc/lib/checksum_64.S (renamed from arch/sparc64/lib/checksum.S)0
-rw-r--r--arch/sparc/lib/clear_page.S (renamed from arch/sparc64/lib/clear_page.S)0
-rw-r--r--arch/sparc/lib/copy_in_user.S (renamed from arch/sparc64/lib/copy_in_user.S)0
-rw-r--r--arch/sparc/lib/copy_page.S (renamed from arch/sparc64/lib/copy_page.S)0
-rw-r--r--arch/sparc/lib/csum_copy.S (renamed from arch/sparc64/lib/csum_copy.S)0
-rw-r--r--arch/sparc/lib/csum_copy_from_user.S (renamed from arch/sparc64/lib/csum_copy_from_user.S)0
-rw-r--r--arch/sparc/lib/csum_copy_to_user.S (renamed from arch/sparc64/lib/csum_copy_to_user.S)0
-rw-r--r--arch/sparc/lib/ipcsum.S (renamed from arch/sparc64/lib/ipcsum.S)0
-rw-r--r--arch/sparc/lib/mcount.S (renamed from arch/sparc64/lib/mcount.S)0
-rw-r--r--arch/sparc/lib/memcmp.S329
-rw-r--r--arch/sparc/lib/memmove.S (renamed from arch/sparc64/lib/memmove.S)0
-rw-r--r--arch/sparc/lib/memscan_32.S (renamed from arch/sparc/lib/memscan.S)0
-rw-r--r--arch/sparc/lib/memscan_64.S (renamed from arch/sparc64/lib/memscan.S)0
-rw-r--r--arch/sparc/lib/rwsem_32.S (renamed from arch/sparc/lib/rwsem.S)0
-rw-r--r--arch/sparc/lib/rwsem_64.S (renamed from arch/sparc64/lib/rwsem.S)7
-rw-r--r--arch/sparc/lib/strlen.S79
-rw-r--r--arch/sparc/lib/strlen_user_32.S (renamed from arch/sparc/lib/strlen_user.S)0
-rw-r--r--arch/sparc/lib/strlen_user_64.S (renamed from arch/sparc64/lib/strlen_user.S)0
-rw-r--r--arch/sparc/lib/strncmp_32.S (renamed from arch/sparc/lib/strncmp.S)0
-rw-r--r--arch/sparc/lib/strncmp_64.S (renamed from arch/sparc64/lib/strncmp.S)0
-rw-r--r--arch/sparc/lib/strncpy_from_user_32.S (renamed from arch/sparc/lib/strncpy_from_user.S)0
-rw-r--r--arch/sparc/lib/strncpy_from_user_64.S (renamed from arch/sparc64/lib/strncpy_from_user.S)0
-rw-r--r--arch/sparc/lib/user_fixup.c (renamed from arch/sparc64/lib/user_fixup.c)0
-rw-r--r--arch/sparc/lib/xor.S (renamed from arch/sparc64/lib/xor.S)0
-rw-r--r--arch/sparc/math-emu/Makefile6
-rw-r--r--arch/sparc/math-emu/ashldi3.S36
-rw-r--r--arch/sparc/math-emu/math_32.c (renamed from arch/sparc/math-emu/math.c)2
-rw-r--r--arch/sparc/math-emu/math_64.c (renamed from arch/sparc64/math-emu/math.c)2
-rw-r--r--arch/sparc/math-emu/sfp-util_32.h (renamed from arch/sparc/math-emu/sfp-util.h)0
-rw-r--r--arch/sparc/math-emu/sfp-util_64.h (renamed from arch/sparc64/math-emu/sfp-util.h)0
-rw-r--r--arch/sparc/mm/Makefile24
-rw-r--r--arch/sparc/mm/fault_32.c (renamed from arch/sparc/mm/fault.c)0
-rw-r--r--arch/sparc/mm/fault_64.c (renamed from arch/sparc64/mm/fault.c)0
-rw-r--r--arch/sparc/mm/generic_32.c (renamed from arch/sparc/mm/generic.c)0
-rw-r--r--arch/sparc/mm/generic_64.c (renamed from arch/sparc64/mm/generic.c)0
-rw-r--r--arch/sparc/mm/hugetlbpage.c (renamed from arch/sparc64/mm/hugetlbpage.c)0
-rw-r--r--arch/sparc/mm/init_32.c (renamed from arch/sparc/mm/init.c)14
-rw-r--r--arch/sparc/mm/init_64.c (renamed from arch/sparc64/mm/init.c)6
-rw-r--r--arch/sparc/mm/init_64.h (renamed from arch/sparc64/mm/init.h)0
-rw-r--r--arch/sparc/mm/io-unit.c8
-rw-r--r--arch/sparc/mm/iommu.c16
-rw-r--r--arch/sparc/mm/srmmu.c25
-rw-r--r--arch/sparc/mm/sun4c.c12
-rw-r--r--arch/sparc/mm/tlb.c (renamed from arch/sparc64/mm/tlb.c)0
-rw-r--r--arch/sparc/mm/tsb.c (renamed from arch/sparc64/mm/tsb.c)25
-rw-r--r--arch/sparc/mm/ultra.S (renamed from arch/sparc64/mm/ultra.S)6
-rw-r--r--arch/sparc/oprofile/init.c229
-rw-r--r--arch/sparc/prom/Makefile19
-rw-r--r--arch/sparc/prom/bootstr_32.c (renamed from arch/sparc/prom/bootstr.c)0
-rw-r--r--arch/sparc/prom/bootstr_64.c (renamed from arch/sparc64/prom/bootstr.c)0
-rw-r--r--arch/sparc/prom/cif.S (renamed from arch/sparc64/prom/cif.S)0
-rw-r--r--arch/sparc/prom/console_32.c (renamed from arch/sparc/prom/console.c)0
-rw-r--r--arch/sparc/prom/console_64.c (renamed from arch/sparc64/prom/console.c)0
-rw-r--r--arch/sparc/prom/devops_32.c (renamed from arch/sparc/prom/devops.c)0
-rw-r--r--arch/sparc/prom/devops_64.c (renamed from arch/sparc64/prom/devops.c)0
-rw-r--r--arch/sparc/prom/init_32.c (renamed from arch/sparc/prom/init.c)0
-rw-r--r--arch/sparc/prom/init_64.c (renamed from arch/sparc64/prom/init.c)0
-rw-r--r--arch/sparc/prom/misc_32.c (renamed from arch/sparc/prom/misc.c)2
-rw-r--r--arch/sparc/prom/misc_64.c (renamed from arch/sparc64/prom/misc.c)0
-rw-r--r--arch/sparc/prom/p1275.c (renamed from arch/sparc64/prom/p1275.c)0
-rw-r--r--arch/sparc/prom/printf.c5
-rw-r--r--arch/sparc/prom/tree_32.c (renamed from arch/sparc/prom/tree.c)6
-rw-r--r--arch/sparc/prom/tree_64.c (renamed from arch/sparc64/prom/tree.c)0
-rw-r--r--arch/sparc64/Kconfig433
-rw-r--r--arch/sparc64/Kconfig.debug44
-rw-r--r--arch/sparc64/Makefile48
-rw-r--r--arch/sparc64/boot/Makefile33
-rw-r--r--arch/sparc64/kernel/Makefile36
-rw-r--r--arch/sparc64/kernel/asm-offsets.c1
-rw-r--r--arch/sparc64/kernel/cpu.c166
-rw-r--r--arch/sparc64/kernel/idprom.c46
-rw-r--r--arch/sparc64/kernel/init_task.c35
-rw-r--r--arch/sparc64/kernel/module.c213
-rw-r--r--arch/sparc64/kernel/vmlinux.lds.S147
-rw-r--r--arch/sparc64/lib/Makefile23
-rw-r--r--arch/sparc64/lib/iomap.c48
-rw-r--r--arch/sparc64/lib/memcmp.S28
-rw-r--r--arch/sparc64/lib/strlen.S80
-rw-r--r--arch/sparc64/math-emu/Makefile7
-rw-r--r--arch/sparc64/mm/Makefile9
-rw-r--r--arch/sparc64/oprofile/Makefile9
-rw-r--r--arch/sparc64/oprofile/init.c23
-rw-r--r--arch/sparc64/prom/Makefile9
-rw-r--r--arch/sparc64/prom/printf.c47
280 files changed, 3471 insertions, 4679 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e594559c8dba..0a94d9c9cde1 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -4,21 +4,116 @@
4 4
5mainmenu "Linux/SPARC Kernel Configuration" 5mainmenu "Linux/SPARC Kernel Configuration"
6 6
7config SPARC
8 bool
9 default y
10 select HAVE_IDE
11 select HAVE_OPROFILE
12 select HAVE_ARCH_KGDB if !SMP || SPARC64
13 select HAVE_ARCH_TRACEHOOK
14 select ARCH_WANT_OPTIONAL_GPIOLIB
15 select RTC_CLASS
16 select RTC_DRV_M48T59
17
18# Identify this as a Sparc32 build
19config SPARC32
20 bool
21 default y if ARCH = "sparc"
22 help
23 SPARC is a family of RISC microprocessors designed and marketed by
24 Sun Microsystems, incorporated. They are very widely found in Sun
25 workstations and clones. This port covers the original 32-bit SPARC;
26 it is old and stable and usually considered one of the "big three"
27 along with the Intel and Alpha ports. The UltraLinux project
28 maintains both the SPARC32 and SPARC64 ports; its web page is
29 available at <http://www.ultralinux.org/>.
30
31config SPARC64
32 bool
33 default y if ARCH = "sparc64"
34 select ARCH_SUPPORTS_MSI
35 select HAVE_FUNCTION_TRACER
36 select HAVE_KRETPROBES
37 select HAVE_KPROBES
38 select HAVE_LMB
39 select USE_GENERIC_SMP_HELPERS if SMP
40 select RTC_DRV_CMOS
41 select RTC_DRV_BQ4802
42 select RTC_DRV_SUN4V
43 select RTC_DRV_STARFIRE
44
45config ARCH_DEFCONFIG
46 string
47 default "arch/sparc/configs/sparc32_defconfig" if SPARC32
48 default "arch/sparc/configs/sparc64_defconfig" if SPARC64
49
50# CONFIG_BITS can be used at source level to get 32/64 bits
51config BITS
52 int
53 default 32 if SPARC32
54 default 64 if SPARC64
55
56config 64BIT
57 def_bool y if SPARC64
58
59config GENERIC_TIME
60 bool
61 default y if SPARC64
62
63config GENERIC_CMOS_UPDATE
64 bool
65 default y if SPARC64
66
67config GENERIC_CLOCKEVENTS
68 bool
69 default y if SPARC64
70
71config IOMMU_HELPER
72 bool
73 default y if SPARC64
74
75config QUICKLIST
76 bool
77 default y if SPARC64
78
79config STACKTRACE_SUPPORT
80 bool
81 default y if SPARC64
82
83config LOCKDEP_SUPPORT
84 bool
85 default y if SPARC64
86
87config HAVE_LATENCYTOP_SUPPORT
88 bool
89 default y if SPARC64
90
91config AUDIT_ARCH
92 bool
93 default y
94
95config HAVE_SETUP_PER_CPU_AREA
96 def_bool y if SPARC64
97
98config GENERIC_HARDIRQS_NO__DO_IRQ
99 bool
100 def_bool y if SPARC64
101
7config MMU 102config MMU
8 bool 103 bool
9 default y 104 default y
10 105
11config HIGHMEM 106config HIGHMEM
12 bool 107 bool
13 default y 108 default y if SPARC32
14 109
15config ZONE_DMA 110config ZONE_DMA
16 bool 111 bool
17 default y 112 default y if SPARC32
18 113
19config GENERIC_ISA_DMA 114config GENERIC_ISA_DMA
20 bool 115 bool
21 default y 116 default y if SPARC32
22 117
23config GENERIC_GPIO 118config GENERIC_GPIO
24 bool 119 bool
@@ -31,15 +126,11 @@ config ARCH_NO_VIRT_TO_BUS
31config OF 126config OF
32 def_bool y 127 def_bool y
33 128
34config HZ
35 int
36 default 100
37
38source "init/Kconfig" 129source "init/Kconfig"
39 130
40source "kernel/Kconfig.freezer" 131source "kernel/Kconfig.freezer"
41 132
42menu "General machine setup" 133menu "Processor type and features"
43 134
44config SMP 135config SMP
45 bool "Symmetric multi-processing support (does not work on sun4/sun4c)" 136 bool "Symmetric multi-processing support (does not work on sun4/sun4c)"
@@ -64,82 +155,269 @@ config SMP
64 If you don't know what to do here, say N. 155 If you don't know what to do here, say N.
65 156
66config NR_CPUS 157config NR_CPUS
67 int "Maximum number of CPUs (2-32)" 158 int "Maximum number of CPUs"
68 range 2 32
69 depends on SMP 159 depends on SMP
70 default "32" 160 range 2 32 if SPARC32
161 range 2 1024 if SPARC64
162 default 32 if SPARC32
163 default 64 if SPARC64
71 164
72config SPARC 165source kernel/Kconfig.hz
166
167config RWSEM_GENERIC_SPINLOCK
168 bool
169 default y if SPARC32
170
171config RWSEM_XCHGADD_ALGORITHM
172 bool
173 default y if SPARC64
174
175config GENERIC_FIND_NEXT_BIT
73 bool 176 bool
74 default y 177 default y
75 select HAVE_IDE
76 select HAVE_OPROFILE
77 select HAVE_ARCH_KGDB if !SMP
78 select HAVE_ARCH_TRACEHOOK
79 select ARCH_WANT_OPTIONAL_GPIOLIB
80 select RTC_CLASS
81 select RTC_DRV_M48T59
82 178
83# Identify this as a Sparc32 build 179config GENERIC_HWEIGHT
84config SPARC32 180 bool
181 default y if !ULTRA_HAS_POPULATION_COUNT
182
183config GENERIC_CALIBRATE_DELAY
85 bool 184 bool
86 default y 185 default y
87 help
88 SPARC is a family of RISC microprocessors designed and marketed by
89 Sun Microsystems, incorporated. They are very widely found in Sun
90 workstations and clones. This port covers the original 32-bit SPARC;
91 it is old and stable and usually considered one of the "big three"
92 along with the Intel and Alpha ports. The UltraLinux project
93 maintains both the SPARC32 and SPARC64 ports; its web page is
94 available at <http://www.ultralinux.org/>.
95 186
96# Global things across all Sun machines. 187config ARCH_MAY_HAVE_PC_FDC
97config ISA
98 bool 188 bool
99 help 189 default y
100 ISA is found on Espresso only and is not supported currently.
101 Say N
102 190
103config EISA 191config ARCH_HAS_ILOG2_U32
104 bool 192 bool
193 default n
194
195config ARCH_HAS_ILOG2_U64
196 bool
197 default n
198
199config EMULATED_CMPXCHG
200 bool
201 default y if SPARC32
105 help 202 help
106 EISA is not supported. 203 Sparc32 does not have a CAS instruction like sparc64. cmpxchg()
107 Say N 204 is emulated, and therefore it is not completely atomic.
108 205
109config MCA 206# Makefile helpers
207config SPARC32_SMP
208 bool
209 default y
210 depends on SPARC32 && SMP
211
212config SPARC64_SMP
110 bool 213 bool
214 default y
215 depends on SPARC64 && SMP
216
217choice
218 prompt "Kernel page size" if SPARC64
219 default SPARC64_PAGE_SIZE_8KB
220
221config SPARC64_PAGE_SIZE_8KB
222 bool "8KB"
111 help 223 help
112 MCA is not supported. 224 This lets you select the page size of the kernel.
113 Say N
114 225
115config PCMCIA 226 8KB and 64KB work quite well, since SPARC ELF sections
116 tristate 227 provide for up to 64KB alignment.
117 ---help---
118 Say Y here if you want to attach PCMCIA- or PC-cards to your Linux
119 computer. These are credit-card size devices such as network cards,
120 modems or hard drives often used with laptops computers. There are
121 actually two varieties of these cards: the older 16 bit PCMCIA cards
122 and the newer 32 bit CardBus cards. If you want to use CardBus
123 cards, you need to say Y here and also to "CardBus support" below.
124 228
125 To use your PC-cards, you will need supporting software from David 229 If you don't know what to do, choose 8KB.
126 Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
127 for location). Please also read the PCMCIA-HOWTO, available from
128 <http://www.tldp.org/docs.html#howto>.
129 230
130 To compile this driver as modules, choose M here: the 231config SPARC64_PAGE_SIZE_64KB
131 modules will be called pcmcia_core and ds. 232 bool "64KB"
132 233
133config SBUS 234endchoice
235
236config SECCOMP
237 bool "Enable seccomp to safely compute untrusted bytecode"
238 depends on SPARC64 && PROC_FS
239 default y
240 help
241 This kernel feature is useful for number crunching applications
242 that may need to compute untrusted bytecode during their
243 execution. By using pipes or other transports made available to
244 the process as file descriptors supporting the read/write
245 syscalls, it's possible to isolate those applications in
246 their own address space using seccomp. Once seccomp is
247 enabled via /proc/<pid>/seccomp, it cannot be disabled
248 and the task is only allowed to execute a few safe syscalls
249 defined by each seccomp mode.
250
251 If unsure, say Y. Only embedded should say N here.
252
253config HOTPLUG_CPU
254 bool "Support for hot-pluggable CPUs"
255 depends on SPARC64 && SMP
256 select HOTPLUG
257 help
258 Say Y here to experiment with turning CPUs off and on. CPUs
259 can be controlled through /sys/devices/system/cpu/cpu#.
260 Say N if you want to disable CPU hotplug.
261
262config GENERIC_HARDIRQS
134 bool 263 bool
264 default y if SPARC64
265
266source "kernel/time/Kconfig"
267
268if SPARC64
269source "drivers/cpufreq/Kconfig"
270
271config US3_FREQ
272 tristate "UltraSPARC-III CPU Frequency driver"
273 depends on CPU_FREQ
274 select CPU_FREQ_TABLE
275 help
276 This adds the CPUFreq driver for UltraSPARC-III processors.
277
278 For details, take a look at <file:Documentation/cpu-freq>.
279
280 If in doubt, say N.
281
282config US2E_FREQ
283 tristate "UltraSPARC-IIe CPU Frequency driver"
284 depends on CPU_FREQ
285 select CPU_FREQ_TABLE
286 help
287 This adds the CPUFreq driver for UltraSPARC-IIe processors.
288
289 For details, take a look at <file:Documentation/cpu-freq>.
290
291 If in doubt, say N.
292
293endif
294
295config US3_MC
296 tristate "UltraSPARC-III Memory Controller driver"
297 depends on SPARC64
135 default y 298 default y
299 help
300 This adds a driver for the UltraSPARC-III memory controller.
301 Loading this driver allows exact mnemonic strings to be
302 printed in the event of a memory error, so that the faulty DIMM
303 on the motherboard can be matched to the error.
136 304
137config SBUSCHAR 305 If in doubt, say Y, as this information can be very useful.
306
307# Global things across all Sun machines.
308config GENERIC_LOCKBREAK
138 bool 309 bool
139 default y 310 default y
311 depends on SPARC64 && SMP && PREEMPT
312
313choice
314 prompt "SPARC64 Huge TLB Page Size"
315 depends on SPARC64 && HUGETLB_PAGE
316 default HUGETLB_PAGE_SIZE_4MB
317
318config HUGETLB_PAGE_SIZE_4MB
319 bool "4MB"
320
321config HUGETLB_PAGE_SIZE_512K
322 bool "512K"
323
324config HUGETLB_PAGE_SIZE_64K
325 depends on !SPARC64_PAGE_SIZE_64KB
326 bool "64K"
327
328endchoice
329
330config NUMA
331 bool "NUMA support"
332 depends on SPARC64 && SMP
333
334config NODES_SHIFT
335 int
336 default "4"
337 depends on NEED_MULTIPLE_NODES
338
339# Some NUMA nodes have memory ranges that span
340# other nodes. Even though a pfn is valid and
341# between a node's start and end pfns, it may not
342# reside on that node. See memmap_init_zone()
343# for details.
344config NODES_SPAN_OTHER_NODES
345 def_bool y
346 depends on NEED_MULTIPLE_NODES
347
348config ARCH_POPULATES_NODE_MAP
349 def_bool y if SPARC64
350
351config ARCH_SELECT_MEMORY_MODEL
352 def_bool y if SPARC64
353
354config ARCH_SPARSEMEM_ENABLE
355 def_bool y if SPARC64
356 select SPARSEMEM_VMEMMAP_ENABLE
357
358config ARCH_SPARSEMEM_DEFAULT
359 def_bool y if SPARC64
360
361source "mm/Kconfig"
362
363config SCHED_SMT
364 bool "SMT (Hyperthreading) scheduler support"
365 depends on SPARC64 && SMP
366 default y
367 help
368 SMT scheduler support improves the CPU scheduler's decision making
369 when dealing with SPARC cpus at a cost of slightly increased overhead
370 in some places. If unsure say N here.
371
372config SCHED_MC
373 bool "Multi-core scheduler support"
374 depends on SPARC64 && SMP
375 default y
376 help
377 Multi-core scheduler support improves the CPU scheduler's decision
378 making when dealing with multi-core CPU chips at a cost of slightly
379 increased overhead in some places. If unsure say N here.
380
381if SPARC64
382source "kernel/Kconfig.preempt"
383endif
384
385config CMDLINE_BOOL
386 bool "Default bootloader kernel arguments"
387 depends on SPARC64
388
389config CMDLINE
390 string "Initial kernel command string"
391 depends on CMDLINE_BOOL
392 default "console=ttyS0,9600 root=/dev/sda1"
393 help
394 Say Y here if you want to be able to pass default arguments to
395 the kernel. This will be overridden by the bootloader, if you
396 use one (such as SILO). This is most useful if you want to boot
397 a kernel from TFTP, and want default options to be available
398 with having them passed on the command line.
399
400 NOTE: This option WILL override the PROM bootargs setting!
401
402config SUN_PM
403 bool
404 default y if SPARC32
405 help
406 Enable power management and CPU standby features on supported
407 SPARC platforms.
408
409config SPARC_LED
410 tristate "Sun4m LED driver"
411 depends on SPARC32
412 help
413 This driver toggles the front-panel LED on sun4m systems
414 in a user-specifiable manner. Its state can be probed
415 by reading /proc/led and its blinking mode can be changed
416 via writes to /proc/led
140 417
141config SERIAL_CONSOLE 418config SERIAL_CONSOLE
142 bool 419 bool
420 depends on SPARC32
143 default y 421 default y
144 ---help--- 422 ---help---
145 If you say Y here, it will be possible to use a serial port as the 423 If you say Y here, it will be possible to use a serial port as the
@@ -161,71 +439,66 @@ config SERIAL_CONSOLE
161 439
162 If unsure, say N. 440 If unsure, say N.
163 441
164config SUN_AUXIO 442endmenu
165 bool
166 default y
167
168config SUN_IO
169 bool
170 default y
171
172config RWSEM_GENERIC_SPINLOCK
173 bool
174 default y
175 443
176config RWSEM_XCHGADD_ALGORITHM 444menu "Bus options (PCI etc.)"
445config ISA
177 bool 446 bool
447 help
448 ISA is found on Espresso only and is not supported currently.
178 449
179config GENERIC_FIND_NEXT_BIT 450config ISAPNP
180 bool 451 bool
181 default y 452 help
453 ISAPNP is not supported
182 454
183config GENERIC_HWEIGHT 455config EISA
184 bool 456 bool
185 default y 457 help
458 EISA is not supported.
186 459
187config GENERIC_CALIBRATE_DELAY 460config MCA
188 bool 461 bool
189 default y 462 help
463 MCA is not supported.
190 464
191config ARCH_MAY_HAVE_PC_FDC 465config SBUS
192 bool 466 bool
193 default y 467 default y
194 468
195config ARCH_HAS_ILOG2_U32 469config SBUSCHAR
196 bool
197 default n
198
199config ARCH_HAS_ILOG2_U64
200 bool
201 default n
202
203config EMULATED_CMPXCHG
204 bool 470 bool
205 default y 471 default y
206 help
207 Sparc32 does not have a CAS instruction like sparc64. cmpxchg()
208 is emulated, and therefore it is not completely atomic.
209 472
210config SUN_PM 473config SUN_LDOMS
211 bool 474 bool "Sun Logical Domains support"
212 default y 475 depends on SPARC64
213 help 476 help
214 Enable power management and CPU standby features on supported 477 Say Y here is you want to support virtual devices via
215 SPARC platforms. 478 Logical Domains.
216 479
217config PCI 480config PCI
218 bool "Support for PCI and PS/2 keyboard/mouse" 481 bool "Support for PCI and PS/2 keyboard/mouse"
219 help 482 help
483 Find out whether your system includes a PCI bus. PCI is the name of
484 a bus system, i.e. the way the CPU talks to the other stuff inside
485 your box. If you say Y here, the kernel will include drivers and
486 infrastructure code to support PCI bus devices.
487
220 CONFIG_PCI is needed for all JavaStation's (including MrCoffee), 488 CONFIG_PCI is needed for all JavaStation's (including MrCoffee),
221 CP-1200, JavaEngine-1, Corona, Red October, and Serengeti SGSC. 489 CP-1200, JavaEngine-1, Corona, Red October, and Serengeti SGSC.
222 All of these platforms are extremely obscure, so say N if unsure. 490 All of these platforms are extremely obscure, so say N if unsure.
223 491
492config PCI_DOMAINS
493 def_bool PCI if SPARC64
494
224config PCI_SYSCALL 495config PCI_SYSCALL
225 def_bool PCI 496 def_bool PCI
226 497
227source "drivers/pci/Kconfig" 498source "drivers/pci/Kconfig"
228 499
500source "drivers/pcmcia/Kconfig"
501
229config SUN_OPENPROMFS 502config SUN_OPENPROMFS
230 tristate "Openprom tree appears in /proc/openprom" 503 tristate "Openprom tree appears in /proc/openprom"
231 help 504 help
@@ -239,17 +512,33 @@ config SUN_OPENPROMFS
239 Only choose N if you know in advance that you will not need to modify 512 Only choose N if you know in advance that you will not need to modify
240 OpenPROM settings on the running system. 513 OpenPROM settings on the running system.
241 514
242config SPARC_LED 515# Makefile helpers
243 tristate "Sun4m LED driver" 516config SPARC32_PCI
244 help 517 bool
245 This driver toggles the front-panel LED on sun4m systems 518 default y
246 in a user-specifiable manner. Its state can be probed 519 depends on SPARC32 && PCI
247 by reading /proc/led and its blinking mode can be changed 520
248 via writes to /proc/led 521config SPARC64_PCI
522 bool
523 default y
524 depends on SPARC64 && PCI
525
526endmenu
527
528menu "Executable file formats"
249 529
250source "fs/Kconfig.binfmt" 530source "fs/Kconfig.binfmt"
251 531
252source "mm/Kconfig" 532config COMPAT
533 bool
534 depends on SPARC64
535 default y
536 select COMPAT_BINFMT_ELF
537
538config SYSVIPC_COMPAT
539 bool
540 depends on COMPAT && SYSVIPC
541 default y
253 542
254endmenu 543endmenu
255 544
@@ -259,40 +548,6 @@ source "drivers/Kconfig"
259 548
260source "drivers/sbus/char/Kconfig" 549source "drivers/sbus/char/Kconfig"
261 550
262# This one must be before the filesystem configs. -DaveM
263
264menu "Unix98 PTY support"
265
266config UNIX98_PTYS
267 bool "Unix98 PTY support"
268 ---help---
269 A pseudo terminal (PTY) is a software device consisting of two
270 halves: a master and a slave. The slave device behaves identical to
271 a physical terminal; the master device is used by a process to
272 read data from and write data to the slave, thereby emulating a
273 terminal. Typical programs for the master side are telnet servers
274 and xterms.
275
276 Linux has traditionally used the BSD-like names /dev/ptyxx for
277 masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
278 has a number of problems. The GNU C library glibc 2.1 and later,
279 however, supports the Unix98 naming standard: in order to acquire a
280 pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
281 terminal is then made available to the process and the pseudo
282 terminal slave can be accessed as /dev/pts/<number>. What was
283 traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
284
285 The entries in /dev/pts/ are created on the fly by a virtual
286 file system; therefore, if you say Y here you should say Y to
287 "/dev/pts file system for Unix98 PTYs" as well.
288
289 If you want to say Y here, you need to have the C library glibc 2.1
290 or later (equal to libc-6.1, check with "ls -l /lib/libc.so.*").
291 Read the instructions in <file:Documentation/Changes> pertaining to
292 pseudo terminals. It's safe to say N.
293
294endmenu
295
296source "fs/Kconfig" 551source "fs/Kconfig"
297 552
298source "arch/sparc/Kconfig.debug" 553source "arch/sparc/Kconfig.debug"
diff --git a/arch/sparc/Kconfig.debug b/arch/sparc/Kconfig.debug
index 87dd496f15eb..b8a15e271bfa 100644
--- a/arch/sparc/Kconfig.debug
+++ b/arch/sparc/Kconfig.debug
@@ -15,4 +15,30 @@ config DEBUG_STACK_USAGE
15 15
16 This option will slow down process creation somewhat. 16 This option will slow down process creation somewhat.
17 17
18config DEBUG_DCFLUSH
19 bool "D-cache flush debugging"
20 depends on SPARC64 && DEBUG_KERNEL
21
22config STACK_DEBUG
23 bool "Stack Overflow Detection Support"
24
25config DEBUG_PAGEALLOC
26 bool "Debug page memory allocations"
27 depends on SPARC64 && DEBUG_KERNEL && !HIBERNATION
28 help
29 Unmap pages from the kernel linear mapping after free_pages().
30 This results in a large slowdown, but helps to find certain types
31 of memory corruptions.
32
33config MCOUNT
34 bool
35 depends on SPARC64
36 depends on STACK_DEBUG || FUNCTION_TRACER
37 default y
38
39config FRAME_POINTER
40 bool
41 depends on MCOUNT
42 default y
43
18endmenu 44endmenu
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 9592889a6fd0..2003ded054c2 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -2,18 +2,31 @@
2# sparc/Makefile 2# sparc/Makefile
3# 3#
4# Makefile for the architecture dependent flags and dependencies on the 4# Makefile for the architecture dependent flags and dependencies on the
5# Sparc. 5# Sparc and sparc64.
6# 6#
7# Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) 7# Copyright (C) 1994,1996,1998 David S. Miller (davem@caip.rutgers.edu)
8# Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
9
10# We are not yet configured - so test on arch
11ifeq ($(ARCH),sparc)
12 KBUILD_DEFCONFIG := sparc32_defconfig
13else
14 KBUILD_DEFCONFIG := sparc64_defconfig
15endif
16
17ifeq ($(CONFIG_SPARC32),y)
18#####
19# sparc32
8# 20#
9 21
10# 22#
11# Uncomment the first KBUILD_CFLAGS if you are doing kgdb source level 23# Uncomment the first KBUILD_CFLAGS if you are doing kgdb source level
12# debugging of the kernel to get the proper debugging information. 24# debugging of the kernel to get the proper debugging information.
13 25
14AS := $(AS) -32 26AS := $(AS) -32
15LDFLAGS := -m elf32_sparc 27LDFLAGS := -m elf32_sparc
16CHECKFLAGS += -D__sparc__ 28CHECKFLAGS += -D__sparc__
29export BITS := 32
17 30
18#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 31#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
19KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 32KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
@@ -25,38 +38,60 @@ CPPFLAGS_vmlinux.lds += -m32
25# Actual linking is done with "make image". 38# Actual linking is done with "make image".
26LDFLAGS_vmlinux = -r 39LDFLAGS_vmlinux = -r
27 40
28head-y := arch/sparc/kernel/head.o arch/sparc/kernel/init_task.o 41# Default target
29HEAD_Y := $(head-y) 42all: zImage
43
44
45else
46#####
47# sparc64
48#
30 49
31core-y += arch/sparc/kernel/ arch/sparc/mm/ arch/sparc/math-emu/ 50CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
32libs-y += arch/sparc/prom/ arch/sparc/lib/ 51
52# Undefine sparc when processing vmlinux.lds - it is used
53# And teach CPP we are doing 64 bit builds (for this case)
54CPPFLAGS_vmlinux.lds += -m64 -Usparc
55LDFLAGS := -m elf64_sparc
56export BITS := 64
57
58KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
59 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
60 -Wa,--undeclared-regs
61KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
62KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
63
64ifeq ($(CONFIG_MCOUNT),y)
65 KBUILD_CFLAGS += -pg
66endif
67
68endif
69
70head-y := arch/sparc/kernel/head_$(BITS).o
71head-y += arch/sparc/kernel/init_task.o
72
73core-y += arch/sparc/kernel/
74core-y += arch/sparc/mm/ arch/sparc/math-emu/
75
76libs-y += arch/sparc/prom/
77libs-y += arch/sparc/lib/
33 78
34drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ 79drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/
35 80
36# Export what is needed by arch/sparc/boot/Makefile 81# Export what is needed by arch/sparc/boot/Makefile
37# Renaming is done to avoid confusing pattern matching rules in 2.5.45 (multy-) 82export VMLINUX_INIT VMLINUX_MAIN
38INIT_Y := $(patsubst %/, %/built-in.o, $(init-y)) 83VMLINUX_INIT := $(head-y) $(init-y)
39CORE_Y := $(core-y) 84VMLINUX_MAIN := $(core-y) kernel/ mm/ fs/ ipc/ security/ crypto/ block/
40CORE_Y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ 85VMLINUX_MAIN += $(patsubst %/, %/lib.a, $(libs-y)) $(libs-y)
41CORE_Y := $(patsubst %/, %/built-in.o, $(CORE_Y)) 86VMLINUX_MAIN += $(drivers-y) $(net-y)
42DRIVERS_Y := $(patsubst %/, %/built-in.o, $(drivers-y))
43NET_Y := $(patsubst %/, %/built-in.o, $(net-y))
44LIBS_Y1 := $(patsubst %/, %/lib.a, $(libs-y))
45LIBS_Y2 := $(patsubst %/, %/built-in.o, $(libs-y))
46LIBS_Y := $(LIBS_Y1) $(LIBS_Y2)
47 87
48ifdef CONFIG_KALLSYMS 88ifdef CONFIG_KALLSYMS
49kallsyms.o := .tmp_kallsyms2.o 89export kallsyms.o := .tmp_kallsyms2.o
50endif 90endif
51 91
52export INIT_Y CORE_Y DRIVERS_Y NET_Y LIBS_Y HEAD_Y kallsyms.o
53
54# Default target
55all: zImage
56
57boot := arch/sparc/boot 92boot := arch/sparc/boot
58 93
59image zImage tftpboot.img: vmlinux 94image zImage tftpboot.img vmlinux.aout: vmlinux
60 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 95 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
61 96
62archclean: 97archclean:
@@ -65,11 +100,17 @@ archclean:
65# This is the image used for packaging 100# This is the image used for packaging
66KBUILD_IMAGE := $(boot)/zImage 101KBUILD_IMAGE := $(boot)/zImage
67 102
68CLEAN_FILES += arch/$(ARCH)/boot/System.map
69
70# Don't use tabs in echo arguments. 103# Don't use tabs in echo arguments.
104ifeq ($(ARCH),sparc)
71define archhelp 105define archhelp
72 echo '* image - kernel image ($(boot)/image)' 106 echo '* image - kernel image ($(boot)/image)'
73 echo '* zImage - stripped kernel image ($(boot)/zImage)' 107 echo '* zImage - stripped kernel image ($(boot)/zImage)'
74 echo ' tftpboot.img - image prepared for tftp' 108 echo ' tftpboot.img - image prepared for tftp'
75endef 109endef
110else
111define archhelp
112 echo '* vmlinux - Standard sparc64 kernel'
113 echo ' vmlinux.aout - a.out kernel for sparc64'
114 echo ' tftpboot.img - image prepared for tftp'
115endef
116endif
diff --git a/arch/sparc64/boot/.gitignore b/arch/sparc/boot/.gitignore
index 36356f9d498e..fc6f3986c76c 100644
--- a/arch/sparc64/boot/.gitignore
+++ b/arch/sparc/boot/.gitignore
@@ -1,4 +1,8 @@
1btfix.S
2btfixupprep
1image 3image
4zImage
2tftpboot.img 5tftpboot.img
3vmlinux.aout 6vmlinux.aout
4piggyback 7piggyback
8
diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
index 3e77a9f52248..96041a8d39e8 100644
--- a/arch/sparc/boot/Makefile
+++ b/arch/sparc/boot/Makefile
@@ -6,13 +6,16 @@
6ROOT_IMG := /usr/src/root.img 6ROOT_IMG := /usr/src/root.img
7ELFTOAOUT := elftoaout 7ELFTOAOUT := elftoaout
8 8
9hostprogs-y := piggyback btfixupprep 9hostprogs-y := piggyback_32 piggyback_64 btfixupprep
10targets := tftpboot.img btfix.o btfix.S image 10targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout
11clean-files := System.map
11 12
12quiet_cmd_elftoaout = ELFTOAOUT $@ 13quiet_cmd_elftoaout = ELFTOAOUT $@
13 cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@ 14 cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
15
16ifeq ($(CONFIG_SPARC32),y)
14quiet_cmd_piggy = PIGGY $@ 17quiet_cmd_piggy = PIGGY $@
15 cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG) 18 cmd_piggy = $(obj)/piggyback_32 $@ $(obj)/System.map $(ROOT_IMG)
16quiet_cmd_btfix = BTFIX $@ 19quiet_cmd_btfix = BTFIX $@
17 cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@ 20 cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
18quiet_cmd_sysmap = SYSMAP $(obj)/System.map 21quiet_cmd_sysmap = SYSMAP $(obj)/System.map
@@ -37,8 +40,8 @@ define rule_image
37 echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd 40 echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
38endef 41endef
39 42
40BTOBJS := $(HEAD_Y) $(INIT_Y) 43BTOBJS := $(patsubst %/, %/built-in.o, $(VMLINUX_INIT))
41BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y) 44BTLIBS := $(patsubst %/, %/built-in.o, $(VMLINUX_MAIN))
42LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \ 45LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \
43 --start-group $(BTLIBS) --end-group \ 46 --start-group $(BTLIBS) --end-group \
44 $(kallsyms.o) $(obj)/btfix.o 47 $(kallsyms.o) $(obj)/btfix.o
@@ -61,3 +64,28 @@ $(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
61 64
62$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE 65$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
63 $(call if_changed,btfix) 66 $(call if_changed,btfix)
67
68endif
69
70ifeq ($(CONFIG_SPARC64),y)
71quiet_cmd_piggy = PIGGY $@
72 cmd_piggy = $(obj)/piggyback_64 $@ System.map $(ROOT_IMG)
73quiet_cmd_strip = STRIP $@
74 cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start vmlinux -o $@
75
76
77# Actual linking
78$(obj)/image: vmlinux FORCE
79 $(call if_changed,strip)
80 @echo ' kernel: $@ is ready'
81
82$(obj)/tftpboot.img: vmlinux $(obj)/piggyback_64 System.map $(ROOT_IMG) FORCE
83 $(call if_changed,elftoaout)
84 $(call if_changed,piggy)
85 @echo ' kernel: $@ is ready'
86
87$(obj)/vmlinux.aout: vmlinux FORCE
88 $(call if_changed,elftoaout)
89 @echo ' kernel: $@ is ready'
90endif
91
diff --git a/arch/sparc/boot/piggyback.c b/arch/sparc/boot/piggyback_32.c
index c9f500c1a8b2..c9f500c1a8b2 100644
--- a/arch/sparc/boot/piggyback.c
+++ b/arch/sparc/boot/piggyback_32.c
diff --git a/arch/sparc64/boot/piggyback.c b/arch/sparc/boot/piggyback_64.c
index de364bfed0bb..de364bfed0bb 100644
--- a/arch/sparc64/boot/piggyback.c
+++ b/arch/sparc/boot/piggyback_64.c
diff --git a/arch/sparc/defconfig b/arch/sparc/configs/sparc32_defconfig
index 2e3a149ea0e7..2e3a149ea0e7 100644
--- a/arch/sparc/defconfig
+++ b/arch/sparc/configs/sparc32_defconfig
diff --git a/arch/sparc64/defconfig b/arch/sparc/configs/sparc64_defconfig
index 05d19a3e590f..05d19a3e590f 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 2d2769d766ec..89c260aab45c 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -15,8 +15,6 @@ header-y += signal_32.h
15header-y += signal_64.h 15header-y += signal_64.h
16header-y += stat_32.h 16header-y += stat_32.h
17header-y += stat_64.h 17header-y += stat_64.h
18header-y += unistd_32.h
19header-y += unistd_64.h
20 18
21header-y += apc.h 19header-y += apc.h
22header-y += asi.h 20header-y += asi.h
diff --git a/arch/sparc/include/asm/asm.h b/arch/sparc/include/asm/asm.h
new file mode 100644
index 000000000000..e8e1d94b4cc9
--- /dev/null
+++ b/arch/sparc/include/asm/asm.h
@@ -0,0 +1,40 @@
1#ifndef _SPARC_ASM_H
2#define _SPARC_ASM_H
3
4/* Macros to assist the sharing of assembler code between 32-bit and
5 * 64-bit sparc.
6 */
7
8#ifdef CONFIG_SPARC64
9#define BRANCH32(TYPE, PREDICT, DEST) \
10 TYPE,PREDICT %icc, DEST
11#define BRANCH32_ANNUL(TYPE, PREDICT, DEST) \
12 TYPE,a,PREDICT %icc, DEST
13#define BRANCH_REG_ZERO(PREDICT, REG, DEST) \
14 brz,PREDICT REG, DEST
15#define BRANCH_REG_ZERO_ANNUL(PREDICT, REG, DEST) \
16 brz,a,PREDICT REG, DEST
17#define BRANCH_REG_NOT_ZERO(PREDICT, REG, DEST) \
18 brnz,PREDICT REG, DEST
19#define BRANCH_REG_NOT_ZERO_ANNUL(PREDICT, REG, DEST) \
20 brnz,a,PREDICT REG, DEST
21#else
22#define BRANCH32(TYPE, PREDICT, DEST) \
23 TYPE DEST
24#define BRANCH32_ANNUL(TYPE, PREDICT, DEST) \
25 TYPE,a DEST
26#define BRANCH_REG_ZERO(PREDICT, REG, DEST) \
27 cmp REG, 0; \
28 be DEST
29#define BRANCH_REG_ZERO_ANNUL(PREDICT, REG, DEST) \
30 cmp REG, 0; \
31 be,a DEST
32#define BRANCH_REG_NOT_ZERO(PREDICT, REG, DEST) \
33 cmp REG, 0; \
34 bne DEST
35#define BRANCH_REG_NOT_ZERO_ANNUL(PREDICT, REG, DEST) \
36 cmp REG, 0; \
37 bne,a DEST
38#endif
39
40#endif /* _SPARC_ASM_H */
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index 2c71ec4a3b18..5982c5ae7f07 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -112,17 +112,10 @@ static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
112#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 112#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
113 113
114/* Atomic operations are already serializing */ 114/* Atomic operations are already serializing */
115#ifdef CONFIG_SMP
116#define smp_mb__before_atomic_dec() membar_storeload_loadload();
117#define smp_mb__after_atomic_dec() membar_storeload_storestore();
118#define smp_mb__before_atomic_inc() membar_storeload_loadload();
119#define smp_mb__after_atomic_inc() membar_storeload_storestore();
120#else
121#define smp_mb__before_atomic_dec() barrier() 115#define smp_mb__before_atomic_dec() barrier()
122#define smp_mb__after_atomic_dec() barrier() 116#define smp_mb__after_atomic_dec() barrier()
123#define smp_mb__before_atomic_inc() barrier() 117#define smp_mb__before_atomic_inc() barrier()
124#define smp_mb__after_atomic_inc() barrier() 118#define smp_mb__after_atomic_inc() barrier()
125#endif
126 119
127#include <asm-generic/atomic.h> 120#include <asm-generic/atomic.h>
128#endif /* !(__ARCH_SPARC64_ATOMIC__) */ 121#endif /* !(__ARCH_SPARC64_ATOMIC__) */
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
index bb87b8080220..e72ac9cdfb98 100644
--- a/arch/sparc/include/asm/bitops_64.h
+++ b/arch/sparc/include/asm/bitops_64.h
@@ -23,13 +23,8 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr);
23 23
24#include <asm-generic/bitops/non-atomic.h> 24#include <asm-generic/bitops/non-atomic.h>
25 25
26#ifdef CONFIG_SMP
27#define smp_mb__before_clear_bit() membar_storeload_loadload()
28#define smp_mb__after_clear_bit() membar_storeload_storestore()
29#else
30#define smp_mb__before_clear_bit() barrier() 26#define smp_mb__before_clear_bit() barrier()
31#define smp_mb__after_clear_bit() barrier() 27#define smp_mb__after_clear_bit() barrier()
32#endif
33 28
34#include <asm-generic/bitops/ffz.h> 29#include <asm-generic/bitops/ffz.h>
35#include <asm-generic/bitops/__ffs.h> 30#include <asm-generic/bitops/__ffs.h>
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h
index 109ae24ba242..bafe5a631b6d 100644
--- a/arch/sparc/include/asm/hypervisor.h
+++ b/arch/sparc/include/asm/hypervisor.h
@@ -2713,6 +2713,30 @@ extern unsigned long sun4v_ldc_revoke(unsigned long channel,
2713 */ 2713 */
2714#define HV_FAST_SET_PERFREG 0x101 2714#define HV_FAST_SET_PERFREG 0x101
2715 2715
2716#define HV_N2_PERF_SPARC_CTL 0x0
2717#define HV_N2_PERF_DRAM_CTL0 0x1
2718#define HV_N2_PERF_DRAM_CNT0 0x2
2719#define HV_N2_PERF_DRAM_CTL1 0x3
2720#define HV_N2_PERF_DRAM_CNT1 0x4
2721#define HV_N2_PERF_DRAM_CTL2 0x5
2722#define HV_N2_PERF_DRAM_CNT2 0x6
2723#define HV_N2_PERF_DRAM_CTL3 0x7
2724#define HV_N2_PERF_DRAM_CNT3 0x8
2725
2726#define HV_FAST_N2_GET_PERFREG 0x104
2727#define HV_FAST_N2_SET_PERFREG 0x105
2728
2729#ifndef __ASSEMBLY__
2730extern unsigned long sun4v_niagara_getperf(unsigned long reg,
2731 unsigned long *val);
2732extern unsigned long sun4v_niagara_setperf(unsigned long reg,
2733 unsigned long val);
2734extern unsigned long sun4v_niagara2_getperf(unsigned long reg,
2735 unsigned long *val);
2736extern unsigned long sun4v_niagara2_setperf(unsigned long reg,
2737 unsigned long val);
2738#endif
2739
2716/* MMU statistics services. 2740/* MMU statistics services.
2717 * 2741 *
2718 * The hypervisor maintains MMU statistics and privileged code provides 2742 * The hypervisor maintains MMU statistics and privileged code provides
diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h
index fe205cc444b8..ea43057d4763 100644
--- a/arch/sparc/include/asm/irq_32.h
+++ b/arch/sparc/include/asm/irq_32.h
@@ -12,4 +12,5 @@
12 12
13#define irq_canonicalize(irq) (irq) 13#define irq_canonicalize(irq) (irq)
14 14
15extern void __init init_IRQ(void);
15#endif 16#endif
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h
index 71673eca3660..d47d4a1955a9 100644
--- a/arch/sparc/include/asm/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
@@ -66,6 +66,9 @@ extern void virt_irq_free(unsigned int virt_irq);
66extern void __init init_IRQ(void); 66extern void __init init_IRQ(void);
67extern void fixup_irqs(void); 67extern void fixup_irqs(void);
68 68
69extern int register_perfctr_intr(void (*handler)(struct pt_regs *));
70extern void release_perfctr_intr(void (*handler)(struct pt_regs *));
71
69static inline void set_softint(unsigned long bits) 72static inline void set_softint(unsigned long bits)
70{ 73{
71 __asm__ __volatile__("wr %0, 0x0, %%set_softint" 74 __asm__ __volatile__("wr %0, 0x0, %%set_softint"
diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
index bb42e59162aa..8b49bf920df3 100644
--- a/arch/sparc/include/asm/irqflags_64.h
+++ b/arch/sparc/include/asm/irqflags_64.h
@@ -10,6 +10,8 @@
10#ifndef _ASM_IRQFLAGS_H 10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H 11#define _ASM_IRQFLAGS_H
12 12
13#include <asm/pil.h>
14
13#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
14 16
15static inline unsigned long __raw_local_save_flags(void) 17static inline unsigned long __raw_local_save_flags(void)
@@ -40,9 +42,9 @@ static inline void raw_local_irq_restore(unsigned long flags)
40static inline void raw_local_irq_disable(void) 42static inline void raw_local_irq_disable(void)
41{ 43{
42 __asm__ __volatile__( 44 __asm__ __volatile__(
43 "wrpr 15, %%pil" 45 "wrpr %0, %%pil"
44 : /* no outputs */ 46 : /* no outputs */
45 : /* no inputs */ 47 : "i" (PIL_NORMAL_MAX)
46 : "memory" 48 : "memory"
47 ); 49 );
48} 50}
diff --git a/arch/sparc/include/asm/module.h b/arch/sparc/include/asm/module.h
index e82cf9a3e60e..ff8e02d80334 100644
--- a/arch/sparc/include/asm/module.h
+++ b/arch/sparc/include/asm/module.h
@@ -1,8 +1,24 @@
1#ifndef ___ASM_SPARC_MODULE_H 1#ifndef __SPARC_MODULE_H
2#define ___ASM_SPARC_MODULE_H 2#define __SPARC_MODULE_H
3#if defined(__sparc__) && defined(__arch64__) 3struct mod_arch_specific { };
4#include <asm/module_64.h> 4
5#else 5/*
6#include <asm/module_32.h> 6 * Use some preprocessor magic to define the correct symbol
7#endif 7 * for sparc32 and sparc64.
8#endif 8 * Elf_Addr becomes Elf32_Addr for sparc32 and Elf64_Addr for sparc64
9 */
10#define ___ELF(a, b, c) a##b##c
11#define __ELF(a, b, c) ___ELF(a, b, c)
12#define _Elf(t) __ELF(Elf, CONFIG_BITS, t)
13#define _ELF(t) __ELF(ELF, CONFIG_BITS, t)
14
15#define Elf_Shdr _Elf(_Shdr)
16#define Elf_Sym _Elf(_Sym)
17#define Elf_Ehdr _Elf(_Ehdr)
18#define Elf_Rela _Elf(_Rela)
19#define Elf_Addr _Elf(_Addr)
20
21#define ELF_R_SYM _ELF(_R_SYM)
22#define ELF_R_TYPE _ELF(_R_TYPE)
23
24#endif /* __SPARC_MODULE_H */
diff --git a/arch/sparc/include/asm/module_32.h b/arch/sparc/include/asm/module_32.h
deleted file mode 100644
index cbd9e67b0c0b..000000000000
--- a/arch/sparc/include/asm/module_32.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_SPARC_MODULE_H
2#define _ASM_SPARC_MODULE_H
3struct mod_arch_specific { };
4#define Elf_Shdr Elf32_Shdr
5#define Elf_Sym Elf32_Sym
6#define Elf_Ehdr Elf32_Ehdr
7#endif /* _ASM_SPARC_MODULE_H */
diff --git a/arch/sparc/include/asm/module_64.h b/arch/sparc/include/asm/module_64.h
deleted file mode 100644
index 3d77ba465783..000000000000
--- a/arch/sparc/include/asm/module_64.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_SPARC64_MODULE_H
2#define _ASM_SPARC64_MODULE_H
3struct mod_arch_specific { };
4#define Elf_Shdr Elf64_Shdr
5#define Elf_Sym Elf64_Sym
6#define Elf_Ehdr Elf64_Ehdr
7#endif /* _ASM_SPARC64_MODULE_H */
diff --git a/arch/sparc/include/asm/openprom_32.h b/arch/sparc/include/asm/openprom_32.h
index 8b1649f29ed9..875da3552d80 100644
--- a/arch/sparc/include/asm/openprom_32.h
+++ b/arch/sparc/include/asm/openprom_32.h
@@ -170,9 +170,9 @@ struct linux_romvec {
170struct linux_nodeops { 170struct linux_nodeops {
171 int (*no_nextnode)(int node); 171 int (*no_nextnode)(int node);
172 int (*no_child)(int node); 172 int (*no_child)(int node);
173 int (*no_proplen)(int node, char *name); 173 int (*no_proplen)(int node, const char *name);
174 int (*no_getprop)(int node, char *name, char *val); 174 int (*no_getprop)(int node, const char *name, char *val);
175 int (*no_setprop)(int node, char *name, char *val, int len); 175 int (*no_setprop)(int node, const char *name, char *val, int len);
176 char * (*no_nextprop)(int node, char *name); 176 char * (*no_nextprop)(int node, char *name);
177}; 177};
178 178
diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h
index 699da05235c8..73d45521db04 100644
--- a/arch/sparc/include/asm/oplib_32.h
+++ b/arch/sparc/include/asm/oplib_32.h
@@ -136,7 +136,7 @@ extern char prom_getchar(void);
136extern void prom_putchar(char character); 136extern void prom_putchar(char character);
137 137
138/* Prom's internal routines, don't use in kernel/boot code. */ 138/* Prom's internal routines, don't use in kernel/boot code. */
139extern void prom_printf(char *fmt, ...); 139extern void prom_printf(const char *fmt, ...);
140extern void prom_write(const char *buf, unsigned int len); 140extern void prom_write(const char *buf, unsigned int len);
141 141
142/* Multiprocessor operations... */ 142/* Multiprocessor operations... */
@@ -199,12 +199,12 @@ extern int prom_getsibling(int node);
199/* Get the length, at the passed node, of the given property type. 199/* Get the length, at the passed node, of the given property type.
200 * Returns -1 on error (ie. no such property at this node). 200 * Returns -1 on error (ie. no such property at this node).
201 */ 201 */
202extern int prom_getproplen(int thisnode, char *property); 202extern int prom_getproplen(int thisnode, const char *property);
203 203
204/* Fetch the requested property using the given buffer. Returns 204/* Fetch the requested property using the given buffer. Returns
205 * the number of bytes the prom put into your buffer or -1 on error. 205 * the number of bytes the prom put into your buffer or -1 on error.
206 */ 206 */
207extern int __must_check prom_getproperty(int thisnode, char *property, 207extern int __must_check prom_getproperty(int thisnode, const char *property,
208 char *prop_buffer, int propbuf_size); 208 char *prop_buffer, int propbuf_size);
209 209
210/* Acquire an integer property. */ 210/* Acquire an integer property. */
@@ -246,7 +246,7 @@ extern int prom_node_has_property(int node, char *property);
246/* Set the indicated property at the given node with the passed value. 246/* Set the indicated property at the given node with the passed value.
247 * Returns the number of bytes of your value that the prom took. 247 * Returns the number of bytes of your value that the prom took.
248 */ 248 */
249extern int prom_setprop(int node, char *prop_name, char *prop_value, 249extern int prom_setprop(int node, const char *prop_name, char *prop_value,
250 int value_size); 250 int value_size);
251 251
252extern int prom_pathtoinode(char *path); 252extern int prom_pathtoinode(char *path);
diff --git a/arch/sparc/include/asm/pil.h b/arch/sparc/include/asm/pil.h
index 71819bb943fc..d573820c0ff4 100644
--- a/arch/sparc/include/asm/pil.h
+++ b/arch/sparc/include/asm/pil.h
@@ -10,7 +10,12 @@
10 * 10 *
11 * In fact any XCALL which has to etrap/rtrap has a problem because 11 * In fact any XCALL which has to etrap/rtrap has a problem because
12 * it is difficult to prevent rtrap from running BH's, and that would 12 * it is difficult to prevent rtrap from running BH's, and that would
13 * need to be done if the XCALL arrived while %pil==15. 13 * need to be done if the XCALL arrived while %pil==PIL_NORMAL_MAX.
14 *
15 * Finally, in order to handle profiling events even when a
16 * local_irq_disable() is in progress, we only disable up to level 14
17 * interrupts. Profile counter overflow interrupts arrive at level
18 * 15.
14 */ 19 */
15#define PIL_SMP_CALL_FUNC 1 20#define PIL_SMP_CALL_FUNC 1
16#define PIL_SMP_RECEIVE_SIGNAL 2 21#define PIL_SMP_RECEIVE_SIGNAL 2
@@ -18,5 +23,7 @@
18#define PIL_SMP_CTX_NEW_VERSION 4 23#define PIL_SMP_CTX_NEW_VERSION 4
19#define PIL_DEVICE_IRQ 5 24#define PIL_DEVICE_IRQ 5
20#define PIL_SMP_CALL_FUNC_SNGL 6 25#define PIL_SMP_CALL_FUNC_SNGL 6
26#define PIL_NORMAL_MAX 14
27#define PIL_NMI 15
21 28
22#endif /* !(_SPARC64_PIL_H) */ 29#endif /* !(_SPARC64_PIL_H) */
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h
index ec21a4517641..e580f5581c88 100644
--- a/arch/sparc/include/asm/scatterlist.h
+++ b/arch/sparc/include/asm/scatterlist.h
@@ -1,8 +1,27 @@
1#ifndef ___ASM_SPARC_SCATTERLIST_H 1#ifndef _SPARC_SCATTERLIST_H
2#define ___ASM_SPARC_SCATTERLIST_H 2#define _SPARC_SCATTERLIST_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/scatterlist_64.h> 4#include <asm/page.h>
5#else 5#include <asm/types.h>
6#include <asm/scatterlist_32.h> 6
7#endif 7struct scatterlist {
8#ifdef CONFIG_DEBUG_SG
9 unsigned long sg_magic;
8#endif 10#endif
11 unsigned long page_link;
12 unsigned int offset;
13
14 unsigned int length;
15
16 dma_addr_t dma_address;
17 __u32 dma_length;
18};
19
20#define sg_dma_address(sg) ((sg)->dma_address)
21#define sg_dma_len(sg) ((sg)->dma_length)
22
23#define ISA_DMA_THRESHOLD (~0UL)
24
25#define ARCH_HAS_SG_CHAIN
26
27#endif /* !(_SPARC_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/scatterlist_32.h b/arch/sparc/include/asm/scatterlist_32.h
deleted file mode 100644
index c82609ca1d0f..000000000000
--- a/arch/sparc/include/asm/scatterlist_32.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef _SPARC_SCATTERLIST_H
2#define _SPARC_SCATTERLIST_H
3
4#include <linux/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset;
12
13 unsigned int length;
14
15 __u32 dvma_address; /* A place to hang host-specific addresses at. */
16 __u32 dvma_length;
17};
18
19#define sg_dma_address(sg) ((sg)->dvma_address)
20#define sg_dma_len(sg) ((sg)->dvma_length)
21
22#define ISA_DMA_THRESHOLD (~0UL)
23
24#define ARCH_HAS_SG_CHAIN
25
26#endif /* !(_SPARC_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/scatterlist_64.h b/arch/sparc/include/asm/scatterlist_64.h
deleted file mode 100644
index 81bd058f9382..000000000000
--- a/arch/sparc/include/asm/scatterlist_64.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _SPARC64_SCATTERLIST_H
2#define _SPARC64_SCATTERLIST_H
3
4#include <asm/page.h>
5#include <asm/types.h>
6
7struct scatterlist {
8#ifdef CONFIG_DEBUG_SG
9 unsigned long sg_magic;
10#endif
11 unsigned long page_link;
12 unsigned int offset;
13
14 unsigned int length;
15
16 dma_addr_t dma_address;
17 __u32 dma_length;
18};
19
20#define sg_dma_address(sg) ((sg)->dma_address)
21#define sg_dma_len(sg) ((sg)->dma_length)
22
23#define ISA_DMA_THRESHOLD (~0UL)
24
25#define ARCH_HAS_SG_CHAIN
26
27#endif /* !(_SPARC64_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/sections.h b/arch/sparc/include/asm/sections.h
index c7c69b00967f..0b0553bbd8a0 100644
--- a/arch/sparc/include/asm/sections.h
+++ b/arch/sparc/include/asm/sections.h
@@ -1,8 +1,10 @@
1#ifndef ___ASM_SPARC_SECTIONS_H 1#ifndef __SPARC_SECTIONS_H
2#define ___ASM_SPARC_SECTIONS_H 2#define __SPARC_SECTIONS_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/sections_64.h> 4/* nothing to see, move along */
5#else 5#include <asm-generic/sections.h>
6#include <asm/sections_32.h> 6
7#endif 7/* sparc entry point */
8extern char _start[];
9
8#endif 10#endif
diff --git a/arch/sparc/include/asm/sections_32.h b/arch/sparc/include/asm/sections_32.h
deleted file mode 100644
index 6832841df051..000000000000
--- a/arch/sparc/include/asm/sections_32.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _SPARC_SECTIONS_H
2#define _SPARC_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6#endif
diff --git a/arch/sparc/include/asm/sections_64.h b/arch/sparc/include/asm/sections_64.h
deleted file mode 100644
index 3f4b9fdc28d0..000000000000
--- a/arch/sparc/include/asm/sections_64.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _SPARC64_SECTIONS_H
2#define _SPARC64_SECTIONS_H
3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7extern char _start[];
8
9#endif
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h
index 120cfe4577c7..c4d274d330e9 100644
--- a/arch/sparc/include/asm/spinlock_64.h
+++ b/arch/sparc/include/asm/spinlock_64.h
@@ -13,17 +13,12 @@
13 * and rebuild your kernel. 13 * and rebuild your kernel.
14 */ 14 */
15 15
16/* All of these locking primitives are expected to work properly 16/* Because we play games to save cycles in the non-contention case, we
17 * even in an RMO memory model, which currently is what the kernel 17 * need to be extra careful about branch targets into the "spinning"
18 * runs in. 18 * code. They live in their own section, but the newer V9 branches
19 * 19 * have a shorter range than the traditional 32-bit sparc branch
20 * There is another issue. Because we play games to save cycles 20 * variants. The rule is that the branches that go into and out of
21 * in the non-contention case, we need to be extra careful about 21 * the spinner sections must be pre-V9 branches.
22 * branch targets into the "spinning" code. They live in their
23 * own section, but the newer V9 branches have a shorter range
24 * than the traditional 32-bit sparc branch variants. The rule
25 * is that the branches that go into and out of the spinner sections
26 * must be pre-V9 branches.
27 */ 22 */
28 23
29#define __raw_spin_is_locked(lp) ((lp)->lock != 0) 24#define __raw_spin_is_locked(lp) ((lp)->lock != 0)
@@ -38,12 +33,10 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
38 33
39 __asm__ __volatile__( 34 __asm__ __volatile__(
40"1: ldstub [%1], %0\n" 35"1: ldstub [%1], %0\n"
41" membar #StoreLoad | #StoreStore\n"
42" brnz,pn %0, 2f\n" 36" brnz,pn %0, 2f\n"
43" nop\n" 37" nop\n"
44" .subsection 2\n" 38" .subsection 2\n"
45"2: ldub [%1], %0\n" 39"2: ldub [%1], %0\n"
46" membar #LoadLoad\n"
47" brnz,pt %0, 2b\n" 40" brnz,pt %0, 2b\n"
48" nop\n" 41" nop\n"
49" ba,a,pt %%xcc, 1b\n" 42" ba,a,pt %%xcc, 1b\n"
@@ -59,7 +52,6 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
59 52
60 __asm__ __volatile__( 53 __asm__ __volatile__(
61" ldstub [%1], %0\n" 54" ldstub [%1], %0\n"
62" membar #StoreLoad | #StoreStore"
63 : "=r" (result) 55 : "=r" (result)
64 : "r" (lock) 56 : "r" (lock)
65 : "memory"); 57 : "memory");
@@ -70,7 +62,6 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
70static inline void __raw_spin_unlock(raw_spinlock_t *lock) 62static inline void __raw_spin_unlock(raw_spinlock_t *lock)
71{ 63{
72 __asm__ __volatile__( 64 __asm__ __volatile__(
73" membar #StoreStore | #LoadStore\n"
74" stb %%g0, [%0]" 65" stb %%g0, [%0]"
75 : /* No outputs */ 66 : /* No outputs */
76 : "r" (lock) 67 : "r" (lock)
@@ -83,14 +74,12 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long fla
83 74
84 __asm__ __volatile__( 75 __asm__ __volatile__(
85"1: ldstub [%2], %0\n" 76"1: ldstub [%2], %0\n"
86" membar #StoreLoad | #StoreStore\n"
87" brnz,pn %0, 2f\n" 77" brnz,pn %0, 2f\n"
88" nop\n" 78" nop\n"
89" .subsection 2\n" 79" .subsection 2\n"
90"2: rdpr %%pil, %1\n" 80"2: rdpr %%pil, %1\n"
91" wrpr %3, %%pil\n" 81" wrpr %3, %%pil\n"
92"3: ldub [%2], %0\n" 82"3: ldub [%2], %0\n"
93" membar #LoadLoad\n"
94" brnz,pt %0, 3b\n" 83" brnz,pt %0, 3b\n"
95" nop\n" 84" nop\n"
96" ba,pt %%xcc, 1b\n" 85" ba,pt %%xcc, 1b\n"
@@ -113,12 +102,10 @@ static void inline __read_lock(raw_rwlock_t *lock)
113"4: add %0, 1, %1\n" 102"4: add %0, 1, %1\n"
114" cas [%2], %0, %1\n" 103" cas [%2], %0, %1\n"
115" cmp %0, %1\n" 104" cmp %0, %1\n"
116" membar #StoreLoad | #StoreStore\n"
117" bne,pn %%icc, 1b\n" 105" bne,pn %%icc, 1b\n"
118" nop\n" 106" nop\n"
119" .subsection 2\n" 107" .subsection 2\n"
120"2: ldsw [%2], %0\n" 108"2: ldsw [%2], %0\n"
121" membar #LoadLoad\n"
122" brlz,pt %0, 2b\n" 109" brlz,pt %0, 2b\n"
123" nop\n" 110" nop\n"
124" ba,a,pt %%xcc, 4b\n" 111" ba,a,pt %%xcc, 4b\n"
@@ -139,7 +126,6 @@ static int inline __read_trylock(raw_rwlock_t *lock)
139" add %0, 1, %1\n" 126" add %0, 1, %1\n"
140" cas [%2], %0, %1\n" 127" cas [%2], %0, %1\n"
141" cmp %0, %1\n" 128" cmp %0, %1\n"
142" membar #StoreLoad | #StoreStore\n"
143" bne,pn %%icc, 1b\n" 129" bne,pn %%icc, 1b\n"
144" mov 1, %0\n" 130" mov 1, %0\n"
145"2:" 131"2:"
@@ -155,7 +141,6 @@ static void inline __read_unlock(raw_rwlock_t *lock)
155 unsigned long tmp1, tmp2; 141 unsigned long tmp1, tmp2;
156 142
157 __asm__ __volatile__( 143 __asm__ __volatile__(
158" membar #StoreLoad | #LoadLoad\n"
159"1: lduw [%2], %0\n" 144"1: lduw [%2], %0\n"
160" sub %0, 1, %1\n" 145" sub %0, 1, %1\n"
161" cas [%2], %0, %1\n" 146" cas [%2], %0, %1\n"
@@ -179,12 +164,10 @@ static void inline __write_lock(raw_rwlock_t *lock)
179"4: or %0, %3, %1\n" 164"4: or %0, %3, %1\n"
180" cas [%2], %0, %1\n" 165" cas [%2], %0, %1\n"
181" cmp %0, %1\n" 166" cmp %0, %1\n"
182" membar #StoreLoad | #StoreStore\n"
183" bne,pn %%icc, 1b\n" 167" bne,pn %%icc, 1b\n"
184" nop\n" 168" nop\n"
185" .subsection 2\n" 169" .subsection 2\n"
186"2: lduw [%2], %0\n" 170"2: lduw [%2], %0\n"
187" membar #LoadLoad\n"
188" brnz,pt %0, 2b\n" 171" brnz,pt %0, 2b\n"
189" nop\n" 172" nop\n"
190" ba,a,pt %%xcc, 4b\n" 173" ba,a,pt %%xcc, 4b\n"
@@ -197,7 +180,6 @@ static void inline __write_lock(raw_rwlock_t *lock)
197static void inline __write_unlock(raw_rwlock_t *lock) 180static void inline __write_unlock(raw_rwlock_t *lock)
198{ 181{
199 __asm__ __volatile__( 182 __asm__ __volatile__(
200" membar #LoadStore | #StoreStore\n"
201" stw %%g0, [%0]" 183" stw %%g0, [%0]"
202 : /* no outputs */ 184 : /* no outputs */
203 : "r" (lock) 185 : "r" (lock)
@@ -217,7 +199,6 @@ static int inline __write_trylock(raw_rwlock_t *lock)
217" or %0, %4, %1\n" 199" or %0, %4, %1\n"
218" cas [%3], %0, %1\n" 200" cas [%3], %0, %1\n"
219" cmp %0, %1\n" 201" cmp %0, %1\n"
220" membar #StoreLoad | #StoreStore\n"
221" bne,pn %%icc, 1b\n" 202" bne,pn %%icc, 1b\n"
222" nop\n" 203" nop\n"
223" mov 1, %2\n" 204" mov 1, %2\n"
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 985ea7e31992..f0d0c40c44da 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -6,6 +6,8 @@
6#ifndef _SPARC64_SPITFIRE_H 6#ifndef _SPARC64_SPITFIRE_H
7#define _SPARC64_SPITFIRE_H 7#define _SPARC64_SPITFIRE_H
8 8
9#ifdef CONFIG_SPARC64
10
9#include <asm/asi.h> 11#include <asm/asi.h>
10 12
11/* The following register addresses are accessible via ASI_DMMU 13/* The following register addresses are accessible via ASI_DMMU
@@ -338,5 +340,5 @@ static inline void cheetah_put_itlb_data(int entry, unsigned long data)
338} 340}
339 341
340#endif /* !(__ASSEMBLY__) */ 342#endif /* !(__ASSEMBLY__) */
341 343#endif /* CONFIG_SPARC64 */
342#endif /* !(_SPARC64_SPITFIRE_H) */ 344#endif /* !(_SPARC64_SPITFIRE_H) */
diff --git a/arch/sparc/include/asm/system_32.h b/arch/sparc/include/asm/system_32.h
index 8623fc48fe24..79c1ae2b42a3 100644
--- a/arch/sparc/include/asm/system_32.h
+++ b/arch/sparc/include/asm/system_32.h
@@ -15,6 +15,11 @@
15 15
16#include <linux/irqflags.h> 16#include <linux/irqflags.h>
17 17
18static inline unsigned int probe_irq_mask(unsigned long val)
19{
20 return 0;
21}
22
18/* 23/*
19 * Sparc (general) CPU types 24 * Sparc (general) CPU types
20 */ 25 */
diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h
index 8759f2a1b837..6c077816ab28 100644
--- a/arch/sparc/include/asm/system_64.h
+++ b/arch/sparc/include/asm/system_64.h
@@ -59,20 +59,9 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
59 : : : "memory"); \ 59 : : : "memory"); \
60} while (0) 60} while (0)
61 61
62#define mb() \ 62#define mb() membar_safe("#StoreLoad")
63 membar_safe("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad") 63#define rmb() __asm__ __volatile__("":::"memory")
64#define rmb() \ 64#define wmb() __asm__ __volatile__("":::"memory")
65 membar_safe("#LoadLoad")
66#define wmb() \
67 membar_safe("#StoreStore")
68#define membar_storeload() \
69 membar_safe("#StoreLoad")
70#define membar_storeload_storestore() \
71 membar_safe("#StoreLoad | #StoreStore")
72#define membar_storeload_loadload() \
73 membar_safe("#StoreLoad | #LoadLoad")
74#define membar_storestore_loadstore() \
75 membar_safe("#StoreStore | #LoadStore")
76 65
77#endif 66#endif
78 67
@@ -80,20 +69,20 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
80 69
81#define read_barrier_depends() do { } while(0) 70#define read_barrier_depends() do { } while(0)
82#define set_mb(__var, __value) \ 71#define set_mb(__var, __value) \
83 do { __var = __value; membar_storeload_storestore(); } while(0) 72 do { __var = __value; membar_safe("#StoreLoad"); } while(0)
84 73
85#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
86#define smp_mb() mb() 75#define smp_mb() mb()
87#define smp_rmb() rmb() 76#define smp_rmb() rmb()
88#define smp_wmb() wmb() 77#define smp_wmb() wmb()
89#define smp_read_barrier_depends() read_barrier_depends()
90#else 78#else
91#define smp_mb() __asm__ __volatile__("":::"memory") 79#define smp_mb() __asm__ __volatile__("":::"memory")
92#define smp_rmb() __asm__ __volatile__("":::"memory") 80#define smp_rmb() __asm__ __volatile__("":::"memory")
93#define smp_wmb() __asm__ __volatile__("":::"memory") 81#define smp_wmb() __asm__ __volatile__("":::"memory")
94#define smp_read_barrier_depends() do { } while(0)
95#endif 82#endif
96 83
84#define smp_read_barrier_depends() do { } while(0)
85
97#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") 86#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory")
98 87
99#define flushw_all() __asm__ __volatile__("flushw") 88#define flushw_all() __asm__ __volatile__("flushw")
@@ -107,11 +96,12 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
107 * arch/sparc64/kernel/smp.c:smp_percpu_timer_interrupt() 96 * arch/sparc64/kernel/smp.c:smp_percpu_timer_interrupt()
108 * for more information. 97 * for more information.
109 */ 98 */
110#define reset_pic() \ 99#define write_pic(__p) \
111 __asm__ __volatile__("ba,pt %xcc, 99f\n\t" \ 100 __asm__ __volatile__("ba,pt %%xcc, 99f\n\t" \
112 ".align 64\n" \ 101 ".align 64\n" \
113 "99:wr %g0, 0x0, %pic\n\t" \ 102 "99:wr %0, 0x0, %%pic\n\t" \
114 "rd %pic, %g0") 103 "rd %%pic, %%g0" : : "r" (__p))
104#define reset_pic() write_pic(0)
115 105
116#ifndef __ASSEMBLY__ 106#ifndef __ASSEMBLY__
117 107
@@ -170,6 +160,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
170 "stb %%o5, [%%g6 + %5]\n\t" \ 160 "stb %%o5, [%%g6 + %5]\n\t" \
171 "rdpr %%cwp, %%o5\n\t" \ 161 "rdpr %%cwp, %%o5\n\t" \
172 "stb %%o5, [%%g6 + %8]\n\t" \ 162 "stb %%o5, [%%g6 + %8]\n\t" \
163 "wrpr %%g0, 15, %%pil\n\t" \
173 "mov %4, %%g6\n\t" \ 164 "mov %4, %%g6\n\t" \
174 "ldub [%4 + %8], %%g1\n\t" \ 165 "ldub [%4 + %8], %%g1\n\t" \
175 "wrpr %%g1, %%cwp\n\t" \ 166 "wrpr %%g1, %%cwp\n\t" \
@@ -180,6 +171,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
180 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ 171 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \
181 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ 172 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \
182 "ldx [%%g6 + %9], %%g4\n\t" \ 173 "ldx [%%g6 + %9], %%g4\n\t" \
174 "wrpr %%g0, 14, %%pil\n\t" \
183 "brz,pt %%o7, switch_to_pc\n\t" \ 175 "brz,pt %%o7, switch_to_pc\n\t" \
184 " mov %%g7, %0\n\t" \ 176 " mov %%g7, %0\n\t" \
185 "sethi %%hi(ret_from_syscall), %%g1\n\t" \ 177 "sethi %%hi(ret_from_syscall), %%g1\n\t" \
@@ -209,14 +201,12 @@ static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int va
209 unsigned long tmp1, tmp2; 201 unsigned long tmp1, tmp2;
210 202
211 __asm__ __volatile__( 203 __asm__ __volatile__(
212" membar #StoreLoad | #LoadLoad\n"
213" mov %0, %1\n" 204" mov %0, %1\n"
214"1: lduw [%4], %2\n" 205"1: lduw [%4], %2\n"
215" cas [%4], %2, %0\n" 206" cas [%4], %2, %0\n"
216" cmp %2, %0\n" 207" cmp %2, %0\n"
217" bne,a,pn %%icc, 1b\n" 208" bne,a,pn %%icc, 1b\n"
218" mov %1, %0\n" 209" mov %1, %0\n"
219" membar #StoreLoad | #StoreStore\n"
220 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) 210 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2)
221 : "0" (val), "r" (m) 211 : "0" (val), "r" (m)
222 : "cc", "memory"); 212 : "cc", "memory");
@@ -228,14 +218,12 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long
228 unsigned long tmp1, tmp2; 218 unsigned long tmp1, tmp2;
229 219
230 __asm__ __volatile__( 220 __asm__ __volatile__(
231" membar #StoreLoad | #LoadLoad\n"
232" mov %0, %1\n" 221" mov %0, %1\n"
233"1: ldx [%4], %2\n" 222"1: ldx [%4], %2\n"
234" casx [%4], %2, %0\n" 223" casx [%4], %2, %0\n"
235" cmp %2, %0\n" 224" cmp %2, %0\n"
236" bne,a,pn %%xcc, 1b\n" 225" bne,a,pn %%xcc, 1b\n"
237" mov %1, %0\n" 226" mov %1, %0\n"
238" membar #StoreLoad | #StoreStore\n"
239 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) 227 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2)
240 : "0" (val), "r" (m) 228 : "0" (val), "r" (m)
241 : "cc", "memory"); 229 : "cc", "memory");
@@ -272,9 +260,7 @@ extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noret
272static inline unsigned long 260static inline unsigned long
273__cmpxchg_u32(volatile int *m, int old, int new) 261__cmpxchg_u32(volatile int *m, int old, int new)
274{ 262{
275 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" 263 __asm__ __volatile__("cas [%2], %3, %0"
276 "cas [%2], %3, %0\n\t"
277 "membar #StoreLoad | #StoreStore"
278 : "=&r" (new) 264 : "=&r" (new)
279 : "0" (new), "r" (m), "r" (old) 265 : "0" (new), "r" (m), "r" (old)
280 : "memory"); 266 : "memory");
@@ -285,9 +271,7 @@ __cmpxchg_u32(volatile int *m, int old, int new)
285static inline unsigned long 271static inline unsigned long
286__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) 272__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
287{ 273{
288 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" 274 __asm__ __volatile__("casx [%2], %3, %0"
289 "casx [%2], %3, %0\n\t"
290 "membar #StoreLoad | #StoreStore"
291 : "=&r" (new) 275 : "=&r" (new)
292 : "0" (new), "r" (m), "r" (old) 276 : "0" (new), "r" (m), "r" (old)
293 : "memory"); 277 : "memory");
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
index 76e4299dd9bc..83c571d8c8a7 100644
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -50,8 +50,6 @@
50#define TSB_TAG_INVALID_BIT 46 50#define TSB_TAG_INVALID_BIT 46
51#define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32)) 51#define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32))
52 52
53#define TSB_MEMBAR membar #StoreStore
54
55/* Some cpus support physical address quad loads. We want to use 53/* Some cpus support physical address quad loads. We want to use
56 * those if possible so we don't need to hard-lock the TSB mapping 54 * those if possible so we don't need to hard-lock the TSB mapping
57 * into the TLB. We encode some instruction patching in order to 55 * into the TLB. We encode some instruction patching in order to
@@ -128,13 +126,11 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
128 cmp REG1, REG2; \ 126 cmp REG1, REG2; \
129 bne,pn %icc, 99b; \ 127 bne,pn %icc, 99b; \
130 nop; \ 128 nop; \
131 TSB_MEMBAR
132 129
133#define TSB_WRITE(TSB, TTE, TAG) \ 130#define TSB_WRITE(TSB, TTE, TAG) \
134 add TSB, 0x8, TSB; \ 131 add TSB, 0x8, TSB; \
135 TSB_STORE(TSB, TTE); \ 132 TSB_STORE(TSB, TTE); \
136 sub TSB, 0x8, TSB; \ 133 sub TSB, 0x8, TSB; \
137 TSB_MEMBAR; \
138 TSB_STORE(TSB, TAG); 134 TSB_STORE(TSB, TAG);
139 135
140#define KTSB_LOAD_QUAD(TSB, REG) \ 136#define KTSB_LOAD_QUAD(TSB, REG) \
@@ -153,13 +149,11 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
153 cmp REG1, REG2; \ 149 cmp REG1, REG2; \
154 bne,pn %icc, 99b; \ 150 bne,pn %icc, 99b; \
155 nop; \ 151 nop; \
156 TSB_MEMBAR
157 152
158#define KTSB_WRITE(TSB, TTE, TAG) \ 153#define KTSB_WRITE(TSB, TTE, TAG) \
159 add TSB, 0x8, TSB; \ 154 add TSB, 0x8, TSB; \
160 stxa TTE, [TSB] ASI_N; \ 155 stxa TTE, [TSB] ASI_N; \
161 sub TSB, 0x8, TSB; \ 156 sub TSB, 0x8, TSB; \
162 TSB_MEMBAR; \
163 stxa TAG, [TSB] ASI_N; 157 stxa TAG, [TSB] ASI_N;
164 158
165 /* Do a kernel page table walk. Leaves physical PTE pointer in 159 /* Do a kernel page table walk. Leaves physical PTE pointer in
diff --git a/arch/sparc/include/asm/ttable.h b/arch/sparc/include/asm/ttable.h
index 5708ba2719fb..48f2807d3265 100644
--- a/arch/sparc/include/asm/ttable.h
+++ b/arch/sparc/include/asm/ttable.h
@@ -2,6 +2,7 @@
2#define _SPARC64_TTABLE_H 2#define _SPARC64_TTABLE_H
3 3
4#include <asm/utrap.h> 4#include <asm/utrap.h>
5#include <asm/pil.h>
5 6
6#ifdef __ASSEMBLY__ 7#ifdef __ASSEMBLY__
7#include <asm/thread_info.h> 8#include <asm/thread_info.h>
@@ -123,7 +124,7 @@
123 124
124#define TRAP_IRQ(routine, level) \ 125#define TRAP_IRQ(routine, level) \
125 rdpr %pil, %g2; \ 126 rdpr %pil, %g2; \
126 wrpr %g0, 15, %pil; \ 127 wrpr %g0, PIL_NORMAL_MAX, %pil; \
127 sethi %hi(1f-4), %g7; \ 128 sethi %hi(1f-4), %g7; \
128 ba,pt %xcc, etrap_irq; \ 129 ba,pt %xcc, etrap_irq; \
129 or %g7, %lo(1f-4), %g7; \ 130 or %g7, %lo(1f-4), %g7; \
@@ -143,7 +144,7 @@
143 144
144#define TRAP_IRQ(routine, level) \ 145#define TRAP_IRQ(routine, level) \
145 rdpr %pil, %g2; \ 146 rdpr %pil, %g2; \
146 wrpr %g0, 15, %pil; \ 147 wrpr %g0, PIL_NORMAL_MAX, %pil; \
147 ba,pt %xcc, etrap_irq; \ 148 ba,pt %xcc, etrap_irq; \
148 rd %pc, %g7; \ 149 rd %pc, %g7; \
149 mov level, %o0; \ 150 mov level, %o0; \
@@ -153,6 +154,16 @@
153 154
154#endif 155#endif
155 156
157#define TRAP_NMI_IRQ(routine, level) \
158 rdpr %pil, %g2; \
159 wrpr %g0, PIL_NMI, %pil; \
160 ba,pt %xcc, etrap_irq; \
161 rd %pc, %g7; \
162 mov level, %o0; \
163 call routine; \
164 add %sp, PTREGS_OFF, %o1; \
165 ba,a,pt %xcc, rtrap_nmi;
166
156#define TRAP_IVEC TRAP_NOSAVE(do_ivec) 167#define TRAP_IVEC TRAP_NOSAVE(do_ivec)
157 168
158#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl) 169#define BTRAP(lvl) TRAP_ARG(bad_trap, lvl)
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 4207fb362da0..031f038b19f7 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -1,8 +1,444 @@
1#ifndef ___ASM_SPARC_UNISTD_H 1#ifndef _SPARC_UNISTD_H
2#define ___ASM_SPARC_UNISTD_H 2#define _SPARC_UNISTD_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/unistd_64.h> 4/*
5 * System calls under the Sparc.
6 *
7 * Don't be scared by the ugly clobbers, it is the only way I can
8 * think of right now to force the arguments into fixed registers
9 * before the trap into the system call with gcc 'asm' statements.
10 *
11 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
12 *
13 * SunOS compatibility based upon preliminary work which is:
14 *
15 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
16 */
17#ifndef __32bit_syscall_numbers__
18#ifndef __arch64__
19#define __32bit_syscall_numbers__
20#endif
21#endif
22
23#define __NR_restart_syscall 0 /* Linux Specific */
24#define __NR_exit 1 /* Common */
25#define __NR_fork 2 /* Common */
26#define __NR_read 3 /* Common */
27#define __NR_write 4 /* Common */
28#define __NR_open 5 /* Common */
29#define __NR_close 6 /* Common */
30#define __NR_wait4 7 /* Common */
31#define __NR_creat 8 /* Common */
32#define __NR_link 9 /* Common */
33#define __NR_unlink 10 /* Common */
34#define __NR_execv 11 /* SunOS Specific */
35#define __NR_chdir 12 /* Common */
36#define __NR_chown 13 /* Common */
37#define __NR_mknod 14 /* Common */
38#define __NR_chmod 15 /* Common */
39#define __NR_lchown 16 /* Common */
40#define __NR_brk 17 /* Common */
41#define __NR_perfctr 18 /* Performance counter operations */
42#define __NR_lseek 19 /* Common */
43#define __NR_getpid 20 /* Common */
44#define __NR_capget 21 /* Linux Specific */
45#define __NR_capset 22 /* Linux Specific */
46#define __NR_setuid 23 /* Implemented via setreuid in SunOS */
47#define __NR_getuid 24 /* Common */
48#define __NR_vmsplice 25 /* ENOSYS under SunOS */
49#define __NR_ptrace 26 /* Common */
50#define __NR_alarm 27 /* Implemented via setitimer in SunOS */
51#define __NR_sigaltstack 28 /* Common */
52#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */
53#define __NR_utime 30 /* Implemented via utimes() under SunOS */
54#ifdef __32bit_syscall_numbers__
55#define __NR_lchown32 31 /* Linux sparc32 specific */
56#define __NR_fchown32 32 /* Linux sparc32 specific */
57#endif
58#define __NR_access 33 /* Common */
59#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */
60#ifdef __32bit_syscall_numbers__
61#define __NR_chown32 35 /* Linux sparc32 specific */
62#endif
63#define __NR_sync 36 /* Common */
64#define __NR_kill 37 /* Common */
65#define __NR_stat 38 /* Common */
66#define __NR_sendfile 39 /* Linux Specific */
67#define __NR_lstat 40 /* Common */
68#define __NR_dup 41 /* Common */
69#define __NR_pipe 42 /* Common */
70#define __NR_times 43 /* Implemented via getrusage() in SunOS */
71#ifdef __32bit_syscall_numbers__
72#define __NR_getuid32 44 /* Linux sparc32 specific */
73#endif
74#define __NR_umount2 45 /* Linux Specific */
75#define __NR_setgid 46 /* Implemented via setregid() in SunOS */
76#define __NR_getgid 47 /* Common */
77#define __NR_signal 48 /* Implemented via sigvec() in SunOS */
78#define __NR_geteuid 49 /* SunOS calls getuid() */
79#define __NR_getegid 50 /* SunOS calls getgid() */
80#define __NR_acct 51 /* Common */
81#ifdef __32bit_syscall_numbers__
82#define __NR_getgid32 53 /* Linux sparc32 specific */
83#else
84#define __NR_memory_ordering 52 /* Linux Specific */
85#endif
86#define __NR_ioctl 54 /* Common */
87#define __NR_reboot 55 /* Common */
88#ifdef __32bit_syscall_numbers__
89#define __NR_mmap2 56 /* Linux sparc32 Specific */
90#endif
91#define __NR_symlink 57 /* Common */
92#define __NR_readlink 58 /* Common */
93#define __NR_execve 59 /* Common */
94#define __NR_umask 60 /* Common */
95#define __NR_chroot 61 /* Common */
96#define __NR_fstat 62 /* Common */
97#define __NR_fstat64 63 /* Linux Specific */
98#define __NR_getpagesize 64 /* Common */
99#define __NR_msync 65 /* Common in newer 1.3.x revs... */
100#define __NR_vfork 66 /* Common */
101#define __NR_pread64 67 /* Linux Specific */
102#define __NR_pwrite64 68 /* Linux Specific */
103#ifdef __32bit_syscall_numbers__
104#define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */
105#define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */
106#endif
107#define __NR_mmap 71 /* Common */
108#ifdef __32bit_syscall_numbers__
109#define __NR_setreuid32 72 /* Linux sparc32, vadvise under SunOS */
110#endif
111#define __NR_munmap 73 /* Common */
112#define __NR_mprotect 74 /* Common */
113#define __NR_madvise 75 /* Common */
114#define __NR_vhangup 76 /* Common */
115#ifdef __32bit_syscall_numbers__
116#define __NR_truncate64 77 /* Linux sparc32 Specific */
117#endif
118#define __NR_mincore 78 /* Common */
119#define __NR_getgroups 79 /* Common */
120#define __NR_setgroups 80 /* Common */
121#define __NR_getpgrp 81 /* Common */
122#ifdef __32bit_syscall_numbers__
123#define __NR_setgroups32 82 /* Linux sparc32, setpgrp under SunOS */
124#endif
125#define __NR_setitimer 83 /* Common */
126#ifdef __32bit_syscall_numbers__
127#define __NR_ftruncate64 84 /* Linux sparc32 Specific */
128#endif
129#define __NR_swapon 85 /* Common */
130#define __NR_getitimer 86 /* Common */
131#ifdef __32bit_syscall_numbers__
132#define __NR_setuid32 87 /* Linux sparc32, gethostname under SunOS */
133#endif
134#define __NR_sethostname 88 /* Common */
135#ifdef __32bit_syscall_numbers__
136#define __NR_setgid32 89 /* Linux sparc32, getdtablesize under SunOS */
137#endif
138#define __NR_dup2 90 /* Common */
139#ifdef __32bit_syscall_numbers__
140#define __NR_setfsuid32 91 /* Linux sparc32, getdopt under SunOS */
141#endif
142#define __NR_fcntl 92 /* Common */
143#define __NR_select 93 /* Common */
144#ifdef __32bit_syscall_numbers__
145#define __NR_setfsgid32 94 /* Linux sparc32, setdopt under SunOS */
146#endif
147#define __NR_fsync 95 /* Common */
148#define __NR_setpriority 96 /* Common */
149#define __NR_socket 97 /* Common */
150#define __NR_connect 98 /* Common */
151#define __NR_accept 99 /* Common */
152#define __NR_getpriority 100 /* Common */
153#define __NR_rt_sigreturn 101 /* Linux Specific */
154#define __NR_rt_sigaction 102 /* Linux Specific */
155#define __NR_rt_sigprocmask 103 /* Linux Specific */
156#define __NR_rt_sigpending 104 /* Linux Specific */
157#define __NR_rt_sigtimedwait 105 /* Linux Specific */
158#define __NR_rt_sigqueueinfo 106 /* Linux Specific */
159#define __NR_rt_sigsuspend 107 /* Linux Specific */
160#ifdef __32bit_syscall_numbers__
161#define __NR_setresuid32 108 /* Linux Specific, sigvec under SunOS */
162#define __NR_getresuid32 109 /* Linux Specific, sigblock under SunOS */
163#define __NR_setresgid32 110 /* Linux Specific, sigsetmask under SunOS */
164#define __NR_getresgid32 111 /* Linux Specific, sigpause under SunOS */
165#define __NR_setregid32 112 /* Linux sparc32, sigstack under SunOS */
166#else
167#define __NR_setresuid 108 /* Linux Specific, sigvec under SunOS */
168#define __NR_getresuid 109 /* Linux Specific, sigblock under SunOS */
169#define __NR_setresgid 110 /* Linux Specific, sigsetmask under SunOS */
170#define __NR_getresgid 111 /* Linux Specific, sigpause under SunOS */
171#endif
172#define __NR_recvmsg 113 /* Common */
173#define __NR_sendmsg 114 /* Common */
174#ifdef __32bit_syscall_numbers__
175#define __NR_getgroups32 115 /* Linux sparc32, vtrace under SunOS */
176#endif
177#define __NR_gettimeofday 116 /* Common */
178#define __NR_getrusage 117 /* Common */
179#define __NR_getsockopt 118 /* Common */
180#define __NR_getcwd 119 /* Linux Specific */
181#define __NR_readv 120 /* Common */
182#define __NR_writev 121 /* Common */
183#define __NR_settimeofday 122 /* Common */
184#define __NR_fchown 123 /* Common */
185#define __NR_fchmod 124 /* Common */
186#define __NR_recvfrom 125 /* Common */
187#define __NR_setreuid 126 /* Common */
188#define __NR_setregid 127 /* Common */
189#define __NR_rename 128 /* Common */
190#define __NR_truncate 129 /* Common */
191#define __NR_ftruncate 130 /* Common */
192#define __NR_flock 131 /* Common */
193#define __NR_lstat64 132 /* Linux Specific */
194#define __NR_sendto 133 /* Common */
195#define __NR_shutdown 134 /* Common */
196#define __NR_socketpair 135 /* Common */
197#define __NR_mkdir 136 /* Common */
198#define __NR_rmdir 137 /* Common */
199#define __NR_utimes 138 /* SunOS Specific */
200#define __NR_stat64 139 /* Linux Specific */
201#define __NR_sendfile64 140 /* adjtime under SunOS */
202#define __NR_getpeername 141 /* Common */
203#define __NR_futex 142 /* gethostid under SunOS */
204#define __NR_gettid 143 /* ENOSYS under SunOS */
205#define __NR_getrlimit 144 /* Common */
206#define __NR_setrlimit 145 /* Common */
207#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */
208#define __NR_prctl 147 /* ENOSYS under SunOS */
209#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */
210#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */
211#define __NR_getsockname 150 /* Common */
212#define __NR_inotify_init 151 /* Linux specific */
213#define __NR_inotify_add_watch 152 /* Linux specific */
214#define __NR_poll 153 /* Common */
215#define __NR_getdents64 154 /* Linux specific */
216#ifdef __32bit_syscall_numbers__
217#define __NR_fcntl64 155 /* Linux sparc32 Specific */
218#endif
219#define __NR_inotify_rm_watch 156 /* Linux specific */
220#define __NR_statfs 157 /* Common */
221#define __NR_fstatfs 158 /* Common */
222#define __NR_umount 159 /* Common */
223#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */
224#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */
225#define __NR_getdomainname 162 /* SunOS Specific */
226#define __NR_setdomainname 163 /* Common */
227#ifndef __32bit_syscall_numbers__
228#define __NR_utrap_install 164 /* SYSV ABI/v9 required */
229#endif
230#define __NR_quotactl 165 /* Common */
231#define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */
232#define __NR_mount 167 /* Common */
233#define __NR_ustat 168 /* Common */
234#define __NR_setxattr 169 /* SunOS: semsys */
235#define __NR_lsetxattr 170 /* SunOS: msgsys */
236#define __NR_fsetxattr 171 /* SunOS: shmsys */
237#define __NR_getxattr 172 /* SunOS: auditsys */
238#define __NR_lgetxattr 173 /* SunOS: rfssys */
239#define __NR_getdents 174 /* Common */
240#define __NR_setsid 175 /* Common */
241#define __NR_fchdir 176 /* Common */
242#define __NR_fgetxattr 177 /* SunOS: fchroot */
243#define __NR_listxattr 178 /* SunOS: vpixsys */
244#define __NR_llistxattr 179 /* SunOS: aioread */
245#define __NR_flistxattr 180 /* SunOS: aiowrite */
246#define __NR_removexattr 181 /* SunOS: aiowait */
247#define __NR_lremovexattr 182 /* SunOS: aiocancel */
248#define __NR_sigpending 183 /* Common */
249#define __NR_query_module 184 /* Linux Specific */
250#define __NR_setpgid 185 /* Common */
251#define __NR_fremovexattr 186 /* SunOS: pathconf */
252#define __NR_tkill 187 /* SunOS: fpathconf */
253#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */
254#define __NR_uname 189 /* Linux Specific */
255#define __NR_init_module 190 /* Linux Specific */
256#define __NR_personality 191 /* Linux Specific */
257#define __NR_remap_file_pages 192 /* Linux Specific */
258#define __NR_epoll_create 193 /* Linux Specific */
259#define __NR_epoll_ctl 194 /* Linux Specific */
260#define __NR_epoll_wait 195 /* Linux Specific */
261#define __NR_ioprio_set 196 /* Linux Specific */
262#define __NR_getppid 197 /* Linux Specific */
263#define __NR_sigaction 198 /* Linux Specific */
264#define __NR_sgetmask 199 /* Linux Specific */
265#define __NR_ssetmask 200 /* Linux Specific */
266#define __NR_sigsuspend 201 /* Linux Specific */
267#define __NR_oldlstat 202 /* Linux Specific */
268#define __NR_uselib 203 /* Linux Specific */
269#define __NR_readdir 204 /* Linux Specific */
270#define __NR_readahead 205 /* Linux Specific */
271#define __NR_socketcall 206 /* Linux Specific */
272#define __NR_syslog 207 /* Linux Specific */
273#define __NR_lookup_dcookie 208 /* Linux Specific */
274#define __NR_fadvise64 209 /* Linux Specific */
275#define __NR_fadvise64_64 210 /* Linux Specific */
276#define __NR_tgkill 211 /* Linux Specific */
277#define __NR_waitpid 212 /* Linux Specific */
278#define __NR_swapoff 213 /* Linux Specific */
279#define __NR_sysinfo 214 /* Linux Specific */
280#define __NR_ipc 215 /* Linux Specific */
281#define __NR_sigreturn 216 /* Linux Specific */
282#define __NR_clone 217 /* Linux Specific */
283#define __NR_ioprio_get 218 /* Linux Specific */
284#define __NR_adjtimex 219 /* Linux Specific */
285#define __NR_sigprocmask 220 /* Linux Specific */
286#define __NR_create_module 221 /* Linux Specific */
287#define __NR_delete_module 222 /* Linux Specific */
288#define __NR_get_kernel_syms 223 /* Linux Specific */
289#define __NR_getpgid 224 /* Linux Specific */
290#define __NR_bdflush 225 /* Linux Specific */
291#define __NR_sysfs 226 /* Linux Specific */
292#define __NR_afs_syscall 227 /* Linux Specific */
293#define __NR_setfsuid 228 /* Linux Specific */
294#define __NR_setfsgid 229 /* Linux Specific */
295#define __NR__newselect 230 /* Linux Specific */
296#ifdef __32bit_syscall_numbers__
297#define __NR_time 231 /* Linux Specific */
5#else 298#else
6#include <asm/unistd_32.h> 299#ifdef __KERNEL__
300#define __NR_time 231 /* Linux sparc32 */
301#endif
302#endif
303#define __NR_splice 232 /* Linux Specific */
304#define __NR_stime 233 /* Linux Specific */
305#define __NR_statfs64 234 /* Linux Specific */
306#define __NR_fstatfs64 235 /* Linux Specific */
307#define __NR__llseek 236 /* Linux Specific */
308#define __NR_mlock 237
309#define __NR_munlock 238
310#define __NR_mlockall 239
311#define __NR_munlockall 240
312#define __NR_sched_setparam 241
313#define __NR_sched_getparam 242
314#define __NR_sched_setscheduler 243
315#define __NR_sched_getscheduler 244
316#define __NR_sched_yield 245
317#define __NR_sched_get_priority_max 246
318#define __NR_sched_get_priority_min 247
319#define __NR_sched_rr_get_interval 248
320#define __NR_nanosleep 249
321#define __NR_mremap 250
322#define __NR__sysctl 251
323#define __NR_getsid 252
324#define __NR_fdatasync 253
325#define __NR_nfsservctl 254
326#define __NR_sync_file_range 255
327#define __NR_clock_settime 256
328#define __NR_clock_gettime 257
329#define __NR_clock_getres 258
330#define __NR_clock_nanosleep 259
331#define __NR_sched_getaffinity 260
332#define __NR_sched_setaffinity 261
333#define __NR_timer_settime 262
334#define __NR_timer_gettime 263
335#define __NR_timer_getoverrun 264
336#define __NR_timer_delete 265
337#define __NR_timer_create 266
338/* #define __NR_vserver 267 Reserved for VSERVER */
339#define __NR_io_setup 268
340#define __NR_io_destroy 269
341#define __NR_io_submit 270
342#define __NR_io_cancel 271
343#define __NR_io_getevents 272
344#define __NR_mq_open 273
345#define __NR_mq_unlink 274
346#define __NR_mq_timedsend 275
347#define __NR_mq_timedreceive 276
348#define __NR_mq_notify 277
349#define __NR_mq_getsetattr 278
350#define __NR_waitid 279
351#define __NR_tee 280
352#define __NR_add_key 281
353#define __NR_request_key 282
354#define __NR_keyctl 283
355#define __NR_openat 284
356#define __NR_mkdirat 285
357#define __NR_mknodat 286
358#define __NR_fchownat 287
359#define __NR_futimesat 288
360#define __NR_fstatat64 289
361#define __NR_unlinkat 290
362#define __NR_renameat 291
363#define __NR_linkat 292
364#define __NR_symlinkat 293
365#define __NR_readlinkat 294
366#define __NR_fchmodat 295
367#define __NR_faccessat 296
368#define __NR_pselect6 297
369#define __NR_ppoll 298
370#define __NR_unshare 299
371#define __NR_set_robust_list 300
372#define __NR_get_robust_list 301
373#define __NR_migrate_pages 302
374#define __NR_mbind 303
375#define __NR_get_mempolicy 304
376#define __NR_set_mempolicy 305
377#define __NR_kexec_load 306
378#define __NR_move_pages 307
379#define __NR_getcpu 308
380#define __NR_epoll_pwait 309
381#define __NR_utimensat 310
382#define __NR_signalfd 311
383#define __NR_timerfd_create 312
384#define __NR_eventfd 313
385#define __NR_fallocate 314
386#define __NR_timerfd_settime 315
387#define __NR_timerfd_gettime 316
388#define __NR_signalfd4 317
389#define __NR_eventfd2 318
390#define __NR_epoll_create1 319
391#define __NR_dup3 320
392#define __NR_pipe2 321
393#define __NR_inotify_init1 322
394#define __NR_accept4 323
395
396#define NR_SYSCALLS 324
397
398#ifdef __32bit_syscall_numbers__
399/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
400 * it never had the plain ones and there is no value to adding those
401 * old versions into the syscall table.
402 */
403#define __IGNORE_setresuid
404#define __IGNORE_getresuid
405#define __IGNORE_setresgid
406#define __IGNORE_getresgid
7#endif 407#endif
408
409#ifdef __KERNEL__
410#define __ARCH_WANT_IPC_PARSE_VERSION
411#define __ARCH_WANT_OLD_READDIR
412#define __ARCH_WANT_STAT64
413#define __ARCH_WANT_SYS_ALARM
414#define __ARCH_WANT_SYS_GETHOSTNAME
415#define __ARCH_WANT_SYS_PAUSE
416#define __ARCH_WANT_SYS_SGETMASK
417#define __ARCH_WANT_SYS_SIGNAL
418#define __ARCH_WANT_SYS_TIME
419#define __ARCH_WANT_SYS_UTIME
420#define __ARCH_WANT_SYS_WAITPID
421#define __ARCH_WANT_SYS_SOCKETCALL
422#define __ARCH_WANT_SYS_FADVISE64
423#define __ARCH_WANT_SYS_GETPGRP
424#define __ARCH_WANT_SYS_LLSEEK
425#define __ARCH_WANT_SYS_NICE
426#define __ARCH_WANT_SYS_OLDUMOUNT
427#define __ARCH_WANT_SYS_SIGPENDING
428#define __ARCH_WANT_SYS_SIGPROCMASK
429#define __ARCH_WANT_SYS_RT_SIGSUSPEND
430#ifndef __32bit_syscall_numbers__
431#define __ARCH_WANT_COMPAT_SYS_TIME
432#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
8#endif 433#endif
434
435/*
436 * "Conditional" syscalls
437 *
438 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
439 * but it doesn't work on all toolchains, so we just do it by hand
440 */
441#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
442
443#endif /* __KERNEL__ */
444#endif /* _SPARC_UNISTD_H */
diff --git a/arch/sparc/include/asm/unistd_32.h b/arch/sparc/include/asm/unistd_32.h
deleted file mode 100644
index 0d13d2a4c76f..000000000000
--- a/arch/sparc/include/asm/unistd_32.h
+++ /dev/null
@@ -1,385 +0,0 @@
1#ifndef _SPARC_UNISTD_H
2#define _SPARC_UNISTD_H
3
4/*
5 * System calls under the Sparc.
6 *
7 * Don't be scared by the ugly clobbers, it is the only way I can
8 * think of right now to force the arguments into fixed registers
9 * before the trap into the system call with gcc 'asm' statements.
10 *
11 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
12 *
13 * SunOS compatibility based upon preliminary work which is:
14 *
15 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
16 */
17
18#define __NR_restart_syscall 0 /* Linux Specific */
19#define __NR_exit 1 /* Common */
20#define __NR_fork 2 /* Common */
21#define __NR_read 3 /* Common */
22#define __NR_write 4 /* Common */
23#define __NR_open 5 /* Common */
24#define __NR_close 6 /* Common */
25#define __NR_wait4 7 /* Common */
26#define __NR_creat 8 /* Common */
27#define __NR_link 9 /* Common */
28#define __NR_unlink 10 /* Common */
29#define __NR_execv 11 /* SunOS Specific */
30#define __NR_chdir 12 /* Common */
31#define __NR_chown 13 /* Common */
32#define __NR_mknod 14 /* Common */
33#define __NR_chmod 15 /* Common */
34#define __NR_lchown 16 /* Common */
35#define __NR_brk 17 /* Common */
36#define __NR_perfctr 18 /* Performance counter operations */
37#define __NR_lseek 19 /* Common */
38#define __NR_getpid 20 /* Common */
39#define __NR_capget 21 /* Linux Specific */
40#define __NR_capset 22 /* Linux Specific */
41#define __NR_setuid 23 /* Implemented via setreuid in SunOS */
42#define __NR_getuid 24 /* Common */
43#define __NR_vmsplice 25 /* ENOSYS under SunOS */
44#define __NR_ptrace 26 /* Common */
45#define __NR_alarm 27 /* Implemented via setitimer in SunOS */
46#define __NR_sigaltstack 28 /* Common */
47#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */
48#define __NR_utime 30 /* Implemented via utimes() under SunOS */
49#define __NR_lchown32 31 /* Linux sparc32 specific */
50#define __NR_fchown32 32 /* Linux sparc32 specific */
51#define __NR_access 33 /* Common */
52#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */
53#define __NR_chown32 35 /* Linux sparc32 specific */
54#define __NR_sync 36 /* Common */
55#define __NR_kill 37 /* Common */
56#define __NR_stat 38 /* Common */
57#define __NR_sendfile 39 /* Linux Specific */
58#define __NR_lstat 40 /* Common */
59#define __NR_dup 41 /* Common */
60#define __NR_pipe 42 /* Common */
61#define __NR_times 43 /* Implemented via getrusage() in SunOS */
62#define __NR_getuid32 44 /* Linux sparc32 specific */
63#define __NR_umount2 45 /* Linux Specific */
64#define __NR_setgid 46 /* Implemented via setregid() in SunOS */
65#define __NR_getgid 47 /* Common */
66#define __NR_signal 48 /* Implemented via sigvec() in SunOS */
67#define __NR_geteuid 49 /* SunOS calls getuid() */
68#define __NR_getegid 50 /* SunOS calls getgid() */
69#define __NR_acct 51 /* Common */
70/* #define __NR_memory_ordering 52 Linux sparc64 specific */
71#define __NR_getgid32 53 /* Linux sparc32 specific */
72#define __NR_ioctl 54 /* Common */
73#define __NR_reboot 55 /* Common */
74#define __NR_mmap2 56 /* Linux sparc32 Specific */
75#define __NR_symlink 57 /* Common */
76#define __NR_readlink 58 /* Common */
77#define __NR_execve 59 /* Common */
78#define __NR_umask 60 /* Common */
79#define __NR_chroot 61 /* Common */
80#define __NR_fstat 62 /* Common */
81#define __NR_fstat64 63 /* Linux Specific */
82#define __NR_getpagesize 64 /* Common */
83#define __NR_msync 65 /* Common in newer 1.3.x revs... */
84#define __NR_vfork 66 /* Common */
85#define __NR_pread64 67 /* Linux Specific */
86#define __NR_pwrite64 68 /* Linux Specific */
87#define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */
88#define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */
89#define __NR_mmap 71 /* Common */
90#define __NR_setreuid32 72 /* Linux sparc32, vadvise under SunOS */
91#define __NR_munmap 73 /* Common */
92#define __NR_mprotect 74 /* Common */
93#define __NR_madvise 75 /* Common */
94#define __NR_vhangup 76 /* Common */
95#define __NR_truncate64 77 /* Linux sparc32 Specific */
96#define __NR_mincore 78 /* Common */
97#define __NR_getgroups 79 /* Common */
98#define __NR_setgroups 80 /* Common */
99#define __NR_getpgrp 81 /* Common */
100#define __NR_setgroups32 82 /* Linux sparc32, setpgrp under SunOS */
101#define __NR_setitimer 83 /* Common */
102#define __NR_ftruncate64 84 /* Linux sparc32 Specific */
103#define __NR_swapon 85 /* Common */
104#define __NR_getitimer 86 /* Common */
105#define __NR_setuid32 87 /* Linux sparc32, gethostname under SunOS */
106#define __NR_sethostname 88 /* Common */
107#define __NR_setgid32 89 /* Linux sparc32, getdtablesize under SunOS */
108#define __NR_dup2 90 /* Common */
109#define __NR_setfsuid32 91 /* Linux sparc32, getdopt under SunOS */
110#define __NR_fcntl 92 /* Common */
111#define __NR_select 93 /* Common */
112#define __NR_setfsgid32 94 /* Linux sparc32, setdopt under SunOS */
113#define __NR_fsync 95 /* Common */
114#define __NR_setpriority 96 /* Common */
115#define __NR_socket 97 /* Common */
116#define __NR_connect 98 /* Common */
117#define __NR_accept 99 /* Common */
118#define __NR_getpriority 100 /* Common */
119#define __NR_rt_sigreturn 101 /* Linux Specific */
120#define __NR_rt_sigaction 102 /* Linux Specific */
121#define __NR_rt_sigprocmask 103 /* Linux Specific */
122#define __NR_rt_sigpending 104 /* Linux Specific */
123#define __NR_rt_sigtimedwait 105 /* Linux Specific */
124#define __NR_rt_sigqueueinfo 106 /* Linux Specific */
125#define __NR_rt_sigsuspend 107 /* Linux Specific */
126#define __NR_setresuid32 108 /* Linux Specific, sigvec under SunOS */
127#define __NR_getresuid32 109 /* Linux Specific, sigblock under SunOS */
128#define __NR_setresgid32 110 /* Linux Specific, sigsetmask under SunOS */
129#define __NR_getresgid32 111 /* Linux Specific, sigpause under SunOS */
130#define __NR_setregid32 112 /* Linux sparc32, sigstack under SunOS */
131#define __NR_recvmsg 113 /* Common */
132#define __NR_sendmsg 114 /* Common */
133#define __NR_getgroups32 115 /* Linux sparc32, vtrace under SunOS */
134#define __NR_gettimeofday 116 /* Common */
135#define __NR_getrusage 117 /* Common */
136#define __NR_getsockopt 118 /* Common */
137#define __NR_getcwd 119 /* Linux Specific */
138#define __NR_readv 120 /* Common */
139#define __NR_writev 121 /* Common */
140#define __NR_settimeofday 122 /* Common */
141#define __NR_fchown 123 /* Common */
142#define __NR_fchmod 124 /* Common */
143#define __NR_recvfrom 125 /* Common */
144#define __NR_setreuid 126 /* Common */
145#define __NR_setregid 127 /* Common */
146#define __NR_rename 128 /* Common */
147#define __NR_truncate 129 /* Common */
148#define __NR_ftruncate 130 /* Common */
149#define __NR_flock 131 /* Common */
150#define __NR_lstat64 132 /* Linux Specific */
151#define __NR_sendto 133 /* Common */
152#define __NR_shutdown 134 /* Common */
153#define __NR_socketpair 135 /* Common */
154#define __NR_mkdir 136 /* Common */
155#define __NR_rmdir 137 /* Common */
156#define __NR_utimes 138 /* SunOS Specific */
157#define __NR_stat64 139 /* Linux Specific */
158#define __NR_sendfile64 140 /* adjtime under SunOS */
159#define __NR_getpeername 141 /* Common */
160#define __NR_futex 142 /* gethostid under SunOS */
161#define __NR_gettid 143 /* ENOSYS under SunOS */
162#define __NR_getrlimit 144 /* Common */
163#define __NR_setrlimit 145 /* Common */
164#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */
165#define __NR_prctl 147 /* ENOSYS under SunOS */
166#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */
167#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */
168#define __NR_getsockname 150 /* Common */
169#define __NR_inotify_init 151 /* Linux specific */
170#define __NR_inotify_add_watch 152 /* Linux specific */
171#define __NR_poll 153 /* Common */
172#define __NR_getdents64 154 /* Linux specific */
173#define __NR_fcntl64 155 /* Linux sparc32 Specific */
174#define __NR_inotify_rm_watch 156 /* Linux specific */
175#define __NR_statfs 157 /* Common */
176#define __NR_fstatfs 158 /* Common */
177#define __NR_umount 159 /* Common */
178#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */
179#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */
180#define __NR_getdomainname 162 /* SunOS Specific */
181#define __NR_setdomainname 163 /* Common */
182/* #define __NR_utrap_install 164 Linux sparc64 specific */
183#define __NR_quotactl 165 /* Common */
184#define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */
185#define __NR_mount 167 /* Common */
186#define __NR_ustat 168 /* Common */
187#define __NR_setxattr 169 /* SunOS: semsys */
188#define __NR_lsetxattr 170 /* SunOS: msgsys */
189#define __NR_fsetxattr 171 /* SunOS: shmsys */
190#define __NR_getxattr 172 /* SunOS: auditsys */
191#define __NR_lgetxattr 173 /* SunOS: rfssys */
192#define __NR_getdents 174 /* Common */
193#define __NR_setsid 175 /* Common */
194#define __NR_fchdir 176 /* Common */
195#define __NR_fgetxattr 177 /* SunOS: fchroot */
196#define __NR_listxattr 178 /* SunOS: vpixsys */
197#define __NR_llistxattr 179 /* SunOS: aioread */
198#define __NR_flistxattr 180 /* SunOS: aiowrite */
199#define __NR_removexattr 181 /* SunOS: aiowait */
200#define __NR_lremovexattr 182 /* SunOS: aiocancel */
201#define __NR_sigpending 183 /* Common */
202#define __NR_query_module 184 /* Linux Specific */
203#define __NR_setpgid 185 /* Common */
204#define __NR_fremovexattr 186 /* SunOS: pathconf */
205#define __NR_tkill 187 /* SunOS: fpathconf */
206#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */
207#define __NR_uname 189 /* Linux Specific */
208#define __NR_init_module 190 /* Linux Specific */
209#define __NR_personality 191 /* Linux Specific */
210#define __NR_remap_file_pages 192 /* Linux Specific */
211#define __NR_epoll_create 193 /* Linux Specific */
212#define __NR_epoll_ctl 194 /* Linux Specific */
213#define __NR_epoll_wait 195 /* Linux Specific */
214#define __NR_ioprio_set 196 /* Linux Specific */
215#define __NR_getppid 197 /* Linux Specific */
216#define __NR_sigaction 198 /* Linux Specific */
217#define __NR_sgetmask 199 /* Linux Specific */
218#define __NR_ssetmask 200 /* Linux Specific */
219#define __NR_sigsuspend 201 /* Linux Specific */
220#define __NR_oldlstat 202 /* Linux Specific */
221#define __NR_uselib 203 /* Linux Specific */
222#define __NR_readdir 204 /* Linux Specific */
223#define __NR_readahead 205 /* Linux Specific */
224#define __NR_socketcall 206 /* Linux Specific */
225#define __NR_syslog 207 /* Linux Specific */
226#define __NR_lookup_dcookie 208 /* Linux Specific */
227#define __NR_fadvise64 209 /* Linux Specific */
228#define __NR_fadvise64_64 210 /* Linux Specific */
229#define __NR_tgkill 211 /* Linux Specific */
230#define __NR_waitpid 212 /* Linux Specific */
231#define __NR_swapoff 213 /* Linux Specific */
232#define __NR_sysinfo 214 /* Linux Specific */
233#define __NR_ipc 215 /* Linux Specific */
234#define __NR_sigreturn 216 /* Linux Specific */
235#define __NR_clone 217 /* Linux Specific */
236#define __NR_ioprio_get 218 /* Linux Specific */
237#define __NR_adjtimex 219 /* Linux Specific */
238#define __NR_sigprocmask 220 /* Linux Specific */
239#define __NR_create_module 221 /* Linux Specific */
240#define __NR_delete_module 222 /* Linux Specific */
241#define __NR_get_kernel_syms 223 /* Linux Specific */
242#define __NR_getpgid 224 /* Linux Specific */
243#define __NR_bdflush 225 /* Linux Specific */
244#define __NR_sysfs 226 /* Linux Specific */
245#define __NR_afs_syscall 227 /* Linux Specific */
246#define __NR_setfsuid 228 /* Linux Specific */
247#define __NR_setfsgid 229 /* Linux Specific */
248#define __NR__newselect 230 /* Linux Specific */
249#define __NR_time 231 /* Linux Specific */
250#define __NR_splice 232 /* Linux Specific */
251#define __NR_stime 233 /* Linux Specific */
252#define __NR_statfs64 234 /* Linux Specific */
253#define __NR_fstatfs64 235 /* Linux Specific */
254#define __NR__llseek 236 /* Linux Specific */
255#define __NR_mlock 237
256#define __NR_munlock 238
257#define __NR_mlockall 239
258#define __NR_munlockall 240
259#define __NR_sched_setparam 241
260#define __NR_sched_getparam 242
261#define __NR_sched_setscheduler 243
262#define __NR_sched_getscheduler 244
263#define __NR_sched_yield 245
264#define __NR_sched_get_priority_max 246
265#define __NR_sched_get_priority_min 247
266#define __NR_sched_rr_get_interval 248
267#define __NR_nanosleep 249
268#define __NR_mremap 250
269#define __NR__sysctl 251
270#define __NR_getsid 252
271#define __NR_fdatasync 253
272#define __NR_nfsservctl 254
273#define __NR_sync_file_range 255
274#define __NR_clock_settime 256
275#define __NR_clock_gettime 257
276#define __NR_clock_getres 258
277#define __NR_clock_nanosleep 259
278#define __NR_sched_getaffinity 260
279#define __NR_sched_setaffinity 261
280#define __NR_timer_settime 262
281#define __NR_timer_gettime 263
282#define __NR_timer_getoverrun 264
283#define __NR_timer_delete 265
284#define __NR_timer_create 266
285/* #define __NR_vserver 267 Reserved for VSERVER */
286#define __NR_io_setup 268
287#define __NR_io_destroy 269
288#define __NR_io_submit 270
289#define __NR_io_cancel 271
290#define __NR_io_getevents 272
291#define __NR_mq_open 273
292#define __NR_mq_unlink 274
293#define __NR_mq_timedsend 275
294#define __NR_mq_timedreceive 276
295#define __NR_mq_notify 277
296#define __NR_mq_getsetattr 278
297#define __NR_waitid 279
298#define __NR_tee 280
299#define __NR_add_key 281
300#define __NR_request_key 282
301#define __NR_keyctl 283
302#define __NR_openat 284
303#define __NR_mkdirat 285
304#define __NR_mknodat 286
305#define __NR_fchownat 287
306#define __NR_futimesat 288
307#define __NR_fstatat64 289
308#define __NR_unlinkat 290
309#define __NR_renameat 291
310#define __NR_linkat 292
311#define __NR_symlinkat 293
312#define __NR_readlinkat 294
313#define __NR_fchmodat 295
314#define __NR_faccessat 296
315#define __NR_pselect6 297
316#define __NR_ppoll 298
317#define __NR_unshare 299
318#define __NR_set_robust_list 300
319#define __NR_get_robust_list 301
320#define __NR_migrate_pages 302
321#define __NR_mbind 303
322#define __NR_get_mempolicy 304
323#define __NR_set_mempolicy 305
324#define __NR_kexec_load 306
325#define __NR_move_pages 307
326#define __NR_getcpu 308
327#define __NR_epoll_pwait 309
328#define __NR_utimensat 310
329#define __NR_signalfd 311
330#define __NR_timerfd_create 312
331#define __NR_eventfd 313
332#define __NR_fallocate 314
333#define __NR_timerfd_settime 315
334#define __NR_timerfd_gettime 316
335#define __NR_signalfd4 317
336#define __NR_eventfd2 318
337#define __NR_epoll_create1 319
338#define __NR_dup3 320
339#define __NR_pipe2 321
340#define __NR_inotify_init1 322
341#define __NR_accept4 323
342
343#define NR_SYSCALLS 324
344
345/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
346 * it never had the plain ones and there is no value to adding those
347 * old versions into the syscall table.
348 */
349#define __IGNORE_setresuid
350#define __IGNORE_getresuid
351#define __IGNORE_setresgid
352#define __IGNORE_getresgid
353
354#ifdef __KERNEL__
355#define __ARCH_WANT_IPC_PARSE_VERSION
356#define __ARCH_WANT_OLD_READDIR
357#define __ARCH_WANT_STAT64
358#define __ARCH_WANT_SYS_ALARM
359#define __ARCH_WANT_SYS_GETHOSTNAME
360#define __ARCH_WANT_SYS_PAUSE
361#define __ARCH_WANT_SYS_SGETMASK
362#define __ARCH_WANT_SYS_SIGNAL
363#define __ARCH_WANT_SYS_TIME
364#define __ARCH_WANT_SYS_UTIME
365#define __ARCH_WANT_SYS_WAITPID
366#define __ARCH_WANT_SYS_SOCKETCALL
367#define __ARCH_WANT_SYS_FADVISE64
368#define __ARCH_WANT_SYS_GETPGRP
369#define __ARCH_WANT_SYS_LLSEEK
370#define __ARCH_WANT_SYS_NICE
371#define __ARCH_WANT_SYS_OLDUMOUNT
372#define __ARCH_WANT_SYS_SIGPENDING
373#define __ARCH_WANT_SYS_SIGPROCMASK
374#define __ARCH_WANT_SYS_RT_SIGSUSPEND
375
376/*
377 * "Conditional" syscalls
378 *
379 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
380 * but it doesn't work on all toolchains, so we just do it by hand
381 */
382#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
383
384#endif /* __KERNEL__ */
385#endif /* _SPARC_UNISTD_H */
diff --git a/arch/sparc/include/asm/unistd_64.h b/arch/sparc/include/asm/unistd_64.h
deleted file mode 100644
index fa5d3c0343c7..000000000000
--- a/arch/sparc/include/asm/unistd_64.h
+++ /dev/null
@@ -1,380 +0,0 @@
1#ifndef _SPARC64_UNISTD_H
2#define _SPARC64_UNISTD_H
3
4/*
5 * System calls under the Sparc.
6 *
7 * Don't be scared by the ugly clobbers, it is the only way I can
8 * think of right now to force the arguments into fixed registers
9 * before the trap into the system call with gcc 'asm' statements.
10 *
11 * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
12 *
13 * SunOS compatibility based upon preliminary work which is:
14 *
15 * Copyright (C) 1995 Adrian M. Rodriguez (adrian@remus.rutgers.edu)
16 */
17
18#define __NR_restart_syscall 0 /* Linux Specific */
19#define __NR_exit 1 /* Common */
20#define __NR_fork 2 /* Common */
21#define __NR_read 3 /* Common */
22#define __NR_write 4 /* Common */
23#define __NR_open 5 /* Common */
24#define __NR_close 6 /* Common */
25#define __NR_wait4 7 /* Common */
26#define __NR_creat 8 /* Common */
27#define __NR_link 9 /* Common */
28#define __NR_unlink 10 /* Common */
29#define __NR_execv 11 /* SunOS Specific */
30#define __NR_chdir 12 /* Common */
31#define __NR_chown 13 /* Common */
32#define __NR_mknod 14 /* Common */
33#define __NR_chmod 15 /* Common */
34#define __NR_lchown 16 /* Common */
35#define __NR_brk 17 /* Common */
36#define __NR_perfctr 18 /* Performance counter operations */
37#define __NR_lseek 19 /* Common */
38#define __NR_getpid 20 /* Common */
39#define __NR_capget 21 /* Linux Specific */
40#define __NR_capset 22 /* Linux Specific */
41#define __NR_setuid 23 /* Implemented via setreuid in SunOS */
42#define __NR_getuid 24 /* Common */
43#define __NR_vmsplice 25 /* ENOSYS under SunOS */
44#define __NR_ptrace 26 /* Common */
45#define __NR_alarm 27 /* Implemented via setitimer in SunOS */
46#define __NR_sigaltstack 28 /* Common */
47#define __NR_pause 29 /* Is sigblock(0)->sigpause() in SunOS */
48#define __NR_utime 30 /* Implemented via utimes() under SunOS */
49/* #define __NR_lchown32 31 Linux sparc32 specific */
50/* #define __NR_fchown32 32 Linux sparc32 specific */
51#define __NR_access 33 /* Common */
52#define __NR_nice 34 /* Implemented via get/setpriority() in SunOS */
53/* #define __NR_chown32 35 Linux sparc32 specific */
54#define __NR_sync 36 /* Common */
55#define __NR_kill 37 /* Common */
56#define __NR_stat 38 /* Common */
57#define __NR_sendfile 39 /* Linux Specific */
58#define __NR_lstat 40 /* Common */
59#define __NR_dup 41 /* Common */
60#define __NR_pipe 42 /* Common */
61#define __NR_times 43 /* Implemented via getrusage() in SunOS */
62/* #define __NR_getuid32 44 Linux sparc32 specific */
63#define __NR_umount2 45 /* Linux Specific */
64#define __NR_setgid 46 /* Implemented via setregid() in SunOS */
65#define __NR_getgid 47 /* Common */
66#define __NR_signal 48 /* Implemented via sigvec() in SunOS */
67#define __NR_geteuid 49 /* SunOS calls getuid() */
68#define __NR_getegid 50 /* SunOS calls getgid() */
69#define __NR_acct 51 /* Common */
70#define __NR_memory_ordering 52 /* Linux Specific */
71/* #define __NR_getgid32 53 Linux sparc32 specific */
72#define __NR_ioctl 54 /* Common */
73#define __NR_reboot 55 /* Common */
74/* #define __NR_mmap2 56 Linux sparc32 Specific */
75#define __NR_symlink 57 /* Common */
76#define __NR_readlink 58 /* Common */
77#define __NR_execve 59 /* Common */
78#define __NR_umask 60 /* Common */
79#define __NR_chroot 61 /* Common */
80#define __NR_fstat 62 /* Common */
81#define __NR_fstat64 63 /* Linux Specific */
82#define __NR_getpagesize 64 /* Common */
83#define __NR_msync 65 /* Common in newer 1.3.x revs... */
84#define __NR_vfork 66 /* Common */
85#define __NR_pread64 67 /* Linux Specific */
86#define __NR_pwrite64 68 /* Linux Specific */
87/* #define __NR_geteuid32 69 Linux sparc32, sbrk under SunOS */
88/* #define __NR_getegid32 70 Linux sparc32, sstk under SunOS */
89#define __NR_mmap 71 /* Common */
90/* #define __NR_setreuid32 72 Linux sparc32, vadvise under SunOS */
91#define __NR_munmap 73 /* Common */
92#define __NR_mprotect 74 /* Common */
93#define __NR_madvise 75 /* Common */
94#define __NR_vhangup 76 /* Common */
95/* #define __NR_truncate64 77 Linux sparc32 Specific */
96#define __NR_mincore 78 /* Common */
97#define __NR_getgroups 79 /* Common */
98#define __NR_setgroups 80 /* Common */
99#define __NR_getpgrp 81 /* Common */
100/* #define __NR_setgroups32 82 Linux sparc32, setpgrp under SunOS */
101#define __NR_setitimer 83 /* Common */
102/* #define __NR_ftruncate64 84 Linux sparc32 Specific */
103#define __NR_swapon 85 /* Common */
104#define __NR_getitimer 86 /* Common */
105/* #define __NR_setuid32 87 Linux sparc32, gethostname under SunOS */
106#define __NR_sethostname 88 /* Common */
107/* #define __NR_setgid32 89 Linux sparc32, getdtablesize under SunOS */
108#define __NR_dup2 90 /* Common */
109/* #define __NR_setfsuid32 91 Linux sparc32, getdopt under SunOS */
110#define __NR_fcntl 92 /* Common */
111#define __NR_select 93 /* Common */
112/* #define __NR_setfsgid32 94 Linux sparc32, setdopt under SunOS */
113#define __NR_fsync 95 /* Common */
114#define __NR_setpriority 96 /* Common */
115#define __NR_socket 97 /* Common */
116#define __NR_connect 98 /* Common */
117#define __NR_accept 99 /* Common */
118#define __NR_getpriority 100 /* Common */
119#define __NR_rt_sigreturn 101 /* Linux Specific */
120#define __NR_rt_sigaction 102 /* Linux Specific */
121#define __NR_rt_sigprocmask 103 /* Linux Specific */
122#define __NR_rt_sigpending 104 /* Linux Specific */
123#define __NR_rt_sigtimedwait 105 /* Linux Specific */
124#define __NR_rt_sigqueueinfo 106 /* Linux Specific */
125#define __NR_rt_sigsuspend 107 /* Linux Specific */
126#define __NR_setresuid 108 /* Linux Specific, sigvec under SunOS */
127#define __NR_getresuid 109 /* Linux Specific, sigblock under SunOS */
128#define __NR_setresgid 110 /* Linux Specific, sigsetmask under SunOS */
129#define __NR_getresgid 111 /* Linux Specific, sigpause under SunOS */
130/* #define __NR_setregid32 75 Linux sparc32, sigstack under SunOS */
131#define __NR_recvmsg 113 /* Common */
132#define __NR_sendmsg 114 /* Common */
133/* #define __NR_getgroups32 115 Linux sparc32, vtrace under SunOS */
134#define __NR_gettimeofday 116 /* Common */
135#define __NR_getrusage 117 /* Common */
136#define __NR_getsockopt 118 /* Common */
137#define __NR_getcwd 119 /* Linux Specific */
138#define __NR_readv 120 /* Common */
139#define __NR_writev 121 /* Common */
140#define __NR_settimeofday 122 /* Common */
141#define __NR_fchown 123 /* Common */
142#define __NR_fchmod 124 /* Common */
143#define __NR_recvfrom 125 /* Common */
144#define __NR_setreuid 126 /* Common */
145#define __NR_setregid 127 /* Common */
146#define __NR_rename 128 /* Common */
147#define __NR_truncate 129 /* Common */
148#define __NR_ftruncate 130 /* Common */
149#define __NR_flock 131 /* Common */
150#define __NR_lstat64 132 /* Linux Specific */
151#define __NR_sendto 133 /* Common */
152#define __NR_shutdown 134 /* Common */
153#define __NR_socketpair 135 /* Common */
154#define __NR_mkdir 136 /* Common */
155#define __NR_rmdir 137 /* Common */
156#define __NR_utimes 138 /* SunOS Specific */
157#define __NR_stat64 139 /* Linux Specific */
158#define __NR_sendfile64 140 /* adjtime under SunOS */
159#define __NR_getpeername 141 /* Common */
160#define __NR_futex 142 /* gethostid under SunOS */
161#define __NR_gettid 143 /* ENOSYS under SunOS */
162#define __NR_getrlimit 144 /* Common */
163#define __NR_setrlimit 145 /* Common */
164#define __NR_pivot_root 146 /* Linux Specific, killpg under SunOS */
165#define __NR_prctl 147 /* ENOSYS under SunOS */
166#define __NR_pciconfig_read 148 /* ENOSYS under SunOS */
167#define __NR_pciconfig_write 149 /* ENOSYS under SunOS */
168#define __NR_getsockname 150 /* Common */
169#define __NR_inotify_init 151 /* Linux specific */
170#define __NR_inotify_add_watch 152 /* Linux specific */
171#define __NR_poll 153 /* Common */
172#define __NR_getdents64 154 /* Linux specific */
173/* #define __NR_fcntl64 155 Linux sparc32 Specific */
174#define __NR_inotify_rm_watch 156 /* Linux specific */
175#define __NR_statfs 157 /* Common */
176#define __NR_fstatfs 158 /* Common */
177#define __NR_umount 159 /* Common */
178#define __NR_sched_set_affinity 160 /* Linux specific, async_daemon under SunOS */
179#define __NR_sched_get_affinity 161 /* Linux specific, getfh under SunOS */
180#define __NR_getdomainname 162 /* SunOS Specific */
181#define __NR_setdomainname 163 /* Common */
182#define __NR_utrap_install 164 /* SYSV ABI/v9 required */
183#define __NR_quotactl 165 /* Common */
184#define __NR_set_tid_address 166 /* Linux specific, exportfs under SunOS */
185#define __NR_mount 167 /* Common */
186#define __NR_ustat 168 /* Common */
187#define __NR_setxattr 169 /* SunOS: semsys */
188#define __NR_lsetxattr 170 /* SunOS: msgsys */
189#define __NR_fsetxattr 171 /* SunOS: shmsys */
190#define __NR_getxattr 172 /* SunOS: auditsys */
191#define __NR_lgetxattr 173 /* SunOS: rfssys */
192#define __NR_getdents 174 /* Common */
193#define __NR_setsid 175 /* Common */
194#define __NR_fchdir 176 /* Common */
195#define __NR_fgetxattr 177 /* SunOS: fchroot */
196#define __NR_listxattr 178 /* SunOS: vpixsys */
197#define __NR_llistxattr 179 /* SunOS: aioread */
198#define __NR_flistxattr 180 /* SunOS: aiowrite */
199#define __NR_removexattr 181 /* SunOS: aiowait */
200#define __NR_lremovexattr 182 /* SunOS: aiocancel */
201#define __NR_sigpending 183 /* Common */
202#define __NR_query_module 184 /* Linux Specific */
203#define __NR_setpgid 185 /* Common */
204#define __NR_fremovexattr 186 /* SunOS: pathconf */
205#define __NR_tkill 187 /* SunOS: fpathconf */
206#define __NR_exit_group 188 /* Linux specific, sysconf undef SunOS */
207#define __NR_uname 189 /* Linux Specific */
208#define __NR_init_module 190 /* Linux Specific */
209#define __NR_personality 191 /* Linux Specific */
210#define __NR_remap_file_pages 192 /* Linux Specific */
211#define __NR_epoll_create 193 /* Linux Specific */
212#define __NR_epoll_ctl 194 /* Linux Specific */
213#define __NR_epoll_wait 195 /* Linux Specific */
214#define __NR_ioprio_set 196 /* Linux Specific */
215#define __NR_getppid 197 /* Linux Specific */
216#define __NR_sigaction 198 /* Linux Specific */
217#define __NR_sgetmask 199 /* Linux Specific */
218#define __NR_ssetmask 200 /* Linux Specific */
219#define __NR_sigsuspend 201 /* Linux Specific */
220#define __NR_oldlstat 202 /* Linux Specific */
221#define __NR_uselib 203 /* Linux Specific */
222#define __NR_readdir 204 /* Linux Specific */
223#define __NR_readahead 205 /* Linux Specific */
224#define __NR_socketcall 206 /* Linux Specific */
225#define __NR_syslog 207 /* Linux Specific */
226#define __NR_lookup_dcookie 208 /* Linux Specific */
227#define __NR_fadvise64 209 /* Linux Specific */
228#define __NR_fadvise64_64 210 /* Linux Specific */
229#define __NR_tgkill 211 /* Linux Specific */
230#define __NR_waitpid 212 /* Linux Specific */
231#define __NR_swapoff 213 /* Linux Specific */
232#define __NR_sysinfo 214 /* Linux Specific */
233#define __NR_ipc 215 /* Linux Specific */
234#define __NR_sigreturn 216 /* Linux Specific */
235#define __NR_clone 217 /* Linux Specific */
236#define __NR_ioprio_get 218 /* Linux Specific */
237#define __NR_adjtimex 219 /* Linux Specific */
238#define __NR_sigprocmask 220 /* Linux Specific */
239#define __NR_create_module 221 /* Linux Specific */
240#define __NR_delete_module 222 /* Linux Specific */
241#define __NR_get_kernel_syms 223 /* Linux Specific */
242#define __NR_getpgid 224 /* Linux Specific */
243#define __NR_bdflush 225 /* Linux Specific */
244#define __NR_sysfs 226 /* Linux Specific */
245#define __NR_afs_syscall 227 /* Linux Specific */
246#define __NR_setfsuid 228 /* Linux Specific */
247#define __NR_setfsgid 229 /* Linux Specific */
248#define __NR__newselect 230 /* Linux Specific */
249#ifdef __KERNEL__
250#define __NR_time 231 /* Linux sparc32 */
251#endif
252#define __NR_splice 232 /* Linux Specific */
253#define __NR_stime 233 /* Linux Specific */
254#define __NR_statfs64 234 /* Linux Specific */
255#define __NR_fstatfs64 235 /* Linux Specific */
256#define __NR__llseek 236 /* Linux Specific */
257#define __NR_mlock 237
258#define __NR_munlock 238
259#define __NR_mlockall 239
260#define __NR_munlockall 240
261#define __NR_sched_setparam 241
262#define __NR_sched_getparam 242
263#define __NR_sched_setscheduler 243
264#define __NR_sched_getscheduler 244
265#define __NR_sched_yield 245
266#define __NR_sched_get_priority_max 246
267#define __NR_sched_get_priority_min 247
268#define __NR_sched_rr_get_interval 248
269#define __NR_nanosleep 249
270#define __NR_mremap 250
271#define __NR__sysctl 251
272#define __NR_getsid 252
273#define __NR_fdatasync 253
274#define __NR_nfsservctl 254
275#define __NR_sync_file_range 255
276#define __NR_clock_settime 256
277#define __NR_clock_gettime 257
278#define __NR_clock_getres 258
279#define __NR_clock_nanosleep 259
280#define __NR_sched_getaffinity 260
281#define __NR_sched_setaffinity 261
282#define __NR_timer_settime 262
283#define __NR_timer_gettime 263
284#define __NR_timer_getoverrun 264
285#define __NR_timer_delete 265
286#define __NR_timer_create 266
287/* #define __NR_vserver 267 Reserved for VSERVER */
288#define __NR_io_setup 268
289#define __NR_io_destroy 269
290#define __NR_io_submit 270
291#define __NR_io_cancel 271
292#define __NR_io_getevents 272
293#define __NR_mq_open 273
294#define __NR_mq_unlink 274
295#define __NR_mq_timedsend 275
296#define __NR_mq_timedreceive 276
297#define __NR_mq_notify 277
298#define __NR_mq_getsetattr 278
299#define __NR_waitid 279
300#define __NR_tee 280
301#define __NR_add_key 281
302#define __NR_request_key 282
303#define __NR_keyctl 283
304#define __NR_openat 284
305#define __NR_mkdirat 285
306#define __NR_mknodat 286
307#define __NR_fchownat 287
308#define __NR_futimesat 288
309#define __NR_fstatat64 289
310#define __NR_unlinkat 290
311#define __NR_renameat 291
312#define __NR_linkat 292
313#define __NR_symlinkat 293
314#define __NR_readlinkat 294
315#define __NR_fchmodat 295
316#define __NR_faccessat 296
317#define __NR_pselect6 297
318#define __NR_ppoll 298
319#define __NR_unshare 299
320#define __NR_set_robust_list 300
321#define __NR_get_robust_list 301
322#define __NR_migrate_pages 302
323#define __NR_mbind 303
324#define __NR_get_mempolicy 304
325#define __NR_set_mempolicy 305
326#define __NR_kexec_load 306
327#define __NR_move_pages 307
328#define __NR_getcpu 308
329#define __NR_epoll_pwait 309
330#define __NR_utimensat 310
331#define __NR_signalfd 311
332#define __NR_timerfd_create 312
333#define __NR_eventfd 313
334#define __NR_fallocate 314
335#define __NR_timerfd_settime 315
336#define __NR_timerfd_gettime 316
337#define __NR_signalfd4 317
338#define __NR_eventfd2 318
339#define __NR_epoll_create1 319
340#define __NR_dup3 320
341#define __NR_pipe2 321
342#define __NR_inotify_init1 322
343#define __NR_accept4 323
344
345#define NR_SYSCALLS 324
346
347#ifdef __KERNEL__
348#define __ARCH_WANT_IPC_PARSE_VERSION
349#define __ARCH_WANT_OLD_READDIR
350#define __ARCH_WANT_STAT64
351#define __ARCH_WANT_SYS_ALARM
352#define __ARCH_WANT_SYS_GETHOSTNAME
353#define __ARCH_WANT_SYS_PAUSE
354#define __ARCH_WANT_SYS_SGETMASK
355#define __ARCH_WANT_SYS_SIGNAL
356#define __ARCH_WANT_SYS_TIME
357#define __ARCH_WANT_COMPAT_SYS_TIME
358#define __ARCH_WANT_SYS_UTIME
359#define __ARCH_WANT_SYS_WAITPID
360#define __ARCH_WANT_SYS_SOCKETCALL
361#define __ARCH_WANT_SYS_FADVISE64
362#define __ARCH_WANT_SYS_GETPGRP
363#define __ARCH_WANT_SYS_LLSEEK
364#define __ARCH_WANT_SYS_NICE
365#define __ARCH_WANT_SYS_OLDUMOUNT
366#define __ARCH_WANT_SYS_SIGPENDING
367#define __ARCH_WANT_SYS_SIGPROCMASK
368#define __ARCH_WANT_SYS_RT_SIGSUSPEND
369#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
370
371/*
372 * "Conditional" syscalls
373 *
374 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
375 * but it doesn't work on all toolchains, so we just do it by hand
376 */
377#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
378
379#endif /* __KERNEL__ */
380#endif /* _SPARC64_UNISTD_H */
diff --git a/arch/sparc/kernel/.gitignore b/arch/sparc/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/sparc/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 2d6582095099..53adcaa0348b 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -2,25 +2,98 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5extra-y := head.o init_task.o vmlinux.lds 5asflags-y := -ansi
6 6ccflags-y := -Werror
7EXTRA_AFLAGS := -ansi 7
8 8extra-y := head_$(BITS).o
9IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o 9extra-y += init_task.o
10obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o $(IRQ_OBJS) \ 10extra-y += vmlinux.lds
11 process.o signal.o ioport.o setup.o idprom.o \ 11
12 sys_sparc.o systbls.o \ 12obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o
13 time.o windows.o cpu.o devices.o \ 13obj-$(CONFIG_SPARC32) += etrap_32.o
14 tadpole.o tick14.o ptrace.o \ 14obj-$(CONFIG_SPARC32) += rtrap_32.o
15 unaligned.o una_asm.o muldiv.o \ 15obj-y += traps_$(BITS).o
16 prom.o of_device.o devres.o dma.o 16
17 17# IRQ
18devres-y = ../../../kernel/irq/devres.o 18obj-y += irq_$(BITS).o
19 19obj-$(CONFIG_SPARC32) += sun4m_irq.o sun4c_irq.o sun4d_irq.o
20obj-$(CONFIG_PCI) += pcic.o 20
21obj-$(CONFIG_SMP) += trampoline.o smp.o sun4m_smp.o sun4d_smp.o 21obj-y += process_$(BITS).o
22obj-$(CONFIG_SUN_AUXIO) += auxio.o 22obj-y += signal_$(BITS).o
23obj-$(CONFIG_SUN_PM) += apc.o pmc.o 23obj-$(CONFIG_SPARC32) += ioport.o
24obj-$(CONFIG_MODULES) += module.o sparc_ksyms.o 24obj-y += setup_$(BITS).o
25obj-$(CONFIG_SPARC_LED) += led.o 25obj-y += idprom.o
26obj-$(CONFIG_KGDB) += kgdb.o 26obj-y += sys_sparc_$(BITS).o
27obj-$(CONFIG_SPARC32) += systbls_32.o
28obj-y += time_$(BITS).o
29obj-$(CONFIG_SPARC32) += windows.o
30obj-y += cpu.o
31obj-$(CONFIG_SPARC32) += devices.o
32obj-$(CONFIG_SPARC32) += tadpole.o
33obj-$(CONFIG_SPARC32) += tick14.o
34obj-y += ptrace_$(BITS).o
35obj-y += unaligned_$(BITS).o
36obj-y += una_asm_$(BITS).o
37obj-$(CONFIG_SPARC32) += muldiv.o
38obj-y += prom_common.o
39obj-y += prom_$(BITS).o
40obj-y += of_device_$(BITS).o
41obj-$(CONFIG_SPARC64) += prom_irqtrans.o
42
43obj-$(CONFIG_SPARC64) += reboot.o
44obj-$(CONFIG_SPARC64) += sysfs.o
45obj-$(CONFIG_SPARC64) += iommu.o
46obj-$(CONFIG_SPARC64) += central.o
47obj-$(CONFIG_SPARC64) += starfire.o
48obj-$(CONFIG_SPARC64) += power.o
49obj-$(CONFIG_SPARC64) += sbus.o
50obj-$(CONFIG_SPARC64) += ebus.o
51obj-$(CONFIG_SPARC64) += visemul.o
52obj-$(CONFIG_SPARC64) += hvapi.o
53obj-$(CONFIG_SPARC64) += sstate.o
54obj-$(CONFIG_SPARC64) += mdesc.o
55
56# sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation
57obj-$(CONFIG_SPARC32) += devres.o
58devres-y := ../../../kernel/irq/devres.o
59
60obj-$(CONFIG_SPARC32) += dma.o
61
62obj-$(CONFIG_SPARC32_PCI) += pcic.o
63
64obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o
65obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o
66obj-$(CONFIG_SPARC64_SMP) += hvtramp.o
67
68obj-y += auxio_$(BITS).o
69obj-$(CONFIG_SUN_PM) += apc.o pmc.o
70
71obj-$(CONFIG_MODULES) += module.o
72obj-$(CONFIG_MODULES) += sparc_ksyms_$(BITS).o
73obj-$(CONFIG_SPARC_LED) += led.o
74obj-$(CONFIG_KGDB) += kgdb_$(BITS).o
75
76
77obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
78CFLAGS_REMOVE_ftrace.o := -pg
79
80obj-$(CONFIG_STACKTRACE) += stacktrace.o
81# sparc64 PCI
82obj-$(CONFIG_SPARC64_PCI) += pci.o pci_common.o psycho_common.o
83obj-$(CONFIG_SPARC64_PCI) += pci_psycho.o pci_sabre.o pci_schizo.o
84obj-$(CONFIG_SPARC64_PCI) += pci_sun4v.o pci_sun4v_asm.o pci_fire.o
85obj-$(CONFIG_PCI_MSI) += pci_msi.o
86
87obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o
88
89# sparc64 cpufreq
90obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o
91obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o
92obj-$(CONFIG_US3_MC) += chmc.o
93
94obj-$(CONFIG_KPROBES) += kprobes.o
95obj-$(CONFIG_SUN_LDOMS) += ldc.o vio.o viohs.o ds.o
96
97obj-$(CONFIG_AUDIT) += audit.o
98audit--$(CONFIG_AUDIT) := compat_audit.o
99obj-$(CONFIG_COMPAT) += $(audit--y)
diff --git a/arch/sparc/kernel/asm-offsets.c b/arch/sparc/kernel/asm-offsets.c
index b5bb99ed892c..68f7e1118e9b 100644
--- a/arch/sparc/kernel/asm-offsets.c
+++ b/arch/sparc/kernel/asm-offsets.c
@@ -14,15 +14,28 @@
14// #include <linux/mm.h> 14// #include <linux/mm.h>
15#include <linux/kbuild.h> 15#include <linux/kbuild.h>
16 16
17int foo(void) 17#ifdef CONFIG_SPARC32
18int sparc32_foo(void)
18{ 19{
19 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
20 BLANK();
21 DEFINE(AOFF_thread_fork_kpsr, 20 DEFINE(AOFF_thread_fork_kpsr,
22 offsetof(struct thread_struct, fork_kpsr)); 21 offsetof(struct thread_struct, fork_kpsr));
22 return 0;
23}
24#else
25int sparc64_foo(void)
26{
27 return 0;
28}
29#endif
30
31int foo(void)
32{
33 BLANK();
34 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
23 BLANK(); 35 BLANK();
24 DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context)); 36 DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context));
25 37
26 /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */ 38 /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */
27 return 0; 39 return 0;
28} 40}
41
diff --git a/arch/sparc64/kernel/audit.c b/arch/sparc/kernel/audit.c
index 8fff0ac63d56..8fff0ac63d56 100644
--- a/arch/sparc64/kernel/audit.c
+++ b/arch/sparc/kernel/audit.c
diff --git a/arch/sparc/kernel/auxio.c b/arch/sparc/kernel/auxio_32.c
index 09c857215a52..09c857215a52 100644
--- a/arch/sparc/kernel/auxio.c
+++ b/arch/sparc/kernel/auxio_32.c
diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc/kernel/auxio_64.c
index 858beda86524..8b67347d4221 100644
--- a/arch/sparc64/kernel/auxio.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -27,73 +27,55 @@ enum auxio_type {
27static enum auxio_type auxio_devtype = AUXIO_TYPE_NODEV; 27static enum auxio_type auxio_devtype = AUXIO_TYPE_NODEV;
28static DEFINE_SPINLOCK(auxio_lock); 28static DEFINE_SPINLOCK(auxio_lock);
29 29
30static void __auxio_sbus_set(u8 bits_on, u8 bits_off) 30static void __auxio_rmw(u8 bits_on, u8 bits_off, int ebus)
31{ 31{
32 if (auxio_register) { 32 if (auxio_register) {
33 unsigned char regval;
34 unsigned long flags; 33 unsigned long flags;
35 unsigned char newval; 34 u8 regval, newval;
36 35
37 spin_lock_irqsave(&auxio_lock, flags); 36 spin_lock_irqsave(&auxio_lock, flags);
38 37
39 regval = sbus_readb(auxio_register); 38 regval = (ebus ?
39 (u8) readl(auxio_register) :
40 sbus_readb(auxio_register));
40 newval = regval | bits_on; 41 newval = regval | bits_on;
41 newval &= ~bits_off; 42 newval &= ~bits_off;
42 newval &= ~AUXIO_AUX1_MASK; 43 if (!ebus)
43 sbus_writeb(newval, auxio_register); 44 newval &= ~AUXIO_AUX1_MASK;
45 if (ebus)
46 writel((u32) newval, auxio_register);
47 else
48 sbus_writeb(newval, auxio_register);
44 49
45 spin_unlock_irqrestore(&auxio_lock, flags); 50 spin_unlock_irqrestore(&auxio_lock, flags);
46 } 51 }
47} 52}
48 53
49static void __auxio_ebus_set(u8 bits_on, u8 bits_off) 54static void __auxio_set_bit(u8 bit, int on, int ebus)
50{ 55{
51 if (auxio_register) { 56 u8 bits_on = (ebus ? AUXIO_PCIO_LED : AUXIO_AUX1_LED);
52 unsigned char regval; 57 u8 bits_off = 0;
53 unsigned long flags;
54 unsigned char newval;
55
56 spin_lock_irqsave(&auxio_lock, flags);
57
58 regval = (u8)readl(auxio_register);
59 newval = regval | bits_on;
60 newval &= ~bits_off;
61 writel((u32)newval, auxio_register);
62 58
63 spin_unlock_irqrestore(&auxio_lock, flags); 59 if (!on) {
60 u8 tmp = bits_off;
61 bits_off = bits_on;
62 bits_on = tmp;
64 } 63 }
65} 64 __auxio_rmw(bits_on, bits_off, ebus);
66
67static inline void __auxio_ebus_set_led(int on)
68{
69 (on) ? __auxio_ebus_set(AUXIO_PCIO_LED, 0) :
70 __auxio_ebus_set(0, AUXIO_PCIO_LED) ;
71}
72
73static inline void __auxio_sbus_set_led(int on)
74{
75 (on) ? __auxio_sbus_set(AUXIO_AUX1_LED, 0) :
76 __auxio_sbus_set(0, AUXIO_AUX1_LED) ;
77} 65}
78 66
79void auxio_set_led(int on) 67void auxio_set_led(int on)
80{ 68{
81 switch(auxio_devtype) { 69 int ebus = auxio_devtype == AUXIO_TYPE_EBUS;
82 case AUXIO_TYPE_SBUS: 70 u8 bit;
83 __auxio_sbus_set_led(on); 71
84 break; 72 bit = (ebus ? AUXIO_PCIO_LED : AUXIO_AUX1_LED);
85 case AUXIO_TYPE_EBUS: 73 __auxio_set_bit(bit, on, ebus);
86 __auxio_ebus_set_led(on);
87 break;
88 default:
89 break;
90 }
91} 74}
92 75
93static inline void __auxio_sbus_set_lte(int on) 76static void __auxio_sbus_set_lte(int on)
94{ 77{
95 (on) ? __auxio_sbus_set(AUXIO_AUX1_LTE, 0) : 78 __auxio_set_bit(AUXIO_AUX1_LTE, on, 0);
96 __auxio_sbus_set(0, AUXIO_AUX1_LTE) ;
97} 79}
98 80
99void auxio_set_lte(int on) 81void auxio_set_lte(int on)
diff --git a/arch/sparc64/kernel/central.c b/arch/sparc/kernel/central.c
index 05f1c916db06..05f1c916db06 100644
--- a/arch/sparc64/kernel/central.c
+++ b/arch/sparc/kernel/central.c
diff --git a/arch/sparc64/kernel/cherrs.S b/arch/sparc/kernel/cherrs.S
index 89afebd7eca0..4ee1ad420862 100644
--- a/arch/sparc64/kernel/cherrs.S
+++ b/arch/sparc/kernel/cherrs.S
@@ -102,7 +102,7 @@ cheetah_plus_dcpe_trap_vector:
102 .type do_cheetah_plus_data_parity,#function 102 .type do_cheetah_plus_data_parity,#function
103do_cheetah_plus_data_parity: 103do_cheetah_plus_data_parity:
104 rdpr %pil, %g2 104 rdpr %pil, %g2
105 wrpr %g0, 15, %pil 105 wrpr %g0, PIL_NORMAL_MAX, %pil
106 ba,pt %xcc, etrap_irq 106 ba,pt %xcc, etrap_irq
107 rd %pc, %g7 107 rd %pc, %g7
108#ifdef CONFIG_TRACE_IRQFLAGS 108#ifdef CONFIG_TRACE_IRQFLAGS
@@ -144,7 +144,7 @@ cheetah_plus_icpe_trap_vector:
144 .type do_cheetah_plus_insn_parity,#function 144 .type do_cheetah_plus_insn_parity,#function
145do_cheetah_plus_insn_parity: 145do_cheetah_plus_insn_parity:
146 rdpr %pil, %g2 146 rdpr %pil, %g2
147 wrpr %g0, 15, %pil 147 wrpr %g0, PIL_NORMAL_MAX, %pil
148 ba,pt %xcc, etrap_irq 148 ba,pt %xcc, etrap_irq
149 rd %pc, %g7 149 rd %pc, %g7
150#ifdef CONFIG_TRACE_IRQFLAGS 150#ifdef CONFIG_TRACE_IRQFLAGS
@@ -492,7 +492,7 @@ cheetah_fast_ecc:
492 .type c_fast_ecc,#function 492 .type c_fast_ecc,#function
493c_fast_ecc: 493c_fast_ecc:
494 rdpr %pil, %g2 494 rdpr %pil, %g2
495 wrpr %g0, 15, %pil 495 wrpr %g0, PIL_NORMAL_MAX, %pil
496 ba,pt %xcc, etrap_irq 496 ba,pt %xcc, etrap_irq
497 rd %pc, %g7 497 rd %pc, %g7
498#ifdef CONFIG_TRACE_IRQFLAGS 498#ifdef CONFIG_TRACE_IRQFLAGS
@@ -528,7 +528,7 @@ cheetah_cee:
528 .type c_cee,#function 528 .type c_cee,#function
529c_cee: 529c_cee:
530 rdpr %pil, %g2 530 rdpr %pil, %g2
531 wrpr %g0, 15, %pil 531 wrpr %g0, PIL_NORMAL_MAX, %pil
532 ba,pt %xcc, etrap_irq 532 ba,pt %xcc, etrap_irq
533 rd %pc, %g7 533 rd %pc, %g7
534#ifdef CONFIG_TRACE_IRQFLAGS 534#ifdef CONFIG_TRACE_IRQFLAGS
@@ -564,7 +564,7 @@ cheetah_deferred_trap:
564 .type c_deferred,#function 564 .type c_deferred,#function
565c_deferred: 565c_deferred:
566 rdpr %pil, %g2 566 rdpr %pil, %g2
567 wrpr %g0, 15, %pil 567 wrpr %g0, PIL_NORMAL_MAX, %pil
568 ba,pt %xcc, etrap_irq 568 ba,pt %xcc, etrap_irq
569 rd %pc, %g7 569 rd %pc, %g7
570#ifdef CONFIG_TRACE_IRQFLAGS 570#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/sparc64/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 3b9f4d6e14a9..3b9f4d6e14a9 100644
--- a/arch/sparc64/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
diff --git a/arch/sparc64/kernel/compat_audit.c b/arch/sparc/kernel/compat_audit.c
index c831b0a4e660..d865575b25bf 100644
--- a/arch/sparc64/kernel/compat_audit.c
+++ b/arch/sparc/kernel/compat_audit.c
@@ -1,4 +1,5 @@
1#include <asm/unistd_32.h> 1#define __32bit_syscall_numbers__
2#include <asm/unistd.h>
2 3
3unsigned sparc32_dir_class[] = { 4unsigned sparc32_dir_class[] = {
4#include <asm-generic/audit_dir_write.h> 5#include <asm-generic/audit_dir_write.h>
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 1fc17f59c6bf..6c2da2420f76 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -8,6 +8,8 @@
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/smp.h> 9#include <linux/smp.h>
10#include <linux/threads.h> 10#include <linux/threads.h>
11
12#include <asm/spitfire.h>
11#include <asm/oplib.h> 13#include <asm/oplib.h>
12#include <asm/page.h> 14#include <asm/page.h>
13#include <asm/head.h> 15#include <asm/head.h>
@@ -15,153 +17,322 @@
15#include <asm/mbus.h> 17#include <asm/mbus.h>
16#include <asm/cpudata.h> 18#include <asm/cpudata.h>
17 19
20#include "kernel.h"
21
18DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; 22DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
19 23
20struct cpu_iu_info { 24struct cpu_info {
21 int psr_impl; 25 int psr_vers;
22 int psr_vers; 26 const char *name;
23 char* cpu_name; /* should be enough I hope... */ 27};
28
29struct fpu_info {
30 int fp_vers;
31 const char *name;
24}; 32};
25 33
26struct cpu_fp_info { 34#define NOCPU 8
27 int psr_impl; 35#define NOFPU 8
28 int fp_vers; 36
29 char* fp_name; 37struct manufacturer_info {
38 int psr_impl;
39 struct cpu_info cpu_info[NOCPU];
40 struct fpu_info fpu_info[NOFPU];
30}; 41};
31 42
43#define CPU(ver, _name) \
44{ .psr_vers = ver, .name = _name }
45
46#define FPU(ver, _name) \
47{ .fp_vers = ver, .name = _name }
48
49static const struct manufacturer_info __initconst manufacturer_info[] = {
50{
51 0,
52 /* Sun4/100, 4/200, SLC */
53 .cpu_info = {
54 CPU(0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"),
55 /* borned STP1012PGA */
56 CPU(4, "Fujitsu MB86904"),
57 CPU(5, "Fujitsu TurboSparc MB86907"),
58 CPU(-1, NULL)
59 },
60 .fpu_info = {
61 FPU(0, "Fujitsu MB86910 or Weitek WTL1164/5"),
62 FPU(1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"),
63 FPU(2, "LSI Logic L64802 or Texas Instruments ACT8847"),
64 /* SparcStation SLC, SparcStation1 */
65 FPU(3, "Weitek WTL3170/2"),
66 /* SPARCstation-5 */
67 FPU(4, "Lsi Logic/Meiko L64804 or compatible"),
68 FPU(-1, NULL)
69 }
70},{
71 1,
72 .cpu_info = {
73 /* SparcStation2, SparcServer 490 & 690 */
74 CPU(0, "LSI Logic Corporation - L64811"),
75 /* SparcStation2 */
76 CPU(1, "Cypress/ROSS CY7C601"),
77 /* Embedded controller */
78 CPU(3, "Cypress/ROSS CY7C611"),
79 /* Ross Technologies HyperSparc */
80 CPU(0xf, "ROSS HyperSparc RT620"),
81 CPU(0xe, "ROSS HyperSparc RT625 or RT626"),
82 CPU(-1, NULL)
83 },
84 .fpu_info = {
85 FPU(0, "ROSS HyperSparc combined IU/FPU"),
86 FPU(1, "Lsi Logic L64814"),
87 FPU(2, "Texas Instruments TMS390-C602A"),
88 FPU(3, "Cypress CY7C602 FPU"),
89 FPU(-1, NULL)
90 }
91},{
92 2,
93 .cpu_info = {
94 /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
95 /* Someone please write the code to support this beast! ;) */
96 CPU(0, "Bipolar Integrated Technology - B5010"),
97 CPU(-1, NULL)
98 },
99 .fpu_info = {
100 FPU(-1, NULL)
101 }
102},{
103 3,
104 .cpu_info = {
105 CPU(0, "LSI Logic Corporation - unknown-type"),
106 CPU(-1, NULL)
107 },
108 .fpu_info = {
109 FPU(-1, NULL)
110 }
111},{
112 4,
113 .cpu_info = {
114 CPU(0, "Texas Instruments, Inc. - SuperSparc-(II)"),
115 /* SparcClassic -- borned STP1010TAB-50*/
116 CPU(1, "Texas Instruments, Inc. - MicroSparc"),
117 CPU(2, "Texas Instruments, Inc. - MicroSparc II"),
118 CPU(3, "Texas Instruments, Inc. - SuperSparc 51"),
119 CPU(4, "Texas Instruments, Inc. - SuperSparc 61"),
120 CPU(5, "Texas Instruments, Inc. - unknown"),
121 CPU(-1, NULL)
122 },
123 .fpu_info = {
124 /* SuperSparc 50 module */
125 FPU(0, "SuperSparc on-chip FPU"),
126 /* SparcClassic */
127 FPU(4, "TI MicroSparc on chip FPU"),
128 FPU(-1, NULL)
129 }
130},{
131 5,
132 .cpu_info = {
133 CPU(0, "Matsushita - MN10501"),
134 CPU(-1, NULL)
135 },
136 .fpu_info = {
137 FPU(0, "Matsushita MN10501"),
138 FPU(-1, NULL)
139 }
140},{
141 6,
142 .cpu_info = {
143 CPU(0, "Philips Corporation - unknown"),
144 CPU(-1, NULL)
145 },
146 .fpu_info = {
147 FPU(-1, NULL)
148 }
149},{
150 7,
151 .cpu_info = {
152 CPU(0, "Harvest VLSI Design Center, Inc. - unknown"),
153 CPU(-1, NULL)
154 },
155 .fpu_info = {
156 FPU(-1, NULL)
157 }
158},{
159 8,
160 .cpu_info = {
161 CPU(0, "Systems and Processes Engineering Corporation (SPEC)"),
162 CPU(-1, NULL)
163 },
164 .fpu_info = {
165 FPU(-1, NULL)
166 }
167},{
168 9,
169 .cpu_info = {
170 /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
171 CPU(0, "Fujitsu or Weitek Power-UP"),
172 CPU(1, "Fujitsu or Weitek Power-UP"),
173 CPU(2, "Fujitsu or Weitek Power-UP"),
174 CPU(3, "Fujitsu or Weitek Power-UP"),
175 CPU(-1, NULL)
176 },
177 .fpu_info = {
178 FPU(3, "Fujitsu or Weitek on-chip FPU"),
179 FPU(-1, NULL)
180 }
181},{
182 0x17,
183 .cpu_info = {
184 CPU(0x10, "TI UltraSparc I (SpitFire)"),
185 CPU(0x11, "TI UltraSparc II (BlackBird)"),
186 CPU(0x12, "TI UltraSparc IIi (Sabre)"),
187 CPU(0x13, "TI UltraSparc IIe (Hummingbird)"),
188 CPU(-1, NULL)
189 },
190 .fpu_info = {
191 FPU(0x10, "UltraSparc I integrated FPU"),
192 FPU(0x11, "UltraSparc II integrated FPU"),
193 FPU(0x12, "UltraSparc IIi integrated FPU"),
194 FPU(0x13, "UltraSparc IIe integrated FPU"),
195 FPU(-1, NULL)
196 }
197},{
198 0x22,
199 .cpu_info = {
200 CPU(0x10, "TI UltraSparc I (SpitFire)"),
201 CPU(-1, NULL)
202 },
203 .fpu_info = {
204 FPU(0x10, "UltraSparc I integrated FPU"),
205 FPU(-1, NULL)
206 }
207},{
208 0x3e,
209 .cpu_info = {
210 CPU(0x14, "TI UltraSparc III (Cheetah)"),
211 CPU(0x15, "TI UltraSparc III+ (Cheetah+)"),
212 CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"),
213 CPU(0x18, "TI UltraSparc IV (Jaguar)"),
214 CPU(0x19, "TI UltraSparc IV+ (Panther)"),
215 CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"),
216 CPU(-1, NULL)
217 },
218 .fpu_info = {
219 FPU(0x14, "UltraSparc III integrated FPU"),
220 FPU(0x15, "UltraSparc III+ integrated FPU"),
221 FPU(0x16, "UltraSparc IIIi integrated FPU"),
222 FPU(0x18, "UltraSparc IV integrated FPU"),
223 FPU(0x19, "UltraSparc IV+ integrated FPU"),
224 FPU(0x22, "UltraSparc IIIi+ integrated FPU"),
225 FPU(-1, NULL)
226 }
227}};
228
32/* In order to get the fpu type correct, you need to take the IDPROM's 229/* In order to get the fpu type correct, you need to take the IDPROM's
33 * machine type value into consideration too. I will fix this. 230 * machine type value into consideration too. I will fix this.
34 */ 231 */
35static struct cpu_fp_info linux_sparc_fpu[] = {
36 { 0, 0, "Fujitsu MB86910 or Weitek WTL1164/5"},
37 { 0, 1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"},
38 { 0, 2, "LSI Logic L64802 or Texas Instruments ACT8847"},
39 /* SparcStation SLC, SparcStation1 */
40 { 0, 3, "Weitek WTL3170/2"},
41 /* SPARCstation-5 */
42 { 0, 4, "Lsi Logic/Meiko L64804 or compatible"},
43 { 0, 5, "reserved"},
44 { 0, 6, "reserved"},
45 { 0, 7, "No FPU"},
46 { 1, 0, "ROSS HyperSparc combined IU/FPU"},
47 { 1, 1, "Lsi Logic L64814"},
48 { 1, 2, "Texas Instruments TMS390-C602A"},
49 { 1, 3, "Cypress CY7C602 FPU"},
50 { 1, 4, "reserved"},
51 { 1, 5, "reserved"},
52 { 1, 6, "reserved"},
53 { 1, 7, "No FPU"},
54 { 2, 0, "BIT B5010 or B5110/20 or B5210"},
55 { 2, 1, "reserved"},
56 { 2, 2, "reserved"},
57 { 2, 3, "reserved"},
58 { 2, 4, "reserved"},
59 { 2, 5, "reserved"},
60 { 2, 6, "reserved"},
61 { 2, 7, "No FPU"},
62 /* SuperSparc 50 module */
63 { 4, 0, "SuperSparc on-chip FPU"},
64 /* SparcClassic */
65 { 4, 4, "TI MicroSparc on chip FPU"},
66 { 5, 0, "Matsushita MN10501"},
67 { 5, 1, "reserved"},
68 { 5, 2, "reserved"},
69 { 5, 3, "reserved"},
70 { 5, 4, "reserved"},
71 { 5, 5, "reserved"},
72 { 5, 6, "reserved"},
73 { 5, 7, "No FPU"},
74 { 9, 3, "Fujitsu or Weitek on-chip FPU"},
75};
76 232
77#define NSPARCFPU ARRAY_SIZE(linux_sparc_fpu) 233const char *sparc_cpu_type;
78 234const char *sparc_fpu_type;
79static struct cpu_iu_info linux_sparc_chips[] = {
80 /* Sun4/100, 4/200, SLC */
81 { 0, 0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"},
82 /* borned STP1012PGA */
83 { 0, 4, "Fujitsu MB86904"},
84 { 0, 5, "Fujitsu TurboSparc MB86907"},
85 /* SparcStation2, SparcServer 490 & 690 */
86 { 1, 0, "LSI Logic Corporation - L64811"},
87 /* SparcStation2 */
88 { 1, 1, "Cypress/ROSS CY7C601"},
89 /* Embedded controller */
90 { 1, 3, "Cypress/ROSS CY7C611"},
91 /* Ross Technologies HyperSparc */
92 { 1, 0xf, "ROSS HyperSparc RT620"},
93 { 1, 0xe, "ROSS HyperSparc RT625 or RT626"},
94 /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */
95 /* Someone please write the code to support this beast! ;) */
96 { 2, 0, "Bipolar Integrated Technology - B5010"},
97 { 3, 0, "LSI Logic Corporation - unknown-type"},
98 { 4, 0, "Texas Instruments, Inc. - SuperSparc-(II)"},
99 /* SparcClassic -- borned STP1010TAB-50*/
100 { 4, 1, "Texas Instruments, Inc. - MicroSparc"},
101 { 4, 2, "Texas Instruments, Inc. - MicroSparc II"},
102 { 4, 3, "Texas Instruments, Inc. - SuperSparc 51"},
103 { 4, 4, "Texas Instruments, Inc. - SuperSparc 61"},
104 { 4, 5, "Texas Instruments, Inc. - unknown"},
105 { 5, 0, "Matsushita - MN10501"},
106 { 6, 0, "Philips Corporation - unknown"},
107 { 7, 0, "Harvest VLSI Design Center, Inc. - unknown"},
108 /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */
109 { 8, 0, "Systems and Processes Engineering Corporation (SPEC)"},
110 { 9, 0, "Fujitsu or Weitek Power-UP"},
111 { 9, 1, "Fujitsu or Weitek Power-UP"},
112 { 9, 2, "Fujitsu or Weitek Power-UP"},
113 { 9, 3, "Fujitsu or Weitek Power-UP"},
114 { 0xa, 0, "UNKNOWN CPU-VENDOR/TYPE"},
115 { 0xb, 0, "UNKNOWN CPU-VENDOR/TYPE"},
116 { 0xc, 0, "UNKNOWN CPU-VENDOR/TYPE"},
117 { 0xd, 0, "UNKNOWN CPU-VENDOR/TYPE"},
118 { 0xe, 0, "UNKNOWN CPU-VENDOR/TYPE"},
119 { 0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"},
120};
121 235
122#define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips) 236unsigned int fsr_storage;
123 237
124char *sparc_cpu_type; 238static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
125char *sparc_fpu_type; 239{
240 sparc_cpu_type = NULL;
241 sparc_fpu_type = NULL;
242 if (psr_impl < ARRAY_SIZE(manufacturer_info))
243 {
244 const struct cpu_info *cpu;
245 const struct fpu_info *fpu;
126 246
127unsigned int fsr_storage; 247 cpu = &manufacturer_info[psr_impl].cpu_info[0];
248 while (cpu->psr_vers != -1)
249 {
250 if (cpu->psr_vers == psr_vers) {
251 sparc_cpu_type = cpu->name;
252 sparc_fpu_type = "No FPU";
253 break;
254 }
255 cpu++;
256 }
257 fpu = &manufacturer_info[psr_impl].fpu_info[0];
258 while (fpu->fp_vers != -1)
259 {
260 if (fpu->fp_vers == fpu_vers) {
261 sparc_fpu_type = fpu->name;
262 break;
263 }
264 fpu++;
265 }
266 }
267 if (sparc_cpu_type == NULL)
268 {
269 printk(KERN_ERR "CPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
270 psr_impl, psr_vers);
271 sparc_cpu_type = "Unknown CPU";
272 }
273 if (sparc_fpu_type == NULL)
274 {
275 printk(KERN_ERR "FPU: Unknown chip, impl[0x%x] vers[0x%x]\n",
276 psr_impl, fpu_vers);
277 sparc_fpu_type = "Unknown FPU";
278 }
279}
128 280
281#ifdef CONFIG_SPARC32
129void __cpuinit cpu_probe(void) 282void __cpuinit cpu_probe(void)
130{ 283{
131 int psr_impl, psr_vers, fpu_vers; 284 int psr_impl, psr_vers, fpu_vers;
132 int i, psr; 285 int psr;
133 286
134 psr_impl = ((get_psr()>>28)&0xf); 287 psr_impl = ((get_psr() >> 28) & 0xf);
135 psr_vers = ((get_psr()>>24)&0xf); 288 psr_vers = ((get_psr() >> 24) & 0xf);
136 289
137 psr = get_psr(); 290 psr = get_psr();
138 put_psr(psr | PSR_EF); 291 put_psr(psr | PSR_EF);
139 fpu_vers = ((get_fsr()>>17)&0x7); 292 fpu_vers = ((get_fsr() >> 17) & 0x7);
140 put_psr(psr); 293 put_psr(psr);
141 294
142 for(i = 0; i<NSPARCCHIPS; i++) { 295 set_cpu_and_fpu(psr_impl, psr_vers, fpu_vers);
143 if(linux_sparc_chips[i].psr_impl == psr_impl) 296}
144 if(linux_sparc_chips[i].psr_vers == psr_vers) { 297#else
145 sparc_cpu_type = linux_sparc_chips[i].cpu_name; 298static void __init sun4v_cpu_probe(void)
146 break; 299{
147 } 300 switch (sun4v_chip_type) {
148 } 301 case SUN4V_CHIP_NIAGARA1:
302 sparc_cpu_type = "UltraSparc T1 (Niagara)";
303 sparc_fpu_type = "UltraSparc T1 integrated FPU";
304 break;
149 305
150 if(i==NSPARCCHIPS) 306 case SUN4V_CHIP_NIAGARA2:
151 printk("DEBUG: psr.impl = 0x%x psr.vers = 0x%x\n", psr_impl, 307 sparc_cpu_type = "UltraSparc T2 (Niagara2)";
152 psr_vers); 308 sparc_fpu_type = "UltraSparc T2 integrated FPU";
309 break;
153 310
154 for(i = 0; i<NSPARCFPU; i++) { 311 default:
155 if(linux_sparc_fpu[i].psr_impl == psr_impl) 312 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
156 if(linux_sparc_fpu[i].fp_vers == fpu_vers) { 313 prom_cpu_compatible);
157 sparc_fpu_type = linux_sparc_fpu[i].fp_name; 314 sparc_cpu_type = "Unknown SUN4V CPU";
158 break; 315 sparc_fpu_type = "Unknown SUN4V FPU";
159 } 316 break;
160 } 317 }
318}
319
320static int __init cpu_type_probe(void)
321{
322 if (tlb_type == hypervisor) {
323 sun4v_cpu_probe();
324 } else {
325 unsigned long ver;
326 int manuf, impl;
161 327
162 if(i == NSPARCFPU) { 328 __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
163 printk("DEBUG: psr.impl = 0x%x fsr.vers = 0x%x\n", psr_impl, 329
164 fpu_vers); 330 manuf = ((ver >> 48) & 0xffff);
165 sparc_fpu_type = linux_sparc_fpu[31].fp_name; 331 impl = ((ver >> 32) & 0xffff);
332 set_cpu_and_fpu(manuf, impl, impl);
166 } 333 }
334 return 0;
167} 335}
336
337arch_initcall(cpu_type_probe);
338#endif
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index ad656b044b8c..b171ae8de90d 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -133,14 +133,12 @@ void __init device_scan(void)
133#endif /* !CONFIG_SMP */ 133#endif /* !CONFIG_SMP */
134 134
135 cpu_probe(); 135 cpu_probe();
136#ifdef CONFIG_SUN_AUXIO
137 { 136 {
138 extern void auxio_probe(void); 137 extern void auxio_probe(void);
139 extern void auxio_power_probe(void); 138 extern void auxio_power_probe(void);
140 auxio_probe(); 139 auxio_probe();
141 auxio_power_probe(); 140 auxio_power_probe();
142 } 141 }
143#endif
144 clock_stop_probe(); 142 clock_stop_probe();
145 143
146 if (ARCH_SUN4C) 144 if (ARCH_SUN4C)
diff --git a/arch/sparc64/kernel/ds.c b/arch/sparc/kernel/ds.c
index f52e0534d91d..f52e0534d91d 100644
--- a/arch/sparc64/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
diff --git a/arch/sparc64/kernel/dtlb_miss.S b/arch/sparc/kernel/dtlb_miss.S
index 09a6a15a7105..09a6a15a7105 100644
--- a/arch/sparc64/kernel/dtlb_miss.S
+++ b/arch/sparc/kernel/dtlb_miss.S
diff --git a/arch/sparc64/kernel/dtlb_prot.S b/arch/sparc/kernel/dtlb_prot.S
index b2c2c5be281c..b2c2c5be281c 100644
--- a/arch/sparc64/kernel/dtlb_prot.S
+++ b/arch/sparc/kernel/dtlb_prot.S
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index 77dbf6d45faf..77dbf6d45faf 100644
--- a/arch/sparc64/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
diff --git a/arch/sparc64/kernel/entry.h b/arch/sparc/kernel/entry.h
index 34d7ab5e10d2..4f53a2395ac6 100644
--- a/arch/sparc64/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -5,9 +5,43 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/init.h> 6#include <linux/init.h>
7 7
8extern const char *sparc_cpu_type; 8/* irq */
9extern const char *sparc_fpu_type; 9extern void handler_irq(int irq, struct pt_regs *regs);
10 10
11#ifdef CONFIG_SPARC32
12/* traps */
13extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type);
14extern void do_illegal_instruction(struct pt_regs *regs, unsigned long pc,
15 unsigned long npc, unsigned long psr);
16
17extern void do_priv_instruction(struct pt_regs *regs, unsigned long pc,
18 unsigned long npc, unsigned long psr);
19extern void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc,
20 unsigned long npc,
21 unsigned long psr);
22extern void do_fpd_trap(struct pt_regs *regs, unsigned long pc,
23 unsigned long npc, unsigned long psr);
24extern void do_fpe_trap(struct pt_regs *regs, unsigned long pc,
25 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
37
38
39/* entry.S */
40extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
41 void *fpqueue, unsigned long *fpqdepth);
42extern void fpload(unsigned long *fpregs, unsigned long *fsr);
43
44#else /* CONFIG_SPARC32 */
11extern void __init per_cpu_patch(void); 45extern void __init per_cpu_patch(void);
12extern void __init sun4v_patch(void); 46extern void __init sun4v_patch(void);
13extern void __init boot_cpu_id_too_large(int cpu); 47extern void __init boot_cpu_id_too_large(int cpu);
@@ -188,8 +222,8 @@ struct ino_bucket {
188extern struct ino_bucket *ivector_table; 222extern struct ino_bucket *ivector_table;
189extern unsigned long ivector_table_pa; 223extern unsigned long ivector_table_pa;
190 224
191extern void handler_irq(int irq, struct pt_regs *regs);
192extern void init_irqwork_curcpu(void); 225extern void init_irqwork_curcpu(void);
193extern void __cpuinit sun4v_register_mondo_queues(int this_cpu); 226extern void __cpuinit sun4v_register_mondo_queues(int this_cpu);
194 227
228#endif /* CONFIG_SPARC32 */
195#endif /* _ENTRY_H */ 229#endif /* _ENTRY_H */
diff --git a/arch/sparc/kernel/etrap.S b/arch/sparc/kernel/etrap_32.S
index e806fcdc46db..e806fcdc46db 100644
--- a/arch/sparc/kernel/etrap.S
+++ b/arch/sparc/kernel/etrap_32.S
diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc/kernel/etrap_64.S
index 29ce489bc188..786b185e6e3f 100644
--- a/arch/sparc64/kernel/etrap.S
+++ b/arch/sparc/kernel/etrap_64.S
@@ -16,9 +16,9 @@
16#include <asm/mmu.h> 16#include <asm/mmu.h>
17 17
18#define TASK_REGOFF (THREAD_SIZE-TRACEREG_SZ-STACKFRAME_SZ) 18#define TASK_REGOFF (THREAD_SIZE-TRACEREG_SZ-STACKFRAME_SZ)
19#define ETRAP_PSTATE1 (PSTATE_RMO | PSTATE_PRIV) 19#define ETRAP_PSTATE1 (PSTATE_TSO | PSTATE_PRIV)
20#define ETRAP_PSTATE2 \ 20#define ETRAP_PSTATE2 \
21 (PSTATE_RMO | PSTATE_PEF | PSTATE_PRIV | PSTATE_IE) 21 (PSTATE_TSO | PSTATE_PEF | PSTATE_PRIV | PSTATE_IE)
22 22
23/* 23/*
24 * On entry, %g7 is return address - 0x4. 24 * On entry, %g7 is return address - 0x4.
@@ -130,7 +130,7 @@ etrap_save: save %g2, -STACK_BIAS, %sp
130 stx %g6, [%sp + PTREGS_OFF + PT_V9_G6] 130 stx %g6, [%sp + PTREGS_OFF + PT_V9_G6]
131 stx %g7, [%sp + PTREGS_OFF + PT_V9_G7] 131 stx %g7, [%sp + PTREGS_OFF + PT_V9_G7]
132 or %l7, %l0, %l7 132 or %l7, %l0, %l7
133 sethi %hi(TSTATE_RMO | TSTATE_PEF), %l0 133 sethi %hi(TSTATE_TSO | TSTATE_PEF), %l0
134 or %l7, %l0, %l7 134 or %l7, %l0, %l7
135 wrpr %l2, %tnpc 135 wrpr %l2, %tnpc
136 wrpr %l7, (TSTATE_PRIV | TSTATE_IE), %tstate 136 wrpr %l7, (TSTATE_PRIV | TSTATE_IE), %tstate
diff --git a/arch/sparc64/kernel/fpu_traps.S b/arch/sparc/kernel/fpu_traps.S
index a6864826a4bd..a6864826a4bd 100644
--- a/arch/sparc64/kernel/fpu_traps.S
+++ b/arch/sparc/kernel/fpu_traps.S
diff --git a/arch/sparc64/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c
index d0218e73f982..d0218e73f982 100644
--- a/arch/sparc64/kernel/ftrace.c
+++ b/arch/sparc/kernel/ftrace.c
diff --git a/arch/sparc64/kernel/getsetcc.S b/arch/sparc/kernel/getsetcc.S
index a14d272d2061..a14d272d2061 100644
--- a/arch/sparc64/kernel/getsetcc.S
+++ b/arch/sparc/kernel/getsetcc.S
diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head_32.S
index 51b40426f9c6..f0b4b516304f 100644
--- a/arch/sparc/kernel/head.S
+++ b/arch/sparc/kernel/head_32.S
@@ -990,7 +990,7 @@ sun4c_continue_boot:
990 990
991 /* Zero out our BSS section. */ 991 /* Zero out our BSS section. */
992 set __bss_start , %o0 ! First address of BSS 992 set __bss_start , %o0 ! First address of BSS
993 set end , %o1 ! Last address of BSS 993 set _end , %o1 ! Last address of BSS
994 add %o0, 0x1, %o0 994 add %o0, 0x1, %o0
9951: 9951:
996 stb %g0, [%o0] 996 stb %g0, [%o0]
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc/kernel/head_64.S
index 353226fa0239..8ffee714f932 100644
--- a/arch/sparc64/kernel/head.S
+++ b/arch/sparc/kernel/head_64.S
@@ -706,7 +706,7 @@ setup_trap_table:
706 andn %l0, PSTATE_IE, %o1 706 andn %l0, PSTATE_IE, %o1
707 wrpr %o1, 0x0, %pstate 707 wrpr %o1, 0x0, %pstate
708 rdpr %pil, %l1 708 rdpr %pil, %l1
709 wrpr %g0, 15, %pil 709 wrpr %g0, PIL_NORMAL_MAX, %pil
710 710
711 /* Make the firmware call to jump over to the Linux trap table. */ 711 /* Make the firmware call to jump over to the Linux trap table. */
712 sethi %hi(is_sun4v), %o0 712 sethi %hi(is_sun4v), %o0
@@ -825,8 +825,8 @@ setup_tba:
825 restore 825 restore
826sparc64_boot_end: 826sparc64_boot_end:
827 827
828#include "etrap.S" 828#include "etrap_64.S"
829#include "rtrap.S" 829#include "rtrap_64.S"
830#include "winfixup.S" 830#include "winfixup.S"
831#include "fpu_traps.S" 831#include "fpu_traps.S"
832#include "ivec.S" 832#include "ivec.S"
@@ -882,7 +882,7 @@ swapper_4m_tsb:
882 882
883! 0x0000000000428000 883! 0x0000000000428000
884 884
885#include "systbls.S" 885#include "systbls_64.S"
886 886
887 .data 887 .data
888 .align 8 888 .align 8
diff --git a/arch/sparc64/kernel/helpers.S b/arch/sparc/kernel/helpers.S
index 314dd0c9fc5b..314dd0c9fc5b 100644
--- a/arch/sparc64/kernel/helpers.S
+++ b/arch/sparc/kernel/helpers.S
diff --git a/arch/sparc64/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c
index 1d272c3b5740..1d272c3b5740 100644
--- a/arch/sparc64/kernel/hvapi.c
+++ b/arch/sparc/kernel/hvapi.c
diff --git a/arch/sparc64/kernel/hvcalls.S b/arch/sparc/kernel/hvcalls.S
index e066269d1594..8a5f35ffb15e 100644
--- a/arch/sparc64/kernel/hvcalls.S
+++ b/arch/sparc/kernel/hvcalls.S
@@ -766,3 +766,35 @@ ENTRY(sun4v_mmu_demap_all)
766 retl 766 retl
767 nop 767 nop
768ENDPROC(sun4v_mmu_demap_all) 768ENDPROC(sun4v_mmu_demap_all)
769
770ENTRY(sun4v_niagara_getperf)
771 mov %o0, %o4
772 mov HV_FAST_GET_PERFREG, %o5
773 ta HV_FAST_TRAP
774 stx %o1, [%o4]
775 retl
776 nop
777ENDPROC(sun4v_niagara_getperf)
778
779ENTRY(sun4v_niagara_setperf)
780 mov HV_FAST_SET_PERFREG, %o5
781 ta HV_FAST_TRAP
782 retl
783 nop
784ENDPROC(sun4v_niagara_setperf)
785
786ENTRY(sun4v_niagara2_getperf)
787 mov %o0, %o4
788 mov HV_FAST_N2_GET_PERFREG, %o5
789 ta HV_FAST_TRAP
790 stx %o1, [%o4]
791 retl
792 nop
793ENDPROC(sun4v_niagara2_getperf)
794
795ENTRY(sun4v_niagara2_setperf)
796 mov HV_FAST_N2_SET_PERFREG, %o5
797 ta HV_FAST_TRAP
798 retl
799 nop
800ENDPROC(sun4v_niagara2_setperf)
diff --git a/arch/sparc64/kernel/hvtramp.S b/arch/sparc/kernel/hvtramp.S
index 0236c43772fa..9365432904d6 100644
--- a/arch/sparc64/kernel/hvtramp.S
+++ b/arch/sparc/kernel/hvtramp.S
@@ -1,6 +1,6 @@
1/* hvtramp.S: Hypervisor start-cpu trampoline code. 1/* hvtramp.S: Hypervisor start-cpu trampoline code.
2 * 2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2007, 2008 David S. Miller <davem@davemloft.net>
4 */ 4 */
5 5
6#include <linux/init.h> 6#include <linux/init.h>
@@ -14,6 +14,7 @@
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15#include <asm/head.h> 15#include <asm/head.h>
16#include <asm/asi.h> 16#include <asm/asi.h>
17#include <asm/pil.h>
17 18
18 __CPUINIT 19 __CPUINIT
19 .align 8 20 .align 8
@@ -32,7 +33,7 @@
32 */ 33 */
33hv_cpu_startup: 34hv_cpu_startup:
34 SET_GL(0) 35 SET_GL(0)
35 wrpr %g0, 15, %pil 36 wrpr %g0, PIL_NORMAL_MAX, %pil
36 wrpr %g0, 0, %canrestore 37 wrpr %g0, 0, %canrestore
37 wrpr %g0, 0, %otherwin 38 wrpr %g0, 0, %otherwin
38 wrpr %g0, 6, %cansave 39 wrpr %g0, 6, %cansave
diff --git a/arch/sparc/kernel/idprom.c b/arch/sparc/kernel/idprom.c
index 223a6582e1e2..c16135e0c151 100644
--- a/arch/sparc/kernel/idprom.c
+++ b/arch/sparc/kernel/idprom.c
@@ -11,35 +11,37 @@
11 11
12#include <asm/oplib.h> 12#include <asm/oplib.h>
13#include <asm/idprom.h> 13#include <asm/idprom.h>
14#include <asm/machines.h> /* Fun with Sun released architectures. */
15 14
16struct idprom *idprom; 15struct idprom *idprom;
17static struct idprom idprom_buffer; 16static struct idprom idprom_buffer;
18 17
18#ifdef CONFIG_SPARC32
19#include <asm/machines.h> /* Fun with Sun released architectures. */
20
19/* Here is the master table of Sun machines which use some implementation 21/* Here is the master table of Sun machines which use some implementation
20 * of the Sparc CPU and have a meaningful IDPROM machtype value that we 22 * of the Sparc CPU and have a meaningful IDPROM machtype value that we
21 * know about. See asm-sparc/machines.h for empirical constants. 23 * know about. See asm-sparc/machines.h for empirical constants.
22 */ 24 */
23static struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = { 25static struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = {
24/* First, Sun4's */ 26/* First, Sun4's */
25{ "Sun 4/100 Series", (SM_SUN4 | SM_4_110) }, 27{ .name = "Sun 4/100 Series", .id_machtype = (SM_SUN4 | SM_4_110) },
26{ "Sun 4/200 Series", (SM_SUN4 | SM_4_260) }, 28{ .name = "Sun 4/200 Series", .id_machtype = (SM_SUN4 | SM_4_260) },
27{ "Sun 4/300 Series", (SM_SUN4 | SM_4_330) }, 29{ .name = "Sun 4/300 Series", .id_machtype = (SM_SUN4 | SM_4_330) },
28{ "Sun 4/400 Series", (SM_SUN4 | SM_4_470) }, 30{ .name = "Sun 4/400 Series", .id_machtype = (SM_SUN4 | SM_4_470) },
29/* Now, Sun4c's */ 31/* Now, Sun4c's */
30{ "Sun4c SparcStation 1", (SM_SUN4C | SM_4C_SS1) }, 32{ .name = "Sun4c SparcStation 1", .id_machtype = (SM_SUN4C | SM_4C_SS1) },
31{ "Sun4c SparcStation IPC", (SM_SUN4C | SM_4C_IPC) }, 33{ .name = "Sun4c SparcStation IPC", .id_machtype = (SM_SUN4C | SM_4C_IPC) },
32{ "Sun4c SparcStation 1+", (SM_SUN4C | SM_4C_SS1PLUS) }, 34{ .name = "Sun4c SparcStation 1+", .id_machtype = (SM_SUN4C | SM_4C_SS1PLUS) },
33{ "Sun4c SparcStation SLC", (SM_SUN4C | SM_4C_SLC) }, 35{ .name = "Sun4c SparcStation SLC", .id_machtype = (SM_SUN4C | SM_4C_SLC) },
34{ "Sun4c SparcStation 2", (SM_SUN4C | SM_4C_SS2) }, 36{ .name = "Sun4c SparcStation 2", .id_machtype = (SM_SUN4C | SM_4C_SS2) },
35{ "Sun4c SparcStation ELC", (SM_SUN4C | SM_4C_ELC) }, 37{ .name = "Sun4c SparcStation ELC", .id_machtype = (SM_SUN4C | SM_4C_ELC) },
36{ "Sun4c SparcStation IPX", (SM_SUN4C | SM_4C_IPX) }, 38{ .name = "Sun4c SparcStation IPX", .id_machtype = (SM_SUN4C | SM_4C_IPX) },
37/* Finally, early Sun4m's */ 39/* Finally, early Sun4m's */
38{ "Sun4m SparcSystem600", (SM_SUN4M | SM_4M_SS60) }, 40{ .name = "Sun4m SparcSystem600", .id_machtype = (SM_SUN4M | SM_4M_SS60) },
39{ "Sun4m SparcStation10/20", (SM_SUN4M | SM_4M_SS50) }, 41{ .name = "Sun4m SparcStation10/20", .id_machtype = (SM_SUN4M | SM_4M_SS50) },
40{ "Sun4m SparcStation5", (SM_SUN4M | SM_4M_SS40) }, 42{ .name = "Sun4m SparcStation5", .id_machtype = (SM_SUN4M | SM_4M_SS40) },
41/* One entry for the OBP arch's which are sun4d, sun4e, and newer sun4m's */ 43/* One entry for the OBP arch's which are sun4d, sun4e, and newer sun4m's */
42{ "Sun4M OBP based system", (SM_SUN4M_OBP | 0x0) } }; 44{ .name = "Sun4M OBP based system", .id_machtype = (SM_SUN4M_OBP | 0x0) } };
43 45
44static void __init display_system_type(unsigned char machtype) 46static void __init display_system_type(unsigned char machtype)
45{ 47{
@@ -47,21 +49,25 @@ static void __init display_system_type(unsigned char machtype)
47 register int i; 49 register int i;
48 50
49 for (i = 0; i < NUM_SUN_MACHINES; i++) { 51 for (i = 0; i < NUM_SUN_MACHINES; i++) {
50 if(Sun_Machines[i].id_machtype == machtype) { 52 if (Sun_Machines[i].id_machtype == machtype) {
51 if (machtype != (SM_SUN4M_OBP | 0x00) || 53 if (machtype != (SM_SUN4M_OBP | 0x00) ||
52 prom_getproperty(prom_root_node, "banner-name", 54 prom_getproperty(prom_root_node, "banner-name",
53 sysname, sizeof(sysname)) <= 0) 55 sysname, sizeof(sysname)) <= 0)
54 printk("TYPE: %s\n", Sun_Machines[i].name); 56 printk(KERN_WARNING "TYPE: %s\n",
57 Sun_Machines[i].name);
55 else 58 else
56 printk("TYPE: %s\n", sysname); 59 printk(KERN_WARNING "TYPE: %s\n", sysname);
57 return; 60 return;
58 } 61 }
59 } 62 }
60 63
61 prom_printf("IDPROM: Bogus id_machtype value, 0x%x\n", machtype); 64 prom_printf("IDPROM: Warning, bogus id_machtype value, 0x%x\n", machtype);
62 prom_halt();
63} 65}
64 66#else
67static void __init display_system_type(unsigned char machtype)
68{
69}
70#endif
65/* Calculate the IDPROM checksum (xor of the data bytes). */ 71/* Calculate the IDPROM checksum (xor of the data bytes). */
66static unsigned char __init calc_idprom_cksum(struct idprom *idprom) 72static unsigned char __init calc_idprom_cksum(struct idprom *idprom)
67{ 73{
@@ -80,21 +86,14 @@ void __init idprom_init(void)
80 86
81 idprom = &idprom_buffer; 87 idprom = &idprom_buffer;
82 88
83 if (idprom->id_format != 0x01) { 89 if (idprom->id_format != 0x01)
84 prom_printf("IDPROM: Unknown format type!\n"); 90 prom_printf("IDPROM: Warning, unknown format type!\n");
85 prom_halt();
86 }
87 91
88 if (idprom->id_cksum != calc_idprom_cksum(idprom)) { 92 if (idprom->id_cksum != calc_idprom_cksum(idprom))
89 prom_printf("IDPROM: Checksum failure (nvram=%x, calc=%x)!\n", 93 prom_printf("IDPROM: Warning, checksum failure (nvram=%x, calc=%x)!\n",
90 idprom->id_cksum, calc_idprom_cksum(idprom)); 94 idprom->id_cksum, calc_idprom_cksum(idprom));
91 prom_halt();
92 }
93 95
94 display_system_type(idprom->id_machtype); 96 display_system_type(idprom->id_machtype);
95 97
96 printk("Ethernet address: %x:%x:%x:%x:%x:%x\n", 98 printk(KERN_WARNING "Ethernet address: %pM\n", idprom->id_ethaddr);
97 idprom->id_ethaddr[0], idprom->id_ethaddr[1],
98 idprom->id_ethaddr[2], idprom->id_ethaddr[3],
99 idprom->id_ethaddr[4], idprom->id_ethaddr[5]);
100} 99}
diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c
index 8e64ebc445ef..62126e4cec54 100644
--- a/arch/sparc/kernel/init_task.c
+++ b/arch/sparc/kernel/init_task.c
@@ -23,6 +23,5 @@ EXPORT_SYMBOL(init_task);
23 * in etrap.S which assumes it. 23 * in etrap.S which assumes it.
24 */ 24 */
25union thread_union init_thread_union 25union thread_union init_thread_union
26 __attribute__((section (".text\"\n\t#"))) 26 __attribute__((section (".data.init_task")))
27 __attribute__((aligned (THREAD_SIZE)))
28 = { INIT_THREAD_INFO(init_task) }; 27 = { INIT_THREAD_INFO(init_task) };
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 1cc1995531e2..1cc1995531e2 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
diff --git a/arch/sparc64/kernel/iommu_common.h b/arch/sparc/kernel/iommu_common.h
index 591f5879039c..591f5879039c 100644
--- a/arch/sparc64/kernel/iommu_common.h
+++ b/arch/sparc/kernel/iommu_common.h
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 4f025b36934b..7ce14f05eb48 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -552,8 +552,8 @@ int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sgl, int nents,
552 /* IIep is write-through, not flushing. */ 552 /* IIep is write-through, not flushing. */
553 for_each_sg(sgl, sg, nents, n) { 553 for_each_sg(sgl, sg, nents, n) {
554 BUG_ON(page_address(sg_page(sg)) == NULL); 554 BUG_ON(page_address(sg_page(sg)) == NULL);
555 sg->dvma_address = virt_to_phys(sg_virt(sg)); 555 sg->dma_address = virt_to_phys(sg_virt(sg));
556 sg->dvma_length = sg->length; 556 sg->dma_length = sg->length;
557 } 557 }
558 return nents; 558 return nents;
559} 559}
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq_32.c
index 93e1d1c65290..f3488c45d57a 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -46,6 +46,7 @@
46#include <asm/cacheflush.h> 46#include <asm/cacheflush.h>
47#include <asm/irq_regs.h> 47#include <asm/irq_regs.h>
48 48
49#include "kernel.h"
49#include "irq.h" 50#include "irq.h"
50 51
51#ifdef CONFIG_SMP 52#ifdef CONFIG_SMP
@@ -592,19 +593,19 @@ EXPORT_SYMBOL(request_irq);
592 593
593void disable_irq_nosync(unsigned int irq) 594void disable_irq_nosync(unsigned int irq)
594{ 595{
595 return __disable_irq(irq); 596 __disable_irq(irq);
596} 597}
597EXPORT_SYMBOL(disable_irq_nosync); 598EXPORT_SYMBOL(disable_irq_nosync);
598 599
599void disable_irq(unsigned int irq) 600void disable_irq(unsigned int irq)
600{ 601{
601 return __disable_irq(irq); 602 __disable_irq(irq);
602} 603}
603EXPORT_SYMBOL(disable_irq); 604EXPORT_SYMBOL(disable_irq);
604 605
605void enable_irq(unsigned int irq) 606void enable_irq(unsigned int irq)
606{ 607{
607 return __enable_irq(irq); 608 __enable_irq(irq);
608} 609}
609 610
610EXPORT_SYMBOL(enable_irq); 611EXPORT_SYMBOL(enable_irq);
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc/kernel/irq_64.c
index 52fc836f464d..a3ea2bcb95de 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -775,6 +775,69 @@ void do_softirq(void)
775 local_irq_restore(flags); 775 local_irq_restore(flags);
776} 776}
777 777
778static void unhandled_perf_irq(struct pt_regs *regs)
779{
780 unsigned long pcr, pic;
781
782 read_pcr(pcr);
783 read_pic(pic);
784
785 write_pcr(0);
786
787 printk(KERN_EMERG "CPU %d: Got unexpected perf counter IRQ.\n",
788 smp_processor_id());
789 printk(KERN_EMERG "CPU %d: PCR[%016lx] PIC[%016lx]\n",
790 smp_processor_id(), pcr, pic);
791}
792
793/* Almost a direct copy of the powerpc PMC code. */
794static DEFINE_SPINLOCK(perf_irq_lock);
795static void *perf_irq_owner_caller; /* mostly for debugging */
796static void (*perf_irq)(struct pt_regs *regs) = unhandled_perf_irq;
797
798/* Invoked from level 15 PIL handler in trap table. */
799void perfctr_irq(int irq, struct pt_regs *regs)
800{
801 clear_softint(1 << irq);
802 perf_irq(regs);
803}
804
805int register_perfctr_intr(void (*handler)(struct pt_regs *))
806{
807 int ret;
808
809 if (!handler)
810 return -EINVAL;
811
812 spin_lock(&perf_irq_lock);
813 if (perf_irq != unhandled_perf_irq) {
814 printk(KERN_WARNING "register_perfctr_intr: "
815 "perf IRQ busy (reserved by caller %p)\n",
816 perf_irq_owner_caller);
817 ret = -EBUSY;
818 goto out;
819 }
820
821 perf_irq_owner_caller = __builtin_return_address(0);
822 perf_irq = handler;
823
824 ret = 0;
825out:
826 spin_unlock(&perf_irq_lock);
827
828 return ret;
829}
830EXPORT_SYMBOL_GPL(register_perfctr_intr);
831
832void release_perfctr_intr(void (*handler)(struct pt_regs *))
833{
834 spin_lock(&perf_irq_lock);
835 perf_irq_owner_caller = NULL;
836 perf_irq = unhandled_perf_irq;
837 spin_unlock(&perf_irq_lock);
838}
839EXPORT_SYMBOL_GPL(release_perfctr_intr);
840
778#ifdef CONFIG_HOTPLUG_CPU 841#ifdef CONFIG_HOTPLUG_CPU
779void fixup_irqs(void) 842void fixup_irqs(void)
780{ 843{
diff --git a/arch/sparc64/kernel/itlb_miss.S b/arch/sparc/kernel/itlb_miss.S
index 5a8377b54955..5a8377b54955 100644
--- a/arch/sparc64/kernel/itlb_miss.S
+++ b/arch/sparc/kernel/itlb_miss.S
diff --git a/arch/sparc64/kernel/ivec.S b/arch/sparc/kernel/ivec.S
index d29f92ebca5e..d29f92ebca5e 100644
--- a/arch/sparc64/kernel/ivec.S
+++ b/arch/sparc/kernel/ivec.S
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
new file mode 100644
index 000000000000..81a972e8d8ea
--- /dev/null
+++ b/arch/sparc/kernel/kernel.h
@@ -0,0 +1,31 @@
1#ifndef __SPARC_KERNEL_H
2#define __SPARC_KERNEL_H
3
4#include <linux/interrupt.h>
5
6/* cpu.c */
7extern const char *sparc_cpu_type;
8extern const char *sparc_fpu_type;
9
10extern unsigned int fsr_storage;
11
12#ifdef CONFIG_SPARC32
13/* cpu.c */
14extern void cpu_probe(void);
15
16/* traps_32.c */
17extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc,
18 unsigned long npc, unsigned long psr);
19/* muldiv.c */
20extern int do_user_muldiv (struct pt_regs *, unsigned long);
21
22/* irq_32.c */
23extern struct irqaction static_irqaction[];
24extern int static_irq_count;
25extern spinlock_t irq_action_lock;
26
27extern void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs);
28
29#else /* CONFIG_SPARC32 */
30#endif /* CONFIG_SPARC32 */
31#endif /* !(__SPARC_KERNEL_H) */
diff --git a/arch/sparc/kernel/kgdb.c b/arch/sparc/kernel/kgdb_32.c
index 757805ce02ee..757805ce02ee 100644
--- a/arch/sparc/kernel/kgdb.c
+++ b/arch/sparc/kernel/kgdb_32.c
diff --git a/arch/sparc64/kernel/kgdb.c b/arch/sparc/kernel/kgdb_64.c
index fefbe6dc51be..fefbe6dc51be 100644
--- a/arch/sparc64/kernel/kgdb.c
+++ b/arch/sparc/kernel/kgdb_64.c
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 201a6e547e4a..201a6e547e4a 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
diff --git a/arch/sparc64/kernel/kstack.h b/arch/sparc/kernel/kstack.h
index 4248d969272f..4248d969272f 100644
--- a/arch/sparc64/kernel/kstack.h
+++ b/arch/sparc/kernel/kstack.h
diff --git a/arch/sparc64/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S
index cef8defcd7a9..cef8defcd7a9 100644
--- a/arch/sparc64/kernel/ktlb.S
+++ b/arch/sparc/kernel/ktlb.S
diff --git a/arch/sparc64/kernel/ldc.c b/arch/sparc/kernel/ldc.c
index d68982330f66..d68982330f66 100644
--- a/arch/sparc64/kernel/ldc.c
+++ b/arch/sparc/kernel/ldc.c
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index dde52bcf5c64..3c539a6d7c18 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -11,6 +11,7 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/miscdevice.h> 12#include <linux/miscdevice.h>
13 13
14#include <asm/cpudata.h>
14#include <asm/hypervisor.h> 15#include <asm/hypervisor.h>
15#include <asm/mdesc.h> 16#include <asm/mdesc.h>
16#include <asm/prom.h> 17#include <asm/prom.h>
diff --git a/arch/sparc64/kernel/misctrap.S b/arch/sparc/kernel/misctrap.S
index 753b4f031bfb..753b4f031bfb 100644
--- a/arch/sparc64/kernel/misctrap.S
+++ b/arch/sparc/kernel/misctrap.S
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 598682f31ebf..90273765e81f 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -1,4 +1,4 @@
1/* Kernel module help for sparc32. 1/* Kernel module help for sparc64.
2 * 2 *
3 * Copyright (C) 2001 Rusty Russell. 3 * Copyright (C) 2001 Rusty Russell.
4 * Copyright (C) 2002 David S. Miller. 4 * Copyright (C) 2002 David S. Miller.
@@ -11,6 +11,48 @@
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/ctype.h> 13#include <linux/ctype.h>
14#include <linux/slab.h>
15#include <linux/mm.h>
16
17#include <asm/processor.h>
18#include <asm/spitfire.h>
19
20#ifdef CONFIG_SPARC64
21static void *module_map(unsigned long size)
22{
23 struct vm_struct *area;
24
25 size = PAGE_ALIGN(size);
26 if (!size || size > MODULES_LEN)
27 return NULL;
28
29 area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
30 if (!area)
31 return NULL;
32
33 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
34}
35
36static char *dot2underscore(char *name)
37{
38 return name;
39}
40#else
41static void *module_map(unsigned long size)
42{
43 return vmalloc(size);
44}
45
46/* Replace references to .func with _Func */
47static char *dot2underscore(char *name)
48{
49 if (name[0] == '.') {
50 name[0] = '_';
51 name[1] = toupper(name[1]);
52 }
53 return name;
54}
55#endif /* CONFIG_SPARC64 */
14 56
15void *module_alloc(unsigned long size) 57void *module_alloc(unsigned long size)
16{ 58{
@@ -20,7 +62,7 @@ void *module_alloc(unsigned long size)
20 if (size == 0) 62 if (size == 0)
21 return NULL; 63 return NULL;
22 64
23 ret = vmalloc(size); 65 ret = module_map(size);
24 if (!ret) 66 if (!ret)
25 ret = ERR_PTR(-ENOMEM); 67 ret = ERR_PTR(-ENOMEM);
26 else 68 else
@@ -37,16 +79,14 @@ void module_free(struct module *mod, void *module_region)
37 table entries. */ 79 table entries. */
38} 80}
39 81
40/* Make generic code ignore STT_REGISTER dummy undefined symbols, 82/* Make generic code ignore STT_REGISTER dummy undefined symbols. */
41 * and replace references to .func with _Func
42 */
43int module_frob_arch_sections(Elf_Ehdr *hdr, 83int module_frob_arch_sections(Elf_Ehdr *hdr,
44 Elf_Shdr *sechdrs, 84 Elf_Shdr *sechdrs,
45 char *secstrings, 85 char *secstrings,
46 struct module *mod) 86 struct module *mod)
47{ 87{
48 unsigned int symidx; 88 unsigned int symidx;
49 Elf32_Sym *sym; 89 Elf_Sym *sym;
50 char *strtab; 90 char *strtab;
51 int i; 91 int i;
52 92
@@ -56,26 +96,23 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
56 return -ENOEXEC; 96 return -ENOEXEC;
57 } 97 }
58 } 98 }
59 sym = (Elf32_Sym *)sechdrs[symidx].sh_addr; 99 sym = (Elf_Sym *)sechdrs[symidx].sh_addr;
60 strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr; 100 strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr;
61 101
62 for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { 102 for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) {
63 if (sym[i].st_shndx == SHN_UNDEF) { 103 if (sym[i].st_shndx == SHN_UNDEF) {
64 if (ELF32_ST_TYPE(sym[i].st_info) == STT_REGISTER) 104 if (ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER) {
65 sym[i].st_shndx = SHN_ABS; 105 sym[i].st_shndx = SHN_ABS;
66 else { 106 } else {
67 char *name = strtab + sym[i].st_name; 107 char *name = strtab + sym[i].st_name;
68 if (name[0] == '.') { 108 dot2underscore(name);
69 name[0] = '_';
70 name[1] = toupper(name[1]);
71 }
72 } 109 }
73 } 110 }
74 } 111 }
75 return 0; 112 return 0;
76} 113}
77 114
78int apply_relocate(Elf32_Shdr *sechdrs, 115int apply_relocate(Elf_Shdr *sechdrs,
79 const char *strtab, 116 const char *strtab,
80 unsigned int symindex, 117 unsigned int symindex,
81 unsigned int relsec, 118 unsigned int relsec,
@@ -86,32 +123,68 @@ int apply_relocate(Elf32_Shdr *sechdrs,
86 return -ENOEXEC; 123 return -ENOEXEC;
87} 124}
88 125
89int apply_relocate_add(Elf32_Shdr *sechdrs, 126int apply_relocate_add(Elf_Shdr *sechdrs,
90 const char *strtab, 127 const char *strtab,
91 unsigned int symindex, 128 unsigned int symindex,
92 unsigned int relsec, 129 unsigned int relsec,
93 struct module *me) 130 struct module *me)
94{ 131{
95 unsigned int i; 132 unsigned int i;
96 Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; 133 Elf_Rela *rel = (void *)sechdrs[relsec].sh_addr;
97 Elf32_Sym *sym; 134 Elf_Sym *sym;
98 u8 *location; 135 u8 *location;
99 u32 *loc32; 136 u32 *loc32;
100 137
101 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { 138 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
102 Elf32_Addr v; 139 Elf_Addr v;
103 140
104 /* This is where to make the change */ 141 /* This is where to make the change */
105 location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr 142 location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr
106 + rel[i].r_offset; 143 + rel[i].r_offset;
107 loc32 = (u32 *) location; 144 loc32 = (u32 *) location;
145
146#ifdef CONFIG_SPARC64
147 BUG_ON(((u64)location >> (u64)32) != (u64)0);
148#endif /* CONFIG_SPARC64 */
149
108 /* This is the symbol it is referring to. Note that all 150 /* This is the symbol it is referring to. Note that all
109 undefined symbols have been resolved. */ 151 undefined symbols have been resolved. */
110 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr 152 sym = (Elf_Sym *)sechdrs[symindex].sh_addr
111 + ELF32_R_SYM(rel[i].r_info); 153 + ELF_R_SYM(rel[i].r_info);
112 v = sym->st_value + rel[i].r_addend; 154 v = sym->st_value + rel[i].r_addend;
113 155
114 switch (ELF32_R_TYPE(rel[i].r_info)) { 156 switch (ELF_R_TYPE(rel[i].r_info) & 0xff) {
157#ifdef CONFIG_SPARC64
158 case R_SPARC_64:
159 location[0] = v >> 56;
160 location[1] = v >> 48;
161 location[2] = v >> 40;
162 location[3] = v >> 32;
163 location[4] = v >> 24;
164 location[5] = v >> 16;
165 location[6] = v >> 8;
166 location[7] = v >> 0;
167 break;
168
169 case R_SPARC_DISP32:
170 v -= (Elf_Addr) location;
171 *loc32 = v;
172 break;
173
174 case R_SPARC_WDISP19:
175 v -= (Elf_Addr) location;
176 *loc32 = (*loc32 & ~0x7ffff) |
177 ((v >> 2) & 0x7ffff);
178 break;
179
180 case R_SPARC_OLO10:
181 *loc32 = (*loc32 & ~0x1fff) |
182 (((v & 0x3ff) +
183 (ELF_R_TYPE(rel[i].r_info) >> 8))
184 & 0x1fff);
185 break;
186#endif /* CONFIG_SPARC64 */
187
115 case R_SPARC_32: 188 case R_SPARC_32:
116 case R_SPARC_UA32: 189 case R_SPARC_UA32:
117 location[0] = v >> 24; 190 location[0] = v >> 24;
@@ -121,13 +194,13 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
121 break; 194 break;
122 195
123 case R_SPARC_WDISP30: 196 case R_SPARC_WDISP30:
124 v -= (Elf32_Addr) location; 197 v -= (Elf_Addr) location;
125 *loc32 = (*loc32 & ~0x3fffffff) | 198 *loc32 = (*loc32 & ~0x3fffffff) |
126 ((v >> 2) & 0x3fffffff); 199 ((v >> 2) & 0x3fffffff);
127 break; 200 break;
128 201
129 case R_SPARC_WDISP22: 202 case R_SPARC_WDISP22:
130 v -= (Elf32_Addr) location; 203 v -= (Elf_Addr) location;
131 *loc32 = (*loc32 & ~0x3fffff) | 204 *loc32 = (*loc32 & ~0x3fffff) |
132 ((v >> 2) & 0x3fffff); 205 ((v >> 2) & 0x3fffff);
133 break; 206 break;
@@ -144,19 +217,38 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
144 default: 217 default:
145 printk(KERN_ERR "module %s: Unknown relocation: %x\n", 218 printk(KERN_ERR "module %s: Unknown relocation: %x\n",
146 me->name, 219 me->name,
147 (int) (ELF32_R_TYPE(rel[i].r_info) & 0xff)); 220 (int) (ELF_R_TYPE(rel[i].r_info) & 0xff));
148 return -ENOEXEC; 221 return -ENOEXEC;
149 }; 222 };
150 } 223 }
151 return 0; 224 return 0;
152} 225}
153 226
227#ifdef CONFIG_SPARC64
154int module_finalize(const Elf_Ehdr *hdr, 228int module_finalize(const Elf_Ehdr *hdr,
155 const Elf_Shdr *sechdrs, 229 const Elf_Shdr *sechdrs,
156 struct module *me) 230 struct module *me)
157{ 231{
232 /* Cheetah's I-cache is fully coherent. */
233 if (tlb_type == spitfire) {
234 unsigned long va;
235
236 flushw_all();
237 for (va = 0; va < (PAGE_SIZE << 1); va += 32)
238 spitfire_put_icache_tag(va, 0x0);
239 __asm__ __volatile__("flush %g6");
240 }
241
158 return 0; 242 return 0;
159} 243}
244#else
245int module_finalize(const Elf_Ehdr *hdr,
246 const Elf_Shdr *sechdrs,
247 struct module *me)
248{
249 return 0;
250}
251#endif /* CONFIG_SPARC64 */
160 252
161void module_arch_cleanup(struct module *mod) 253void module_arch_cleanup(struct module *mod)
162{ 254{
diff --git a/arch/sparc/kernel/muldiv.c b/arch/sparc/kernel/muldiv.c
index e352239e72c8..ba960c02bb55 100644
--- a/arch/sparc/kernel/muldiv.c
+++ b/arch/sparc/kernel/muldiv.c
@@ -17,6 +17,8 @@
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19 19
20#include "kernel.h"
21
20/* #define DEBUG_MULDIV */ 22/* #define DEBUG_MULDIV */
21 23
22static inline int has_imm13(int insn) 24static inline int has_imm13(int insn)
@@ -88,9 +90,6 @@ store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
88 return (put_user(result, &win->locals[reg - 16])); 90 return (put_user(result, &win->locals[reg - 16]));
89 } 91 }
90} 92}
91
92extern void handle_hw_divzero (struct pt_regs *regs, unsigned long pc,
93 unsigned long npc, unsigned long psr);
94 93
95/* Should return 0 if mul/div emulation succeeded and SIGILL should 94/* Should return 0 if mul/div emulation succeeded and SIGILL should
96 * not be issued. 95 * not be issued.
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device_32.c
index 0a83bd737654..0a83bd737654 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device_32.c
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc/kernel/of_device_64.c
index 0f616ae3246c..46e231f7c5ce 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -811,20 +811,20 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
811 811
812 irq = of_get_property(dp, "interrupts", &len); 812 irq = of_get_property(dp, "interrupts", &len);
813 if (irq) { 813 if (irq) {
814 memcpy(op->irqs, irq, len);
815 op->num_irqs = len / 4; 814 op->num_irqs = len / 4;
815
816 /* Prevent overrunning the op->irqs[] array. */
817 if (op->num_irqs > PROMINTR_MAX) {
818 printk(KERN_WARNING "%s: Too many irqs (%d), "
819 "limiting to %d.\n",
820 dp->full_name, op->num_irqs, PROMINTR_MAX);
821 op->num_irqs = PROMINTR_MAX;
822 }
823 memcpy(op->irqs, irq, op->num_irqs * 4);
816 } else { 824 } else {
817 op->num_irqs = 0; 825 op->num_irqs = 0;
818 } 826 }
819 827
820 /* Prevent overrunning the op->irqs[] array. */
821 if (op->num_irqs > PROMINTR_MAX) {
822 printk(KERN_WARNING "%s: Too many irqs (%d), "
823 "limiting to %d.\n",
824 dp->full_name, op->num_irqs, PROMINTR_MAX);
825 op->num_irqs = PROMINTR_MAX;
826 }
827
828 build_device_resources(op, parent); 828 build_device_resources(op, parent);
829 for (i = 0; i < op->num_irqs; i++) 829 for (i = 0; i < op->num_irqs; i++)
830 op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]); 830 op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]);
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc/kernel/pci.c
index bdb7c0a6d83d..bdb7c0a6d83d 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
index 23b88082d0b2..23b88082d0b2 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc/kernel/pci_common.c
diff --git a/arch/sparc64/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index 9462b68f4894..9462b68f4894 100644
--- a/arch/sparc64/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
diff --git a/arch/sparc64/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 03186824327e..03186824327e 100644
--- a/arch/sparc64/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
diff --git a/arch/sparc64/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c
index 2e680f34f727..2e680f34f727 100644
--- a/arch/sparc64/kernel/pci_msi.c
+++ b/arch/sparc/kernel/pci_msi.c
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index dfb3ec892987..dfb3ec892987 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 713257b6963c..713257b6963c 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 45d9dba1ba11..45d9dba1ba11 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 34a1fded3941..34a1fded3941 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
diff --git a/arch/sparc64/kernel/pci_sun4v.h b/arch/sparc/kernel/pci_sun4v.h
index 8e9fc3a5b4f5..8e9fc3a5b4f5 100644
--- a/arch/sparc64/kernel/pci_sun4v.h
+++ b/arch/sparc/kernel/pci_sun4v.h
diff --git a/arch/sparc64/kernel/pci_sun4v_asm.S b/arch/sparc/kernel/pci_sun4v_asm.S
index e606d46c6815..e606d46c6815 100644
--- a/arch/sparc64/kernel/pci_sun4v_asm.S
+++ b/arch/sparc/kernel/pci_sun4v_asm.S
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 462584e55fba..75ed98be3edf 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -436,7 +436,7 @@ int pcic_present(void)
436 return pcic0_up; 436 return pcic0_up;
437} 437}
438 438
439static int __init pdev_to_pnode(struct linux_pbm_info *pbm, 439static int __devinit pdev_to_pnode(struct linux_pbm_info *pbm,
440 struct pci_dev *pdev) 440 struct pci_dev *pdev)
441{ 441{
442 struct linux_prom_pci_registers regs[PROMREG_MAX]; 442 struct linux_prom_pci_registers regs[PROMREG_MAX];
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 2afcfab4f11c..5e4563d86f19 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -24,32 +24,32 @@
24 */ 24 */
25 25
26#define PMC_OBPNAME "SUNW,pmc" 26#define PMC_OBPNAME "SUNW,pmc"
27#define PMC_DEVNAME "pmc" 27#define PMC_DEVNAME "pmc"
28 28
29#define PMC_IDLE_REG 0x00 29#define PMC_IDLE_REG 0x00
30#define PMC_IDLE_ON 0x01 30#define PMC_IDLE_ON 0x01
31 31
32static u8 __iomem *regs; 32static u8 __iomem *regs;
33 33
34#define pmc_readb(offs) (sbus_readb(regs+offs)) 34#define pmc_readb(offs) (sbus_readb(regs+offs))
35#define pmc_writeb(val, offs) (sbus_writeb(val, regs+offs)) 35#define pmc_writeb(val, offs) (sbus_writeb(val, regs+offs))
36 36
37/* 37/*
38 * CPU idle callback function 38 * CPU idle callback function
39 * See .../arch/sparc/kernel/process.c 39 * See .../arch/sparc/kernel/process.c
40 */ 40 */
41void pmc_swift_idle(void) 41static void pmc_swift_idle(void)
42{ 42{
43#ifdef PMC_DEBUG_LED 43#ifdef PMC_DEBUG_LED
44 set_auxio(0x00, AUXIO_LED); 44 set_auxio(0x00, AUXIO_LED);
45#endif 45#endif
46 46
47 pmc_writeb(pmc_readb(PMC_IDLE_REG) | PMC_IDLE_ON, PMC_IDLE_REG); 47 pmc_writeb(pmc_readb(PMC_IDLE_REG) | PMC_IDLE_ON, PMC_IDLE_REG);
48 48
49#ifdef PMC_DEBUG_LED 49#ifdef PMC_DEBUG_LED
50 set_auxio(AUXIO_LED, 0x00); 50 set_auxio(AUXIO_LED, 0x00);
51#endif 51#endif
52} 52}
53 53
54static int __devinit pmc_probe(struct of_device *op, 54static int __devinit pmc_probe(struct of_device *op,
55 const struct of_device_id *match) 55 const struct of_device_id *match)
@@ -63,7 +63,7 @@ static int __devinit pmc_probe(struct of_device *op,
63 63
64#ifndef PMC_NO_IDLE 64#ifndef PMC_NO_IDLE
65 /* Assign power management IDLE handler */ 65 /* Assign power management IDLE handler */
66 pm_idle = pmc_swift_idle; 66 pm_idle = pmc_swift_idle;
67#endif 67#endif
68 68
69 printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME); 69 printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME);
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc/kernel/power.c
index 076cad7f9757..076cad7f9757 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc/kernel/power.c
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process_32.c
index e8c43ffe317e..69d9315f4a93 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process_32.c
@@ -168,11 +168,9 @@ void machine_restart(char * cmd)
168 168
169void machine_power_off(void) 169void machine_power_off(void)
170{ 170{
171#ifdef CONFIG_SUN_AUXIO
172 if (auxio_power_register && 171 if (auxio_power_register &&
173 (strcmp(of_console_device->type, "serial") || scons_pwroff)) 172 (strcmp(of_console_device->type, "serial") || scons_pwroff))
174 *auxio_power_register |= AUXIO_POWER_OFF; 173 *auxio_power_register |= AUXIO_POWER_OFF;
175#endif
176 machine_halt(); 174 machine_halt();
177} 175}
178 176
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc/kernel/process_64.c
index d5e2acef9877..d5e2acef9877 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc/kernel/process_64.c
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
new file mode 100644
index 000000000000..bb0f0fda6cab
--- /dev/null
+++ b/arch/sparc/kernel/prom.h
@@ -0,0 +1,29 @@
1#ifndef __PROM_H
2#define __PROM_H
3
4#include <linux/spinlock.h>
5#include <asm/prom.h>
6
7extern struct device_node *allnodes; /* temporary while merging */
8extern rwlock_t devtree_lock; /* temporary while merging */
9
10extern void * prom_early_alloc(unsigned long size);
11extern void irq_trans_init(struct device_node *dp);
12
13extern unsigned int prom_unique_id;
14
15static inline int is_root_node(const struct device_node *dp)
16{
17 if (!dp)
18 return 0;
19
20 return (dp->parent == NULL);
21}
22
23extern char *build_path_component(struct device_node *dp);
24extern void of_console_init(void);
25extern void of_fill_in_cpu_data(void);
26
27extern unsigned int prom_early_allocated;
28
29#endif /* __PROM_H */
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom_32.c
index eee5efcfe50e..fe43e80772db 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom_32.c
@@ -25,107 +25,9 @@
25#include <asm/prom.h> 25#include <asm/prom.h>
26#include <asm/oplib.h> 26#include <asm/oplib.h>
27 27
28extern struct device_node *allnodes; /* temporary while merging */ 28#include "prom.h"
29 29
30extern rwlock_t devtree_lock; /* temporary while merging */ 30void * __init prom_early_alloc(unsigned long size)
31
32struct device_node *of_find_node_by_phandle(phandle handle)
33{
34 struct device_node *np;
35
36 for (np = allnodes; np != 0; np = np->allnext)
37 if (np->node == handle)
38 break;
39
40 return np;
41}
42EXPORT_SYMBOL(of_find_node_by_phandle);
43
44int of_getintprop_default(struct device_node *np, const char *name, int def)
45{
46 struct property *prop;
47 int len;
48
49 prop = of_find_property(np, name, &len);
50 if (!prop || len != 4)
51 return def;
52
53 return *(int *) prop->value;
54}
55EXPORT_SYMBOL(of_getintprop_default);
56
57DEFINE_MUTEX(of_set_property_mutex);
58EXPORT_SYMBOL(of_set_property_mutex);
59
60int of_set_property(struct device_node *dp, const char *name, void *val, int len)
61{
62 struct property **prevp;
63 void *new_val;
64 int err;
65
66 new_val = kmalloc(len, GFP_KERNEL);
67 if (!new_val)
68 return -ENOMEM;
69
70 memcpy(new_val, val, len);
71
72 err = -ENODEV;
73
74 write_lock(&devtree_lock);
75 prevp = &dp->properties;
76 while (*prevp) {
77 struct property *prop = *prevp;
78
79 if (!strcasecmp(prop->name, name)) {
80 void *old_val = prop->value;
81 int ret;
82
83 mutex_lock(&of_set_property_mutex);
84 ret = prom_setprop(dp->node, (char *) name, val, len);
85 mutex_unlock(&of_set_property_mutex);
86
87 err = -EINVAL;
88 if (ret >= 0) {
89 prop->value = new_val;
90 prop->length = len;
91
92 if (OF_IS_DYNAMIC(prop))
93 kfree(old_val);
94
95 OF_MARK_DYNAMIC(prop);
96
97 err = 0;
98 }
99 break;
100 }
101 prevp = &(*prevp)->next;
102 }
103 write_unlock(&devtree_lock);
104
105 /* XXX Upate procfs if necessary... */
106
107 return err;
108}
109EXPORT_SYMBOL(of_set_property);
110
111int of_find_in_proplist(const char *list, const char *match, int len)
112{
113 while (len > 0) {
114 int l;
115
116 if (!strcmp(list, match))
117 return 1;
118 l = strlen(list) + 1;
119 list += l;
120 len -= l;
121 }
122 return 0;
123}
124EXPORT_SYMBOL(of_find_in_proplist);
125
126static unsigned int prom_early_allocated;
127
128static void * __init prom_early_alloc(unsigned long size)
129{ 31{
130 void *ret; 32 void *ret;
131 33
@@ -138,14 +40,6 @@ static void * __init prom_early_alloc(unsigned long size)
138 return ret; 40 return ret;
139} 41}
140 42
141static int is_root_node(const struct device_node *dp)
142{
143 if (!dp)
144 return 0;
145
146 return (dp->parent == NULL);
147}
148
149/* The following routines deal with the black magic of fully naming a 43/* The following routines deal with the black magic of fully naming a
150 * node. 44 * node.
151 * 45 *
@@ -257,7 +151,7 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
257 return sparc32_path_component(dp, tmp_buf); 151 return sparc32_path_component(dp, tmp_buf);
258} 152}
259 153
260static char * __init build_path_component(struct device_node *dp) 154char * __init build_path_component(struct device_node *dp)
261{ 155{
262 char tmp_buf[64], *n; 156 char tmp_buf[64], *n;
263 157
@@ -272,164 +166,9 @@ static char * __init build_path_component(struct device_node *dp)
272 return n; 166 return n;
273} 167}
274 168
275static char * __init build_full_name(struct device_node *dp)
276{
277 int len, ourlen, plen;
278 char *n;
279
280 plen = strlen(dp->parent->full_name);
281 ourlen = strlen(dp->path_component_name);
282 len = ourlen + plen + 2;
283
284 n = prom_early_alloc(len);
285 strcpy(n, dp->parent->full_name);
286 if (!is_root_node(dp->parent)) {
287 strcpy(n + plen, "/");
288 plen++;
289 }
290 strcpy(n + plen, dp->path_component_name);
291
292 return n;
293}
294
295static unsigned int unique_id;
296
297static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len)
298{
299 static struct property *tmp = NULL;
300 struct property *p;
301 int len;
302 const char *name;
303
304 if (tmp) {
305 p = tmp;
306 memset(p, 0, sizeof(*p) + 32);
307 tmp = NULL;
308 } else {
309 p = prom_early_alloc(sizeof(struct property) + 32);
310 p->unique_id = unique_id++;
311 }
312
313 p->name = (char *) (p + 1);
314 if (special_name) {
315 strcpy(p->name, special_name);
316 p->length = special_len;
317 p->value = prom_early_alloc(special_len);
318 memcpy(p->value, special_val, special_len);
319 } else {
320 if (prev == NULL) {
321 name = prom_firstprop(node, NULL);
322 } else {
323 name = prom_nextprop(node, prev, NULL);
324 }
325 if (strlen(name) == 0) {
326 tmp = p;
327 return NULL;
328 }
329 strcpy(p->name, name);
330 p->length = prom_getproplen(node, p->name);
331 if (p->length <= 0) {
332 p->length = 0;
333 } else {
334 p->value = prom_early_alloc(p->length + 1);
335 len = prom_getproperty(node, p->name, p->value,
336 p->length);
337 if (len <= 0)
338 p->length = 0;
339 ((unsigned char *)p->value)[p->length] = '\0';
340 }
341 }
342 return p;
343}
344
345static struct property * __init build_prop_list(phandle node)
346{
347 struct property *head, *tail;
348
349 head = tail = build_one_prop(node, NULL,
350 ".node", &node, sizeof(node));
351
352 tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
353 tail = tail->next;
354 while(tail) {
355 tail->next = build_one_prop(node, tail->name,
356 NULL, NULL, 0);
357 tail = tail->next;
358 }
359
360 return head;
361}
362
363static char * __init get_one_property(phandle node, char *name)
364{
365 char *buf = "<NULL>";
366 int len;
367
368 len = prom_getproplen(node, name);
369 if (len > 0) {
370 buf = prom_early_alloc(len);
371 len = prom_getproperty(node, name, buf, len);
372 }
373
374 return buf;
375}
376
377static struct device_node * __init create_node(phandle node)
378{
379 struct device_node *dp;
380
381 if (!node)
382 return NULL;
383
384 dp = prom_early_alloc(sizeof(*dp));
385 dp->unique_id = unique_id++;
386
387 kref_init(&dp->kref);
388
389 dp->name = get_one_property(node, "name");
390 dp->type = get_one_property(node, "device_type");
391 dp->node = node;
392
393 /* Build interrupts later... */
394
395 dp->properties = build_prop_list(node);
396
397 return dp;
398}
399
400static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp)
401{
402 struct device_node *dp;
403
404 dp = create_node(node);
405 if (dp) {
406 *(*nextp) = dp;
407 *nextp = &dp->allnext;
408
409 dp->parent = parent;
410 dp->path_component_name = build_path_component(dp);
411 dp->full_name = build_full_name(dp);
412
413 dp->child = build_tree(dp, prom_getchild(node), nextp);
414
415 dp->sibling = build_tree(parent, prom_getsibling(node), nextp);
416 }
417
418 return dp;
419}
420
421struct device_node *of_console_device;
422EXPORT_SYMBOL(of_console_device);
423
424char *of_console_path;
425EXPORT_SYMBOL(of_console_path);
426
427char *of_console_options;
428EXPORT_SYMBOL(of_console_options);
429
430extern void restore_current(void); 169extern void restore_current(void);
431 170
432static void __init of_console_init(void) 171void __init of_console_init(void)
433{ 172{
434 char *msg = "OF stdout device is: %s\n"; 173 char *msg = "OF stdout device is: %s\n";
435 struct device_node *dp; 174 struct device_node *dp;
@@ -547,20 +286,10 @@ static void __init of_console_init(void)
547 printk(msg, of_console_path); 286 printk(msg, of_console_path);
548} 287}
549 288
550void __init prom_build_devicetree(void) 289void __init of_fill_in_cpu_data(void)
551{ 290{
552 struct device_node **nextp; 291}
553
554 allnodes = create_node(prom_root_node);
555 allnodes->path_component_name = "";
556 allnodes->full_name = "/";
557
558 nextp = &allnodes->allnext;
559 allnodes->child = build_tree(allnodes,
560 prom_getchild(allnodes->node),
561 &nextp);
562 of_console_init();
563 292
564 printk("PROM: Built device tree with %u bytes of memory.\n", 293void __init irq_trans_init(struct device_node *dp)
565 prom_early_allocated); 294{
566} 295}
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
new file mode 100644
index 000000000000..edecca7b8116
--- /dev/null
+++ b/arch/sparc/kernel/prom_64.c
@@ -0,0 +1,571 @@
1/*
2 * Procedures for creating, accessing and interpreting the device tree.
3 *
4 * Paul Mackerras August 1996.
5 * Copyright (C) 1996-2005 Paul Mackerras.
6 *
7 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
8 * {engebret|bergner}@us.ibm.com
9 *
10 * Adapted for sparc64 by David S. Miller davem@davemloft.net
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/string.h>
21#include <linux/mm.h>
22#include <linux/module.h>
23#include <linux/lmb.h>
24#include <linux/of_device.h>
25
26#include <asm/prom.h>
27#include <asm/oplib.h>
28#include <asm/irq.h>
29#include <asm/asi.h>
30#include <asm/upa.h>
31#include <asm/smp.h>
32
33#include "prom.h"
34
35void * __init prom_early_alloc(unsigned long size)
36{
37 unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES);
38 void *ret;
39
40 if (!paddr) {
41 prom_printf("prom_early_alloc(%lu) failed\n");
42 prom_halt();
43 }
44
45 ret = __va(paddr);
46 memset(ret, 0, size);
47 prom_early_allocated += size;
48
49 return ret;
50}
51
52/* The following routines deal with the black magic of fully naming a
53 * node.
54 *
55 * Certain well known named nodes are just the simple name string.
56 *
57 * Actual devices have an address specifier appended to the base name
58 * string, like this "foo@addr". The "addr" can be in any number of
59 * formats, and the platform plus the type of the node determine the
60 * format and how it is constructed.
61 *
62 * For children of the ROOT node, the naming convention is fixed and
63 * determined by whether this is a sun4u or sun4v system.
64 *
65 * For children of other nodes, it is bus type specific. So
66 * we walk up the tree until we discover a "device_type" property
67 * we recognize and we go from there.
68 *
69 * As an example, the boot device on my workstation has a full path:
70 *
71 * /pci@1e,600000/ide@d/disk@0,0:c
72 */
73static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
74{
75 struct linux_prom64_registers *regs;
76 struct property *rprop;
77 u32 high_bits, low_bits, type;
78
79 rprop = of_find_property(dp, "reg", NULL);
80 if (!rprop)
81 return;
82
83 regs = rprop->value;
84 if (!is_root_node(dp->parent)) {
85 sprintf(tmp_buf, "%s@%x,%x",
86 dp->name,
87 (unsigned int) (regs->phys_addr >> 32UL),
88 (unsigned int) (regs->phys_addr & 0xffffffffUL));
89 return;
90 }
91
92 type = regs->phys_addr >> 60UL;
93 high_bits = (regs->phys_addr >> 32UL) & 0x0fffffffUL;
94 low_bits = (regs->phys_addr & 0xffffffffUL);
95
96 if (type == 0 || type == 8) {
97 const char *prefix = (type == 0) ? "m" : "i";
98
99 if (low_bits)
100 sprintf(tmp_buf, "%s@%s%x,%x",
101 dp->name, prefix,
102 high_bits, low_bits);
103 else
104 sprintf(tmp_buf, "%s@%s%x",
105 dp->name,
106 prefix,
107 high_bits);
108 } else if (type == 12) {
109 sprintf(tmp_buf, "%s@%x",
110 dp->name, high_bits);
111 }
112}
113
114static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
115{
116 struct linux_prom64_registers *regs;
117 struct property *prop;
118
119 prop = of_find_property(dp, "reg", NULL);
120 if (!prop)
121 return;
122
123 regs = prop->value;
124 if (!is_root_node(dp->parent)) {
125 sprintf(tmp_buf, "%s@%x,%x",
126 dp->name,
127 (unsigned int) (regs->phys_addr >> 32UL),
128 (unsigned int) (regs->phys_addr & 0xffffffffUL));
129 return;
130 }
131
132 prop = of_find_property(dp, "upa-portid", NULL);
133 if (!prop)
134 prop = of_find_property(dp, "portid", NULL);
135 if (prop) {
136 unsigned long mask = 0xffffffffUL;
137
138 if (tlb_type >= cheetah)
139 mask = 0x7fffff;
140
141 sprintf(tmp_buf, "%s@%x,%x",
142 dp->name,
143 *(u32 *)prop->value,
144 (unsigned int) (regs->phys_addr & mask));
145 }
146}
147
148/* "name@slot,offset" */
149static void __init sbus_path_component(struct device_node *dp, char *tmp_buf)
150{
151 struct linux_prom_registers *regs;
152 struct property *prop;
153
154 prop = of_find_property(dp, "reg", NULL);
155 if (!prop)
156 return;
157
158 regs = prop->value;
159 sprintf(tmp_buf, "%s@%x,%x",
160 dp->name,
161 regs->which_io,
162 regs->phys_addr);
163}
164
165/* "name@devnum[,func]" */
166static void __init pci_path_component(struct device_node *dp, char *tmp_buf)
167{
168 struct linux_prom_pci_registers *regs;
169 struct property *prop;
170 unsigned int devfn;
171
172 prop = of_find_property(dp, "reg", NULL);
173 if (!prop)
174 return;
175
176 regs = prop->value;
177 devfn = (regs->phys_hi >> 8) & 0xff;
178 if (devfn & 0x07) {
179 sprintf(tmp_buf, "%s@%x,%x",
180 dp->name,
181 devfn >> 3,
182 devfn & 0x07);
183 } else {
184 sprintf(tmp_buf, "%s@%x",
185 dp->name,
186 devfn >> 3);
187 }
188}
189
190/* "name@UPA_PORTID,offset" */
191static void __init upa_path_component(struct device_node *dp, char *tmp_buf)
192{
193 struct linux_prom64_registers *regs;
194 struct property *prop;
195
196 prop = of_find_property(dp, "reg", NULL);
197 if (!prop)
198 return;
199
200 regs = prop->value;
201
202 prop = of_find_property(dp, "upa-portid", NULL);
203 if (!prop)
204 return;
205
206 sprintf(tmp_buf, "%s@%x,%x",
207 dp->name,
208 *(u32 *) prop->value,
209 (unsigned int) (regs->phys_addr & 0xffffffffUL));
210}
211
212/* "name@reg" */
213static void __init vdev_path_component(struct device_node *dp, char *tmp_buf)
214{
215 struct property *prop;
216 u32 *regs;
217
218 prop = of_find_property(dp, "reg", NULL);
219 if (!prop)
220 return;
221
222 regs = prop->value;
223
224 sprintf(tmp_buf, "%s@%x", dp->name, *regs);
225}
226
227/* "name@addrhi,addrlo" */
228static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
229{
230 struct linux_prom64_registers *regs;
231 struct property *prop;
232
233 prop = of_find_property(dp, "reg", NULL);
234 if (!prop)
235 return;
236
237 regs = prop->value;
238
239 sprintf(tmp_buf, "%s@%x,%x",
240 dp->name,
241 (unsigned int) (regs->phys_addr >> 32UL),
242 (unsigned int) (regs->phys_addr & 0xffffffffUL));
243}
244
245/* "name@bus,addr" */
246static void __init i2c_path_component(struct device_node *dp, char *tmp_buf)
247{
248 struct property *prop;
249 u32 *regs;
250
251 prop = of_find_property(dp, "reg", NULL);
252 if (!prop)
253 return;
254
255 regs = prop->value;
256
257 /* This actually isn't right... should look at the #address-cells
258 * property of the i2c bus node etc. etc.
259 */
260 sprintf(tmp_buf, "%s@%x,%x",
261 dp->name, regs[0], regs[1]);
262}
263
264/* "name@reg0[,reg1]" */
265static void __init usb_path_component(struct device_node *dp, char *tmp_buf)
266{
267 struct property *prop;
268 u32 *regs;
269
270 prop = of_find_property(dp, "reg", NULL);
271 if (!prop)
272 return;
273
274 regs = prop->value;
275
276 if (prop->length == sizeof(u32) || regs[1] == 1) {
277 sprintf(tmp_buf, "%s@%x",
278 dp->name, regs[0]);
279 } else {
280 sprintf(tmp_buf, "%s@%x,%x",
281 dp->name, regs[0], regs[1]);
282 }
283}
284
285/* "name@reg0reg1[,reg2reg3]" */
286static void __init ieee1394_path_component(struct device_node *dp, char *tmp_buf)
287{
288 struct property *prop;
289 u32 *regs;
290
291 prop = of_find_property(dp, "reg", NULL);
292 if (!prop)
293 return;
294
295 regs = prop->value;
296
297 if (regs[2] || regs[3]) {
298 sprintf(tmp_buf, "%s@%08x%08x,%04x%08x",
299 dp->name, regs[0], regs[1], regs[2], regs[3]);
300 } else {
301 sprintf(tmp_buf, "%s@%08x%08x",
302 dp->name, regs[0], regs[1]);
303 }
304}
305
306static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
307{
308 struct device_node *parent = dp->parent;
309
310 if (parent != NULL) {
311 if (!strcmp(parent->type, "pci") ||
312 !strcmp(parent->type, "pciex")) {
313 pci_path_component(dp, tmp_buf);
314 return;
315 }
316 if (!strcmp(parent->type, "sbus")) {
317 sbus_path_component(dp, tmp_buf);
318 return;
319 }
320 if (!strcmp(parent->type, "upa")) {
321 upa_path_component(dp, tmp_buf);
322 return;
323 }
324 if (!strcmp(parent->type, "ebus")) {
325 ebus_path_component(dp, tmp_buf);
326 return;
327 }
328 if (!strcmp(parent->name, "usb") ||
329 !strcmp(parent->name, "hub")) {
330 usb_path_component(dp, tmp_buf);
331 return;
332 }
333 if (!strcmp(parent->type, "i2c")) {
334 i2c_path_component(dp, tmp_buf);
335 return;
336 }
337 if (!strcmp(parent->type, "firewire")) {
338 ieee1394_path_component(dp, tmp_buf);
339 return;
340 }
341 if (!strcmp(parent->type, "virtual-devices")) {
342 vdev_path_component(dp, tmp_buf);
343 return;
344 }
345 /* "isa" is handled with platform naming */
346 }
347
348 /* Use platform naming convention. */
349 if (tlb_type == hypervisor) {
350 sun4v_path_component(dp, tmp_buf);
351 return;
352 } else {
353 sun4u_path_component(dp, tmp_buf);
354 }
355}
356
357char * __init build_path_component(struct device_node *dp)
358{
359 char tmp_buf[64], *n;
360
361 tmp_buf[0] = '\0';
362 __build_path_component(dp, tmp_buf);
363 if (tmp_buf[0] == '\0')
364 strcpy(tmp_buf, dp->name);
365
366 n = prom_early_alloc(strlen(tmp_buf) + 1);
367 strcpy(n, tmp_buf);
368
369 return n;
370}
371
372static const char *get_mid_prop(void)
373{
374 return (tlb_type == spitfire ? "upa-portid" : "portid");
375}
376
377struct device_node *of_find_node_by_cpuid(int cpuid)
378{
379 struct device_node *dp;
380 const char *mid_prop = get_mid_prop();
381
382 for_each_node_by_type(dp, "cpu") {
383 int id = of_getintprop_default(dp, mid_prop, -1);
384 const char *this_mid_prop = mid_prop;
385
386 if (id < 0) {
387 this_mid_prop = "cpuid";
388 id = of_getintprop_default(dp, this_mid_prop, -1);
389 }
390
391 if (id < 0) {
392 prom_printf("OF: Serious problem, cpu lacks "
393 "%s property", this_mid_prop);
394 prom_halt();
395 }
396 if (cpuid == id)
397 return dp;
398 }
399 return NULL;
400}
401
402void __init of_fill_in_cpu_data(void)
403{
404 struct device_node *dp;
405 const char *mid_prop;
406
407 if (tlb_type == hypervisor)
408 return;
409
410 mid_prop = get_mid_prop();
411 ncpus_probed = 0;
412 for_each_node_by_type(dp, "cpu") {
413 int cpuid = of_getintprop_default(dp, mid_prop, -1);
414 const char *this_mid_prop = mid_prop;
415 struct device_node *portid_parent;
416 int portid = -1;
417
418 portid_parent = NULL;
419 if (cpuid < 0) {
420 this_mid_prop = "cpuid";
421 cpuid = of_getintprop_default(dp, this_mid_prop, -1);
422 if (cpuid >= 0) {
423 int limit = 2;
424
425 portid_parent = dp;
426 while (limit--) {
427 portid_parent = portid_parent->parent;
428 if (!portid_parent)
429 break;
430 portid = of_getintprop_default(portid_parent,
431 "portid", -1);
432 if (portid >= 0)
433 break;
434 }
435 }
436 }
437
438 if (cpuid < 0) {
439 prom_printf("OF: Serious problem, cpu lacks "
440 "%s property", this_mid_prop);
441 prom_halt();
442 }
443
444 ncpus_probed++;
445
446#ifdef CONFIG_SMP
447 if (cpuid >= NR_CPUS) {
448 printk(KERN_WARNING "Ignoring CPU %d which is "
449 ">= NR_CPUS (%d)\n",
450 cpuid, NR_CPUS);
451 continue;
452 }
453#else
454 /* On uniprocessor we only want the values for the
455 * real physical cpu the kernel booted onto, however
456 * cpu_data() only has one entry at index 0.
457 */
458 if (cpuid != real_hard_smp_processor_id())
459 continue;
460 cpuid = 0;
461#endif
462
463 cpu_data(cpuid).clock_tick =
464 of_getintprop_default(dp, "clock-frequency", 0);
465
466 if (portid_parent) {
467 cpu_data(cpuid).dcache_size =
468 of_getintprop_default(dp, "l1-dcache-size",
469 16 * 1024);
470 cpu_data(cpuid).dcache_line_size =
471 of_getintprop_default(dp, "l1-dcache-line-size",
472 32);
473 cpu_data(cpuid).icache_size =
474 of_getintprop_default(dp, "l1-icache-size",
475 8 * 1024);
476 cpu_data(cpuid).icache_line_size =
477 of_getintprop_default(dp, "l1-icache-line-size",
478 32);
479 cpu_data(cpuid).ecache_size =
480 of_getintprop_default(dp, "l2-cache-size", 0);
481 cpu_data(cpuid).ecache_line_size =
482 of_getintprop_default(dp, "l2-cache-line-size", 0);
483 if (!cpu_data(cpuid).ecache_size ||
484 !cpu_data(cpuid).ecache_line_size) {
485 cpu_data(cpuid).ecache_size =
486 of_getintprop_default(portid_parent,
487 "l2-cache-size",
488 (4 * 1024 * 1024));
489 cpu_data(cpuid).ecache_line_size =
490 of_getintprop_default(portid_parent,
491 "l2-cache-line-size", 64);
492 }
493
494 cpu_data(cpuid).core_id = portid + 1;
495 cpu_data(cpuid).proc_id = portid;
496#ifdef CONFIG_SMP
497 sparc64_multi_core = 1;
498#endif
499 } else {
500 cpu_data(cpuid).dcache_size =
501 of_getintprop_default(dp, "dcache-size", 16 * 1024);
502 cpu_data(cpuid).dcache_line_size =
503 of_getintprop_default(dp, "dcache-line-size", 32);
504
505 cpu_data(cpuid).icache_size =
506 of_getintprop_default(dp, "icache-size", 16 * 1024);
507 cpu_data(cpuid).icache_line_size =
508 of_getintprop_default(dp, "icache-line-size", 32);
509
510 cpu_data(cpuid).ecache_size =
511 of_getintprop_default(dp, "ecache-size",
512 (4 * 1024 * 1024));
513 cpu_data(cpuid).ecache_line_size =
514 of_getintprop_default(dp, "ecache-line-size", 64);
515
516 cpu_data(cpuid).core_id = 0;
517 cpu_data(cpuid).proc_id = -1;
518 }
519
520#ifdef CONFIG_SMP
521 cpu_set(cpuid, cpu_present_map);
522 cpu_set(cpuid, cpu_possible_map);
523#endif
524 }
525
526 smp_fill_in_sib_core_maps();
527}
528
529void __init of_console_init(void)
530{
531 char *msg = "OF stdout device is: %s\n";
532 struct device_node *dp;
533 const char *type;
534 phandle node;
535
536 of_console_path = prom_early_alloc(256);
537 if (prom_ihandle2path(prom_stdout, of_console_path, 256) < 0) {
538 prom_printf("Cannot obtain path of stdout.\n");
539 prom_halt();
540 }
541 of_console_options = strrchr(of_console_path, ':');
542 if (of_console_options) {
543 of_console_options++;
544 if (*of_console_options == '\0')
545 of_console_options = NULL;
546 }
547
548 node = prom_inst2pkg(prom_stdout);
549 if (!node) {
550 prom_printf("Cannot resolve stdout node from "
551 "instance %08x.\n", prom_stdout);
552 prom_halt();
553 }
554
555 dp = of_find_node_by_phandle(node);
556 type = of_get_property(dp, "device_type", NULL);
557 if (!type) {
558 prom_printf("Console stdout lacks device_type property.\n");
559 prom_halt();
560 }
561
562 if (strcmp(type, "display") && strcmp(type, "serial")) {
563 prom_printf("Console device_type is neither display "
564 "nor serial.\n");
565 prom_halt();
566 }
567
568 of_console_device = dp;
569
570 printk(msg, of_console_path);
571}
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
new file mode 100644
index 000000000000..4e9af593db49
--- /dev/null
+++ b/arch/sparc/kernel/prom_common.c
@@ -0,0 +1,326 @@
1/* prom_common.c: OF device tree support common code.
2 *
3 * Paul Mackerras August 1996.
4 * Copyright (C) 1996-2005 Paul Mackerras.
5 *
6 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
7 * {engebret|bergner}@us.ibm.com
8 *
9 * Adapted for sparc by David S. Miller davem@davemloft.net
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16
17#include <linux/kernel.h>
18#include <linux/module.h>
19#include <linux/errno.h>
20#include <linux/mutex.h>
21#include <linux/slab.h>
22#include <linux/of.h>
23#include <asm/prom.h>
24#include <asm/oplib.h>
25
26#include "prom.h"
27
28struct device_node *of_console_device;
29EXPORT_SYMBOL(of_console_device);
30
31char *of_console_path;
32EXPORT_SYMBOL(of_console_path);
33
34char *of_console_options;
35EXPORT_SYMBOL(of_console_options);
36
37struct device_node *of_find_node_by_phandle(phandle handle)
38{
39 struct device_node *np;
40
41 for (np = allnodes; np; np = np->allnext)
42 if (np->node == handle)
43 break;
44
45 return np;
46}
47EXPORT_SYMBOL(of_find_node_by_phandle);
48
49int of_getintprop_default(struct device_node *np, const char *name, int def)
50{
51 struct property *prop;
52 int len;
53
54 prop = of_find_property(np, name, &len);
55 if (!prop || len != 4)
56 return def;
57
58 return *(int *) prop->value;
59}
60EXPORT_SYMBOL(of_getintprop_default);
61
62DEFINE_MUTEX(of_set_property_mutex);
63EXPORT_SYMBOL(of_set_property_mutex);
64
65int of_set_property(struct device_node *dp, const char *name, void *val, int len)
66{
67 struct property **prevp;
68 void *new_val;
69 int err;
70
71 new_val = kmalloc(len, GFP_KERNEL);
72 if (!new_val)
73 return -ENOMEM;
74
75 memcpy(new_val, val, len);
76
77 err = -ENODEV;
78
79 write_lock(&devtree_lock);
80 prevp = &dp->properties;
81 while (*prevp) {
82 struct property *prop = *prevp;
83
84 if (!strcasecmp(prop->name, name)) {
85 void *old_val = prop->value;
86 int ret;
87
88 mutex_lock(&of_set_property_mutex);
89 ret = prom_setprop(dp->node, name, val, len);
90 mutex_unlock(&of_set_property_mutex);
91
92 err = -EINVAL;
93 if (ret >= 0) {
94 prop->value = new_val;
95 prop->length = len;
96
97 if (OF_IS_DYNAMIC(prop))
98 kfree(old_val);
99
100 OF_MARK_DYNAMIC(prop);
101
102 err = 0;
103 }
104 break;
105 }
106 prevp = &(*prevp)->next;
107 }
108 write_unlock(&devtree_lock);
109
110 /* XXX Upate procfs if necessary... */
111
112 return err;
113}
114EXPORT_SYMBOL(of_set_property);
115
116int of_find_in_proplist(const char *list, const char *match, int len)
117{
118 while (len > 0) {
119 int l;
120
121 if (!strcmp(list, match))
122 return 1;
123 l = strlen(list) + 1;
124 list += l;
125 len -= l;
126 }
127 return 0;
128}
129EXPORT_SYMBOL(of_find_in_proplist);
130
131unsigned int prom_unique_id;
132
133static struct property * __init build_one_prop(phandle node, char *prev,
134 char *special_name,
135 void *special_val,
136 int special_len)
137{
138 static struct property *tmp = NULL;
139 struct property *p;
140 const char *name;
141
142 if (tmp) {
143 p = tmp;
144 memset(p, 0, sizeof(*p) + 32);
145 tmp = NULL;
146 } else {
147 p = prom_early_alloc(sizeof(struct property) + 32);
148 p->unique_id = prom_unique_id++;
149 }
150
151 p->name = (char *) (p + 1);
152 if (special_name) {
153 strcpy(p->name, special_name);
154 p->length = special_len;
155 p->value = prom_early_alloc(special_len);
156 memcpy(p->value, special_val, special_len);
157 } else {
158#ifdef CONFIG_SPARC32
159 if (prev == NULL) {
160 name = prom_firstprop(node, NULL);
161 } else {
162 name = prom_nextprop(node, prev, NULL);
163 }
164#else
165 if (prev == NULL) {
166 prom_firstprop(node, p->name);
167 } else {
168 prom_nextprop(node, prev, p->name);
169 }
170 name = p->name;
171#endif
172 if (strlen(name) == 0) {
173 tmp = p;
174 return NULL;
175 }
176#ifdef CONFIG_SPARC32
177 strcpy(p->name, name);
178#endif
179 p->length = prom_getproplen(node, p->name);
180 if (p->length <= 0) {
181 p->length = 0;
182 } else {
183 int len;
184
185 p->value = prom_early_alloc(p->length + 1);
186 len = prom_getproperty(node, p->name, p->value,
187 p->length);
188 if (len <= 0)
189 p->length = 0;
190 ((unsigned char *)p->value)[p->length] = '\0';
191 }
192 }
193 return p;
194}
195
196static struct property * __init build_prop_list(phandle node)
197{
198 struct property *head, *tail;
199
200 head = tail = build_one_prop(node, NULL,
201 ".node", &node, sizeof(node));
202
203 tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
204 tail = tail->next;
205 while(tail) {
206 tail->next = build_one_prop(node, tail->name,
207 NULL, NULL, 0);
208 tail = tail->next;
209 }
210
211 return head;
212}
213
214static char * __init get_one_property(phandle node, const char *name)
215{
216 char *buf = "<NULL>";
217 int len;
218
219 len = prom_getproplen(node, name);
220 if (len > 0) {
221 buf = prom_early_alloc(len);
222 len = prom_getproperty(node, name, buf, len);
223 }
224
225 return buf;
226}
227
228static struct device_node * __init prom_create_node(phandle node,
229 struct device_node *parent)
230{
231 struct device_node *dp;
232
233 if (!node)
234 return NULL;
235
236 dp = prom_early_alloc(sizeof(*dp));
237 dp->unique_id = prom_unique_id++;
238 dp->parent = parent;
239
240 kref_init(&dp->kref);
241
242 dp->name = get_one_property(node, "name");
243 dp->type = get_one_property(node, "device_type");
244 dp->node = node;
245
246 dp->properties = build_prop_list(node);
247
248 irq_trans_init(dp);
249
250 return dp;
251}
252
253static char * __init build_full_name(struct device_node *dp)
254{
255 int len, ourlen, plen;
256 char *n;
257
258 plen = strlen(dp->parent->full_name);
259 ourlen = strlen(dp->path_component_name);
260 len = ourlen + plen + 2;
261
262 n = prom_early_alloc(len);
263 strcpy(n, dp->parent->full_name);
264 if (!is_root_node(dp->parent)) {
265 strcpy(n + plen, "/");
266 plen++;
267 }
268 strcpy(n + plen, dp->path_component_name);
269
270 return n;
271}
272
273static struct device_node * __init prom_build_tree(struct device_node *parent,
274 phandle node,
275 struct device_node ***nextp)
276{
277 struct device_node *ret = NULL, *prev_sibling = NULL;
278 struct device_node *dp;
279
280 while (1) {
281 dp = prom_create_node(node, parent);
282 if (!dp)
283 break;
284
285 if (prev_sibling)
286 prev_sibling->sibling = dp;
287
288 if (!ret)
289 ret = dp;
290 prev_sibling = dp;
291
292 *(*nextp) = dp;
293 *nextp = &dp->allnext;
294
295 dp->path_component_name = build_path_component(dp);
296 dp->full_name = build_full_name(dp);
297
298 dp->child = prom_build_tree(dp, prom_getchild(node), nextp);
299
300 node = prom_getsibling(node);
301 }
302
303 return ret;
304}
305
306unsigned int prom_early_allocated __initdata;
307
308void __init prom_build_devicetree(void)
309{
310 struct device_node **nextp;
311
312 allnodes = prom_create_node(prom_root_node, NULL);
313 allnodes->path_component_name = "";
314 allnodes->full_name = "/";
315
316 nextp = &allnodes->allnext;
317 allnodes->child = prom_build_tree(allnodes,
318 prom_getchild(allnodes->node),
319 &nextp);
320 of_console_init();
321
322 printk("PROM: Built device tree with %u bytes of memory.\n",
323 prom_early_allocated);
324
325 of_fill_in_cpu_data();
326}
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc/kernel/prom_irqtrans.c
index dbba82f9b142..96958c4dce8e 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc/kernel/prom_irqtrans.c
@@ -1,151 +1,15 @@
1/*
2 * Procedures for creating, accessing and interpreting the device tree.
3 *
4 * Paul Mackerras August 1996.
5 * Copyright (C) 1996-2005 Paul Mackerras.
6 *
7 * Adapted for 64bit PowerPC by Dave Engebretsen and Peter Bergner.
8 * {engebret|bergner}@us.ibm.com
9 *
10 * Adapted for sparc64 by David S. Miller davem@davemloft.net
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/kernel.h> 1#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/string.h> 2#include <linux/string.h>
21#include <linux/mm.h> 3#include <linux/init.h>
22#include <linux/module.h> 4#include <linux/of.h>
23#include <linux/lmb.h> 5#include <linux/of_platform.h>
24#include <linux/of_device.h>
25 6
26#include <asm/prom.h>
27#include <asm/oplib.h> 7#include <asm/oplib.h>
8#include <asm/prom.h>
28#include <asm/irq.h> 9#include <asm/irq.h>
29#include <asm/asi.h>
30#include <asm/upa.h> 10#include <asm/upa.h>
31#include <asm/smp.h>
32
33extern struct device_node *allnodes; /* temporary while merging */
34
35extern rwlock_t devtree_lock; /* temporary while merging */
36
37struct device_node *of_find_node_by_phandle(phandle handle)
38{
39 struct device_node *np;
40
41 for (np = allnodes; np; np = np->allnext)
42 if (np->node == handle)
43 break;
44
45 return np;
46}
47EXPORT_SYMBOL(of_find_node_by_phandle);
48
49int of_getintprop_default(struct device_node *np, const char *name, int def)
50{
51 struct property *prop;
52 int len;
53
54 prop = of_find_property(np, name, &len);
55 if (!prop || len != 4)
56 return def;
57
58 return *(int *) prop->value;
59}
60EXPORT_SYMBOL(of_getintprop_default);
61
62DEFINE_MUTEX(of_set_property_mutex);
63EXPORT_SYMBOL(of_set_property_mutex);
64
65int of_set_property(struct device_node *dp, const char *name, void *val, int len)
66{
67 struct property **prevp;
68 void *new_val;
69 int err;
70
71 new_val = kmalloc(len, GFP_KERNEL);
72 if (!new_val)
73 return -ENOMEM;
74
75 memcpy(new_val, val, len);
76
77 err = -ENODEV;
78
79 write_lock(&devtree_lock);
80 prevp = &dp->properties;
81 while (*prevp) {
82 struct property *prop = *prevp;
83
84 if (!strcasecmp(prop->name, name)) {
85 void *old_val = prop->value;
86 int ret;
87
88 mutex_lock(&of_set_property_mutex);
89 ret = prom_setprop(dp->node, name, val, len);
90 mutex_unlock(&of_set_property_mutex);
91
92 err = -EINVAL;
93 if (ret >= 0) {
94 prop->value = new_val;
95 prop->length = len;
96
97 if (OF_IS_DYNAMIC(prop))
98 kfree(old_val);
99
100 OF_MARK_DYNAMIC(prop);
101
102 err = 0;
103 }
104 break;
105 }
106 prevp = &(*prevp)->next;
107 }
108 write_unlock(&devtree_lock);
109
110 /* XXX Upate procfs if necessary... */
111 11
112 return err; 12#include "prom.h"
113}
114EXPORT_SYMBOL(of_set_property);
115
116int of_find_in_proplist(const char *list, const char *match, int len)
117{
118 while (len > 0) {
119 int l;
120
121 if (!strcmp(list, match))
122 return 1;
123 l = strlen(list) + 1;
124 list += l;
125 len -= l;
126 }
127 return 0;
128}
129EXPORT_SYMBOL(of_find_in_proplist);
130
131static unsigned int prom_early_allocated __initdata;
132
133static void * __init prom_early_alloc(unsigned long size)
134{
135 unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES);
136 void *ret;
137
138 if (!paddr) {
139 prom_printf("prom_early_alloc(%lu) failed\n");
140 prom_halt();
141 }
142
143 ret = __va(paddr);
144 memset(ret, 0, size);
145 prom_early_allocated += size;
146
147 return ret;
148}
149 13
150#ifdef CONFIG_PCI 14#ifdef CONFIG_PCI
151/* PSYCHO interrupt mapping support. */ 15/* PSYCHO interrupt mapping support. */
@@ -936,7 +800,7 @@ static void __init sun4v_vdev_irq_trans_init(struct device_node *dp)
936 ((regs->phys_addr >> 32UL) & 0x0fffffff); 800 ((regs->phys_addr >> 32UL) & 0x0fffffff);
937} 801}
938 802
939static void __init irq_trans_init(struct device_node *dp) 803void __init irq_trans_init(struct device_node *dp)
940{ 804{
941#ifdef CONFIG_PCI 805#ifdef CONFIG_PCI
942 const char *model; 806 const char *model;
@@ -976,709 +840,3 @@ static void __init irq_trans_init(struct device_node *dp)
976 return; 840 return;
977 } 841 }
978} 842}
979
980static int is_root_node(const struct device_node *dp)
981{
982 if (!dp)
983 return 0;
984
985 return (dp->parent == NULL);
986}
987
988/* The following routines deal with the black magic of fully naming a
989 * node.
990 *
991 * Certain well known named nodes are just the simple name string.
992 *
993 * Actual devices have an address specifier appended to the base name
994 * string, like this "foo@addr". The "addr" can be in any number of
995 * formats, and the platform plus the type of the node determine the
996 * format and how it is constructed.
997 *
998 * For children of the ROOT node, the naming convention is fixed and
999 * determined by whether this is a sun4u or sun4v system.
1000 *
1001 * For children of other nodes, it is bus type specific. So
1002 * we walk up the tree until we discover a "device_type" property
1003 * we recognize and we go from there.
1004 *
1005 * As an example, the boot device on my workstation has a full path:
1006 *
1007 * /pci@1e,600000/ide@d/disk@0,0:c
1008 */
1009static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
1010{
1011 struct linux_prom64_registers *regs;
1012 struct property *rprop;
1013 u32 high_bits, low_bits, type;
1014
1015 rprop = of_find_property(dp, "reg", NULL);
1016 if (!rprop)
1017 return;
1018
1019 regs = rprop->value;
1020 if (!is_root_node(dp->parent)) {
1021 sprintf(tmp_buf, "%s@%x,%x",
1022 dp->name,
1023 (unsigned int) (regs->phys_addr >> 32UL),
1024 (unsigned int) (regs->phys_addr & 0xffffffffUL));
1025 return;
1026 }
1027
1028 type = regs->phys_addr >> 60UL;
1029 high_bits = (regs->phys_addr >> 32UL) & 0x0fffffffUL;
1030 low_bits = (regs->phys_addr & 0xffffffffUL);
1031
1032 if (type == 0 || type == 8) {
1033 const char *prefix = (type == 0) ? "m" : "i";
1034
1035 if (low_bits)
1036 sprintf(tmp_buf, "%s@%s%x,%x",
1037 dp->name, prefix,
1038 high_bits, low_bits);
1039 else
1040 sprintf(tmp_buf, "%s@%s%x",
1041 dp->name,
1042 prefix,
1043 high_bits);
1044 } else if (type == 12) {
1045 sprintf(tmp_buf, "%s@%x",
1046 dp->name, high_bits);
1047 }
1048}
1049
1050static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
1051{
1052 struct linux_prom64_registers *regs;
1053 struct property *prop;
1054
1055 prop = of_find_property(dp, "reg", NULL);
1056 if (!prop)
1057 return;
1058
1059 regs = prop->value;
1060 if (!is_root_node(dp->parent)) {
1061 sprintf(tmp_buf, "%s@%x,%x",
1062 dp->name,
1063 (unsigned int) (regs->phys_addr >> 32UL),
1064 (unsigned int) (regs->phys_addr & 0xffffffffUL));
1065 return;
1066 }
1067
1068 prop = of_find_property(dp, "upa-portid", NULL);
1069 if (!prop)
1070 prop = of_find_property(dp, "portid", NULL);
1071 if (prop) {
1072 unsigned long mask = 0xffffffffUL;
1073
1074 if (tlb_type >= cheetah)
1075 mask = 0x7fffff;
1076
1077 sprintf(tmp_buf, "%s@%x,%x",
1078 dp->name,
1079 *(u32 *)prop->value,
1080 (unsigned int) (regs->phys_addr & mask));
1081 }
1082}
1083
1084/* "name@slot,offset" */
1085static void __init sbus_path_component(struct device_node *dp, char *tmp_buf)
1086{
1087 struct linux_prom_registers *regs;
1088 struct property *prop;
1089
1090 prop = of_find_property(dp, "reg", NULL);
1091 if (!prop)
1092 return;
1093
1094 regs = prop->value;
1095 sprintf(tmp_buf, "%s@%x,%x",
1096 dp->name,
1097 regs->which_io,
1098 regs->phys_addr);
1099}
1100
1101/* "name@devnum[,func]" */
1102static void __init pci_path_component(struct device_node *dp, char *tmp_buf)
1103{
1104 struct linux_prom_pci_registers *regs;
1105 struct property *prop;
1106 unsigned int devfn;
1107
1108 prop = of_find_property(dp, "reg", NULL);
1109 if (!prop)
1110 return;
1111
1112 regs = prop->value;
1113 devfn = (regs->phys_hi >> 8) & 0xff;
1114 if (devfn & 0x07) {
1115 sprintf(tmp_buf, "%s@%x,%x",
1116 dp->name,
1117 devfn >> 3,
1118 devfn & 0x07);
1119 } else {
1120 sprintf(tmp_buf, "%s@%x",
1121 dp->name,
1122 devfn >> 3);
1123 }
1124}
1125
1126/* "name@UPA_PORTID,offset" */
1127static void __init upa_path_component(struct device_node *dp, char *tmp_buf)
1128{
1129 struct linux_prom64_registers *regs;
1130 struct property *prop;
1131
1132 prop = of_find_property(dp, "reg", NULL);
1133 if (!prop)
1134 return;
1135
1136 regs = prop->value;
1137
1138 prop = of_find_property(dp, "upa-portid", NULL);
1139 if (!prop)
1140 return;
1141
1142 sprintf(tmp_buf, "%s@%x,%x",
1143 dp->name,
1144 *(u32 *) prop->value,
1145 (unsigned int) (regs->phys_addr & 0xffffffffUL));
1146}
1147
1148/* "name@reg" */
1149static void __init vdev_path_component(struct device_node *dp, char *tmp_buf)
1150{
1151 struct property *prop;
1152 u32 *regs;
1153
1154 prop = of_find_property(dp, "reg", NULL);
1155 if (!prop)
1156 return;
1157
1158 regs = prop->value;
1159
1160 sprintf(tmp_buf, "%s@%x", dp->name, *regs);
1161}
1162
1163/* "name@addrhi,addrlo" */
1164static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
1165{
1166 struct linux_prom64_registers *regs;
1167 struct property *prop;
1168
1169 prop = of_find_property(dp, "reg", NULL);
1170 if (!prop)
1171 return;
1172
1173 regs = prop->value;
1174
1175 sprintf(tmp_buf, "%s@%x,%x",
1176 dp->name,
1177 (unsigned int) (regs->phys_addr >> 32UL),
1178 (unsigned int) (regs->phys_addr & 0xffffffffUL));
1179}
1180
1181/* "name@bus,addr" */
1182static void __init i2c_path_component(struct device_node *dp, char *tmp_buf)
1183{
1184 struct property *prop;
1185 u32 *regs;
1186
1187 prop = of_find_property(dp, "reg", NULL);
1188 if (!prop)
1189 return;
1190
1191 regs = prop->value;
1192
1193 /* This actually isn't right... should look at the #address-cells
1194 * property of the i2c bus node etc. etc.
1195 */
1196 sprintf(tmp_buf, "%s@%x,%x",
1197 dp->name, regs[0], regs[1]);
1198}
1199
1200/* "name@reg0[,reg1]" */
1201static void __init usb_path_component(struct device_node *dp, char *tmp_buf)
1202{
1203 struct property *prop;
1204 u32 *regs;
1205
1206 prop = of_find_property(dp, "reg", NULL);
1207 if (!prop)
1208 return;
1209
1210 regs = prop->value;
1211
1212 if (prop->length == sizeof(u32) || regs[1] == 1) {
1213 sprintf(tmp_buf, "%s@%x",
1214 dp->name, regs[0]);
1215 } else {
1216 sprintf(tmp_buf, "%s@%x,%x",
1217 dp->name, regs[0], regs[1]);
1218 }
1219}
1220
1221/* "name@reg0reg1[,reg2reg3]" */
1222static void __init ieee1394_path_component(struct device_node *dp, char *tmp_buf)
1223{
1224 struct property *prop;
1225 u32 *regs;
1226
1227 prop = of_find_property(dp, "reg", NULL);
1228 if (!prop)
1229 return;
1230
1231 regs = prop->value;
1232
1233 if (regs[2] || regs[3]) {
1234 sprintf(tmp_buf, "%s@%08x%08x,%04x%08x",
1235 dp->name, regs[0], regs[1], regs[2], regs[3]);
1236 } else {
1237 sprintf(tmp_buf, "%s@%08x%08x",
1238 dp->name, regs[0], regs[1]);
1239 }
1240}
1241
1242static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
1243{
1244 struct device_node *parent = dp->parent;
1245
1246 if (parent != NULL) {
1247 if (!strcmp(parent->type, "pci") ||
1248 !strcmp(parent->type, "pciex")) {
1249 pci_path_component(dp, tmp_buf);
1250 return;
1251 }
1252 if (!strcmp(parent->type, "sbus")) {
1253 sbus_path_component(dp, tmp_buf);
1254 return;
1255 }
1256 if (!strcmp(parent->type, "upa")) {
1257 upa_path_component(dp, tmp_buf);
1258 return;
1259 }
1260 if (!strcmp(parent->type, "ebus")) {
1261 ebus_path_component(dp, tmp_buf);
1262 return;
1263 }
1264 if (!strcmp(parent->name, "usb") ||
1265 !strcmp(parent->name, "hub")) {
1266 usb_path_component(dp, tmp_buf);
1267 return;
1268 }
1269 if (!strcmp(parent->type, "i2c")) {
1270 i2c_path_component(dp, tmp_buf);
1271 return;
1272 }
1273 if (!strcmp(parent->type, "firewire")) {
1274 ieee1394_path_component(dp, tmp_buf);
1275 return;
1276 }
1277 if (!strcmp(parent->type, "virtual-devices")) {
1278 vdev_path_component(dp, tmp_buf);
1279 return;
1280 }
1281 /* "isa" is handled with platform naming */
1282 }
1283
1284 /* Use platform naming convention. */
1285 if (tlb_type == hypervisor) {
1286 sun4v_path_component(dp, tmp_buf);
1287 return;
1288 } else {
1289 sun4u_path_component(dp, tmp_buf);
1290 }
1291}
1292
1293static char * __init build_path_component(struct device_node *dp)
1294{
1295 char tmp_buf[64], *n;
1296
1297 tmp_buf[0] = '\0';
1298 __build_path_component(dp, tmp_buf);
1299 if (tmp_buf[0] == '\0')
1300 strcpy(tmp_buf, dp->name);
1301
1302 n = prom_early_alloc(strlen(tmp_buf) + 1);
1303 strcpy(n, tmp_buf);
1304
1305 return n;
1306}
1307
1308static char * __init build_full_name(struct device_node *dp)
1309{
1310 int len, ourlen, plen;
1311 char *n;
1312
1313 plen = strlen(dp->parent->full_name);
1314 ourlen = strlen(dp->path_component_name);
1315 len = ourlen + plen + 2;
1316
1317 n = prom_early_alloc(len);
1318 strcpy(n, dp->parent->full_name);
1319 if (!is_root_node(dp->parent)) {
1320 strcpy(n + plen, "/");
1321 plen++;
1322 }
1323 strcpy(n + plen, dp->path_component_name);
1324
1325 return n;
1326}
1327
1328static unsigned int unique_id;
1329
1330static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len)
1331{
1332 static struct property *tmp = NULL;
1333 struct property *p;
1334
1335 if (tmp) {
1336 p = tmp;
1337 memset(p, 0, sizeof(*p) + 32);
1338 tmp = NULL;
1339 } else {
1340 p = prom_early_alloc(sizeof(struct property) + 32);
1341 p->unique_id = unique_id++;
1342 }
1343
1344 p->name = (char *) (p + 1);
1345 if (special_name) {
1346 strcpy(p->name, special_name);
1347 p->length = special_len;
1348 p->value = prom_early_alloc(special_len);
1349 memcpy(p->value, special_val, special_len);
1350 } else {
1351 if (prev == NULL) {
1352 prom_firstprop(node, p->name);
1353 } else {
1354 prom_nextprop(node, prev, p->name);
1355 }
1356 if (strlen(p->name) == 0) {
1357 tmp = p;
1358 return NULL;
1359 }
1360 p->length = prom_getproplen(node, p->name);
1361 if (p->length <= 0) {
1362 p->length = 0;
1363 } else {
1364 p->value = prom_early_alloc(p->length + 1);
1365 prom_getproperty(node, p->name, p->value, p->length);
1366 ((unsigned char *)p->value)[p->length] = '\0';
1367 }
1368 }
1369 return p;
1370}
1371
1372static struct property * __init build_prop_list(phandle node)
1373{
1374 struct property *head, *tail;
1375
1376 head = tail = build_one_prop(node, NULL,
1377 ".node", &node, sizeof(node));
1378
1379 tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
1380 tail = tail->next;
1381 while(tail) {
1382 tail->next = build_one_prop(node, tail->name,
1383 NULL, NULL, 0);
1384 tail = tail->next;
1385 }
1386
1387 return head;
1388}
1389
1390static char * __init get_one_property(phandle node, const char *name)
1391{
1392 char *buf = "<NULL>";
1393 int len;
1394
1395 len = prom_getproplen(node, name);
1396 if (len > 0) {
1397 buf = prom_early_alloc(len);
1398 prom_getproperty(node, name, buf, len);
1399 }
1400
1401 return buf;
1402}
1403
1404static struct device_node * __init create_node(phandle node, struct device_node *parent)
1405{
1406 struct device_node *dp;
1407
1408 if (!node)
1409 return NULL;
1410
1411 dp = prom_early_alloc(sizeof(*dp));
1412 dp->unique_id = unique_id++;
1413 dp->parent = parent;
1414
1415 kref_init(&dp->kref);
1416
1417 dp->name = get_one_property(node, "name");
1418 dp->type = get_one_property(node, "device_type");
1419 dp->node = node;
1420
1421 dp->properties = build_prop_list(node);
1422
1423 irq_trans_init(dp);
1424
1425 return dp;
1426}
1427
1428static struct device_node * __init build_tree(struct device_node *parent, phandle node, struct device_node ***nextp)
1429{
1430 struct device_node *ret = NULL, *prev_sibling = NULL;
1431 struct device_node *dp;
1432
1433 while (1) {
1434 dp = create_node(node, parent);
1435 if (!dp)
1436 break;
1437
1438 if (prev_sibling)
1439 prev_sibling->sibling = dp;
1440
1441 if (!ret)
1442 ret = dp;
1443 prev_sibling = dp;
1444
1445 *(*nextp) = dp;
1446 *nextp = &dp->allnext;
1447
1448 dp->path_component_name = build_path_component(dp);
1449 dp->full_name = build_full_name(dp);
1450
1451 dp->child = build_tree(dp, prom_getchild(node), nextp);
1452
1453 node = prom_getsibling(node);
1454 }
1455
1456 return ret;
1457}
1458
1459static const char *get_mid_prop(void)
1460{
1461 return (tlb_type == spitfire ? "upa-portid" : "portid");
1462}
1463
1464struct device_node *of_find_node_by_cpuid(int cpuid)
1465{
1466 struct device_node *dp;
1467 const char *mid_prop = get_mid_prop();
1468
1469 for_each_node_by_type(dp, "cpu") {
1470 int id = of_getintprop_default(dp, mid_prop, -1);
1471 const char *this_mid_prop = mid_prop;
1472
1473 if (id < 0) {
1474 this_mid_prop = "cpuid";
1475 id = of_getintprop_default(dp, this_mid_prop, -1);
1476 }
1477
1478 if (id < 0) {
1479 prom_printf("OF: Serious problem, cpu lacks "
1480 "%s property", this_mid_prop);
1481 prom_halt();
1482 }
1483 if (cpuid == id)
1484 return dp;
1485 }
1486 return NULL;
1487}
1488
1489static void __init of_fill_in_cpu_data(void)
1490{
1491 struct device_node *dp;
1492 const char *mid_prop = get_mid_prop();
1493
1494 ncpus_probed = 0;
1495 for_each_node_by_type(dp, "cpu") {
1496 int cpuid = of_getintprop_default(dp, mid_prop, -1);
1497 const char *this_mid_prop = mid_prop;
1498 struct device_node *portid_parent;
1499 int portid = -1;
1500
1501 portid_parent = NULL;
1502 if (cpuid < 0) {
1503 this_mid_prop = "cpuid";
1504 cpuid = of_getintprop_default(dp, this_mid_prop, -1);
1505 if (cpuid >= 0) {
1506 int limit = 2;
1507
1508 portid_parent = dp;
1509 while (limit--) {
1510 portid_parent = portid_parent->parent;
1511 if (!portid_parent)
1512 break;
1513 portid = of_getintprop_default(portid_parent,
1514 "portid", -1);
1515 if (portid >= 0)
1516 break;
1517 }
1518 }
1519 }
1520
1521 if (cpuid < 0) {
1522 prom_printf("OF: Serious problem, cpu lacks "
1523 "%s property", this_mid_prop);
1524 prom_halt();
1525 }
1526
1527 ncpus_probed++;
1528
1529#ifdef CONFIG_SMP
1530 if (cpuid >= NR_CPUS) {
1531 printk(KERN_WARNING "Ignoring CPU %d which is "
1532 ">= NR_CPUS (%d)\n",
1533 cpuid, NR_CPUS);
1534 continue;
1535 }
1536#else
1537 /* On uniprocessor we only want the values for the
1538 * real physical cpu the kernel booted onto, however
1539 * cpu_data() only has one entry at index 0.
1540 */
1541 if (cpuid != real_hard_smp_processor_id())
1542 continue;
1543 cpuid = 0;
1544#endif
1545
1546 cpu_data(cpuid).clock_tick =
1547 of_getintprop_default(dp, "clock-frequency", 0);
1548
1549 if (portid_parent) {
1550 cpu_data(cpuid).dcache_size =
1551 of_getintprop_default(dp, "l1-dcache-size",
1552 16 * 1024);
1553 cpu_data(cpuid).dcache_line_size =
1554 of_getintprop_default(dp, "l1-dcache-line-size",
1555 32);
1556 cpu_data(cpuid).icache_size =
1557 of_getintprop_default(dp, "l1-icache-size",
1558 8 * 1024);
1559 cpu_data(cpuid).icache_line_size =
1560 of_getintprop_default(dp, "l1-icache-line-size",
1561 32);
1562 cpu_data(cpuid).ecache_size =
1563 of_getintprop_default(dp, "l2-cache-size", 0);
1564 cpu_data(cpuid).ecache_line_size =
1565 of_getintprop_default(dp, "l2-cache-line-size", 0);
1566 if (!cpu_data(cpuid).ecache_size ||
1567 !cpu_data(cpuid).ecache_line_size) {
1568 cpu_data(cpuid).ecache_size =
1569 of_getintprop_default(portid_parent,
1570 "l2-cache-size",
1571 (4 * 1024 * 1024));
1572 cpu_data(cpuid).ecache_line_size =
1573 of_getintprop_default(portid_parent,
1574 "l2-cache-line-size", 64);
1575 }
1576
1577 cpu_data(cpuid).core_id = portid + 1;
1578 cpu_data(cpuid).proc_id = portid;
1579#ifdef CONFIG_SMP
1580 sparc64_multi_core = 1;
1581#endif
1582 } else {
1583 cpu_data(cpuid).dcache_size =
1584 of_getintprop_default(dp, "dcache-size", 16 * 1024);
1585 cpu_data(cpuid).dcache_line_size =
1586 of_getintprop_default(dp, "dcache-line-size", 32);
1587
1588 cpu_data(cpuid).icache_size =
1589 of_getintprop_default(dp, "icache-size", 16 * 1024);
1590 cpu_data(cpuid).icache_line_size =
1591 of_getintprop_default(dp, "icache-line-size", 32);
1592
1593 cpu_data(cpuid).ecache_size =
1594 of_getintprop_default(dp, "ecache-size",
1595 (4 * 1024 * 1024));
1596 cpu_data(cpuid).ecache_line_size =
1597 of_getintprop_default(dp, "ecache-line-size", 64);
1598
1599 cpu_data(cpuid).core_id = 0;
1600 cpu_data(cpuid).proc_id = -1;
1601 }
1602
1603#ifdef CONFIG_SMP
1604 cpu_set(cpuid, cpu_present_map);
1605 cpu_set(cpuid, cpu_possible_map);
1606#endif
1607 }
1608
1609 smp_fill_in_sib_core_maps();
1610}
1611
1612struct device_node *of_console_device;
1613EXPORT_SYMBOL(of_console_device);
1614
1615char *of_console_path;
1616EXPORT_SYMBOL(of_console_path);
1617
1618char *of_console_options;
1619EXPORT_SYMBOL(of_console_options);
1620
1621static void __init of_console_init(void)
1622{
1623 char *msg = "OF stdout device is: %s\n";
1624 struct device_node *dp;
1625 const char *type;
1626 phandle node;
1627
1628 of_console_path = prom_early_alloc(256);
1629 if (prom_ihandle2path(prom_stdout, of_console_path, 256) < 0) {
1630 prom_printf("Cannot obtain path of stdout.\n");
1631 prom_halt();
1632 }
1633 of_console_options = strrchr(of_console_path, ':');
1634 if (of_console_options) {
1635 of_console_options++;
1636 if (*of_console_options == '\0')
1637 of_console_options = NULL;
1638 }
1639
1640 node = prom_inst2pkg(prom_stdout);
1641 if (!node) {
1642 prom_printf("Cannot resolve stdout node from "
1643 "instance %08x.\n", prom_stdout);
1644 prom_halt();
1645 }
1646
1647 dp = of_find_node_by_phandle(node);
1648 type = of_get_property(dp, "device_type", NULL);
1649 if (!type) {
1650 prom_printf("Console stdout lacks device_type property.\n");
1651 prom_halt();
1652 }
1653
1654 if (strcmp(type, "display") && strcmp(type, "serial")) {
1655 prom_printf("Console device_type is neither display "
1656 "nor serial.\n");
1657 prom_halt();
1658 }
1659
1660 of_console_device = dp;
1661
1662 printk(msg, of_console_path);
1663}
1664
1665void __init prom_build_devicetree(void)
1666{
1667 struct device_node **nextp;
1668
1669 allnodes = create_node(prom_root_node, NULL);
1670 allnodes->path_component_name = "";
1671 allnodes->full_name = "/";
1672
1673 nextp = &allnodes->allnext;
1674 allnodes->child = build_tree(allnodes,
1675 prom_getchild(allnodes->node),
1676 &nextp);
1677 of_console_init();
1678
1679 printk("PROM: Built device tree with %u bytes of memory.\n",
1680 prom_early_allocated);
1681
1682 if (tlb_type != hypervisor)
1683 of_fill_in_cpu_data();
1684}
diff --git a/arch/sparc64/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 790996428c14..790996428c14 100644
--- a/arch/sparc64/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
diff --git a/arch/sparc64/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h
index 092c278ef28d..092c278ef28d 100644
--- a/arch/sparc64/kernel/psycho_common.h
+++ b/arch/sparc/kernel/psycho_common.h
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace_32.c
index 8ce6285a06d5..8ce6285a06d5 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace_32.c
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc/kernel/ptrace_64.c
index a941c610e7ce..a941c610e7ce 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace_64.c
diff --git a/arch/sparc64/kernel/reboot.c b/arch/sparc/kernel/reboot.c
index ef89d3d69748..ef89d3d69748 100644
--- a/arch/sparc64/kernel/reboot.c
+++ b/arch/sparc/kernel/reboot.c
diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap_32.S
index 4da2e1f66290..4da2e1f66290 100644
--- a/arch/sparc/kernel/rtrap.S
+++ b/arch/sparc/kernel/rtrap_32.S
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc/kernel/rtrap_64.S
index 97a993c1f7f3..fd3cee4d117c 100644
--- a/arch/sparc64/kernel/rtrap.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -14,9 +14,9 @@
14#include <asm/visasm.h> 14#include <asm/visasm.h>
15#include <asm/processor.h> 15#include <asm/processor.h>
16 16
17#define RTRAP_PSTATE (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV|PSTATE_IE) 17#define RTRAP_PSTATE (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_IE)
18#define RTRAP_PSTATE_IRQOFF (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV) 18#define RTRAP_PSTATE_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV)
19#define RTRAP_PSTATE_AG_IRQOFF (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG) 19#define RTRAP_PSTATE_AG_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG)
20 20
21 .text 21 .text
22 .align 32 22 .align 32
@@ -132,6 +132,18 @@ __handle_signal:
132 ba,pt %xcc, __handle_signal_continue 132 ba,pt %xcc, __handle_signal_continue
133 andn %l1, %l4, %l1 133 andn %l1, %l4, %l1
134 134
135 /* When returning from a NMI (%pil==15) interrupt we want to
136 * avoid running softirqs, doing IRQ tracing, preempting, etc.
137 */
138 .globl rtrap_nmi
139rtrap_nmi: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
140 sethi %hi(0xf << 20), %l4
141 and %l1, %l4, %l4
142 andn %l1, %l4, %l1
143 srl %l4, 20, %l4
144 ba,pt %xcc, rtrap_no_irq_enable
145 wrpr %l4, %pil
146
135 .align 64 147 .align 64
136 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall 148 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall
137rtrap_irq: 149rtrap_irq:
@@ -161,8 +173,8 @@ rtrap_xcall:
161 call trace_hardirqs_on 173 call trace_hardirqs_on
162 nop 174 nop
163 wrpr %l4, %pil 175 wrpr %l4, %pil
164rtrap_no_irq_enable:
165#endif 176#endif
177rtrap_no_irq_enable:
166 andcc %l1, TSTATE_PRIV, %l3 178 andcc %l1, TSTATE_PRIV, %l3
167 bne,pn %icc, to_kernel 179 bne,pn %icc, to_kernel
168 nop 180 nop
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index 2ead310066d1..2ead310066d1 100644
--- a/arch/sparc64/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup_32.c
index 24fe3078bd4b..c96c65d1b58b 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -46,6 +46,8 @@
46#include <asm/cpudata.h> 46#include <asm/cpudata.h>
47#include <asm/setup.h> 47#include <asm/setup.h>
48 48
49#include "kernel.h"
50
49struct screen_info screen_info = { 51struct screen_info screen_info = {
50 0, 0, /* orig-x, orig-y */ 52 0, 0, /* orig-x, orig-y */
51 0, /* unused */ 53 0, /* unused */
@@ -308,9 +310,6 @@ void __init setup_arch(char **cmdline_p)
308 smp_setup_cpu_possible_map(); 310 smp_setup_cpu_possible_map();
309} 311}
310 312
311extern char *sparc_cpu_type;
312extern char *sparc_fpu_type;
313
314static int ncpus_probed; 313static int ncpus_probed;
315 314
316static int show_cpuinfo(struct seq_file *m, void *__unused) 315static int show_cpuinfo(struct seq_file *m, void *__unused)
@@ -328,8 +327,8 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
328 "CPU0ClkTck\t: %ld\n" 327 "CPU0ClkTck\t: %ld\n"
329#endif 328#endif
330 , 329 ,
331 sparc_cpu_type ? sparc_cpu_type : "undetermined", 330 sparc_cpu_type,
332 sparc_fpu_type ? sparc_fpu_type : "undetermined", 331 sparc_fpu_type ,
333 romvec->pv_romvers, 332 romvec->pv_romvers,
334 prom_rev, 333 prom_rev,
335 romvec->pv_printrev >> 16, 334 romvec->pv_printrev >> 16,
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc/kernel/setup_64.c
index c8b03a4f68bf..555db7452ebe 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -52,6 +52,7 @@
52#endif 52#endif
53 53
54#include "entry.h" 54#include "entry.h"
55#include "kernel.h"
55 56
56/* Used to synchronize accesses to NatSemi SUPER I/O chip configure 57/* Used to synchronize accesses to NatSemi SUPER I/O chip configure
57 * operations in asm/ns87303.h 58 * operations in asm/ns87303.h
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index ba5b09ad6666..ba5b09ad6666 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal_32.c
index c94f91c8b6e0..c94f91c8b6e0 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal_32.c
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc/kernel/signal_64.c
index ec82d76dc6f2..ec82d76dc6f2 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc/kernel/signal_64.c
diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp_32.c
index e396c1f17a92..e396c1f17a92 100644
--- a/arch/sparc/kernel/smp.c
+++ b/arch/sparc/kernel/smp_32.c
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc/kernel/smp_64.c
index f500b0618bb0..bfe99d82d458 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -163,7 +163,7 @@ static inline long get_delta (long *rt, long *master)
163 for (i = 0; i < NUM_ITERS; i++) { 163 for (i = 0; i < NUM_ITERS; i++) {
164 t0 = tick_ops->get_tick(); 164 t0 = tick_ops->get_tick();
165 go[MASTER] = 1; 165 go[MASTER] = 1;
166 membar_storeload(); 166 membar_safe("#StoreLoad");
167 while (!(tm = go[SLAVE])) 167 while (!(tm = go[SLAVE]))
168 rmb(); 168 rmb();
169 go[SLAVE] = 0; 169 go[SLAVE] = 0;
@@ -257,7 +257,7 @@ static void smp_synchronize_one_tick(int cpu)
257 257
258 /* now let the client proceed into his loop */ 258 /* now let the client proceed into his loop */
259 go[MASTER] = 0; 259 go[MASTER] = 0;
260 membar_storeload(); 260 membar_safe("#StoreLoad");
261 261
262 spin_lock_irqsave(&itc_sync_lock, flags); 262 spin_lock_irqsave(&itc_sync_lock, flags);
263 { 263 {
@@ -267,7 +267,7 @@ static void smp_synchronize_one_tick(int cpu)
267 go[MASTER] = 0; 267 go[MASTER] = 0;
268 wmb(); 268 wmb();
269 go[SLAVE] = tick_ops->get_tick(); 269 go[SLAVE] = tick_ops->get_tick();
270 membar_storeload(); 270 membar_safe("#StoreLoad");
271 } 271 }
272 } 272 }
273 spin_unlock_irqrestore(&itc_sync_lock, flags); 273 spin_unlock_irqrestore(&itc_sync_lock, flags);
@@ -773,7 +773,7 @@ static void xcall_deliver(u64 data0, u64 data1, u64 data2, const cpumask_t *mask
773 773
774 /* Setup the initial cpu list. */ 774 /* Setup the initial cpu list. */
775 cnt = 0; 775 cnt = 0;
776 for_each_cpu_mask_nr(i, *mask) { 776 for_each_cpu(i, mask) {
777 if (i == this_cpu || !cpu_online(i)) 777 if (i == this_cpu || !cpu_online(i))
778 continue; 778 continue;
779 cpu_list[cnt++] = i; 779 cpu_list[cnt++] = i;
@@ -1122,7 +1122,6 @@ void smp_capture(void)
1122 smp_processor_id()); 1122 smp_processor_id());
1123#endif 1123#endif
1124 penguins_are_doing_time = 1; 1124 penguins_are_doing_time = 1;
1125 membar_storestore_loadstore();
1126 atomic_inc(&smp_capture_registry); 1125 atomic_inc(&smp_capture_registry);
1127 smp_cross_call(&xcall_capture, 0, 0, 0); 1126 smp_cross_call(&xcall_capture, 0, 0, 0);
1128 while (atomic_read(&smp_capture_registry) != ncpus) 1127 while (atomic_read(&smp_capture_registry) != ncpus)
@@ -1142,13 +1141,13 @@ void smp_release(void)
1142 smp_processor_id()); 1141 smp_processor_id());
1143#endif 1142#endif
1144 penguins_are_doing_time = 0; 1143 penguins_are_doing_time = 0;
1145 membar_storeload_storestore(); 1144 membar_safe("#StoreLoad");
1146 atomic_dec(&smp_capture_registry); 1145 atomic_dec(&smp_capture_registry);
1147 } 1146 }
1148} 1147}
1149 1148
1150/* Imprisoned penguins run with %pil == 15, but PSTATE_IE set, so they 1149/* Imprisoned penguins run with %pil == PIL_NORMAL_MAX, but PSTATE_IE
1151 * can service tlb flush xcalls... 1150 * set, so they can service tlb flush xcalls...
1152 */ 1151 */
1153extern void prom_world(int); 1152extern void prom_world(int);
1154 1153
@@ -1161,7 +1160,7 @@ void smp_penguin_jailcell(int irq, struct pt_regs *regs)
1161 __asm__ __volatile__("flushw"); 1160 __asm__ __volatile__("flushw");
1162 prom_world(1); 1161 prom_world(1);
1163 atomic_inc(&smp_capture_registry); 1162 atomic_inc(&smp_capture_registry);
1164 membar_storeload_storestore(); 1163 membar_safe("#StoreLoad");
1165 while (penguins_are_doing_time) 1164 while (penguins_are_doing_time)
1166 rmb(); 1165 rmb();
1167 atomic_dec(&smp_capture_registry); 1166 atomic_dec(&smp_capture_registry);
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms_32.c
index b0dfff848653..a4d45fc29b21 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms_32.c
@@ -61,7 +61,6 @@ extern void (*bzero_1page)(void *);
61extern void *__bzero(void *, size_t); 61extern void *__bzero(void *, size_t);
62extern void *__memscan_zero(void *, size_t); 62extern void *__memscan_zero(void *, size_t);
63extern void *__memscan_generic(void *, int, size_t); 63extern void *__memscan_generic(void *, int, size_t);
64extern int __memcmp(const void *, const void *, __kernel_size_t);
65extern int __strncmp(const char *, const char *, __kernel_size_t); 64extern int __strncmp(const char *, const char *, __kernel_size_t);
66 65
67extern int __ashrdi3(int, int); 66extern int __ashrdi3(int, int);
@@ -122,10 +121,8 @@ EXPORT_SYMBOL(phys_cpu_present_map);
122EXPORT_SYMBOL(__udelay); 121EXPORT_SYMBOL(__udelay);
123EXPORT_SYMBOL(__ndelay); 122EXPORT_SYMBOL(__ndelay);
124EXPORT_SYMBOL(rtc_lock); 123EXPORT_SYMBOL(rtc_lock);
125#ifdef CONFIG_SUN_AUXIO
126EXPORT_SYMBOL(set_auxio); 124EXPORT_SYMBOL(set_auxio);
127EXPORT_SYMBOL(get_auxio); 125EXPORT_SYMBOL(get_auxio);
128#endif
129EXPORT_SYMBOL(io_remap_pfn_range); 126EXPORT_SYMBOL(io_remap_pfn_range);
130 127
131#ifndef CONFIG_SMP 128#ifndef CONFIG_SMP
@@ -213,7 +210,6 @@ EXPORT_SYMBOL(bzero_1page);
213EXPORT_SYMBOL(__bzero); 210EXPORT_SYMBOL(__bzero);
214EXPORT_SYMBOL(__memscan_zero); 211EXPORT_SYMBOL(__memscan_zero);
215EXPORT_SYMBOL(__memscan_generic); 212EXPORT_SYMBOL(__memscan_generic);
216EXPORT_SYMBOL(__memcmp);
217EXPORT_SYMBOL(__strncmp); 213EXPORT_SYMBOL(__strncmp);
218EXPORT_SYMBOL(__memmove); 214EXPORT_SYMBOL(__memmove);
219 215
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc/kernel/sparc_ksyms_64.c
index 30bba8b0a3b0..0133211ab634 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms_64.c
@@ -49,6 +49,7 @@
49#include <asm/timer.h> 49#include <asm/timer.h>
50#include <asm/cpudata.h> 50#include <asm/cpudata.h>
51#include <asm/ftrace.h> 51#include <asm/ftrace.h>
52#include <asm/hypervisor.h>
52 53
53struct poll { 54struct poll {
54 int fd; 55 int fd;
@@ -61,7 +62,6 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
61extern void *__bzero(void *, size_t); 62extern void *__bzero(void *, size_t);
62extern void *__memscan_zero(void *, size_t); 63extern void *__memscan_zero(void *, size_t);
63extern void *__memscan_generic(void *, int, size_t); 64extern void *__memscan_generic(void *, int, size_t);
64extern int __memcmp(const void *, const void *, __kernel_size_t);
65extern __kernel_size_t strlen(const char *); 65extern __kernel_size_t strlen(const char *);
66extern void sys_sigsuspend(void); 66extern void sys_sigsuspend(void);
67extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg); 67extern int compat_sys_ioctl(unsigned int fd, unsigned int cmd, u32 arg);
@@ -148,10 +148,13 @@ EXPORT_SYMBOL(flush_dcache_page);
148EXPORT_SYMBOL(__flush_dcache_range); 148EXPORT_SYMBOL(__flush_dcache_range);
149#endif 149#endif
150 150
151#ifdef CONFIG_SUN_AUXIO 151EXPORT_SYMBOL(sun4v_niagara_getperf);
152EXPORT_SYMBOL(sun4v_niagara_setperf);
153EXPORT_SYMBOL(sun4v_niagara2_getperf);
154EXPORT_SYMBOL(sun4v_niagara2_setperf);
155
152EXPORT_SYMBOL(auxio_set_led); 156EXPORT_SYMBOL(auxio_set_led);
153EXPORT_SYMBOL(auxio_set_lte); 157EXPORT_SYMBOL(auxio_set_lte);
154#endif
155#ifdef CONFIG_SBUS 158#ifdef CONFIG_SBUS
156EXPORT_SYMBOL(sbus_set_sbus64); 159EXPORT_SYMBOL(sbus_set_sbus64);
157#endif 160#endif
@@ -177,7 +180,6 @@ EXPORT_SYMBOL(pci_dma_supported);
177EXPORT_SYMBOL(io_remap_pfn_range); 180EXPORT_SYMBOL(io_remap_pfn_range);
178 181
179EXPORT_SYMBOL(dump_fpu); 182EXPORT_SYMBOL(dump_fpu);
180EXPORT_SYMBOL(put_fs_struct);
181 183
182/* math-emu wants this */ 184/* math-emu wants this */
183EXPORT_SYMBOL(die_if_kernel); 185EXPORT_SYMBOL(die_if_kernel);
@@ -219,7 +221,6 @@ EXPORT_SYMBOL(copy_user_page);
219EXPORT_SYMBOL(__bzero); 221EXPORT_SYMBOL(__bzero);
220EXPORT_SYMBOL(__memscan_zero); 222EXPORT_SYMBOL(__memscan_zero);
221EXPORT_SYMBOL(__memscan_generic); 223EXPORT_SYMBOL(__memscan_generic);
222EXPORT_SYMBOL(__memcmp);
223EXPORT_SYMBOL(__memset); 224EXPORT_SYMBOL(__memset);
224 225
225EXPORT_SYMBOL(csum_partial); 226EXPORT_SYMBOL(csum_partial);
diff --git a/arch/sparc64/kernel/spiterrs.S b/arch/sparc/kernel/spiterrs.S
index ef902c6f8e3c..c357e40ffd01 100644
--- a/arch/sparc64/kernel/spiterrs.S
+++ b/arch/sparc/kernel/spiterrs.S
@@ -80,7 +80,7 @@ __spitfire_cee_trap_continue:
80 cmp %g2, 1 80 cmp %g2, 1
81 rdpr %pil, %g2 81 rdpr %pil, %g2
82 bleu,pt %xcc, 1f 82 bleu,pt %xcc, 1f
83 wrpr %g0, 15, %pil 83 wrpr %g0, PIL_NORMAL_MAX, %pil
84 84
85 ba,pt %xcc, etraptl1 85 ba,pt %xcc, etraptl1
86 rd %pc, %g7 86 rd %pc, %g7
diff --git a/arch/sparc64/kernel/sstate.c b/arch/sparc/kernel/sstate.c
index 8cdbe5946b43..8cdbe5946b43 100644
--- a/arch/sparc64/kernel/sstate.c
+++ b/arch/sparc/kernel/sstate.c
diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc/kernel/stacktrace.c
index 4e21d4a57d3b..acb12f673757 100644
--- a/arch/sparc64/kernel/stacktrace.c
+++ b/arch/sparc/kernel/stacktrace.c
@@ -7,17 +7,18 @@
7 7
8#include "kstack.h" 8#include "kstack.h"
9 9
10void save_stack_trace(struct stack_trace *trace) 10static void __save_stack_trace(struct thread_info *tp,
11 struct stack_trace *trace,
12 bool skip_sched)
11{ 13{
12 struct thread_info *tp = task_thread_info(current);
13 unsigned long ksp, fp; 14 unsigned long ksp, fp;
14 15
15 stack_trace_flush(); 16 if (tp == current_thread_info()) {
16 17 stack_trace_flush();
17 __asm__ __volatile__( 18 __asm__ __volatile__("mov %%fp, %0" : "=r" (ksp));
18 "mov %%fp, %0" 19 } else {
19 : "=r" (ksp) 20 ksp = tp->ksp;
20 ); 21 }
21 22
22 fp = ksp + STACK_BIAS; 23 fp = ksp + STACK_BIAS;
23 do { 24 do {
@@ -43,8 +44,21 @@ void save_stack_trace(struct stack_trace *trace)
43 44
44 if (trace->skip > 0) 45 if (trace->skip > 0)
45 trace->skip--; 46 trace->skip--;
46 else 47 else if (!skip_sched || !in_sched_functions(pc))
47 trace->entries[trace->nr_entries++] = pc; 48 trace->entries[trace->nr_entries++] = pc;
48 } while (trace->nr_entries < trace->max_entries); 49 } while (trace->nr_entries < trace->max_entries);
49} 50}
51
52void save_stack_trace(struct stack_trace *trace)
53{
54 __save_stack_trace(current_thread_info(), trace, false);
55}
50EXPORT_SYMBOL_GPL(save_stack_trace); 56EXPORT_SYMBOL_GPL(save_stack_trace);
57
58void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
59{
60 struct thread_info *tp = task_thread_info(tsk);
61
62 __save_stack_trace(tp, trace, true);
63}
64EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
diff --git a/arch/sparc64/kernel/starfire.c b/arch/sparc/kernel/starfire.c
index 060d0f3a6151..060d0f3a6151 100644
--- a/arch/sparc64/kernel/starfire.c
+++ b/arch/sparc/kernel/starfire.c
diff --git a/arch/sparc/kernel/sun4c_irq.c b/arch/sparc/kernel/sun4c_irq.c
index 5dc8a5769489..bc3adbf79c6a 100644
--- a/arch/sparc/kernel/sun4c_irq.c
+++ b/arch/sparc/kernel/sun4c_irq.c
@@ -160,6 +160,7 @@ static void __init sun4c_init_timers(irq_handler_t counter_fn)
160 sun4c_timers = (void __iomem *) (unsigned long) addr[0]; 160 sun4c_timers = (void __iomem *) (unsigned long) addr[0];
161 161
162 irq = of_get_property(dp, "intr", NULL); 162 irq = of_get_property(dp, "intr", NULL);
163 of_node_put(dp);
163 if (!irq) { 164 if (!irq) {
164 prom_printf("sun4c_init_timers: No intr property\n"); 165 prom_printf("sun4c_init_timers: No intr property\n");
165 prom_halt(); 166 prom_halt();
@@ -200,6 +201,7 @@ void __init sun4c_init_IRQ(void)
200 } 201 }
201 202
202 addr = of_get_property(dp, "address", NULL); 203 addr = of_get_property(dp, "address", NULL);
204 of_node_put(dp);
203 if (!addr) { 205 if (!addr) {
204 prom_printf("sun4c_init_IRQ: No address property\n"); 206 prom_printf("sun4c_init_IRQ: No address property\n");
205 prom_halt(); 207 prom_halt();
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index d3cb76ce418b..3369fef5b4b3 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -40,6 +40,7 @@
40#include <asm/cacheflush.h> 40#include <asm/cacheflush.h>
41#include <asm/irq_regs.h> 41#include <asm/irq_regs.h>
42 42
43#include "kernel.h"
43#include "irq.h" 44#include "irq.h"
44 45
45/* If you trust current SCSI layer to handle different SCSI IRQs, enable this. I don't trust it... -jj */ 46/* If you trust current SCSI layer to handle different SCSI IRQs, enable this. I don't trust it... -jj */
@@ -58,7 +59,6 @@ static struct sun4d_timer_regs __iomem *sun4d_timers;
58#define TIMER_IRQ 10 59#define TIMER_IRQ 10
59 60
60#define MAX_STATIC_ALLOC 4 61#define MAX_STATIC_ALLOC 4
61extern struct irqaction static_irqaction[MAX_STATIC_ALLOC];
62extern int static_irq_count; 62extern int static_irq_count;
63static unsigned char sbus_tid[32]; 63static unsigned char sbus_tid[32];
64 64
@@ -508,6 +508,7 @@ static void __init sun4d_init_timers(irq_handler_t counter_fn)
508 * bootbus. 508 * bootbus.
509 */ 509 */
510 reg = of_get_property(dp, "reg", NULL); 510 reg = of_get_property(dp, "reg", NULL);
511 of_node_put(dp);
511 if (!reg) { 512 if (!reg) {
512 prom_printf("sun4d_init_timers: No reg property\n"); 513 prom_printf("sun4d_init_timers: No reg property\n");
513 prom_halt(); 514 prom_halt();
diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c
index f10317179ee6..301892e2d718 100644
--- a/arch/sparc/kernel/sun4m_irq.c
+++ b/arch/sparc/kernel/sun4m_irq.c
@@ -374,6 +374,7 @@ static void __init sun4m_init_timers(irq_handler_t counter_fn)
374 } 374 }
375 375
376 addr = of_get_property(dp, "address", &len); 376 addr = of_get_property(dp, "address", &len);
377 of_node_put(dp);
377 if (!addr) { 378 if (!addr) {
378 printk(KERN_ERR "sun4m_init_timers: No 'address' prop.\n"); 379 printk(KERN_ERR "sun4m_init_timers: No 'address' prop.\n");
379 return; 380 return;
@@ -437,6 +438,7 @@ void __init sun4m_init_IRQ(void)
437 } 438 }
438 439
439 addr = of_get_property(dp, "address", &len); 440 addr = of_get_property(dp, "address", &len);
441 of_node_put(dp);
440 if (!addr) { 442 if (!addr) {
441 printk(KERN_ERR "sun4m_init_IRQ: No 'address' prop.\n"); 443 printk(KERN_ERR "sun4m_init_IRQ: No 'address' prop.\n");
442 return; 444 return;
diff --git a/arch/sparc64/kernel/sun4v_ivec.S b/arch/sparc/kernel/sun4v_ivec.S
index e2f8e1b4882a..559bc5e9c199 100644
--- a/arch/sparc64/kernel/sun4v_ivec.S
+++ b/arch/sparc/kernel/sun4v_ivec.S
@@ -186,7 +186,7 @@ sun4v_res_mondo:
186 * when it's done. 186 * when it's done.
187 */ 187 */
188 rdpr %pil, %g2 188 rdpr %pil, %g2
189 wrpr %g0, 15, %pil 189 wrpr %g0, PIL_NORMAL_MAX, %pil
190 mov %g1, %g4 190 mov %g1, %g4
191 ba,pt %xcc, etrap_irq 191 ba,pt %xcc, etrap_irq
192 rd %pc, %g7 192 rd %pc, %g7
@@ -216,7 +216,7 @@ sun4v_res_mondo_queue_full:
216 membar #Sync 216 membar #Sync
217 217
218 rdpr %pil, %g2 218 rdpr %pil, %g2
219 wrpr %g0, 15, %pil 219 wrpr %g0, PIL_NORMAL_MAX, %pil
220 ba,pt %xcc, etrap_irq 220 ba,pt %xcc, etrap_irq
221 rd %pc, %g7 221 rd %pc, %g7
222#ifdef CONFIG_TRACE_IRQFLAGS 222#ifdef CONFIG_TRACE_IRQFLAGS
@@ -297,7 +297,7 @@ sun4v_nonres_mondo:
297 * when it's done. 297 * when it's done.
298 */ 298 */
299 rdpr %pil, %g2 299 rdpr %pil, %g2
300 wrpr %g0, 15, %pil 300 wrpr %g0, PIL_NORMAL_MAX, %pil
301 mov %g1, %g4 301 mov %g1, %g4
302 ba,pt %xcc, etrap_irq 302 ba,pt %xcc, etrap_irq
303 rd %pc, %g7 303 rd %pc, %g7
@@ -327,7 +327,7 @@ sun4v_nonres_mondo_queue_full:
327 membar #Sync 327 membar #Sync
328 328
329 rdpr %pil, %g2 329 rdpr %pil, %g2
330 wrpr %g0, 15, %pil 330 wrpr %g0, PIL_NORMAL_MAX, %pil
331 ba,pt %xcc, etrap_irq 331 ba,pt %xcc, etrap_irq
332 rd %pc, %g7 332 rd %pc, %g7
333#ifdef CONFIG_TRACE_IRQFLAGS 333#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/sparc64/kernel/sun4v_tlb_miss.S b/arch/sparc/kernel/sun4v_tlb_miss.S
index e1fbf8c75787..e1fbf8c75787 100644
--- a/arch/sparc64/kernel/sun4v_tlb_miss.S
+++ b/arch/sparc/kernel/sun4v_tlb_miss.S
diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index f061c4dda9ef..f061c4dda9ef 100644
--- a/arch/sparc64/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index e800503879e4..e800503879e4 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc_32.c
index 03035c852a43..03035c852a43 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc_64.c
index 39749e32dc7e..39749e32dc7e 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
diff --git a/arch/sparc64/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index 7a6786a71363..7a6786a71363 100644
--- a/arch/sparc64/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
index 84e5ce146713..d28f496f4669 100644
--- a/arch/sparc64/kernel/sysfs.c
+++ b/arch/sparc/kernel/sysfs.c
@@ -8,6 +8,7 @@
8#include <linux/percpu.h> 8#include <linux/percpu.h>
9#include <linux/init.h> 9#include <linux/init.h>
10 10
11#include <asm/cpudata.h>
11#include <asm/hypervisor.h> 12#include <asm/hypervisor.h>
12#include <asm/spitfire.h> 13#include <asm/spitfire.h>
13 14
diff --git a/arch/sparc64/kernel/systbls.h b/arch/sparc/kernel/systbls.h
index bc9f5dac4069..bc9f5dac4069 100644
--- a/arch/sparc64/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls_32.S
index 7d0807586442..7d0807586442 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls_32.S
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc/kernel/systbls_64.S
index 9fc78cf354bd..9fc78cf354bd 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls_64.S
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time_32.c
index 00f7383c7657..00f7383c7657 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time_32.c
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc/kernel/time_64.c
index 141da3759091..141da3759091 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc/kernel/time_64.c
diff --git a/arch/sparc/kernel/trampoline.S b/arch/sparc/kernel/trampoline_32.S
index 5e235c52d667..5e235c52d667 100644
--- a/arch/sparc/kernel/trampoline.S
+++ b/arch/sparc/kernel/trampoline_32.S
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc/kernel/trampoline_64.S
index 83abd5ae88a4..da1b781b5e65 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc/kernel/trampoline_64.S
@@ -109,7 +109,6 @@ startup_continue:
109 */ 109 */
110 sethi %hi(prom_entry_lock), %g2 110 sethi %hi(prom_entry_lock), %g2
1111: ldstub [%g2 + %lo(prom_entry_lock)], %g1 1111: ldstub [%g2 + %lo(prom_entry_lock)], %g1
112 membar #StoreLoad | #StoreStore
113 brnz,pn %g1, 1b 112 brnz,pn %g1, 1b
114 nop 113 nop
115 114
@@ -214,7 +213,6 @@ startup_continue:
214 213
215 sethi %hi(prom_entry_lock), %g2 214 sethi %hi(prom_entry_lock), %g2
216 stb %g0, [%g2 + %lo(prom_entry_lock)] 215 stb %g0, [%g2 + %lo(prom_entry_lock)]
217 membar #StoreStore | #StoreLoad
218 216
219 ba,pt %xcc, after_lock_tlb 217 ba,pt %xcc, after_lock_tlb
220 nop 218 nop
@@ -330,7 +328,6 @@ after_lock_tlb:
330 328
331 sethi %hi(prom_entry_lock), %g2 329 sethi %hi(prom_entry_lock), %g2
3321: ldstub [%g2 + %lo(prom_entry_lock)], %g1 3301: ldstub [%g2 + %lo(prom_entry_lock)], %g1
333 membar #StoreLoad | #StoreStore
334 brnz,pn %g1, 1b 331 brnz,pn %g1, 1b
335 nop 332 nop
336 333
@@ -394,7 +391,6 @@ after_lock_tlb:
394 391
3953: sethi %hi(prom_entry_lock), %g2 3923: sethi %hi(prom_entry_lock), %g2
396 stb %g0, [%g2 + %lo(prom_entry_lock)] 393 stb %g0, [%g2 + %lo(prom_entry_lock)]
397 membar #StoreStore | #StoreLoad
398 394
399 ldx [%l0], %g6 395 ldx [%l0], %g6
400 ldx [%g6 + TI_TASK], %g4 396 ldx [%g6 + TI_TASK], %g4
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps_32.c
index 2b7d50659036..716f3946c494 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps_32.c
@@ -25,31 +25,10 @@
25#include <asm/unistd.h> 25#include <asm/unistd.h>
26#include <asm/traps.h> 26#include <asm/traps.h>
27 27
28/* #define TRAP_DEBUG */ 28#include "entry.h"
29 29#include "kernel.h"
30struct trap_trace_entry {
31 unsigned long pc;
32 unsigned long type;
33};
34
35void syscall_trace_entry(struct pt_regs *regs)
36{
37 printk("%s[%d]: ", current->comm, task_pid_nr(current));
38 printk("scall<%d> (could be %d)\n", (int) regs->u_regs[UREG_G1],
39 (int) regs->u_regs[UREG_I0]);
40}
41
42void syscall_trace_exit(struct pt_regs *regs)
43{
44}
45 30
46void sun4d_nmi(struct pt_regs *regs) 31/* #define TRAP_DEBUG */
47{
48 printk("Aieee: sun4d NMI received!\n");
49 printk("you lose buddy boy...\n");
50 show_regs(regs);
51 prom_halt();
52}
53 32
54static void instruction_dump(unsigned long *pc) 33static void instruction_dump(unsigned long *pc)
55{ 34{
@@ -134,7 +113,6 @@ void do_hw_interrupt(struct pt_regs *regs, unsigned long type)
134void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc, 113void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc,
135 unsigned long psr) 114 unsigned long psr)
136{ 115{
137 extern int do_user_muldiv (struct pt_regs *, unsigned long);
138 siginfo_t info; 116 siginfo_t info;
139 117
140 if(psr & PSR_PS) 118 if(psr & PSR_PS)
@@ -195,10 +173,6 @@ void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, unsigned lon
195 send_sig_info(SIGBUS, &info, current); 173 send_sig_info(SIGBUS, &info, current);
196} 174}
197 175
198extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
199 void *fpqueue, unsigned long *fpqdepth);
200extern void fpload(unsigned long *fpregs, unsigned long *fsr);
201
202static unsigned long init_fsr = 0x0UL; 176static unsigned long init_fsr = 0x0UL;
203static unsigned long init_fregs[32] __attribute__ ((aligned (8))) = 177static unsigned long init_fregs[32] __attribute__ ((aligned (8))) =
204 { ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, 178 { ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL,
@@ -456,8 +430,6 @@ void do_BUG(const char *file, int line)
456 * up here so that timer interrupts work during initialization. 430 * up here so that timer interrupts work during initialization.
457 */ 431 */
458 432
459extern void sparc_cpu_startup(void);
460
461void trap_init(void) 433void trap_init(void)
462{ 434{
463 extern void thread_info_offsets_are_bolixed_pete(void); 435 extern void thread_info_offsets_are_bolixed_pete(void);
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc/kernel/traps_64.c
index 81ccd22e78d4..4638af2f55a0 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -1371,7 +1371,6 @@ static int cheetah_fix_ce(unsigned long physaddr)
1371 __asm__ __volatile__("ldxa [%0] %3, %%g0\n\t" 1371 __asm__ __volatile__("ldxa [%0] %3, %%g0\n\t"
1372 "ldxa [%1] %3, %%g0\n\t" 1372 "ldxa [%1] %3, %%g0\n\t"
1373 "casxa [%2] %3, %%g0, %%g0\n\t" 1373 "casxa [%2] %3, %%g0, %%g0\n\t"
1374 "membar #StoreLoad | #StoreStore\n\t"
1375 "ldxa [%0] %3, %%g0\n\t" 1374 "ldxa [%0] %3, %%g0\n\t"
1376 "ldxa [%1] %3, %%g0\n\t" 1375 "ldxa [%1] %3, %%g0\n\t"
1377 "membar #Sync" 1376 "membar #Sync"
@@ -1833,7 +1832,7 @@ static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent,
1833 } 1832 }
1834} 1833}
1835 1834
1836/* We run with %pil set to 15 and PSTATE_IE enabled in %pstate. 1835/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
1837 * Log the event and clear the first word of the entry. 1836 * Log the event and clear the first word of the entry.
1838 */ 1837 */
1839void sun4v_resum_error(struct pt_regs *regs, unsigned long offset) 1838void sun4v_resum_error(struct pt_regs *regs, unsigned long offset)
@@ -1881,7 +1880,7 @@ void sun4v_resum_overflow(struct pt_regs *regs)
1881 atomic_inc(&sun4v_resum_oflow_cnt); 1880 atomic_inc(&sun4v_resum_oflow_cnt);
1882} 1881}
1883 1882
1884/* We run with %pil set to 15 and PSTATE_IE enabled in %pstate. 1883/* We run with %pil set to PIL_NORMAL_MAX and PSTATE_IE enabled in %pstate.
1885 * Log the event, clear the first word of the entry, and die. 1884 * Log the event, clear the first word of the entry, and die.
1886 */ 1885 */
1887void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset) 1886void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset)
diff --git a/arch/sparc64/kernel/tsb.S b/arch/sparc/kernel/tsb.S
index c499214b501d..8c91d9b29a2f 100644
--- a/arch/sparc64/kernel/tsb.S
+++ b/arch/sparc/kernel/tsb.S
@@ -317,7 +317,7 @@ tsb_flush:
317 srlx %g1, 32, %o3 317 srlx %g1, 32, %o3
318 andcc %o3, %g2, %g0 318 andcc %o3, %g2, %g0
319 bne,pn %icc, 1b 319 bne,pn %icc, 1b
320 membar #LoadLoad 320 nop
321 cmp %g1, %o1 321 cmp %g1, %o1
322 mov 1, %o3 322 mov 1, %o3
323 bne,pt %xcc, 2f 323 bne,pt %xcc, 2f
@@ -327,7 +327,7 @@ tsb_flush:
327 bne,pn %xcc, 1b 327 bne,pn %xcc, 1b
328 nop 328 nop
3292: retl 3292: retl
330 TSB_MEMBAR 330 nop
331 .size tsb_flush, .-tsb_flush 331 .size tsb_flush, .-tsb_flush
332 332
333 /* Reload MMU related context switch state at 333 /* Reload MMU related context switch state at
@@ -478,7 +478,7 @@ copy_tsb: /* %o0=old_tsb_base, %o1=old_tsb_size
478 nop 478 nop
479 479
480 retl 480 retl
481 TSB_MEMBAR 481 nop
482 .size copy_tsb, .-copy_tsb 482 .size copy_tsb, .-copy_tsb
483 483
484 /* Set the invalid bit in all TSB entries. */ 484 /* Set the invalid bit in all TSB entries. */
diff --git a/arch/sparc64/kernel/ttable.S b/arch/sparc/kernel/ttable.S
index 1ade3d6fb7fc..ea925503b42e 100644
--- a/arch/sparc64/kernel/ttable.S
+++ b/arch/sparc/kernel/ttable.S
@@ -66,7 +66,7 @@ tl0_irq6: BTRAP(0x46)
66tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49) 66tl0_irq7: BTRAP(0x47) BTRAP(0x48) BTRAP(0x49)
67tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d) 67tl0_irq10: BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d)
68tl0_irq14: TRAP_IRQ(timer_interrupt, 14) 68tl0_irq14: TRAP_IRQ(timer_interrupt, 14)
69tl0_irq15: TRAP_IRQ(handler_irq, 15) 69tl0_irq15: TRAP_NMI_IRQ(perfctr_irq, 15)
70tl0_resv050: BTRAP(0x50) BTRAP(0x51) BTRAP(0x52) BTRAP(0x53) BTRAP(0x54) BTRAP(0x55) 70tl0_resv050: BTRAP(0x50) BTRAP(0x51) BTRAP(0x52) BTRAP(0x53) BTRAP(0x54) BTRAP(0x55)
71tl0_resv056: BTRAP(0x56) BTRAP(0x57) BTRAP(0x58) BTRAP(0x59) BTRAP(0x5a) BTRAP(0x5b) 71tl0_resv056: BTRAP(0x56) BTRAP(0x57) BTRAP(0x58) BTRAP(0x59) BTRAP(0x5a) BTRAP(0x5b)
72tl0_resv05c: BTRAP(0x5c) BTRAP(0x5d) BTRAP(0x5e) BTRAP(0x5f) 72tl0_resv05c: BTRAP(0x5c) BTRAP(0x5d) BTRAP(0x5e) BTRAP(0x5f)
diff --git a/arch/sparc/kernel/una_asm.S b/arch/sparc/kernel/una_asm_32.S
index 8cc03458eb7e..8cc03458eb7e 100644
--- a/arch/sparc/kernel/una_asm.S
+++ b/arch/sparc/kernel/una_asm_32.S
diff --git a/arch/sparc64/kernel/una_asm.S b/arch/sparc/kernel/una_asm_64.S
index be183fe41443..be183fe41443 100644
--- a/arch/sparc64/kernel/una_asm.S
+++ b/arch/sparc/kernel/una_asm_64.S
diff --git a/arch/sparc/kernel/unaligned.c b/arch/sparc/kernel/unaligned_32.c
index c2a28c5ad650..c2a28c5ad650 100644
--- a/arch/sparc/kernel/unaligned.c
+++ b/arch/sparc/kernel/unaligned_32.c
diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc/kernel/unaligned_64.c
index 203ddfad9f27..203ddfad9f27 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc/kernel/unaligned_64.c
diff --git a/arch/sparc64/kernel/us2e_cpufreq.c b/arch/sparc/kernel/us2e_cpufreq.c
index 791c15138f3a..791c15138f3a 100644
--- a/arch/sparc64/kernel/us2e_cpufreq.c
+++ b/arch/sparc/kernel/us2e_cpufreq.c
diff --git a/arch/sparc64/kernel/us3_cpufreq.c b/arch/sparc/kernel/us3_cpufreq.c
index 365b6464e2ce..365b6464e2ce 100644
--- a/arch/sparc64/kernel/us3_cpufreq.c
+++ b/arch/sparc/kernel/us3_cpufreq.c
diff --git a/arch/sparc64/kernel/utrap.S b/arch/sparc/kernel/utrap.S
index b7f0f3f3a909..b7f0f3f3a909 100644
--- a/arch/sparc64/kernel/utrap.S
+++ b/arch/sparc/kernel/utrap.S
diff --git a/arch/sparc64/kernel/vio.c b/arch/sparc/kernel/vio.c
index 92b1f8ec01de..92b1f8ec01de 100644
--- a/arch/sparc64/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
diff --git a/arch/sparc64/kernel/viohs.c b/arch/sparc/kernel/viohs.c
index 708fa1705fbe..708fa1705fbe 100644
--- a/arch/sparc64/kernel/viohs.c
+++ b/arch/sparc/kernel/viohs.c
diff --git a/arch/sparc64/kernel/visemul.c b/arch/sparc/kernel/visemul.c
index b956fd71c131..b956fd71c131 100644
--- a/arch/sparc64/kernel/visemul.c
+++ b/arch/sparc/kernel/visemul.c
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 5b7e69a8c32f..76267085b13b 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -1,27 +1,56 @@
1/* ld script to make SparcLinux kernel */ 1/* ld script for sparc32/sparc64 kernel */
2 2
3#include <asm-generic/vmlinux.lds.h> 3#include <asm-generic/vmlinux.lds.h>
4
4#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/thread_info.h>
7
8#ifdef CONFIG_SPARC32
9#define INITIAL_ADDRESS 0x10000 + SIZEOF_HEADERS
10#define TEXTSTART 0xf0004000
11
12#define SMP_CACHE_BYTES_SHIFT 5
13
14#else
15#define SMP_CACHE_BYTES_SHIFT 6
16#define INITIAL_ADDRESS 0x4000
17#define TEXTSTART 0x0000000000404000
18
19#endif
20
21#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT)
5 22
23#ifdef CONFIG_SPARC32
6OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc") 24OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparc")
7OUTPUT_ARCH(sparc) 25OUTPUT_ARCH(sparc)
8ENTRY(_start) 26ENTRY(_start)
9jiffies = jiffies_64 + 4; 27jiffies = jiffies_64 + 4;
28#else
29/* sparc64 */
30OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
31OUTPUT_ARCH(sparc:v9a)
32ENTRY(_start)
33jiffies = jiffies_64;
34#endif
35
10SECTIONS 36SECTIONS
11{ 37{
12 . = 0x10000 + SIZEOF_HEADERS; 38 /* swapper_low_pmd_dir is sparc64 only */
13 .text 0xf0004000 : 39 swapper_low_pmd_dir = 0x0000000000402000;
40 . = INITIAL_ADDRESS;
41 .text TEXTSTART :
14 { 42 {
15 _text = .; 43 _text = .;
16 *(.text.head) 44 *(.text.head)
17 TEXT_TEXT 45 TEXT_TEXT
18 SCHED_TEXT 46 SCHED_TEXT
19 LOCK_TEXT 47 LOCK_TEXT
48 KPROBES_TEXT
20 *(.gnu.warning) 49 *(.gnu.warning)
21 } = 0 50 } = 0
22 _etext = .; 51 _etext = .;
23 PROVIDE (etext = .); 52
24 RODATA 53 RO_DATA(PAGE_SIZE)
25 .data : { 54 .data : {
26 DATA_DATA 55 DATA_DATA
27 CONSTRUCTORS 56 CONSTRUCTORS
@@ -29,25 +58,38 @@ SECTIONS
29 .data1 : { 58 .data1 : {
30 *(.data1) 59 *(.data1)
31 } 60 }
61 . = ALIGN(SMP_CACHE_BYTES);
62 .data.cacheline_aligned : {
63 *(.data.cacheline_aligned)
64 }
65 . = ALIGN(SMP_CACHE_BYTES);
66 .data.read_mostly : {
67 *(.data.read_mostly)
68 }
69 /* End of data section */
32 _edata = .; 70 _edata = .;
33 PROVIDE (edata = .);
34 71
72 /* init_task */
73 . = ALIGN(THREAD_SIZE);
74 .data.init_task : {
75 *(.data.init_task)
76 }
35 .fixup : { 77 .fixup : {
36 __start___fixup = .; 78 __start___fixup = .;
37 *(.fixup) 79 *(.fixup)
38 __stop___fixup = .; 80 __stop___fixup = .;
39 } 81 }
82 . = ALIGN(16);
40 __ex_table : { 83 __ex_table : {
41 __start___ex_table = .; 84 __start___ex_table = .;
42 *(__ex_table) 85 *(__ex_table)
43 __stop___ex_table = .; 86 __stop___ex_table = .;
44 } 87 }
45
46 NOTES 88 NOTES
47 89
48 . = ALIGN(PAGE_SIZE); 90 . = ALIGN(PAGE_SIZE);
49 __init_begin = .;
50 .init.text : { 91 .init.text : {
92 __init_begin = .;
51 _sinittext = .; 93 _sinittext = .;
52 INIT_TEXT 94 INIT_TEXT
53 _einittext = .; 95 _einittext = .;
@@ -65,7 +107,7 @@ SECTIONS
65 .initcall.init : { 107 .initcall.init : {
66 __initcall_start = .; 108 __initcall_start = .;
67 INITCALLS 109 INITCALLS
68 __initcall_end = .; 110 __initcall_end = .;
69 } 111 }
70 .con_initcall.init : { 112 .con_initcall.init : {
71 __con_initcall_start = .; 113 __con_initcall_start = .;
@@ -74,38 +116,61 @@ SECTIONS
74 } 116 }
75 SECURITY_INIT 117 SECURITY_INIT
76 118
119 . = ALIGN(4);
120 .tsb_ldquad_phys_patch : {
121 __tsb_ldquad_phys_patch = .;
122 *(.tsb_ldquad_phys_patch)
123 __tsb_ldquad_phys_patch_end = .;
124 }
125
126 .tsb_phys_patch : {
127 __tsb_phys_patch = .;
128 *(.tsb_phys_patch)
129 __tsb_phys_patch_end = .;
130 }
131
132 .cpuid_patch : {
133 __cpuid_patch = .;
134 *(.cpuid_patch)
135 __cpuid_patch_end = .;
136 }
137
138 .sun4v_1insn_patch : {
139 __sun4v_1insn_patch = .;
140 *(.sun4v_1insn_patch)
141 __sun4v_1insn_patch_end = .;
142 }
143 .sun4v_2insn_patch : {
144 __sun4v_2insn_patch = .;
145 *(.sun4v_2insn_patch)
146 __sun4v_2insn_patch_end = .;
147 }
148
77#ifdef CONFIG_BLK_DEV_INITRD 149#ifdef CONFIG_BLK_DEV_INITRD
78 . = ALIGN(PAGE_SIZE); 150 . = ALIGN(PAGE_SIZE);
79 .init.ramfs : { 151 .init.ramfs : {
80 __initramfs_start = .; 152 __initramfs_start = .;
81 *(.init.ramfs) 153 *(.init.ramfs)
82 __initramfs_end = .; 154 __initramfs_end = .;
83 } 155 }
84#endif 156#endif
85 157
86 PERCPU(PAGE_SIZE) 158 PERCPU(PAGE_SIZE)
159
87 . = ALIGN(PAGE_SIZE); 160 . = ALIGN(PAGE_SIZE);
88 __init_end = .; 161 __init_end = .;
89 . = ALIGN(32);
90 .data.cacheline_aligned : {
91 *(.data.cacheline_aligned)
92 }
93 . = ALIGN(32);
94 .data.read_mostly : {
95 *(.data.read_mostly)
96 }
97
98 __bss_start = .; 162 __bss_start = .;
99 .sbss : { 163 .sbss : {
100 *(.sbss) 164 *(.sbss)
101 *(.scommon) } 165 *(.scommon)
166 }
102 .bss : { 167 .bss : {
103 *(.dynbss) 168 *(.dynbss)
104 *(.bss) 169 *(.bss)
105 *(COMMON) 170 *(COMMON)
106 } 171 }
107 _end = . ; 172 _end = . ;
108 PROVIDE (end = .); 173
109 /DISCARD/ : { 174 /DISCARD/ : {
110 EXIT_TEXT 175 EXIT_TEXT
111 EXIT_DATA 176 EXIT_DATA
diff --git a/arch/sparc64/kernel/winfixup.S b/arch/sparc/kernel/winfixup.S
index a6b0863c27df..a6b0863c27df 100644
--- a/arch/sparc64/kernel/winfixup.S
+++ b/arch/sparc/kernel/winfixup.S
diff --git a/arch/sparc64/lib/GENbzero.S b/arch/sparc/lib/GENbzero.S
index 6a4f956a2f7a..6a4f956a2f7a 100644
--- a/arch/sparc64/lib/GENbzero.S
+++ b/arch/sparc/lib/GENbzero.S
diff --git a/arch/sparc64/lib/GENcopy_from_user.S b/arch/sparc/lib/GENcopy_from_user.S
index 2b9df99e87f9..2b9df99e87f9 100644
--- a/arch/sparc64/lib/GENcopy_from_user.S
+++ b/arch/sparc/lib/GENcopy_from_user.S
diff --git a/arch/sparc64/lib/GENcopy_to_user.S b/arch/sparc/lib/GENcopy_to_user.S
index bb3f7084daf9..bb3f7084daf9 100644
--- a/arch/sparc64/lib/GENcopy_to_user.S
+++ b/arch/sparc/lib/GENcopy_to_user.S
diff --git a/arch/sparc64/lib/GENmemcpy.S b/arch/sparc/lib/GENmemcpy.S
index 89358ee94851..89358ee94851 100644
--- a/arch/sparc64/lib/GENmemcpy.S
+++ b/arch/sparc/lib/GENmemcpy.S
diff --git a/arch/sparc64/lib/GENpage.S b/arch/sparc/lib/GENpage.S
index 2ef9d05f21bc..2ef9d05f21bc 100644
--- a/arch/sparc64/lib/GENpage.S
+++ b/arch/sparc/lib/GENpage.S
diff --git a/arch/sparc64/lib/GENpatch.S b/arch/sparc/lib/GENpatch.S
index fab9e89f16bd..fab9e89f16bd 100644
--- a/arch/sparc64/lib/GENpatch.S
+++ b/arch/sparc/lib/GENpatch.S
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index 6e303e10c3b9..375016e19144 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -1,13 +1,44 @@
1# Makefile for Sparc library files.. 1# Makefile for Sparc library files..
2# 2#
3 3
4EXTRA_AFLAGS := -ansi -DST_DIV0=0x02 4asflags-y := -ansi -DST_DIV0=0x02
5ccflags-y := -Werror
5 6
6lib-y := mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \ 7lib-$(CONFIG_SPARC32) += mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o
7 strlen.o checksum.o blockops.o memscan.o memcmp.o strncmp.o \ 8lib-$(CONFIG_SPARC32) += memcpy.o memset.o
8 strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \ 9lib-y += strlen.o
9 copy_user.o locks.o atomic.o \ 10lib-y += checksum_$(BITS).o
10 lshrdi3.o ashldi3.o rwsem.o muldi3.o bitext.o \ 11lib-$(CONFIG_SPARC32) += blockops.o
11 cmpdi2.o 12lib-y += memscan_$(BITS).o memcmp.o strncmp_$(BITS).o
13lib-y += strncpy_from_user_$(BITS).o strlen_user_$(BITS).o
14lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o
15lib-$(CONFIG_SPARC32) += copy_user.o locks.o
16lib-y += atomic_$(BITS).o
17lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o
18lib-y += rwsem_$(BITS).o
19lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o
12 20
13obj-y += iomap.o atomic32.o 21lib-$(CONFIG_SPARC64) += PeeCeeI.o copy_page.o clear_page.o bzero.o
22lib-$(CONFIG_SPARC64) += csum_copy.o csum_copy_from_user.o csum_copy_to_user.o
23lib-$(CONFIG_SPARC64) += VISsave.o
24lib-$(CONFIG_SPARC64) += bitops.o
25
26lib-$(CONFIG_SPARC64) += U1memcpy.o U1copy_from_user.o U1copy_to_user.o
27
28lib-$(CONFIG_SPARC64) += U3memcpy.o U3copy_from_user.o U3copy_to_user.o
29lib-$(CONFIG_SPARC64) += U3patch.o
30
31lib-$(CONFIG_SPARC64) += NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o
32lib-$(CONFIG_SPARC64) += NGpatch.o NGpage.o NGbzero.o
33
34lib-$(CONFIG_SPARC64) += NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o
35lib-$(CONFIG_SPARC64) += NG2patch.o NG2page.o
36
37lib-$(CONFIG_SPARC64) += GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o
38lib-$(CONFIG_SPARC64) += GENpatch.o GENpage.o GENbzero.o
39
40lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o
41lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o
42
43obj-y += iomap.o
44obj-$(CONFIG_SPARC32) += atomic32.o
diff --git a/arch/sparc64/lib/NG2copy_from_user.S b/arch/sparc/lib/NG2copy_from_user.S
index c77ef5f22102..c77ef5f22102 100644
--- a/arch/sparc64/lib/NG2copy_from_user.S
+++ b/arch/sparc/lib/NG2copy_from_user.S
diff --git a/arch/sparc64/lib/NG2copy_to_user.S b/arch/sparc/lib/NG2copy_to_user.S
index 4bd4093acbbd..4bd4093acbbd 100644
--- a/arch/sparc64/lib/NG2copy_to_user.S
+++ b/arch/sparc/lib/NG2copy_to_user.S
diff --git a/arch/sparc64/lib/NG2memcpy.S b/arch/sparc/lib/NG2memcpy.S
index 0aed75653b50..0aed75653b50 100644
--- a/arch/sparc64/lib/NG2memcpy.S
+++ b/arch/sparc/lib/NG2memcpy.S
diff --git a/arch/sparc64/lib/NG2page.S b/arch/sparc/lib/NG2page.S
index 73b6b7c72cbf..73b6b7c72cbf 100644
--- a/arch/sparc64/lib/NG2page.S
+++ b/arch/sparc/lib/NG2page.S
diff --git a/arch/sparc64/lib/NG2patch.S b/arch/sparc/lib/NG2patch.S
index 28c36f06a6d1..28c36f06a6d1 100644
--- a/arch/sparc64/lib/NG2patch.S
+++ b/arch/sparc/lib/NG2patch.S
diff --git a/arch/sparc64/lib/NGbzero.S b/arch/sparc/lib/NGbzero.S
index 814d5f7a45e1..814d5f7a45e1 100644
--- a/arch/sparc64/lib/NGbzero.S
+++ b/arch/sparc/lib/NGbzero.S
diff --git a/arch/sparc64/lib/NGcopy_from_user.S b/arch/sparc/lib/NGcopy_from_user.S
index e7f433f71b42..e7f433f71b42 100644
--- a/arch/sparc64/lib/NGcopy_from_user.S
+++ b/arch/sparc/lib/NGcopy_from_user.S
diff --git a/arch/sparc64/lib/NGcopy_to_user.S b/arch/sparc/lib/NGcopy_to_user.S
index 6ea01c5532a0..6ea01c5532a0 100644
--- a/arch/sparc64/lib/NGcopy_to_user.S
+++ b/arch/sparc/lib/NGcopy_to_user.S
diff --git a/arch/sparc64/lib/NGmemcpy.S b/arch/sparc/lib/NGmemcpy.S
index 96a14caf6966..96a14caf6966 100644
--- a/arch/sparc64/lib/NGmemcpy.S
+++ b/arch/sparc/lib/NGmemcpy.S
diff --git a/arch/sparc64/lib/NGpage.S b/arch/sparc/lib/NGpage.S
index 428920de05ba..428920de05ba 100644
--- a/arch/sparc64/lib/NGpage.S
+++ b/arch/sparc/lib/NGpage.S
diff --git a/arch/sparc64/lib/NGpatch.S b/arch/sparc/lib/NGpatch.S
index 3b0674fc3366..3b0674fc3366 100644
--- a/arch/sparc64/lib/NGpatch.S
+++ b/arch/sparc/lib/NGpatch.S
diff --git a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc/lib/PeeCeeI.c
index 46053e6ddd7b..46053e6ddd7b 100644
--- a/arch/sparc64/lib/PeeCeeI.c
+++ b/arch/sparc/lib/PeeCeeI.c
diff --git a/arch/sparc64/lib/U1copy_from_user.S b/arch/sparc/lib/U1copy_from_user.S
index 3192b0bf4fab..3192b0bf4fab 100644
--- a/arch/sparc64/lib/U1copy_from_user.S
+++ b/arch/sparc/lib/U1copy_from_user.S
diff --git a/arch/sparc64/lib/U1copy_to_user.S b/arch/sparc/lib/U1copy_to_user.S
index d1210ffb0b82..d1210ffb0b82 100644
--- a/arch/sparc64/lib/U1copy_to_user.S
+++ b/arch/sparc/lib/U1copy_to_user.S
diff --git a/arch/sparc64/lib/U1memcpy.S b/arch/sparc/lib/U1memcpy.S
index bafd2fc07acb..bafd2fc07acb 100644
--- a/arch/sparc64/lib/U1memcpy.S
+++ b/arch/sparc/lib/U1memcpy.S
diff --git a/arch/sparc64/lib/U3copy_from_user.S b/arch/sparc/lib/U3copy_from_user.S
index f5bfc8d9d216..f5bfc8d9d216 100644
--- a/arch/sparc64/lib/U3copy_from_user.S
+++ b/arch/sparc/lib/U3copy_from_user.S
diff --git a/arch/sparc64/lib/U3copy_to_user.S b/arch/sparc/lib/U3copy_to_user.S
index 2334f111bb0c..2334f111bb0c 100644
--- a/arch/sparc64/lib/U3copy_to_user.S
+++ b/arch/sparc/lib/U3copy_to_user.S
diff --git a/arch/sparc64/lib/U3memcpy.S b/arch/sparc/lib/U3memcpy.S
index 7cae9cc6a204..7cae9cc6a204 100644
--- a/arch/sparc64/lib/U3memcpy.S
+++ b/arch/sparc/lib/U3memcpy.S
diff --git a/arch/sparc64/lib/U3patch.S b/arch/sparc/lib/U3patch.S
index ecc302619a6e..ecc302619a6e 100644
--- a/arch/sparc64/lib/U3patch.S
+++ b/arch/sparc/lib/U3patch.S
diff --git a/arch/sparc64/lib/VISsave.S b/arch/sparc/lib/VISsave.S
index b320ae9e2e2e..b320ae9e2e2e 100644
--- a/arch/sparc64/lib/VISsave.S
+++ b/arch/sparc/lib/VISsave.S
diff --git a/arch/sparc/lib/atomic.S b/arch/sparc/lib/atomic_32.S
index 178cbb8ae1b9..178cbb8ae1b9 100644
--- a/arch/sparc/lib/atomic.S
+++ b/arch/sparc/lib/atomic_32.S
diff --git a/arch/sparc64/lib/atomic.S b/arch/sparc/lib/atomic_64.S
index 70ac4186f62b..0268210ca168 100644
--- a/arch/sparc64/lib/atomic.S
+++ b/arch/sparc/lib/atomic_64.S
@@ -43,29 +43,10 @@ atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
432: BACKOFF_SPIN(%o2, %o3, 1b) 432: BACKOFF_SPIN(%o2, %o3, 1b)
44 .size atomic_sub, .-atomic_sub 44 .size atomic_sub, .-atomic_sub
45 45
46 /* On SMP we need to use memory barriers to ensure
47 * correct memory operation ordering, nop these out
48 * for uniprocessor.
49 */
50#ifdef CONFIG_SMP
51
52#define ATOMIC_PRE_BARRIER membar #StoreLoad | #LoadLoad;
53#define ATOMIC_POST_BARRIER \
54 ba,pt %xcc, 80b; \
55 membar #StoreLoad | #StoreStore
56
5780: retl
58 nop
59#else
60#define ATOMIC_PRE_BARRIER
61#define ATOMIC_POST_BARRIER
62#endif
63
64 .globl atomic_add_ret 46 .globl atomic_add_ret
65 .type atomic_add_ret,#function 47 .type atomic_add_ret,#function
66atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 48atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
67 BACKOFF_SETUP(%o2) 49 BACKOFF_SETUP(%o2)
68 ATOMIC_PRE_BARRIER
691: lduw [%o1], %g1 501: lduw [%o1], %g1
70 add %g1, %o0, %g7 51 add %g1, %o0, %g7
71 cas [%o1], %g1, %g7 52 cas [%o1], %g1, %g7
@@ -73,7 +54,6 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
73 bne,pn %icc, 2f 54 bne,pn %icc, 2f
74 add %g7, %o0, %g7 55 add %g7, %o0, %g7
75 sra %g7, 0, %o0 56 sra %g7, 0, %o0
76 ATOMIC_POST_BARRIER
77 retl 57 retl
78 nop 58 nop
792: BACKOFF_SPIN(%o2, %o3, 1b) 592: BACKOFF_SPIN(%o2, %o3, 1b)
@@ -83,7 +63,6 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
83 .type atomic_sub_ret,#function 63 .type atomic_sub_ret,#function
84atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 64atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
85 BACKOFF_SETUP(%o2) 65 BACKOFF_SETUP(%o2)
86 ATOMIC_PRE_BARRIER
871: lduw [%o1], %g1 661: lduw [%o1], %g1
88 sub %g1, %o0, %g7 67 sub %g1, %o0, %g7
89 cas [%o1], %g1, %g7 68 cas [%o1], %g1, %g7
@@ -91,7 +70,6 @@ atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
91 bne,pn %icc, 2f 70 bne,pn %icc, 2f
92 sub %g7, %o0, %g7 71 sub %g7, %o0, %g7
93 sra %g7, 0, %o0 72 sra %g7, 0, %o0
94 ATOMIC_POST_BARRIER
95 retl 73 retl
96 nop 74 nop
972: BACKOFF_SPIN(%o2, %o3, 1b) 752: BACKOFF_SPIN(%o2, %o3, 1b)
@@ -131,7 +109,6 @@ atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */
131 .type atomic64_add_ret,#function 109 .type atomic64_add_ret,#function
132atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 110atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
133 BACKOFF_SETUP(%o2) 111 BACKOFF_SETUP(%o2)
134 ATOMIC_PRE_BARRIER
1351: ldx [%o1], %g1 1121: ldx [%o1], %g1
136 add %g1, %o0, %g7 113 add %g1, %o0, %g7
137 casx [%o1], %g1, %g7 114 casx [%o1], %g1, %g7
@@ -139,7 +116,6 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
139 bne,pn %xcc, 2f 116 bne,pn %xcc, 2f
140 add %g7, %o0, %g7 117 add %g7, %o0, %g7
141 mov %g7, %o0 118 mov %g7, %o0
142 ATOMIC_POST_BARRIER
143 retl 119 retl
144 nop 120 nop
1452: BACKOFF_SPIN(%o2, %o3, 1b) 1212: BACKOFF_SPIN(%o2, %o3, 1b)
@@ -149,7 +125,6 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
149 .type atomic64_sub_ret,#function 125 .type atomic64_sub_ret,#function
150atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 126atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
151 BACKOFF_SETUP(%o2) 127 BACKOFF_SETUP(%o2)
152 ATOMIC_PRE_BARRIER
1531: ldx [%o1], %g1 1281: ldx [%o1], %g1
154 sub %g1, %o0, %g7 129 sub %g1, %o0, %g7
155 casx [%o1], %g1, %g7 130 casx [%o1], %g1, %g7
@@ -157,7 +132,6 @@ atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
157 bne,pn %xcc, 2f 132 bne,pn %xcc, 2f
158 sub %g7, %o0, %g7 133 sub %g7, %o0, %g7
159 mov %g7, %o0 134 mov %g7, %o0
160 ATOMIC_POST_BARRIER
161 retl 135 retl
162 nop 136 nop
1632: BACKOFF_SPIN(%o2, %o3, 1b) 1372: BACKOFF_SPIN(%o2, %o3, 1b)
diff --git a/arch/sparc64/lib/bitops.S b/arch/sparc/lib/bitops.S
index 6b015a6eefb5..2b7228cb8c22 100644
--- a/arch/sparc64/lib/bitops.S
+++ b/arch/sparc/lib/bitops.S
@@ -8,29 +8,10 @@
8 8
9 .text 9 .text
10 10
11 /* On SMP we need to use memory barriers to ensure
12 * correct memory operation ordering, nop these out
13 * for uniprocessor.
14 */
15
16#ifdef CONFIG_SMP
17#define BITOP_PRE_BARRIER membar #StoreLoad | #LoadLoad
18#define BITOP_POST_BARRIER \
19 ba,pt %xcc, 80b; \
20 membar #StoreLoad | #StoreStore
21
2280: retl
23 nop
24#else
25#define BITOP_PRE_BARRIER
26#define BITOP_POST_BARRIER
27#endif
28
29 .globl test_and_set_bit 11 .globl test_and_set_bit
30 .type test_and_set_bit,#function 12 .type test_and_set_bit,#function
31test_and_set_bit: /* %o0=nr, %o1=addr */ 13test_and_set_bit: /* %o0=nr, %o1=addr */
32 BACKOFF_SETUP(%o3) 14 BACKOFF_SETUP(%o3)
33 BITOP_PRE_BARRIER
34 srlx %o0, 6, %g1 15 srlx %o0, 6, %g1
35 mov 1, %o2 16 mov 1, %o2
36 sllx %g1, 3, %g3 17 sllx %g1, 3, %g3
@@ -45,7 +26,6 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
45 and %g7, %o2, %g2 26 and %g7, %o2, %g2
46 clr %o0 27 clr %o0
47 movrne %g2, 1, %o0 28 movrne %g2, 1, %o0
48 BITOP_POST_BARRIER
49 retl 29 retl
50 nop 30 nop
512: BACKOFF_SPIN(%o3, %o4, 1b) 312: BACKOFF_SPIN(%o3, %o4, 1b)
@@ -55,7 +35,6 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
55 .type test_and_clear_bit,#function 35 .type test_and_clear_bit,#function
56test_and_clear_bit: /* %o0=nr, %o1=addr */ 36test_and_clear_bit: /* %o0=nr, %o1=addr */
57 BACKOFF_SETUP(%o3) 37 BACKOFF_SETUP(%o3)
58 BITOP_PRE_BARRIER
59 srlx %o0, 6, %g1 38 srlx %o0, 6, %g1
60 mov 1, %o2 39 mov 1, %o2
61 sllx %g1, 3, %g3 40 sllx %g1, 3, %g3
@@ -70,7 +49,6 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
70 and %g7, %o2, %g2 49 and %g7, %o2, %g2
71 clr %o0 50 clr %o0
72 movrne %g2, 1, %o0 51 movrne %g2, 1, %o0
73 BITOP_POST_BARRIER
74 retl 52 retl
75 nop 53 nop
762: BACKOFF_SPIN(%o3, %o4, 1b) 542: BACKOFF_SPIN(%o3, %o4, 1b)
@@ -80,7 +58,6 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
80 .type test_and_change_bit,#function 58 .type test_and_change_bit,#function
81test_and_change_bit: /* %o0=nr, %o1=addr */ 59test_and_change_bit: /* %o0=nr, %o1=addr */
82 BACKOFF_SETUP(%o3) 60 BACKOFF_SETUP(%o3)
83 BITOP_PRE_BARRIER
84 srlx %o0, 6, %g1 61 srlx %o0, 6, %g1
85 mov 1, %o2 62 mov 1, %o2
86 sllx %g1, 3, %g3 63 sllx %g1, 3, %g3
@@ -95,7 +72,6 @@ test_and_change_bit: /* %o0=nr, %o1=addr */
95 and %g7, %o2, %g2 72 and %g7, %o2, %g2
96 clr %o0 73 clr %o0
97 movrne %g2, 1, %o0 74 movrne %g2, 1, %o0
98 BITOP_POST_BARRIER
99 retl 75 retl
100 nop 76 nop
1012: BACKOFF_SPIN(%o3, %o4, 1b) 772: BACKOFF_SPIN(%o3, %o4, 1b)
diff --git a/arch/sparc64/lib/bzero.S b/arch/sparc/lib/bzero.S
index c7bbae8c590f..c7bbae8c590f 100644
--- a/arch/sparc64/lib/bzero.S
+++ b/arch/sparc/lib/bzero.S
diff --git a/arch/sparc/lib/checksum.S b/arch/sparc/lib/checksum_32.S
index 77f228533d47..77f228533d47 100644
--- a/arch/sparc/lib/checksum.S
+++ b/arch/sparc/lib/checksum_32.S
diff --git a/arch/sparc64/lib/checksum.S b/arch/sparc/lib/checksum_64.S
index 1d230f693dc4..1d230f693dc4 100644
--- a/arch/sparc64/lib/checksum.S
+++ b/arch/sparc/lib/checksum_64.S
diff --git a/arch/sparc64/lib/clear_page.S b/arch/sparc/lib/clear_page.S
index 77e531f6c2a7..77e531f6c2a7 100644
--- a/arch/sparc64/lib/clear_page.S
+++ b/arch/sparc/lib/clear_page.S
diff --git a/arch/sparc64/lib/copy_in_user.S b/arch/sparc/lib/copy_in_user.S
index 650af3f21f78..650af3f21f78 100644
--- a/arch/sparc64/lib/copy_in_user.S
+++ b/arch/sparc/lib/copy_in_user.S
diff --git a/arch/sparc64/lib/copy_page.S b/arch/sparc/lib/copy_page.S
index b243d3b606ba..b243d3b606ba 100644
--- a/arch/sparc64/lib/copy_page.S
+++ b/arch/sparc/lib/copy_page.S
diff --git a/arch/sparc64/lib/csum_copy.S b/arch/sparc/lib/csum_copy.S
index e566c770a0f6..e566c770a0f6 100644
--- a/arch/sparc64/lib/csum_copy.S
+++ b/arch/sparc/lib/csum_copy.S
diff --git a/arch/sparc64/lib/csum_copy_from_user.S b/arch/sparc/lib/csum_copy_from_user.S
index a22eddbe5dba..a22eddbe5dba 100644
--- a/arch/sparc64/lib/csum_copy_from_user.S
+++ b/arch/sparc/lib/csum_copy_from_user.S
diff --git a/arch/sparc64/lib/csum_copy_to_user.S b/arch/sparc/lib/csum_copy_to_user.S
index d5b12f441f02..d5b12f441f02 100644
--- a/arch/sparc64/lib/csum_copy_to_user.S
+++ b/arch/sparc/lib/csum_copy_to_user.S
diff --git a/arch/sparc64/lib/ipcsum.S b/arch/sparc/lib/ipcsum.S
index 58ca5b9a8778..58ca5b9a8778 100644
--- a/arch/sparc64/lib/ipcsum.S
+++ b/arch/sparc/lib/ipcsum.S
diff --git a/arch/sparc64/lib/mcount.S b/arch/sparc/lib/mcount.S
index 7ce9c65f3592..7ce9c65f3592 100644
--- a/arch/sparc64/lib/mcount.S
+++ b/arch/sparc/lib/mcount.S
diff --git a/arch/sparc/lib/memcmp.S b/arch/sparc/lib/memcmp.S
index cb4bdb0cc2af..efa106c41ed0 100644
--- a/arch/sparc/lib/memcmp.S
+++ b/arch/sparc/lib/memcmp.S
@@ -1,312 +1,27 @@
1 .text 1/* Sparc optimized memcmp code.
2 .align 4 2 *
3 .global __memcmp, memcmp 3 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
4__memcmp: 4 * Copyright (C) 2000, 2008 David S. Miller (davem@davemloft.net)
5memcmp: 5 */
6#if 1
7 cmp %o2, 0
8 ble L3
9 mov 0, %g3
10L5:
11 ldub [%o0], %g2
12 ldub [%o1], %g3
13 sub %g2, %g3, %g2
14 mov %g2, %g3
15 sll %g2, 24, %g2
16
17 cmp %g2, 0
18 bne L3
19 add %o0, 1, %o0
20 6
21 add %o2, -1, %o2 7#include <linux/linkage.h>
8#include <asm/asm.h>
22 9
10 .text
11ENTRY(memcmp)
23 cmp %o2, 0 12 cmp %o2, 0
24 bg L5 131: BRANCH32(be, pn, 2f)
25 add %o1, 1, %o1
26L3:
27 sll %g3, 24, %o0
28 sra %o0, 24, %o0
29
30 retl
31 nop 14 nop
32#else 15 ldub [%o0], %g7
33 save %sp, -104, %sp 16 ldub [%o1], %g3
34 mov %i2, %o4 17 sub %o2, 1, %o2
35 mov %i0, %o0
36
37 cmp %o4, 15
38 ble L72
39 mov %i1, %i2
40
41 andcc %i2, 3, %g0
42 be L161
43 andcc %o0, 3, %g2
44L75:
45 ldub [%o0], %g3
46 ldub [%i2], %g2
47 add %o0,1, %o0
48
49 subcc %g3, %g2, %i0
50 bne L156
51 add %i2, 1, %i2
52
53 andcc %i2, 3, %g0
54 bne L75
55 add %o4, -1, %o4
56
57 andcc %o0, 3, %g2
58L161:
59 bne,a L78
60 mov %i2, %i1
61
62 mov %o0, %i5
63 mov %i2, %i3
64 srl %o4, 2, %i4
65
66 cmp %i4, 0
67 bge L93
68 mov %i4, %g2
69
70 add %i4, 3, %g2
71L93:
72 sra %g2, 2, %g2
73 sll %g2, 2, %g2
74 sub %i4, %g2, %g2
75
76 cmp %g2, 1
77 be,a L88
78 add %o0, 4, %i5
79
80 bg L94
81 cmp %g2, 2
82
83 cmp %g2, 0
84 be,a L86
85 ld [%o0], %g3
86
87 b L162
88 ld [%i5], %g3
89L94:
90 be L81
91 cmp %g2, 3
92
93 be,a L83
94 add %o0, -4, %i5
95
96 b L162
97 ld [%i5], %g3
98L81:
99 add %o0, -8, %i5
100 ld [%o0], %g3
101 add %i2, -8, %i3
102 ld [%i2], %g2
103
104 b L82
105 add %i4, 2, %i4
106L83:
107 ld [%o0], %g4
108 add %i2, -4, %i3
109 ld [%i2], %g1
110
111 b L84
112 add %i4, 1, %i4
113L86:
114 b L87
115 ld [%i2], %g2
116L88:
117 add %i2, 4, %i3
118 ld [%o0], %g4
119 add %i4, -1, %i4
120 ld [%i2], %g1
121L95:
122 ld [%i5], %g3
123L162:
124 cmp %g4, %g1
125 be L87
126 ld [%i3], %g2
127
128 cmp %g4, %g1
129L163:
130 bleu L114
131 mov -1, %i0
132
133 b L114
134 mov 1, %i0
135L87:
136 ld [%i5 + 4], %g4
137 cmp %g3, %g2
138 bne L163
139 ld [%i3 + 4], %g1
140L84:
141 ld [%i5 + 8], %g3
142
143 cmp %g4, %g1
144 bne L163
145 ld [%i3 + 8], %g2
146L82:
147 ld [%i5 + 12], %g4
148 cmp %g3, %g2
149 bne L163
150 ld [%i3 + 12], %g1
151
152 add %i5, 16, %i5
153
154 addcc %i4, -4, %i4
155 bne L95
156 add %i3, 16, %i3
157
158 cmp %g4, %g1
159 bne L163
160 nop
161
162 b L114
163 mov 0, %i0
164L78:
165 srl %o4, 2, %i0
166 and %o0, -4, %i3
167 orcc %i0, %g0, %g3
168 sll %g2, 3, %o7
169 mov 32, %g2
170
171 bge L129
172 sub %g2, %o7, %o1
173
174 add %i0, 3, %g3
175L129:
176 sra %g3, 2, %g2
177 sll %g2, 2, %g2
178 sub %i0, %g2, %g2
179
180 cmp %g2, 1
181 be,a L124
182 ld [%i3], %o3
183
184 bg L130
185 cmp %g2, 2
186
187 cmp %g2, 0
188 be,a L122
189 ld [%i3], %o2
190
191 b L164
192 sll %o3, %o7, %g3
193L130:
194 be L117
195 cmp %g2, 3
196
197 be,a L119
198 ld [%i3], %g1
199
200 b L164
201 sll %o3, %o7, %g3
202L117:
203 ld [%i3], %g4
204 add %i2, -8, %i1
205 ld [%i3 + 4], %o3
206 add %i0, 2, %i0
207 ld [%i2], %i4
208
209 b L118
210 add %i3, -4, %i3
211L119:
212 ld [%i3 + 4], %g4
213 add %i2, -4, %i1
214 ld [%i2], %i5
215
216 b L120
217 add %i0, 1, %i0
218L122:
219 ld [%i3 + 4], %g1
220 ld [%i2], %i4
221
222 b L123
223 add %i3, 4, %i3
224L124:
225 add %i2, 4, %i1
226 ld [%i3 + 4], %o2
227 add %i0, -1, %i0
228 ld [%i2], %i5
229 add %i3, 8, %i3
230L131:
231 sll %o3, %o7, %g3
232L164:
233 srl %o2, %o1, %g2
234 ld [%i3], %g1
235 or %g3, %g2, %g3
236
237 cmp %g3, %i5
238 bne L163
239 ld [%i1], %i4
240L123:
241 sll %o2, %o7, %g3
242 srl %g1, %o1, %g2
243 ld [%i3 + 4], %g4
244 or %g3, %g2, %g3
245
246 cmp %g3, %i4
247 bne L163
248 ld [%i1 + 4], %i5
249L120:
250 sll %g1, %o7, %g3
251 srl %g4, %o1, %g2
252 ld [%i3 + 8], %o3
253 or %g3, %g2, %g3
254
255 cmp %g3, %i5
256 bne L163
257 ld [%i1 + 8], %i4
258L118:
259 sll %g4, %o7, %g3
260 srl %o3, %o1, %g2
261 ld [%i3 + 12], %o2
262 or %g3, %g2, %g3
263
264 cmp %g3, %i4
265 bne L163
266 ld [%i1 + 12], %i5
267
268 add %i3, 16, %i3
269 addcc %i0, -4, %i0
270 bne L131
271 add %i1, 16, %i1
272
273 sll %o3, %o7, %g3
274 srl %o2, %o1, %g2
275 or %g3, %g2, %g3
276
277 cmp %g3, %i5
278 be,a L114
279 mov 0, %i0
280
281 b,a L163
282L114:
283 cmp %i0, 0
284 bne L156
285 and %o4, -4, %g2
286
287 add %o0, %g2, %o0
288 add %i2, %g2, %i2
289 and %o4, 3, %o4
290L72:
291 cmp %o4, 0
292 be L156
293 mov 0, %i0
294
295 ldub [%o0], %g3
296L165:
297 ldub [%i2], %g2
298 add %o0, 1, %o0 18 add %o0, 1, %o0
299 19 add %o1, 1, %o1
300 subcc %g3, %g2, %i0 20 subcc %g7, %g3, %g3
301 bne L156 21 BRANCH32(be, pt, 1b)
302 add %i2, 1, %i2 22 cmp %o2, 0
303 23 retl
304 addcc %o4, -1, %o4 24 mov %g3, %o0
305 bne,a L165 252: retl
306 ldub [%o0], %g3 26 mov 0, %o0
307 27ENDPROC(memcmp)
308 mov 0, %i0
309L156:
310 ret
311 restore
312#endif
diff --git a/arch/sparc64/lib/memmove.S b/arch/sparc/lib/memmove.S
index 97395802c23c..97395802c23c 100644
--- a/arch/sparc64/lib/memmove.S
+++ b/arch/sparc/lib/memmove.S
diff --git a/arch/sparc/lib/memscan.S b/arch/sparc/lib/memscan_32.S
index 4ff1657dfc24..4ff1657dfc24 100644
--- a/arch/sparc/lib/memscan.S
+++ b/arch/sparc/lib/memscan_32.S
diff --git a/arch/sparc64/lib/memscan.S b/arch/sparc/lib/memscan_64.S
index 5686dfa5dc15..5686dfa5dc15 100644
--- a/arch/sparc64/lib/memscan.S
+++ b/arch/sparc/lib/memscan_64.S
diff --git a/arch/sparc/lib/rwsem.S b/arch/sparc/lib/rwsem_32.S
index 9675268e7fde..9675268e7fde 100644
--- a/arch/sparc/lib/rwsem.S
+++ b/arch/sparc/lib/rwsem_32.S
diff --git a/arch/sparc64/lib/rwsem.S b/arch/sparc/lib/rwsem_64.S
index 1a4cc5654de4..91a7d29a79d5 100644
--- a/arch/sparc64/lib/rwsem.S
+++ b/arch/sparc/lib/rwsem_64.S
@@ -17,7 +17,6 @@ __down_read:
17 bne,pn %icc, 1b 17 bne,pn %icc, 1b
18 add %g7, 1, %g7 18 add %g7, 1, %g7
19 cmp %g7, 0 19 cmp %g7, 0
20 membar #StoreLoad | #StoreStore
21 bl,pn %icc, 3f 20 bl,pn %icc, 3f
22 nop 21 nop
232: 222:
@@ -42,7 +41,6 @@ __down_read_trylock:
42 cmp %g1, %g7 41 cmp %g1, %g7
43 bne,pn %icc, 1b 42 bne,pn %icc, 1b
44 mov 1, %o1 43 mov 1, %o1
45 membar #StoreLoad | #StoreStore
462: retl 442: retl
47 mov %o1, %o0 45 mov %o1, %o0
48 .size __down_read_trylock, .-__down_read_trylock 46 .size __down_read_trylock, .-__down_read_trylock
@@ -58,7 +56,6 @@ __down_write:
58 cmp %g3, %g7 56 cmp %g3, %g7
59 bne,pn %icc, 1b 57 bne,pn %icc, 1b
60 cmp %g7, 0 58 cmp %g7, 0
61 membar #StoreLoad | #StoreStore
62 bne,pn %icc, 3f 59 bne,pn %icc, 3f
63 nop 60 nop
642: retl 612: retl
@@ -85,7 +82,6 @@ __down_write_trylock:
85 cmp %g3, %g7 82 cmp %g3, %g7
86 bne,pn %icc, 1b 83 bne,pn %icc, 1b
87 mov 1, %o1 84 mov 1, %o1
88 membar #StoreLoad | #StoreStore
892: retl 852: retl
90 mov %o1, %o0 86 mov %o1, %o0
91 .size __down_write_trylock, .-__down_write_trylock 87 .size __down_write_trylock, .-__down_write_trylock
@@ -99,7 +95,6 @@ __up_read:
99 cmp %g1, %g7 95 cmp %g1, %g7
100 bne,pn %icc, 1b 96 bne,pn %icc, 1b
101 cmp %g7, 0 97 cmp %g7, 0
102 membar #StoreLoad | #StoreStore
103 bl,pn %icc, 3f 98 bl,pn %icc, 3f
104 nop 99 nop
1052: retl 1002: retl
@@ -129,7 +124,6 @@ __up_write:
129 bne,pn %icc, 1b 124 bne,pn %icc, 1b
130 sub %g7, %g1, %g7 125 sub %g7, %g1, %g7
131 cmp %g7, 0 126 cmp %g7, 0
132 membar #StoreLoad | #StoreStore
133 bl,pn %icc, 3f 127 bl,pn %icc, 3f
134 nop 128 nop
1352: 1292:
@@ -155,7 +149,6 @@ __downgrade_write:
155 bne,pn %icc, 1b 149 bne,pn %icc, 1b
156 sub %g7, %g1, %g7 150 sub %g7, %g1, %g7
157 cmp %g7, 0 151 cmp %g7, 0
158 membar #StoreLoad | #StoreStore
159 bl,pn %icc, 3f 152 bl,pn %icc, 3f
160 nop 153 nop
1612: 1542:
diff --git a/arch/sparc/lib/strlen.S b/arch/sparc/lib/strlen.S
index ed9a763368cd..536f83507fbf 100644
--- a/arch/sparc/lib/strlen.S
+++ b/arch/sparc/lib/strlen.S
@@ -1,51 +1,40 @@
1/* strlen.S: Sparc optimized strlen code 1/* strlen.S: Sparc optimized strlen code
2 * Hand optimized from GNU libc's strlen 2 * Hand optimized from GNU libc's strlen
3 * Copyright (C) 1991,1996 Free Software Foundation 3 * Copyright (C) 1991,1996 Free Software Foundation
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996,2008 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 5 * Copyright (C) 1996, 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */ 6 */
7 7
8#include <linux/linkage.h>
9#include <asm/asm.h>
10
8#define LO_MAGIC 0x01010101 11#define LO_MAGIC 0x01010101
9#define HI_MAGIC 0x80808080 12#define HI_MAGIC 0x80808080
10 13
110: 14 .text
15ENTRY(strlen)
16 mov %o0, %o1
17 andcc %o0, 3, %g0
18 BRANCH32(be, pt, 9f)
19 sethi %hi(HI_MAGIC), %o4
12 ldub [%o0], %o5 20 ldub [%o0], %o5
13 cmp %o5, 0 21 BRANCH_REG_ZERO(pn, %o5, 11f)
14 be 1f
15 add %o0, 1, %o0 22 add %o0, 1, %o0
16 andcc %o0, 3, %g0 23 andcc %o0, 3, %g0
17 be 4f 24 BRANCH32(be, pn, 4f)
18 or %o4, %lo(HI_MAGIC), %o3 25 or %o4, %lo(HI_MAGIC), %o3
19 ldub [%o0], %o5 26 ldub [%o0], %o5
20 cmp %o5, 0 27 BRANCH_REG_ZERO(pn, %o5, 12f)
21 be 2f
22 add %o0, 1, %o0 28 add %o0, 1, %o0
23 andcc %o0, 3, %g0 29 andcc %o0, 3, %g0
24 be 5f 30 BRANCH32(be, pt, 5f)
25 sethi %hi(LO_MAGIC), %o4 31 sethi %hi(LO_MAGIC), %o4
26 ldub [%o0], %o5 32 ldub [%o0], %o5
27 cmp %o5, 0 33 BRANCH_REG_ZERO(pn, %o5, 13f)
28 be 3f
29 add %o0, 1, %o0 34 add %o0, 1, %o0
30 b 8f 35 BRANCH32(ba, pt, 8f)
31 or %o4, %lo(LO_MAGIC), %o2 36 or %o4, %lo(LO_MAGIC), %o2
321: 379:
33 retl
34 mov 0, %o0
352:
36 retl
37 mov 1, %o0
383:
39 retl
40 mov 2, %o0
41
42 .align 4
43 .global strlen
44strlen:
45 mov %o0, %o1
46 andcc %o0, 3, %g0
47 bne 0b
48 sethi %hi(HI_MAGIC), %o4
49 or %o4, %lo(HI_MAGIC), %o3 38 or %o4, %lo(HI_MAGIC), %o3
504: 394:
51 sethi %hi(LO_MAGIC), %o4 40 sethi %hi(LO_MAGIC), %o4
@@ -56,26 +45,36 @@ strlen:
562: 452:
57 sub %o5, %o2, %o4 46 sub %o5, %o2, %o4
58 andcc %o4, %o3, %g0 47 andcc %o4, %o3, %g0
59 be 8b 48 BRANCH32(be, pt, 8b)
60 add %o0, 4, %o0 49 add %o0, 4, %o0
61 50
62 /* Check every byte. */ 51 /* Check every byte. */
63 srl %o5, 24, %g5 52 srl %o5, 24, %g7
64 andcc %g5, 0xff, %g0 53 andcc %g7, 0xff, %g0
65 be 1f 54 BRANCH32(be, pn, 1f)
66 add %o0, -4, %o4 55 add %o0, -4, %o4
67 srl %o5, 16, %g5 56 srl %o5, 16, %g7
68 andcc %g5, 0xff, %g0 57 andcc %g7, 0xff, %g0
69 be 1f 58 BRANCH32(be, pn, 1f)
70 add %o4, 1, %o4 59 add %o4, 1, %o4
71 srl %o5, 8, %g5 60 srl %o5, 8, %g7
72 andcc %g5, 0xff, %g0 61 andcc %g7, 0xff, %g0
73 be 1f 62 BRANCH32(be, pn, 1f)
74 add %o4, 1, %o4 63 add %o4, 1, %o4
75 andcc %o5, 0xff, %g0 64 andcc %o5, 0xff, %g0
76 bne,a 2b 65 BRANCH32_ANNUL(bne, pt, 2b)
77 ld [%o0], %o5 66 ld [%o0], %o5
78 add %o4, 1, %o4 67 add %o4, 1, %o4
791: 681:
80 retl 69 retl
81 sub %o4, %o1, %o0 70 sub %o4, %o1, %o0
7111:
72 retl
73 mov 0, %o0
7412:
75 retl
76 mov 1, %o0
7713:
78 retl
79 mov 2, %o0
80ENDPROC(strlen)
diff --git a/arch/sparc/lib/strlen_user.S b/arch/sparc/lib/strlen_user_32.S
index 8c8a371df3c9..8c8a371df3c9 100644
--- a/arch/sparc/lib/strlen_user.S
+++ b/arch/sparc/lib/strlen_user_32.S
diff --git a/arch/sparc64/lib/strlen_user.S b/arch/sparc/lib/strlen_user_64.S
index 114ed111e251..114ed111e251 100644
--- a/arch/sparc64/lib/strlen_user.S
+++ b/arch/sparc/lib/strlen_user_64.S
diff --git a/arch/sparc/lib/strncmp.S b/arch/sparc/lib/strncmp_32.S
index 494ec664537a..494ec664537a 100644
--- a/arch/sparc/lib/strncmp.S
+++ b/arch/sparc/lib/strncmp_32.S
diff --git a/arch/sparc64/lib/strncmp.S b/arch/sparc/lib/strncmp_64.S
index 980e83751556..980e83751556 100644
--- a/arch/sparc64/lib/strncmp.S
+++ b/arch/sparc/lib/strncmp_64.S
diff --git a/arch/sparc/lib/strncpy_from_user.S b/arch/sparc/lib/strncpy_from_user_32.S
index d77198976a66..d77198976a66 100644
--- a/arch/sparc/lib/strncpy_from_user.S
+++ b/arch/sparc/lib/strncpy_from_user_32.S
diff --git a/arch/sparc64/lib/strncpy_from_user.S b/arch/sparc/lib/strncpy_from_user_64.S
index 511c8f136f95..511c8f136f95 100644
--- a/arch/sparc64/lib/strncpy_from_user.S
+++ b/arch/sparc/lib/strncpy_from_user_64.S
diff --git a/arch/sparc64/lib/user_fixup.c b/arch/sparc/lib/user_fixup.c
index 05a361b0a1a4..05a361b0a1a4 100644
--- a/arch/sparc64/lib/user_fixup.c
+++ b/arch/sparc/lib/user_fixup.c
diff --git a/arch/sparc64/lib/xor.S b/arch/sparc/lib/xor.S
index f44f58f40234..f44f58f40234 100644
--- a/arch/sparc64/lib/xor.S
+++ b/arch/sparc/lib/xor.S
diff --git a/arch/sparc/math-emu/Makefile b/arch/sparc/math-emu/Makefile
index 8136987977f4..b9085ecbb27b 100644
--- a/arch/sparc/math-emu/Makefile
+++ b/arch/sparc/math-emu/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the FPU instruction emulation. 2# Makefile for the FPU instruction emulation.
3# 3#
4 4
5obj-y := math.o 5# supress all warnings - as math.c produces a lot!
6ccflags-y := -w
6 7
7EXTRA_AFLAGS := -ansi 8obj-y := math_$(BITS).o
8EXTRA_CFLAGS = -I. -Iinclude/math-emu -w
diff --git a/arch/sparc/math-emu/ashldi3.S b/arch/sparc/math-emu/ashldi3.S
deleted file mode 100644
index 7230ff5c7aa1..000000000000
--- a/arch/sparc/math-emu/ashldi3.S
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * ashldi3.S: Math-emu code creates all kinds of references to
3 * this little routine on the sparc with gcc.
4 *
5 * Copyright (C) 1998 Jakub Jelinek(jj@ultra.linux.cz)
6 */
7
8#include <asm/cprefix.h>
9
10 .globl C_LABEL(__ashldi3)
11C_LABEL(__ashldi3):
12 tst %o2
13 be 3f
14 mov 32, %g2
15
16 sub %g2, %o2, %g2
17
18 tst %g2
19 bg 1f
20 srl %o1, %g2, %g3
21
22 clr %o5
23 neg %g2
24 ba 2f
25 sll %o1, %g2, %o4
26
271:
28 sll %o1, %o2, %o5
29 srl %o0, %o2, %g2
30 or %g2, %g3, %o4
312:
32 mov %o4, %o0
33 mov %o5, %o1
343:
35 jmpl %o7 + 8, %g0
36 nop
diff --git a/arch/sparc/math-emu/math.c b/arch/sparc/math-emu/math_32.c
index 8613b3eb877c..e13f65da17df 100644
--- a/arch/sparc/math-emu/math.c
+++ b/arch/sparc/math-emu/math_32.c
@@ -69,7 +69,7 @@
69#include <linux/mm.h> 69#include <linux/mm.h>
70#include <asm/uaccess.h> 70#include <asm/uaccess.h>
71 71
72#include "sfp-util.h" 72#include "sfp-util_32.h"
73#include <math-emu/soft-fp.h> 73#include <math-emu/soft-fp.h>
74#include <math-emu/single.h> 74#include <math-emu/single.h>
75#include <math-emu/double.h> 75#include <math-emu/double.h>
diff --git a/arch/sparc64/math-emu/math.c b/arch/sparc/math-emu/math_64.c
index add053e0f3b3..6863c9bde25c 100644
--- a/arch/sparc64/math-emu/math.c
+++ b/arch/sparc/math-emu/math_64.c
@@ -16,7 +16,7 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18 18
19#include "sfp-util.h" 19#include "sfp-util_64.h"
20#include <math-emu/soft-fp.h> 20#include <math-emu/soft-fp.h>
21#include <math-emu/single.h> 21#include <math-emu/single.h>
22#include <math-emu/double.h> 22#include <math-emu/double.h>
diff --git a/arch/sparc/math-emu/sfp-util.h b/arch/sparc/math-emu/sfp-util_32.h
index d1b2aff3c259..d1b2aff3c259 100644
--- a/arch/sparc/math-emu/sfp-util.h
+++ b/arch/sparc/math-emu/sfp-util_32.h
diff --git a/arch/sparc64/math-emu/sfp-util.h b/arch/sparc/math-emu/sfp-util_64.h
index 425d3cf01af4..425d3cf01af4 100644
--- a/arch/sparc64/math-emu/sfp-util.h
+++ b/arch/sparc/math-emu/sfp-util_64.h
diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile
index ea88955d97ff..681abe0a4594 100644
--- a/arch/sparc/mm/Makefile
+++ b/arch/sparc/mm/Makefile
@@ -1,17 +1,25 @@
1# Makefile for the linux Sparc-specific parts of the memory manager. 1# Makefile for the linux Sparc-specific parts of the memory manager.
2# 2#
3 3
4EXTRA_AFLAGS := -ansi 4asflags-y := -ansi
5ccflags-y := -Werror
5 6
6obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o \ 7obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o
7 srmmu.o iommu.o io-unit.o hypersparc.o viking.o tsunami.o swift.o 8obj-y += fault_$(BITS).o
9obj-y += init_$(BITS).o
10obj-$(CONFIG_SPARC32) += loadmmu.o
11obj-y += generic_$(BITS).o
12obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o
13obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o
8 14
9ifdef CONFIG_HIGHMEM 15# Only used by sparc64
10obj-y += highmem.o 16obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
11endif 17
18# Only used by sparc32
19obj-$(CONFIG_HIGHMEM) += highmem.o
12 20
13ifdef CONFIG_SMP 21ifdef CONFIG_SMP
14obj-y += nosun4c.o 22obj-$(CONFIG_SPARC32) += nosun4c.o
15else 23else
16obj-y += sun4c.o 24obj-$(CONFIG_SPARC32) += sun4c.o
17endif 25endif
diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault_32.c
index a507e1174662..a507e1174662 100644
--- a/arch/sparc/mm/fault.c
+++ b/arch/sparc/mm/fault_32.c
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc/mm/fault_64.c
index a9e474bf6385..a9e474bf6385 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc/mm/fault_64.c
diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic_32.c
index a289261da9fd..a289261da9fd 100644
--- a/arch/sparc/mm/generic.c
+++ b/arch/sparc/mm/generic_32.c
diff --git a/arch/sparc64/mm/generic.c b/arch/sparc/mm/generic_64.c
index f362c2037013..f362c2037013 100644
--- a/arch/sparc64/mm/generic.c
+++ b/arch/sparc/mm/generic_64.c
diff --git a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index f27d10369e0c..f27d10369e0c 100644
--- a/arch/sparc64/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init_32.c
index 677c1e187a23..fec926021f49 100644
--- a/arch/sparc/mm/init.c
+++ b/arch/sparc/mm/init_32.c
@@ -25,6 +25,7 @@
25#include <linux/pagemap.h> 25#include <linux/pagemap.h>
26#include <linux/poison.h> 26#include <linux/poison.h>
27 27
28#include <asm/sections.h>
28#include <asm/system.h> 29#include <asm/system.h>
29#include <asm/vac-ops.h> 30#include <asm/vac-ops.h>
30#include <asm/page.h> 31#include <asm/page.h>
@@ -48,9 +49,6 @@ unsigned long sparc_unmapped_base;
48 49
49struct pgtable_cache_struct pgt_quicklists; 50struct pgtable_cache_struct pgt_quicklists;
50 51
51/* References to section boundaries */
52extern char __init_begin, __init_end, _start, _end, etext , edata;
53
54/* Initial ramdisk setup */ 52/* Initial ramdisk setup */
55extern unsigned int sparc_ramdisk_image; 53extern unsigned int sparc_ramdisk_image;
56extern unsigned int sparc_ramdisk_size; 54extern unsigned int sparc_ramdisk_size;
@@ -450,9 +448,9 @@ void __init mem_init(void)
450 448
451 totalram_pages += totalhigh_pages; 449 totalram_pages += totalhigh_pages;
452 450
453 codepages = (((unsigned long) &etext) - ((unsigned long)&_start)); 451 codepages = (((unsigned long) &_etext) - ((unsigned long)&_start));
454 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT; 452 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
455 datapages = (((unsigned long) &edata) - ((unsigned long)&etext)); 453 datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext));
456 datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT; 454 datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT;
457 initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin)); 455 initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin));
458 initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT; 456 initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT;
@@ -476,8 +474,10 @@ void __init mem_init(void)
476void free_initmem (void) 474void free_initmem (void)
477{ 475{
478 unsigned long addr; 476 unsigned long addr;
477 unsigned long freed;
479 478
480 addr = (unsigned long)(&__init_begin); 479 addr = (unsigned long)(&__init_begin);
480 freed = (unsigned long)(&__init_end) - addr;
481 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { 481 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
482 struct page *p; 482 struct page *p;
483 483
@@ -490,8 +490,8 @@ void free_initmem (void)
490 totalram_pages++; 490 totalram_pages++;
491 num_physpages++; 491 num_physpages++;
492 } 492 }
493 printk(KERN_INFO "Freeing unused kernel memory: %dk freed\n", 493 printk(KERN_INFO "Freeing unused kernel memory: %ldk freed\n",
494 (&__init_end - &__init_begin) >> 10); 494 freed >> 10);
495} 495}
496 496
497#ifdef CONFIG_BLK_DEV_INITRD 497#ifdef CONFIG_BLK_DEV_INITRD
diff --git a/arch/sparc64/mm/init.c b/arch/sparc/mm/init_64.c
index 185f34679110..6ea73da29312 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc/mm/init_64.c
@@ -50,7 +50,7 @@
50#include <asm/cpudata.h> 50#include <asm/cpudata.h>
51#include <asm/irq.h> 51#include <asm/irq.h>
52 52
53#include "init.h" 53#include "init_64.h"
54 54
55unsigned long kern_linear_pte_xor[2] __read_mostly; 55unsigned long kern_linear_pte_xor[2] __read_mostly;
56 56
@@ -214,7 +214,6 @@ static inline void set_dcache_dirty(struct page *page, int this_cpu)
214 "or %%g1, %0, %%g1\n\t" 214 "or %%g1, %0, %%g1\n\t"
215 "casx [%2], %%g7, %%g1\n\t" 215 "casx [%2], %%g7, %%g1\n\t"
216 "cmp %%g7, %%g1\n\t" 216 "cmp %%g7, %%g1\n\t"
217 "membar #StoreLoad | #StoreStore\n\t"
218 "bne,pn %%xcc, 1b\n\t" 217 "bne,pn %%xcc, 1b\n\t"
219 " nop" 218 " nop"
220 : /* no outputs */ 219 : /* no outputs */
@@ -236,7 +235,6 @@ static inline void clear_dcache_dirty_cpu(struct page *page, unsigned long cpu)
236 " andn %%g7, %1, %%g1\n\t" 235 " andn %%g7, %1, %%g1\n\t"
237 "casx [%2], %%g7, %%g1\n\t" 236 "casx [%2], %%g7, %%g1\n\t"
238 "cmp %%g7, %%g1\n\t" 237 "cmp %%g7, %%g1\n\t"
239 "membar #StoreLoad | #StoreStore\n\t"
240 "bne,pn %%xcc, 1b\n\t" 238 "bne,pn %%xcc, 1b\n\t"
241 " nop\n" 239 " nop\n"
242 "2:" 240 "2:"
@@ -956,7 +954,7 @@ int of_node_to_nid(struct device_node *dp)
956 return nid; 954 return nid;
957} 955}
958 956
959static void __init add_node_ranges(void) 957static void add_node_ranges(void)
960{ 958{
961 int i; 959 int i;
962 960
diff --git a/arch/sparc64/mm/init.h b/arch/sparc/mm/init_64.h
index 16063870a489..16063870a489 100644
--- a/arch/sparc64/mm/init.h
+++ b/arch/sparc/mm/init_64.h
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index daadf5f88050..005e758a4db7 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -156,8 +156,8 @@ static void iounit_get_scsi_sgl(struct device *dev, struct scatterlist *sg, int
156 spin_lock_irqsave(&iounit->lock, flags); 156 spin_lock_irqsave(&iounit->lock, flags);
157 while (sz != 0) { 157 while (sz != 0) {
158 --sz; 158 --sz;
159 sg->dvma_address = iounit_get_area(iounit, (unsigned long) sg_virt(sg), sg->length); 159 sg->dma_address = iounit_get_area(iounit, (unsigned long) sg_virt(sg), sg->length);
160 sg->dvma_length = sg->length; 160 sg->dma_length = sg->length;
161 sg = sg_next(sg); 161 sg = sg_next(sg);
162 } 162 }
163 spin_unlock_irqrestore(&iounit->lock, flags); 163 spin_unlock_irqrestore(&iounit->lock, flags);
@@ -186,8 +186,8 @@ static void iounit_release_scsi_sgl(struct device *dev, struct scatterlist *sg,
186 spin_lock_irqsave(&iounit->lock, flags); 186 spin_lock_irqsave(&iounit->lock, flags);
187 while (sz != 0) { 187 while (sz != 0) {
188 --sz; 188 --sz;
189 len = ((sg->dvma_address & ~PAGE_MASK) + sg->length + (PAGE_SIZE-1)) >> PAGE_SHIFT; 189 len = ((sg->dma_address & ~PAGE_MASK) + sg->length + (PAGE_SIZE-1)) >> PAGE_SHIFT;
190 vaddr = (sg->dvma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT; 190 vaddr = (sg->dma_address - IOUNIT_DMA_BASE) >> PAGE_SHIFT;
191 IOD(("iounit_release %08lx-%08lx\n", (long)vaddr, (long)len+vaddr)); 191 IOD(("iounit_release %08lx-%08lx\n", (long)vaddr, (long)len+vaddr));
192 for (len += vaddr; vaddr < len; vaddr++) 192 for (len += vaddr; vaddr < len; vaddr++)
193 clear_bit(vaddr, iounit->bmap); 193 clear_bit(vaddr, iounit->bmap);
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index e7a499e3aa3c..b2e6e73888b5 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -245,8 +245,8 @@ static void iommu_get_scsi_sgl_noflush(struct device *dev, struct scatterlist *s
245 while (sz != 0) { 245 while (sz != 0) {
246 --sz; 246 --sz;
247 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; 247 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
248 sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; 248 sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
249 sg->dvma_length = (__u32) sg->length; 249 sg->dma_length = sg->length;
250 sg = sg_next(sg); 250 sg = sg_next(sg);
251 } 251 }
252} 252}
@@ -259,8 +259,8 @@ static void iommu_get_scsi_sgl_gflush(struct device *dev, struct scatterlist *sg
259 while (sz != 0) { 259 while (sz != 0) {
260 --sz; 260 --sz;
261 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; 261 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
262 sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; 262 sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
263 sg->dvma_length = (__u32) sg->length; 263 sg->dma_length = sg->length;
264 sg = sg_next(sg); 264 sg = sg_next(sg);
265 } 265 }
266} 266}
@@ -290,8 +290,8 @@ static void iommu_get_scsi_sgl_pflush(struct device *dev, struct scatterlist *sg
290 } 290 }
291 } 291 }
292 292
293 sg->dvma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset; 293 sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
294 sg->dvma_length = (__u32) sg->length; 294 sg->dma_length = sg->length;
295 sg = sg_next(sg); 295 sg = sg_next(sg);
296 } 296 }
297} 297}
@@ -330,8 +330,8 @@ static void iommu_release_scsi_sgl(struct device *dev, struct scatterlist *sg, i
330 --sz; 330 --sz;
331 331
332 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT; 332 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
333 iommu_release_one(dev, sg->dvma_address & PAGE_MASK, n); 333 iommu_release_one(dev, sg->dma_address & PAGE_MASK, n);
334 sg->dvma_address = 0x21212121; 334 sg->dma_address = 0x21212121;
335 sg = sg_next(sg); 335 sg = sg_next(sg);
336 } 336 }
337} 337}
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index dd8aa36f366c..fe7ed08390bb 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -1312,10 +1312,8 @@ void __init srmmu_paging_init(void)
1312#endif 1312#endif
1313 poke_srmmu(); 1313 poke_srmmu();
1314 1314
1315#ifdef CONFIG_SUN_IO
1316 srmmu_allocate_ptable_skeleton(sparc_iomap.start, IOBASE_END); 1315 srmmu_allocate_ptable_skeleton(sparc_iomap.start, IOBASE_END);
1317 srmmu_allocate_ptable_skeleton(DVMA_VADDR, DVMA_END); 1316 srmmu_allocate_ptable_skeleton(DVMA_VADDR, DVMA_END);
1318#endif
1319 1317
1320 srmmu_allocate_ptable_skeleton( 1318 srmmu_allocate_ptable_skeleton(
1321 __fix_to_virt(__end_of_fixed_addresses - 1), FIXADDR_TOP); 1319 __fix_to_virt(__end_of_fixed_addresses - 1), FIXADDR_TOP);
@@ -1916,18 +1914,6 @@ static void __cpuinit poke_viking(void)
1916 mreg |= VIKING_SBENABLE; 1914 mreg |= VIKING_SBENABLE;
1917 mreg &= ~(VIKING_ACENABLE); 1915 mreg &= ~(VIKING_ACENABLE);
1918 srmmu_set_mmureg(mreg); 1916 srmmu_set_mmureg(mreg);
1919
1920#ifdef CONFIG_SMP
1921 /* Avoid unnecessary cross calls. */
1922 BTFIXUPCOPY_CALL(flush_cache_all, local_flush_cache_all);
1923 BTFIXUPCOPY_CALL(flush_cache_mm, local_flush_cache_mm);
1924 BTFIXUPCOPY_CALL(flush_cache_range, local_flush_cache_range);
1925 BTFIXUPCOPY_CALL(flush_cache_page, local_flush_cache_page);
1926 BTFIXUPCOPY_CALL(__flush_page_to_ram, local_flush_page_to_ram);
1927 BTFIXUPCOPY_CALL(flush_sig_insns, local_flush_sig_insns);
1928 BTFIXUPCOPY_CALL(flush_page_for_dma, local_flush_page_for_dma);
1929 btfixup();
1930#endif
1931} 1917}
1932 1918
1933static void __init init_viking(void) 1919static void __init init_viking(void)
@@ -2272,6 +2258,17 @@ void __init ld_mmu_srmmu(void)
2272 BTFIXUPSET_CALL(__flush_page_to_ram, smp_flush_page_to_ram, BTFIXUPCALL_NORM); 2258 BTFIXUPSET_CALL(__flush_page_to_ram, smp_flush_page_to_ram, BTFIXUPCALL_NORM);
2273 BTFIXUPSET_CALL(flush_sig_insns, smp_flush_sig_insns, BTFIXUPCALL_NORM); 2259 BTFIXUPSET_CALL(flush_sig_insns, smp_flush_sig_insns, BTFIXUPCALL_NORM);
2274 BTFIXUPSET_CALL(flush_page_for_dma, smp_flush_page_for_dma, BTFIXUPCALL_NORM); 2260 BTFIXUPSET_CALL(flush_page_for_dma, smp_flush_page_for_dma, BTFIXUPCALL_NORM);
2261
2262 if (poke_srmmu == poke_viking) {
2263 /* Avoid unnecessary cross calls. */
2264 BTFIXUPCOPY_CALL(flush_cache_all, local_flush_cache_all);
2265 BTFIXUPCOPY_CALL(flush_cache_mm, local_flush_cache_mm);
2266 BTFIXUPCOPY_CALL(flush_cache_range, local_flush_cache_range);
2267 BTFIXUPCOPY_CALL(flush_cache_page, local_flush_cache_page);
2268 BTFIXUPCOPY_CALL(__flush_page_to_ram, local_flush_page_to_ram);
2269 BTFIXUPCOPY_CALL(flush_sig_insns, local_flush_sig_insns);
2270 BTFIXUPCOPY_CALL(flush_page_for_dma, local_flush_page_for_dma);
2271 }
2275#endif 2272#endif
2276 2273
2277 if (sparc_cpu_model == sun4d) 2274 if (sparc_cpu_model == sun4d)
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index fe65aeeb3947..2ffacd67c424 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -18,6 +18,7 @@
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19#include <linux/scatterlist.h> 19#include <linux/scatterlist.h>
20 20
21#include <asm/sections.h>
21#include <asm/page.h> 22#include <asm/page.h>
22#include <asm/pgalloc.h> 23#include <asm/pgalloc.h>
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
@@ -240,9 +241,7 @@ void sun4c_complete_all_stores(void)
240 241
241 _unused = sun4c_get_context(); 242 _unused = sun4c_get_context();
242 sun4c_set_context(_unused); 243 sun4c_set_context(_unused);
243#ifdef CONFIG_SUN_AUXIO
244 _unused = get_auxio(); 244 _unused = get_auxio();
245#endif
246} 245}
247 246
248/* Bootup utility functions. */ 247/* Bootup utility functions. */
@@ -1124,8 +1123,8 @@ static void sun4c_get_scsi_sgl(struct device *dev, struct scatterlist *sg, int s
1124{ 1123{
1125 while (sz != 0) { 1124 while (sz != 0) {
1126 --sz; 1125 --sz;
1127 sg->dvma_address = (__u32)sun4c_lockarea(sg_virt(sg), sg->length); 1126 sg->dma_address = (__u32)sun4c_lockarea(sg_virt(sg), sg->length);
1128 sg->dvma_length = sg->length; 1127 sg->dma_length = sg->length;
1129 sg = sg_next(sg); 1128 sg = sg_next(sg);
1130 } 1129 }
1131} 1130}
@@ -1141,7 +1140,7 @@ static void sun4c_release_scsi_sgl(struct device *dev, struct scatterlist *sg, i
1141{ 1140{
1142 while (sz != 0) { 1141 while (sz != 0) {
1143 --sz; 1142 --sz;
1144 sun4c_unlockarea((char *)sg->dvma_address, sg->length); 1143 sun4c_unlockarea((char *)sg->dma_address, sg->length);
1145 sg = sg_next(sg); 1144 sg = sg_next(sg);
1146 } 1145 }
1147} 1146}
@@ -1953,7 +1952,6 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
1953} 1952}
1954 1953
1955extern void sparc_context_init(int); 1954extern void sparc_context_init(int);
1956extern unsigned long end;
1957extern unsigned long bootmem_init(unsigned long *pages_avail); 1955extern unsigned long bootmem_init(unsigned long *pages_avail);
1958extern unsigned long last_valid_pfn; 1956extern unsigned long last_valid_pfn;
1959 1957
@@ -1964,7 +1962,7 @@ void __init sun4c_paging_init(void)
1964 extern struct resource sparc_iomap; 1962 extern struct resource sparc_iomap;
1965 unsigned long end_pfn, pages_avail; 1963 unsigned long end_pfn, pages_avail;
1966 1964
1967 kernel_end = (unsigned long) &end; 1965 kernel_end = (unsigned long) &_end;
1968 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end); 1966 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end);
1969 1967
1970 pages_avail = 0; 1968 pages_avail = 0;
diff --git a/arch/sparc64/mm/tlb.c b/arch/sparc/mm/tlb.c
index d8f21e24a82f..d8f21e24a82f 100644
--- a/arch/sparc64/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
diff --git a/arch/sparc64/mm/tsb.c b/arch/sparc/mm/tsb.c
index 587f8efb2e05..36a0813f9517 100644
--- a/arch/sparc64/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -41,10 +41,8 @@ void flush_tsb_kernel_range(unsigned long start, unsigned long end)
41 KERNEL_TSB_NENTRIES); 41 KERNEL_TSB_NENTRIES);
42 struct tsb *ent = &swapper_tsb[hash]; 42 struct tsb *ent = &swapper_tsb[hash];
43 43
44 if (tag_compare(ent->tag, v)) { 44 if (tag_compare(ent->tag, v))
45 ent->tag = (1UL << TSB_TAG_INVALID_BIT); 45 ent->tag = (1UL << TSB_TAG_INVALID_BIT);
46 membar_storeload_storestore();
47 }
48 } 46 }
49} 47}
50 48
@@ -267,6 +265,18 @@ void __init pgtable_cache_init(void)
267 } 265 }
268} 266}
269 267
268int sysctl_tsb_ratio = -2;
269
270static unsigned long tsb_size_to_rss_limit(unsigned long new_size)
271{
272 unsigned long num_ents = (new_size / sizeof(struct tsb));
273
274 if (sysctl_tsb_ratio < 0)
275 return num_ents - (num_ents >> -sysctl_tsb_ratio);
276 else
277 return num_ents + (num_ents >> sysctl_tsb_ratio);
278}
279
270/* When the RSS of an address space exceeds tsb_rss_limit for a TSB, 280/* When the RSS of an address space exceeds tsb_rss_limit for a TSB,
271 * do_sparc64_fault() invokes this routine to try and grow it. 281 * do_sparc64_fault() invokes this routine to try and grow it.
272 * 282 *
@@ -297,19 +307,14 @@ void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long rss)
297 307
298 new_cache_index = 0; 308 new_cache_index = 0;
299 for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) { 309 for (new_size = 8192; new_size < max_tsb_size; new_size <<= 1UL) {
300 unsigned long n_entries = new_size / sizeof(struct tsb); 310 new_rss_limit = tsb_size_to_rss_limit(new_size);
301 311 if (new_rss_limit > rss)
302 n_entries = (n_entries * 3) / 4;
303 if (n_entries > rss)
304 break; 312 break;
305
306 new_cache_index++; 313 new_cache_index++;
307 } 314 }
308 315
309 if (new_size == max_tsb_size) 316 if (new_size == max_tsb_size)
310 new_rss_limit = ~0UL; 317 new_rss_limit = ~0UL;
311 else
312 new_rss_limit = ((new_size / sizeof(struct tsb)) * 3) / 4;
313 318
314retry_tsb_alloc: 319retry_tsb_alloc:
315 gfp_flags = GFP_KERNEL; 320 gfp_flags = GFP_KERNEL;
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc/mm/ultra.S
index 86773e89dc1b..80c788ec7c32 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc/mm/ultra.S
@@ -125,7 +125,6 @@ __spitfire_flush_tlb_mm_slow:
125 .align 32 125 .align 32
126 .globl __flush_icache_page 126 .globl __flush_icache_page
127__flush_icache_page: /* %o0 = phys_page */ 127__flush_icache_page: /* %o0 = phys_page */
128 membar #StoreStore
129 srlx %o0, PAGE_SHIFT, %o0 128 srlx %o0, PAGE_SHIFT, %o0
130 sethi %uhi(PAGE_OFFSET), %g1 129 sethi %uhi(PAGE_OFFSET), %g1
131 sllx %o0, PAGE_SHIFT, %o0 130 sllx %o0, PAGE_SHIFT, %o0
@@ -467,7 +466,7 @@ xcall_sync_tick:
467 .previous 466 .previous
468 467
469 rdpr %pil, %g2 468 rdpr %pil, %g2
470 wrpr %g0, 15, %pil 469 wrpr %g0, PIL_NORMAL_MAX, %pil
471 sethi %hi(109f), %g7 470 sethi %hi(109f), %g7
472 b,pt %xcc, etrap_irq 471 b,pt %xcc, etrap_irq
473109: or %g7, %lo(109b), %g7 472109: or %g7, %lo(109b), %g7
@@ -507,7 +506,6 @@ xcall_fetch_glob_regs:
507 sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2 506 sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2
508 add %g7, %g2, %g7 507 add %g7, %g2, %g7
509 ldx [%g7 + TRAP_PER_CPU_THREAD], %g3 508 ldx [%g7 + TRAP_PER_CPU_THREAD], %g3
510 membar #StoreStore
511 stx %g3, [%g1 + GR_SNAP_THREAD] 509 stx %g3, [%g1 + GR_SNAP_THREAD]
512 retry 510 retry
513 511
@@ -690,7 +688,7 @@ xcall_kgdb_capture:
690 .previous 688 .previous
691 689
692 rdpr %pil, %g2 690 rdpr %pil, %g2
693 wrpr %g0, 15, %pil 691 wrpr %g0, PIL_NORMAL_MAX, %pil
694 sethi %hi(109f), %g7 692 sethi %hi(109f), %g7
695 ba,pt %xcc, etrap_irq 693 ba,pt %xcc, etrap_irq
696109: or %g7, %lo(109b), %g7 694109: or %g7, %lo(109b), %g7
diff --git a/arch/sparc/oprofile/init.c b/arch/sparc/oprofile/init.c
index 17bb6035069b..d6e170c074fc 100644
--- a/arch/sparc/oprofile/init.c
+++ b/arch/sparc/oprofile/init.c
@@ -12,12 +12,239 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/init.h> 13#include <linux/init.h>
14 14
15#ifdef CONFIG_SPARC64
16#include <asm/hypervisor.h>
17#include <asm/spitfire.h>
18#include <asm/cpudata.h>
19#include <asm/irq.h>
20
21static int nmi_enabled;
22
23struct pcr_ops {
24 u64 (*read)(void);
25 void (*write)(u64);
26};
27static const struct pcr_ops *pcr_ops;
28
29static u64 direct_pcr_read(void)
30{
31 u64 val;
32
33 read_pcr(val);
34 return val;
35}
36
37static void direct_pcr_write(u64 val)
38{
39 write_pcr(val);
40}
41
42static const struct pcr_ops direct_pcr_ops = {
43 .read = direct_pcr_read,
44 .write = direct_pcr_write,
45};
46
47static void n2_pcr_write(u64 val)
48{
49 unsigned long ret;
50
51 ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
52 if (val != HV_EOK)
53 write_pcr(val);
54}
55
56static const struct pcr_ops n2_pcr_ops = {
57 .read = direct_pcr_read,
58 .write = n2_pcr_write,
59};
60
61/* In order to commonize as much of the implementation as
62 * possible, we use PICH as our counter. Mostly this is
63 * to accomodate Niagara-1 which can only count insn cycles
64 * in PICH.
65 */
66static u64 picl_value(void)
67{
68 u32 delta = local_cpu_data().clock_tick / HZ;
69
70 return ((u64)((0 - delta) & 0xffffffff)) << 32;
71}
72
73#define PCR_PIC_PRIV 0x00000001 /* PIC access is privileged */
74#define PCR_STRACE 0x00000002 /* Trace supervisor events */
75#define PCR_UTRACE 0x00000004 /* Trace user events */
76#define PCR_N2_HTRACE 0x00000008 /* Trace hypervisor events */
77#define PCR_N2_TOE_OV0 0x00000010 /* Trap if PIC 0 overflows */
78#define PCR_N2_TOE_OV1 0x00000020 /* Trap if PIC 1 overflows */
79#define PCR_N2_MASK0 0x00003fc0
80#define PCR_N2_MASK0_SHIFT 6
81#define PCR_N2_SL0 0x0003c000
82#define PCR_N2_SL0_SHIFT 14
83#define PCR_N2_OV0 0x00040000
84#define PCR_N2_MASK1 0x07f80000
85#define PCR_N2_MASK1_SHIFT 19
86#define PCR_N2_SL1 0x78000000
87#define PCR_N2_SL1_SHIFT 27
88#define PCR_N2_OV1 0x80000000
89
90#define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE)
91#define PCR_N2_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \
92 PCR_N2_TOE_OV1 | \
93 (2 << PCR_N2_SL1_SHIFT) | \
94 (0xff << PCR_N2_MASK1_SHIFT))
95
96static u64 pcr_enable = PCR_SUN4U_ENABLE;
97
98static void nmi_handler(struct pt_regs *regs)
99{
100 pcr_ops->write(PCR_PIC_PRIV);
101
102 if (nmi_enabled) {
103 oprofile_add_sample(regs, 0);
104
105 write_pic(picl_value());
106 pcr_ops->write(pcr_enable);
107 }
108}
109
110/* We count "clock cycle" events in the lower 32-bit PIC.
111 * Then configure it such that it overflows every HZ, and thus
112 * generates a level 15 interrupt at that frequency.
113 */
114static void cpu_nmi_start(void *_unused)
115{
116 pcr_ops->write(PCR_PIC_PRIV);
117 write_pic(picl_value());
118
119 pcr_ops->write(pcr_enable);
120}
121
122static void cpu_nmi_stop(void *_unused)
123{
124 pcr_ops->write(PCR_PIC_PRIV);
125}
126
127static int nmi_start(void)
128{
129 int err = register_perfctr_intr(nmi_handler);
130
131 if (!err) {
132 nmi_enabled = 1;
133 wmb();
134 err = on_each_cpu(cpu_nmi_start, NULL, 1);
135 if (err) {
136 nmi_enabled = 0;
137 wmb();
138 on_each_cpu(cpu_nmi_stop, NULL, 1);
139 release_perfctr_intr(nmi_handler);
140 }
141 }
142
143 return err;
144}
145
146static void nmi_stop(void)
147{
148 nmi_enabled = 0;
149 wmb();
150
151 on_each_cpu(cpu_nmi_stop, NULL, 1);
152 release_perfctr_intr(nmi_handler);
153 synchronize_sched();
154}
155
156static unsigned long perf_hsvc_group;
157static unsigned long perf_hsvc_major;
158static unsigned long perf_hsvc_minor;
159
160static int __init register_perf_hsvc(void)
161{
162 if (tlb_type == hypervisor) {
163 switch (sun4v_chip_type) {
164 case SUN4V_CHIP_NIAGARA1:
165 perf_hsvc_group = HV_GRP_NIAG_PERF;
166 break;
167
168 case SUN4V_CHIP_NIAGARA2:
169 perf_hsvc_group = HV_GRP_N2_CPU;
170 break;
171
172 default:
173 return -ENODEV;
174 }
175
176
177 perf_hsvc_major = 1;
178 perf_hsvc_minor = 0;
179 if (sun4v_hvapi_register(perf_hsvc_group,
180 perf_hsvc_major,
181 &perf_hsvc_minor)) {
182 printk("perfmon: Could not register N2 hvapi.\n");
183 return -ENODEV;
184 }
185 }
186 return 0;
187}
188
189static void unregister_perf_hsvc(void)
190{
191 if (tlb_type != hypervisor)
192 return;
193 sun4v_hvapi_unregister(perf_hsvc_group);
194}
195
196static int oprofile_nmi_init(struct oprofile_operations *ops)
197{
198 int err = register_perf_hsvc();
199
200 if (err)
201 return err;
202
203 switch (tlb_type) {
204 case hypervisor:
205 pcr_ops = &n2_pcr_ops;
206 pcr_enable = PCR_N2_ENABLE;
207 break;
208
209 case cheetah:
210 case cheetah_plus:
211 pcr_ops = &direct_pcr_ops;
212 break;
213
214 default:
215 return -ENODEV;
216 }
217
218 ops->create_files = NULL;
219 ops->setup = NULL;
220 ops->shutdown = NULL;
221 ops->start = nmi_start;
222 ops->stop = nmi_stop;
223 ops->cpu_type = "timer";
224
225 printk(KERN_INFO "oprofile: Using perfctr based NMI timer interrupt.\n");
226
227 return 0;
228}
229#endif
230
15int __init oprofile_arch_init(struct oprofile_operations *ops) 231int __init oprofile_arch_init(struct oprofile_operations *ops)
16{ 232{
17 return -ENODEV; 233 int ret = -ENODEV;
234
235#ifdef CONFIG_SPARC64
236 ret = oprofile_nmi_init(ops);
237 if (!ret)
238 return ret;
239#endif
240
241 return ret;
18} 242}
19 243
20 244
21void oprofile_arch_exit(void) 245void oprofile_arch_exit(void)
22{ 246{
247#ifdef CONFIG_SPARC64
248 unregister_perf_hsvc();
249#endif
23} 250}
diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile
index 8f7e18546c97..1b8c073adb44 100644
--- a/arch/sparc/prom/Makefile
+++ b/arch/sparc/prom/Makefile
@@ -1,6 +1,21 @@
1# Makefile for the Sun Boot PROM interface library under 1# Makefile for the Sun Boot PROM interface library under
2# Linux. 2# Linux.
3# 3#
4asflags := -ansi
5ccflags := -Werror
4 6
5lib-y := bootstr.o devmap.o devops.o init.o memory.o misc.o mp.o \ 7lib-y := bootstr_$(BITS).o
6 palloc.o ranges.o segment.o console.o printf.o tree.o 8lib-$(CONFIG_SPARC32) += devmap.o
9lib-y += devops_$(BITS).o
10lib-y += init_$(BITS).o
11lib-$(CONFIG_SPARC32) += memory.o
12lib-y += misc_$(BITS).o
13lib-$(CONFIG_SPARC32) += mp.o
14lib-$(CONFIG_SPARC32) += palloc.o
15lib-$(CONFIG_SPARC32) += ranges.o
16lib-$(CONFIG_SPARC32) += segment.o
17lib-y += console_$(BITS).o
18lib-y += printf.o
19lib-y += tree_$(BITS).o
20lib-$(CONFIG_SPARC64) += p1275.o
21lib-$(CONFIG_SPARC64) += cif.o
diff --git a/arch/sparc/prom/bootstr.c b/arch/sparc/prom/bootstr_32.c
index 916831da7e67..916831da7e67 100644
--- a/arch/sparc/prom/bootstr.c
+++ b/arch/sparc/prom/bootstr_32.c
diff --git a/arch/sparc64/prom/bootstr.c b/arch/sparc/prom/bootstr_64.c
index ab9ccc63b388..ab9ccc63b388 100644
--- a/arch/sparc64/prom/bootstr.c
+++ b/arch/sparc/prom/bootstr_64.c
diff --git a/arch/sparc64/prom/cif.S b/arch/sparc/prom/cif.S
index 5f27ad779c0c..5f27ad779c0c 100644
--- a/arch/sparc64/prom/cif.S
+++ b/arch/sparc/prom/cif.S
diff --git a/arch/sparc/prom/console.c b/arch/sparc/prom/console_32.c
index b3075d73fc19..b3075d73fc19 100644
--- a/arch/sparc/prom/console.c
+++ b/arch/sparc/prom/console_32.c
diff --git a/arch/sparc64/prom/console.c b/arch/sparc/prom/console_64.c
index e1c3fc87484d..e1c3fc87484d 100644
--- a/arch/sparc64/prom/console.c
+++ b/arch/sparc/prom/console_64.c
diff --git a/arch/sparc/prom/devops.c b/arch/sparc/prom/devops_32.c
index 9f1a95c91ad1..9f1a95c91ad1 100644
--- a/arch/sparc/prom/devops.c
+++ b/arch/sparc/prom/devops_32.c
diff --git a/arch/sparc64/prom/devops.c b/arch/sparc/prom/devops_64.c
index 9dbd803e46e1..9dbd803e46e1 100644
--- a/arch/sparc64/prom/devops.c
+++ b/arch/sparc/prom/devops_64.c
diff --git a/arch/sparc/prom/init.c b/arch/sparc/prom/init_32.c
index 873217c6d823..873217c6d823 100644
--- a/arch/sparc/prom/init.c
+++ b/arch/sparc/prom/init_32.c
diff --git a/arch/sparc64/prom/init.c b/arch/sparc/prom/init_64.c
index 7b00f89490a4..7b00f89490a4 100644
--- a/arch/sparc64/prom/init.c
+++ b/arch/sparc/prom/init_64.c
diff --git a/arch/sparc/prom/misc.c b/arch/sparc/prom/misc_32.c
index 49b5057b9601..cf6c3f6d36c3 100644
--- a/arch/sparc/prom/misc.c
+++ b/arch/sparc/prom/misc_32.c
@@ -61,9 +61,7 @@ prom_cmdline(void)
61 restore_current(); 61 restore_current();
62 install_linux_ticker(); 62 install_linux_ticker();
63 spin_unlock_irqrestore(&prom_lock, flags); 63 spin_unlock_irqrestore(&prom_lock, flags);
64#ifdef CONFIG_SUN_AUXIO
65 set_auxio(AUXIO_LED, 0); 64 set_auxio(AUXIO_LED, 0);
66#endif
67} 65}
68 66
69/* Drop into the prom, but completely terminate the program. 67/* Drop into the prom, but completely terminate the program.
diff --git a/arch/sparc64/prom/misc.c b/arch/sparc/prom/misc_64.c
index 9b0c0760901e..9b0c0760901e 100644
--- a/arch/sparc64/prom/misc.c
+++ b/arch/sparc/prom/misc_64.c
diff --git a/arch/sparc64/prom/p1275.c b/arch/sparc/prom/p1275.c
index 4b7c937bba61..4b7c937bba61 100644
--- a/arch/sparc64/prom/p1275.c
+++ b/arch/sparc/prom/p1275.c
diff --git a/arch/sparc/prom/printf.c b/arch/sparc/prom/printf.c
index a36ab9c5ee08..660943ee4c2a 100644
--- a/arch/sparc/prom/printf.c
+++ b/arch/sparc/prom/printf.c
@@ -2,6 +2,7 @@
2 * printf.c: Internal prom library printf facility. 2 * printf.c: Internal prom library printf facility.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com) 6 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
6 * 7 *
7 * We used to warn all over the code: DO NOT USE prom_printf(), 8 * We used to warn all over the code: DO NOT USE prom_printf(),
@@ -13,7 +14,6 @@
13 */ 14 */
14 15
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/module.h>
17 17
18#include <asm/openprom.h> 18#include <asm/openprom.h>
19#include <asm/oplib.h> 19#include <asm/oplib.h>
@@ -34,7 +34,7 @@ prom_write(const char *buf, unsigned int n)
34} 34}
35 35
36void 36void
37prom_printf(char *fmt, ...) 37prom_printf(const char *fmt, ...)
38{ 38{
39 va_list args; 39 va_list args;
40 int i; 40 int i;
@@ -45,4 +45,3 @@ prom_printf(char *fmt, ...)
45 45
46 prom_write(ppbuf, i); 46 prom_write(ppbuf, i);
47} 47}
48EXPORT_SYMBOL(prom_printf);
diff --git a/arch/sparc/prom/tree.c b/arch/sparc/prom/tree_32.c
index f228fe057b24..6d8187357331 100644
--- a/arch/sparc/prom/tree.c
+++ b/arch/sparc/prom/tree_32.c
@@ -85,7 +85,7 @@ int prom_getsibling(int node)
85/* Return the length in bytes of property 'prop' at node 'node'. 85/* Return the length in bytes of property 'prop' at node 'node'.
86 * Return -1 on error. 86 * Return -1 on error.
87 */ 87 */
88int prom_getproplen(int node, char *prop) 88int prom_getproplen(int node, const char *prop)
89{ 89{
90 int ret; 90 int ret;
91 unsigned long flags; 91 unsigned long flags;
@@ -104,7 +104,7 @@ int prom_getproplen(int node, char *prop)
104 * 'buffer' which has a size of 'bufsize'. If the acquisition 104 * 'buffer' which has a size of 'bufsize'. If the acquisition
105 * was successful the length will be returned, else -1 is returned. 105 * was successful the length will be returned, else -1 is returned.
106 */ 106 */
107int prom_getproperty(int node, char *prop, char *buffer, int bufsize) 107int prom_getproperty(int node, const char *prop, char *buffer, int bufsize)
108{ 108{
109 int plen, ret; 109 int plen, ret;
110 unsigned long flags; 110 unsigned long flags;
@@ -303,7 +303,7 @@ int prom_node_has_property(int node, char *prop)
303/* Set property 'pname' at node 'node' to value 'value' which has a length 303/* Set property 'pname' at node 'node' to value 'value' which has a length
304 * of 'size' bytes. Return the number of bytes the prom accepted. 304 * of 'size' bytes. Return the number of bytes the prom accepted.
305 */ 305 */
306int prom_setprop(int node, char *pname, char *value, int size) 306int prom_setprop(int node, const char *pname, char *value, int size)
307{ 307{
308 unsigned long flags; 308 unsigned long flags;
309 int ret; 309 int ret;
diff --git a/arch/sparc64/prom/tree.c b/arch/sparc/prom/tree_64.c
index 281aea44790b..281aea44790b 100644
--- a/arch/sparc64/prom/tree.c
+++ b/arch/sparc/prom/tree_64.c
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
deleted file mode 100644
index 3b96e70b4670..000000000000
--- a/arch/sparc64/Kconfig
+++ /dev/null
@@ -1,433 +0,0 @@
1# sparc64 configuration
2mainmenu "Linux Kernel Configuration for 64-bit SPARC"
3
4config SPARC
5 bool
6 default y
7 select HAVE_OPROFILE
8 select HAVE_KPROBES
9 select HAVE_KRETPROBES
10
11config SPARC64
12 bool
13 default y
14 select HAVE_FUNCTION_TRACER
15 select HAVE_IDE
16 select HAVE_LMB
17 select HAVE_ARCH_KGDB
18 select USE_GENERIC_SMP_HELPERS if SMP
19 select HAVE_ARCH_TRACEHOOK
20 select ARCH_WANT_OPTIONAL_GPIOLIB
21 select RTC_CLASS
22 select RTC_DRV_M48T59
23 select RTC_DRV_CMOS
24 select RTC_DRV_BQ4802
25 select RTC_DRV_SUN4V
26 select RTC_DRV_STARFIRE
27
28config GENERIC_TIME
29 bool
30 default y
31
32config GENERIC_CMOS_UPDATE
33 bool
34 default y
35
36config GENERIC_CLOCKEVENTS
37 bool
38 default y
39
40config GENERIC_GPIO
41 bool
42 help
43 Generic GPIO API support
44
45config 64BIT
46 def_bool y
47
48config MMU
49 bool
50 default y
51
52config IOMMU_HELPER
53 bool
54 default y
55
56config QUICKLIST
57 bool
58 default y
59
60config STACKTRACE_SUPPORT
61 bool
62 default y
63
64config LOCKDEP_SUPPORT
65 bool
66 default y
67
68config ARCH_MAY_HAVE_PC_FDC
69 bool
70 default y
71
72config ARCH_HAS_ILOG2_U32
73 bool
74 default n
75
76config ARCH_HAS_ILOG2_U64
77 bool
78 default n
79
80config AUDIT_ARCH
81 bool
82 default y
83
84config HAVE_SETUP_PER_CPU_AREA
85 def_bool y
86
87config ARCH_NO_VIRT_TO_BUS
88 def_bool y
89
90config OF
91 def_bool y
92
93config GENERIC_HARDIRQS_NO__DO_IRQ
94 bool
95 def_bool y
96
97source "init/Kconfig"
98source "kernel/Kconfig.freezer"
99
100menu "Processor type and features"
101
102choice
103 prompt "Kernel page size"
104 default SPARC64_PAGE_SIZE_8KB
105
106config SPARC64_PAGE_SIZE_8KB
107 bool "8KB"
108 help
109 This lets you select the page size of the kernel.
110
111 8KB and 64KB work quite well, since SPARC ELF sections
112 provide for up to 64KB alignment.
113
114 If you don't know what to do, choose 8KB.
115
116config SPARC64_PAGE_SIZE_64KB
117 bool "64KB"
118
119endchoice
120
121config SECCOMP
122 bool "Enable seccomp to safely compute untrusted bytecode"
123 depends on PROC_FS
124 default y
125 help
126 This kernel feature is useful for number crunching applications
127 that may need to compute untrusted bytecode during their
128 execution. By using pipes or other transports made available to
129 the process as file descriptors supporting the read/write
130 syscalls, it's possible to isolate those applications in
131 their own address space using seccomp. Once seccomp is
132 enabled via /proc/<pid>/seccomp, it cannot be disabled
133 and the task is only allowed to execute a few safe syscalls
134 defined by each seccomp mode.
135
136 If unsure, say Y. Only embedded should say N here.
137
138source kernel/Kconfig.hz
139
140config HOTPLUG_CPU
141 bool "Support for hot-pluggable CPUs"
142 depends on SMP
143 select HOTPLUG
144 help
145 Say Y here to experiment with turning CPUs off and on. CPUs
146 can be controlled through /sys/devices/system/cpu/cpu#.
147 Say N if you want to disable CPU hotplug.
148
149config GENERIC_HARDIRQS
150 bool
151 default y
152
153source "kernel/time/Kconfig"
154
155config SMP
156 bool "Symmetric multi-processing support"
157 help
158 This enables support for systems with more than one CPU. If you have
159 a system with only one CPU, say N. If you have a system with more than
160 one CPU, say Y.
161
162 If you say N here, the kernel will run on single and multiprocessor
163 machines, but will use only one CPU of a multiprocessor machine. If
164 you say Y here, the kernel will run on single-processor machines.
165 On a single-processor machine, the kernel will run faster if you say
166 N here.
167
168 If you don't know what to do here, say N.
169
170config NR_CPUS
171 int "Maximum number of CPUs (2-1024)"
172 range 2 1024
173 depends on SMP
174 default "64"
175
176source "drivers/cpufreq/Kconfig"
177
178config US3_FREQ
179 tristate "UltraSPARC-III CPU Frequency driver"
180 depends on CPU_FREQ
181 select CPU_FREQ_TABLE
182 help
183 This adds the CPUFreq driver for UltraSPARC-III processors.
184
185 For details, take a look at <file:Documentation/cpu-freq>.
186
187 If in doubt, say N.
188
189config US2E_FREQ
190 tristate "UltraSPARC-IIe CPU Frequency driver"
191 depends on CPU_FREQ
192 select CPU_FREQ_TABLE
193 help
194 This adds the CPUFreq driver for UltraSPARC-IIe processors.
195
196 For details, take a look at <file:Documentation/cpu-freq>.
197
198 If in doubt, say N.
199
200config US3_MC
201 tristate "UltraSPARC-III Memory Controller driver"
202 default y
203 help
204 This adds a driver for the UltraSPARC-III memory controller.
205 Loading this driver allows exact mnemonic strings to be
206 printed in the event of a memory error, so that the faulty DIMM
207 on the motherboard can be matched to the error.
208
209 If in doubt, say Y, as this information can be very useful.
210
211# Global things across all Sun machines.
212config GENERIC_LOCKBREAK
213 bool
214 default y
215 depends on SMP && PREEMPT
216
217config RWSEM_GENERIC_SPINLOCK
218 bool
219
220config RWSEM_XCHGADD_ALGORITHM
221 bool
222 default y
223
224config GENERIC_FIND_NEXT_BIT
225 bool
226 default y
227
228config GENERIC_HWEIGHT
229 bool
230 default y if !ULTRA_HAS_POPULATION_COUNT
231
232config GENERIC_CALIBRATE_DELAY
233 bool
234 default y
235
236choice
237 prompt "SPARC64 Huge TLB Page Size"
238 depends on HUGETLB_PAGE
239 default HUGETLB_PAGE_SIZE_4MB
240
241config HUGETLB_PAGE_SIZE_4MB
242 bool "4MB"
243
244config HUGETLB_PAGE_SIZE_512K
245 bool "512K"
246
247config HUGETLB_PAGE_SIZE_64K
248 depends on !SPARC64_PAGE_SIZE_64KB
249 bool "64K"
250
251endchoice
252
253endmenu
254
255config NUMA
256 bool "NUMA support"
257 depends on SMP
258
259config NODES_SHIFT
260 int
261 default "4"
262 depends on NEED_MULTIPLE_NODES
263
264# Some NUMA nodes have memory ranges that span
265# other nodes. Even though a pfn is valid and
266# between a node's start and end pfns, it may not
267# reside on that node. See memmap_init_zone()
268# for details.
269config NODES_SPAN_OTHER_NODES
270 def_bool y
271 depends on NEED_MULTIPLE_NODES
272
273config ARCH_POPULATES_NODE_MAP
274 def_bool y
275
276config ARCH_SELECT_MEMORY_MODEL
277 def_bool y
278
279config ARCH_SPARSEMEM_ENABLE
280 def_bool y
281 select SPARSEMEM_VMEMMAP_ENABLE
282
283config ARCH_SPARSEMEM_DEFAULT
284 def_bool y
285
286source "mm/Kconfig"
287
288config ISA
289 bool
290
291config ISAPNP
292 bool
293
294config EISA
295 bool
296
297config MCA
298 bool
299
300config PCMCIA
301 tristate
302 help
303 Say Y here if you want to attach PCMCIA- or PC-cards to your Linux
304 computer. These are credit-card size devices such as network cards,
305 modems or hard drives often used with laptops computers. There are
306 actually two varieties of these cards: the older 16 bit PCMCIA cards
307 and the newer 32 bit CardBus cards. If you want to use CardBus
308 cards, you need to say Y here and also to "CardBus support" below.
309
310 To use your PC-cards, you will need supporting software from David
311 Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
312 for location). Please also read the PCMCIA-HOWTO, available from
313 <http://www.tldp.org/docs.html#howto>.
314
315 To compile this driver as modules, choose M here: the
316 modules will be called pcmcia_core and ds.
317
318config SBUS
319 bool
320 default y
321
322config SBUSCHAR
323 bool
324 default y
325
326config SUN_AUXIO
327 bool
328 default y
329
330config SUN_IO
331 bool
332 default y
333
334config SUN_LDOMS
335 bool "Sun Logical Domains support"
336 help
337 Say Y here is you want to support virtual devices via
338 Logical Domains.
339
340config PCI
341 bool "PCI support"
342 select ARCH_SUPPORTS_MSI
343 help
344 Find out whether your system includes a PCI bus. PCI is the name of
345 a bus system, i.e. the way the CPU talks to the other stuff inside
346 your box. If you say Y here, the kernel will include drivers and
347 infrastructure code to support PCI bus devices.
348
349config PCI_DOMAINS
350 def_bool PCI
351
352config PCI_SYSCALL
353 def_bool PCI
354
355source "drivers/pci/Kconfig"
356
357config SUN_OPENPROMFS
358 tristate "Openprom tree appears in /proc/openprom"
359 help
360 If you say Y, the OpenPROM device tree will be available as a
361 virtual file system, which you can mount to /proc/openprom by "mount
362 -t openpromfs none /proc/openprom".
363
364 To compile the /proc/openprom support as a module, choose M here: the
365 module will be called openpromfs. If unsure, choose M.
366
367menu "Executable file formats"
368
369source "fs/Kconfig.binfmt"
370
371config COMPAT
372 bool
373 default y
374 select COMPAT_BINFMT_ELF
375
376config SYSVIPC_COMPAT
377 bool
378 depends on COMPAT && SYSVIPC
379 default y
380
381endmenu
382
383config SCHED_SMT
384 bool "SMT (Hyperthreading) scheduler support"
385 depends on SMP
386 default y
387 help
388 SMT scheduler support improves the CPU scheduler's decision making
389 when dealing with SPARC cpus at a cost of slightly increased overhead
390 in some places. If unsure say N here.
391
392config SCHED_MC
393 bool "Multi-core scheduler support"
394 depends on SMP
395 default y
396 help
397 Multi-core scheduler support improves the CPU scheduler's decision
398 making when dealing with multi-core CPU chips at a cost of slightly
399 increased overhead in some places. If unsure say N here.
400
401source "kernel/Kconfig.preempt"
402
403config CMDLINE_BOOL
404 bool "Default bootloader kernel arguments"
405
406config CMDLINE
407 string "Initial kernel command string"
408 depends on CMDLINE_BOOL
409 default "console=ttyS0,9600 root=/dev/sda1"
410 help
411 Say Y here if you want to be able to pass default arguments to
412 the kernel. This will be overridden by the bootloader, if you
413 use one (such as SILO). This is most useful if you want to boot
414 a kernel from TFTP, and want default options to be available
415 with having them passed on the command line.
416
417 NOTE: This option WILL override the PROM bootargs setting!
418
419source "net/Kconfig"
420
421source "drivers/Kconfig"
422
423source "drivers/sbus/char/Kconfig"
424
425source "fs/Kconfig"
426
427source "arch/sparc64/Kconfig.debug"
428
429source "security/Kconfig"
430
431source "crypto/Kconfig"
432
433source "lib/Kconfig"
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug
deleted file mode 100644
index c40515c06690..000000000000
--- a/arch/sparc64/Kconfig.debug
+++ /dev/null
@@ -1,44 +0,0 @@
1menu "Kernel hacking"
2
3config TRACE_IRQFLAGS_SUPPORT
4 bool
5 default y
6
7source "lib/Kconfig.debug"
8
9config DEBUG_STACK_USAGE
10 bool "Enable stack utilization instrumentation"
11 depends on DEBUG_KERNEL
12 help
13 Enables the display of the minimum amount of free stack which each
14 task has ever had available in the sysrq-T and sysrq-P debug output.
15
16 This option will slow down process creation somewhat.
17
18config DEBUG_DCFLUSH
19 bool "D-cache flush debugging"
20 depends on DEBUG_KERNEL
21
22config STACK_DEBUG
23 depends on DEBUG_KERNEL
24 bool "Stack Overflow Detection Support"
25
26config DEBUG_PAGEALLOC
27 bool "Debug page memory allocations"
28 depends on DEBUG_KERNEL && !HIBERNATION
29 help
30 Unmap pages from the kernel linear mapping after free_pages().
31 This results in a large slowdown, but helps to find certain types
32 of memory corruptions.
33
34config MCOUNT
35 bool
36 depends on STACK_DEBUG || FUNCTION_TRACER
37 default y
38
39config FRAME_POINTER
40 bool
41 depends on MCOUNT
42 default y
43
44endmenu
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
deleted file mode 100644
index c7214abc0d84..000000000000
--- a/arch/sparc64/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
1# sparc64/Makefile
2#
3# Makefile for the architecture dependent flags and dependencies on the
4# 64-bit Sparc.
5#
6# Copyright (C) 1996,1998 David S. Miller (davem@caip.rutgers.edu)
7# Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
8#
9
10CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
11
12# Undefine sparc when processing vmlinux.lds - it is used
13# And teach CPP we are doing 64 bit builds (for this case)
14CPPFLAGS_vmlinux.lds += -m64 -Usparc
15
16LDFLAGS := -m elf64_sparc
17
18KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
19 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
20 -Wa,--undeclared-regs
21KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
22KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
23
24ifeq ($(CONFIG_MCOUNT),y)
25 KBUILD_CFLAGS += -pg
26endif
27
28head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
29
30core-y += arch/sparc64/kernel/ arch/sparc64/mm/
31core-y += arch/sparc64/math-emu/
32libs-y += arch/sparc64/prom/ arch/sparc64/lib/
33drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/
34
35boot := arch/sparc64/boot
36
37image tftpboot.img vmlinux.aout: vmlinux
38 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
39
40archclean:
41 $(Q)$(MAKE) $(clean)=$(boot)
42
43define archhelp
44 echo '* vmlinux - Standard sparc64 kernel'
45 echo ' vmlinux.aout - a.out kernel for sparc64'
46 echo ' tftpboot.img - Image prepared for tftp'
47endef
48
diff --git a/arch/sparc64/boot/Makefile b/arch/sparc64/boot/Makefile
deleted file mode 100644
index 0458b5244f09..000000000000
--- a/arch/sparc64/boot/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
1# Makefile for the Sparc64 boot stuff.
2#
3# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
4# Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5
6ROOT_IMG := /usr/src/root.img
7ELFTOAOUT := elftoaout
8
9hostprogs-y := piggyback
10targets := image tftpboot.img vmlinux.aout
11
12quiet_cmd_elftoaout = ELF2AOUT $@
13 cmd_elftoaout = $(ELFTOAOUT) vmlinux -o $@
14quiet_cmd_piggy = PIGGY $@
15 cmd_piggy = $(obj)/piggyback $@ System.map $(ROOT_IMG)
16quiet_cmd_strip = STRIP $@
17 cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start vmlinux -o $@
18
19
20# Actual linking
21$(obj)/image: vmlinux FORCE
22 $(call if_changed,strip)
23 @echo ' kernel: $@ is ready'
24
25$(obj)/tftpboot.img: vmlinux $(obj)/piggyback System.map $(ROOT_IMG) FORCE
26 $(call if_changed,elftoaout)
27 $(call if_changed,piggy)
28 @echo ' kernel: $@ is ready'
29
30$(obj)/vmlinux.aout: vmlinux FORCE
31 $(call if_changed,elftoaout)
32 @echo ' kernel: $@ is ready'
33
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
deleted file mode 100644
index b3e0b986bef8..000000000000
--- a/arch/sparc64/kernel/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5EXTRA_AFLAGS := -ansi
6EXTRA_CFLAGS := -Werror
7
8CFLAGS_REMOVE_ftrace.o = -pg
9
10extra-y := head.o init_task.o vmlinux.lds
11
12obj-y := process.o setup.o cpu.o idprom.o reboot.o \
13 traps.o auxio.o una_asm.o sysfs.o iommu.o \
14 irq.o ptrace.o time.o sys_sparc.o signal.o \
15 unaligned.o central.o starfire.o \
16 power.o sbus.o sparc64_ksyms.o ebus.o \
17 visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o
18
19obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
20obj-$(CONFIG_STACKTRACE) += stacktrace.o
21obj-$(CONFIG_PCI) += pci.o pci_common.o psycho_common.o \
22 pci_psycho.o pci_sabre.o pci_schizo.o \
23 pci_sun4v.o pci_sun4v_asm.o pci_fire.o
24obj-$(CONFIG_PCI_MSI) += pci_msi.o
25obj-$(CONFIG_SMP) += smp.o trampoline.o hvtramp.o
26obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o
27obj-$(CONFIG_MODULES) += module.o
28obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o
29obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o
30obj-$(CONFIG_US3_MC) += chmc.o
31obj-$(CONFIG_KPROBES) += kprobes.o
32obj-$(CONFIG_SUN_LDOMS) += ldc.o vio.o viohs.o ds.o
33obj-$(CONFIG_AUDIT) += audit.o
34obj-$(CONFIG_AUDIT)$(CONFIG_COMPAT) += compat_audit.o
35obj-y += $(obj-yy)
36obj-$(CONFIG_KGDB) += kgdb.o
diff --git a/arch/sparc64/kernel/asm-offsets.c b/arch/sparc64/kernel/asm-offsets.c
deleted file mode 100644
index 9e263112a6e2..000000000000
--- a/arch/sparc64/kernel/asm-offsets.c
+++ /dev/null
@@ -1 +0,0 @@
1/* Dummy asm-offsets.c file. Required by kbuild and ready to be used - hint! */
diff --git a/arch/sparc64/kernel/cpu.c b/arch/sparc64/kernel/cpu.c
deleted file mode 100644
index 0c9ac83ed0a8..000000000000
--- a/arch/sparc64/kernel/cpu.c
+++ /dev/null
@@ -1,166 +0,0 @@
1/* cpu.c: Dinky routines to look for the kind of Sparc cpu
2 * we are on.
3 *
4 * Copyright (C) 1996, 2007, 2008 David S. Miller (davem@davemloft.net)
5 */
6
7#include <linux/kernel.h>
8#include <linux/init.h>
9#include <linux/sched.h>
10#include <linux/smp.h>
11#include <asm/asi.h>
12#include <asm/system.h>
13#include <asm/fpumacro.h>
14#include <asm/cpudata.h>
15#include <asm/spitfire.h>
16#include <asm/oplib.h>
17
18#include "entry.h"
19
20DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
21
22struct cpu_chip_info {
23 unsigned short manuf;
24 unsigned short impl;
25 const char *cpu_name;
26 const char *fp_name;
27};
28
29static const struct cpu_chip_info cpu_chips[] = {
30 {
31 .manuf = 0x17,
32 .impl = 0x10,
33 .cpu_name = "TI UltraSparc I (SpitFire)",
34 .fp_name = "UltraSparc I integrated FPU",
35 },
36 {
37 .manuf = 0x22,
38 .impl = 0x10,
39 .cpu_name = "TI UltraSparc I (SpitFire)",
40 .fp_name = "UltraSparc I integrated FPU",
41 },
42 {
43 .manuf = 0x17,
44 .impl = 0x11,
45 .cpu_name = "TI UltraSparc II (BlackBird)",
46 .fp_name = "UltraSparc II integrated FPU",
47 },
48 {
49 .manuf = 0x17,
50 .impl = 0x12,
51 .cpu_name = "TI UltraSparc IIi (Sabre)",
52 .fp_name = "UltraSparc IIi integrated FPU",
53 },
54 {
55 .manuf = 0x17,
56 .impl = 0x13,
57 .cpu_name = "TI UltraSparc IIe (Hummingbird)",
58 .fp_name = "UltraSparc IIe integrated FPU",
59 },
60 {
61 .manuf = 0x3e,
62 .impl = 0x14,
63 .cpu_name = "TI UltraSparc III (Cheetah)",
64 .fp_name = "UltraSparc III integrated FPU",
65 },
66 {
67 .manuf = 0x3e,
68 .impl = 0x15,
69 .cpu_name = "TI UltraSparc III+ (Cheetah+)",
70 .fp_name = "UltraSparc III+ integrated FPU",
71 },
72 {
73 .manuf = 0x3e,
74 .impl = 0x16,
75 .cpu_name = "TI UltraSparc IIIi (Jalapeno)",
76 .fp_name = "UltraSparc IIIi integrated FPU",
77 },
78 {
79 .manuf = 0x3e,
80 .impl = 0x18,
81 .cpu_name = "TI UltraSparc IV (Jaguar)",
82 .fp_name = "UltraSparc IV integrated FPU",
83 },
84 {
85 .manuf = 0x3e,
86 .impl = 0x19,
87 .cpu_name = "TI UltraSparc IV+ (Panther)",
88 .fp_name = "UltraSparc IV+ integrated FPU",
89 },
90 {
91 .manuf = 0x3e,
92 .impl = 0x22,
93 .cpu_name = "TI UltraSparc IIIi+ (Serrano)",
94 .fp_name = "UltraSparc IIIi+ integrated FPU",
95 },
96};
97
98#define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips)
99
100const char *sparc_cpu_type;
101const char *sparc_fpu_type;
102
103static void __init sun4v_cpu_probe(void)
104{
105 switch (sun4v_chip_type) {
106 case SUN4V_CHIP_NIAGARA1:
107 sparc_cpu_type = "UltraSparc T1 (Niagara)";
108 sparc_fpu_type = "UltraSparc T1 integrated FPU";
109 break;
110
111 case SUN4V_CHIP_NIAGARA2:
112 sparc_cpu_type = "UltraSparc T2 (Niagara2)";
113 sparc_fpu_type = "UltraSparc T2 integrated FPU";
114 break;
115
116 default:
117 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
118 prom_cpu_compatible);
119 sparc_cpu_type = "Unknown SUN4V CPU";
120 sparc_fpu_type = "Unknown SUN4V FPU";
121 break;
122 }
123}
124
125static const struct cpu_chip_info * __init find_cpu_chip(unsigned short manuf,
126 unsigned short impl)
127{
128 int i;
129
130 for (i = 0; i < ARRAY_SIZE(cpu_chips); i++) {
131 const struct cpu_chip_info *p = &cpu_chips[i];
132
133 if (p->manuf == manuf && p->impl == impl)
134 return p;
135 }
136 return NULL;
137}
138
139static int __init cpu_type_probe(void)
140{
141 if (tlb_type == hypervisor) {
142 sun4v_cpu_probe();
143 } else {
144 unsigned long ver, manuf, impl;
145 const struct cpu_chip_info *p;
146
147 __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
148
149 manuf = ((ver >> 48) & 0xffff);
150 impl = ((ver >> 32) & 0xffff);
151
152 p = find_cpu_chip(manuf, impl);
153 if (p) {
154 sparc_cpu_type = p->cpu_name;
155 sparc_fpu_type = p->fp_name;
156 } else {
157 printk(KERN_ERR "CPU: Unknown chip, manuf[%lx] impl[%lx]\n",
158 manuf, impl);
159 sparc_cpu_type = "Unknown CPU";
160 sparc_fpu_type = "Unknown FPU";
161 }
162 }
163 return 0;
164}
165
166arch_initcall(cpu_type_probe);
diff --git a/arch/sparc64/kernel/idprom.c b/arch/sparc64/kernel/idprom.c
deleted file mode 100644
index a62ff83337cd..000000000000
--- a/arch/sparc64/kernel/idprom.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * idprom.c: Routines to load the idprom into kernel addresses and
3 * interpret the data contained within.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
7
8#include <linux/kernel.h>
9#include <linux/types.h>
10#include <linux/init.h>
11
12#include <asm/oplib.h>
13#include <asm/idprom.h>
14
15struct idprom *idprom;
16static struct idprom idprom_buffer;
17
18/* Calculate the IDPROM checksum (xor of the data bytes). */
19static unsigned char __init calc_idprom_cksum(struct idprom *idprom)
20{
21 unsigned char cksum, i, *ptr = (unsigned char *)idprom;
22
23 for (i = cksum = 0; i <= 0x0E; i++)
24 cksum ^= *ptr++;
25
26 return cksum;
27}
28
29/* Create a local IDPROM copy and verify integrity. */
30void __init idprom_init(void)
31{
32 prom_get_idprom((char *) &idprom_buffer, sizeof(idprom_buffer));
33
34 idprom = &idprom_buffer;
35
36 if (idprom->id_format != 0x01) {
37 prom_printf("IDPROM: Warning, unknown format type!\n");
38 }
39
40 if (idprom->id_cksum != calc_idprom_cksum(idprom)) {
41 prom_printf("IDPROM: Warning, checksum failure (nvram=%x, calc=%x)!\n",
42 idprom->id_cksum, calc_idprom_cksum(idprom));
43 }
44
45 printk("Ethernet address: %pM\n", idprom->id_ethaddr);
46}
diff --git a/arch/sparc64/kernel/init_task.c b/arch/sparc64/kernel/init_task.c
deleted file mode 100644
index d2b312381c19..000000000000
--- a/arch/sparc64/kernel/init_task.c
+++ /dev/null
@@ -1,35 +0,0 @@
1#include <linux/mm.h>
2#include <linux/fs.h>
3#include <linux/module.h>
4#include <linux/sched.h>
5#include <linux/init_task.h>
6#include <linux/mqueue.h>
7
8#include <asm/pgtable.h>
9#include <asm/uaccess.h>
10#include <asm/processor.h>
11
12static struct fs_struct init_fs = INIT_FS;
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15struct mm_struct init_mm = INIT_MM(init_mm);
16
17EXPORT_SYMBOL(init_mm);
18
19/* .text section in head.S is aligned at 2 page boundary and this gets linked
20 * right after that so that the init_thread_union is aligned properly as well.
21 * We really don't need this special alignment like the Intel does, but
22 * I do it anyways for completeness.
23 */
24__asm__ (".text");
25union thread_union init_thread_union = { INIT_THREAD_INFO(init_task) };
26
27/*
28 * Initial task structure.
29 *
30 * All other task structs will be allocated on slabs in fork.c
31 */
32EXPORT_SYMBOL(init_task);
33
34__asm__(".data");
35struct task_struct init_task = INIT_TASK(init_task);
diff --git a/arch/sparc64/kernel/module.c b/arch/sparc64/kernel/module.c
deleted file mode 100644
index 158484bf5999..000000000000
--- a/arch/sparc64/kernel/module.c
+++ /dev/null
@@ -1,213 +0,0 @@
1/* Kernel module help for sparc64.
2 *
3 * Copyright (C) 2001 Rusty Russell.
4 * Copyright (C) 2002 David S. Miller.
5 */
6
7#include <linux/moduleloader.h>
8#include <linux/kernel.h>
9#include <linux/elf.h>
10#include <linux/vmalloc.h>
11#include <linux/fs.h>
12#include <linux/string.h>
13#include <linux/slab.h>
14#include <linux/mm.h>
15
16#include <asm/processor.h>
17#include <asm/spitfire.h>
18
19static void *module_map(unsigned long size)
20{
21 struct vm_struct *area;
22
23 size = PAGE_ALIGN(size);
24 if (!size || size > MODULES_LEN)
25 return NULL;
26
27 area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
28 if (!area)
29 return NULL;
30
31 return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
32}
33
34void *module_alloc(unsigned long size)
35{
36 void *ret;
37
38 /* We handle the zero case fine, unlike vmalloc */
39 if (size == 0)
40 return NULL;
41
42 ret = module_map(size);
43 if (!ret)
44 ret = ERR_PTR(-ENOMEM);
45 else
46 memset(ret, 0, size);
47
48 return ret;
49}
50
51/* Free memory returned from module_core_alloc/module_init_alloc */
52void module_free(struct module *mod, void *module_region)
53{
54 vfree(module_region);
55 /* FIXME: If module_region == mod->init_region, trim exception
56 table entries. */
57}
58
59/* Make generic code ignore STT_REGISTER dummy undefined symbols. */
60int module_frob_arch_sections(Elf_Ehdr *hdr,
61 Elf_Shdr *sechdrs,
62 char *secstrings,
63 struct module *mod)
64{
65 unsigned int symidx;
66 Elf64_Sym *sym;
67 const char *strtab;
68 int i;
69
70 for (symidx = 0; sechdrs[symidx].sh_type != SHT_SYMTAB; symidx++) {
71 if (symidx == hdr->e_shnum-1) {
72 printk("%s: no symtab found.\n", mod->name);
73 return -ENOEXEC;
74 }
75 }
76 sym = (Elf64_Sym *)sechdrs[symidx].sh_addr;
77 strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr;
78
79 for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) {
80 if (sym[i].st_shndx == SHN_UNDEF &&
81 ELF64_ST_TYPE(sym[i].st_info) == STT_REGISTER)
82 sym[i].st_shndx = SHN_ABS;
83 }
84 return 0;
85}
86
87int apply_relocate(Elf64_Shdr *sechdrs,
88 const char *strtab,
89 unsigned int symindex,
90 unsigned int relsec,
91 struct module *me)
92{
93 printk(KERN_ERR "module %s: non-ADD RELOCATION unsupported\n",
94 me->name);
95 return -ENOEXEC;
96}
97
98int apply_relocate_add(Elf64_Shdr *sechdrs,
99 const char *strtab,
100 unsigned int symindex,
101 unsigned int relsec,
102 struct module *me)
103{
104 unsigned int i;
105 Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr;
106 Elf64_Sym *sym;
107 u8 *location;
108 u32 *loc32;
109
110 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
111 Elf64_Addr v;
112
113 /* This is where to make the change */
114 location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr
115 + rel[i].r_offset;
116 loc32 = (u32 *) location;
117
118 BUG_ON(((u64)location >> (u64)32) != (u64)0);
119
120 /* This is the symbol it is referring to. Note that all
121 undefined symbols have been resolved. */
122 sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
123 + ELF64_R_SYM(rel[i].r_info);
124 v = sym->st_value + rel[i].r_addend;
125
126 switch (ELF64_R_TYPE(rel[i].r_info) & 0xff) {
127 case R_SPARC_64:
128 location[0] = v >> 56;
129 location[1] = v >> 48;
130 location[2] = v >> 40;
131 location[3] = v >> 32;
132 location[4] = v >> 24;
133 location[5] = v >> 16;
134 location[6] = v >> 8;
135 location[7] = v >> 0;
136 break;
137
138 case R_SPARC_32:
139 location[0] = v >> 24;
140 location[1] = v >> 16;
141 location[2] = v >> 8;
142 location[3] = v >> 0;
143 break;
144
145 case R_SPARC_DISP32:
146 v -= (Elf64_Addr) location;
147 *loc32 = v;
148 break;
149
150 case R_SPARC_WDISP30:
151 v -= (Elf64_Addr) location;
152 *loc32 = (*loc32 & ~0x3fffffff) |
153 ((v >> 2) & 0x3fffffff);
154 break;
155
156 case R_SPARC_WDISP22:
157 v -= (Elf64_Addr) location;
158 *loc32 = (*loc32 & ~0x3fffff) |
159 ((v >> 2) & 0x3fffff);
160 break;
161
162 case R_SPARC_WDISP19:
163 v -= (Elf64_Addr) location;
164 *loc32 = (*loc32 & ~0x7ffff) |
165 ((v >> 2) & 0x7ffff);
166 break;
167
168 case R_SPARC_LO10:
169 *loc32 = (*loc32 & ~0x3ff) | (v & 0x3ff);
170 break;
171
172 case R_SPARC_HI22:
173 *loc32 = (*loc32 & ~0x3fffff) |
174 ((v >> 10) & 0x3fffff);
175 break;
176
177 case R_SPARC_OLO10:
178 *loc32 = (*loc32 & ~0x1fff) |
179 (((v & 0x3ff) +
180 (ELF64_R_TYPE(rel[i].r_info) >> 8))
181 & 0x1fff);
182 break;
183
184 default:
185 printk(KERN_ERR "module %s: Unknown relocation: %x\n",
186 me->name,
187 (int) (ELF64_R_TYPE(rel[i].r_info) & 0xff));
188 return -ENOEXEC;
189 };
190 }
191 return 0;
192}
193
194int module_finalize(const Elf_Ehdr *hdr,
195 const Elf_Shdr *sechdrs,
196 struct module *me)
197{
198 /* Cheetah's I-cache is fully coherent. */
199 if (tlb_type == spitfire) {
200 unsigned long va;
201
202 flushw_all();
203 for (va = 0; va < (PAGE_SIZE << 1); va += 32)
204 spitfire_put_icache_tag(va, 0x0);
205 __asm__ __volatile__("flush %g6");
206 }
207
208 return 0;
209}
210
211void module_arch_cleanup(struct module *mod)
212{
213}
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
deleted file mode 100644
index 01f809617e5e..000000000000
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ /dev/null
@@ -1,147 +0,0 @@
1/* ld script to make UltraLinux kernel */
2
3#include <asm/page.h>
4#include <asm-generic/vmlinux.lds.h>
5
6OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
7OUTPUT_ARCH(sparc:v9a)
8ENTRY(_start)
9
10jiffies = jiffies_64;
11SECTIONS
12{
13 swapper_low_pmd_dir = 0x0000000000402000;
14 . = 0x4000;
15 .text 0x0000000000404000 : {
16 _text = .;
17 TEXT_TEXT
18 SCHED_TEXT
19 LOCK_TEXT
20 KPROBES_TEXT
21 *(.gnu.warning)
22 } = 0
23 _etext = .;
24 PROVIDE (etext = .);
25
26 RO_DATA(PAGE_SIZE)
27 .data : {
28 DATA_DATA
29 CONSTRUCTORS
30 }
31 .data1 : {
32 *(.data1)
33 }
34 . = ALIGN(64);
35 .data.cacheline_aligned : {
36 *(.data.cacheline_aligned)
37 }
38 . = ALIGN(64);
39 .data.read_mostly : {
40 *(.data.read_mostly)
41 }
42 _edata = .;
43 PROVIDE (edata = .);
44 .fixup : {
45 *(.fixup)
46 }
47 . = ALIGN(16);
48 __ex_table : {
49 __start___ex_table = .;
50 *(__ex_table)
51 __stop___ex_table = .;
52 }
53 NOTES
54
55 . = ALIGN(PAGE_SIZE);
56 .init.text : {
57 __init_begin = .;
58 _sinittext = .;
59 INIT_TEXT
60 _einittext = .;
61 }
62 .init.data : {
63 INIT_DATA
64 }
65 . = ALIGN(16);
66 .init.setup : {
67 __setup_start = .;
68 *(.init.setup)
69 __setup_end = .;
70 }
71 .initcall.init : {
72 __initcall_start = .;
73 INITCALLS
74 __initcall_end = .;
75 }
76 .con_initcall.init : {
77 __con_initcall_start = .;
78 *(.con_initcall.init)
79 __con_initcall_end = .;
80 }
81 SECURITY_INIT
82
83 . = ALIGN(4);
84 .tsb_ldquad_phys_patch : {
85 __tsb_ldquad_phys_patch = .;
86 *(.tsb_ldquad_phys_patch)
87 __tsb_ldquad_phys_patch_end = .;
88 }
89
90 .tsb_phys_patch : {
91 __tsb_phys_patch = .;
92 *(.tsb_phys_patch)
93 __tsb_phys_patch_end = .;
94 }
95
96 .cpuid_patch : {
97 __cpuid_patch = .;
98 *(.cpuid_patch)
99 __cpuid_patch_end = .;
100 }
101
102 .sun4v_1insn_patch : {
103 __sun4v_1insn_patch = .;
104 *(.sun4v_1insn_patch)
105 __sun4v_1insn_patch_end = .;
106 }
107 .sun4v_2insn_patch : {
108 __sun4v_2insn_patch = .;
109 *(.sun4v_2insn_patch)
110 __sun4v_2insn_patch_end = .;
111 }
112
113#ifdef CONFIG_BLK_DEV_INITRD
114 . = ALIGN(PAGE_SIZE);
115 .init.ramfs : {
116 __initramfs_start = .;
117 *(.init.ramfs)
118 __initramfs_end = .;
119 }
120#endif
121
122 PERCPU(PAGE_SIZE)
123
124 . = ALIGN(PAGE_SIZE);
125 __init_end = .;
126 __bss_start = .;
127 .sbss : {
128 *(.sbss)
129 *(.scommon)
130 }
131 .bss : {
132 *(.dynbss)
133 *(.bss)
134 *(COMMON)
135 }
136 _end = . ;
137 PROVIDE (end = .);
138
139 /DISCARD/ : {
140 EXIT_TEXT
141 EXIT_DATA
142 *(.exitcall.exit)
143 }
144
145 STABS_DEBUG
146 DWARF_DEBUG
147}
diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile
deleted file mode 100644
index f095e13910bc..000000000000
--- a/arch/sparc64/lib/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
1#
2# Makefile for Sparc64 library files..
3#
4
5EXTRA_AFLAGS := -ansi
6EXTRA_CFLAGS := -Werror
7
8lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \
9 memscan.o strncpy_from_user.o strlen_user.o memcmp.o checksum.o \
10 bzero.o csum_copy.o csum_copy_from_user.o csum_copy_to_user.o \
11 VISsave.o atomic.o bitops.o \
12 U1memcpy.o U1copy_from_user.o U1copy_to_user.o \
13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \
14 NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \
15 NGpage.o NGbzero.o \
16 NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o NG2patch.o \
17 NG2page.o \
18 GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \
19 GENpage.o GENbzero.o \
20 copy_in_user.o user_fixup.o memmove.o \
21 mcount.o ipcsum.o rwsem.o xor.o
22
23obj-y += iomap.o
diff --git a/arch/sparc64/lib/iomap.c b/arch/sparc64/lib/iomap.c
deleted file mode 100644
index 7120ebbd4d03..000000000000
--- a/arch/sparc64/lib/iomap.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Implement the sparc64 iomap interfaces
3 */
4#include <linux/pci.h>
5#include <linux/module.h>
6#include <asm/io.h>
7
8/* Create a virtual mapping cookie for an IO port range */
9void __iomem *ioport_map(unsigned long port, unsigned int nr)
10{
11 return (void __iomem *) (unsigned long) port;
12}
13
14void ioport_unmap(void __iomem *addr)
15{
16 /* Nothing to do */
17}
18EXPORT_SYMBOL(ioport_map);
19EXPORT_SYMBOL(ioport_unmap);
20
21/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
22void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
23{
24 resource_size_t start = pci_resource_start(dev, bar);
25 resource_size_t len = pci_resource_len(dev, bar);
26 unsigned long flags = pci_resource_flags(dev, bar);
27
28 if (!len || !start)
29 return NULL;
30 if (maxlen && len > maxlen)
31 len = maxlen;
32 if (flags & IORESOURCE_IO)
33 return ioport_map(start, len);
34 if (flags & IORESOURCE_MEM) {
35 if (flags & IORESOURCE_CACHEABLE)
36 return ioremap(start, len);
37 return ioremap_nocache(start, len);
38 }
39 /* What? */
40 return NULL;
41}
42
43void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
44{
45 /* nothing to do */
46}
47EXPORT_SYMBOL(pci_iomap);
48EXPORT_SYMBOL(pci_iounmap);
diff --git a/arch/sparc64/lib/memcmp.S b/arch/sparc64/lib/memcmp.S
deleted file mode 100644
index d3fdaa898566..000000000000
--- a/arch/sparc64/lib/memcmp.S
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Sparc64 optimized memcmp code.
3 *
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
6 */
7
8 .text
9 .align 32
10 .globl __memcmp, memcmp
11__memcmp:
12memcmp:
13 cmp %o2, 0 ! IEU1 Group
14loop: be,pn %icc, ret_0 ! CTI
15 nop ! IEU0
16 ldub [%o0], %g7 ! LSU Group
17 ldub [%o1], %g3 ! LSU Group
18 sub %o2, 1, %o2 ! IEU0
19 add %o0, 1, %o0 ! IEU1
20 add %o1, 1, %o1 ! IEU0 Group
21 subcc %g7, %g3, %g3 ! IEU1 Group
22 be,pt %icc, loop ! CTI
23 cmp %o2, 0 ! IEU1 Group
24
25ret_n0: retl
26 mov %g3, %o0
27ret_0: retl
28 mov 0, %o0
diff --git a/arch/sparc64/lib/strlen.S b/arch/sparc64/lib/strlen.S
deleted file mode 100644
index e9ba1920d818..000000000000
--- a/arch/sparc64/lib/strlen.S
+++ /dev/null
@@ -1,80 +0,0 @@
1/* strlen.S: Sparc64 optimized strlen code
2 * Hand optimized from GNU libc's strlen
3 * Copyright (C) 1991,1996 Free Software Foundation
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1996, 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */
7
8#define LO_MAGIC 0x01010101
9#define HI_MAGIC 0x80808080
10
11 .align 32
12 .globl strlen
13 .type strlen,#function
14strlen:
15 mov %o0, %o1
16 andcc %o0, 3, %g0
17 be,pt %icc, 9f
18 sethi %hi(HI_MAGIC), %o4
19 ldub [%o0], %o5
20 brz,pn %o5, 11f
21 add %o0, 1, %o0
22 andcc %o0, 3, %g0
23 be,pn %icc, 4f
24 or %o4, %lo(HI_MAGIC), %o3
25 ldub [%o0], %o5
26 brz,pn %o5, 12f
27 add %o0, 1, %o0
28 andcc %o0, 3, %g0
29 be,pt %icc, 5f
30 sethi %hi(LO_MAGIC), %o4
31 ldub [%o0], %o5
32 brz,pn %o5, 13f
33 add %o0, 1, %o0
34 ba,pt %icc, 8f
35 or %o4, %lo(LO_MAGIC), %o2
369:
37 or %o4, %lo(HI_MAGIC), %o3
384:
39 sethi %hi(LO_MAGIC), %o4
405:
41 or %o4, %lo(LO_MAGIC), %o2
428:
43 ld [%o0], %o5
442:
45 sub %o5, %o2, %o4
46 andcc %o4, %o3, %g0
47 be,pt %icc, 8b
48 add %o0, 4, %o0
49
50 /* Check every byte. */
51 srl %o5, 24, %g7
52 andcc %g7, 0xff, %g0
53 be,pn %icc, 1f
54 add %o0, -4, %o4
55 srl %o5, 16, %g7
56 andcc %g7, 0xff, %g0
57 be,pn %icc, 1f
58 add %o4, 1, %o4
59 srl %o5, 8, %g7
60 andcc %g7, 0xff, %g0
61 be,pn %icc, 1f
62 add %o4, 1, %o4
63 andcc %o5, 0xff, %g0
64 bne,a,pt %icc, 2b
65 ld [%o0], %o5
66 add %o4, 1, %o4
671:
68 retl
69 sub %o4, %o1, %o0
7011:
71 retl
72 mov 0, %o0
7312:
74 retl
75 mov 1, %o0
7613:
77 retl
78 mov 2, %o0
79
80 .size strlen, .-strlen
diff --git a/arch/sparc64/math-emu/Makefile b/arch/sparc64/math-emu/Makefile
deleted file mode 100644
index cc5cb9baf6aa..000000000000
--- a/arch/sparc64/math-emu/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# Makefile for the FPU instruction emulation.
3#
4
5obj-y := math.o
6
7EXTRA_CFLAGS = -Iinclude/math-emu -w
diff --git a/arch/sparc64/mm/Makefile b/arch/sparc64/mm/Makefile
deleted file mode 100644
index 68d04c0370f4..000000000000
--- a/arch/sparc64/mm/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1# Makefile for the linux Sparc64-specific parts of the memory manager.
2#
3
4EXTRA_AFLAGS := -ansi
5EXTRA_CFLAGS := -Werror
6
7obj-y := ultra.o tlb.o tsb.o fault.o init.o generic.o
8
9obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
diff --git a/arch/sparc64/oprofile/Makefile b/arch/sparc64/oprofile/Makefile
deleted file mode 100644
index e9feca1ca28b..000000000000
--- a/arch/sparc64/oprofile/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1obj-$(CONFIG_OPROFILE) += oprofile.o
2
3DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
4 oprof.o cpu_buffer.o buffer_sync.o \
5 event_buffer.o oprofile_files.o \
6 oprofilefs.o oprofile_stats.o \
7 timer_int.o )
8
9oprofile-y := $(DRIVER_OBJS) init.o
diff --git a/arch/sparc64/oprofile/init.c b/arch/sparc64/oprofile/init.c
deleted file mode 100644
index 17bb6035069b..000000000000
--- a/arch/sparc64/oprofile/init.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/**
2 * @file init.c
3 *
4 * @remark Copyright 2002 OProfile authors
5 * @remark Read the file COPYING
6 *
7 * @author John Levon <levon@movementarian.org>
8 */
9
10#include <linux/kernel.h>
11#include <linux/oprofile.h>
12#include <linux/errno.h>
13#include <linux/init.h>
14
15int __init oprofile_arch_init(struct oprofile_operations *ops)
16{
17 return -ENODEV;
18}
19
20
21void oprofile_arch_exit(void)
22{
23}
diff --git a/arch/sparc64/prom/Makefile b/arch/sparc64/prom/Makefile
deleted file mode 100644
index 8c94483ca54d..000000000000
--- a/arch/sparc64/prom/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1# Makefile for the Sun Boot PROM interface library under
2# Linux.
3#
4
5EXTRA_AFLAGS := -ansi
6EXTRA_CFLAGS := -Werror
7
8lib-y := bootstr.o devops.o init.o misc.o \
9 tree.o console.o printf.o p1275.o cif.o
diff --git a/arch/sparc64/prom/printf.c b/arch/sparc64/prom/printf.c
deleted file mode 100644
index 660943ee4c2a..000000000000
--- a/arch/sparc64/prom/printf.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * printf.c: Internal prom library printf facility.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
7 *
8 * We used to warn all over the code: DO NOT USE prom_printf(),
9 * and yet people do. Anton's banking code was outputting banks
10 * with prom_printf for most of the 2.4 lifetime. Since an effective
11 * stick is not available, we deployed a carrot: an early printk
12 * through PROM by means of -p boot option. This ought to fix it.
13 * USE printk; if you need, deploy -p.
14 */
15
16#include <linux/kernel.h>
17
18#include <asm/openprom.h>
19#include <asm/oplib.h>
20
21static char ppbuf[1024];
22
23void
24prom_write(const char *buf, unsigned int n)
25{
26 char ch;
27
28 while (n != 0) {
29 --n;
30 if ((ch = *buf++) == '\n')
31 prom_putchar('\r');
32 prom_putchar(ch);
33 }
34}
35
36void
37prom_printf(const char *fmt, ...)
38{
39 va_list args;
40 int i;
41
42 va_start(args, fmt);
43 i = vscnprintf(ppbuf, sizeof(ppbuf), fmt, args);
44 va_end(args);
45
46 prom_write(ppbuf, i);
47}