aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/Kconfig19
-rw-r--r--arch/sparc/Kconfig.debug19
-rw-r--r--arch/sparc/Makefile2
-rw-r--r--arch/sparc/configs/sparc32_defconfig139
-rw-r--r--arch/sparc/configs/sparc64_defconfig173
-rw-r--r--arch/sparc/include/asm/asm-offsets.h1
-rw-r--r--arch/sparc/include/asm/btext.h6
-rw-r--r--arch/sparc/include/asm/cacheflush_32.h1
-rw-r--r--arch/sparc/include/asm/cacheflush_64.h1
-rw-r--r--arch/sparc/include/asm/compat.h3
-rw-r--r--arch/sparc/include/asm/cpudata_64.h2
-rw-r--r--arch/sparc/include/asm/dma-mapping.h14
-rw-r--r--arch/sparc/include/asm/elf_32.h2
-rw-r--r--arch/sparc/include/asm/elf_64.h14
-rw-r--r--arch/sparc/include/asm/fbio.h2
-rw-r--r--arch/sparc/include/asm/fcntl.h19
-rw-r--r--arch/sparc/include/asm/io_32.h6
-rw-r--r--arch/sparc/include/asm/io_64.h4
-rw-r--r--arch/sparc/include/asm/irqflags_64.h23
-rw-r--r--arch/sparc/include/asm/leon.h45
-rw-r--r--arch/sparc/include/asm/page_32.h2
-rw-r--r--arch/sparc/include/asm/param.h19
-rw-r--r--arch/sparc/include/asm/pci_32.h14
-rw-r--r--arch/sparc/include/asm/pci_64.h16
-rw-r--r--arch/sparc/include/asm/perfctr.h4
-rw-r--r--arch/sparc/include/asm/pgtable_32.h4
-rw-r--r--arch/sparc/include/asm/pgtable_64.h2
-rw-r--r--arch/sparc/include/asm/prom.h55
-rw-r--r--arch/sparc/include/asm/rwsem.h4
-rw-r--r--arch/sparc/include/asm/scatterlist.h21
-rw-r--r--arch/sparc/include/asm/smp_32.h9
-rw-r--r--arch/sparc/include/asm/socket.h2
-rw-r--r--arch/sparc/include/asm/spinlock_32.h62
-rw-r--r--arch/sparc/include/asm/spinlock_64.h54
-rw-r--r--arch/sparc/include/asm/spinlock_types.h8
-rw-r--r--arch/sparc/include/asm/stat.h4
-rw-r--r--arch/sparc/include/asm/string_32.h78
-rw-r--r--arch/sparc/include/asm/string_64.h25
-rw-r--r--arch/sparc/include/asm/syscall.h7
-rw-r--r--arch/sparc/include/asm/system_64.h15
-rw-r--r--arch/sparc/include/asm/thread_info_64.h33
-rw-r--r--arch/sparc/include/asm/timex_32.h1
-rw-r--r--arch/sparc/include/asm/topology_64.h4
-rw-r--r--arch/sparc/include/asm/uaccess_32.h15
-rw-r--r--arch/sparc/include/asm/uaccess_64.h23
-rw-r--r--arch/sparc/include/asm/unistd.h7
-rw-r--r--arch/sparc/kernel/Makefile13
-rw-r--r--arch/sparc/kernel/apc.c37
-rw-r--r--arch/sparc/kernel/auxio_32.c1
-rw-r--r--arch/sparc/kernel/btext.c673
-rw-r--r--arch/sparc/kernel/central.c5
-rw-r--r--arch/sparc/kernel/cpu.c11
-rw-r--r--arch/sparc/kernel/cpumap.c1
-rw-r--r--arch/sparc/kernel/devices.c4
-rw-r--r--arch/sparc/kernel/entry.S35
-rw-r--r--arch/sparc/kernel/entry.h1
-rw-r--r--arch/sparc/kernel/ftrace.c60
-rw-r--r--arch/sparc/kernel/head_32.S22
-rw-r--r--arch/sparc/kernel/helpers.S75
-rw-r--r--arch/sparc/kernel/hvapi.c1
-rw-r--r--arch/sparc/kernel/iommu.c14
-rw-r--r--arch/sparc/kernel/ioport.c16
-rw-r--r--arch/sparc/kernel/irq_64.c88
-rw-r--r--arch/sparc/kernel/kgdb_64.c3
-rw-r--r--arch/sparc/kernel/kprobes.c4
-rw-r--r--arch/sparc/kernel/kstack.h23
-rw-r--r--arch/sparc/kernel/ldc.c20
-rw-r--r--arch/sparc/kernel/led.c1
-rw-r--r--arch/sparc/kernel/leon_kernel.c85
-rw-r--r--arch/sparc/kernel/leon_smp.c469
-rw-r--r--arch/sparc/kernel/mdesc.c21
-rw-r--r--arch/sparc/kernel/module.c2
-rw-r--r--arch/sparc/kernel/nmi.c22
-rw-r--r--arch/sparc/kernel/of_device_32.c4
-rw-r--r--arch/sparc/kernel/of_device_64.c16
-rw-r--r--arch/sparc/kernel/of_device_common.c1
-rw-r--r--arch/sparc/kernel/pci.c95
-rw-r--r--arch/sparc/kernel/pci_common.c11
-rw-r--r--arch/sparc/kernel/pci_msi.c3
-rw-r--r--arch/sparc/kernel/pcic.c110
-rw-r--r--arch/sparc/kernel/pcr.c3
-rw-r--r--arch/sparc/kernel/perf_event.c640
-rw-r--r--arch/sparc/kernel/process_32.c4
-rw-r--r--arch/sparc/kernel/process_64.c39
-rw-r--r--arch/sparc/kernel/prom.h3
-rw-r--r--arch/sparc/kernel/prom_common.c18
-rw-r--r--arch/sparc/kernel/ptrace_32.c4
-rw-r--r--arch/sparc/kernel/ptrace_64.c14
-rw-r--r--arch/sparc/kernel/rtrap_64.S74
-rw-r--r--arch/sparc/kernel/setup_32.c2
-rw-r--r--arch/sparc/kernel/setup_64.c7
-rw-r--r--arch/sparc/kernel/signal32.c10
-rw-r--r--arch/sparc/kernel/signal_32.c6
-rw-r--r--arch/sparc/kernel/signal_64.c8
-rw-r--r--arch/sparc/kernel/smp_32.c10
-rw-r--r--arch/sparc/kernel/smp_64.c14
-rw-r--r--arch/sparc/kernel/sparc_ksyms_64.c12
-rw-r--r--arch/sparc/kernel/sun4c_irq.c1
-rw-r--r--arch/sparc/kernel/sun4d_smp.c2
-rw-r--r--arch/sparc/kernel/sun4m_irq.c1
-rw-r--r--arch/sparc/kernel/sys32.S1
-rw-r--r--arch/sparc/kernel/sys_sparc32.c87
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c177
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c173
-rw-r--r--arch/sparc/kernel/syscalls.S37
-rw-r--r--arch/sparc/kernel/sysfs.c4
-rw-r--r--arch/sparc/kernel/systbls.h8
-rw-r--r--arch/sparc/kernel/systbls_32.S6
-rw-r--r--arch/sparc/kernel/systbls_64.S16
-rw-r--r--arch/sparc/kernel/time_32.c119
-rw-r--r--arch/sparc/kernel/time_64.c30
-rw-r--r--arch/sparc/kernel/trampoline_32.S69
-rw-r--r--arch/sparc/kernel/traps_64.c36
-rw-r--r--arch/sparc/kernel/tsb.S6
-rw-r--r--arch/sparc/kernel/unaligned_32.c15
-rw-r--r--arch/sparc/kernel/unaligned_64.c40
-rw-r--r--arch/sparc/kernel/us2e_cpufreq.c8
-rw-r--r--arch/sparc/kernel/us3_cpufreq.c8
-rw-r--r--arch/sparc/kernel/vio.c1
-rw-r--r--arch/sparc/kernel/visemul.c3
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S5
-rw-r--r--arch/sparc/lib/Makefile1
-rw-r--r--arch/sparc/lib/bzero.S5
-rw-r--r--arch/sparc/lib/checksum_32.S2
-rw-r--r--arch/sparc/lib/ksyms.c2
-rw-r--r--arch/sparc/lib/mcount.S158
-rw-r--r--arch/sparc/lib/memcpy.S3
-rw-r--r--arch/sparc/lib/memset.S3
-rw-r--r--arch/sparc/lib/usercopy.c8
-rw-r--r--arch/sparc/math-emu/math_32.c3
-rw-r--r--arch/sparc/math-emu/math_64.c2
-rw-r--r--arch/sparc/mm/fault_32.c122
-rw-r--r--arch/sparc/mm/fault_64.c71
-rw-r--r--arch/sparc/mm/hugetlbpage.c1
-rw-r--r--arch/sparc/mm/init_32.c1
-rw-r--r--arch/sparc/mm/init_64.c7
-rw-r--r--arch/sparc/mm/nosun4c.c2
-rw-r--r--arch/sparc/mm/srmmu.c17
-rw-r--r--arch/sparc/mm/sun4c.c24
-rw-r--r--arch/sparc/mm/tsb.c1
-rw-r--r--arch/sparc/prom/console_32.c1
-rw-r--r--arch/sparc/prom/console_64.c1
-rw-r--r--arch/sparc/prom/devmap.c1
-rw-r--r--arch/sparc/prom/devops_32.c2
-rw-r--r--arch/sparc/prom/init_32.c1
-rw-r--r--arch/sparc/prom/p1275.c12
-rw-r--r--arch/sparc/prom/palloc.c1
-rw-r--r--arch/sparc/prom/ranges.c2
-rw-r--r--arch/sparc/prom/segment.c1
-rw-r--r--arch/sparc/prom/tree_32.c1
-rw-r--r--arch/sparc/prom/tree_64.c1
151 files changed, 3247 insertions, 1861 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 05ef5380a687..9908d477ccd9 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -37,12 +37,16 @@ config SPARC64
37 def_bool 64BIT 37 def_bool 64BIT
38 select ARCH_SUPPORTS_MSI 38 select ARCH_SUPPORTS_MSI
39 select HAVE_FUNCTION_TRACER 39 select HAVE_FUNCTION_TRACER
40 select HAVE_FUNCTION_GRAPH_TRACER
41 select HAVE_FUNCTION_GRAPH_FP_TEST
42 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
40 select HAVE_KRETPROBES 43 select HAVE_KRETPROBES
41 select HAVE_KPROBES 44 select HAVE_KPROBES
42 select HAVE_LMB 45 select HAVE_LMB
43 select HAVE_SYSCALL_WRAPPERS 46 select HAVE_SYSCALL_WRAPPERS
44 select HAVE_DYNAMIC_FTRACE 47 select HAVE_DYNAMIC_FTRACE
45 select HAVE_FTRACE_MCOUNT_RECORD 48 select HAVE_FTRACE_MCOUNT_RECORD
49 select HAVE_SYSCALL_TRACEPOINTS
46 select USE_GENERIC_SMP_HELPERS if SMP 50 select USE_GENERIC_SMP_HELPERS if SMP
47 select RTC_DRV_CMOS 51 select RTC_DRV_CMOS
48 select RTC_DRV_BQ4802 52 select RTC_DRV_BQ4802
@@ -63,8 +67,11 @@ config BITS
63 default 64 if SPARC64 67 default 64 if SPARC64
64 68
65config GENERIC_TIME 69config GENERIC_TIME
70 def_bool y
71
72config ARCH_USES_GETTIMEOFFSET
66 bool 73 bool
67 default y if SPARC64 74 default y if SPARC32
68 75
69config GENERIC_CMOS_UPDATE 76config GENERIC_CMOS_UPDATE
70 bool 77 bool
@@ -123,6 +130,9 @@ config ZONE_DMA
123 bool 130 bool
124 default y if SPARC32 131 default y if SPARC32
125 132
133config NEED_DMA_MAP_STATE
134 def_bool y
135
126config GENERIC_ISA_DMA 136config GENERIC_ISA_DMA
127 bool 137 bool
128 default y if SPARC32 138 default y if SPARC32
@@ -221,6 +231,13 @@ config SPARC64_SMP
221 default y 231 default y
222 depends on SPARC64 && SMP 232 depends on SPARC64 && SMP
223 233
234config EARLYFB
235 bool "Support for early boot text console"
236 default y
237 depends on SPARC64
238 help
239 Say Y here to enable a faster early framebuffer boot console.
240
224choice 241choice
225 prompt "Kernel page size" if SPARC64 242 prompt "Kernel page size" if SPARC64
226 default SPARC64_PAGE_SIZE_8KB 243 default SPARC64_PAGE_SIZE_8KB
diff --git a/arch/sparc/Kconfig.debug b/arch/sparc/Kconfig.debug
index 90d5fe223a74..1b4a831565f9 100644
--- a/arch/sparc/Kconfig.debug
+++ b/arch/sparc/Kconfig.debug
@@ -19,13 +19,10 @@ config DEBUG_DCFLUSH
19 bool "D-cache flush debugging" 19 bool "D-cache flush debugging"
20 depends on SPARC64 && DEBUG_KERNEL 20 depends on SPARC64 && DEBUG_KERNEL
21 21
22config STACK_DEBUG
23 bool "Stack Overflow Detection Support"
24
25config MCOUNT 22config MCOUNT
26 bool 23 bool
27 depends on SPARC64 24 depends on SPARC64
28 depends on STACK_DEBUG || FUNCTION_TRACER 25 depends on FUNCTION_TRACER
29 default y 26 default y
30 27
31config FRAME_POINTER 28config FRAME_POINTER
@@ -33,4 +30,18 @@ config FRAME_POINTER
33 depends on MCOUNT 30 depends on MCOUNT
34 default y 31 default y
35 32
33config DEBUG_STRICT_USER_COPY_CHECKS
34 bool "Strict copy size checks"
35 depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
36 ---help---
37 Enabling this option turns a certain set of sanity checks for user
38 copy operations into compile time failures.
39
40 The copy_from_user() etc checks are there to help test if there
41 are sufficient security checks on the length argument of
42 the copy operation, by having gcc prove that the argument is
43 within bounds.
44
45 If unsure, or if you run an older (pre 4.4) gcc, say N.
46
36endmenu 47endmenu
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index dfe272d14465..113225b241e0 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -27,6 +27,7 @@ AS := $(AS) -32
27LDFLAGS := -m elf32_sparc 27LDFLAGS := -m elf32_sparc
28CHECKFLAGS += -D__sparc__ 28CHECKFLAGS += -D__sparc__
29export BITS := 32 29export BITS := 32
30UTS_MACHINE := sparc
30 31
31#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 32#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
32KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 33KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
@@ -46,6 +47,7 @@ CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
46 47
47LDFLAGS := -m elf64_sparc 48LDFLAGS := -m elf64_sparc
48export BITS := 64 49export BITS := 64
50UTS_MACHINE := sparc64
49 51
50KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \ 52KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
51 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \ 53 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
diff --git a/arch/sparc/configs/sparc32_defconfig b/arch/sparc/configs/sparc32_defconfig
index 983d59824a28..6a8d078070ca 100644
--- a/arch/sparc/configs/sparc32_defconfig
+++ b/arch/sparc/configs/sparc32_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31 3# Linux kernel version: 2.6.33
4# Wed Sep 16 00:03:43 2009 4# Wed Mar 3 02:52:23 2010
5# 5#
6# CONFIG_64BIT is not set 6# CONFIG_64BIT is not set
7CONFIG_SPARC=y 7CONFIG_SPARC=y
@@ -9,6 +9,8 @@ CONFIG_SPARC32=y
9# CONFIG_SPARC64 is not set 9# CONFIG_SPARC64 is not set
10CONFIG_ARCH_DEFCONFIG="arch/sparc/configs/sparc32_defconfig" 10CONFIG_ARCH_DEFCONFIG="arch/sparc/configs/sparc32_defconfig"
11CONFIG_BITS=32 11CONFIG_BITS=32
12CONFIG_GENERIC_TIME=y
13CONFIG_ARCH_USES_GETTIMEOFFSET=y
12CONFIG_AUDIT_ARCH=y 14CONFIG_AUDIT_ARCH=y
13CONFIG_MMU=y 15CONFIG_MMU=y
14CONFIG_HIGHMEM=y 16CONFIG_HIGHMEM=y
@@ -41,17 +43,13 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
41# 43#
42CONFIG_TREE_RCU=y 44CONFIG_TREE_RCU=y
43# CONFIG_TREE_PREEMPT_RCU is not set 45# CONFIG_TREE_PREEMPT_RCU is not set
46# CONFIG_TINY_RCU is not set
44# CONFIG_RCU_TRACE is not set 47# CONFIG_RCU_TRACE is not set
45CONFIG_RCU_FANOUT=32 48CONFIG_RCU_FANOUT=32
46# CONFIG_RCU_FANOUT_EXACT is not set 49# CONFIG_RCU_FANOUT_EXACT is not set
47# CONFIG_TREE_RCU_TRACE is not set 50# CONFIG_TREE_RCU_TRACE is not set
48# CONFIG_IKCONFIG is not set 51# CONFIG_IKCONFIG is not set
49CONFIG_LOG_BUF_SHIFT=14 52CONFIG_LOG_BUF_SHIFT=14
50CONFIG_GROUP_SCHED=y
51CONFIG_FAIR_GROUP_SCHED=y
52CONFIG_RT_GROUP_SCHED=y
53CONFIG_USER_SCHED=y
54# CONFIG_CGROUP_SCHED is not set
55# CONFIG_CGROUPS is not set 53# CONFIG_CGROUPS is not set
56CONFIG_SYSFS_DEPRECATED=y 54CONFIG_SYSFS_DEPRECATED=y
57CONFIG_SYSFS_DEPRECATED_V2=y 55CONFIG_SYSFS_DEPRECATED_V2=y
@@ -67,6 +65,7 @@ CONFIG_INITRAMFS_SOURCE=""
67CONFIG_RD_GZIP=y 65CONFIG_RD_GZIP=y
68CONFIG_RD_BZIP2=y 66CONFIG_RD_BZIP2=y
69CONFIG_RD_LZMA=y 67CONFIG_RD_LZMA=y
68CONFIG_RD_LZO=y
70# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 69# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
71CONFIG_SYSCTL=y 70CONFIG_SYSCTL=y
72CONFIG_ANON_INODES=y 71CONFIG_ANON_INODES=y
@@ -88,21 +87,21 @@ CONFIG_TIMERFD=y
88CONFIG_EVENTFD=y 87CONFIG_EVENTFD=y
89CONFIG_SHMEM=y 88CONFIG_SHMEM=y
90CONFIG_AIO=y 89CONFIG_AIO=y
91CONFIG_HAVE_PERF_COUNTERS=y 90CONFIG_HAVE_PERF_EVENTS=y
91CONFIG_PERF_USE_VMALLOC=y
92 92
93# 93#
94# Performance Counters 94# Kernel Performance Events And Counters
95# 95#
96# CONFIG_PERF_EVENTS is not set
96# CONFIG_PERF_COUNTERS is not set 97# CONFIG_PERF_COUNTERS is not set
97CONFIG_VM_EVENT_COUNTERS=y 98CONFIG_VM_EVENT_COUNTERS=y
98CONFIG_PCI_QUIRKS=y 99CONFIG_PCI_QUIRKS=y
99# CONFIG_STRIP_ASM_SYMS is not set
100CONFIG_COMPAT_BRK=y 100CONFIG_COMPAT_BRK=y
101CONFIG_SLAB=y 101CONFIG_SLAB=y
102# CONFIG_SLUB is not set 102# CONFIG_SLUB is not set
103# CONFIG_SLOB is not set 103# CONFIG_SLOB is not set
104# CONFIG_PROFILING is not set 104# CONFIG_PROFILING is not set
105# CONFIG_MARKERS is not set
106CONFIG_HAVE_OPROFILE=y 105CONFIG_HAVE_OPROFILE=y
107CONFIG_HAVE_ARCH_TRACEHOOK=y 106CONFIG_HAVE_ARCH_TRACEHOOK=y
108CONFIG_HAVE_DMA_ATTRS=y 107CONFIG_HAVE_DMA_ATTRS=y
@@ -131,14 +130,41 @@ CONFIG_LBDAF=y
131# IO Schedulers 130# IO Schedulers
132# 131#
133CONFIG_IOSCHED_NOOP=y 132CONFIG_IOSCHED_NOOP=y
134CONFIG_IOSCHED_AS=y
135CONFIG_IOSCHED_DEADLINE=y 133CONFIG_IOSCHED_DEADLINE=y
136CONFIG_IOSCHED_CFQ=y 134CONFIG_IOSCHED_CFQ=y
137# CONFIG_DEFAULT_AS is not set
138# CONFIG_DEFAULT_DEADLINE is not set 135# CONFIG_DEFAULT_DEADLINE is not set
139CONFIG_DEFAULT_CFQ=y 136CONFIG_DEFAULT_CFQ=y
140# CONFIG_DEFAULT_NOOP is not set 137# CONFIG_DEFAULT_NOOP is not set
141CONFIG_DEFAULT_IOSCHED="cfq" 138CONFIG_DEFAULT_IOSCHED="cfq"
139# CONFIG_INLINE_SPIN_TRYLOCK is not set
140# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
141# CONFIG_INLINE_SPIN_LOCK is not set
142# CONFIG_INLINE_SPIN_LOCK_BH is not set
143# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
144# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
145CONFIG_INLINE_SPIN_UNLOCK=y
146# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
147CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
148# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
149# CONFIG_INLINE_READ_TRYLOCK is not set
150# CONFIG_INLINE_READ_LOCK is not set
151# CONFIG_INLINE_READ_LOCK_BH is not set
152# CONFIG_INLINE_READ_LOCK_IRQ is not set
153# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
154CONFIG_INLINE_READ_UNLOCK=y
155# CONFIG_INLINE_READ_UNLOCK_BH is not set
156CONFIG_INLINE_READ_UNLOCK_IRQ=y
157# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
158# CONFIG_INLINE_WRITE_TRYLOCK is not set
159# CONFIG_INLINE_WRITE_LOCK is not set
160# CONFIG_INLINE_WRITE_LOCK_BH is not set
161# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
162# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
163CONFIG_INLINE_WRITE_UNLOCK=y
164# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
165CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
166# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
167# CONFIG_MUTEX_SPIN_ON_OWNER is not set
142# CONFIG_FREEZER is not set 168# CONFIG_FREEZER is not set
143 169
144# 170#
@@ -168,8 +194,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
168# CONFIG_PHYS_ADDR_T_64BIT is not set 194# CONFIG_PHYS_ADDR_T_64BIT is not set
169CONFIG_ZONE_DMA_FLAG=1 195CONFIG_ZONE_DMA_FLAG=1
170CONFIG_BOUNCE=y 196CONFIG_BOUNCE=y
171CONFIG_HAVE_MLOCK=y 197# CONFIG_KSM is not set
172CONFIG_HAVE_MLOCKED_PAGE_BIT=y
173CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 198CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
174CONFIG_SUN_PM=y 199CONFIG_SUN_PM=y
175# CONFIG_SPARC_LED is not set 200# CONFIG_SPARC_LED is not set
@@ -184,7 +209,6 @@ CONFIG_SBUSCHAR=y
184CONFIG_PCI=y 209CONFIG_PCI=y
185CONFIG_PCI_SYSCALL=y 210CONFIG_PCI_SYSCALL=y
186# CONFIG_ARCH_SUPPORTS_MSI is not set 211# CONFIG_ARCH_SUPPORTS_MSI is not set
187CONFIG_PCI_LEGACY=y
188# CONFIG_PCI_DEBUG is not set 212# CONFIG_PCI_DEBUG is not set
189# CONFIG_PCI_STUB is not set 213# CONFIG_PCI_STUB is not set
190# CONFIG_PCI_IOV is not set 214# CONFIG_PCI_IOV is not set
@@ -205,7 +229,6 @@ CONFIG_NET=y
205# Networking options 229# Networking options
206# 230#
207CONFIG_PACKET=y 231CONFIG_PACKET=y
208# CONFIG_PACKET_MMAP is not set
209CONFIG_UNIX=y 232CONFIG_UNIX=y
210CONFIG_XFRM=y 233CONFIG_XFRM=y
211CONFIG_XFRM_USER=m 234CONFIG_XFRM_USER=m
@@ -257,6 +280,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
257CONFIG_INET6_XFRM_MODE_BEET=m 280CONFIG_INET6_XFRM_MODE_BEET=m
258# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 281# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
259CONFIG_IPV6_SIT=m 282CONFIG_IPV6_SIT=m
283# CONFIG_IPV6_SIT_6RD is not set
260CONFIG_IPV6_NDISC_NODETYPE=y 284CONFIG_IPV6_NDISC_NODETYPE=y
261CONFIG_IPV6_TUNNEL=m 285CONFIG_IPV6_TUNNEL=m
262# CONFIG_IPV6_MULTIPLE_TABLES is not set 286# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -295,9 +319,6 @@ CONFIG_NET_PKTGEN=m
295# CONFIG_AF_RXRPC is not set 319# CONFIG_AF_RXRPC is not set
296CONFIG_WIRELESS=y 320CONFIG_WIRELESS=y
297# CONFIG_CFG80211 is not set 321# CONFIG_CFG80211 is not set
298CONFIG_CFG80211_DEFAULT_PS_VALUE=0
299CONFIG_WIRELESS_OLD_REGULATORY=y
300# CONFIG_WIRELESS_EXT is not set
301# CONFIG_LIB80211 is not set 322# CONFIG_LIB80211 is not set
302 323
303# 324#
@@ -335,6 +356,10 @@ CONFIG_BLK_DEV=y
335# CONFIG_BLK_DEV_COW_COMMON is not set 356# CONFIG_BLK_DEV_COW_COMMON is not set
336CONFIG_BLK_DEV_LOOP=m 357CONFIG_BLK_DEV_LOOP=m
337CONFIG_BLK_DEV_CRYPTOLOOP=m 358CONFIG_BLK_DEV_CRYPTOLOOP=m
359
360#
361# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
362#
338# CONFIG_BLK_DEV_NBD is not set 363# CONFIG_BLK_DEV_NBD is not set
339# CONFIG_BLK_DEV_SX8 is not set 364# CONFIG_BLK_DEV_SX8 is not set
340CONFIG_BLK_DEV_RAM=y 365CONFIG_BLK_DEV_RAM=y
@@ -350,11 +375,13 @@ CONFIG_MISC_DEVICES=y
350# CONFIG_TIFM_CORE is not set 375# CONFIG_TIFM_CORE is not set
351# CONFIG_ENCLOSURE_SERVICES is not set 376# CONFIG_ENCLOSURE_SERVICES is not set
352# CONFIG_HP_ILO is not set 377# CONFIG_HP_ILO is not set
378# CONFIG_TI_DAC7512 is not set
353# CONFIG_C2PORT is not set 379# CONFIG_C2PORT is not set
354 380
355# 381#
356# EEPROM support 382# EEPROM support
357# 383#
384# CONFIG_EEPROM_AT25 is not set
358# CONFIG_EEPROM_93CX6 is not set 385# CONFIG_EEPROM_93CX6 is not set
359# CONFIG_CB710_CORE is not set 386# CONFIG_CB710_CORE is not set
360CONFIG_HAVE_IDE=y 387CONFIG_HAVE_IDE=y
@@ -398,8 +425,11 @@ CONFIG_SCSI_LOWLEVEL=y
398# CONFIG_ISCSI_TCP is not set 425# CONFIG_ISCSI_TCP is not set
399# CONFIG_SCSI_CXGB3_ISCSI is not set 426# CONFIG_SCSI_CXGB3_ISCSI is not set
400# CONFIG_SCSI_BNX2_ISCSI is not set 427# CONFIG_SCSI_BNX2_ISCSI is not set
428# CONFIG_BE2ISCSI is not set
401# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 429# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
430# CONFIG_SCSI_HPSA is not set
402# CONFIG_SCSI_3W_9XXX is not set 431# CONFIG_SCSI_3W_9XXX is not set
432# CONFIG_SCSI_3W_SAS is not set
403# CONFIG_SCSI_ACARD is not set 433# CONFIG_SCSI_ACARD is not set
404# CONFIG_SCSI_AACRAID is not set 434# CONFIG_SCSI_AACRAID is not set
405# CONFIG_SCSI_AIC7XXX is not set 435# CONFIG_SCSI_AIC7XXX is not set
@@ -434,7 +464,9 @@ CONFIG_SCSI_QLOGICPTI=m
434# CONFIG_SCSI_DEBUG is not set 464# CONFIG_SCSI_DEBUG is not set
435CONFIG_SCSI_SUNESP=y 465CONFIG_SCSI_SUNESP=y
436# CONFIG_SCSI_PMCRAID is not set 466# CONFIG_SCSI_PMCRAID is not set
467# CONFIG_SCSI_PM8001 is not set
437# CONFIG_SCSI_SRP is not set 468# CONFIG_SCSI_SRP is not set
469# CONFIG_SCSI_BFA_FC is not set
438# CONFIG_SCSI_DH is not set 470# CONFIG_SCSI_DH is not set
439# CONFIG_SCSI_OSD_INITIATOR is not set 471# CONFIG_SCSI_OSD_INITIATOR is not set
440# CONFIG_ATA is not set 472# CONFIG_ATA is not set
@@ -450,7 +482,7 @@ CONFIG_SCSI_SUNESP=y
450# 482#
451 483
452# 484#
453# See the help texts for more information. 485# The newer stack is recommended.
454# 486#
455# CONFIG_FIREWIRE is not set 487# CONFIG_FIREWIRE is not set
456# CONFIG_IEEE1394 is not set 488# CONFIG_IEEE1394 is not set
@@ -473,7 +505,9 @@ CONFIG_SUNQE=m
473# CONFIG_SUNGEM is not set 505# CONFIG_SUNGEM is not set
474# CONFIG_CASSINI is not set 506# CONFIG_CASSINI is not set
475# CONFIG_NET_VENDOR_3COM is not set 507# CONFIG_NET_VENDOR_3COM is not set
508# CONFIG_ENC28J60 is not set
476# CONFIG_ETHOC is not set 509# CONFIG_ETHOC is not set
510# CONFIG_GRETH is not set
477# CONFIG_DNET is not set 511# CONFIG_DNET is not set
478# CONFIG_NET_TULIP is not set 512# CONFIG_NET_TULIP is not set
479# CONFIG_HP100 is not set 513# CONFIG_HP100 is not set
@@ -487,6 +521,8 @@ CONFIG_SUNQE=m
487# CONFIG_NET_PCI is not set 521# CONFIG_NET_PCI is not set
488# CONFIG_B44 is not set 522# CONFIG_B44 is not set
489# CONFIG_KS8842 is not set 523# CONFIG_KS8842 is not set
524# CONFIG_KS8851 is not set
525# CONFIG_KS8851_MLL is not set
490# CONFIG_ATL2 is not set 526# CONFIG_ATL2 is not set
491CONFIG_NETDEV_1000=y 527CONFIG_NETDEV_1000=y
492# CONFIG_ACENIC is not set 528# CONFIG_ACENIC is not set
@@ -528,6 +564,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
528# CONFIG_MLX4_CORE is not set 564# CONFIG_MLX4_CORE is not set
529# CONFIG_TEHUTI is not set 565# CONFIG_TEHUTI is not set
530# CONFIG_BNX2X is not set 566# CONFIG_BNX2X is not set
567# CONFIG_QLCNIC is not set
531# CONFIG_QLGE is not set 568# CONFIG_QLGE is not set
532# CONFIG_SFC is not set 569# CONFIG_SFC is not set
533# CONFIG_BE2NET is not set 570# CONFIG_BE2NET is not set
@@ -546,6 +583,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
546# CONFIG_NETCONSOLE is not set 583# CONFIG_NETCONSOLE is not set
547# CONFIG_NETPOLL is not set 584# CONFIG_NETPOLL is not set
548# CONFIG_NET_POLL_CONTROLLER is not set 585# CONFIG_NET_POLL_CONTROLLER is not set
586# CONFIG_VMXNET3 is not set
549# CONFIG_ISDN is not set 587# CONFIG_ISDN is not set
550# CONFIG_PHONE is not set 588# CONFIG_PHONE is not set
551 589
@@ -555,6 +593,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
555CONFIG_INPUT=y 593CONFIG_INPUT=y
556# CONFIG_INPUT_FF_MEMLESS is not set 594# CONFIG_INPUT_FF_MEMLESS is not set
557# CONFIG_INPUT_POLLDEV is not set 595# CONFIG_INPUT_POLLDEV is not set
596# CONFIG_INPUT_SPARSEKMAP is not set
558 597
559# 598#
560# Userland interfaces 599# Userland interfaces
@@ -574,6 +613,7 @@ CONFIG_INPUT_KEYBOARD=y
574CONFIG_KEYBOARD_ATKBD=m 613CONFIG_KEYBOARD_ATKBD=m
575# CONFIG_KEYBOARD_LKKBD is not set 614# CONFIG_KEYBOARD_LKKBD is not set
576# CONFIG_KEYBOARD_NEWTON is not set 615# CONFIG_KEYBOARD_NEWTON is not set
616# CONFIG_KEYBOARD_OPENCORES is not set
577# CONFIG_KEYBOARD_STOWAWAY is not set 617# CONFIG_KEYBOARD_STOWAWAY is not set
578CONFIG_KEYBOARD_SUNKBD=m 618CONFIG_KEYBOARD_SUNKBD=m
579# CONFIG_KEYBOARD_XTKBD is not set 619# CONFIG_KEYBOARD_XTKBD is not set
@@ -604,6 +644,7 @@ CONFIG_SERIO_SERPORT=m
604# CONFIG_SERIO_PCIPS2 is not set 644# CONFIG_SERIO_PCIPS2 is not set
605CONFIG_SERIO_LIBPS2=m 645CONFIG_SERIO_LIBPS2=m
606# CONFIG_SERIO_RAW is not set 646# CONFIG_SERIO_RAW is not set
647# CONFIG_SERIO_ALTERA_PS2 is not set
607# CONFIG_GAMEPORT is not set 648# CONFIG_GAMEPORT is not set
608 649
609# 650#
@@ -626,6 +667,7 @@ CONFIG_DEVKMEM=y
626# 667#
627# Non-8250 serial port support 668# Non-8250 serial port support
628# 669#
670# CONFIG_SERIAL_MAX3100 is not set
629CONFIG_SERIAL_SUNCORE=y 671CONFIG_SERIAL_SUNCORE=y
630CONFIG_SERIAL_SUNZILOG=y 672CONFIG_SERIAL_SUNZILOG=y
631CONFIG_SERIAL_SUNZILOG_CONSOLE=y 673CONFIG_SERIAL_SUNZILOG_CONSOLE=y
@@ -636,6 +678,7 @@ CONFIG_SERIAL_CORE=y
636CONFIG_SERIAL_CORE_CONSOLE=y 678CONFIG_SERIAL_CORE_CONSOLE=y
637CONFIG_CONSOLE_POLL=y 679CONFIG_CONSOLE_POLL=y
638# CONFIG_SERIAL_JSM is not set 680# CONFIG_SERIAL_JSM is not set
681# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
639CONFIG_UNIX98_PTYS=y 682CONFIG_UNIX98_PTYS=y
640# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 683# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
641CONFIG_LEGACY_PTYS=y 684CONFIG_LEGACY_PTYS=y
@@ -649,7 +692,23 @@ CONFIG_HW_RANDOM=m
649# CONFIG_TCG_TPM is not set 692# CONFIG_TCG_TPM is not set
650CONFIG_DEVPORT=y 693CONFIG_DEVPORT=y
651# CONFIG_I2C is not set 694# CONFIG_I2C is not set
652# CONFIG_SPI is not set 695CONFIG_SPI=y
696# CONFIG_SPI_DEBUG is not set
697CONFIG_SPI_MASTER=y
698
699#
700# SPI Master Controller Drivers
701#
702CONFIG_SPI_BITBANG=m
703CONFIG_SPI_XILINX=m
704CONFIG_SPI_XILINX_PLTFM=m
705# CONFIG_SPI_DESIGNWARE is not set
706
707#
708# SPI Protocol Masters
709#
710# CONFIG_SPI_SPIDEV is not set
711# CONFIG_SPI_TLE62X0 is not set
653 712
654# 713#
655# PPS support 714# PPS support
@@ -661,10 +720,18 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
661# CONFIG_POWER_SUPPLY is not set 720# CONFIG_POWER_SUPPLY is not set
662CONFIG_HWMON=y 721CONFIG_HWMON=y
663# CONFIG_HWMON_VID is not set 722# CONFIG_HWMON_VID is not set
723# CONFIG_HWMON_DEBUG_CHIP is not set
724
725#
726# Native drivers
727#
728# CONFIG_SENSORS_ADCXX is not set
664# CONFIG_SENSORS_I5K_AMB is not set 729# CONFIG_SENSORS_I5K_AMB is not set
665# CONFIG_SENSORS_F71805F is not set 730# CONFIG_SENSORS_F71805F is not set
666# CONFIG_SENSORS_F71882FG is not set 731# CONFIG_SENSORS_F71882FG is not set
667# CONFIG_SENSORS_IT87 is not set 732# CONFIG_SENSORS_IT87 is not set
733# CONFIG_SENSORS_LM70 is not set
734# CONFIG_SENSORS_MAX1111 is not set
668# CONFIG_SENSORS_PC87360 is not set 735# CONFIG_SENSORS_PC87360 is not set
669# CONFIG_SENSORS_PC87427 is not set 736# CONFIG_SENSORS_PC87427 is not set
670# CONFIG_SENSORS_SIS5595 is not set 737# CONFIG_SENSORS_SIS5595 is not set
@@ -675,9 +742,8 @@ CONFIG_HWMON=y
675# CONFIG_SENSORS_VT8231 is not set 742# CONFIG_SENSORS_VT8231 is not set
676# CONFIG_SENSORS_W83627HF is not set 743# CONFIG_SENSORS_W83627HF is not set
677# CONFIG_SENSORS_W83627EHF is not set 744# CONFIG_SENSORS_W83627EHF is not set
678# CONFIG_HWMON_DEBUG_CHIP is not set 745# CONFIG_SENSORS_LIS3_SPI is not set
679# CONFIG_THERMAL is not set 746# CONFIG_THERMAL is not set
680# CONFIG_THERMAL_HWMON is not set
681# CONFIG_WATCHDOG is not set 747# CONFIG_WATCHDOG is not set
682CONFIG_SSB_POSSIBLE=y 748CONFIG_SSB_POSSIBLE=y
683 749
@@ -693,12 +759,16 @@ CONFIG_SSB_POSSIBLE=y
693# CONFIG_MFD_SM501 is not set 759# CONFIG_MFD_SM501 is not set
694# CONFIG_HTC_PASIC3 is not set 760# CONFIG_HTC_PASIC3 is not set
695# CONFIG_MFD_TMIO is not set 761# CONFIG_MFD_TMIO is not set
762# CONFIG_MFD_MC13783 is not set
763# CONFIG_AB4500_CORE is not set
696# CONFIG_REGULATOR is not set 764# CONFIG_REGULATOR is not set
697# CONFIG_MEDIA_SUPPORT is not set 765# CONFIG_MEDIA_SUPPORT is not set
698 766
699# 767#
700# Graphics support 768# Graphics support
701# 769#
770CONFIG_VGA_ARB=y
771CONFIG_VGA_ARB_MAX_GPUS=16
702# CONFIG_VGASTATE is not set 772# CONFIG_VGASTATE is not set
703# CONFIG_VIDEO_OUTPUT_CONTROL is not set 773# CONFIG_VIDEO_OUTPUT_CONTROL is not set
704# CONFIG_FB is not set 774# CONFIG_FB is not set
@@ -764,6 +834,14 @@ CONFIG_RTC_INTF_DEV=y
764# 834#
765# SPI RTC drivers 835# SPI RTC drivers
766# 836#
837# CONFIG_RTC_DRV_M41T94 is not set
838# CONFIG_RTC_DRV_DS1305 is not set
839# CONFIG_RTC_DRV_DS1390 is not set
840# CONFIG_RTC_DRV_MAX6902 is not set
841# CONFIG_RTC_DRV_R9701 is not set
842# CONFIG_RTC_DRV_RS5C348 is not set
843# CONFIG_RTC_DRV_DS3234 is not set
844# CONFIG_RTC_DRV_PCF2123 is not set
767 845
768# 846#
769# Platform RTC drivers 847# Platform RTC drivers
@@ -776,7 +854,9 @@ CONFIG_RTC_INTF_DEV=y
776# CONFIG_RTC_DRV_M48T86 is not set 854# CONFIG_RTC_DRV_M48T86 is not set
777# CONFIG_RTC_DRV_M48T35 is not set 855# CONFIG_RTC_DRV_M48T35 is not set
778CONFIG_RTC_DRV_M48T59=y 856CONFIG_RTC_DRV_M48T59=y
857# CONFIG_RTC_DRV_MSM6242 is not set
779# CONFIG_RTC_DRV_BQ4802 is not set 858# CONFIG_RTC_DRV_BQ4802 is not set
859# CONFIG_RTC_DRV_RP5C01 is not set
780# CONFIG_RTC_DRV_V3020 is not set 860# CONFIG_RTC_DRV_V3020 is not set
781 861
782# 862#
@@ -955,6 +1035,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
955CONFIG_ENABLE_MUST_CHECK=y 1035CONFIG_ENABLE_MUST_CHECK=y
956CONFIG_FRAME_WARN=1024 1036CONFIG_FRAME_WARN=1024
957CONFIG_MAGIC_SYSRQ=y 1037CONFIG_MAGIC_SYSRQ=y
1038# CONFIG_STRIP_ASM_SYMS is not set
958# CONFIG_UNUSED_SYMBOLS is not set 1039# CONFIG_UNUSED_SYMBOLS is not set
959# CONFIG_DEBUG_FS is not set 1040# CONFIG_DEBUG_FS is not set
960# CONFIG_HEADERS_CHECK is not set 1041# CONFIG_HEADERS_CHECK is not set
@@ -1003,9 +1084,9 @@ CONFIG_KGDB=y
1003CONFIG_KGDB_SERIAL_CONSOLE=y 1084CONFIG_KGDB_SERIAL_CONSOLE=y
1004CONFIG_KGDB_TESTS=y 1085CONFIG_KGDB_TESTS=y
1005# CONFIG_KGDB_TESTS_ON_BOOT is not set 1086# CONFIG_KGDB_TESTS_ON_BOOT is not set
1006# CONFIG_KMEMCHECK is not set
1007# CONFIG_DEBUG_STACK_USAGE is not set 1087# CONFIG_DEBUG_STACK_USAGE is not set
1008# CONFIG_STACK_DEBUG is not set 1088# CONFIG_STACK_DEBUG is not set
1089# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set
1009 1090
1010# 1091#
1011# Security options 1092# Security options
@@ -1013,7 +1094,11 @@ CONFIG_KGDB_TESTS=y
1013# CONFIG_KEYS is not set 1094# CONFIG_KEYS is not set
1014# CONFIG_SECURITY is not set 1095# CONFIG_SECURITY is not set
1015# CONFIG_SECURITYFS is not set 1096# CONFIG_SECURITYFS is not set
1016# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1097# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1098# CONFIG_DEFAULT_SECURITY_SMACK is not set
1099# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1100CONFIG_DEFAULT_SECURITY_DAC=y
1101CONFIG_DEFAULT_SECURITY=""
1017CONFIG_CRYPTO=y 1102CONFIG_CRYPTO=y
1018 1103
1019# 1104#
@@ -1129,9 +1214,11 @@ CONFIG_CRC32=y
1129CONFIG_LIBCRC32C=m 1214CONFIG_LIBCRC32C=m
1130CONFIG_ZLIB_INFLATE=y 1215CONFIG_ZLIB_INFLATE=y
1131CONFIG_ZLIB_DEFLATE=y 1216CONFIG_ZLIB_DEFLATE=y
1217CONFIG_LZO_DECOMPRESS=y
1132CONFIG_DECOMPRESS_GZIP=y 1218CONFIG_DECOMPRESS_GZIP=y
1133CONFIG_DECOMPRESS_BZIP2=y 1219CONFIG_DECOMPRESS_BZIP2=y
1134CONFIG_DECOMPRESS_LZMA=y 1220CONFIG_DECOMPRESS_LZMA=y
1221CONFIG_DECOMPRESS_LZO=y
1135CONFIG_HAS_IOMEM=y 1222CONFIG_HAS_IOMEM=y
1136CONFIG_HAS_IOPORT=y 1223CONFIG_HAS_IOPORT=y
1137CONFIG_HAS_DMA=y 1224CONFIG_HAS_DMA=y
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig
index f80b881dfea7..259e3fd50993 100644
--- a/arch/sparc/configs/sparc64_defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31 3# Linux kernel version: 2.6.34-rc3
4# Tue Sep 15 17:06:03 2009 4# Sat Apr 3 15:49:56 2010
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_SPARC=y 7CONFIG_SPARC=y
@@ -20,8 +20,10 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
20CONFIG_AUDIT_ARCH=y 20CONFIG_AUDIT_ARCH=y
21CONFIG_HAVE_SETUP_PER_CPU_AREA=y 21CONFIG_HAVE_SETUP_PER_CPU_AREA=y
22CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y 22CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
23CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
23CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
24CONFIG_MMU=y 25CONFIG_MMU=y
26CONFIG_NEED_DMA_MAP_STATE=y
25CONFIG_ARCH_NO_VIRT_TO_BUS=y 27CONFIG_ARCH_NO_VIRT_TO_BUS=y
26CONFIG_OF=y 28CONFIG_OF=y
27CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 29CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
@@ -50,20 +52,16 @@ CONFIG_POSIX_MQUEUE_SYSCTL=y
50# 52#
51CONFIG_TREE_RCU=y 53CONFIG_TREE_RCU=y
52# CONFIG_TREE_PREEMPT_RCU is not set 54# CONFIG_TREE_PREEMPT_RCU is not set
55# CONFIG_TINY_RCU is not set
53# CONFIG_RCU_TRACE is not set 56# CONFIG_RCU_TRACE is not set
54CONFIG_RCU_FANOUT=64 57CONFIG_RCU_FANOUT=64
55# CONFIG_RCU_FANOUT_EXACT is not set 58# CONFIG_RCU_FANOUT_EXACT is not set
59# CONFIG_RCU_FAST_NO_HZ is not set
56# CONFIG_TREE_RCU_TRACE is not set 60# CONFIG_TREE_RCU_TRACE is not set
57# CONFIG_IKCONFIG is not set 61# CONFIG_IKCONFIG is not set
58CONFIG_LOG_BUF_SHIFT=18 62CONFIG_LOG_BUF_SHIFT=18
59CONFIG_GROUP_SCHED=y
60CONFIG_FAIR_GROUP_SCHED=y
61CONFIG_RT_GROUP_SCHED=y
62CONFIG_USER_SCHED=y
63# CONFIG_CGROUP_SCHED is not set
64# CONFIG_CGROUPS is not set 63# CONFIG_CGROUPS is not set
65CONFIG_SYSFS_DEPRECATED=y 64# CONFIG_SYSFS_DEPRECATED_V2 is not set
66CONFIG_SYSFS_DEPRECATED_V2=y
67CONFIG_RELAY=y 65CONFIG_RELAY=y
68CONFIG_NAMESPACES=y 66CONFIG_NAMESPACES=y
69# CONFIG_UTS_NS is not set 67# CONFIG_UTS_NS is not set
@@ -76,6 +74,7 @@ CONFIG_INITRAMFS_SOURCE=""
76CONFIG_RD_GZIP=y 74CONFIG_RD_GZIP=y
77CONFIG_RD_BZIP2=y 75CONFIG_RD_BZIP2=y
78CONFIG_RD_LZMA=y 76CONFIG_RD_LZMA=y
77CONFIG_RD_LZO=y
79CONFIG_CC_OPTIMIZE_FOR_SIZE=y 78CONFIG_CC_OPTIMIZE_FOR_SIZE=y
80CONFIG_SYSCTL=y 79CONFIG_SYSCTL=y
81CONFIG_ANON_INODES=y 80CONFIG_ANON_INODES=y
@@ -97,24 +96,24 @@ CONFIG_TIMERFD=y
97CONFIG_EVENTFD=y 96CONFIG_EVENTFD=y
98CONFIG_SHMEM=y 97CONFIG_SHMEM=y
99CONFIG_AIO=y 98CONFIG_AIO=y
100CONFIG_HAVE_PERF_COUNTERS=y 99CONFIG_HAVE_PERF_EVENTS=y
100CONFIG_PERF_USE_VMALLOC=y
101 101
102# 102#
103# Performance Counters 103# Kernel Performance Events And Counters
104# 104#
105CONFIG_PERF_EVENTS=y
105CONFIG_PERF_COUNTERS=y 106CONFIG_PERF_COUNTERS=y
106CONFIG_EVENT_PROFILE=y 107# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
107CONFIG_VM_EVENT_COUNTERS=y 108CONFIG_VM_EVENT_COUNTERS=y
108CONFIG_PCI_QUIRKS=y 109CONFIG_PCI_QUIRKS=y
109CONFIG_SLUB_DEBUG=y 110CONFIG_SLUB_DEBUG=y
110# CONFIG_STRIP_ASM_SYMS is not set
111# CONFIG_COMPAT_BRK is not set 111# CONFIG_COMPAT_BRK is not set
112# CONFIG_SLAB is not set 112# CONFIG_SLAB is not set
113CONFIG_SLUB=y 113CONFIG_SLUB=y
114# CONFIG_SLOB is not set 114# CONFIG_SLOB is not set
115CONFIG_PROFILING=y 115CONFIG_PROFILING=y
116CONFIG_TRACEPOINTS=y 116CONFIG_TRACEPOINTS=y
117CONFIG_MARKERS=y
118CONFIG_OPROFILE=m 117CONFIG_OPROFILE=m
119CONFIG_HAVE_OPROFILE=y 118CONFIG_HAVE_OPROFILE=y
120CONFIG_KPROBES=y 119CONFIG_KPROBES=y
@@ -152,14 +151,41 @@ CONFIG_BLOCK_COMPAT=y
152# IO Schedulers 151# IO Schedulers
153# 152#
154CONFIG_IOSCHED_NOOP=y 153CONFIG_IOSCHED_NOOP=y
155CONFIG_IOSCHED_AS=y
156CONFIG_IOSCHED_DEADLINE=y 154CONFIG_IOSCHED_DEADLINE=y
157CONFIG_IOSCHED_CFQ=y 155CONFIG_IOSCHED_CFQ=y
158CONFIG_DEFAULT_AS=y
159# CONFIG_DEFAULT_DEADLINE is not set 156# CONFIG_DEFAULT_DEADLINE is not set
160# CONFIG_DEFAULT_CFQ is not set 157CONFIG_DEFAULT_CFQ=y
161# CONFIG_DEFAULT_NOOP is not set 158# CONFIG_DEFAULT_NOOP is not set
162CONFIG_DEFAULT_IOSCHED="anticipatory" 159CONFIG_DEFAULT_IOSCHED="cfq"
160# CONFIG_INLINE_SPIN_TRYLOCK is not set
161# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
162# CONFIG_INLINE_SPIN_LOCK is not set
163# CONFIG_INLINE_SPIN_LOCK_BH is not set
164# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
165# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
166CONFIG_INLINE_SPIN_UNLOCK=y
167# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
168CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
169# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
170# CONFIG_INLINE_READ_TRYLOCK is not set
171# CONFIG_INLINE_READ_LOCK is not set
172# CONFIG_INLINE_READ_LOCK_BH is not set
173# CONFIG_INLINE_READ_LOCK_IRQ is not set
174# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
175CONFIG_INLINE_READ_UNLOCK=y
176# CONFIG_INLINE_READ_UNLOCK_BH is not set
177CONFIG_INLINE_READ_UNLOCK_IRQ=y
178# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
179# CONFIG_INLINE_WRITE_TRYLOCK is not set
180# CONFIG_INLINE_WRITE_LOCK is not set
181# CONFIG_INLINE_WRITE_LOCK_BH is not set
182# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
183# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
184CONFIG_INLINE_WRITE_UNLOCK=y
185# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
186CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
187# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
188CONFIG_MUTEX_SPIN_ON_OWNER=y
163# CONFIG_FREEZER is not set 189# CONFIG_FREEZER is not set
164 190
165# 191#
@@ -179,6 +205,7 @@ CONFIG_GENERIC_HWEIGHT=y
179CONFIG_GENERIC_CALIBRATE_DELAY=y 205CONFIG_GENERIC_CALIBRATE_DELAY=y
180CONFIG_ARCH_MAY_HAVE_PC_FDC=y 206CONFIG_ARCH_MAY_HAVE_PC_FDC=y
181CONFIG_SPARC64_SMP=y 207CONFIG_SPARC64_SMP=y
208CONFIG_EARLYFB=y
182CONFIG_SPARC64_PAGE_SIZE_8KB=y 209CONFIG_SPARC64_PAGE_SIZE_8KB=y
183# CONFIG_SPARC64_PAGE_SIZE_64KB is not set 210# CONFIG_SPARC64_PAGE_SIZE_64KB is not set
184CONFIG_SECCOMP=y 211CONFIG_SECCOMP=y
@@ -216,8 +243,7 @@ CONFIG_MIGRATION=y
216CONFIG_PHYS_ADDR_T_64BIT=y 243CONFIG_PHYS_ADDR_T_64BIT=y
217CONFIG_ZONE_DMA_FLAG=0 244CONFIG_ZONE_DMA_FLAG=0
218CONFIG_NR_QUICK=1 245CONFIG_NR_QUICK=1
219CONFIG_HAVE_MLOCK=y 246# CONFIG_KSM is not set
220CONFIG_HAVE_MLOCKED_PAGE_BIT=y
221CONFIG_DEFAULT_MMAP_MIN_ADDR=8192 247CONFIG_DEFAULT_MMAP_MIN_ADDR=8192
222CONFIG_SCHED_SMT=y 248CONFIG_SCHED_SMT=y
223CONFIG_SCHED_MC=y 249CONFIG_SCHED_MC=y
@@ -237,7 +263,6 @@ CONFIG_PCI_DOMAINS=y
237CONFIG_PCI_SYSCALL=y 263CONFIG_PCI_SYSCALL=y
238CONFIG_ARCH_SUPPORTS_MSI=y 264CONFIG_ARCH_SUPPORTS_MSI=y
239CONFIG_PCI_MSI=y 265CONFIG_PCI_MSI=y
240# CONFIG_PCI_LEGACY is not set
241# CONFIG_PCI_DEBUG is not set 266# CONFIG_PCI_DEBUG is not set
242# CONFIG_PCI_STUB is not set 267# CONFIG_PCI_STUB is not set
243# CONFIG_PCI_IOV is not set 268# CONFIG_PCI_IOV is not set
@@ -261,7 +286,6 @@ CONFIG_NET=y
261# Networking options 286# Networking options
262# 287#
263CONFIG_PACKET=y 288CONFIG_PACKET=y
264CONFIG_PACKET_MMAP=y
265CONFIG_UNIX=y 289CONFIG_UNIX=y
266CONFIG_XFRM=y 290CONFIG_XFRM=y
267CONFIG_XFRM_USER=m 291CONFIG_XFRM_USER=m
@@ -315,6 +339,7 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=m
315CONFIG_INET6_XFRM_MODE_BEET=m 339CONFIG_INET6_XFRM_MODE_BEET=m
316# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 340# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
317CONFIG_IPV6_SIT=m 341CONFIG_IPV6_SIT=m
342# CONFIG_IPV6_SIT_6RD is not set
318CONFIG_IPV6_NDISC_NODETYPE=y 343CONFIG_IPV6_NDISC_NODETYPE=y
319CONFIG_IPV6_TUNNEL=m 344CONFIG_IPV6_TUNNEL=m
320# CONFIG_IPV6_MULTIPLE_TABLES is not set 345# CONFIG_IPV6_MULTIPLE_TABLES is not set
@@ -356,9 +381,6 @@ CONFIG_NET_TCPPROBE=m
356# CONFIG_AF_RXRPC is not set 381# CONFIG_AF_RXRPC is not set
357CONFIG_WIRELESS=y 382CONFIG_WIRELESS=y
358# CONFIG_CFG80211 is not set 383# CONFIG_CFG80211 is not set
359CONFIG_CFG80211_DEFAULT_PS_VALUE=0
360CONFIG_WIRELESS_OLD_REGULATORY=y
361# CONFIG_WIRELESS_EXT is not set
362# CONFIG_LIB80211 is not set 384# CONFIG_LIB80211 is not set
363 385
364# 386#
@@ -376,6 +398,7 @@ CONFIG_WIRELESS_OLD_REGULATORY=y
376# Generic Driver Options 398# Generic Driver Options
377# 399#
378CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 400CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
401# CONFIG_DEVTMPFS is not set
379CONFIG_STANDALONE=y 402CONFIG_STANDALONE=y
380# CONFIG_PREVENT_FIRMWARE_BUILD is not set 403# CONFIG_PREVENT_FIRMWARE_BUILD is not set
381CONFIG_FW_LOADER=y 404CONFIG_FW_LOADER=y
@@ -397,6 +420,7 @@ CONFIG_BLK_DEV=y
397# CONFIG_BLK_DEV_COW_COMMON is not set 420# CONFIG_BLK_DEV_COW_COMMON is not set
398CONFIG_BLK_DEV_LOOP=m 421CONFIG_BLK_DEV_LOOP=m
399CONFIG_BLK_DEV_CRYPTOLOOP=m 422CONFIG_BLK_DEV_CRYPTOLOOP=m
423# CONFIG_BLK_DEV_DRBD is not set
400CONFIG_BLK_DEV_NBD=m 424CONFIG_BLK_DEV_NBD=m
401# CONFIG_BLK_DEV_SX8 is not set 425# CONFIG_BLK_DEV_SX8 is not set
402# CONFIG_BLK_DEV_UB is not set 426# CONFIG_BLK_DEV_UB is not set
@@ -408,6 +432,7 @@ CONFIG_ATA_OVER_ETH=m
408CONFIG_SUNVDC=m 432CONFIG_SUNVDC=m
409# CONFIG_BLK_DEV_HD is not set 433# CONFIG_BLK_DEV_HD is not set
410CONFIG_MISC_DEVICES=y 434CONFIG_MISC_DEVICES=y
435# CONFIG_AD525X_DPOT is not set
411# CONFIG_PHANTOM is not set 436# CONFIG_PHANTOM is not set
412# CONFIG_SGI_IOC4 is not set 437# CONFIG_SGI_IOC4 is not set
413# CONFIG_TIFM_CORE is not set 438# CONFIG_TIFM_CORE is not set
@@ -415,6 +440,8 @@ CONFIG_MISC_DEVICES=y
415# CONFIG_ENCLOSURE_SERVICES is not set 440# CONFIG_ENCLOSURE_SERVICES is not set
416# CONFIG_HP_ILO is not set 441# CONFIG_HP_ILO is not set
417# CONFIG_ISL29003 is not set 442# CONFIG_ISL29003 is not set
443# CONFIG_SENSORS_TSL2550 is not set
444# CONFIG_DS1682 is not set
418# CONFIG_C2PORT is not set 445# CONFIG_C2PORT is not set
419 446
420# 447#
@@ -486,6 +513,7 @@ CONFIG_BLK_DEV_IDEDMA=y
486# 513#
487# SCSI device support 514# SCSI device support
488# 515#
516CONFIG_SCSI_MOD=y
489CONFIG_RAID_ATTRS=m 517CONFIG_RAID_ATTRS=m
490CONFIG_SCSI=y 518CONFIG_SCSI=y
491CONFIG_SCSI_DMA=y 519CONFIG_SCSI_DMA=y
@@ -522,8 +550,11 @@ CONFIG_SCSI_LOWLEVEL=y
522# CONFIG_ISCSI_TCP is not set 550# CONFIG_ISCSI_TCP is not set
523# CONFIG_SCSI_CXGB3_ISCSI is not set 551# CONFIG_SCSI_CXGB3_ISCSI is not set
524# CONFIG_SCSI_BNX2_ISCSI is not set 552# CONFIG_SCSI_BNX2_ISCSI is not set
553# CONFIG_BE2ISCSI is not set
525# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 554# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
555# CONFIG_SCSI_HPSA is not set
526# CONFIG_SCSI_3W_9XXX is not set 556# CONFIG_SCSI_3W_9XXX is not set
557# CONFIG_SCSI_3W_SAS is not set
527# CONFIG_SCSI_ACARD is not set 558# CONFIG_SCSI_ACARD is not set
528# CONFIG_SCSI_AACRAID is not set 559# CONFIG_SCSI_AACRAID is not set
529# CONFIG_SCSI_AIC7XXX is not set 560# CONFIG_SCSI_AIC7XXX is not set
@@ -557,7 +588,9 @@ CONFIG_SCSI_LOWLEVEL=y
557# CONFIG_SCSI_DEBUG is not set 588# CONFIG_SCSI_DEBUG is not set
558# CONFIG_SCSI_SUNESP is not set 589# CONFIG_SCSI_SUNESP is not set
559# CONFIG_SCSI_PMCRAID is not set 590# CONFIG_SCSI_PMCRAID is not set
591# CONFIG_SCSI_PM8001 is not set
560# CONFIG_SCSI_SRP is not set 592# CONFIG_SCSI_SRP is not set
593# CONFIG_SCSI_BFA_FC is not set
561# CONFIG_SCSI_DH is not set 594# CONFIG_SCSI_DH is not set
562# CONFIG_SCSI_OSD_INITIATOR is not set 595# CONFIG_SCSI_OSD_INITIATOR is not set
563# CONFIG_ATA is not set 596# CONFIG_ATA is not set
@@ -568,7 +601,9 @@ CONFIG_MD_RAID0=m
568CONFIG_MD_RAID1=m 601CONFIG_MD_RAID1=m
569CONFIG_MD_RAID10=m 602CONFIG_MD_RAID10=m
570CONFIG_MD_RAID456=m 603CONFIG_MD_RAID456=m
604# CONFIG_MULTICORE_RAID456 is not set
571CONFIG_MD_RAID6_PQ=m 605CONFIG_MD_RAID6_PQ=m
606# CONFIG_ASYNC_RAID6_TEST is not set
572CONFIG_MD_MULTIPATH=m 607CONFIG_MD_MULTIPATH=m
573# CONFIG_MD_FAULTY is not set 608# CONFIG_MD_FAULTY is not set
574CONFIG_BLK_DEV_DM=m 609CONFIG_BLK_DEV_DM=m
@@ -592,7 +627,7 @@ CONFIG_DM_ZERO=m
592# 627#
593 628
594# 629#
595# See the help texts for more information. 630# The newer stack is recommended.
596# 631#
597# CONFIG_FIREWIRE is not set 632# CONFIG_FIREWIRE is not set
598# CONFIG_IEEE1394 is not set 633# CONFIG_IEEE1394 is not set
@@ -635,6 +670,7 @@ CONFIG_SUNGEM=m
635CONFIG_SUNVNET=m 670CONFIG_SUNVNET=m
636# CONFIG_NET_VENDOR_3COM is not set 671# CONFIG_NET_VENDOR_3COM is not set
637# CONFIG_ETHOC is not set 672# CONFIG_ETHOC is not set
673# CONFIG_GRETH is not set
638# CONFIG_DNET is not set 674# CONFIG_DNET is not set
639# CONFIG_NET_TULIP is not set 675# CONFIG_NET_TULIP is not set
640# CONFIG_HP100 is not set 676# CONFIG_HP100 is not set
@@ -649,6 +685,7 @@ CONFIG_NET_PCI=y
649# CONFIG_PCNET32 is not set 685# CONFIG_PCNET32 is not set
650# CONFIG_AMD8111_ETH is not set 686# CONFIG_AMD8111_ETH is not set
651# CONFIG_ADAPTEC_STARFIRE is not set 687# CONFIG_ADAPTEC_STARFIRE is not set
688# CONFIG_KSZ884X_PCI is not set
652# CONFIG_B44 is not set 689# CONFIG_B44 is not set
653# CONFIG_FORCEDETH is not set 690# CONFIG_FORCEDETH is not set
654# CONFIG_E100 is not set 691# CONFIG_E100 is not set
@@ -664,6 +701,7 @@ CONFIG_NET_PCI=y
664# CONFIG_SUNDANCE is not set 701# CONFIG_SUNDANCE is not set
665# CONFIG_TLAN is not set 702# CONFIG_TLAN is not set
666# CONFIG_KS8842 is not set 703# CONFIG_KS8842 is not set
704# CONFIG_KS8851_MLL is not set
667# CONFIG_VIA_RHINE is not set 705# CONFIG_VIA_RHINE is not set
668# CONFIG_SC92031 is not set 706# CONFIG_SC92031 is not set
669# CONFIG_ATL2 is not set 707# CONFIG_ATL2 is not set
@@ -698,6 +736,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
698# CONFIG_CHELSIO_T3 is not set 736# CONFIG_CHELSIO_T3 is not set
699# CONFIG_ENIC is not set 737# CONFIG_ENIC is not set
700# CONFIG_IXGBE is not set 738# CONFIG_IXGBE is not set
739# CONFIG_IXGBEVF is not set
701# CONFIG_IXGB is not set 740# CONFIG_IXGB is not set
702# CONFIG_S2IO is not set 741# CONFIG_S2IO is not set
703# CONFIG_VXGE is not set 742# CONFIG_VXGE is not set
@@ -708,6 +747,7 @@ CONFIG_NIU=m
708# CONFIG_MLX4_CORE is not set 747# CONFIG_MLX4_CORE is not set
709# CONFIG_TEHUTI is not set 748# CONFIG_TEHUTI is not set
710# CONFIG_BNX2X is not set 749# CONFIG_BNX2X is not set
750# CONFIG_QLCNIC is not set
711# CONFIG_QLGE is not set 751# CONFIG_QLGE is not set
712# CONFIG_SFC is not set 752# CONFIG_SFC is not set
713# CONFIG_BE2NET is not set 753# CONFIG_BE2NET is not set
@@ -745,6 +785,7 @@ CONFIG_SLHC=m
745# CONFIG_NETCONSOLE is not set 785# CONFIG_NETCONSOLE is not set
746# CONFIG_NETPOLL is not set 786# CONFIG_NETPOLL is not set
747# CONFIG_NET_POLL_CONTROLLER is not set 787# CONFIG_NET_POLL_CONTROLLER is not set
788# CONFIG_VMXNET3 is not set
748# CONFIG_ISDN is not set 789# CONFIG_ISDN is not set
749# CONFIG_PHONE is not set 790# CONFIG_PHONE is not set
750 791
@@ -754,6 +795,7 @@ CONFIG_SLHC=m
754CONFIG_INPUT=y 795CONFIG_INPUT=y
755# CONFIG_INPUT_FF_MEMLESS is not set 796# CONFIG_INPUT_FF_MEMLESS is not set
756# CONFIG_INPUT_POLLDEV is not set 797# CONFIG_INPUT_POLLDEV is not set
798# CONFIG_INPUT_SPARSEKMAP is not set
757 799
758# 800#
759# Userland interfaces 801# Userland interfaces
@@ -770,9 +812,13 @@ CONFIG_INPUT_EVDEV=y
770# Input Device Drivers 812# Input Device Drivers
771# 813#
772CONFIG_INPUT_KEYBOARD=y 814CONFIG_INPUT_KEYBOARD=y
815# CONFIG_KEYBOARD_ADP5588 is not set
773CONFIG_KEYBOARD_ATKBD=y 816CONFIG_KEYBOARD_ATKBD=y
817# CONFIG_QT2160 is not set
774CONFIG_KEYBOARD_LKKBD=m 818CONFIG_KEYBOARD_LKKBD=m
819# CONFIG_KEYBOARD_MAX7359 is not set
775# CONFIG_KEYBOARD_NEWTON is not set 820# CONFIG_KEYBOARD_NEWTON is not set
821# CONFIG_KEYBOARD_OPENCORES is not set
776# CONFIG_KEYBOARD_STOWAWAY is not set 822# CONFIG_KEYBOARD_STOWAWAY is not set
777CONFIG_KEYBOARD_SUNKBD=y 823CONFIG_KEYBOARD_SUNKBD=y
778# CONFIG_KEYBOARD_XTKBD is not set 824# CONFIG_KEYBOARD_XTKBD is not set
@@ -812,6 +858,7 @@ CONFIG_SERIO_I8042=y
812CONFIG_SERIO_PCIPS2=m 858CONFIG_SERIO_PCIPS2=m
813CONFIG_SERIO_LIBPS2=y 859CONFIG_SERIO_LIBPS2=y
814CONFIG_SERIO_RAW=m 860CONFIG_SERIO_RAW=m
861# CONFIG_SERIO_ALTERA_PS2 is not set
815# CONFIG_GAMEPORT is not set 862# CONFIG_GAMEPORT is not set
816 863
817# 864#
@@ -844,6 +891,8 @@ CONFIG_SERIAL_SUNHV=y
844CONFIG_SERIAL_CORE=y 891CONFIG_SERIAL_CORE=y
845CONFIG_SERIAL_CORE_CONSOLE=y 892CONFIG_SERIAL_CORE_CONSOLE=y
846# CONFIG_SERIAL_JSM is not set 893# CONFIG_SERIAL_JSM is not set
894# CONFIG_SERIAL_TIMBERDALE is not set
895# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
847CONFIG_UNIX98_PTYS=y 896CONFIG_UNIX98_PTYS=y
848# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 897# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
849# CONFIG_LEGACY_PTYS is not set 898# CONFIG_LEGACY_PTYS is not set
@@ -858,6 +907,7 @@ CONFIG_HW_RANDOM_N2RNG=m
858CONFIG_DEVPORT=y 907CONFIG_DEVPORT=y
859CONFIG_I2C=y 908CONFIG_I2C=y
860CONFIG_I2C_BOARDINFO=y 909CONFIG_I2C_BOARDINFO=y
910CONFIG_I2C_COMPAT=y
861# CONFIG_I2C_CHARDEV is not set 911# CONFIG_I2C_CHARDEV is not set
862CONFIG_I2C_HELPER_AUTO=y 912CONFIG_I2C_HELPER_AUTO=y
863CONFIG_I2C_ALGOBIT=y 913CONFIG_I2C_ALGOBIT=y
@@ -889,6 +939,7 @@ CONFIG_I2C_ALGOBIT=y
889# 939#
890# CONFIG_I2C_OCORES is not set 940# CONFIG_I2C_OCORES is not set
891# CONFIG_I2C_SIMTEC is not set 941# CONFIG_I2C_SIMTEC is not set
942# CONFIG_I2C_XILINX is not set
892 943
893# 944#
894# External I2C/SMBus adapter drivers 945# External I2C/SMBus adapter drivers
@@ -898,28 +949,13 @@ CONFIG_I2C_ALGOBIT=y
898# CONFIG_I2C_TINY_USB is not set 949# CONFIG_I2C_TINY_USB is not set
899 950
900# 951#
901# Graphics adapter I2C/DDC channel drivers
902#
903# CONFIG_I2C_VOODOO3 is not set
904
905#
906# Other I2C/SMBus bus drivers 952# Other I2C/SMBus bus drivers
907# 953#
908# CONFIG_I2C_PCA_PLATFORM is not set 954# CONFIG_I2C_PCA_PLATFORM is not set
909# CONFIG_I2C_STUB is not set 955# CONFIG_I2C_STUB is not set
910
911#
912# Miscellaneous I2C Chip support
913#
914# CONFIG_DS1682 is not set
915# CONFIG_SENSORS_PCF8574 is not set
916# CONFIG_PCF8575 is not set
917# CONFIG_SENSORS_PCA9539 is not set
918# CONFIG_SENSORS_TSL2550 is not set
919# CONFIG_I2C_DEBUG_CORE is not set 956# CONFIG_I2C_DEBUG_CORE is not set
920# CONFIG_I2C_DEBUG_ALGO is not set 957# CONFIG_I2C_DEBUG_ALGO is not set
921# CONFIG_I2C_DEBUG_BUS is not set 958# CONFIG_I2C_DEBUG_BUS is not set
922# CONFIG_I2C_DEBUG_CHIP is not set
923# CONFIG_SPI is not set 959# CONFIG_SPI is not set
924 960
925# 961#
@@ -932,6 +968,11 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
932# CONFIG_POWER_SUPPLY is not set 968# CONFIG_POWER_SUPPLY is not set
933CONFIG_HWMON=y 969CONFIG_HWMON=y
934# CONFIG_HWMON_VID is not set 970# CONFIG_HWMON_VID is not set
971# CONFIG_HWMON_DEBUG_CHIP is not set
972
973#
974# Native drivers
975#
935# CONFIG_SENSORS_AD7414 is not set 976# CONFIG_SENSORS_AD7414 is not set
936# CONFIG_SENSORS_AD7418 is not set 977# CONFIG_SENSORS_AD7418 is not set
937# CONFIG_SENSORS_ADM1021 is not set 978# CONFIG_SENSORS_ADM1021 is not set
@@ -940,10 +981,11 @@ CONFIG_HWMON=y
940# CONFIG_SENSORS_ADM1029 is not set 981# CONFIG_SENSORS_ADM1029 is not set
941# CONFIG_SENSORS_ADM1031 is not set 982# CONFIG_SENSORS_ADM1031 is not set
942# CONFIG_SENSORS_ADM9240 is not set 983# CONFIG_SENSORS_ADM9240 is not set
984# CONFIG_SENSORS_ADT7411 is not set
943# CONFIG_SENSORS_ADT7462 is not set 985# CONFIG_SENSORS_ADT7462 is not set
944# CONFIG_SENSORS_ADT7470 is not set 986# CONFIG_SENSORS_ADT7470 is not set
945# CONFIG_SENSORS_ADT7473 is not set
946# CONFIG_SENSORS_ADT7475 is not set 987# CONFIG_SENSORS_ADT7475 is not set
988# CONFIG_SENSORS_ASC7621 is not set
947# CONFIG_SENSORS_ATXP1 is not set 989# CONFIG_SENSORS_ATXP1 is not set
948# CONFIG_SENSORS_DS1621 is not set 990# CONFIG_SENSORS_DS1621 is not set
949# CONFIG_SENSORS_I5K_AMB is not set 991# CONFIG_SENSORS_I5K_AMB is not set
@@ -955,6 +997,7 @@ CONFIG_HWMON=y
955# CONFIG_SENSORS_GL520SM is not set 997# CONFIG_SENSORS_GL520SM is not set
956# CONFIG_SENSORS_IT87 is not set 998# CONFIG_SENSORS_IT87 is not set
957# CONFIG_SENSORS_LM63 is not set 999# CONFIG_SENSORS_LM63 is not set
1000# CONFIG_SENSORS_LM73 is not set
958# CONFIG_SENSORS_LM75 is not set 1001# CONFIG_SENSORS_LM75 is not set
959# CONFIG_SENSORS_LM77 is not set 1002# CONFIG_SENSORS_LM77 is not set
960# CONFIG_SENSORS_LM78 is not set 1003# CONFIG_SENSORS_LM78 is not set
@@ -979,8 +1022,10 @@ CONFIG_HWMON=y
979# CONFIG_SENSORS_SMSC47M192 is not set 1022# CONFIG_SENSORS_SMSC47M192 is not set
980# CONFIG_SENSORS_SMSC47B397 is not set 1023# CONFIG_SENSORS_SMSC47B397 is not set
981# CONFIG_SENSORS_ADS7828 is not set 1024# CONFIG_SENSORS_ADS7828 is not set
1025# CONFIG_SENSORS_AMC6821 is not set
982# CONFIG_SENSORS_THMC50 is not set 1026# CONFIG_SENSORS_THMC50 is not set
983# CONFIG_SENSORS_TMP401 is not set 1027# CONFIG_SENSORS_TMP401 is not set
1028# CONFIG_SENSORS_TMP421 is not set
984# CONFIG_SENSORS_VIA686A is not set 1029# CONFIG_SENSORS_VIA686A is not set
985# CONFIG_SENSORS_VT1211 is not set 1030# CONFIG_SENSORS_VT1211 is not set
986# CONFIG_SENSORS_VT8231 is not set 1031# CONFIG_SENSORS_VT8231 is not set
@@ -993,9 +1038,8 @@ CONFIG_HWMON=y
993# CONFIG_SENSORS_W83627HF is not set 1038# CONFIG_SENSORS_W83627HF is not set
994# CONFIG_SENSORS_W83627EHF is not set 1039# CONFIG_SENSORS_W83627EHF is not set
995# CONFIG_SENSORS_ULTRA45 is not set 1040# CONFIG_SENSORS_ULTRA45 is not set
996# CONFIG_HWMON_DEBUG_CHIP is not set 1041# CONFIG_SENSORS_LIS3_I2C is not set
997# CONFIG_THERMAL is not set 1042# CONFIG_THERMAL is not set
998# CONFIG_THERMAL_HWMON is not set
999# CONFIG_WATCHDOG is not set 1043# CONFIG_WATCHDOG is not set
1000CONFIG_SSB_POSSIBLE=y 1044CONFIG_SSB_POSSIBLE=y
1001 1045
@@ -1008,21 +1052,29 @@ CONFIG_SSB_POSSIBLE=y
1008# Multifunction device drivers 1052# Multifunction device drivers
1009# 1053#
1010# CONFIG_MFD_CORE is not set 1054# CONFIG_MFD_CORE is not set
1055# CONFIG_MFD_88PM860X is not set
1011# CONFIG_MFD_SM501 is not set 1056# CONFIG_MFD_SM501 is not set
1012# CONFIG_HTC_PASIC3 is not set 1057# CONFIG_HTC_PASIC3 is not set
1013# CONFIG_TWL4030_CORE is not set 1058# CONFIG_TWL4030_CORE is not set
1014# CONFIG_MFD_TMIO is not set 1059# CONFIG_MFD_TMIO is not set
1015# CONFIG_PMIC_DA903X is not set 1060# CONFIG_PMIC_DA903X is not set
1061# CONFIG_PMIC_ADP5520 is not set
1062# CONFIG_MFD_MAX8925 is not set
1016# CONFIG_MFD_WM8400 is not set 1063# CONFIG_MFD_WM8400 is not set
1064# CONFIG_MFD_WM831X is not set
1017# CONFIG_MFD_WM8350_I2C is not set 1065# CONFIG_MFD_WM8350_I2C is not set
1066# CONFIG_MFD_WM8994 is not set
1018# CONFIG_MFD_PCF50633 is not set 1067# CONFIG_MFD_PCF50633 is not set
1019# CONFIG_AB3100_CORE is not set 1068# CONFIG_AB3100_CORE is not set
1069# CONFIG_LPC_SCH is not set
1020# CONFIG_REGULATOR is not set 1070# CONFIG_REGULATOR is not set
1021# CONFIG_MEDIA_SUPPORT is not set 1071# CONFIG_MEDIA_SUPPORT is not set
1022 1072
1023# 1073#
1024# Graphics support 1074# Graphics support
1025# 1075#
1076CONFIG_VGA_ARB=y
1077CONFIG_VGA_ARB_MAX_GPUS=16
1026# CONFIG_DRM is not set 1078# CONFIG_DRM is not set
1027# CONFIG_VGASTATE is not set 1079# CONFIG_VGASTATE is not set
1028# CONFIG_VIDEO_OUTPUT_CONTROL is not set 1080# CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -1064,6 +1116,7 @@ CONFIG_FB_FFB=y
1064# CONFIG_FB_LEO is not set 1116# CONFIG_FB_LEO is not set
1065CONFIG_FB_XVR500=y 1117CONFIG_FB_XVR500=y
1066CONFIG_FB_XVR2500=y 1118CONFIG_FB_XVR2500=y
1119CONFIG_FB_XVR1000=y
1067# CONFIG_FB_S1D13XXX is not set 1120# CONFIG_FB_S1D13XXX is not set
1068# CONFIG_FB_NVIDIA is not set 1121# CONFIG_FB_NVIDIA is not set
1069# CONFIG_FB_RIVA is not set 1122# CONFIG_FB_RIVA is not set
@@ -1176,6 +1229,7 @@ CONFIG_SND_ALI5451=m
1176# CONFIG_SND_OXYGEN is not set 1229# CONFIG_SND_OXYGEN is not set
1177# CONFIG_SND_CS4281 is not set 1230# CONFIG_SND_CS4281 is not set
1178# CONFIG_SND_CS46XX is not set 1231# CONFIG_SND_CS46XX is not set
1232# CONFIG_SND_CS5535AUDIO is not set
1179# CONFIG_SND_CTXFI is not set 1233# CONFIG_SND_CTXFI is not set
1180# CONFIG_SND_DARLA20 is not set 1234# CONFIG_SND_DARLA20 is not set
1181# CONFIG_SND_GINA20 is not set 1235# CONFIG_SND_GINA20 is not set
@@ -1225,6 +1279,7 @@ CONFIG_SND_ALI5451=m
1225# CONFIG_SND_YMFPCI is not set 1279# CONFIG_SND_YMFPCI is not set
1226CONFIG_SND_USB=y 1280CONFIG_SND_USB=y
1227# CONFIG_SND_USB_AUDIO is not set 1281# CONFIG_SND_USB_AUDIO is not set
1282# CONFIG_SND_USB_UA101 is not set
1228# CONFIG_SND_USB_CAIAQ is not set 1283# CONFIG_SND_USB_CAIAQ is not set
1229CONFIG_SND_SPARC=y 1284CONFIG_SND_SPARC=y
1230# CONFIG_SND_SUN_AMD7930 is not set 1285# CONFIG_SND_SUN_AMD7930 is not set
@@ -1247,6 +1302,7 @@ CONFIG_USB_HIDDEV=y
1247# 1302#
1248# Special HID drivers 1303# Special HID drivers
1249# 1304#
1305# CONFIG_HID_3M_PCT is not set
1250CONFIG_HID_A4TECH=y 1306CONFIG_HID_A4TECH=y
1251CONFIG_HID_APPLE=y 1307CONFIG_HID_APPLE=y
1252CONFIG_HID_BELKIN=y 1308CONFIG_HID_BELKIN=y
@@ -1263,14 +1319,19 @@ CONFIG_HID_KENSINGTON=y
1263CONFIG_HID_LOGITECH=y 1319CONFIG_HID_LOGITECH=y
1264# CONFIG_LOGITECH_FF is not set 1320# CONFIG_LOGITECH_FF is not set
1265# CONFIG_LOGIRUMBLEPAD2_FF is not set 1321# CONFIG_LOGIRUMBLEPAD2_FF is not set
1322# CONFIG_LOGIG940_FF is not set
1266CONFIG_HID_MICROSOFT=y 1323CONFIG_HID_MICROSOFT=y
1324# CONFIG_HID_MOSART is not set
1267CONFIG_HID_MONTEREY=y 1325CONFIG_HID_MONTEREY=y
1268CONFIG_HID_NTRIG=y 1326CONFIG_HID_NTRIG=y
1327CONFIG_HID_ORTEK=y
1269CONFIG_HID_PANTHERLORD=y 1328CONFIG_HID_PANTHERLORD=y
1270# CONFIG_PANTHERLORD_FF is not set 1329# CONFIG_PANTHERLORD_FF is not set
1271CONFIG_HID_PETALYNX=y 1330CONFIG_HID_PETALYNX=y
1331# CONFIG_HID_QUANTA is not set
1272CONFIG_HID_SAMSUNG=y 1332CONFIG_HID_SAMSUNG=y
1273CONFIG_HID_SONY=y 1333CONFIG_HID_SONY=y
1334# CONFIG_HID_STANTUM is not set
1274CONFIG_HID_SUNPLUS=y 1335CONFIG_HID_SUNPLUS=y
1275CONFIG_HID_GREENASIA=y 1336CONFIG_HID_GREENASIA=y
1276# CONFIG_GREENASIA_FF is not set 1337# CONFIG_GREENASIA_FF is not set
@@ -1311,6 +1372,7 @@ CONFIG_USB_EHCI_HCD=m
1311# CONFIG_USB_OXU210HP_HCD is not set 1372# CONFIG_USB_OXU210HP_HCD is not set
1312# CONFIG_USB_ISP116X_HCD is not set 1373# CONFIG_USB_ISP116X_HCD is not set
1313# CONFIG_USB_ISP1760_HCD is not set 1374# CONFIG_USB_ISP1760_HCD is not set
1375# CONFIG_USB_ISP1362_HCD is not set
1314CONFIG_USB_OHCI_HCD=y 1376CONFIG_USB_OHCI_HCD=y
1315# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1377# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1316# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1378# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1372,7 +1434,6 @@ CONFIG_USB_STORAGE=m
1372# CONFIG_USB_RIO500 is not set 1434# CONFIG_USB_RIO500 is not set
1373# CONFIG_USB_LEGOTOWER is not set 1435# CONFIG_USB_LEGOTOWER is not set
1374# CONFIG_USB_LCD is not set 1436# CONFIG_USB_LCD is not set
1375# CONFIG_USB_BERRY_CHARGE is not set
1376# CONFIG_USB_LED is not set 1437# CONFIG_USB_LED is not set
1377# CONFIG_USB_CYPRESS_CY7C63 is not set 1438# CONFIG_USB_CYPRESS_CY7C63 is not set
1378# CONFIG_USB_CYTHERM is not set 1439# CONFIG_USB_CYTHERM is not set
@@ -1385,7 +1446,6 @@ CONFIG_USB_STORAGE=m
1385# CONFIG_USB_IOWARRIOR is not set 1446# CONFIG_USB_IOWARRIOR is not set
1386# CONFIG_USB_TEST is not set 1447# CONFIG_USB_TEST is not set
1387# CONFIG_USB_ISIGHTFW is not set 1448# CONFIG_USB_ISIGHTFW is not set
1388# CONFIG_USB_VST is not set
1389# CONFIG_USB_GADGET is not set 1449# CONFIG_USB_GADGET is not set
1390 1450
1391# 1451#
@@ -1426,6 +1486,7 @@ CONFIG_RTC_INTF_DEV=y
1426# CONFIG_RTC_DRV_PCF8563 is not set 1486# CONFIG_RTC_DRV_PCF8563 is not set
1427# CONFIG_RTC_DRV_PCF8583 is not set 1487# CONFIG_RTC_DRV_PCF8583 is not set
1428# CONFIG_RTC_DRV_M41T80 is not set 1488# CONFIG_RTC_DRV_M41T80 is not set
1489# CONFIG_RTC_DRV_BQ32K is not set
1429# CONFIG_RTC_DRV_S35390A is not set 1490# CONFIG_RTC_DRV_S35390A is not set
1430# CONFIG_RTC_DRV_FM3130 is not set 1491# CONFIG_RTC_DRV_FM3130 is not set
1431# CONFIG_RTC_DRV_RX8581 is not set 1492# CONFIG_RTC_DRV_RX8581 is not set
@@ -1447,7 +1508,9 @@ CONFIG_RTC_DRV_CMOS=y
1447# CONFIG_RTC_DRV_M48T86 is not set 1508# CONFIG_RTC_DRV_M48T86 is not set
1448# CONFIG_RTC_DRV_M48T35 is not set 1509# CONFIG_RTC_DRV_M48T35 is not set
1449CONFIG_RTC_DRV_M48T59=y 1510CONFIG_RTC_DRV_M48T59=y
1511# CONFIG_RTC_DRV_MSM6242 is not set
1450CONFIG_RTC_DRV_BQ4802=y 1512CONFIG_RTC_DRV_BQ4802=y
1513# CONFIG_RTC_DRV_RP5C01 is not set
1451# CONFIG_RTC_DRV_V3020 is not set 1514# CONFIG_RTC_DRV_V3020 is not set
1452 1515
1453# 1516#
@@ -1549,6 +1612,7 @@ CONFIG_MISC_FILESYSTEMS=y
1549# CONFIG_BEFS_FS is not set 1612# CONFIG_BEFS_FS is not set
1550# CONFIG_BFS_FS is not set 1613# CONFIG_BFS_FS is not set
1551# CONFIG_EFS_FS is not set 1614# CONFIG_EFS_FS is not set
1615# CONFIG_LOGFS is not set
1552# CONFIG_CRAMFS is not set 1616# CONFIG_CRAMFS is not set
1553# CONFIG_SQUASHFS is not set 1617# CONFIG_SQUASHFS is not set
1554# CONFIG_VXFS_FS is not set 1618# CONFIG_VXFS_FS is not set
@@ -1563,6 +1627,7 @@ CONFIG_NETWORK_FILESYSTEMS=y
1563# CONFIG_NFS_FS is not set 1627# CONFIG_NFS_FS is not set
1564# CONFIG_NFSD is not set 1628# CONFIG_NFSD is not set
1565# CONFIG_SMB_FS is not set 1629# CONFIG_SMB_FS is not set
1630# CONFIG_CEPH_FS is not set
1566# CONFIG_CIFS is not set 1631# CONFIG_CIFS is not set
1567# CONFIG_NCP_FS is not set 1632# CONFIG_NCP_FS is not set
1568# CONFIG_CODA_FS is not set 1633# CONFIG_CODA_FS is not set
@@ -1625,6 +1690,7 @@ CONFIG_PRINTK_TIME=y
1625CONFIG_ENABLE_MUST_CHECK=y 1690CONFIG_ENABLE_MUST_CHECK=y
1626CONFIG_FRAME_WARN=2048 1691CONFIG_FRAME_WARN=2048
1627CONFIG_MAGIC_SYSRQ=y 1692CONFIG_MAGIC_SYSRQ=y
1693# CONFIG_STRIP_ASM_SYMS is not set
1628# CONFIG_UNUSED_SYMBOLS is not set 1694# CONFIG_UNUSED_SYMBOLS is not set
1629CONFIG_DEBUG_FS=y 1695CONFIG_DEBUG_FS=y
1630# CONFIG_HEADERS_CHECK is not set 1696# CONFIG_HEADERS_CHECK is not set
@@ -1678,9 +1744,11 @@ CONFIG_NOP_TRACER=y
1678CONFIG_HAVE_FUNCTION_TRACER=y 1744CONFIG_HAVE_FUNCTION_TRACER=y
1679CONFIG_HAVE_DYNAMIC_FTRACE=y 1745CONFIG_HAVE_DYNAMIC_FTRACE=y
1680CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1746CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1747CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
1681CONFIG_RING_BUFFER=y 1748CONFIG_RING_BUFFER=y
1682CONFIG_EVENT_TRACING=y 1749CONFIG_EVENT_TRACING=y
1683CONFIG_CONTEXT_SWITCH_TRACER=y 1750CONFIG_CONTEXT_SWITCH_TRACER=y
1751CONFIG_RING_BUFFER_ALLOW_SWAP=y
1684CONFIG_TRACING=y 1752CONFIG_TRACING=y
1685CONFIG_GENERIC_TRACER=y 1753CONFIG_GENERIC_TRACER=y
1686CONFIG_TRACING_SUPPORT=y 1754CONFIG_TRACING_SUPPORT=y
@@ -1688,6 +1756,7 @@ CONFIG_FTRACE=y
1688# CONFIG_FUNCTION_TRACER is not set 1756# CONFIG_FUNCTION_TRACER is not set
1689# CONFIG_IRQSOFF_TRACER is not set 1757# CONFIG_IRQSOFF_TRACER is not set
1690# CONFIG_SCHED_TRACER is not set 1758# CONFIG_SCHED_TRACER is not set
1759# CONFIG_FTRACE_SYSCALLS is not set
1691# CONFIG_BOOT_TRACER is not set 1760# CONFIG_BOOT_TRACER is not set
1692CONFIG_BRANCH_PROFILE_NONE=y 1761CONFIG_BRANCH_PROFILE_NONE=y
1693# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set 1762# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
@@ -1706,6 +1775,7 @@ CONFIG_HAVE_ARCH_KGDB=y
1706# CONFIG_DEBUG_STACK_USAGE is not set 1775# CONFIG_DEBUG_STACK_USAGE is not set
1707# CONFIG_DEBUG_DCFLUSH is not set 1776# CONFIG_DEBUG_DCFLUSH is not set
1708# CONFIG_STACK_DEBUG is not set 1777# CONFIG_STACK_DEBUG is not set
1778# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set
1709 1779
1710# 1780#
1711# Security options 1781# Security options
@@ -1714,11 +1784,17 @@ CONFIG_KEYS=y
1714# CONFIG_KEYS_DEBUG_PROC_KEYS is not set 1784# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
1715# CONFIG_SECURITY is not set 1785# CONFIG_SECURITY is not set
1716# CONFIG_SECURITYFS is not set 1786# CONFIG_SECURITYFS is not set
1717# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1787# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1788# CONFIG_DEFAULT_SECURITY_SMACK is not set
1789# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1790CONFIG_DEFAULT_SECURITY_DAC=y
1791CONFIG_DEFAULT_SECURITY=""
1718CONFIG_XOR_BLOCKS=m 1792CONFIG_XOR_BLOCKS=m
1719CONFIG_ASYNC_CORE=m 1793CONFIG_ASYNC_CORE=m
1720CONFIG_ASYNC_MEMCPY=m 1794CONFIG_ASYNC_MEMCPY=m
1721CONFIG_ASYNC_XOR=m 1795CONFIG_ASYNC_XOR=m
1796CONFIG_ASYNC_PQ=m
1797CONFIG_ASYNC_RAID6_RECOV=m
1722CONFIG_CRYPTO=y 1798CONFIG_CRYPTO=y
1723 1799
1724# 1800#
@@ -1738,6 +1814,7 @@ CONFIG_CRYPTO_MANAGER=y
1738CONFIG_CRYPTO_MANAGER2=y 1814CONFIG_CRYPTO_MANAGER2=y
1739CONFIG_CRYPTO_GF128MUL=m 1815CONFIG_CRYPTO_GF128MUL=m
1740CONFIG_CRYPTO_NULL=m 1816CONFIG_CRYPTO_NULL=m
1817# CONFIG_CRYPTO_PCRYPT is not set
1741CONFIG_CRYPTO_WORKQUEUE=y 1818CONFIG_CRYPTO_WORKQUEUE=y
1742# CONFIG_CRYPTO_CRYPTD is not set 1819# CONFIG_CRYPTO_CRYPTD is not set
1743CONFIG_CRYPTO_AUTHENC=y 1820CONFIG_CRYPTO_AUTHENC=y
@@ -1835,9 +1912,11 @@ CONFIG_CRC32=y
1835CONFIG_LIBCRC32C=m 1912CONFIG_LIBCRC32C=m
1836CONFIG_ZLIB_INFLATE=y 1913CONFIG_ZLIB_INFLATE=y
1837CONFIG_ZLIB_DEFLATE=y 1914CONFIG_ZLIB_DEFLATE=y
1915CONFIG_LZO_DECOMPRESS=y
1838CONFIG_DECOMPRESS_GZIP=y 1916CONFIG_DECOMPRESS_GZIP=y
1839CONFIG_DECOMPRESS_BZIP2=y 1917CONFIG_DECOMPRESS_BZIP2=y
1840CONFIG_DECOMPRESS_LZMA=y 1918CONFIG_DECOMPRESS_LZMA=y
1919CONFIG_DECOMPRESS_LZO=y
1841CONFIG_HAS_IOMEM=y 1920CONFIG_HAS_IOMEM=y
1842CONFIG_HAS_IOPORT=y 1921CONFIG_HAS_IOPORT=y
1843CONFIG_HAS_DMA=y 1922CONFIG_HAS_DMA=y
diff --git a/arch/sparc/include/asm/asm-offsets.h b/arch/sparc/include/asm/asm-offsets.h
new file mode 100644
index 000000000000..d370ee36a182
--- /dev/null
+++ b/arch/sparc/include/asm/asm-offsets.h
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
diff --git a/arch/sparc/include/asm/btext.h b/arch/sparc/include/asm/btext.h
new file mode 100644
index 000000000000..9b2bc6b6ed0a
--- /dev/null
+++ b/arch/sparc/include/asm/btext.h
@@ -0,0 +1,6 @@
1#ifndef _SPARC_BTEXT_H
2#define _SPARC_BTEXT_H
3
4extern int btext_find_display(void);
5
6#endif /* _SPARC_BTEXT_H */
diff --git a/arch/sparc/include/asm/cacheflush_32.h b/arch/sparc/include/asm/cacheflush_32.h
index 68ac10910271..2e468773f250 100644
--- a/arch/sparc/include/asm/cacheflush_32.h
+++ b/arch/sparc/include/asm/cacheflush_32.h
@@ -75,6 +75,7 @@ BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long)
75 75
76extern void sparc_flush_page_to_ram(struct page *page); 76extern void sparc_flush_page_to_ram(struct page *page);
77 77
78#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
78#define flush_dcache_page(page) sparc_flush_page_to_ram(page) 79#define flush_dcache_page(page) sparc_flush_page_to_ram(page)
79#define flush_dcache_mmap_lock(mapping) do { } while (0) 80#define flush_dcache_mmap_lock(mapping) do { } while (0)
80#define flush_dcache_mmap_unlock(mapping) do { } while (0) 81#define flush_dcache_mmap_unlock(mapping) do { } while (0)
diff --git a/arch/sparc/include/asm/cacheflush_64.h b/arch/sparc/include/asm/cacheflush_64.h
index c43321729b3b..b95384033e89 100644
--- a/arch/sparc/include/asm/cacheflush_64.h
+++ b/arch/sparc/include/asm/cacheflush_64.h
@@ -37,6 +37,7 @@ extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page);
37#endif 37#endif
38 38
39extern void __flush_dcache_range(unsigned long start, unsigned long end); 39extern void __flush_dcache_range(unsigned long start, unsigned long end);
40#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
40extern void flush_dcache_page(struct page *page); 41extern void flush_dcache_page(struct page *page);
41 42
42#define flush_icache_page(vma, pg) do { } while(0) 43#define flush_icache_page(vma, pg) do { } while(0)
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
index 0e706257918f..5016f76ea98a 100644
--- a/arch/sparc/include/asm/compat.h
+++ b/arch/sparc/include/asm/compat.h
@@ -5,7 +5,8 @@
5 */ 5 */
6#include <linux/types.h> 6#include <linux/types.h>
7 7
8#define COMPAT_USER_HZ 100 8#define COMPAT_USER_HZ 100
9#define COMPAT_UTS_MACHINE "sparc\0\0"
9 10
10typedef u32 compat_size_t; 11typedef u32 compat_size_t;
11typedef s32 compat_ssize_t; 12typedef s32 compat_ssize_t;
diff --git a/arch/sparc/include/asm/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h
index 926397d345ff..050ef35b9dcf 100644
--- a/arch/sparc/include/asm/cpudata_64.h
+++ b/arch/sparc/include/asm/cpudata_64.h
@@ -17,7 +17,7 @@ typedef struct {
17 unsigned int __nmi_count; 17 unsigned int __nmi_count;
18 unsigned long clock_tick; /* %tick's per second */ 18 unsigned long clock_tick; /* %tick's per second */
19 unsigned long __pad; 19 unsigned long __pad;
20 unsigned int __pad1; 20 unsigned int irq0_irqs;
21 unsigned int __pad2; 21 unsigned int __pad2;
22 22
23 /* Dcache line 2, rarely used */ 23 /* Dcache line 2, rarely used */
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 5a8c308e2b5c..4b4a0c0b0ccd 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -8,7 +8,6 @@
8#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 8#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
9 9
10extern int dma_supported(struct device *dev, u64 mask); 10extern int dma_supported(struct device *dev, u64 mask);
11extern int dma_set_mask(struct device *dev, u64 dma_mask);
12 11
13#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 12#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
14#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 13#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
@@ -62,4 +61,17 @@ static inline int dma_get_cache_alignment(void)
62 return (1 << INTERNODE_CACHE_SHIFT); 61 return (1 << INTERNODE_CACHE_SHIFT);
63} 62}
64 63
64static inline int dma_set_mask(struct device *dev, u64 mask)
65{
66#ifdef CONFIG_PCI
67 if (dev->bus == &pci_bus_type) {
68 if (!dev->dma_mask || !dma_supported(dev, mask))
69 return -EINVAL;
70 *dev->dma_mask = mask;
71 return 0;
72 }
73#endif
74 return -EINVAL;
75}
76
65#endif 77#endif
diff --git a/arch/sparc/include/asm/elf_32.h b/arch/sparc/include/asm/elf_32.h
index 381a1b5256d6..4269ca6ad18a 100644
--- a/arch/sparc/include/asm/elf_32.h
+++ b/arch/sparc/include/asm/elf_32.h
@@ -104,8 +104,6 @@ typedef struct {
104#define ELF_CLASS ELFCLASS32 104#define ELF_CLASS ELFCLASS32
105#define ELF_DATA ELFDATA2MSB 105#define ELF_DATA ELFDATA2MSB
106 106
107#define USE_ELF_CORE_DUMP
108
109#define ELF_EXEC_PAGESIZE 4096 107#define ELF_EXEC_PAGESIZE 4096
110 108
111 109
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index d42e393078c4..e67880381b84 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -152,7 +152,6 @@ typedef struct {
152 (x)->e_machine == EM_SPARC32PLUS) 152 (x)->e_machine == EM_SPARC32PLUS)
153#define compat_start_thread start_thread32 153#define compat_start_thread start_thread32
154 154
155#define USE_ELF_CORE_DUMP
156#define ELF_EXEC_PAGESIZE PAGE_SIZE 155#define ELF_EXEC_PAGESIZE PAGE_SIZE
157 156
158/* This is the location that an ET_DYN program is loaded if exec'ed. Typical 157/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
@@ -196,17 +195,10 @@ static inline unsigned int sparc64_elf_hwcap(void)
196#define ELF_PLATFORM (NULL) 195#define ELF_PLATFORM (NULL)
197 196
198#define SET_PERSONALITY(ex) \ 197#define SET_PERSONALITY(ex) \
199do { unsigned long new_flags = current_thread_info()->flags; \ 198do { if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
200 new_flags &= _TIF_32BIT; \ 199 set_thread_flag(TIF_32BIT); \
201 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
202 new_flags |= _TIF_32BIT; \
203 else \ 200 else \
204 new_flags &= ~_TIF_32BIT; \ 201 clear_thread_flag(TIF_32BIT); \
205 if ((current_thread_info()->flags & _TIF_32BIT) \
206 != new_flags) \
207 set_thread_flag(TIF_ABI_PENDING); \
208 else \
209 clear_thread_flag(TIF_ABI_PENDING); \
210 /* flush_thread will update pgd cache */ \ 202 /* flush_thread will update pgd cache */ \
211 if (personality(current->personality) != PER_LINUX32) \ 203 if (personality(current->personality) != PER_LINUX32) \
212 set_personality(PER_LINUX | \ 204 set_personality(PER_LINUX | \
diff --git a/arch/sparc/include/asm/fbio.h b/arch/sparc/include/asm/fbio.h
index b9215a0907d3..0a21da87f7d6 100644
--- a/arch/sparc/include/asm/fbio.h
+++ b/arch/sparc/include/asm/fbio.h
@@ -173,7 +173,7 @@ struct mdi_cfginfo {
173 int mdi_ncluts; /* Number of implemented CLUTs in this MDI */ 173 int mdi_ncluts; /* Number of implemented CLUTs in this MDI */
174 int mdi_type; /* FBTYPE name */ 174 int mdi_type; /* FBTYPE name */
175 int mdi_height; /* height */ 175 int mdi_height; /* height */
176 int mdi_width; /* widht */ 176 int mdi_width; /* width */
177 int mdi_size; /* available ram */ 177 int mdi_size; /* available ram */
178 int mdi_mode; /* 8bpp, 16bpp or 32bpp */ 178 int mdi_mode; /* 8bpp, 16bpp or 32bpp */
179 int mdi_pixfreq; /* pixel clock (from PROM) */ 179 int mdi_pixfreq; /* pixel clock (from PROM) */
diff --git a/arch/sparc/include/asm/fcntl.h b/arch/sparc/include/asm/fcntl.h
index d4d9c9d852c3..38f37b333cc7 100644
--- a/arch/sparc/include/asm/fcntl.h
+++ b/arch/sparc/include/asm/fcntl.h
@@ -1,14 +1,12 @@
1#ifndef _SPARC_FCNTL_H 1#ifndef _SPARC_FCNTL_H
2#define _SPARC_FCNTL_H 2#define _SPARC_FCNTL_H
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_APPEND 0x0008 4#define O_APPEND 0x0008
7#define FASYNC 0x0040 /* fcntl, for BSD compatibility */ 5#define FASYNC 0x0040 /* fcntl, for BSD compatibility */
8#define O_CREAT 0x0200 /* not fcntl */ 6#define O_CREAT 0x0200 /* not fcntl */
9#define O_TRUNC 0x0400 /* not fcntl */ 7#define O_TRUNC 0x0400 /* not fcntl */
10#define O_EXCL 0x0800 /* not fcntl */ 8#define O_EXCL 0x0800 /* not fcntl */
11#define O_SYNC 0x2000 9#define O_DSYNC 0x2000 /* used to be O_SYNC, see below */
12#define O_NONBLOCK 0x4000 10#define O_NONBLOCK 0x4000
13#if defined(__sparc__) && defined(__arch64__) 11#if defined(__sparc__) && defined(__arch64__)
14#define O_NDELAY 0x0004 12#define O_NDELAY 0x0004
@@ -20,6 +18,21 @@
20#define O_DIRECT 0x100000 /* direct disk access hint */ 18#define O_DIRECT 0x100000 /* direct disk access hint */
21#define O_NOATIME 0x200000 19#define O_NOATIME 0x200000
22#define O_CLOEXEC 0x400000 20#define O_CLOEXEC 0x400000
21/*
22 * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
23 * the O_SYNC flag. We continue to use the existing numerical value
24 * for O_DSYNC semantics now, but using the correct symbolic name for it.
25 * This new value is used to request true Posix O_SYNC semantics. It is
26 * defined in this strange way to make sure applications compiled against
27 * new headers get at least O_DSYNC semantics on older kernels.
28 *
29 * This has the nice side-effect that we can simply test for O_DSYNC
30 * wherever we do not care if O_DSYNC or O_SYNC is used.
31 *
32 * Note: __O_SYNC must never be used directly.
33 */
34#define __O_SYNC 0x800000
35#define O_SYNC (__O_SYNC|O_DSYNC)
23 36
24#define F_GETOWN 5 /* for sockets. */ 37#define F_GETOWN 5 /* for sockets. */
25#define F_SETOWN 6 /* for sockets. */ 38#define F_SETOWN 6 /* for sockets. */
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index 93fe21e02c86..2889574608db 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -8,7 +8,7 @@
8#include <asm/page.h> /* IO address mapping routines need this */ 8#include <asm/page.h> /* IO address mapping routines need this */
9#include <asm/system.h> 9#include <asm/system.h>
10 10
11#define page_to_phys(page) (((page) - mem_map) << PAGE_SHIFT) 11#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
12 12
13static inline u32 flip_dword (u32 l) 13static inline u32 flip_dword (u32 l)
14{ 14{
@@ -249,10 +249,14 @@ extern void iounmap(volatile void __iomem *addr);
249 249
250#define ioread8(X) readb(X) 250#define ioread8(X) readb(X)
251#define ioread16(X) readw(X) 251#define ioread16(X) readw(X)
252#define ioread16be(X) __raw_readw(X)
252#define ioread32(X) readl(X) 253#define ioread32(X) readl(X)
254#define ioread32be(X) __raw_readl(X)
253#define iowrite8(val,X) writeb(val,X) 255#define iowrite8(val,X) writeb(val,X)
254#define iowrite16(val,X) writew(val,X) 256#define iowrite16(val,X) writew(val,X)
257#define iowrite16be(val,X) __raw_writew(val,X)
255#define iowrite32(val,X) writel(val,X) 258#define iowrite32(val,X) writel(val,X)
259#define iowrite32be(val,X) __raw_writel(val,X)
256 260
257static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count) 261static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count)
258{ 262{
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 4aee21dc9c6f..9517d063c79c 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -468,10 +468,14 @@ static inline void iounmap(volatile void __iomem *addr)
468 468
469#define ioread8(X) readb(X) 469#define ioread8(X) readb(X)
470#define ioread16(X) readw(X) 470#define ioread16(X) readw(X)
471#define ioread16be(X) __raw_readw(X)
471#define ioread32(X) readl(X) 472#define ioread32(X) readl(X)
473#define ioread32be(X) __raw_readl(X)
472#define iowrite8(val,X) writeb(val,X) 474#define iowrite8(val,X) writeb(val,X)
473#define iowrite16(val,X) writew(val,X) 475#define iowrite16(val,X) writew(val,X)
476#define iowrite16be(val,X) __raw_writew(val,X)
474#define iowrite32(val,X) writel(val,X) 477#define iowrite32(val,X) writel(val,X)
478#define iowrite32be(val,X) __raw_writel(val,X)
475 479
476/* Create a virtual mapping cookie for an IO port range */ 480/* Create a virtual mapping cookie for an IO port range */
477extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 481extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
index 8b49bf920df3..bfa1ea45b4cd 100644
--- a/arch/sparc/include/asm/irqflags_64.h
+++ b/arch/sparc/include/asm/irqflags_64.h
@@ -76,9 +76,26 @@ static inline int raw_irqs_disabled(void)
76 */ 76 */
77static inline unsigned long __raw_local_irq_save(void) 77static inline unsigned long __raw_local_irq_save(void)
78{ 78{
79 unsigned long flags = __raw_local_save_flags(); 79 unsigned long flags, tmp;
80 80
81 raw_local_irq_disable(); 81 /* Disable interrupts to PIL_NORMAL_MAX unless we already
82 * are using PIL_NMI, in which case PIL_NMI is retained.
83 *
84 * The only values we ever program into the %pil are 0,
85 * PIL_NORMAL_MAX and PIL_NMI.
86 *
87 * Since PIL_NMI is the largest %pil value and all bits are
88 * set in it (0xf), it doesn't matter what PIL_NORMAL_MAX
89 * actually is.
90 */
91 __asm__ __volatile__(
92 "rdpr %%pil, %0\n\t"
93 "or %0, %2, %1\n\t"
94 "wrpr %1, 0x0, %%pil"
95 : "=r" (flags), "=r" (tmp)
96 : "i" (PIL_NORMAL_MAX)
97 : "memory"
98 );
82 99
83 return flags; 100 return flags;
84} 101}
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index 28a42b73f64f..3ea5964c43b4 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -148,7 +148,7 @@ static inline unsigned long leon_load_reg(unsigned long paddr)
148 return retval; 148 return retval;
149} 149}
150 150
151extern inline void leon_srmmu_disabletlb(void) 151static inline void leon_srmmu_disabletlb(void)
152{ 152{
153 unsigned int retval; 153 unsigned int retval;
154 __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), 154 __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0),
@@ -158,7 +158,7 @@ extern inline void leon_srmmu_disabletlb(void)
158 "i"(ASI_LEON_MMUREGS) : "memory"); 158 "i"(ASI_LEON_MMUREGS) : "memory");
159} 159}
160 160
161extern inline void leon_srmmu_enabletlb(void) 161static inline void leon_srmmu_enabletlb(void)
162{ 162{
163 unsigned int retval; 163 unsigned int retval;
164 __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), 164 __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0),
@@ -190,7 +190,7 @@ extern void leon_init_IRQ(void);
190 190
191extern unsigned long last_valid_pfn; 191extern unsigned long last_valid_pfn;
192 192
193extern inline unsigned long sparc_leon3_get_dcachecfg(void) 193static inline unsigned long sparc_leon3_get_dcachecfg(void)
194{ 194{
195 unsigned int retval; 195 unsigned int retval;
196 __asm__ __volatile__("lda [%1] %2, %0\n\t" : 196 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
@@ -201,7 +201,7 @@ extern inline unsigned long sparc_leon3_get_dcachecfg(void)
201} 201}
202 202
203/* enable snooping */ 203/* enable snooping */
204extern inline void sparc_leon3_enable_snooping(void) 204static inline void sparc_leon3_enable_snooping(void)
205{ 205{
206 __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t" 206 __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t"
207 "set 0x800000, %%l2\n\t" 207 "set 0x800000, %%l2\n\t"
@@ -209,7 +209,14 @@ extern inline void sparc_leon3_enable_snooping(void)
209 "sta %%l2, [%%g0] 2\n\t" : : : "l1", "l2"); 209 "sta %%l2, [%%g0] 2\n\t" : : : "l1", "l2");
210}; 210};
211 211
212extern inline void sparc_leon3_disable_cache(void) 212static inline int sparc_leon3_snooping_enabled(void)
213{
214 u32 cctrl;
215 __asm__ __volatile__("lda [%%g0] 2, %0\n\t" : "=r"(cctrl));
216 return (cctrl >> 23) & 1;
217};
218
219static inline void sparc_leon3_disable_cache(void)
213{ 220{
214 __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t" 221 __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t"
215 "set 0x00000f, %%l2\n\t" 222 "set 0x00000f, %%l2\n\t"
@@ -340,6 +347,30 @@ extern int leon_flush_needed(void);
340extern void leon_switch_mm(void); 347extern void leon_switch_mm(void);
341extern int srmmu_swprobe_trace; 348extern int srmmu_swprobe_trace;
342 349
350#ifdef CONFIG_SMP
351extern int leon_smp_nrcpus(void);
352extern void leon_clear_profile_irq(int cpu);
353extern void leon_smp_done(void);
354extern void leon_boot_cpus(void);
355extern int leon_boot_one_cpu(int i);
356void leon_init_smp(void);
357extern void cpu_probe(void);
358extern void cpu_idle(void);
359extern void init_IRQ(void);
360extern void cpu_panic(void);
361extern int __leon_processor_id(void);
362void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu);
363
364extern unsigned int real_irq_entry[], smpleon_ticker[];
365extern unsigned int patchme_maybe_smp_msg[];
366extern unsigned long trapbase_cpu1[];
367extern unsigned long trapbase_cpu2[];
368extern unsigned long trapbase_cpu3[];
369extern unsigned int t_nmi[], linux_trap_ipi15_leon[];
370extern unsigned int linux_trap_ipi15_sun4m[];
371
372#endif /* CONFIG_SMP */
373
343#endif /* __KERNEL__ */ 374#endif /* __KERNEL__ */
344 375
345#endif /* __ASSEMBLY__ */ 376#endif /* __ASSEMBLY__ */
@@ -356,6 +387,10 @@ extern int srmmu_swprobe_trace;
356#define leon_switch_mm() do {} while (0) 387#define leon_switch_mm() do {} while (0)
357#define leon_init_IRQ() do {} while (0) 388#define leon_init_IRQ() do {} while (0)
358#define init_leon() do {} while (0) 389#define init_leon() do {} while (0)
390#define leon_smp_done() do {} while (0)
391#define leon_boot_cpus() do {} while (0)
392#define leon_boot_one_cpu(i) 1
393#define leon_init_smp() do {} while (0)
359 394
360#endif /* !defined(CONFIG_SPARC_LEON) */ 395#endif /* !defined(CONFIG_SPARC_LEON) */
361 396
diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h
index f72080bdda94..156707b0f18d 100644
--- a/arch/sparc/include/asm/page_32.h
+++ b/arch/sparc/include/asm/page_32.h
@@ -143,7 +143,7 @@ extern unsigned long pfn_base;
143#define phys_to_virt __va 143#define phys_to_virt __va
144 144
145#define ARCH_PFN_OFFSET (pfn_base) 145#define ARCH_PFN_OFFSET (pfn_base)
146#define virt_to_page(kaddr) (mem_map + ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT))) 146#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
147 147
148#define pfn_valid(pfn) (((pfn) >= (pfn_base)) && (((pfn)-(pfn_base)) < max_mapnr)) 148#define pfn_valid(pfn) (((pfn) >= (pfn_base)) && (((pfn)-(pfn_base)) < max_mapnr))
149#define virt_addr_valid(kaddr) ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT) < max_mapnr) 149#define virt_addr_valid(kaddr) ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT) < max_mapnr)
diff --git a/arch/sparc/include/asm/param.h b/arch/sparc/include/asm/param.h
index 9836d9a3cb9a..0bc356bf8c50 100644
--- a/arch/sparc/include/asm/param.h
+++ b/arch/sparc/include/asm/param.h
@@ -1,22 +1,7 @@
1#ifndef _ASMSPARC_PARAM_H 1#ifndef _ASMSPARC_PARAM_H
2#define _ASMSPARC_PARAM_H 2#define _ASMSPARC_PARAM_H
3 3
4#ifdef __KERNEL__
5# define HZ CONFIG_HZ /* Internal kernel timer frequency */
6# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
7# define CLOCKS_PER_SEC (USER_HZ)
8#endif
9
10#ifndef HZ
11#define HZ 100
12#endif
13
14#define EXEC_PAGESIZE 8192 /* Thanks for sun4's we carry baggage... */ 4#define EXEC_PAGESIZE 8192 /* Thanks for sun4's we carry baggage... */
5#include <asm-generic/param.h>
15 6
16#ifndef NOGROUP 7#endif /* _ASMSPARC_PARAM_H */
17#define NOGROUP (-1)
18#endif
19
20#define MAXHOSTNAMELEN 64 /* max length of hostname */
21
22#endif
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h
index e769f668a4b5..332ac9ab36bc 100644
--- a/arch/sparc/include/asm/pci_32.h
+++ b/arch/sparc/include/asm/pci_32.h
@@ -32,20 +32,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
32 32
33struct pci_dev; 33struct pci_dev;
34 34
35/* pci_unmap_{single,page} is not a nop, thus... */
36#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
37 dma_addr_t ADDR_NAME;
38#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
39 __u32 LEN_NAME;
40#define pci_unmap_addr(PTR, ADDR_NAME) \
41 ((PTR)->ADDR_NAME)
42#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
43 (((PTR)->ADDR_NAME) = (VAL))
44#define pci_unmap_len(PTR, LEN_NAME) \
45 ((PTR)->LEN_NAME)
46#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
47 (((PTR)->LEN_NAME) = (VAL))
48
49#ifdef CONFIG_PCI 35#ifdef CONFIG_PCI
50static inline void pci_dma_burst_advice(struct pci_dev *pdev, 36static inline void pci_dma_burst_advice(struct pci_dev *pdev,
51 enum pci_dma_burst_strategy *strat, 37 enum pci_dma_burst_strategy *strat,
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index b63e51c3c3ee..5312782f0b5e 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -16,8 +16,6 @@
16 16
17#define PCI_IRQ_NONE 0xffffffff 17#define PCI_IRQ_NONE 0xffffffff
18 18
19#define PCI_CACHE_LINE_BYTES 64
20
21static inline void pcibios_set_master(struct pci_dev *dev) 19static inline void pcibios_set_master(struct pci_dev *dev)
22{ 20{
23 /* No special bus mastering setup handling */ 21 /* No special bus mastering setup handling */
@@ -34,20 +32,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
34 */ 32 */
35#define PCI_DMA_BUS_IS_PHYS (0) 33#define PCI_DMA_BUS_IS_PHYS (0)
36 34
37/* pci_unmap_{single,page} is not a nop, thus... */
38#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
39 dma_addr_t ADDR_NAME;
40#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
41 __u32 LEN_NAME;
42#define pci_unmap_addr(PTR, ADDR_NAME) \
43 ((PTR)->ADDR_NAME)
44#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
45 (((PTR)->ADDR_NAME) = (VAL))
46#define pci_unmap_len(PTR, LEN_NAME) \
47 ((PTR)->LEN_NAME)
48#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
49 (((PTR)->LEN_NAME) = (VAL))
50
51/* PCI IOMMU mapping bypass support. */ 35/* PCI IOMMU mapping bypass support. */
52 36
53/* PCI 64-bit addressing works for all slots on all controller 37/* PCI 64-bit addressing works for all slots on all controller
diff --git a/arch/sparc/include/asm/perfctr.h b/arch/sparc/include/asm/perfctr.h
index 836873002b75..8d8720a8770d 100644
--- a/arch/sparc/include/asm/perfctr.h
+++ b/arch/sparc/include/asm/perfctr.h
@@ -10,8 +10,8 @@
10 * from enumeration below. The meaning of further arguments 10 * from enumeration below. The meaning of further arguments
11 * are determined by the operation code. 11 * are determined by the operation code.
12 * 12 *
13 * int sys_perfctr(int opcode, unsigned long arg0, 13 * NOTE: This system call is no longer provided, use the perf_events
14 * unsigned long arg1, unsigned long arg2) 14 * infrastructure.
15 * 15 *
16 * Pointers which are passed by the user are pointers to 64-bit 16 * Pointers which are passed by the user are pointers to 64-bit
17 * integers. 17 * integers.
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index e0cabe790ec1..77f906d8cc21 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -330,9 +330,9 @@ BTFIXUPDEF_CALL(void, mmu_info, struct seq_file *)
330#define FAULT_CODE_WRITE 0x2 330#define FAULT_CODE_WRITE 0x2
331#define FAULT_CODE_USER 0x4 331#define FAULT_CODE_USER 0x4
332 332
333BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t) 333BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t *)
334 334
335#define update_mmu_cache(vma,addr,pte) BTFIXUP_CALL(update_mmu_cache)(vma,addr,pte) 335#define update_mmu_cache(vma,addr,ptep) BTFIXUP_CALL(update_mmu_cache)(vma,addr,ptep)
336 336
337BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long, 337BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long,
338 unsigned long, unsigned int) 338 unsigned long, unsigned int)
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index f3cb790fa2ae..f5b5fa76c02d 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -706,7 +706,7 @@ extern unsigned long find_ecache_flush_span(unsigned long size);
706#define mmu_unlockarea(vaddr, len) do { } while(0) 706#define mmu_unlockarea(vaddr, len) do { } while(0)
707 707
708struct vm_area_struct; 708struct vm_area_struct;
709extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); 709extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
710 710
711/* Encode and de-code a swap entry */ 711/* Encode and de-code a swap entry */
712#define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL) 712#define __swp_type(entry) (((entry).val >> PAGE_SHIFT) & 0xffUL)
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 82a190d7efc1..f845828ca4c6 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -1,3 +1,4 @@
1#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
1#ifndef _SPARC_PROM_H 2#ifndef _SPARC_PROM_H
2#define _SPARC_PROM_H 3#define _SPARC_PROM_H
3#ifdef __KERNEL__ 4#ifdef __KERNEL__
@@ -28,50 +29,11 @@
28#define of_prop_cmp(s1, s2) strcasecmp((s1), (s2)) 29#define of_prop_cmp(s1, s2) strcasecmp((s1), (s2))
29#define of_node_cmp(s1, s2) strcmp((s1), (s2)) 30#define of_node_cmp(s1, s2) strcmp((s1), (s2))
30 31
31typedef u32 phandle;
32typedef u32 ihandle;
33
34struct property {
35 char *name;
36 int length;
37 void *value;
38 struct property *next;
39 unsigned long _flags;
40 unsigned int unique_id;
41};
42
43struct of_irq_controller;
44struct device_node {
45 const char *name;
46 const char *type;
47 phandle node;
48 char *path_component_name;
49 char *full_name;
50
51 struct property *properties;
52 struct property *deadprops; /* removed properties */
53 struct device_node *parent;
54 struct device_node *child;
55 struct device_node *sibling;
56 struct device_node *next; /* next device of same type */
57 struct device_node *allnext; /* next in list of all nodes */
58 struct proc_dir_entry *pde; /* this node's proc directory */
59 struct kref kref;
60 unsigned long _flags;
61 void *data;
62 unsigned int unique_id;
63
64 struct of_irq_controller *irq_trans;
65};
66
67struct of_irq_controller { 32struct of_irq_controller {
68 unsigned int (*irq_build)(struct device_node *, unsigned int, void *); 33 unsigned int (*irq_build)(struct device_node *, unsigned int, void *);
69 void *data; 34 void *data;
70}; 35};
71 36
72#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
73#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
74
75extern struct device_node *of_find_node_by_cpuid(int cpuid); 37extern struct device_node *of_find_node_by_cpuid(int cpuid);
76extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 38extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
77extern struct mutex of_set_property_mutex; 39extern struct mutex of_set_property_mutex;
@@ -89,15 +51,6 @@ extern void prom_build_devicetree(void);
89extern void of_populate_present_mask(void); 51extern void of_populate_present_mask(void);
90extern void of_fill_in_cpu_data(void); 52extern void of_fill_in_cpu_data(void);
91 53
92/* Dummy ref counting routines - to be implemented later */
93static inline struct device_node *of_node_get(struct device_node *node)
94{
95 return node;
96}
97static inline void of_node_put(struct device_node *node)
98{
99}
100
101/* These routines are here to provide compatibility with how powerpc 54/* These routines are here to provide compatibility with how powerpc
102 * handles IRQ mapping for OF device nodes. We precompute and permanently 55 * handles IRQ mapping for OF device nodes. We precompute and permanently
103 * register them in the of_device objects, whereas powerpc computes them 56 * register them in the of_device objects, whereas powerpc computes them
@@ -108,12 +61,6 @@ static inline void irq_dispose_mapping(unsigned int virq)
108{ 61{
109} 62}
110 63
111/*
112 * NB: This is here while we transition from using asm/prom.h
113 * to linux/of.h
114 */
115#include <linux/of.h>
116
117extern struct device_node *of_console_device; 64extern struct device_node *of_console_device;
118extern char *of_console_path; 65extern char *of_console_path;
119extern char *of_console_options; 66extern char *of_console_options;
diff --git a/arch/sparc/include/asm/rwsem.h b/arch/sparc/include/asm/rwsem.h
index 1dc129ac2feb..6e5621006f85 100644
--- a/arch/sparc/include/asm/rwsem.h
+++ b/arch/sparc/include/asm/rwsem.h
@@ -35,8 +35,8 @@ struct rw_semaphore {
35#endif 35#endif
36 36
37#define __RWSEM_INITIALIZER(name) \ 37#define __RWSEM_INITIALIZER(name) \
38{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \ 38{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
39 __RWSEM_DEP_MAP_INIT(name) } 39 LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
40 40
41#define DECLARE_RWSEM(name) \ 41#define DECLARE_RWSEM(name) \
42 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 42 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h
index e580f5581c88..d1120257b033 100644
--- a/arch/sparc/include/asm/scatterlist.h
+++ b/arch/sparc/include/asm/scatterlist.h
@@ -1,27 +1,8 @@
1#ifndef _SPARC_SCATTERLIST_H 1#ifndef _SPARC_SCATTERLIST_H
2#define _SPARC_SCATTERLIST_H 2#define _SPARC_SCATTERLIST_H
3 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) 4#define sg_dma_len(sg) ((sg)->dma_length)
22 5
23#define ISA_DMA_THRESHOLD (~0UL) 6#include <asm-generic/scatterlist.h>
24
25#define ARCH_HAS_SG_CHAIN
26 7
27#endif /* !(_SPARC_SCATTERLIST_H) */ 8#endif /* !(_SPARC_SCATTERLIST_H) */
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h
index 58101dc70493..841905c10215 100644
--- a/arch/sparc/include/asm/smp_32.h
+++ b/arch/sparc/include/asm/smp_32.h
@@ -106,6 +106,15 @@ static inline int hard_smp4d_processor_id(void)
106 return cpuid; 106 return cpuid;
107} 107}
108 108
109extern inline int hard_smpleon_processor_id(void)
110{
111 int cpuid;
112 __asm__ __volatile__("rd %%asr17,%0\n\t"
113 "srl %0,28,%0" :
114 "=&r" (cpuid) : );
115 return cpuid;
116}
117
109#ifndef MODULE 118#ifndef MODULE
110static inline int hard_smp_processor_id(void) 119static inline int hard_smp_processor_id(void)
111{ 120{
diff --git a/arch/sparc/include/asm/socket.h b/arch/sparc/include/asm/socket.h
index 3a5ae3d12088..9d3fefcff2f5 100644
--- a/arch/sparc/include/asm/socket.h
+++ b/arch/sparc/include/asm/socket.h
@@ -56,6 +56,8 @@
56#define SO_TIMESTAMPING 0x0023 56#define SO_TIMESTAMPING 0x0023
57#define SCM_TIMESTAMPING SO_TIMESTAMPING 57#define SCM_TIMESTAMPING SO_TIMESTAMPING
58 58
59#define SO_RXQ_OVFL 0x0024
60
59/* Security levels - as per NRL IPv6 - don't actually do anything */ 61/* Security levels - as per NRL IPv6 - don't actually do anything */
60#define SO_SECURITY_AUTHENTICATION 0x5001 62#define SO_SECURITY_AUTHENTICATION 0x5001
61#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 63#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
diff --git a/arch/sparc/include/asm/spinlock_32.h b/arch/sparc/include/asm/spinlock_32.h
index 857630cff636..7f9b9dba38a6 100644
--- a/arch/sparc/include/asm/spinlock_32.h
+++ b/arch/sparc/include/asm/spinlock_32.h
@@ -10,12 +10,12 @@
10 10
11#include <asm/psr.h> 11#include <asm/psr.h>
12 12
13#define __raw_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) 13#define arch_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0)
14 14
15#define __raw_spin_unlock_wait(lock) \ 15#define arch_spin_unlock_wait(lock) \
16 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 16 do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
17 17
18static inline void __raw_spin_lock(raw_spinlock_t *lock) 18static inline void arch_spin_lock(arch_spinlock_t *lock)
19{ 19{
20 __asm__ __volatile__( 20 __asm__ __volatile__(
21 "\n1:\n\t" 21 "\n1:\n\t"
@@ -35,7 +35,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
35 : "g2", "memory", "cc"); 35 : "g2", "memory", "cc");
36} 36}
37 37
38static inline int __raw_spin_trylock(raw_spinlock_t *lock) 38static inline int arch_spin_trylock(arch_spinlock_t *lock)
39{ 39{
40 unsigned int result; 40 unsigned int result;
41 __asm__ __volatile__("ldstub [%1], %0" 41 __asm__ __volatile__("ldstub [%1], %0"
@@ -45,7 +45,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
45 return (result == 0); 45 return (result == 0);
46} 46}
47 47
48static inline void __raw_spin_unlock(raw_spinlock_t *lock) 48static inline void arch_spin_unlock(arch_spinlock_t *lock)
49{ 49{
50 __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); 50 __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory");
51} 51}
@@ -65,7 +65,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
65 * Sort of like atomic_t's on Sparc, but even more clever. 65 * Sort of like atomic_t's on Sparc, but even more clever.
66 * 66 *
67 * ------------------------------------ 67 * ------------------------------------
68 * | 24-bit counter | wlock | raw_rwlock_t 68 * | 24-bit counter | wlock | arch_rwlock_t
69 * ------------------------------------ 69 * ------------------------------------
70 * 31 8 7 0 70 * 31 8 7 0
71 * 71 *
@@ -76,9 +76,9 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
76 * 76 *
77 * Unfortunately this scheme limits us to ~16,000,000 cpus. 77 * Unfortunately this scheme limits us to ~16,000,000 cpus.
78 */ 78 */
79static inline void arch_read_lock(raw_rwlock_t *rw) 79static inline void __arch_read_lock(arch_rwlock_t *rw)
80{ 80{
81 register raw_rwlock_t *lp asm("g1"); 81 register arch_rwlock_t *lp asm("g1");
82 lp = rw; 82 lp = rw;
83 __asm__ __volatile__( 83 __asm__ __volatile__(
84 "mov %%o7, %%g4\n\t" 84 "mov %%o7, %%g4\n\t"
@@ -89,16 +89,16 @@ static inline void arch_read_lock(raw_rwlock_t *rw)
89 : "g2", "g4", "memory", "cc"); 89 : "g2", "g4", "memory", "cc");
90} 90}
91 91
92#define __raw_read_lock(lock) \ 92#define arch_read_lock(lock) \
93do { unsigned long flags; \ 93do { unsigned long flags; \
94 local_irq_save(flags); \ 94 local_irq_save(flags); \
95 arch_read_lock(lock); \ 95 __arch_read_lock(lock); \
96 local_irq_restore(flags); \ 96 local_irq_restore(flags); \
97} while(0) 97} while(0)
98 98
99static inline void arch_read_unlock(raw_rwlock_t *rw) 99static inline void __arch_read_unlock(arch_rwlock_t *rw)
100{ 100{
101 register raw_rwlock_t *lp asm("g1"); 101 register arch_rwlock_t *lp asm("g1");
102 lp = rw; 102 lp = rw;
103 __asm__ __volatile__( 103 __asm__ __volatile__(
104 "mov %%o7, %%g4\n\t" 104 "mov %%o7, %%g4\n\t"
@@ -109,16 +109,16 @@ static inline void arch_read_unlock(raw_rwlock_t *rw)
109 : "g2", "g4", "memory", "cc"); 109 : "g2", "g4", "memory", "cc");
110} 110}
111 111
112#define __raw_read_unlock(lock) \ 112#define arch_read_unlock(lock) \
113do { unsigned long flags; \ 113do { unsigned long flags; \
114 local_irq_save(flags); \ 114 local_irq_save(flags); \
115 arch_read_unlock(lock); \ 115 __arch_read_unlock(lock); \
116 local_irq_restore(flags); \ 116 local_irq_restore(flags); \
117} while(0) 117} while(0)
118 118
119static inline void __raw_write_lock(raw_rwlock_t *rw) 119static inline void arch_write_lock(arch_rwlock_t *rw)
120{ 120{
121 register raw_rwlock_t *lp asm("g1"); 121 register arch_rwlock_t *lp asm("g1");
122 lp = rw; 122 lp = rw;
123 __asm__ __volatile__( 123 __asm__ __volatile__(
124 "mov %%o7, %%g4\n\t" 124 "mov %%o7, %%g4\n\t"
@@ -130,7 +130,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
130 *(volatile __u32 *)&lp->lock = ~0U; 130 *(volatile __u32 *)&lp->lock = ~0U;
131} 131}
132 132
133static inline int __raw_write_trylock(raw_rwlock_t *rw) 133static inline int arch_write_trylock(arch_rwlock_t *rw)
134{ 134{
135 unsigned int val; 135 unsigned int val;
136 136
@@ -150,9 +150,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
150 return (val == 0); 150 return (val == 0);
151} 151}
152 152
153static inline int arch_read_trylock(raw_rwlock_t *rw) 153static inline int __arch_read_trylock(arch_rwlock_t *rw)
154{ 154{
155 register raw_rwlock_t *lp asm("g1"); 155 register arch_rwlock_t *lp asm("g1");
156 register int res asm("o0"); 156 register int res asm("o0");
157 lp = rw; 157 lp = rw;
158 __asm__ __volatile__( 158 __asm__ __volatile__(
@@ -165,27 +165,27 @@ static inline int arch_read_trylock(raw_rwlock_t *rw)
165 return res; 165 return res;
166} 166}
167 167
168#define __raw_read_trylock(lock) \ 168#define arch_read_trylock(lock) \
169({ unsigned long flags; \ 169({ unsigned long flags; \
170 int res; \ 170 int res; \
171 local_irq_save(flags); \ 171 local_irq_save(flags); \
172 res = arch_read_trylock(lock); \ 172 res = __arch_read_trylock(lock); \
173 local_irq_restore(flags); \ 173 local_irq_restore(flags); \
174 res; \ 174 res; \
175}) 175})
176 176
177#define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) 177#define arch_write_unlock(rw) do { (rw)->lock = 0; } while(0)
178 178
179#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 179#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
180#define __raw_read_lock_flags(rw, flags) __raw_read_lock(rw) 180#define arch_read_lock_flags(rw, flags) arch_read_lock(rw)
181#define __raw_write_lock_flags(rw, flags) __raw_write_lock(rw) 181#define arch_write_lock_flags(rw, flags) arch_write_lock(rw)
182 182
183#define _raw_spin_relax(lock) cpu_relax() 183#define arch_spin_relax(lock) cpu_relax()
184#define _raw_read_relax(lock) cpu_relax() 184#define arch_read_relax(lock) cpu_relax()
185#define _raw_write_relax(lock) cpu_relax() 185#define arch_write_relax(lock) cpu_relax()
186 186
187#define __raw_read_can_lock(rw) (!((rw)->lock & 0xff)) 187#define arch_read_can_lock(rw) (!((rw)->lock & 0xff))
188#define __raw_write_can_lock(rw) (!(rw)->lock) 188#define arch_write_can_lock(rw) (!(rw)->lock)
189 189
190#endif /* !(__ASSEMBLY__) */ 190#endif /* !(__ASSEMBLY__) */
191 191
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h
index 43e514783582..073936a8b275 100644
--- a/arch/sparc/include/asm/spinlock_64.h
+++ b/arch/sparc/include/asm/spinlock_64.h
@@ -21,13 +21,13 @@
21 * the spinner sections must be pre-V9 branches. 21 * the spinner sections must be pre-V9 branches.
22 */ 22 */
23 23
24#define __raw_spin_is_locked(lp) ((lp)->lock != 0) 24#define arch_spin_is_locked(lp) ((lp)->lock != 0)
25 25
26#define __raw_spin_unlock_wait(lp) \ 26#define arch_spin_unlock_wait(lp) \
27 do { rmb(); \ 27 do { rmb(); \
28 } while((lp)->lock) 28 } while((lp)->lock)
29 29
30static inline void __raw_spin_lock(raw_spinlock_t *lock) 30static inline void arch_spin_lock(arch_spinlock_t *lock)
31{ 31{
32 unsigned long tmp; 32 unsigned long tmp;
33 33
@@ -46,7 +46,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
46 : "memory"); 46 : "memory");
47} 47}
48 48
49static inline int __raw_spin_trylock(raw_spinlock_t *lock) 49static inline int arch_spin_trylock(arch_spinlock_t *lock)
50{ 50{
51 unsigned long result; 51 unsigned long result;
52 52
@@ -59,7 +59,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
59 return (result == 0UL); 59 return (result == 0UL);
60} 60}
61 61
62static inline void __raw_spin_unlock(raw_spinlock_t *lock) 62static inline void arch_spin_unlock(arch_spinlock_t *lock)
63{ 63{
64 __asm__ __volatile__( 64 __asm__ __volatile__(
65" stb %%g0, [%0]" 65" stb %%g0, [%0]"
@@ -68,7 +68,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
68 : "memory"); 68 : "memory");
69} 69}
70 70
71static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) 71static inline void arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags)
72{ 72{
73 unsigned long tmp1, tmp2; 73 unsigned long tmp1, tmp2;
74 74
@@ -92,7 +92,7 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long fla
92 92
93/* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ 93/* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */
94 94
95static void inline arch_read_lock(raw_rwlock_t *lock) 95static void inline arch_read_lock(arch_rwlock_t *lock)
96{ 96{
97 unsigned long tmp1, tmp2; 97 unsigned long tmp1, tmp2;
98 98
@@ -115,7 +115,7 @@ static void inline arch_read_lock(raw_rwlock_t *lock)
115 : "memory"); 115 : "memory");
116} 116}
117 117
118static int inline arch_read_trylock(raw_rwlock_t *lock) 118static int inline arch_read_trylock(arch_rwlock_t *lock)
119{ 119{
120 int tmp1, tmp2; 120 int tmp1, tmp2;
121 121
@@ -136,7 +136,7 @@ static int inline arch_read_trylock(raw_rwlock_t *lock)
136 return tmp1; 136 return tmp1;
137} 137}
138 138
139static void inline arch_read_unlock(raw_rwlock_t *lock) 139static void inline arch_read_unlock(arch_rwlock_t *lock)
140{ 140{
141 unsigned long tmp1, tmp2; 141 unsigned long tmp1, tmp2;
142 142
@@ -152,7 +152,7 @@ static void inline arch_read_unlock(raw_rwlock_t *lock)
152 : "memory"); 152 : "memory");
153} 153}
154 154
155static void inline arch_write_lock(raw_rwlock_t *lock) 155static void inline arch_write_lock(arch_rwlock_t *lock)
156{ 156{
157 unsigned long mask, tmp1, tmp2; 157 unsigned long mask, tmp1, tmp2;
158 158
@@ -177,7 +177,7 @@ static void inline arch_write_lock(raw_rwlock_t *lock)
177 : "memory"); 177 : "memory");
178} 178}
179 179
180static void inline arch_write_unlock(raw_rwlock_t *lock) 180static void inline arch_write_unlock(arch_rwlock_t *lock)
181{ 181{
182 __asm__ __volatile__( 182 __asm__ __volatile__(
183" stw %%g0, [%0]" 183" stw %%g0, [%0]"
@@ -186,7 +186,7 @@ static void inline arch_write_unlock(raw_rwlock_t *lock)
186 : "memory"); 186 : "memory");
187} 187}
188 188
189static int inline arch_write_trylock(raw_rwlock_t *lock) 189static int inline arch_write_trylock(arch_rwlock_t *lock)
190{ 190{
191 unsigned long mask, tmp1, tmp2, result; 191 unsigned long mask, tmp1, tmp2, result;
192 192
@@ -210,21 +210,21 @@ static int inline arch_write_trylock(raw_rwlock_t *lock)
210 return result; 210 return result;
211} 211}
212 212
213#define __raw_read_lock(p) arch_read_lock(p) 213#define arch_read_lock(p) arch_read_lock(p)
214#define __raw_read_lock_flags(p, f) arch_read_lock(p) 214#define arch_read_lock_flags(p, f) arch_read_lock(p)
215#define __raw_read_trylock(p) arch_read_trylock(p) 215#define arch_read_trylock(p) arch_read_trylock(p)
216#define __raw_read_unlock(p) arch_read_unlock(p) 216#define arch_read_unlock(p) arch_read_unlock(p)
217#define __raw_write_lock(p) arch_write_lock(p) 217#define arch_write_lock(p) arch_write_lock(p)
218#define __raw_write_lock_flags(p, f) arch_write_lock(p) 218#define arch_write_lock_flags(p, f) arch_write_lock(p)
219#define __raw_write_unlock(p) arch_write_unlock(p) 219#define arch_write_unlock(p) arch_write_unlock(p)
220#define __raw_write_trylock(p) arch_write_trylock(p) 220#define arch_write_trylock(p) arch_write_trylock(p)
221 221
222#define __raw_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) 222#define arch_read_can_lock(rw) (!((rw)->lock & 0x80000000UL))
223#define __raw_write_can_lock(rw) (!(rw)->lock) 223#define arch_write_can_lock(rw) (!(rw)->lock)
224 224
225#define _raw_spin_relax(lock) cpu_relax() 225#define arch_spin_relax(lock) cpu_relax()
226#define _raw_read_relax(lock) cpu_relax() 226#define arch_read_relax(lock) cpu_relax()
227#define _raw_write_relax(lock) cpu_relax() 227#define arch_write_relax(lock) cpu_relax()
228 228
229#endif /* !(__ASSEMBLY__) */ 229#endif /* !(__ASSEMBLY__) */
230 230
diff --git a/arch/sparc/include/asm/spinlock_types.h b/arch/sparc/include/asm/spinlock_types.h
index 37cbe01c585b..9c454fdeaad8 100644
--- a/arch/sparc/include/asm/spinlock_types.h
+++ b/arch/sparc/include/asm/spinlock_types.h
@@ -7,14 +7,14 @@
7 7
8typedef struct { 8typedef struct {
9 volatile unsigned char lock; 9 volatile unsigned char lock;
10} raw_spinlock_t; 10} arch_spinlock_t;
11 11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 } 12#define __ARCH_SPIN_LOCK_UNLOCKED { 0 }
13 13
14typedef struct { 14typedef struct {
15 volatile unsigned int lock; 15 volatile unsigned int lock;
16} raw_rwlock_t; 16} arch_rwlock_t;
17 17
18#define __RAW_RW_LOCK_UNLOCKED { 0 } 18#define __ARCH_RW_LOCK_UNLOCKED { 0 }
19 19
20#endif 20#endif
diff --git a/arch/sparc/include/asm/stat.h b/arch/sparc/include/asm/stat.h
index 55db5eca08e2..a232e9e1f4e5 100644
--- a/arch/sparc/include/asm/stat.h
+++ b/arch/sparc/include/asm/stat.h
@@ -53,8 +53,8 @@ struct stat {
53 ino_t st_ino; 53 ino_t st_ino;
54 mode_t st_mode; 54 mode_t st_mode;
55 short st_nlink; 55 short st_nlink;
56 uid_t st_uid; 56 unsigned short st_uid;
57 gid_t st_gid; 57 unsigned short st_gid;
58 unsigned short st_rdev; 58 unsigned short st_rdev;
59 off_t st_size; 59 off_t st_size;
60 time_t st_atime; 60 time_t st_atime;
diff --git a/arch/sparc/include/asm/string_32.h b/arch/sparc/include/asm/string_32.h
index 6c5fddb7e6b5..edf196ee4ef8 100644
--- a/arch/sparc/include/asm/string_32.h
+++ b/arch/sparc/include/asm/string_32.h
@@ -16,8 +16,6 @@
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18extern void __memmove(void *,const void *,__kernel_size_t); 18extern void __memmove(void *,const void *,__kernel_size_t);
19extern __kernel_size_t __memcpy(void *,const void *,__kernel_size_t);
20extern __kernel_size_t __memset(void *,int,__kernel_size_t);
21 19
22#ifndef EXPORT_SYMTAB_STROPS 20#ifndef EXPORT_SYMTAB_STROPS
23 21
@@ -32,82 +30,10 @@ extern __kernel_size_t __memset(void *,int,__kernel_size_t);
32}) 30})
33 31
34#define __HAVE_ARCH_MEMCPY 32#define __HAVE_ARCH_MEMCPY
35 33#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
36static inline void *__constant_memcpy(void *to, const void *from, __kernel_size_t n)
37{
38 extern void __copy_1page(void *, const void *);
39
40 if(n <= 32) {
41 __builtin_memcpy(to, from, n);
42 } else if (((unsigned int) to & 7) != 0) {
43 /* Destination is not aligned on the double-word boundary */
44 __memcpy(to, from, n);
45 } else {
46 switch(n) {
47 case PAGE_SIZE:
48 __copy_1page(to, from);
49 break;
50 default:
51 __memcpy(to, from, n);
52 break;
53 }
54 }
55 return to;
56}
57
58static inline void *__nonconstant_memcpy(void *to, const void *from, __kernel_size_t n)
59{
60 __memcpy(to, from, n);
61 return to;
62}
63
64#undef memcpy
65#define memcpy(t, f, n) \
66(__builtin_constant_p(n) ? \
67 __constant_memcpy((t),(f),(n)) : \
68 __nonconstant_memcpy((t),(f),(n)))
69 34
70#define __HAVE_ARCH_MEMSET 35#define __HAVE_ARCH_MEMSET
71 36#define memset(s, c, count) __builtin_memset(s, c, count)
72static inline void *__constant_c_and_count_memset(void *s, char c, __kernel_size_t count)
73{
74 extern void bzero_1page(void *);
75 extern __kernel_size_t __bzero(void *, __kernel_size_t);
76
77 if(!c) {
78 if(count == PAGE_SIZE)
79 bzero_1page(s);
80 else
81 __bzero(s, count);
82 } else {
83 __memset(s, c, count);
84 }
85 return s;
86}
87
88static inline void *__constant_c_memset(void *s, char c, __kernel_size_t count)
89{
90 extern __kernel_size_t __bzero(void *, __kernel_size_t);
91
92 if(!c)
93 __bzero(s, count);
94 else
95 __memset(s, c, count);
96 return s;
97}
98
99static inline void *__nonconstant_memset(void *s, char c, __kernel_size_t count)
100{
101 __memset(s, c, count);
102 return s;
103}
104
105#undef memset
106#define memset(s, c, count) \
107(__builtin_constant_p(c) ? (__builtin_constant_p(count) ? \
108 __constant_c_and_count_memset((s), (c), (count)) : \
109 __constant_c_memset((s), (c), (count))) \
110 : __nonconstant_memset((s), (c), (count)))
111 37
112#define __HAVE_ARCH_MEMSCAN 38#define __HAVE_ARCH_MEMSCAN
113 39
diff --git a/arch/sparc/include/asm/string_64.h b/arch/sparc/include/asm/string_64.h
index 43161f2d17eb..9623bc213158 100644
--- a/arch/sparc/include/asm/string_64.h
+++ b/arch/sparc/include/asm/string_64.h
@@ -15,8 +15,6 @@
15 15
16#include <asm/asi.h> 16#include <asm/asi.h>
17 17
18extern void *__memset(void *,int,__kernel_size_t);
19
20#ifndef EXPORT_SYMTAB_STROPS 18#ifndef EXPORT_SYMTAB_STROPS
21 19
22/* First the mem*() things. */ 20/* First the mem*() things. */
@@ -24,29 +22,10 @@ extern void *__memset(void *,int,__kernel_size_t);
24extern void *memmove(void *, const void *, __kernel_size_t); 22extern void *memmove(void *, const void *, __kernel_size_t);
25 23
26#define __HAVE_ARCH_MEMCPY 24#define __HAVE_ARCH_MEMCPY
27extern void *memcpy(void *, const void *, __kernel_size_t); 25#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
28 26
29#define __HAVE_ARCH_MEMSET 27#define __HAVE_ARCH_MEMSET
30extern void *__builtin_memset(void *,int,__kernel_size_t); 28#define memset(s, c, count) __builtin_memset(s, c, count)
31
32static inline void *__constant_memset(void *s, int c, __kernel_size_t count)
33{
34 extern __kernel_size_t __bzero(void *, __kernel_size_t);
35
36 if (!c) {
37 __bzero(s, count);
38 return s;
39 } else
40 return __memset(s, c, count);
41}
42
43#undef memset
44#define memset(s, c, count) \
45((__builtin_constant_p(count) && (count) <= 32) ? \
46 __builtin_memset((s), (c), (count)) : \
47 (__builtin_constant_p(c) ? \
48 __constant_memset((s), (c), (count)) : \
49 __memset((s), (c), (count))))
50 29
51#define __HAVE_ARCH_MEMSCAN 30#define __HAVE_ARCH_MEMSCAN
52 31
diff --git a/arch/sparc/include/asm/syscall.h b/arch/sparc/include/asm/syscall.h
index 7486c605e23c..025a02ad2e31 100644
--- a/arch/sparc/include/asm/syscall.h
+++ b/arch/sparc/include/asm/syscall.h
@@ -5,6 +5,13 @@
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <asm/ptrace.h> 6#include <asm/ptrace.h>
7 7
8/*
9 * The syscall table always contains 32 bit pointers since we know that the
10 * address of the function to be called is (way) below 4GB. So the "int"
11 * type here is what we want [need] for both 32 bit and 64 bit systems.
12 */
13extern const unsigned int sys_call_table[];
14
8/* The system call number is given by the user in %g1 */ 15/* The system call number is given by the user in %g1 */
9static inline long syscall_get_nr(struct task_struct *task, 16static inline long syscall_get_nr(struct task_struct *task,
10 struct pt_regs *regs) 17 struct pt_regs *regs)
diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h
index d47a98e66972..d24cfe16afc1 100644
--- a/arch/sparc/include/asm/system_64.h
+++ b/arch/sparc/include/asm/system_64.h
@@ -143,15 +143,7 @@ do { \
143 * and 2 stores in this critical code path. -DaveM 143 * and 2 stores in this critical code path. -DaveM
144 */ 144 */
145#define switch_to(prev, next, last) \ 145#define switch_to(prev, next, last) \
146do { if (test_thread_flag(TIF_PERFCTR)) { \ 146do { flush_tlb_pending(); \
147 unsigned long __tmp; \
148 read_pcr(__tmp); \
149 current_thread_info()->pcr_reg = __tmp; \
150 read_pic(__tmp); \
151 current_thread_info()->kernel_cntd0 += (unsigned int)(__tmp);\
152 current_thread_info()->kernel_cntd1 += ((__tmp) >> 32); \
153 } \
154 flush_tlb_pending(); \
155 save_and_clear_fpu(); \ 147 save_and_clear_fpu(); \
156 /* If you are tempted to conditionalize the following */ \ 148 /* If you are tempted to conditionalize the following */ \
157 /* so that ASI is only written if it changes, think again. */ \ 149 /* so that ASI is only written if it changes, think again. */ \
@@ -197,11 +189,6 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
197 "l1", "l2", "l3", "l4", "l5", "l6", "l7", \ 189 "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
198 "i0", "i1", "i2", "i3", "i4", "i5", \ 190 "i0", "i1", "i2", "i3", "i4", "i5", \
199 "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \ 191 "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \
200 /* If you fuck with this, update ret_from_syscall code too. */ \
201 if (test_thread_flag(TIF_PERFCTR)) { \
202 write_pcr(current_thread_info()->pcr_reg); \
203 reset_pic(); \
204 } \
205} while(0) 192} while(0)
206 193
207static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) 194static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val)
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index 1b45a7bbe407..4827a3aeac7f 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -58,11 +58,6 @@ struct thread_info {
58 unsigned long gsr[7]; 58 unsigned long gsr[7];
59 unsigned long xfsr[7]; 59 unsigned long xfsr[7];
60 60
61 __u64 __user *user_cntd0;
62 __u64 __user *user_cntd1;
63 __u64 kernel_cntd0, kernel_cntd1;
64 __u64 pcr_reg;
65
66 struct restart_block restart_block; 61 struct restart_block restart_block;
67 62
68 struct pt_regs *kern_una_regs; 63 struct pt_regs *kern_una_regs;
@@ -96,15 +91,10 @@ struct thread_info {
96#define TI_RWIN_SPTRS 0x000003c8 91#define TI_RWIN_SPTRS 0x000003c8
97#define TI_GSR 0x00000400 92#define TI_GSR 0x00000400
98#define TI_XFSR 0x00000438 93#define TI_XFSR 0x00000438
99#define TI_USER_CNTD0 0x00000470 94#define TI_RESTART_BLOCK 0x00000470
100#define TI_USER_CNTD1 0x00000478 95#define TI_KUNA_REGS 0x000004a0
101#define TI_KERN_CNTD0 0x00000480 96#define TI_KUNA_INSN 0x000004a8
102#define TI_KERN_CNTD1 0x00000488 97#define TI_FPREGS 0x000004c0
103#define TI_PCR 0x00000490
104#define TI_RESTART_BLOCK 0x00000498
105#define TI_KUNA_REGS 0x000004c8
106#define TI_KUNA_INSN 0x000004d0
107#define TI_FPREGS 0x00000500
108 98
109/* We embed this in the uppermost byte of thread_info->flags */ 99/* We embed this in the uppermost byte of thread_info->flags */
110#define FAULT_CODE_WRITE 0x01 /* Write access, implies D-TLB */ 100#define FAULT_CODE_WRITE 0x01 /* Write access, implies D-TLB */
@@ -121,7 +111,7 @@ struct thread_info {
121#define THREAD_SHIFT PAGE_SHIFT 111#define THREAD_SHIFT PAGE_SHIFT
122#endif /* PAGE_SHIFT == 13 */ 112#endif /* PAGE_SHIFT == 13 */
123 113
124#define PREEMPT_ACTIVE 0x4000000 114#define PREEMPT_ACTIVE 0x10000000
125 115
126/* 116/*
127 * macros/functions for gaining access to the thread information structure 117 * macros/functions for gaining access to the thread information structure
@@ -199,7 +189,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
199 * 189 *
200 * On trap return we need to test several values: 190 * On trap return we need to test several values:
201 * 191 *
202 * user: need_resched, notify_resume, sigpending, wsaved, perfctr 192 * user: need_resched, notify_resume, sigpending, wsaved
203 * kernel: fpdepth 193 * kernel: fpdepth
204 * 194 *
205 * So to check for work in the kernel case we simply load the fpdepth 195 * So to check for work in the kernel case we simply load the fpdepth
@@ -220,19 +210,19 @@ register struct thread_info *current_thread_info_reg asm("g6");
220#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ 210#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
221#define TIF_SIGPENDING 2 /* signal pending */ 211#define TIF_SIGPENDING 2 /* signal pending */
222#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 212#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
223#define TIF_PERFCTR 4 /* performance counters active */ 213/* flag bit 4 is available */
224#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */ 214#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */
225/* flag bit 6 is available */ 215/* flag bit 6 is available */
226#define TIF_32BIT 7 /* 32-bit binary */ 216#define TIF_32BIT 7 /* 32-bit binary */
227/* flag bit 8 is available */ 217/* flag bit 8 is available */
228#define TIF_SECCOMP 9 /* secure computing */ 218#define TIF_SECCOMP 9 /* secure computing */
229#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */ 219#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */
230/* flag bit 11 is available */ 220#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
231/* NOTE: Thread flags >= 12 should be ones we have no interest 221/* NOTE: Thread flags >= 12 should be ones we have no interest
232 * in using in assembly, else we can't use the mask as 222 * in using in assembly, else we can't use the mask as
233 * an immediate value in instructions such as andcc. 223 * an immediate value in instructions such as andcc.
234 */ 224 */
235#define TIF_ABI_PENDING 12 225/* flag bit 12 is available */
236#define TIF_MEMDIE 13 226#define TIF_MEMDIE 13
237#define TIF_POLLING_NRFLAG 14 227#define TIF_POLLING_NRFLAG 14
238#define TIF_FREEZE 15 /* is freezing for suspend */ 228#define TIF_FREEZE 15 /* is freezing for suspend */
@@ -241,18 +231,17 @@ register struct thread_info *current_thread_info_reg asm("g6");
241#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 231#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
242#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 232#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
243#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 233#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
244#define _TIF_PERFCTR (1<<TIF_PERFCTR)
245#define _TIF_UNALIGNED (1<<TIF_UNALIGNED) 234#define _TIF_UNALIGNED (1<<TIF_UNALIGNED)
246#define _TIF_32BIT (1<<TIF_32BIT) 235#define _TIF_32BIT (1<<TIF_32BIT)
247#define _TIF_SECCOMP (1<<TIF_SECCOMP) 236#define _TIF_SECCOMP (1<<TIF_SECCOMP)
248#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 237#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
249#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 238#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
250#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 239#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
251#define _TIF_FREEZE (1<<TIF_FREEZE) 240#define _TIF_FREEZE (1<<TIF_FREEZE)
252 241
253#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \ 242#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
254 _TIF_DO_NOTIFY_RESUME_MASK | \ 243 _TIF_DO_NOTIFY_RESUME_MASK | \
255 _TIF_NEED_RESCHED | _TIF_PERFCTR) 244 _TIF_NEED_RESCHED)
256#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING) 245#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING)
257 246
258/* 247/*
diff --git a/arch/sparc/include/asm/timex_32.h b/arch/sparc/include/asm/timex_32.h
index b6ccdb0d6f7d..a254750e4c03 100644
--- a/arch/sparc/include/asm/timex_32.h
+++ b/arch/sparc/include/asm/timex_32.h
@@ -12,4 +12,5 @@
12typedef unsigned long cycles_t; 12typedef unsigned long cycles_t;
13#define get_cycles() (0) 13#define get_cycles() (0)
14 14
15extern u32 (*do_arch_gettimeoffset)(void);
15#endif 16#endif
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index 600a79035fa1..1c79f32734a0 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -12,7 +12,9 @@ static inline int cpu_to_node(int cpu)
12 12
13#define parent_node(node) (node) 13#define parent_node(node) (node)
14 14
15#define cpumask_of_node(node) (&numa_cpumask_lookup_table[node]) 15#define cpumask_of_node(node) ((node) == -1 ? \
16 cpu_all_mask : \
17 &numa_cpumask_lookup_table[node])
16 18
17struct pci_bus; 19struct pci_bus;
18#ifdef CONFIG_PCI 20#ifdef CONFIG_PCI
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h
index 8303ac481034..25f1d10155e8 100644
--- a/arch/sparc/include/asm/uaccess_32.h
+++ b/arch/sparc/include/asm/uaccess_32.h
@@ -260,8 +260,23 @@ static inline unsigned long __copy_to_user(void __user *to, const void *from, un
260 return __copy_user(to, (__force void __user *) from, n); 260 return __copy_user(to, (__force void __user *) from, n);
261} 261}
262 262
263extern void copy_from_user_overflow(void)
264#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
265 __compiletime_error("copy_from_user() buffer size is not provably correct")
266#else
267 __compiletime_warning("copy_from_user() buffer size is not provably correct")
268#endif
269;
270
263static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) 271static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
264{ 272{
273 int sz = __compiletime_object_size(to);
274
275 if (unlikely(sz != -1 && sz < n)) {
276 copy_from_user_overflow();
277 return n;
278 }
279
265 if (n && __access_ok((unsigned long) from, n)) 280 if (n && __access_ok((unsigned long) from, n))
266 return __copy_user((__force void __user *) to, from, n); 281 return __copy_user((__force void __user *) to, from, n);
267 else 282 else
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index 9ea271e19c70..2406788bfe5f 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -6,6 +6,7 @@
6 */ 6 */
7 7
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9#include <linux/errno.h>
9#include <linux/compiler.h> 10#include <linux/compiler.h>
10#include <linux/string.h> 11#include <linux/string.h>
11#include <linux/thread_info.h> 12#include <linux/thread_info.h>
@@ -204,6 +205,14 @@ __asm__ __volatile__( \
204 205
205extern int __get_user_bad(void); 206extern int __get_user_bad(void);
206 207
208extern void copy_from_user_overflow(void)
209#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
210 __compiletime_error("copy_from_user() buffer size is not provably correct")
211#else
212 __compiletime_warning("copy_from_user() buffer size is not provably correct")
213#endif
214;
215
207extern unsigned long __must_check ___copy_from_user(void *to, 216extern unsigned long __must_check ___copy_from_user(void *to,
208 const void __user *from, 217 const void __user *from,
209 unsigned long size); 218 unsigned long size);
@@ -212,10 +221,16 @@ extern unsigned long copy_from_user_fixup(void *to, const void __user *from,
212static inline unsigned long __must_check 221static inline unsigned long __must_check
213copy_from_user(void *to, const void __user *from, unsigned long size) 222copy_from_user(void *to, const void __user *from, unsigned long size)
214{ 223{
215 unsigned long ret = ___copy_from_user(to, from, size); 224 int sz = __compiletime_object_size(to);
216 225 unsigned long ret = size;
217 if (unlikely(ret)) 226
218 ret = copy_from_user_fixup(to, from, size); 227 if (likely(sz == -1 || sz >= size)) {
228 ret = ___copy_from_user(to, from, size);
229 if (unlikely(ret))
230 ret = copy_from_user_fixup(to, from, size);
231 } else {
232 copy_from_user_overflow();
233 }
219 return ret; 234 return ret;
220} 235}
221#define __copy_from_user copy_from_user 236#define __copy_from_user copy_from_user
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 42f2316c3eaa..d0b3b01ac9d4 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -396,8 +396,9 @@
396#define __NR_pwritev 325 396#define __NR_pwritev 325
397#define __NR_rt_tgsigqueueinfo 326 397#define __NR_rt_tgsigqueueinfo 326
398#define __NR_perf_event_open 327 398#define __NR_perf_event_open 327
399#define __NR_recvmmsg 328
399 400
400#define NR_SYSCALLS 328 401#define NR_syscalls 329
401 402
402#ifdef __32bit_syscall_numbers__ 403#ifdef __32bit_syscall_numbers__
403/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, 404/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
@@ -431,7 +432,9 @@
431#define __ARCH_WANT_SYS_SIGPENDING 432#define __ARCH_WANT_SYS_SIGPENDING
432#define __ARCH_WANT_SYS_SIGPROCMASK 433#define __ARCH_WANT_SYS_SIGPROCMASK
433#define __ARCH_WANT_SYS_RT_SIGSUSPEND 434#define __ARCH_WANT_SYS_RT_SIGSUSPEND
434#ifndef __32bit_syscall_numbers__ 435#ifdef __32bit_syscall_numbers__
436#define __ARCH_WANT_SYS_IPC
437#else
435#define __ARCH_WANT_COMPAT_SYS_TIME 438#define __ARCH_WANT_COMPAT_SYS_TIME
436#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 439#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
437#endif 440#endif
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 5b47fab9966e..0c2dc1f24a9a 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -13,6 +13,14 @@ extra-y += init_task.o
13CPPFLAGS_vmlinux.lds := -Usparc -m$(BITS) 13CPPFLAGS_vmlinux.lds := -Usparc -m$(BITS)
14extra-y += vmlinux.lds 14extra-y += vmlinux.lds
15 15
16ifdef CONFIG_FUNCTION_TRACER
17# Do not profile debug and lowlevel utilities
18CFLAGS_REMOVE_ftrace.o := -pg
19CFLAGS_REMOVE_time_$(BITS).o := -pg
20CFLAGS_REMOVE_perf_event.o := -pg
21CFLAGS_REMOVE_pcr.o := -pg
22endif
23
16obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o 24obj-$(CONFIG_SPARC32) += entry.o wof.o wuf.o
17obj-$(CONFIG_SPARC32) += etrap_32.o 25obj-$(CONFIG_SPARC32) += etrap_32.o
18obj-$(CONFIG_SPARC32) += rtrap_32.o 26obj-$(CONFIG_SPARC32) += rtrap_32.o
@@ -72,7 +80,7 @@ obj-y += dma.o
72obj-$(CONFIG_SPARC32_PCI) += pcic.o 80obj-$(CONFIG_SPARC32_PCI) += pcic.o
73 81
74obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o 82obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o
75obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o 83obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o leon_smp.o
76obj-$(CONFIG_SPARC64_SMP) += hvtramp.o 84obj-$(CONFIG_SPARC64_SMP) += hvtramp.o
77 85
78obj-y += auxio_$(BITS).o 86obj-y += auxio_$(BITS).o
@@ -85,8 +93,9 @@ obj-$(CONFIG_KGDB) += kgdb_$(BITS).o
85 93
86 94
87obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 95obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
88CFLAGS_REMOVE_ftrace.o := -pg 96obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
89 97
98obj-$(CONFIG_EARLYFB) += btext.o
90obj-$(CONFIG_STACKTRACE) += stacktrace.o 99obj-$(CONFIG_STACKTRACE) += stacktrace.o
91# sparc64 PCI 100# sparc64 PCI
92obj-$(CONFIG_SPARC64_PCI) += pci.o pci_common.o psycho_common.o 101obj-$(CONFIG_SPARC64_PCI) += pci.o pci_common.o psycho_common.o
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index 9c115823c4b5..71ec90b9e316 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -10,7 +10,6 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/miscdevice.h> 12#include <linux/miscdevice.h>
13#include <linux/smp_lock.h>
14#include <linux/pm.h> 13#include <linux/pm.h>
15#include <linux/of.h> 14#include <linux/of.h>
16#include <linux/of_device.h> 15#include <linux/of_device.h>
@@ -76,7 +75,6 @@ static inline void apc_free(struct of_device *op)
76 75
77static int apc_open(struct inode *inode, struct file *f) 76static int apc_open(struct inode *inode, struct file *f)
78{ 77{
79 cycle_kernel_lock();
80 return 0; 78 return 0;
81} 79}
82 80
@@ -87,61 +85,46 @@ static int apc_release(struct inode *inode, struct file *f)
87 85
88static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg) 86static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg)
89{ 87{
90 __u8 inarg, __user *arg; 88 __u8 inarg, __user *arg = (__u8 __user *) __arg;
91
92 arg = (__u8 __user *) __arg;
93
94 lock_kernel();
95 89
96 switch (cmd) { 90 switch (cmd) {
97 case APCIOCGFANCTL: 91 case APCIOCGFANCTL:
98 if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) { 92 if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg))
99 unlock_kernel();
100 return -EFAULT; 93 return -EFAULT;
101 }
102 break; 94 break;
103 95
104 case APCIOCGCPWR: 96 case APCIOCGCPWR:
105 if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) { 97 if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg))
106 unlock_kernel();
107 return -EFAULT; 98 return -EFAULT;
108 }
109 break; 99 break;
110 100
111 case APCIOCGBPORT: 101 case APCIOCGBPORT:
112 if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) { 102 if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg))
113 unlock_kernel();
114 return -EFAULT; 103 return -EFAULT;
115 }
116 break; 104 break;
117 105
118 case APCIOCSFANCTL: 106 case APCIOCSFANCTL:
119 if (get_user(inarg, arg)) { 107 if (get_user(inarg, arg))
120 unlock_kernel();
121 return -EFAULT; 108 return -EFAULT;
122 }
123 apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); 109 apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
124 break; 110 break;
111
125 case APCIOCSCPWR: 112 case APCIOCSCPWR:
126 if (get_user(inarg, arg)) { 113 if (get_user(inarg, arg))
127 unlock_kernel();
128 return -EFAULT; 114 return -EFAULT;
129 }
130 apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); 115 apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
131 break; 116 break;
117
132 case APCIOCSBPORT: 118 case APCIOCSBPORT:
133 if (get_user(inarg, arg)) { 119 if (get_user(inarg, arg))
134 unlock_kernel();
135 return -EFAULT; 120 return -EFAULT;
136 }
137 apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); 121 apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
138 break; 122 break;
123
139 default: 124 default:
140 unlock_kernel();
141 return -EINVAL; 125 return -EINVAL;
142 }; 126 };
143 127
144 unlock_kernel();
145 return 0; 128 return 0;
146} 129}
147 130
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
index 45c41232fc4c..ee8d214cae1e 100644
--- a/arch/sparc/kernel/auxio_32.c
+++ b/arch/sparc/kernel/auxio_32.c
@@ -28,6 +28,7 @@ void __init auxio_probe(void)
28 struct resource r; 28 struct resource r;
29 29
30 switch (sparc_cpu_model) { 30 switch (sparc_cpu_model) {
31 case sparc_leon:
31 case sun4d: 32 case sun4d:
32 case sun4: 33 case sun4:
33 return; 34 return;
diff --git a/arch/sparc/kernel/btext.c b/arch/sparc/kernel/btext.c
new file mode 100644
index 000000000000..8cc2d56ffe9a
--- /dev/null
+++ b/arch/sparc/kernel/btext.c
@@ -0,0 +1,673 @@
1/*
2 * Procedures for drawing on the screen early on in the boot process.
3 *
4 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 */
6#include <linux/kernel.h>
7#include <linux/string.h>
8#include <linux/init.h>
9#include <linux/module.h>
10#include <linux/console.h>
11
12#include <asm/btext.h>
13#include <asm/oplib.h>
14#include <asm/io.h>
15
16#define NO_SCROLL
17
18#ifndef NO_SCROLL
19static void scrollscreen(void);
20#endif
21
22static void draw_byte(unsigned char c, long locX, long locY);
23static void draw_byte_32(unsigned char *bits, unsigned int *base, int rb);
24static void draw_byte_16(unsigned char *bits, unsigned int *base, int rb);
25static void draw_byte_8(unsigned char *bits, unsigned int *base, int rb);
26
27#define __force_data __attribute__((__section__(".data")))
28
29static int g_loc_X __force_data;
30static int g_loc_Y __force_data;
31static int g_max_loc_X __force_data;
32static int g_max_loc_Y __force_data;
33
34static int dispDeviceRowBytes __force_data;
35static int dispDeviceDepth __force_data;
36static int dispDeviceRect[4] __force_data;
37static unsigned char *dispDeviceBase __force_data;
38
39#define cmapsz (16*256)
40
41static unsigned char vga_font[cmapsz];
42
43static int __init btext_initialize(unsigned int node)
44{
45 unsigned int width, height, depth, pitch;
46 unsigned long address = 0;
47 u32 prop;
48
49 if (prom_getproperty(node, "width", (char *)&width, 4) < 0)
50 return -EINVAL;
51 if (prom_getproperty(node, "height", (char *)&height, 4) < 0)
52 return -EINVAL;
53 if (prom_getproperty(node, "depth", (char *)&depth, 4) < 0)
54 return -EINVAL;
55 pitch = width * ((depth + 7) / 8);
56
57 if (prom_getproperty(node, "linebytes", (char *)&prop, 4) >= 0 &&
58 prop != 0xffffffffu)
59 pitch = prop;
60
61 if (pitch == 1)
62 pitch = 0x1000;
63
64 if (prom_getproperty(node, "address", (char *)&prop, 4) >= 0)
65 address = prop;
66
67 /* FIXME: Add support for PCI reg properties. Right now, only
68 * reliable on macs
69 */
70 if (address == 0)
71 return -EINVAL;
72
73 g_loc_X = 0;
74 g_loc_Y = 0;
75 g_max_loc_X = width / 8;
76 g_max_loc_Y = height / 16;
77 dispDeviceBase = (unsigned char *)address;
78 dispDeviceRowBytes = pitch;
79 dispDeviceDepth = depth == 15 ? 16 : depth;
80 dispDeviceRect[0] = dispDeviceRect[1] = 0;
81 dispDeviceRect[2] = width;
82 dispDeviceRect[3] = height;
83
84 return 0;
85}
86
87/* Calc the base address of a given point (x,y) */
88static unsigned char * calc_base(int x, int y)
89{
90 unsigned char *base = dispDeviceBase;
91
92 base += (x + dispDeviceRect[0]) * (dispDeviceDepth >> 3);
93 base += (y + dispDeviceRect[1]) * dispDeviceRowBytes;
94 return base;
95}
96
97static void btext_clearscreen(void)
98{
99 unsigned int *base = (unsigned int *)calc_base(0, 0);
100 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) *
101 (dispDeviceDepth >> 3)) >> 2;
102 int i,j;
103
104 for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1]); i++)
105 {
106 unsigned int *ptr = base;
107 for(j=width; j; --j)
108 *(ptr++) = 0;
109 base += (dispDeviceRowBytes >> 2);
110 }
111}
112
113#ifndef NO_SCROLL
114static void scrollscreen(void)
115{
116 unsigned int *src = (unsigned int *)calc_base(0,16);
117 unsigned int *dst = (unsigned int *)calc_base(0,0);
118 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) *
119 (dispDeviceDepth >> 3)) >> 2;
120 int i,j;
121
122 for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1] - 16); i++)
123 {
124 unsigned int *src_ptr = src;
125 unsigned int *dst_ptr = dst;
126 for(j=width; j; --j)
127 *(dst_ptr++) = *(src_ptr++);
128 src += (dispDeviceRowBytes >> 2);
129 dst += (dispDeviceRowBytes >> 2);
130 }
131 for (i=0; i<16; i++)
132 {
133 unsigned int *dst_ptr = dst;
134 for(j=width; j; --j)
135 *(dst_ptr++) = 0;
136 dst += (dispDeviceRowBytes >> 2);
137 }
138}
139#endif /* ndef NO_SCROLL */
140
141void btext_drawchar(char c)
142{
143 int cline = 0;
144#ifdef NO_SCROLL
145 int x;
146#endif
147 switch (c) {
148 case '\b':
149 if (g_loc_X > 0)
150 --g_loc_X;
151 break;
152 case '\t':
153 g_loc_X = (g_loc_X & -8) + 8;
154 break;
155 case '\r':
156 g_loc_X = 0;
157 break;
158 case '\n':
159 g_loc_X = 0;
160 g_loc_Y++;
161 cline = 1;
162 break;
163 default:
164 draw_byte(c, g_loc_X++, g_loc_Y);
165 }
166 if (g_loc_X >= g_max_loc_X) {
167 g_loc_X = 0;
168 g_loc_Y++;
169 cline = 1;
170 }
171#ifndef NO_SCROLL
172 while (g_loc_Y >= g_max_loc_Y) {
173 scrollscreen();
174 g_loc_Y--;
175 }
176#else
177 /* wrap around from bottom to top of screen so we don't
178 waste time scrolling each line. -- paulus. */
179 if (g_loc_Y >= g_max_loc_Y)
180 g_loc_Y = 0;
181 if (cline) {
182 for (x = 0; x < g_max_loc_X; ++x)
183 draw_byte(' ', x, g_loc_Y);
184 }
185#endif
186}
187
188static void btext_drawtext(const char *c, unsigned int len)
189{
190 while (len--)
191 btext_drawchar(*c++);
192}
193
194static void draw_byte(unsigned char c, long locX, long locY)
195{
196 unsigned char *base = calc_base(locX << 3, locY << 4);
197 unsigned char *font = &vga_font[((unsigned int)c) * 16];
198 int rb = dispDeviceRowBytes;
199
200 switch(dispDeviceDepth) {
201 case 24:
202 case 32:
203 draw_byte_32(font, (unsigned int *)base, rb);
204 break;
205 case 15:
206 case 16:
207 draw_byte_16(font, (unsigned int *)base, rb);
208 break;
209 case 8:
210 draw_byte_8(font, (unsigned int *)base, rb);
211 break;
212 }
213}
214
215static unsigned int expand_bits_8[16] = {
216 0x00000000,
217 0x000000ff,
218 0x0000ff00,
219 0x0000ffff,
220 0x00ff0000,
221 0x00ff00ff,
222 0x00ffff00,
223 0x00ffffff,
224 0xff000000,
225 0xff0000ff,
226 0xff00ff00,
227 0xff00ffff,
228 0xffff0000,
229 0xffff00ff,
230 0xffffff00,
231 0xffffffff
232};
233
234static unsigned int expand_bits_16[4] = {
235 0x00000000,
236 0x0000ffff,
237 0xffff0000,
238 0xffffffff
239};
240
241
242static void draw_byte_32(unsigned char *font, unsigned int *base, int rb)
243{
244 int l, bits;
245 int fg = 0xFFFFFFFFUL;
246 int bg = 0x00000000UL;
247
248 for (l = 0; l < 16; ++l)
249 {
250 bits = *font++;
251 base[0] = (-(bits >> 7) & fg) ^ bg;
252 base[1] = (-((bits >> 6) & 1) & fg) ^ bg;
253 base[2] = (-((bits >> 5) & 1) & fg) ^ bg;
254 base[3] = (-((bits >> 4) & 1) & fg) ^ bg;
255 base[4] = (-((bits >> 3) & 1) & fg) ^ bg;
256 base[5] = (-((bits >> 2) & 1) & fg) ^ bg;
257 base[6] = (-((bits >> 1) & 1) & fg) ^ bg;
258 base[7] = (-(bits & 1) & fg) ^ bg;
259 base = (unsigned int *) ((char *)base + rb);
260 }
261}
262
263static void draw_byte_16(unsigned char *font, unsigned int *base, int rb)
264{
265 int l, bits;
266 int fg = 0xFFFFFFFFUL;
267 int bg = 0x00000000UL;
268 unsigned int *eb = (int *)expand_bits_16;
269
270 for (l = 0; l < 16; ++l)
271 {
272 bits = *font++;
273 base[0] = (eb[bits >> 6] & fg) ^ bg;
274 base[1] = (eb[(bits >> 4) & 3] & fg) ^ bg;
275 base[2] = (eb[(bits >> 2) & 3] & fg) ^ bg;
276 base[3] = (eb[bits & 3] & fg) ^ bg;
277 base = (unsigned int *) ((char *)base + rb);
278 }
279}
280
281static void draw_byte_8(unsigned char *font, unsigned int *base, int rb)
282{
283 int l, bits;
284 int fg = 0x0F0F0F0FUL;
285 int bg = 0x00000000UL;
286 unsigned int *eb = (int *)expand_bits_8;
287
288 for (l = 0; l < 16; ++l)
289 {
290 bits = *font++;
291 base[0] = (eb[bits >> 4] & fg) ^ bg;
292 base[1] = (eb[bits & 0xf] & fg) ^ bg;
293 base = (unsigned int *) ((char *)base + rb);
294 }
295}
296
297static void btext_console_write(struct console *con, const char *s,
298 unsigned int n)
299{
300 btext_drawtext(s, n);
301}
302
303static struct console btext_console = {
304 .name = "btext",
305 .write = btext_console_write,
306 .flags = CON_PRINTBUFFER | CON_ENABLED | CON_BOOT | CON_ANYTIME,
307 .index = 0,
308};
309
310int __init btext_find_display(void)
311{
312 unsigned int node;
313 char type[32];
314 int ret;
315
316 node = prom_inst2pkg(prom_stdout);
317 if (prom_getproperty(node, "device_type", type, 32) < 0)
318 return -ENODEV;
319 if (strcmp(type, "display"))
320 return -ENODEV;
321
322 ret = btext_initialize(node);
323 if (!ret) {
324 btext_clearscreen();
325 register_console(&btext_console);
326 }
327 return ret;
328}
329
330static unsigned char vga_font[cmapsz] = {
3310x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd,
3330x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff,
3340xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
3350x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10,
3360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe,
3370x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
3380x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
3390x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c,
3400x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,
3410x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
3420xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
3430x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00,
3440x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd,
3450xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x1e, 0x0e,
3460x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
3470x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18,
3480x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30,
3490x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x63,
3500x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00,
3510x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18,
3520x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8,
3530xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0e,
3540x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
3550x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00,
3560x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
3570x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xdb,
3580xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,
3590x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6,
3600x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3610xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,
3620x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
3630x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
3640x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
3650x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3660x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3670x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00,
3680x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0,
3690xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3700x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3710x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00,
3720x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c,
3730x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3740x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3750x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18,
3760x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00,
3770x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c,
3780x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
3790x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c,
3800x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18,
3810x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c,
3820x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
3830x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3840x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30,
3850x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18,
3860x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
3870x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00,
3880x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e,
3890x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3900x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
3910x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
3920x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3930x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3940x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
3950x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0xc6, 0x7c,
3960x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18,
3970x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6,
3980x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
3990x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c,
4000x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe,
4010x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0,
4020xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
4030x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
4040x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18,
4050x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6,
4060xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
4070x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78,
4080x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
4090x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4100x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
4110x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06,
4120x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
4130x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
4140x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
4150x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18,
4160x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xde,
4170xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38,
4180x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
4190x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc,
4200x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0,
4210xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6c,
4220x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
4230x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe,
4240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68,
4250x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
4260xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00,
4270x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
4280x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18,
4290x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c,
4300x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
4310x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6,
4320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60,
4330x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xe7,
4340xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00,
4350x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6,
4360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
4370xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66,
4380x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
4390x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c,
4400x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c,
4410x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6,
4420xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
4430x00, 0x00, 0xff, 0xdb, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
4440x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
4450xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3,
4460xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
4470x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x66,
4480x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18,
4490x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3,
4500xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
4510x00, 0x00, 0xff, 0xc3, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc1, 0xc3, 0xff,
4520x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
4530x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
4540xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
4550x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c,
4560x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
4570x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4580x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
4590x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4600x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c,
4610xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60,
4620x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00,
4630x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c,
4640x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc,
4650xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4660x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
4670x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0,
4680x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc,
4690xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, 0xe0, 0x60,
4700x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
4710x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
4720x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06,
4730x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0xe0, 0x60,
4740x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
4750x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
4760x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xff, 0xdb,
4770xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4780x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
4790x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
4800x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66,
4810x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
4820x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00,
4830x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0,
4840x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60,
4850x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30,
4860x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
4870x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76,
4880x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3,
4890xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4900x00, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x00, 0x00, 0x00, 0x00,
4910x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3,
4920x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6,
4930xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
4940x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
4950x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e,
4960x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18,
4970x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18,
4980x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
4990x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5000x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6,
5010xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66,
5020xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00,
5030x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76,
5040x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe,
5050xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c,
5060x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
5070x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76,
5080x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c,
5090xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38,
5100x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
5110x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06,
5120x3c, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe,
5130xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00,
5140x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
5150x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c,
5160x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18,
5170x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66,
5180x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
5190x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c,
5200x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6,
5210xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38, 0x00,
5220x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
5230x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe,
5240x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x1b,
5250x7e, 0xd8, 0xdc, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x6c,
5260xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00,
5270x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
5280x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6,
5290xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18,
5300x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
5310x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76,
5320x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc,
5330xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00,
5340x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00,
5350x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
5360x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
5370xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e,
5380xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
5390x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc,
5400x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0xff, 0x18,
5410xff, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66,
5420x7c, 0x62, 0x66, 0x6f, 0x66, 0x66, 0x66, 0xf3, 0x00, 0x00, 0x00, 0x00,
5430x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18,
5440xd8, 0x70, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c,
5450xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30,
5460x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
5470x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c,
5480x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc,
5490xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc,
5500x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
5510x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6,
5520x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00,
5530x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c,
5540x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5550x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c,
5560x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0,
5570xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5580x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
5590x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xce, 0x9b, 0x06,
5600x0c, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30,
5610x66, 0xce, 0x96, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
5620x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
5630x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00,
5640x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36,
5650x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x44, 0x11, 0x44,
5660x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44,
5670x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
5680x55, 0xaa, 0x55, 0xaa, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77,
5690xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0x18, 0x18, 0x18, 0x18,
5700x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
5710x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18,
5720x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8,
5730x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36,
5740x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
5750x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36,
5760x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8,
5770x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36,
5780x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
5790x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
5800x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6,
5810x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
5820x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5830x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00,
5840x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8,
5850x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5860x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
5870x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00,
5880x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff,
5890x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5900x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
5910x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
5920x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
5930x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
5940x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
5950x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
5960x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37,
5970x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
5980x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5990x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36,
6000x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff,
6010x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6020x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
6030x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36,
6040x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
6050x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36,
6060x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
6070x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
6080x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff,
6090x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6100x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
6110x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36,
6120x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f,
6130x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,
6140x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6150x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18,
6160x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f,
6170x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
6180x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
6190x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18,
6200x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
6210x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6220x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
6230xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
6240xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
6250xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0,
6260xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
6270x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
6280x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
6290x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6300x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00,
6310x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc,
6320x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0,
6330xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6340xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
6350x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe,
6360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8,
6370xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6380x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
6390x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
6400x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66,
6410x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
6420x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
6430x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee,
6440x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66,
6450x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6460x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6470x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0,
6480x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60,
6490x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
6500xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
6510x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00,
6520x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18,
6530x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
6540x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
6550x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e,
6560x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x1b, 0x18, 0x18,
6570x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
6580x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
6590x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00,
6600x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00,
6610x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c,
6620x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6630x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
6640x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6650x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0c, 0x0c,
6660x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00,
6670x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,
6680x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00,
6690x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6700x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
6710x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6720x00, 0x00, 0x00, 0x00,
673};
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index f3b5466c389c..415c86d5a8da 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/slab.h>
8#include <linux/string.h> 9#include <linux/string.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/of_device.h> 11#include <linux/of_device.h>
@@ -99,7 +100,7 @@ static int __devinit clock_board_probe(struct of_device *op,
99 100
100 p->leds_resource.start = (unsigned long) 101 p->leds_resource.start = (unsigned long)
101 (p->clock_regs + CLOCK_CTRL); 102 (p->clock_regs + CLOCK_CTRL);
102 p->leds_resource.end = p->leds_resource.end; 103 p->leds_resource.end = p->leds_resource.start;
103 p->leds_resource.name = "leds"; 104 p->leds_resource.name = "leds";
104 105
105 p->leds_pdev.name = "sunfire-clockboard-leds"; 106 p->leds_pdev.name = "sunfire-clockboard-leds";
@@ -194,7 +195,7 @@ static int __devinit fhc_probe(struct of_device *op,
194 if (!p->central) { 195 if (!p->central) {
195 p->leds_resource.start = (unsigned long) 196 p->leds_resource.start = (unsigned long)
196 (p->pregs + FHC_PREGS_CTRL); 197 (p->pregs + FHC_PREGS_CTRL);
197 p->leds_resource.end = p->leds_resource.end; 198 p->leds_resource.end = p->leds_resource.start;
198 p->leds_resource.name = "leds"; 199 p->leds_resource.name = "leds";
199 200
200 p->leds_pdev.name = "sunfire-fhc-leds"; 201 p->leds_pdev.name = "sunfire-fhc-leds";
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 1446df90ef85..e447938d39cf 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -185,6 +185,17 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
185 FPU(-1, NULL) 185 FPU(-1, NULL)
186 } 186 }
187},{ 187},{
188 0xF, /* Aeroflex Gaisler */
189 .cpu_info = {
190 CPU(3, "LEON"),
191 CPU(-1, NULL)
192 },
193 .fpu_info = {
194 FPU(2, "GRFPU"),
195 FPU(3, "GRFPU-Lite"),
196 FPU(-1, NULL)
197 }
198},{
188 0x17, 199 0x17,
189 .cpu_info = { 200 .cpu_info = {
190 CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"), 201 CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"),
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index 7430ed080b23..8de64c8126bc 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/slab.h>
7#include <linux/kernel.h> 8#include <linux/kernel.h>
8#include <linux/init.h> 9#include <linux/init.h>
9#include <linux/cpumask.h> 10#include <linux/cpumask.h>
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index b171ae8de90d..62dc7a021413 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -59,7 +59,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg,
59 59
60 cur_inst = 0; 60 cur_inst = 0;
61 for_each_node_by_type(dp, "cpu") { 61 for_each_node_by_type(dp, "cpu") {
62 int err = check_cpu_node(dp->node, &cur_inst, 62 int err = check_cpu_node(dp->phandle, &cur_inst,
63 compare, compare_arg, 63 compare, compare_arg,
64 prom_node, mid); 64 prom_node, mid);
65 if (!err) { 65 if (!err) {
@@ -143,6 +143,4 @@ void __init device_scan(void)
143 143
144 if (ARCH_SUN4C) 144 if (ARCH_SUN4C)
145 sun4c_probe_memerr_reg(); 145 sun4c_probe_memerr_reg();
146
147 return;
148} 146}
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index f41ecc5ac0b4..1504df8ddf70 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -400,6 +400,39 @@ linux_trap_ipi15_sun4d:
400 /* FIXME */ 400 /* FIXME */
4011: b,a 1b 4011: b,a 1b
402 402
403#ifdef CONFIG_SPARC_LEON
404
405 .globl smpleon_ticker
406 /* SMP per-cpu ticker interrupts are handled specially. */
407smpleon_ticker:
408 SAVE_ALL
409 or %l0, PSR_PIL, %g2
410 wr %g2, 0x0, %psr
411 WRITE_PAUSE
412 wr %g2, PSR_ET, %psr
413 WRITE_PAUSE
414 call leon_percpu_timer_interrupt
415 add %sp, STACKFRAME_SZ, %o0
416 wr %l0, PSR_ET, %psr
417 WRITE_PAUSE
418 RESTORE_ALL
419
420 .align 4
421 .globl linux_trap_ipi15_leon
422linux_trap_ipi15_leon:
423 SAVE_ALL
424 or %l0, PSR_PIL, %l4
425 wr %l4, 0x0, %psr
426 WRITE_PAUSE
427 wr %l4, PSR_ET, %psr
428 WRITE_PAUSE
429 call leon_cross_call_irq
430 nop
431 b ret_trap_lockless_ipi
432 clr %l6
433
434#endif /* CONFIG_SPARC_LEON */
435
403#endif /* CONFIG_SMP */ 436#endif /* CONFIG_SMP */
404 437
405 /* This routine handles illegal instructions and privileged 438 /* This routine handles illegal instructions and privileged
@@ -1261,7 +1294,7 @@ linux_sparc_syscall:
1261 sethi %hi(PSR_SYSCALL), %l4 1294 sethi %hi(PSR_SYSCALL), %l4
1262 or %l0, %l4, %l0 1295 or %l0, %l4, %l0
1263 /* Direct access to user regs, must faster. */ 1296 /* Direct access to user regs, must faster. */
1264 cmp %g1, NR_SYSCALLS 1297 cmp %g1, NR_syscalls
1265 bgeu linux_sparc_ni_syscall 1298 bgeu linux_sparc_ni_syscall
1266 sll %g1, 2, %l4 1299 sll %g1, 2, %l4
1267 ld [%l7 + %l4], %l7 1300 ld [%l7 + %l4], %l7
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index 4f53a2395ac6..c011b932bb17 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -48,7 +48,6 @@ extern void __init boot_cpu_id_too_large(int cpu);
48extern unsigned int dcache_parity_tl1_occurred; 48extern unsigned int dcache_parity_tl1_occurred;
49extern unsigned int icache_parity_tl1_occurred; 49extern unsigned int icache_parity_tl1_occurred;
50 50
51extern asmlinkage void update_perfctrs(void);
52extern asmlinkage void sparc_breakpoint(struct pt_regs *regs); 51extern asmlinkage void sparc_breakpoint(struct pt_regs *regs);
53extern void timer_interrupt(int irq, struct pt_regs *regs); 52extern void timer_interrupt(int irq, struct pt_regs *regs);
54 53
diff --git a/arch/sparc/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c
index d3b1a3076569..03ab022e51c5 100644
--- a/arch/sparc/kernel/ftrace.c
+++ b/arch/sparc/kernel/ftrace.c
@@ -4,6 +4,7 @@
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/list.h> 6#include <linux/list.h>
7#include <trace/syscall.h>
7 8
8#include <asm/ftrace.h> 9#include <asm/ftrace.h>
9 10
@@ -12,7 +13,7 @@ static const u32 ftrace_nop = 0x01000000;
12 13
13static u32 ftrace_call_replace(unsigned long ip, unsigned long addr) 14static u32 ftrace_call_replace(unsigned long ip, unsigned long addr)
14{ 15{
15 static u32 call; 16 u32 call;
16 s32 off; 17 s32 off;
17 18
18 off = ((s32)addr - (s32)ip); 19 off = ((s32)addr - (s32)ip);
@@ -91,3 +92,60 @@ int __init ftrace_dyn_arch_init(void *data)
91} 92}
92#endif 93#endif
93 94
95#ifdef CONFIG_FUNCTION_GRAPH_TRACER
96
97#ifdef CONFIG_DYNAMIC_FTRACE
98extern void ftrace_graph_call(void);
99
100int ftrace_enable_ftrace_graph_caller(void)
101{
102 unsigned long ip = (unsigned long)(&ftrace_graph_call);
103 u32 old, new;
104
105 old = *(u32 *) &ftrace_graph_call;
106 new = ftrace_call_replace(ip, (unsigned long) &ftrace_graph_caller);
107 return ftrace_modify_code(ip, old, new);
108}
109
110int ftrace_disable_ftrace_graph_caller(void)
111{
112 unsigned long ip = (unsigned long)(&ftrace_graph_call);
113 u32 old, new;
114
115 old = *(u32 *) &ftrace_graph_call;
116 new = ftrace_call_replace(ip, (unsigned long) &ftrace_stub);
117
118 return ftrace_modify_code(ip, old, new);
119}
120
121#endif /* !CONFIG_DYNAMIC_FTRACE */
122
123/*
124 * Hook the return address and push it in the stack of return addrs
125 * in current thread info.
126 */
127unsigned long prepare_ftrace_return(unsigned long parent,
128 unsigned long self_addr,
129 unsigned long frame_pointer)
130{
131 unsigned long return_hooker = (unsigned long) &return_to_handler;
132 struct ftrace_graph_ent trace;
133
134 if (unlikely(atomic_read(&current->tracing_graph_pause)))
135 return parent + 8UL;
136
137 if (ftrace_push_return_trace(parent, self_addr, &trace.depth,
138 frame_pointer) == -EBUSY)
139 return parent + 8UL;
140
141 trace.func = self_addr;
142
143 /* Only trace if the calling function expects to */
144 if (!ftrace_graph_entry(&trace)) {
145 current->curr_ret_stack--;
146 return parent + 8UL;
147 }
148
149 return return_hooker;
150}
151#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
diff --git a/arch/sparc/kernel/head_32.S b/arch/sparc/kernel/head_32.S
index 439d82a95ac9..21bb2590d4ae 100644
--- a/arch/sparc/kernel/head_32.S
+++ b/arch/sparc/kernel/head_32.S
@@ -811,9 +811,31 @@ found_version:
811got_prop: 811got_prop:
812#ifdef CONFIG_SPARC_LEON 812#ifdef CONFIG_SPARC_LEON
813 /* no cpu-type check is needed, it is a SPARC-LEON */ 813 /* no cpu-type check is needed, it is a SPARC-LEON */
814#ifdef CONFIG_SMP
815 ba leon_smp_init
816 nop
817
818 .global leon_smp_init
819leon_smp_init:
820 sethi %hi(boot_cpu_id), %g1 ! master always 0
821 stb %g0, [%g1 + %lo(boot_cpu_id)]
822 sethi %hi(boot_cpu_id4), %g1 ! master always 0
823 stb %g0, [%g1 + %lo(boot_cpu_id4)]
824
825 rd %asr17,%g1
826 srl %g1,28,%g1
827
828 cmp %g0,%g1
829 beq sun4c_continue_boot !continue with master
830 nop
831
832 ba leon_smp_cpu_startup
833 nop
834#else
814 ba sun4c_continue_boot 835 ba sun4c_continue_boot
815 nop 836 nop
816#endif 837#endif
838#endif
817 set cputypval, %o2 839 set cputypval, %o2
818 ldub [%o2 + 0x4], %l1 840 ldub [%o2 + 0x4], %l1
819 841
diff --git a/arch/sparc/kernel/helpers.S b/arch/sparc/kernel/helpers.S
index 314dd0c9fc5b..92090cc9e829 100644
--- a/arch/sparc/kernel/helpers.S
+++ b/arch/sparc/kernel/helpers.S
@@ -46,6 +46,81 @@ stack_trace_flush:
46 nop 46 nop
47 .size stack_trace_flush,.-stack_trace_flush 47 .size stack_trace_flush,.-stack_trace_flush
48 48
49#ifdef CONFIG_PERF_EVENTS
50 .globl perf_arch_fetch_caller_regs
51 .type perf_arch_fetch_caller_regs,#function
52perf_arch_fetch_caller_regs:
53 /* We always read the %pstate into %o5 since we will use
54 * that to construct a fake %tstate to store into the regs.
55 */
56 rdpr %pstate, %o5
57 brz,pn %o2, 50f
58 mov %o2, %g7
59
60 /* Turn off interrupts while we walk around the register
61 * window by hand.
62 */
63 wrpr %o5, PSTATE_IE, %pstate
64
65 /* The %canrestore tells us how many register windows are
66 * still live in the chip above us, past that we have to
67 * walk the frame as saved on the stack. We stash away
68 * the %cwp in %g1 so we can return back to the original
69 * register window.
70 */
71 rdpr %cwp, %g1
72 rdpr %canrestore, %g2
73 sub %g1, 1, %g3
74
75 /* We have the skip count in %g7, if it hits zero then
76 * %fp/%i7 are the registers we need. Otherwise if our
77 * %canrestore count maintained in %g2 hits zero we have
78 * to start traversing the stack.
79 */
8010: brz,pn %g2, 4f
81 sub %g2, 1, %g2
82 wrpr %g3, %cwp
83 subcc %g7, 1, %g7
84 bne,pt %xcc, 10b
85 sub %g3, 1, %g3
86
87 /* We found the values we need in the cpu's register
88 * windows.
89 */
90 mov %fp, %g3
91 ba,pt %xcc, 3f
92 mov %i7, %g2
93
9450: mov %fp, %g3
95 ba,pt %xcc, 2f
96 mov %i7, %g2
97
98 /* We hit the end of the valid register windows in the
99 * cpu, start traversing the stack frame.
100 */
1014: mov %fp, %g3
102
10320: ldx [%g3 + STACK_BIAS + RW_V9_I7], %g2
104 subcc %g7, 1, %g7
105 bne,pn %xcc, 20b
106 ldx [%g3 + STACK_BIAS + RW_V9_I6], %g3
107
108 /* Restore the current register window position and
109 * re-enable interrupts.
110 */
1113: wrpr %g1, %cwp
112 wrpr %o5, %pstate
113
1142: stx %g3, [%o0 + PT_V9_FP]
115 sllx %o5, 8, %o5
116 stx %o5, [%o0 + PT_V9_TSTATE]
117 stx %g2, [%o0 + PT_V9_TPC]
118 add %g2, 4, %g2
119 retl
120 stx %g2, [%o0 + PT_V9_TNPC]
121 .size perf_arch_fetch_caller_regs,.-perf_arch_fetch_caller_regs
122#endif /* CONFIG_PERF_EVENTS */
123
49#ifdef CONFIG_SMP 124#ifdef CONFIG_SMP
50 .globl hard_smp_processor_id 125 .globl hard_smp_processor_id
51 .type hard_smp_processor_id,#function 126 .type hard_smp_processor_id,#function
diff --git a/arch/sparc/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c
index 1d272c3b5740..7c60afb835b0 100644
--- a/arch/sparc/kernel/hvapi.c
+++ b/arch/sparc/kernel/hvapi.c
@@ -5,7 +5,6 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/slab.h>
9 8
10#include <asm/hypervisor.h> 9#include <asm/hypervisor.h>
11#include <asm/oplib.h> 10#include <asm/oplib.h>
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 7690cc219ecc..47977a77f6c6 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -6,11 +6,13 @@
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/slab.h>
9#include <linux/delay.h> 10#include <linux/delay.h>
10#include <linux/device.h> 11#include <linux/device.h>
11#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
12#include <linux/errno.h> 13#include <linux/errno.h>
13#include <linux/iommu-helper.h> 14#include <linux/iommu-helper.h>
15#include <linux/bitmap.h>
14 16
15#ifdef CONFIG_PCI 17#ifdef CONFIG_PCI
16#include <linux/pci.h> 18#include <linux/pci.h>
@@ -169,7 +171,7 @@ void iommu_range_free(struct iommu *iommu, dma_addr_t dma_addr, unsigned long np
169 171
170 entry = (dma_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT; 172 entry = (dma_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT;
171 173
172 iommu_area_free(arena->map, entry, npages); 174 bitmap_clear(arena->map, entry, npages);
173} 175}
174 176
175int iommu_table_init(struct iommu *iommu, int tsbsize, 177int iommu_table_init(struct iommu *iommu, int tsbsize,
@@ -861,13 +863,3 @@ int dma_supported(struct device *dev, u64 device_mask)
861 return 0; 863 return 0;
862} 864}
863EXPORT_SYMBOL(dma_supported); 865EXPORT_SYMBOL(dma_supported);
864
865int dma_set_mask(struct device *dev, u64 dma_mask)
866{
867#ifdef CONFIG_PCI
868 if (dev->bus == &pci_bus_type)
869 return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
870#endif
871 return -EINVAL;
872}
873EXPORT_SYMBOL(dma_set_mask);
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 9f61fd8cbb7b..84e5386714cd 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -48,8 +48,13 @@
48#include <asm/dma.h> 48#include <asm/dma.h>
49#include <asm/iommu.h> 49#include <asm/iommu.h>
50#include <asm/io-unit.h> 50#include <asm/io-unit.h>
51#include <asm/leon.h>
51 52
53#ifdef CONFIG_SPARC_LEON
54#define mmu_inval_dma_area(p, l) leon_flush_dcache_all()
55#else
52#define mmu_inval_dma_area(p, l) /* Anton pulled it out for 2.4.0-xx */ 56#define mmu_inval_dma_area(p, l) /* Anton pulled it out for 2.4.0-xx */
57#endif
53 58
54static struct resource *_sparc_find_resource(struct resource *r, 59static struct resource *_sparc_find_resource(struct resource *r,
55 unsigned long); 60 unsigned long);
@@ -671,17 +676,6 @@ int dma_supported(struct device *dev, u64 mask)
671} 676}
672EXPORT_SYMBOL(dma_supported); 677EXPORT_SYMBOL(dma_supported);
673 678
674int dma_set_mask(struct device *dev, u64 dma_mask)
675{
676#ifdef CONFIG_PCI
677 if (dev->bus == &pci_bus_type)
678 return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
679#endif
680 return -EOPNOTSUPP;
681}
682EXPORT_SYMBOL(dma_set_mask);
683
684
685#ifdef CONFIG_PROC_FS 679#ifdef CONFIG_PROC_FS
686 680
687static int sparc_io_proc_show(struct seq_file *m, void *v) 681static int sparc_io_proc_show(struct seq_file *m, void *v)
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index 8ab1d4728a4b..830d70a3e20b 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -20,7 +20,9 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/ftrace.h>
23#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/kmemleak.h>
24 26
25#include <asm/ptrace.h> 27#include <asm/ptrace.h>
26#include <asm/processor.h> 28#include <asm/processor.h>
@@ -45,6 +47,7 @@
45 47
46#include "entry.h" 48#include "entry.h"
47#include "cpumap.h" 49#include "cpumap.h"
50#include "kstack.h"
48 51
49#define NUM_IVECS (IMAP_INR + 1) 52#define NUM_IVECS (IMAP_INR + 1)
50 53
@@ -176,7 +179,7 @@ int show_interrupts(struct seq_file *p, void *v)
176 } 179 }
177 180
178 if (i < NR_IRQS) { 181 if (i < NR_IRQS) {
179 spin_lock_irqsave(&irq_desc[i].lock, flags); 182 raw_spin_lock_irqsave(&irq_desc[i].lock, flags);
180 action = irq_desc[i].action; 183 action = irq_desc[i].action;
181 if (!action) 184 if (!action)
182 goto skip; 185 goto skip;
@@ -187,7 +190,7 @@ int show_interrupts(struct seq_file *p, void *v)
187 for_each_online_cpu(j) 190 for_each_online_cpu(j)
188 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 191 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
189#endif 192#endif
190 seq_printf(p, " %9s", irq_desc[i].chip->typename); 193 seq_printf(p, " %9s", irq_desc[i].chip->name);
191 seq_printf(p, " %s", action->name); 194 seq_printf(p, " %s", action->name);
192 195
193 for (action=action->next; action; action = action->next) 196 for (action=action->next; action; action = action->next)
@@ -195,7 +198,7 @@ int show_interrupts(struct seq_file *p, void *v)
195 198
196 seq_putc(p, '\n'); 199 seq_putc(p, '\n');
197skip: 200skip:
198 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 201 raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);
199 } else if (i == NR_IRQS) { 202 } else if (i == NR_IRQS) {
200 seq_printf(p, "NMI: "); 203 seq_printf(p, "NMI: ");
201 for_each_online_cpu(j) 204 for_each_online_cpu(j)
@@ -250,12 +253,12 @@ struct irq_handler_data {
250}; 253};
251 254
252#ifdef CONFIG_SMP 255#ifdef CONFIG_SMP
253static int irq_choose_cpu(unsigned int virt_irq) 256static int irq_choose_cpu(unsigned int virt_irq, const struct cpumask *affinity)
254{ 257{
255 cpumask_t mask; 258 cpumask_t mask;
256 int cpuid; 259 int cpuid;
257 260
258 cpumask_copy(&mask, irq_desc[virt_irq].affinity); 261 cpumask_copy(&mask, affinity);
259 if (cpus_equal(mask, cpu_online_map)) { 262 if (cpus_equal(mask, cpu_online_map)) {
260 cpuid = map_to_cpu(virt_irq); 263 cpuid = map_to_cpu(virt_irq);
261 } else { 264 } else {
@@ -268,10 +271,8 @@ static int irq_choose_cpu(unsigned int virt_irq)
268 return cpuid; 271 return cpuid;
269} 272}
270#else 273#else
271static int irq_choose_cpu(unsigned int virt_irq) 274#define irq_choose_cpu(virt_irq, affinity) \
272{ 275 real_hard_smp_processor_id()
273 return real_hard_smp_processor_id();
274}
275#endif 276#endif
276 277
277static void sun4u_irq_enable(unsigned int virt_irq) 278static void sun4u_irq_enable(unsigned int virt_irq)
@@ -282,7 +283,8 @@ static void sun4u_irq_enable(unsigned int virt_irq)
282 unsigned long cpuid, imap, val; 283 unsigned long cpuid, imap, val;
283 unsigned int tid; 284 unsigned int tid;
284 285
285 cpuid = irq_choose_cpu(virt_irq); 286 cpuid = irq_choose_cpu(virt_irq,
287 irq_desc[virt_irq].affinity);
286 imap = data->imap; 288 imap = data->imap;
287 289
288 tid = sun4u_compute_tid(imap, cpuid); 290 tid = sun4u_compute_tid(imap, cpuid);
@@ -299,7 +301,24 @@ static void sun4u_irq_enable(unsigned int virt_irq)
299static int sun4u_set_affinity(unsigned int virt_irq, 301static int sun4u_set_affinity(unsigned int virt_irq,
300 const struct cpumask *mask) 302 const struct cpumask *mask)
301{ 303{
302 sun4u_irq_enable(virt_irq); 304 struct irq_handler_data *data = get_irq_chip_data(virt_irq);
305
306 if (likely(data)) {
307 unsigned long cpuid, imap, val;
308 unsigned int tid;
309
310 cpuid = irq_choose_cpu(virt_irq, mask);
311 imap = data->imap;
312
313 tid = sun4u_compute_tid(imap, cpuid);
314
315 val = upa_readq(imap);
316 val &= ~(IMAP_TID_UPA | IMAP_TID_JBUS |
317 IMAP_AID_SAFARI | IMAP_NID_SAFARI);
318 val |= tid | IMAP_VALID;
319 upa_writeq(val, imap);
320 upa_writeq(ICLR_IDLE, data->iclr);
321 }
303 322
304 return 0; 323 return 0;
305} 324}
@@ -340,7 +359,8 @@ static void sun4u_irq_eoi(unsigned int virt_irq)
340static void sun4v_irq_enable(unsigned int virt_irq) 359static void sun4v_irq_enable(unsigned int virt_irq)
341{ 360{
342 unsigned int ino = virt_irq_table[virt_irq].dev_ino; 361 unsigned int ino = virt_irq_table[virt_irq].dev_ino;
343 unsigned long cpuid = irq_choose_cpu(virt_irq); 362 unsigned long cpuid = irq_choose_cpu(virt_irq,
363 irq_desc[virt_irq].affinity);
344 int err; 364 int err;
345 365
346 err = sun4v_intr_settarget(ino, cpuid); 366 err = sun4v_intr_settarget(ino, cpuid);
@@ -361,7 +381,7 @@ static int sun4v_set_affinity(unsigned int virt_irq,
361 const struct cpumask *mask) 381 const struct cpumask *mask)
362{ 382{
363 unsigned int ino = virt_irq_table[virt_irq].dev_ino; 383 unsigned int ino = virt_irq_table[virt_irq].dev_ino;
364 unsigned long cpuid = irq_choose_cpu(virt_irq); 384 unsigned long cpuid = irq_choose_cpu(virt_irq, mask);
365 int err; 385 int err;
366 386
367 err = sun4v_intr_settarget(ino, cpuid); 387 err = sun4v_intr_settarget(ino, cpuid);
@@ -403,7 +423,7 @@ static void sun4v_virq_enable(unsigned int virt_irq)
403 unsigned long cpuid, dev_handle, dev_ino; 423 unsigned long cpuid, dev_handle, dev_ino;
404 int err; 424 int err;
405 425
406 cpuid = irq_choose_cpu(virt_irq); 426 cpuid = irq_choose_cpu(virt_irq, irq_desc[virt_irq].affinity);
407 427
408 dev_handle = virt_irq_table[virt_irq].dev_handle; 428 dev_handle = virt_irq_table[virt_irq].dev_handle;
409 dev_ino = virt_irq_table[virt_irq].dev_ino; 429 dev_ino = virt_irq_table[virt_irq].dev_ino;
@@ -433,7 +453,7 @@ static int sun4v_virt_set_affinity(unsigned int virt_irq,
433 unsigned long cpuid, dev_handle, dev_ino; 453 unsigned long cpuid, dev_handle, dev_ino;
434 int err; 454 int err;
435 455
436 cpuid = irq_choose_cpu(virt_irq); 456 cpuid = irq_choose_cpu(virt_irq, mask);
437 457
438 dev_handle = virt_irq_table[virt_irq].dev_handle; 458 dev_handle = virt_irq_table[virt_irq].dev_handle;
439 dev_ino = virt_irq_table[virt_irq].dev_ino; 459 dev_ino = virt_irq_table[virt_irq].dev_ino;
@@ -484,7 +504,7 @@ static void sun4v_virq_eoi(unsigned int virt_irq)
484} 504}
485 505
486static struct irq_chip sun4u_irq = { 506static struct irq_chip sun4u_irq = {
487 .typename = "sun4u", 507 .name = "sun4u",
488 .enable = sun4u_irq_enable, 508 .enable = sun4u_irq_enable,
489 .disable = sun4u_irq_disable, 509 .disable = sun4u_irq_disable,
490 .eoi = sun4u_irq_eoi, 510 .eoi = sun4u_irq_eoi,
@@ -492,7 +512,7 @@ static struct irq_chip sun4u_irq = {
492}; 512};
493 513
494static struct irq_chip sun4v_irq = { 514static struct irq_chip sun4v_irq = {
495 .typename = "sun4v", 515 .name = "sun4v",
496 .enable = sun4v_irq_enable, 516 .enable = sun4v_irq_enable,
497 .disable = sun4v_irq_disable, 517 .disable = sun4v_irq_disable,
498 .eoi = sun4v_irq_eoi, 518 .eoi = sun4v_irq_eoi,
@@ -500,7 +520,7 @@ static struct irq_chip sun4v_irq = {
500}; 520};
501 521
502static struct irq_chip sun4v_virq = { 522static struct irq_chip sun4v_virq = {
503 .typename = "vsun4v", 523 .name = "vsun4v",
504 .enable = sun4v_virq_enable, 524 .enable = sun4v_virq_enable,
505 .disable = sun4v_virq_disable, 525 .disable = sun4v_virq_disable,
506 .eoi = sun4v_virq_eoi, 526 .eoi = sun4v_virq_eoi,
@@ -630,6 +650,14 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
630 bucket = kzalloc(sizeof(struct ino_bucket), GFP_ATOMIC); 650 bucket = kzalloc(sizeof(struct ino_bucket), GFP_ATOMIC);
631 if (unlikely(!bucket)) 651 if (unlikely(!bucket))
632 return 0; 652 return 0;
653
654 /* The only reference we store to the IRQ bucket is
655 * by physical address which kmemleak can't see, tell
656 * it that this object explicitly is not a leak and
657 * should be scanned.
658 */
659 kmemleak_not_leak(bucket);
660
633 __flush_dcache_range((unsigned long) bucket, 661 __flush_dcache_range((unsigned long) bucket,
634 ((unsigned long) bucket + 662 ((unsigned long) bucket +
635 sizeof(struct ino_bucket))); 663 sizeof(struct ino_bucket)));
@@ -686,25 +714,7 @@ void ack_bad_irq(unsigned int virt_irq)
686void *hardirq_stack[NR_CPUS]; 714void *hardirq_stack[NR_CPUS];
687void *softirq_stack[NR_CPUS]; 715void *softirq_stack[NR_CPUS];
688 716
689static __attribute__((always_inline)) void *set_hardirq_stack(void) 717void __irq_entry handler_irq(int irq, struct pt_regs *regs)
690{
691 void *orig_sp, *sp = hardirq_stack[smp_processor_id()];
692
693 __asm__ __volatile__("mov %%sp, %0" : "=r" (orig_sp));
694 if (orig_sp < sp ||
695 orig_sp > (sp + THREAD_SIZE)) {
696 sp += THREAD_SIZE - 192 - STACK_BIAS;
697 __asm__ __volatile__("mov %0, %%sp" : : "r" (sp));
698 }
699
700 return orig_sp;
701}
702static __attribute__((always_inline)) void restore_hardirq_stack(void *orig_sp)
703{
704 __asm__ __volatile__("mov %0, %%sp" : : "r" (orig_sp));
705}
706
707void handler_irq(int irq, struct pt_regs *regs)
708{ 718{
709 unsigned long pstate, bucket_pa; 719 unsigned long pstate, bucket_pa;
710 struct pt_regs *old_regs; 720 struct pt_regs *old_regs;
@@ -785,14 +795,14 @@ void fixup_irqs(void)
785 for (irq = 0; irq < NR_IRQS; irq++) { 795 for (irq = 0; irq < NR_IRQS; irq++) {
786 unsigned long flags; 796 unsigned long flags;
787 797
788 spin_lock_irqsave(&irq_desc[irq].lock, flags); 798 raw_spin_lock_irqsave(&irq_desc[irq].lock, flags);
789 if (irq_desc[irq].action && 799 if (irq_desc[irq].action &&
790 !(irq_desc[irq].status & IRQ_PER_CPU)) { 800 !(irq_desc[irq].status & IRQ_PER_CPU)) {
791 if (irq_desc[irq].chip->set_affinity) 801 if (irq_desc[irq].chip->set_affinity)
792 irq_desc[irq].chip->set_affinity(irq, 802 irq_desc[irq].chip->set_affinity(irq,
793 irq_desc[irq].affinity); 803 irq_desc[irq].affinity);
794 } 804 }
795 spin_unlock_irqrestore(&irq_desc[irq].lock, flags); 805 raw_spin_unlock_irqrestore(&irq_desc[irq].lock, flags);
796 } 806 }
797 807
798 tick_ops->disable_irq(); 808 tick_ops->disable_irq();
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c
index f5a0fd490b59..0a2bd0f99fc1 100644
--- a/arch/sparc/kernel/kgdb_64.c
+++ b/arch/sparc/kernel/kgdb_64.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/kgdb.h> 6#include <linux/kgdb.h>
7#include <linux/kdebug.h> 7#include <linux/kdebug.h>
8#include <linux/ftrace.h>
8 9
9#include <asm/kdebug.h> 10#include <asm/kdebug.h>
10#include <asm/ptrace.h> 11#include <asm/ptrace.h>
@@ -108,7 +109,7 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
108} 109}
109 110
110#ifdef CONFIG_SMP 111#ifdef CONFIG_SMP
111void smp_kgdb_capture_client(int irq, struct pt_regs *regs) 112void __irq_entry smp_kgdb_capture_client(int irq, struct pt_regs *regs)
112{ 113{
113 unsigned long flags; 114 unsigned long flags;
114 115
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 3bc6527c95af..a39d1ba5a119 100644
--- a/arch/sparc/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
@@ -7,6 +7,7 @@
7#include <linux/kprobes.h> 7#include <linux/kprobes.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/kdebug.h> 9#include <linux/kdebug.h>
10#include <linux/slab.h>
10#include <asm/signal.h> 11#include <asm/signal.h>
11#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
12#include <asm/uaccess.h> 13#include <asm/uaccess.h>
@@ -46,6 +47,9 @@ struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
46 47
47int __kprobes arch_prepare_kprobe(struct kprobe *p) 48int __kprobes arch_prepare_kprobe(struct kprobe *p)
48{ 49{
50 if ((unsigned long) p->addr & 0x3UL)
51 return -EILSEQ;
52
49 p->ainsn.insn[0] = *p->addr; 53 p->ainsn.insn[0] = *p->addr;
50 flushi(&p->ainsn.insn[0]); 54 flushi(&p->ainsn.insn[0]);
51 55
diff --git a/arch/sparc/kernel/kstack.h b/arch/sparc/kernel/kstack.h
index 4248d969272f..53dfb92e09fb 100644
--- a/arch/sparc/kernel/kstack.h
+++ b/arch/sparc/kernel/kstack.h
@@ -11,6 +11,10 @@ static inline bool kstack_valid(struct thread_info *tp, unsigned long sp)
11{ 11{
12 unsigned long base = (unsigned long) tp; 12 unsigned long base = (unsigned long) tp;
13 13
14 /* Stack pointer must be 16-byte aligned. */
15 if (sp & (16UL - 1))
16 return false;
17
14 if (sp >= (base + sizeof(struct thread_info)) && 18 if (sp >= (base + sizeof(struct thread_info)) &&
15 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) 19 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
16 return true; 20 return true;
@@ -57,4 +61,23 @@ check_magic:
57 61
58} 62}
59 63
64static inline __attribute__((always_inline)) void *set_hardirq_stack(void)
65{
66 void *orig_sp, *sp = hardirq_stack[smp_processor_id()];
67
68 __asm__ __volatile__("mov %%sp, %0" : "=r" (orig_sp));
69 if (orig_sp < sp ||
70 orig_sp > (sp + THREAD_SIZE)) {
71 sp += THREAD_SIZE - 192 - STACK_BIAS;
72 __asm__ __volatile__("mov %0, %%sp" : : "r" (sp));
73 }
74
75 return orig_sp;
76}
77
78static inline __attribute__((always_inline)) void restore_hardirq_stack(void *orig_sp)
79{
80 __asm__ __volatile__("mov %0, %%sp" : : "r" (orig_sp));
81}
82
60#endif /* _KSTACK_H */ 83#endif /* _KSTACK_H */
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
index cb3c72c45aab..df39a0f0d27a 100644
--- a/arch/sparc/kernel/ldc.c
+++ b/arch/sparc/kernel/ldc.c
@@ -14,6 +14,7 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/bitmap.h>
17 18
18#include <asm/hypervisor.h> 19#include <asm/hypervisor.h>
19#include <asm/iommu.h> 20#include <asm/iommu.h>
@@ -1242,13 +1243,13 @@ int ldc_bind(struct ldc_channel *lp, const char *name)
1242 snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); 1243 snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name);
1243 1244
1244 err = request_irq(lp->cfg.rx_irq, ldc_rx, 1245 err = request_irq(lp->cfg.rx_irq, ldc_rx,
1245 IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED, 1246 IRQF_SAMPLE_RANDOM | IRQF_DISABLED,
1246 lp->rx_irq_name, lp); 1247 lp->rx_irq_name, lp);
1247 if (err) 1248 if (err)
1248 return err; 1249 return err;
1249 1250
1250 err = request_irq(lp->cfg.tx_irq, ldc_tx, 1251 err = request_irq(lp->cfg.tx_irq, ldc_tx,
1251 IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED, 1252 IRQF_SAMPLE_RANDOM | IRQF_DISABLED,
1252 lp->tx_irq_name, lp); 1253 lp->tx_irq_name, lp);
1253 if (err) { 1254 if (err) {
1254 free_irq(lp->cfg.rx_irq, lp); 1255 free_irq(lp->cfg.rx_irq, lp);
@@ -1875,7 +1876,7 @@ EXPORT_SYMBOL(ldc_read);
1875static long arena_alloc(struct ldc_iommu *iommu, unsigned long npages) 1876static long arena_alloc(struct ldc_iommu *iommu, unsigned long npages)
1876{ 1877{
1877 struct iommu_arena *arena = &iommu->arena; 1878 struct iommu_arena *arena = &iommu->arena;
1878 unsigned long n, i, start, end, limit; 1879 unsigned long n, start, end, limit;
1879 int pass; 1880 int pass;
1880 1881
1881 limit = arena->limit; 1882 limit = arena->limit;
@@ -1883,7 +1884,7 @@ static long arena_alloc(struct ldc_iommu *iommu, unsigned long npages)
1883 pass = 0; 1884 pass = 0;
1884 1885
1885again: 1886again:
1886 n = find_next_zero_bit(arena->map, limit, start); 1887 n = bitmap_find_next_zero_area(arena->map, limit, start, npages, 0);
1887 end = n + npages; 1888 end = n + npages;
1888 if (unlikely(end >= limit)) { 1889 if (unlikely(end >= limit)) {
1889 if (likely(pass < 1)) { 1890 if (likely(pass < 1)) {
@@ -1896,16 +1897,7 @@ again:
1896 return -1; 1897 return -1;
1897 } 1898 }
1898 } 1899 }
1899 1900 bitmap_set(arena->map, n, npages);
1900 for (i = n; i < end; i++) {
1901 if (test_bit(i, arena->map)) {
1902 start = i + 1;
1903 goto again;
1904 }
1905 }
1906
1907 for (i = n; i < end; i++)
1908 __set_bit(i, arena->map);
1909 1901
1910 arena->hint = end; 1902 arena->hint = end;
1911 1903
diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c
index 00d034ea2164..3ae36f36e758 100644
--- a/arch/sparc/kernel/led.c
+++ b/arch/sparc/kernel/led.c
@@ -3,6 +3,7 @@
3#include <linux/init.h> 3#include <linux/init.h>
4#include <linux/proc_fs.h> 4#include <linux/proc_fs.h>
5#include <linux/seq_file.h> 5#include <linux/seq_file.h>
6#include <linux/slab.h>
6#include <linux/string.h> 7#include <linux/string.h>
7#include <linux/jiffies.h> 8#include <linux/jiffies.h>
8#include <linux/timer.h> 9#include <linux/timer.h>
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index 54d8a5bd4824..6a7b4dbc8e09 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -7,16 +7,18 @@
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/mutex.h> 9#include <linux/mutex.h>
10#include <linux/slab.h>
11#include <linux/of.h> 10#include <linux/of.h>
12#include <linux/of_platform.h> 11#include <linux/of_platform.h>
13#include <linux/interrupt.h> 12#include <linux/interrupt.h>
14#include <linux/of_device.h> 13#include <linux/of_device.h>
14
15#include <asm/oplib.h> 15#include <asm/oplib.h>
16#include <asm/timer.h> 16#include <asm/timer.h>
17#include <asm/prom.h> 17#include <asm/prom.h>
18#include <asm/leon.h> 18#include <asm/leon.h>
19#include <asm/leon_amba.h> 19#include <asm/leon_amba.h>
20#include <asm/traps.h>
21#include <asm/cacheflush.h>
20 22
21#include "prom.h" 23#include "prom.h"
22#include "irq.h" 24#include "irq.h"
@@ -115,6 +117,21 @@ void __init leon_init_timers(irq_handler_t counter_fn)
115 (((1000000 / 100) - 1))); 117 (((1000000 / 100) - 1)));
116 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 0); 118 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 0);
117 119
120#ifdef CONFIG_SMP
121 leon_percpu_timer_dev[0].start = (int)leon3_gptimer_regs;
122 leon_percpu_timer_dev[0].irq = leon3_gptimer_irq+1;
123
124 if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) &
125 (1<<LEON3_GPTIMER_SEPIRQ))) {
126 prom_printf("irq timer not configured with separate irqs\n");
127 BUG();
128 }
129
130 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].val, 0);
131 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/100) - 1)));
132 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl, 0);
133# endif
134
118 } else { 135 } else {
119 printk(KERN_ERR "No Timer/irqctrl found\n"); 136 printk(KERN_ERR "No Timer/irqctrl found\n");
120 BUG(); 137 BUG();
@@ -130,11 +147,41 @@ void __init leon_init_timers(irq_handler_t counter_fn)
130 prom_halt(); 147 prom_halt();
131 } 148 }
132 149
150# ifdef CONFIG_SMP
151 {
152 unsigned long flags;
153 struct tt_entry *trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (leon_percpu_timer_dev[0].irq - 1)];
154
155 /* For SMP we use the level 14 ticker, however the bootup code
156 * has copied the firmwares level 14 vector into boot cpu's
157 * trap table, we must fix this now or we get squashed.
158 */
159 local_irq_save(flags);
160
161 patchme_maybe_smp_msg[0] = 0x01000000; /* NOP out the branch */
162
163 /* Adjust so that we jump directly to smpleon_ticker */
164 trap_table->inst_three += smpleon_ticker - real_irq_entry;
165
166 local_flush_cache_all();
167 local_irq_restore(flags);
168 }
169# endif
170
133 if (leon3_gptimer_regs) { 171 if (leon3_gptimer_regs) {
134 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 172 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl,
135 LEON3_GPTIMER_EN | 173 LEON3_GPTIMER_EN |
136 LEON3_GPTIMER_RL | 174 LEON3_GPTIMER_RL |
137 LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN); 175 LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN);
176
177#ifdef CONFIG_SMP
178 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl,
179 LEON3_GPTIMER_EN |
180 LEON3_GPTIMER_RL |
181 LEON3_GPTIMER_LD |
182 LEON3_GPTIMER_IRQEN);
183#endif
184
138 } 185 }
139} 186}
140 187
@@ -175,6 +222,42 @@ void __init leon_node_init(struct device_node *dp, struct device_node ***nextp)
175 } 222 }
176} 223}
177 224
225#ifdef CONFIG_SMP
226
227void leon_set_cpu_int(int cpu, int level)
228{
229 unsigned long mask;
230 mask = get_irqmask(level);
231 LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask);
232}
233
234static void leon_clear_ipi(int cpu, int level)
235{
236 unsigned long mask;
237 mask = get_irqmask(level);
238 LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask<<16);
239}
240
241static void leon_set_udt(int cpu)
242{
243}
244
245void leon_clear_profile_irq(int cpu)
246{
247}
248
249void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu)
250{
251 unsigned long mask, flags, *addr;
252 mask = get_irqmask(irq_nr);
253 local_irq_save(flags);
254 addr = (unsigned long *)&(leon3_irqctrl_regs->mask[cpu]);
255 LEON3_BYPASS_STORE_PA(addr, (LEON3_BYPASS_LOAD_PA(addr) | (mask)));
256 local_irq_restore(flags);
257}
258
259#endif
260
178void __init leon_init_IRQ(void) 261void __init leon_init_IRQ(void)
179{ 262{
180 sparc_init_timers = leon_init_timers; 263 sparc_init_timers = leon_init_timers;
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
new file mode 100644
index 000000000000..e1656fc41ccb
--- /dev/null
+++ b/arch/sparc/kernel/leon_smp.c
@@ -0,0 +1,469 @@
1/* leon_smp.c: Sparc-Leon SMP support.
2 *
3 * based on sun4m_smp.c
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 2009 Daniel Hellstrom (daniel@gaisler.com) Aeroflex Gaisler AB
6 * Copyright (C) 2009 Konrad Eisele (konrad@gaisler.com) Aeroflex Gaisler AB
7 */
8
9#include <asm/head.h>
10
11#include <linux/kernel.h>
12#include <linux/sched.h>
13#include <linux/threads.h>
14#include <linux/smp.h>
15#include <linux/smp_lock.h>
16#include <linux/interrupt.h>
17#include <linux/kernel_stat.h>
18#include <linux/init.h>
19#include <linux/spinlock.h>
20#include <linux/mm.h>
21#include <linux/swap.h>
22#include <linux/profile.h>
23#include <linux/pm.h>
24#include <linux/delay.h>
25#include <linux/gfp.h>
26
27#include <asm/cacheflush.h>
28#include <asm/tlbflush.h>
29
30#include <asm/ptrace.h>
31#include <asm/atomic.h>
32#include <asm/irq_regs.h>
33
34#include <asm/delay.h>
35#include <asm/irq.h>
36#include <asm/page.h>
37#include <asm/pgalloc.h>
38#include <asm/pgtable.h>
39#include <asm/oplib.h>
40#include <asm/cpudata.h>
41#include <asm/asi.h>
42#include <asm/leon.h>
43#include <asm/leon_amba.h>
44
45#ifdef CONFIG_SPARC_LEON
46
47#include "irq.h"
48
49extern ctxd_t *srmmu_ctx_table_phys;
50static int smp_processors_ready;
51extern volatile unsigned long cpu_callin_map[NR_CPUS];
52extern unsigned char boot_cpu_id;
53extern cpumask_t smp_commenced_mask;
54void __init leon_configure_cache_smp(void);
55
56static inline unsigned long do_swap(volatile unsigned long *ptr,
57 unsigned long val)
58{
59 __asm__ __volatile__("swapa [%1] %2, %0\n\t" : "=&r"(val)
60 : "r"(ptr), "i"(ASI_LEON_DCACHE_MISS)
61 : "memory");
62 return val;
63}
64
65static void smp_setup_percpu_timer(void);
66
67void __cpuinit leon_callin(void)
68{
69 int cpuid = hard_smpleon_processor_id();
70
71 local_flush_cache_all();
72 local_flush_tlb_all();
73 leon_configure_cache_smp();
74
75 /* Get our local ticker going. */
76 smp_setup_percpu_timer();
77
78 calibrate_delay();
79 smp_store_cpu_info(cpuid);
80
81 local_flush_cache_all();
82 local_flush_tlb_all();
83
84 /*
85 * Unblock the master CPU _only_ when the scheduler state
86 * of all secondary CPUs will be up-to-date, so after
87 * the SMP initialization the master will be just allowed
88 * to call the scheduler code.
89 * Allow master to continue.
90 */
91 do_swap(&cpu_callin_map[cpuid], 1);
92
93 local_flush_cache_all();
94 local_flush_tlb_all();
95
96 cpu_probe();
97
98 /* Fix idle thread fields. */
99 __asm__ __volatile__("ld [%0], %%g6\n\t" : : "r"(&current_set[cpuid])
100 : "memory" /* paranoid */);
101
102 /* Attach to the address space of init_task. */
103 atomic_inc(&init_mm.mm_count);
104 current->active_mm = &init_mm;
105
106 while (!cpu_isset(cpuid, smp_commenced_mask))
107 mb();
108
109 local_irq_enable();
110 cpu_set(cpuid, cpu_online_map);
111}
112
113/*
114 * Cycle through the processors asking the PROM to start each one.
115 */
116
117extern struct linux_prom_registers smp_penguin_ctable;
118
119void __init leon_configure_cache_smp(void)
120{
121 unsigned long cfg = sparc_leon3_get_dcachecfg();
122 int me = smp_processor_id();
123
124 if (ASI_LEON3_SYSCTRL_CFG_SSIZE(cfg) > 4) {
125 printk(KERN_INFO "Note: SMP with snooping only works on 4k cache, found %dk(0x%x) on cpu %d, disabling caches\n",
126 (unsigned int)ASI_LEON3_SYSCTRL_CFG_SSIZE(cfg),
127 (unsigned int)cfg, (unsigned int)me);
128 sparc_leon3_disable_cache();
129 } else {
130 if (cfg & ASI_LEON3_SYSCTRL_CFG_SNOOPING) {
131 sparc_leon3_enable_snooping();
132 } else {
133 printk(KERN_INFO "Note: You have to enable snooping in the vhdl model cpu %d, disabling caches\n",
134 me);
135 sparc_leon3_disable_cache();
136 }
137 }
138
139 local_flush_cache_all();
140 local_flush_tlb_all();
141}
142
143void leon_smp_setbroadcast(unsigned int mask)
144{
145 int broadcast =
146 ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >>
147 LEON3_IRQMPSTATUS_BROADCAST) & 1);
148 if (!broadcast) {
149 prom_printf("######## !!!! The irqmp-ctrl must have broadcast enabled, smp wont work !!!!! ####### nr cpus: %d\n",
150 leon_smp_nrcpus());
151 if (leon_smp_nrcpus() > 1) {
152 BUG();
153 } else {
154 prom_printf("continue anyway\n");
155 return;
156 }
157 }
158 LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask);
159}
160
161unsigned int leon_smp_getbroadcast(void)
162{
163 unsigned int mask;
164 mask = LEON_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpbroadcast));
165 return mask;
166}
167
168int leon_smp_nrcpus(void)
169{
170 int nrcpu =
171 ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >>
172 LEON3_IRQMPSTATUS_CPUNR) & 0xf) + 1;
173 return nrcpu;
174}
175
176void __init leon_boot_cpus(void)
177{
178 int nrcpu = leon_smp_nrcpus();
179 int me = smp_processor_id();
180
181 printk(KERN_INFO "%d:(%d:%d) cpus mpirq at 0x%x\n", (unsigned int)me,
182 (unsigned int)nrcpu, (unsigned int)NR_CPUS,
183 (unsigned int)&(leon3_irqctrl_regs->mpstatus));
184
185 leon_enable_irq_cpu(LEON3_IRQ_CROSS_CALL, me);
186 leon_enable_irq_cpu(LEON3_IRQ_TICKER, me);
187 leon_enable_irq_cpu(LEON3_IRQ_RESCHEDULE, me);
188
189 leon_smp_setbroadcast(1 << LEON3_IRQ_TICKER);
190
191 leon_configure_cache_smp();
192 smp_setup_percpu_timer();
193 local_flush_cache_all();
194
195}
196
197int __cpuinit leon_boot_one_cpu(int i)
198{
199
200 struct task_struct *p;
201 int timeout;
202
203 /* Cook up an idler for this guy. */
204 p = fork_idle(i);
205
206 current_set[i] = task_thread_info(p);
207
208 /* See trampoline.S:leon_smp_cpu_startup for details...
209 * Initialize the contexts table
210 * Since the call to prom_startcpu() trashes the structure,
211 * we need to re-initialize it for each cpu
212 */
213 smp_penguin_ctable.which_io = 0;
214 smp_penguin_ctable.phys_addr = (unsigned int)srmmu_ctx_table_phys;
215 smp_penguin_ctable.reg_size = 0;
216
217 /* whirrr, whirrr, whirrrrrrrrr... */
218 printk(KERN_INFO "Starting CPU %d : (irqmp: 0x%x)\n", (unsigned int)i,
219 (unsigned int)&leon3_irqctrl_regs->mpstatus);
220 local_flush_cache_all();
221
222 LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpstatus), 1 << i);
223
224 /* wheee... it's going... */
225 for (timeout = 0; timeout < 10000; timeout++) {
226 if (cpu_callin_map[i])
227 break;
228 udelay(200);
229 }
230 printk(KERN_INFO "Started CPU %d\n", (unsigned int)i);
231
232 if (!(cpu_callin_map[i])) {
233 printk(KERN_ERR "Processor %d is stuck.\n", i);
234 return -ENODEV;
235 } else {
236 leon_enable_irq_cpu(LEON3_IRQ_CROSS_CALL, i);
237 leon_enable_irq_cpu(LEON3_IRQ_TICKER, i);
238 leon_enable_irq_cpu(LEON3_IRQ_RESCHEDULE, i);
239 }
240
241 local_flush_cache_all();
242 return 0;
243}
244
245void __init leon_smp_done(void)
246{
247
248 int i, first;
249 int *prev;
250
251 /* setup cpu list for irq rotation */
252 first = 0;
253 prev = &first;
254 for (i = 0; i < NR_CPUS; i++) {
255 if (cpu_online(i)) {
256 *prev = i;
257 prev = &cpu_data(i).next;
258 }
259 }
260 *prev = first;
261 local_flush_cache_all();
262
263 /* Free unneeded trap tables */
264 if (!cpu_isset(1, cpu_present_map)) {
265 ClearPageReserved(virt_to_page(trapbase_cpu1));
266 init_page_count(virt_to_page(trapbase_cpu1));
267 free_page((unsigned long)trapbase_cpu1);
268 totalram_pages++;
269 num_physpages++;
270 }
271 if (!cpu_isset(2, cpu_present_map)) {
272 ClearPageReserved(virt_to_page(trapbase_cpu2));
273 init_page_count(virt_to_page(trapbase_cpu2));
274 free_page((unsigned long)trapbase_cpu2);
275 totalram_pages++;
276 num_physpages++;
277 }
278 if (!cpu_isset(3, cpu_present_map)) {
279 ClearPageReserved(virt_to_page(trapbase_cpu3));
280 init_page_count(virt_to_page(trapbase_cpu3));
281 free_page((unsigned long)trapbase_cpu3);
282 totalram_pages++;
283 num_physpages++;
284 }
285 /* Ok, they are spinning and ready to go. */
286 smp_processors_ready = 1;
287
288}
289
290void leon_irq_rotate(int cpu)
291{
292}
293
294static struct smp_funcall {
295 smpfunc_t func;
296 unsigned long arg1;
297 unsigned long arg2;
298 unsigned long arg3;
299 unsigned long arg4;
300 unsigned long arg5;
301 unsigned long processors_in[NR_CPUS]; /* Set when ipi entered. */
302 unsigned long processors_out[NR_CPUS]; /* Set when ipi exited. */
303} ccall_info;
304
305static DEFINE_SPINLOCK(cross_call_lock);
306
307/* Cross calls must be serialized, at least currently. */
308static void leon_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1,
309 unsigned long arg2, unsigned long arg3,
310 unsigned long arg4)
311{
312 if (smp_processors_ready) {
313 register int high = NR_CPUS - 1;
314 unsigned long flags;
315
316 spin_lock_irqsave(&cross_call_lock, flags);
317
318 {
319 /* If you make changes here, make sure gcc generates proper code... */
320 register smpfunc_t f asm("i0") = func;
321 register unsigned long a1 asm("i1") = arg1;
322 register unsigned long a2 asm("i2") = arg2;
323 register unsigned long a3 asm("i3") = arg3;
324 register unsigned long a4 asm("i4") = arg4;
325 register unsigned long a5 asm("i5") = 0;
326
327 __asm__ __volatile__("std %0, [%6]\n\t"
328 "std %2, [%6 + 8]\n\t"
329 "std %4, [%6 + 16]\n\t" : :
330 "r"(f), "r"(a1), "r"(a2), "r"(a3),
331 "r"(a4), "r"(a5),
332 "r"(&ccall_info.func));
333 }
334
335 /* Init receive/complete mapping, plus fire the IPI's off. */
336 {
337 register int i;
338
339 cpu_clear(smp_processor_id(), mask);
340 cpus_and(mask, cpu_online_map, mask);
341 for (i = 0; i <= high; i++) {
342 if (cpu_isset(i, mask)) {
343 ccall_info.processors_in[i] = 0;
344 ccall_info.processors_out[i] = 0;
345 set_cpu_int(i, LEON3_IRQ_CROSS_CALL);
346
347 }
348 }
349 }
350
351 {
352 register int i;
353
354 i = 0;
355 do {
356 if (!cpu_isset(i, mask))
357 continue;
358
359 while (!ccall_info.processors_in[i])
360 barrier();
361 } while (++i <= high);
362
363 i = 0;
364 do {
365 if (!cpu_isset(i, mask))
366 continue;
367
368 while (!ccall_info.processors_out[i])
369 barrier();
370 } while (++i <= high);
371 }
372
373 spin_unlock_irqrestore(&cross_call_lock, flags);
374 }
375}
376
377/* Running cross calls. */
378void leon_cross_call_irq(void)
379{
380 int i = smp_processor_id();
381
382 ccall_info.processors_in[i] = 1;
383 ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3,
384 ccall_info.arg4, ccall_info.arg5);
385 ccall_info.processors_out[i] = 1;
386}
387
388void leon_percpu_timer_interrupt(struct pt_regs *regs)
389{
390 struct pt_regs *old_regs;
391 int cpu = smp_processor_id();
392
393 old_regs = set_irq_regs(regs);
394
395 leon_clear_profile_irq(cpu);
396
397 profile_tick(CPU_PROFILING);
398
399 if (!--prof_counter(cpu)) {
400 int user = user_mode(regs);
401
402 irq_enter();
403 update_process_times(user);
404 irq_exit();
405
406 prof_counter(cpu) = prof_multiplier(cpu);
407 }
408 set_irq_regs(old_regs);
409}
410
411static void __init smp_setup_percpu_timer(void)
412{
413 int cpu = smp_processor_id();
414
415 prof_counter(cpu) = prof_multiplier(cpu) = 1;
416}
417
418void __init leon_blackbox_id(unsigned *addr)
419{
420 int rd = *addr & 0x3e000000;
421 int rs1 = rd >> 11;
422
423 /* patch places where ___b_hard_smp_processor_id appears */
424 addr[0] = 0x81444000 | rd; /* rd %asr17, reg */
425 addr[1] = 0x8130201c | rd | rs1; /* srl reg, 0x1c, reg */
426 addr[2] = 0x01000000; /* nop */
427}
428
429void __init leon_blackbox_current(unsigned *addr)
430{
431 int rd = *addr & 0x3e000000;
432 int rs1 = rd >> 11;
433
434 /* patch LOAD_CURRENT macro where ___b_load_current appears */
435 addr[0] = 0x81444000 | rd; /* rd %asr17, reg */
436 addr[2] = 0x8130201c | rd | rs1; /* srl reg, 0x1c, reg */
437 addr[4] = 0x81282002 | rd | rs1; /* sll reg, 0x2, reg */
438
439}
440
441/*
442 * CPU idle callback function
443 * See .../arch/sparc/kernel/process.c
444 */
445void pmc_leon_idle(void)
446{
447 __asm__ volatile ("mov %g0, %asr19");
448}
449
450void __init leon_init_smp(void)
451{
452 /* Patch ipi15 trap table */
453 t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_leon - linux_trap_ipi15_sun4m);
454
455 BTFIXUPSET_BLACKBOX(hard_smp_processor_id, leon_blackbox_id);
456 BTFIXUPSET_BLACKBOX(load_current, leon_blackbox_current);
457 BTFIXUPSET_CALL(smp_cross_call, leon_cross_call, BTFIXUPCALL_NORM);
458 BTFIXUPSET_CALL(__hard_smp_processor_id, __leon_processor_id,
459 BTFIXUPCALL_NORM);
460
461#ifndef PMC_NO_IDLE
462 /* Assign power management IDLE handler */
463 pm_idle = pmc_leon_idle;
464 printk(KERN_INFO "leon: power management initialized\n");
465#endif
466
467}
468
469#endif /* CONFIG_SPARC_LEON */
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 938da19dc065..cdc91d919e93 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -10,6 +10,7 @@
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/miscdevice.h> 12#include <linux/miscdevice.h>
13#include <linux/bootmem.h>
13 14
14#include <asm/cpudata.h> 15#include <asm/cpudata.h>
15#include <asm/hypervisor.h> 16#include <asm/hypervisor.h>
@@ -108,25 +109,15 @@ static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size)
108 109
109static void mdesc_lmb_free(struct mdesc_handle *hp) 110static void mdesc_lmb_free(struct mdesc_handle *hp)
110{ 111{
111 unsigned int alloc_size, handle_size = hp->handle_size; 112 unsigned int alloc_size;
112 unsigned long start, end; 113 unsigned long start;
113 114
114 BUG_ON(atomic_read(&hp->refcnt) != 0); 115 BUG_ON(atomic_read(&hp->refcnt) != 0);
115 BUG_ON(!list_empty(&hp->list)); 116 BUG_ON(!list_empty(&hp->list));
116 117
117 alloc_size = PAGE_ALIGN(handle_size); 118 alloc_size = PAGE_ALIGN(hp->handle_size);
118 119 start = __pa(hp);
119 start = (unsigned long) hp; 120 free_bootmem_late(start, alloc_size);
120 end = start + alloc_size;
121
122 while (start < end) {
123 struct page *p;
124
125 p = virt_to_page(start);
126 ClearPageReserved(p);
127 __free_page(p);
128 start += PAGE_SIZE;
129 }
130} 121}
131 122
132static struct mdesc_mem_ops lmb_mdesc_ops = { 123static struct mdesc_mem_ops lmb_mdesc_ops = {
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 0ee642f63234..f848aadf54dc 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -9,9 +9,9 @@
9#include <linux/elf.h> 9#include <linux/elf.h>
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/gfp.h>
12#include <linux/string.h> 13#include <linux/string.h>
13#include <linux/ctype.h> 14#include <linux/ctype.h>
14#include <linux/slab.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16 16
17#include <asm/processor.h> 17#include <asm/processor.h>
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
index b129611590a4..a4bd7ba74c89 100644
--- a/arch/sparc/kernel/nmi.c
+++ b/arch/sparc/kernel/nmi.c
@@ -21,9 +21,10 @@
21 21
22#include <asm/perf_event.h> 22#include <asm/perf_event.h>
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/local.h>
25#include <asm/pcr.h> 24#include <asm/pcr.h>
26 25
26#include "kstack.h"
27
27/* We don't have a real NMI on sparc64, but we can fake one 28/* We don't have a real NMI on sparc64, but we can fake one
28 * up using profiling counter overflow interrupts and interrupt 29 * up using profiling counter overflow interrupts and interrupt
29 * levels. 30 * levels.
@@ -47,7 +48,7 @@ static DEFINE_PER_CPU(short, wd_enabled);
47static int endflag __initdata; 48static int endflag __initdata;
48 49
49static DEFINE_PER_CPU(unsigned int, last_irq_sum); 50static DEFINE_PER_CPU(unsigned int, last_irq_sum);
50static DEFINE_PER_CPU(local_t, alert_counter); 51static DEFINE_PER_CPU(long, alert_counter);
51static DEFINE_PER_CPU(int, nmi_touch); 52static DEFINE_PER_CPU(int, nmi_touch);
52 53
53void touch_nmi_watchdog(void) 54void touch_nmi_watchdog(void)
@@ -93,38 +94,43 @@ static void die_nmi(const char *str, struct pt_regs *regs, int do_panic)
93notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs) 94notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
94{ 95{
95 unsigned int sum, touched = 0; 96 unsigned int sum, touched = 0;
96 int cpu = smp_processor_id(); 97 void *orig_sp;
97 98
98 clear_softint(1 << irq); 99 clear_softint(1 << irq);
99 pcr_ops->write(PCR_PIC_PRIV);
100 100
101 local_cpu_data().__nmi_count++; 101 local_cpu_data().__nmi_count++;
102 102
103 nmi_enter(); 103 nmi_enter();
104 104
105 orig_sp = set_hardirq_stack();
106
105 if (notify_die(DIE_NMI, "nmi", regs, 0, 107 if (notify_die(DIE_NMI, "nmi", regs, 0,
106 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP) 108 pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
107 touched = 1; 109 touched = 1;
110 else
111 pcr_ops->write(PCR_PIC_PRIV);
108 112
109 sum = kstat_irqs_cpu(0, cpu); 113 sum = local_cpu_data().irq0_irqs;
110 if (__get_cpu_var(nmi_touch)) { 114 if (__get_cpu_var(nmi_touch)) {
111 __get_cpu_var(nmi_touch) = 0; 115 __get_cpu_var(nmi_touch) = 0;
112 touched = 1; 116 touched = 1;
113 } 117 }
114 if (!touched && __get_cpu_var(last_irq_sum) == sum) { 118 if (!touched && __get_cpu_var(last_irq_sum) == sum) {
115 local_inc(&__get_cpu_var(alert_counter)); 119 __this_cpu_inc(alert_counter);
116 if (local_read(&__get_cpu_var(alert_counter)) == 30 * nmi_hz) 120 if (__this_cpu_read(alert_counter) == 30 * nmi_hz)
117 die_nmi("BUG: NMI Watchdog detected LOCKUP", 121 die_nmi("BUG: NMI Watchdog detected LOCKUP",
118 regs, panic_on_timeout); 122 regs, panic_on_timeout);
119 } else { 123 } else {
120 __get_cpu_var(last_irq_sum) = sum; 124 __get_cpu_var(last_irq_sum) = sum;
121 local_set(&__get_cpu_var(alert_counter), 0); 125 __this_cpu_write(alert_counter, 0);
122 } 126 }
123 if (__get_cpu_var(wd_enabled)) { 127 if (__get_cpu_var(wd_enabled)) {
124 write_pic(picl_value(nmi_hz)); 128 write_pic(picl_value(nmi_hz));
125 pcr_ops->write(pcr_enable); 129 pcr_ops->write(pcr_enable);
126 } 130 }
127 131
132 restore_hardirq_stack(orig_sp);
133
128 nmi_exit(); 134 nmi_exit();
129} 135}
130 136
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 4c26eb59e742..da527b33ebc7 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -105,7 +105,7 @@ static unsigned long of_bus_sbus_get_flags(const u32 *addr, unsigned long flags)
105 105
106static int of_bus_ambapp_match(struct device_node *np) 106static int of_bus_ambapp_match(struct device_node *np)
107{ 107{
108 return !strcmp(np->name, "ambapp"); 108 return !strcmp(np->type, "ambapp");
109} 109}
110 110
111static void of_bus_ambapp_count_cells(struct device_node *child, 111static void of_bus_ambapp_count_cells(struct device_node *child,
@@ -433,7 +433,7 @@ build_resources:
433 if (!parent) 433 if (!parent)
434 dev_set_name(&op->dev, "root"); 434 dev_set_name(&op->dev, "root");
435 else 435 else
436 dev_set_name(&op->dev, "%08x", dp->node); 436 dev_set_name(&op->dev, "%08x", dp->phandle);
437 437
438 if (of_device_register(op)) { 438 if (of_device_register(op)) {
439 printk("%s: Could not register of device.\n", 439 printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 881947e59e95..b3d4cb5d21b3 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -104,9 +104,19 @@ static int of_bus_pci_map(u32 *addr, const u32 *range,
104 int i; 104 int i;
105 105
106 /* Check address type match */ 106 /* Check address type match */
107 if ((addr[0] ^ range[0]) & 0x03000000) 107 if (!((addr[0] ^ range[0]) & 0x03000000))
108 return -EINVAL; 108 goto type_match;
109
110 /* Special exception, we can map a 64-bit address into
111 * a 32-bit range.
112 */
113 if ((addr[0] & 0x03000000) == 0x03000000 &&
114 (range[0] & 0x03000000) == 0x02000000)
115 goto type_match;
116
117 return -EINVAL;
109 118
119type_match:
110 if (of_out_of_range(addr + 1, range + 1, range + na + pna, 120 if (of_out_of_range(addr + 1, range + 1, range + na + pna,
111 na - 1, ns)) 121 na - 1, ns))
112 return -EINVAL; 122 return -EINVAL;
@@ -666,7 +676,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
666 if (!parent) 676 if (!parent)
667 dev_set_name(&op->dev, "root"); 677 dev_set_name(&op->dev, "root");
668 else 678 else
669 dev_set_name(&op->dev, "%08x", dp->node); 679 dev_set_name(&op->dev, "%08x", dp->phandle);
670 680
671 if (of_device_register(op)) { 681 if (of_device_register(op)) {
672 printk("%s: Could not register of device.\n", 682 printk("%s: Could not register of device.\n",
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index cb8eb799bb6c..0247e68210b3 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -4,7 +4,6 @@
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/mod_devicetable.h> 6#include <linux/mod_devicetable.h>
7#include <linux/slab.h>
8#include <linux/errno.h> 7#include <linux/errno.h>
9#include <linux/irq.h> 8#include <linux/irq.h>
10#include <linux/of_device.h> 9#include <linux/of_device.h>
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index c68648662802..5ac539a5930f 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -247,6 +247,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
247 struct pci_bus *bus, int devfn) 247 struct pci_bus *bus, int devfn)
248{ 248{
249 struct dev_archdata *sd; 249 struct dev_archdata *sd;
250 struct pci_slot *slot;
250 struct of_device *op; 251 struct of_device *op;
251 struct pci_dev *dev; 252 struct pci_dev *dev;
252 const char *type; 253 const char *type;
@@ -286,6 +287,11 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
286 dev->dev.bus = &pci_bus_type; 287 dev->dev.bus = &pci_bus_type;
287 dev->devfn = devfn; 288 dev->devfn = devfn;
288 dev->multifunction = 0; /* maybe a lie? */ 289 dev->multifunction = 0; /* maybe a lie? */
290 set_pcie_port_type(dev);
291
292 list_for_each_entry(slot, &dev->bus->slots, list)
293 if (PCI_SLOT(dev->devfn) == slot->number)
294 dev->slot = slot;
289 295
290 dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff); 296 dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff);
291 dev->device = of_getintprop_default(node, "device-id", 0xffff); 297 dev->device = of_getintprop_default(node, "device-id", 0xffff);
@@ -322,6 +328,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
322 328
323 dev->current_state = 4; /* unknown power state */ 329 dev->current_state = 4; /* unknown power state */
324 dev->error_state = pci_channel_io_normal; 330 dev->error_state = pci_channel_io_normal;
331 dev->dma_mask = 0xffffffff;
325 332
326 if (!strcmp(node->name, "pci")) { 333 if (!strcmp(node->name, "pci")) {
327 /* a PCI-PCI bridge */ 334 /* a PCI-PCI bridge */
@@ -715,9 +722,10 @@ void pcibios_update_irq(struct pci_dev *pdev, int irq)
715{ 722{
716} 723}
717 724
718void pcibios_align_resource(void *data, struct resource *res, 725resource_size_t pcibios_align_resource(void *data, const struct resource *res,
719 resource_size_t size, resource_size_t align) 726 resource_size_t size, resource_size_t align)
720{ 727{
728 return res->start;
721} 729}
722 730
723int pcibios_enable_device(struct pci_dev *dev, int mask) 731int pcibios_enable_device(struct pci_dev *dev, int mask)
@@ -1064,7 +1072,6 @@ int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask)
1064 1072
1065 return (device_mask & dma_addr_mask) == dma_addr_mask; 1073 return (device_mask & dma_addr_mask) == dma_addr_mask;
1066} 1074}
1067EXPORT_SYMBOL(pci_dma_supported);
1068 1075
1069void pci_resource_to_user(const struct pci_dev *pdev, int bar, 1076void pci_resource_to_user(const struct pci_dev *pdev, int bar,
1070 const struct resource *rp, resource_size_t *start, 1077 const struct resource *rp, resource_size_t *start,
@@ -1081,3 +1088,85 @@ void pci_resource_to_user(const struct pci_dev *pdev, int bar,
1081 *start = rp->start - offset; 1088 *start = rp->start - offset;
1082 *end = rp->end - offset; 1089 *end = rp->end - offset;
1083} 1090}
1091
1092static int __init pcibios_init(void)
1093{
1094 pci_dfl_cache_line_size = 64 >> 2;
1095 return 0;
1096}
1097subsys_initcall(pcibios_init);
1098
1099#ifdef CONFIG_SYSFS
1100static void __devinit pci_bus_slot_names(struct device_node *node,
1101 struct pci_bus *bus)
1102{
1103 const struct pci_slot_names {
1104 u32 slot_mask;
1105 char names[0];
1106 } *prop;
1107 const char *sp;
1108 int len, i;
1109 u32 mask;
1110
1111 prop = of_get_property(node, "slot-names", &len);
1112 if (!prop)
1113 return;
1114
1115 mask = prop->slot_mask;
1116 sp = prop->names;
1117
1118 if (ofpci_verbose)
1119 printk("PCI: Making slots for [%s] mask[0x%02x]\n",
1120 node->full_name, mask);
1121
1122 i = 0;
1123 while (mask) {
1124 struct pci_slot *pci_slot;
1125 u32 this_bit = 1 << i;
1126
1127 if (!(mask & this_bit)) {
1128 i++;
1129 continue;
1130 }
1131
1132 if (ofpci_verbose)
1133 printk("PCI: Making slot [%s]\n", sp);
1134
1135 pci_slot = pci_create_slot(bus, i, sp, NULL);
1136 if (IS_ERR(pci_slot))
1137 printk(KERN_ERR "PCI: pci_create_slot returned %ld\n",
1138 PTR_ERR(pci_slot));
1139
1140 sp += strlen(sp) + 1;
1141 mask &= ~this_bit;
1142 i++;
1143 }
1144}
1145
1146static int __init of_pci_slot_init(void)
1147{
1148 struct pci_bus *pbus = NULL;
1149
1150 while ((pbus = pci_find_next_bus(pbus)) != NULL) {
1151 struct device_node *node;
1152
1153 if (pbus->self) {
1154 struct dev_archdata *sd = pbus->self->sysdata;
1155
1156 /* PCI->PCI bridge */
1157 node = sd->prom_node;
1158 } else {
1159 struct pci_pbm_info *pbm = pbus->sysdata;
1160
1161 /* Host PCI controller */
1162 node = pbm->op->node;
1163 }
1164
1165 pci_bus_slot_names(node, pbus);
1166 }
1167
1168 return 0;
1169}
1170
1171module_init(of_pci_slot_init);
1172#endif
diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
index b775658a927d..8a000583b5cf 100644
--- a/arch/sparc/kernel/pci_common.c
+++ b/arch/sparc/kernel/pci_common.c
@@ -371,14 +371,19 @@ static void pci_register_iommu_region(struct pci_pbm_info *pbm)
371 struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL); 371 struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
372 372
373 if (!rp) { 373 if (!rp) {
374 prom_printf("Cannot allocate IOMMU resource.\n"); 374 pr_info("%s: Cannot allocate IOMMU resource.\n",
375 prom_halt(); 375 pbm->name);
376 return;
376 } 377 }
377 rp->name = "IOMMU"; 378 rp->name = "IOMMU";
378 rp->start = pbm->mem_space.start + (unsigned long) vdma[0]; 379 rp->start = pbm->mem_space.start + (unsigned long) vdma[0];
379 rp->end = rp->start + (unsigned long) vdma[1] - 1UL; 380 rp->end = rp->start + (unsigned long) vdma[1] - 1UL;
380 rp->flags = IORESOURCE_BUSY; 381 rp->flags = IORESOURCE_BUSY;
381 request_resource(&pbm->mem_space, rp); 382 if (request_resource(&pbm->mem_space, rp)) {
383 pr_info("%s: Unable to request IOMMU resource.\n",
384 pbm->name);
385 kfree(rp);
386 }
382 } 387 }
383} 388}
384 389
diff --git a/arch/sparc/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c
index f1be37a7b123..e0ef847219c3 100644
--- a/arch/sparc/kernel/pci_msi.c
+++ b/arch/sparc/kernel/pci_msi.c
@@ -4,6 +4,7 @@
4 */ 4 */
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/interrupt.h> 6#include <linux/interrupt.h>
7#include <linux/slab.h>
7#include <linux/irq.h> 8#include <linux/irq.h>
8 9
9#include "pci_impl.h" 10#include "pci_impl.h"
@@ -112,7 +113,7 @@ static void free_msi(struct pci_pbm_info *pbm, int msi_num)
112} 113}
113 114
114static struct irq_chip msi_irq = { 115static struct irq_chip msi_irq = {
115 .typename = "PCI-MSI", 116 .name = "PCI-MSI",
116 .mask = mask_msi_irq, 117 .mask = mask_msi_irq,
117 .unmask = unmask_msi_irq, 118 .unmask = unmask_msi_irq,
118 .enable = unmask_msi_irq, 119 .enable = unmask_msi_irq,
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 85e7037429b9..d36a8d391ca0 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -30,6 +30,7 @@
30#include <asm/oplib.h> 30#include <asm/oplib.h>
31#include <asm/prom.h> 31#include <asm/prom.h>
32#include <asm/pcic.h> 32#include <asm/pcic.h>
33#include <asm/timex.h>
33#include <asm/timer.h> 34#include <asm/timer.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
35#include <asm/irq_regs.h> 36#include <asm/irq_regs.h>
@@ -163,8 +164,6 @@ void __iomem *pcic_regs;
163volatile int pcic_speculative; 164volatile int pcic_speculative;
164volatile int pcic_trapped; 165volatile int pcic_trapped;
165 166
166static void pci_do_gettimeofday(struct timeval *tv);
167static int pci_do_settimeofday(struct timespec *tv);
168 167
169#define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (((unsigned int)bus) << 16) | (((unsigned int)device_fn) << 8) | (where & ~3)) 168#define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (((unsigned int)bus) << 16) | (((unsigned int)device_fn) << 8) | (where & ~3))
170 169
@@ -586,8 +585,6 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
586 writew(ivec, pcic->pcic_regs+PCI_INT_SELECT_LO); 585 writew(ivec, pcic->pcic_regs+PCI_INT_SELECT_LO);
587 } 586 }
588 } 587 }
589
590 return;
591} 588}
592 589
593/* 590/*
@@ -716,19 +713,27 @@ static irqreturn_t pcic_timer_handler (int irq, void *h)
716#define USECS_PER_JIFFY 10000 /* We have 100HZ "standard" timer for sparc */ 713#define USECS_PER_JIFFY 10000 /* We have 100HZ "standard" timer for sparc */
717#define TICK_TIMER_LIMIT ((100*1000000/4)/100) 714#define TICK_TIMER_LIMIT ((100*1000000/4)/100)
718 715
716u32 pci_gettimeoffset(void)
717{
718 /*
719 * We divide all by 100
720 * to have microsecond resolution and to avoid overflow
721 */
722 unsigned long count =
723 readl(pcic0.pcic_regs+PCI_SYS_COUNTER) & ~PCI_SYS_COUNTER_OVERFLOW;
724 count = ((count/100)*USECS_PER_JIFFY) / (TICK_TIMER_LIMIT/100);
725 return count * 1000;
726}
727
728
719void __init pci_time_init(void) 729void __init pci_time_init(void)
720{ 730{
721 struct linux_pcic *pcic = &pcic0; 731 struct linux_pcic *pcic = &pcic0;
722 unsigned long v; 732 unsigned long v;
723 int timer_irq, irq; 733 int timer_irq, irq;
724 734
725 /* A hack until do_gettimeofday prototype is moved to arch specific headers 735 do_arch_gettimeoffset = pci_gettimeoffset;
726 and btfixupped. Patch do_gettimeofday with ba pci_do_gettimeofday; nop */ 736
727 ((unsigned int *)do_gettimeofday)[0] =
728 0x10800000 | ((((unsigned long)pci_do_gettimeofday -
729 (unsigned long)do_gettimeofday) >> 2) & 0x003fffff);
730 ((unsigned int *)do_gettimeofday)[1] = 0x01000000;
731 BTFIXUPSET_CALL(bus_do_settimeofday, pci_do_settimeofday, BTFIXUPCALL_NORM);
732 btfixup(); 737 btfixup();
733 738
734 writel (TICK_TIMER_LIMIT, pcic->pcic_regs+PCI_SYS_LIMIT); 739 writel (TICK_TIMER_LIMIT, pcic->pcic_regs+PCI_SYS_LIMIT);
@@ -746,84 +751,6 @@ void __init pci_time_init(void)
746 local_irq_enable(); 751 local_irq_enable();
747} 752}
748 753
749static inline unsigned long do_gettimeoffset(void)
750{
751 /*
752 * We divide all by 100
753 * to have microsecond resolution and to avoid overflow
754 */
755 unsigned long count =
756 readl(pcic0.pcic_regs+PCI_SYS_COUNTER) & ~PCI_SYS_COUNTER_OVERFLOW;
757 count = ((count/100)*USECS_PER_JIFFY) / (TICK_TIMER_LIMIT/100);
758 return count;
759}
760
761static void pci_do_gettimeofday(struct timeval *tv)
762{
763 unsigned long flags;
764 unsigned long seq;
765 unsigned long usec, sec;
766 unsigned long max_ntp_tick = tick_usec - tickadj;
767
768 do {
769 seq = read_seqbegin_irqsave(&xtime_lock, flags);
770 usec = do_gettimeoffset();
771
772 /*
773 * If time_adjust is negative then NTP is slowing the clock
774 * so make sure not to go into next possible interval.
775 * Better to lose some accuracy than have time go backwards..
776 */
777 if (unlikely(time_adjust < 0))
778 usec = min(usec, max_ntp_tick);
779
780 sec = xtime.tv_sec;
781 usec += (xtime.tv_nsec / 1000);
782 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
783
784 while (usec >= 1000000) {
785 usec -= 1000000;
786 sec++;
787 }
788
789 tv->tv_sec = sec;
790 tv->tv_usec = usec;
791}
792
793static int pci_do_settimeofday(struct timespec *tv)
794{
795 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
796 return -EINVAL;
797
798 /*
799 * This is revolting. We need to set "xtime" correctly. However, the
800 * value in this location is the value at the most recent update of
801 * wall time. Discover what correction gettimeofday() would have
802 * made, and then undo it!
803 */
804 tv->tv_nsec -= 1000 * do_gettimeoffset();
805 while (tv->tv_nsec < 0) {
806 tv->tv_nsec += NSEC_PER_SEC;
807 tv->tv_sec--;
808 }
809
810 wall_to_monotonic.tv_sec += xtime.tv_sec - tv->tv_sec;
811 wall_to_monotonic.tv_nsec += xtime.tv_nsec - tv->tv_nsec;
812
813 if (wall_to_monotonic.tv_nsec > NSEC_PER_SEC) {
814 wall_to_monotonic.tv_nsec -= NSEC_PER_SEC;
815 wall_to_monotonic.tv_sec++;
816 }
817 if (wall_to_monotonic.tv_nsec < 0) {
818 wall_to_monotonic.tv_nsec += NSEC_PER_SEC;
819 wall_to_monotonic.tv_sec--;
820 }
821
822 xtime.tv_sec = tv->tv_sec;
823 xtime.tv_nsec = tv->tv_nsec;
824 ntp_clear();
825 return 0;
826}
827 754
828#if 0 755#if 0
829static void watchdog_reset() { 756static void watchdog_reset() {
@@ -839,9 +766,10 @@ char * __devinit pcibios_setup(char *str)
839 return str; 766 return str;
840} 767}
841 768
842void pcibios_align_resource(void *data, struct resource *res, 769resource_size_t pcibios_align_resource(void *data, const struct resource *res,
843 resource_size_t size, resource_size_t align) 770 resource_size_t size, resource_size_t align)
844{ 771{
772 return res->start;
845} 773}
846 774
847int pcibios_enable_device(struct pci_dev *pdev, int mask) 775int pcibios_enable_device(struct pci_dev *pdev, int mask)
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
index 2d94e7a03af5..c4a6a50b4849 100644
--- a/arch/sparc/kernel/pcr.c
+++ b/arch/sparc/kernel/pcr.c
@@ -8,6 +8,7 @@
8#include <linux/irq.h> 8#include <linux/irq.h>
9 9
10#include <linux/perf_event.h> 10#include <linux/perf_event.h>
11#include <linux/ftrace.h>
11 12
12#include <asm/pil.h> 13#include <asm/pil.h>
13#include <asm/pcr.h> 14#include <asm/pcr.h>
@@ -34,7 +35,7 @@ unsigned int picl_shift;
34 * Therefore in such situations we defer the work by signalling 35 * Therefore in such situations we defer the work by signalling
35 * a lower level cpu IRQ. 36 * a lower level cpu IRQ.
36 */ 37 */
37void deferred_pcr_work_irq(int irq, struct pt_regs *regs) 38void __irq_entry deferred_pcr_work_irq(int irq, struct pt_regs *regs)
38{ 39{
39 struct pt_regs *old_regs; 40 struct pt_regs *old_regs;
40 41
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index fa5936e1c3b9..e2771939341d 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1,6 +1,6 @@
1/* Performance event support for sparc64. 1/* Performance event support for sparc64.
2 * 2 *
3 * Copyright (C) 2009 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 2009, 2010 David S. Miller <davem@davemloft.net>
4 * 4 *
5 * This code is based almost entirely upon the x86 perf event 5 * This code is based almost entirely upon the x86 perf event
6 * code, which is: 6 * code, which is:
@@ -18,11 +18,15 @@
18#include <linux/kdebug.h> 18#include <linux/kdebug.h>
19#include <linux/mutex.h> 19#include <linux/mutex.h>
20 20
21#include <asm/stacktrace.h>
21#include <asm/cpudata.h> 22#include <asm/cpudata.h>
23#include <asm/uaccess.h>
22#include <asm/atomic.h> 24#include <asm/atomic.h>
23#include <asm/nmi.h> 25#include <asm/nmi.h>
24#include <asm/pcr.h> 26#include <asm/pcr.h>
25 27
28#include "kstack.h"
29
26/* Sparc64 chips have two performance counters, 32-bits each, with 30/* Sparc64 chips have two performance counters, 32-bits each, with
27 * overflow interrupts generated on transition from 0xffffffff to 0. 31 * overflow interrupts generated on transition from 0xffffffff to 0.
28 * The counters are accessed in one go using a 64-bit register. 32 * The counters are accessed in one go using a 64-bit register.
@@ -51,16 +55,49 @@
51 55
52#define PIC_UPPER_INDEX 0 56#define PIC_UPPER_INDEX 0
53#define PIC_LOWER_INDEX 1 57#define PIC_LOWER_INDEX 1
58#define PIC_NO_INDEX -1
54 59
55struct cpu_hw_events { 60struct cpu_hw_events {
56 struct perf_event *events[MAX_HWEVENTS]; 61 /* Number of events currently scheduled onto this cpu.
57 unsigned long used_mask[BITS_TO_LONGS(MAX_HWEVENTS)]; 62 * This tells how many entries in the arrays below
58 unsigned long active_mask[BITS_TO_LONGS(MAX_HWEVENTS)]; 63 * are valid.
64 */
65 int n_events;
66
67 /* Number of new events added since the last hw_perf_disable().
68 * This works because the perf event layer always adds new
69 * events inside of a perf_{disable,enable}() sequence.
70 */
71 int n_added;
72
73 /* Array of events current scheduled on this cpu. */
74 struct perf_event *event[MAX_HWEVENTS];
75
76 /* Array of encoded longs, specifying the %pcr register
77 * encoding and the mask of PIC counters this even can
78 * be scheduled on. See perf_event_encode() et al.
79 */
80 unsigned long events[MAX_HWEVENTS];
81
82 /* The current counter index assigned to an event. When the
83 * event hasn't been programmed into the cpu yet, this will
84 * hold PIC_NO_INDEX. The event->hw.idx value tells us where
85 * we ought to schedule the event.
86 */
87 int current_idx[MAX_HWEVENTS];
88
89 /* Software copy of %pcr register on this cpu. */
59 u64 pcr; 90 u64 pcr;
91
92 /* Enabled/disable state. */
60 int enabled; 93 int enabled;
61}; 94};
62DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; 95DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, };
63 96
97/* An event map describes the characteristics of a performance
98 * counter event. In particular it gives the encoding as well as
99 * a mask telling which counters the event can be measured on.
100 */
64struct perf_event_map { 101struct perf_event_map {
65 u16 encoding; 102 u16 encoding;
66 u8 pic_mask; 103 u8 pic_mask;
@@ -69,15 +106,20 @@ struct perf_event_map {
69#define PIC_LOWER 0x02 106#define PIC_LOWER 0x02
70}; 107};
71 108
109/* Encode a perf_event_map entry into a long. */
72static unsigned long perf_event_encode(const struct perf_event_map *pmap) 110static unsigned long perf_event_encode(const struct perf_event_map *pmap)
73{ 111{
74 return ((unsigned long) pmap->encoding << 16) | pmap->pic_mask; 112 return ((unsigned long) pmap->encoding << 16) | pmap->pic_mask;
75} 113}
76 114
77static void perf_event_decode(unsigned long val, u16 *enc, u8 *msk) 115static u8 perf_event_get_msk(unsigned long val)
78{ 116{
79 *msk = val & 0xff; 117 return val & 0xff;
80 *enc = val >> 16; 118}
119
120static u64 perf_event_get_enc(unsigned long val)
121{
122 return val >> 16;
81} 123}
82 124
83#define C(x) PERF_COUNT_HW_CACHE_##x 125#define C(x) PERF_COUNT_HW_CACHE_##x
@@ -491,53 +533,6 @@ static inline void sparc_pmu_disable_event(struct cpu_hw_events *cpuc, struct hw
491 pcr_ops->write(cpuc->pcr); 533 pcr_ops->write(cpuc->pcr);
492} 534}
493 535
494void hw_perf_enable(void)
495{
496 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
497 u64 val;
498 int i;
499
500 if (cpuc->enabled)
501 return;
502
503 cpuc->enabled = 1;
504 barrier();
505
506 val = cpuc->pcr;
507
508 for (i = 0; i < MAX_HWEVENTS; i++) {
509 struct perf_event *cp = cpuc->events[i];
510 struct hw_perf_event *hwc;
511
512 if (!cp)
513 continue;
514 hwc = &cp->hw;
515 val |= hwc->config_base;
516 }
517
518 cpuc->pcr = val;
519
520 pcr_ops->write(cpuc->pcr);
521}
522
523void hw_perf_disable(void)
524{
525 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
526 u64 val;
527
528 if (!cpuc->enabled)
529 return;
530
531 cpuc->enabled = 0;
532
533 val = cpuc->pcr;
534 val &= ~(PCR_UTRACE | PCR_STRACE |
535 sparc_pmu->hv_bit | sparc_pmu->irq_bit);
536 cpuc->pcr = val;
537
538 pcr_ops->write(cpuc->pcr);
539}
540
541static u32 read_pmc(int idx) 536static u32 read_pmc(int idx)
542{ 537{
543 u64 val; 538 u64 val;
@@ -566,6 +561,30 @@ static void write_pmc(int idx, u64 val)
566 write_pic(pic); 561 write_pic(pic);
567} 562}
568 563
564static u64 sparc_perf_event_update(struct perf_event *event,
565 struct hw_perf_event *hwc, int idx)
566{
567 int shift = 64 - 32;
568 u64 prev_raw_count, new_raw_count;
569 s64 delta;
570
571again:
572 prev_raw_count = atomic64_read(&hwc->prev_count);
573 new_raw_count = read_pmc(idx);
574
575 if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count,
576 new_raw_count) != prev_raw_count)
577 goto again;
578
579 delta = (new_raw_count << shift) - (prev_raw_count << shift);
580 delta >>= shift;
581
582 atomic64_add(delta, &event->count);
583 atomic64_sub(delta, &hwc->period_left);
584
585 return new_raw_count;
586}
587
569static int sparc_perf_event_set_period(struct perf_event *event, 588static int sparc_perf_event_set_period(struct perf_event *event,
570 struct hw_perf_event *hwc, int idx) 589 struct hw_perf_event *hwc, int idx)
571{ 590{
@@ -598,81 +617,166 @@ static int sparc_perf_event_set_period(struct perf_event *event,
598 return ret; 617 return ret;
599} 618}
600 619
601static int sparc_pmu_enable(struct perf_event *event) 620/* If performance event entries have been added, move existing
621 * events around (if necessary) and then assign new entries to
622 * counters.
623 */
624static u64 maybe_change_configuration(struct cpu_hw_events *cpuc, u64 pcr)
602{ 625{
603 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 626 int i;
604 struct hw_perf_event *hwc = &event->hw;
605 int idx = hwc->idx;
606 627
607 if (test_and_set_bit(idx, cpuc->used_mask)) 628 if (!cpuc->n_added)
608 return -EAGAIN; 629 goto out;
609 630
610 sparc_pmu_disable_event(cpuc, hwc, idx); 631 /* Read in the counters which are moving. */
632 for (i = 0; i < cpuc->n_events; i++) {
633 struct perf_event *cp = cpuc->event[i];
611 634
612 cpuc->events[idx] = event; 635 if (cpuc->current_idx[i] != PIC_NO_INDEX &&
613 set_bit(idx, cpuc->active_mask); 636 cpuc->current_idx[i] != cp->hw.idx) {
637 sparc_perf_event_update(cp, &cp->hw,
638 cpuc->current_idx[i]);
639 cpuc->current_idx[i] = PIC_NO_INDEX;
640 }
641 }
614 642
615 sparc_perf_event_set_period(event, hwc, idx); 643 /* Assign to counters all unassigned events. */
616 sparc_pmu_enable_event(cpuc, hwc, idx); 644 for (i = 0; i < cpuc->n_events; i++) {
617 perf_event_update_userpage(event); 645 struct perf_event *cp = cpuc->event[i];
618 return 0; 646 struct hw_perf_event *hwc = &cp->hw;
647 int idx = hwc->idx;
648 u64 enc;
649
650 if (cpuc->current_idx[i] != PIC_NO_INDEX)
651 continue;
652
653 sparc_perf_event_set_period(cp, hwc, idx);
654 cpuc->current_idx[i] = idx;
655
656 enc = perf_event_get_enc(cpuc->events[i]);
657 pcr |= event_encoding(enc, idx);
658 }
659out:
660 return pcr;
619} 661}
620 662
621static u64 sparc_perf_event_update(struct perf_event *event, 663void hw_perf_enable(void)
622 struct hw_perf_event *hwc, int idx)
623{ 664{
624 int shift = 64 - 32; 665 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
625 u64 prev_raw_count, new_raw_count; 666 u64 pcr;
626 s64 delta;
627 667
628again: 668 if (cpuc->enabled)
629 prev_raw_count = atomic64_read(&hwc->prev_count); 669 return;
630 new_raw_count = read_pmc(idx);
631 670
632 if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count, 671 cpuc->enabled = 1;
633 new_raw_count) != prev_raw_count) 672 barrier();
634 goto again;
635 673
636 delta = (new_raw_count << shift) - (prev_raw_count << shift); 674 pcr = cpuc->pcr;
637 delta >>= shift; 675 if (!cpuc->n_events) {
676 pcr = 0;
677 } else {
678 pcr = maybe_change_configuration(cpuc, pcr);
638 679
639 atomic64_add(delta, &event->count); 680 /* We require that all of the events have the same
640 atomic64_sub(delta, &hwc->period_left); 681 * configuration, so just fetch the settings from the
682 * first entry.
683 */
684 cpuc->pcr = pcr | cpuc->event[0]->hw.config_base;
685 }
641 686
642 return new_raw_count; 687 pcr_ops->write(cpuc->pcr);
688}
689
690void hw_perf_disable(void)
691{
692 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
693 u64 val;
694
695 if (!cpuc->enabled)
696 return;
697
698 cpuc->enabled = 0;
699 cpuc->n_added = 0;
700
701 val = cpuc->pcr;
702 val &= ~(PCR_UTRACE | PCR_STRACE |
703 sparc_pmu->hv_bit | sparc_pmu->irq_bit);
704 cpuc->pcr = val;
705
706 pcr_ops->write(cpuc->pcr);
643} 707}
644 708
645static void sparc_pmu_disable(struct perf_event *event) 709static void sparc_pmu_disable(struct perf_event *event)
646{ 710{
647 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 711 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
648 struct hw_perf_event *hwc = &event->hw; 712 struct hw_perf_event *hwc = &event->hw;
649 int idx = hwc->idx; 713 unsigned long flags;
714 int i;
650 715
651 clear_bit(idx, cpuc->active_mask); 716 local_irq_save(flags);
652 sparc_pmu_disable_event(cpuc, hwc, idx); 717 perf_disable();
718
719 for (i = 0; i < cpuc->n_events; i++) {
720 if (event == cpuc->event[i]) {
721 int idx = cpuc->current_idx[i];
722
723 /* Shift remaining entries down into
724 * the existing slot.
725 */
726 while (++i < cpuc->n_events) {
727 cpuc->event[i - 1] = cpuc->event[i];
728 cpuc->events[i - 1] = cpuc->events[i];
729 cpuc->current_idx[i - 1] =
730 cpuc->current_idx[i];
731 }
732
733 /* Absorb the final count and turn off the
734 * event.
735 */
736 sparc_pmu_disable_event(cpuc, hwc, idx);
737 barrier();
738 sparc_perf_event_update(event, hwc, idx);
653 739
654 barrier(); 740 perf_event_update_userpage(event);
655 741
656 sparc_perf_event_update(event, hwc, idx); 742 cpuc->n_events--;
657 cpuc->events[idx] = NULL; 743 break;
658 clear_bit(idx, cpuc->used_mask); 744 }
745 }
659 746
660 perf_event_update_userpage(event); 747 perf_enable();
748 local_irq_restore(flags);
749}
750
751static int active_event_index(struct cpu_hw_events *cpuc,
752 struct perf_event *event)
753{
754 int i;
755
756 for (i = 0; i < cpuc->n_events; i++) {
757 if (cpuc->event[i] == event)
758 break;
759 }
760 BUG_ON(i == cpuc->n_events);
761 return cpuc->current_idx[i];
661} 762}
662 763
663static void sparc_pmu_read(struct perf_event *event) 764static void sparc_pmu_read(struct perf_event *event)
664{ 765{
766 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
767 int idx = active_event_index(cpuc, event);
665 struct hw_perf_event *hwc = &event->hw; 768 struct hw_perf_event *hwc = &event->hw;
666 769
667 sparc_perf_event_update(event, hwc, hwc->idx); 770 sparc_perf_event_update(event, hwc, idx);
668} 771}
669 772
670static void sparc_pmu_unthrottle(struct perf_event *event) 773static void sparc_pmu_unthrottle(struct perf_event *event)
671{ 774{
672 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 775 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
776 int idx = active_event_index(cpuc, event);
673 struct hw_perf_event *hwc = &event->hw; 777 struct hw_perf_event *hwc = &event->hw;
674 778
675 sparc_pmu_enable_event(cpuc, hwc, hwc->idx); 779 sparc_pmu_enable_event(cpuc, hwc, idx);
676} 780}
677 781
678static atomic_t active_events = ATOMIC_INIT(0); 782static atomic_t active_events = ATOMIC_INIT(0);
@@ -750,43 +854,75 @@ static void hw_perf_event_destroy(struct perf_event *event)
750/* Make sure all events can be scheduled into the hardware at 854/* Make sure all events can be scheduled into the hardware at
751 * the same time. This is simplified by the fact that we only 855 * the same time. This is simplified by the fact that we only
752 * need to support 2 simultaneous HW events. 856 * need to support 2 simultaneous HW events.
857 *
858 * As a side effect, the evts[]->hw.idx values will be assigned
859 * on success. These are pending indexes. When the events are
860 * actually programmed into the chip, these values will propagate
861 * to the per-cpu cpuc->current_idx[] slots, see the code in
862 * maybe_change_configuration() for details.
753 */ 863 */
754static int sparc_check_constraints(unsigned long *events, int n_ev) 864static int sparc_check_constraints(struct perf_event **evts,
865 unsigned long *events, int n_ev)
755{ 866{
756 if (n_ev <= perf_max_events) { 867 u8 msk0 = 0, msk1 = 0;
757 u8 msk1, msk2; 868 int idx0 = 0;
758 u16 dummy; 869
759 870 /* This case is possible when we are invoked from
760 if (n_ev == 1) 871 * hw_perf_group_sched_in().
761 return 0; 872 */
762 BUG_ON(n_ev != 2); 873 if (!n_ev)
763 perf_event_decode(events[0], &dummy, &msk1); 874 return 0;
764 perf_event_decode(events[1], &dummy, &msk2); 875
765 876 if (n_ev > perf_max_events)
766 /* If both events can go on any counter, OK. */ 877 return -1;
767 if (msk1 == (PIC_UPPER | PIC_LOWER) && 878
768 msk2 == (PIC_UPPER | PIC_LOWER)) 879 msk0 = perf_event_get_msk(events[0]);
769 return 0; 880 if (n_ev == 1) {
770 881 if (msk0 & PIC_LOWER)
771 /* If one event is limited to a specific counter, 882 idx0 = 1;
772 * and the other can go on both, OK. 883 goto success;
773 */ 884 }
774 if ((msk1 == PIC_UPPER || msk1 == PIC_LOWER) && 885 BUG_ON(n_ev != 2);
775 msk2 == (PIC_UPPER | PIC_LOWER)) 886 msk1 = perf_event_get_msk(events[1]);
776 return 0; 887
777 if ((msk2 == PIC_UPPER || msk2 == PIC_LOWER) && 888 /* If both events can go on any counter, OK. */
778 msk1 == (PIC_UPPER | PIC_LOWER)) 889 if (msk0 == (PIC_UPPER | PIC_LOWER) &&
779 return 0; 890 msk1 == (PIC_UPPER | PIC_LOWER))
780 891 goto success;
781 /* If the events are fixed to different counters, OK. */ 892
782 if ((msk1 == PIC_UPPER && msk2 == PIC_LOWER) || 893 /* If one event is limited to a specific counter,
783 (msk1 == PIC_LOWER && msk2 == PIC_UPPER)) 894 * and the other can go on both, OK.
784 return 0; 895 */
785 896 if ((msk0 == PIC_UPPER || msk0 == PIC_LOWER) &&
786 /* Otherwise, there is a conflict. */ 897 msk1 == (PIC_UPPER | PIC_LOWER)) {
898 if (msk0 & PIC_LOWER)
899 idx0 = 1;
900 goto success;
787 } 901 }
788 902
903 if ((msk1 == PIC_UPPER || msk1 == PIC_LOWER) &&
904 msk0 == (PIC_UPPER | PIC_LOWER)) {
905 if (msk1 & PIC_UPPER)
906 idx0 = 1;
907 goto success;
908 }
909
910 /* If the events are fixed to different counters, OK. */
911 if ((msk0 == PIC_UPPER && msk1 == PIC_LOWER) ||
912 (msk0 == PIC_LOWER && msk1 == PIC_UPPER)) {
913 if (msk0 & PIC_LOWER)
914 idx0 = 1;
915 goto success;
916 }
917
918 /* Otherwise, there is a conflict. */
789 return -1; 919 return -1;
920
921success:
922 evts[0]->hw.idx = idx0;
923 if (n_ev == 2)
924 evts[1]->hw.idx = idx0 ^ 1;
925 return 0;
790} 926}
791 927
792static int check_excludes(struct perf_event **evts, int n_prev, int n_new) 928static int check_excludes(struct perf_event **evts, int n_prev, int n_new)
@@ -818,7 +954,8 @@ static int check_excludes(struct perf_event **evts, int n_prev, int n_new)
818} 954}
819 955
820static int collect_events(struct perf_event *group, int max_count, 956static int collect_events(struct perf_event *group, int max_count,
821 struct perf_event *evts[], unsigned long *events) 957 struct perf_event *evts[], unsigned long *events,
958 int *current_idx)
822{ 959{
823 struct perf_event *event; 960 struct perf_event *event;
824 int n = 0; 961 int n = 0;
@@ -827,7 +964,8 @@ static int collect_events(struct perf_event *group, int max_count,
827 if (n >= max_count) 964 if (n >= max_count)
828 return -1; 965 return -1;
829 evts[n] = group; 966 evts[n] = group;
830 events[n++] = group->hw.event_base; 967 events[n] = group->hw.event_base;
968 current_idx[n++] = PIC_NO_INDEX;
831 } 969 }
832 list_for_each_entry(event, &group->sibling_list, group_entry) { 970 list_for_each_entry(event, &group->sibling_list, group_entry) {
833 if (!is_software_event(event) && 971 if (!is_software_event(event) &&
@@ -835,20 +973,100 @@ static int collect_events(struct perf_event *group, int max_count,
835 if (n >= max_count) 973 if (n >= max_count)
836 return -1; 974 return -1;
837 evts[n] = event; 975 evts[n] = event;
838 events[n++] = event->hw.event_base; 976 events[n] = event->hw.event_base;
977 current_idx[n++] = PIC_NO_INDEX;
839 } 978 }
840 } 979 }
841 return n; 980 return n;
842} 981}
843 982
983static void event_sched_in(struct perf_event *event)
984{
985 event->state = PERF_EVENT_STATE_ACTIVE;
986 event->oncpu = smp_processor_id();
987 event->tstamp_running += event->ctx->time - event->tstamp_stopped;
988 if (is_software_event(event))
989 event->pmu->enable(event);
990}
991
992int hw_perf_group_sched_in(struct perf_event *group_leader,
993 struct perf_cpu_context *cpuctx,
994 struct perf_event_context *ctx)
995{
996 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
997 struct perf_event *sub;
998 int n0, n;
999
1000 if (!sparc_pmu)
1001 return 0;
1002
1003 n0 = cpuc->n_events;
1004 n = collect_events(group_leader, perf_max_events - n0,
1005 &cpuc->event[n0], &cpuc->events[n0],
1006 &cpuc->current_idx[n0]);
1007 if (n < 0)
1008 return -EAGAIN;
1009 if (check_excludes(cpuc->event, n0, n))
1010 return -EINVAL;
1011 if (sparc_check_constraints(cpuc->event, cpuc->events, n + n0))
1012 return -EAGAIN;
1013 cpuc->n_events = n0 + n;
1014 cpuc->n_added += n;
1015
1016 cpuctx->active_oncpu += n;
1017 n = 1;
1018 event_sched_in(group_leader);
1019 list_for_each_entry(sub, &group_leader->sibling_list, group_entry) {
1020 if (sub->state != PERF_EVENT_STATE_OFF) {
1021 event_sched_in(sub);
1022 n++;
1023 }
1024 }
1025 ctx->nr_active += n;
1026
1027 return 1;
1028}
1029
1030static int sparc_pmu_enable(struct perf_event *event)
1031{
1032 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1033 int n0, ret = -EAGAIN;
1034 unsigned long flags;
1035
1036 local_irq_save(flags);
1037 perf_disable();
1038
1039 n0 = cpuc->n_events;
1040 if (n0 >= perf_max_events)
1041 goto out;
1042
1043 cpuc->event[n0] = event;
1044 cpuc->events[n0] = event->hw.event_base;
1045 cpuc->current_idx[n0] = PIC_NO_INDEX;
1046
1047 if (check_excludes(cpuc->event, n0, 1))
1048 goto out;
1049 if (sparc_check_constraints(cpuc->event, cpuc->events, n0 + 1))
1050 goto out;
1051
1052 cpuc->n_events++;
1053 cpuc->n_added++;
1054
1055 ret = 0;
1056out:
1057 perf_enable();
1058 local_irq_restore(flags);
1059 return ret;
1060}
1061
844static int __hw_perf_event_init(struct perf_event *event) 1062static int __hw_perf_event_init(struct perf_event *event)
845{ 1063{
846 struct perf_event_attr *attr = &event->attr; 1064 struct perf_event_attr *attr = &event->attr;
847 struct perf_event *evts[MAX_HWEVENTS]; 1065 struct perf_event *evts[MAX_HWEVENTS];
848 struct hw_perf_event *hwc = &event->hw; 1066 struct hw_perf_event *hwc = &event->hw;
849 unsigned long events[MAX_HWEVENTS]; 1067 unsigned long events[MAX_HWEVENTS];
1068 int current_idx_dmy[MAX_HWEVENTS];
850 const struct perf_event_map *pmap; 1069 const struct perf_event_map *pmap;
851 u64 enc;
852 int n; 1070 int n;
853 1071
854 if (atomic_read(&nmi_active) < 0) 1072 if (atomic_read(&nmi_active) < 0)
@@ -865,10 +1083,7 @@ static int __hw_perf_event_init(struct perf_event *event)
865 } else 1083 } else
866 return -EOPNOTSUPP; 1084 return -EOPNOTSUPP;
867 1085
868 /* We save the enable bits in the config_base. So to 1086 /* We save the enable bits in the config_base. */
869 * turn off sampling just write 'config', and to enable
870 * things write 'config | config_base'.
871 */
872 hwc->config_base = sparc_pmu->irq_bit; 1087 hwc->config_base = sparc_pmu->irq_bit;
873 if (!attr->exclude_user) 1088 if (!attr->exclude_user)
874 hwc->config_base |= PCR_UTRACE; 1089 hwc->config_base |= PCR_UTRACE;
@@ -879,13 +1094,11 @@ static int __hw_perf_event_init(struct perf_event *event)
879 1094
880 hwc->event_base = perf_event_encode(pmap); 1095 hwc->event_base = perf_event_encode(pmap);
881 1096
882 enc = pmap->encoding;
883
884 n = 0; 1097 n = 0;
885 if (event->group_leader != event) { 1098 if (event->group_leader != event) {
886 n = collect_events(event->group_leader, 1099 n = collect_events(event->group_leader,
887 perf_max_events - 1, 1100 perf_max_events - 1,
888 evts, events); 1101 evts, events, current_idx_dmy);
889 if (n < 0) 1102 if (n < 0)
890 return -EINVAL; 1103 return -EINVAL;
891 } 1104 }
@@ -895,9 +1108,11 @@ static int __hw_perf_event_init(struct perf_event *event)
895 if (check_excludes(evts, n, 1)) 1108 if (check_excludes(evts, n, 1))
896 return -EINVAL; 1109 return -EINVAL;
897 1110
898 if (sparc_check_constraints(events, n + 1)) 1111 if (sparc_check_constraints(evts, events, n + 1))
899 return -EINVAL; 1112 return -EINVAL;
900 1113
1114 hwc->idx = PIC_NO_INDEX;
1115
901 /* Try to do all error checking before this point, as unwinding 1116 /* Try to do all error checking before this point, as unwinding
902 * state after grabbing the PMC is difficult. 1117 * state after grabbing the PMC is difficult.
903 */ 1118 */
@@ -910,15 +1125,6 @@ static int __hw_perf_event_init(struct perf_event *event)
910 atomic64_set(&hwc->period_left, hwc->sample_period); 1125 atomic64_set(&hwc->period_left, hwc->sample_period);
911 } 1126 }
912 1127
913 if (pmap->pic_mask & PIC_UPPER) {
914 hwc->idx = PIC_UPPER_INDEX;
915 enc <<= sparc_pmu->upper_shift;
916 } else {
917 hwc->idx = PIC_LOWER_INDEX;
918 enc <<= sparc_pmu->lower_shift;
919 }
920
921 hwc->config |= enc;
922 return 0; 1128 return 0;
923} 1129}
924 1130
@@ -968,7 +1174,7 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
968 struct perf_sample_data data; 1174 struct perf_sample_data data;
969 struct cpu_hw_events *cpuc; 1175 struct cpu_hw_events *cpuc;
970 struct pt_regs *regs; 1176 struct pt_regs *regs;
971 int idx; 1177 int i;
972 1178
973 if (!atomic_read(&active_events)) 1179 if (!atomic_read(&active_events))
974 return NOTIFY_DONE; 1180 return NOTIFY_DONE;
@@ -983,16 +1189,26 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
983 1189
984 regs = args->regs; 1190 regs = args->regs;
985 1191
986 data.addr = 0; 1192 perf_sample_data_init(&data, 0);
987 1193
988 cpuc = &__get_cpu_var(cpu_hw_events); 1194 cpuc = &__get_cpu_var(cpu_hw_events);
989 for (idx = 0; idx < MAX_HWEVENTS; idx++) { 1195
990 struct perf_event *event = cpuc->events[idx]; 1196 /* If the PMU has the TOE IRQ enable bits, we need to do a
1197 * dummy write to the %pcr to clear the overflow bits and thus
1198 * the interrupt.
1199 *
1200 * Do this before we peek at the counters to determine
1201 * overflow so we don't lose any events.
1202 */
1203 if (sparc_pmu->irq_bit)
1204 pcr_ops->write(cpuc->pcr);
1205
1206 for (i = 0; i < cpuc->n_events; i++) {
1207 struct perf_event *event = cpuc->event[i];
1208 int idx = cpuc->current_idx[i];
991 struct hw_perf_event *hwc; 1209 struct hw_perf_event *hwc;
992 u64 val; 1210 u64 val;
993 1211
994 if (!test_bit(idx, cpuc->active_mask))
995 continue;
996 hwc = &event->hw; 1212 hwc = &event->hw;
997 val = sparc_perf_event_update(event, hwc, idx); 1213 val = sparc_perf_event_update(event, hwc, idx);
998 if (val & (1ULL << 31)) 1214 if (val & (1ULL << 31))
@@ -1044,10 +1260,122 @@ void __init init_hw_perf_events(void)
1044 1260
1045 pr_cont("Supported PMU type is '%s'\n", sparc_pmu_type); 1261 pr_cont("Supported PMU type is '%s'\n", sparc_pmu_type);
1046 1262
1047 /* All sparc64 PMUs currently have 2 events. But this simple 1263 /* All sparc64 PMUs currently have 2 events. */
1048 * driver only supports one active event at a time. 1264 perf_max_events = 2;
1049 */
1050 perf_max_events = 1;
1051 1265
1052 register_die_notifier(&perf_event_nmi_notifier); 1266 register_die_notifier(&perf_event_nmi_notifier);
1053} 1267}
1268
1269static inline void callchain_store(struct perf_callchain_entry *entry, u64 ip)
1270{
1271 if (entry->nr < PERF_MAX_STACK_DEPTH)
1272 entry->ip[entry->nr++] = ip;
1273}
1274
1275static void perf_callchain_kernel(struct pt_regs *regs,
1276 struct perf_callchain_entry *entry)
1277{
1278 unsigned long ksp, fp;
1279
1280 callchain_store(entry, PERF_CONTEXT_KERNEL);
1281 callchain_store(entry, regs->tpc);
1282
1283 ksp = regs->u_regs[UREG_I6];
1284 fp = ksp + STACK_BIAS;
1285 do {
1286 struct sparc_stackf *sf;
1287 struct pt_regs *regs;
1288 unsigned long pc;
1289
1290 if (!kstack_valid(current_thread_info(), fp))
1291 break;
1292
1293 sf = (struct sparc_stackf *) fp;
1294 regs = (struct pt_regs *) (sf + 1);
1295
1296 if (kstack_is_trap_frame(current_thread_info(), regs)) {
1297 if (user_mode(regs))
1298 break;
1299 pc = regs->tpc;
1300 fp = regs->u_regs[UREG_I6] + STACK_BIAS;
1301 } else {
1302 pc = sf->callers_pc;
1303 fp = (unsigned long)sf->fp + STACK_BIAS;
1304 }
1305 callchain_store(entry, pc);
1306 } while (entry->nr < PERF_MAX_STACK_DEPTH);
1307}
1308
1309static void perf_callchain_user_64(struct pt_regs *regs,
1310 struct perf_callchain_entry *entry)
1311{
1312 unsigned long ufp;
1313
1314 callchain_store(entry, PERF_CONTEXT_USER);
1315 callchain_store(entry, regs->tpc);
1316
1317 ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
1318 do {
1319 struct sparc_stackf *usf, sf;
1320 unsigned long pc;
1321
1322 usf = (struct sparc_stackf *) ufp;
1323 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1324 break;
1325
1326 pc = sf.callers_pc;
1327 ufp = (unsigned long)sf.fp + STACK_BIAS;
1328 callchain_store(entry, pc);
1329 } while (entry->nr < PERF_MAX_STACK_DEPTH);
1330}
1331
1332static void perf_callchain_user_32(struct pt_regs *regs,
1333 struct perf_callchain_entry *entry)
1334{
1335 unsigned long ufp;
1336
1337 callchain_store(entry, PERF_CONTEXT_USER);
1338 callchain_store(entry, regs->tpc);
1339
1340 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
1341 do {
1342 struct sparc_stackf32 *usf, sf;
1343 unsigned long pc;
1344
1345 usf = (struct sparc_stackf32 *) ufp;
1346 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1347 break;
1348
1349 pc = sf.callers_pc;
1350 ufp = (unsigned long)sf.fp;
1351 callchain_store(entry, pc);
1352 } while (entry->nr < PERF_MAX_STACK_DEPTH);
1353}
1354
1355/* Like powerpc we can't get PMU interrupts within the PMU handler,
1356 * so no need for separate NMI and IRQ chains as on x86.
1357 */
1358static DEFINE_PER_CPU(struct perf_callchain_entry, callchain);
1359
1360struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
1361{
1362 struct perf_callchain_entry *entry = &__get_cpu_var(callchain);
1363
1364 entry->nr = 0;
1365 if (!user_mode(regs)) {
1366 stack_trace_flush();
1367 perf_callchain_kernel(regs, entry);
1368 if (current->mm)
1369 regs = task_pt_regs(current);
1370 else
1371 regs = NULL;
1372 }
1373 if (regs) {
1374 flushw_user();
1375 if (test_thread_flag(TIF_32BIT))
1376 perf_callchain_user_32(regs, entry);
1377 else
1378 perf_callchain_user_64(regs, entry);
1379 }
1380 return entry;
1381}
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 2830b415e214..40e29fc8a4d6 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -17,13 +17,13 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/stddef.h> 18#include <linux/stddef.h>
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/slab.h>
21#include <linux/user.h> 20#include <linux/user.h>
22#include <linux/smp.h> 21#include <linux/smp.h>
23#include <linux/reboot.h> 22#include <linux/reboot.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/pm.h> 24#include <linux/pm.h>
26#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/slab.h>
27 27
28#include <asm/auxio.h> 28#include <asm/auxio.h>
29#include <asm/oplib.h> 29#include <asm/oplib.h>
@@ -526,7 +526,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
526 * Set some valid stack frames to give to the child. 526 * Set some valid stack frames to give to the child.
527 */ 527 */
528 childstack = (struct sparc_stackf __user *) 528 childstack = (struct sparc_stackf __user *)
529 (sp & ~0x7UL); 529 (sp & ~0xfUL);
530 parentstack = (struct sparc_stackf __user *) 530 parentstack = (struct sparc_stackf __user *)
531 regs->u_regs[UREG_FP]; 531 regs->u_regs[UREG_FP];
532 532
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index 18d67854a1b8..a5cf3864b31f 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -352,12 +352,6 @@ void exit_thread(void)
352 else 352 else
353 t->utraps[0]--; 353 t->utraps[0]--;
354 } 354 }
355
356 if (test_and_clear_thread_flag(TIF_PERFCTR)) {
357 t->user_cntd0 = t->user_cntd1 = NULL;
358 t->pcr_reg = 0;
359 write_pcr(0);
360 }
361} 355}
362 356
363void flush_thread(void) 357void flush_thread(void)
@@ -365,27 +359,12 @@ void flush_thread(void)
365 struct thread_info *t = current_thread_info(); 359 struct thread_info *t = current_thread_info();
366 struct mm_struct *mm; 360 struct mm_struct *mm;
367 361
368 if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
369 clear_ti_thread_flag(t, TIF_ABI_PENDING);
370 if (test_ti_thread_flag(t, TIF_32BIT))
371 clear_ti_thread_flag(t, TIF_32BIT);
372 else
373 set_ti_thread_flag(t, TIF_32BIT);
374 }
375
376 mm = t->task->mm; 362 mm = t->task->mm;
377 if (mm) 363 if (mm)
378 tsb_context_switch(mm); 364 tsb_context_switch(mm);
379 365
380 set_thread_wsaved(0); 366 set_thread_wsaved(0);
381 367
382 /* Turn off performance counters if on. */
383 if (test_and_clear_thread_flag(TIF_PERFCTR)) {
384 t->user_cntd0 = t->user_cntd1 = NULL;
385 t->pcr_reg = 0;
386 write_pcr(0);
387 }
388
389 /* Clear FPU register state. */ 368 /* Clear FPU register state. */
390 t->fpsaved[0] = 0; 369 t->fpsaved[0] = 0;
391 370
@@ -406,11 +385,11 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
406 } else 385 } else
407 __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6])); 386 __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
408 387
409 /* Now 8-byte align the stack as this is mandatory in the 388 /* Now align the stack as this is mandatory in the Sparc ABI
410 * Sparc ABI due to how register windows work. This hides 389 * due to how register windows work. This hides the
411 * the restriction from thread libraries etc. -DaveM 390 * restriction from thread libraries etc.
412 */ 391 */
413 csp &= ~7UL; 392 csp &= ~15UL;
414 393
415 distance = fp - psp; 394 distance = fp - psp;
416 rval = (csp - distance); 395 rval = (csp - distance);
@@ -599,16 +578,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
599 t->kregs->u_regs[UREG_FP] = 578 t->kregs->u_regs[UREG_FP] =
600 ((unsigned long) child_sf) - STACK_BIAS; 579 ((unsigned long) child_sf) - STACK_BIAS;
601 580
602 /* Special case, if we are spawning a kernel thread from
603 * a userspace task (usermode helper, NFS or similar), we
604 * must disable performance counters in the child because
605 * the address space and protection realm are changing.
606 */
607 if (t->flags & _TIF_PERFCTR) {
608 t->user_cntd0 = t->user_cntd1 = NULL;
609 t->pcr_reg = 0;
610 t->flags &= ~_TIF_PERFCTR;
611 }
612 t->flags |= ((long)ASI_P << TI_FLAG_CURRENT_DS_SHIFT); 581 t->flags |= ((long)ASI_P << TI_FLAG_CURRENT_DS_SHIFT);
613 t->kregs->u_regs[UREG_G6] = (unsigned long) t; 582 t->kregs->u_regs[UREG_G6] = (unsigned long) t;
614 t->kregs->u_regs[UREG_G4] = (unsigned long) t->task; 583 t->kregs->u_regs[UREG_G4] = (unsigned long) t->task;
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index 453397fe5e14..a8591ef2636d 100644
--- a/arch/sparc/kernel/prom.h
+++ b/arch/sparc/kernel/prom.h
@@ -4,9 +4,6 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <asm/prom.h> 5#include <asm/prom.h>
6 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); 7extern void * prom_early_alloc(unsigned long size);
11extern void irq_trans_init(struct device_node *dp); 8extern void irq_trans_init(struct device_node *dp);
12 9
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index d80a65d9e893..57ac9e28be0c 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -37,18 +37,6 @@ EXPORT_SYMBOL(of_console_path);
37char *of_console_options; 37char *of_console_options;
38EXPORT_SYMBOL(of_console_options); 38EXPORT_SYMBOL(of_console_options);
39 39
40struct device_node *of_find_node_by_phandle(phandle handle)
41{
42 struct device_node *np;
43
44 for (np = allnodes; np; np = np->allnext)
45 if (np->node == handle)
46 break;
47
48 return np;
49}
50EXPORT_SYMBOL(of_find_node_by_phandle);
51
52int of_getintprop_default(struct device_node *np, const char *name, int def) 40int of_getintprop_default(struct device_node *np, const char *name, int def)
53{ 41{
54 struct property *prop; 42 struct property *prop;
@@ -89,7 +77,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
89 void *old_val = prop->value; 77 void *old_val = prop->value;
90 int ret; 78 int ret;
91 79
92 ret = prom_setprop(dp->node, name, val, len); 80 ret = prom_setprop(dp->phandle, name, val, len);
93 81
94 err = -EINVAL; 82 err = -EINVAL;
95 if (ret >= 0) { 83 if (ret >= 0) {
@@ -236,7 +224,7 @@ static struct device_node * __init prom_create_node(phandle node,
236 224
237 dp->name = get_one_property(node, "name"); 225 dp->name = get_one_property(node, "name");
238 dp->type = get_one_property(node, "device_type"); 226 dp->type = get_one_property(node, "device_type");
239 dp->node = node; 227 dp->phandle = node;
240 228
241 dp->properties = build_prop_list(node); 229 dp->properties = build_prop_list(node);
242 230
@@ -313,7 +301,7 @@ void __init prom_build_devicetree(void)
313 301
314 nextp = &allnodes->allnext; 302 nextp = &allnodes->allnext;
315 allnodes->child = prom_build_tree(allnodes, 303 allnodes->child = prom_build_tree(allnodes,
316 prom_getchild(allnodes->node), 304 prom_getchild(allnodes->phandle),
317 &nextp); 305 &nextp);
318 of_console_init(); 306 of_console_init();
319 307
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
index 7e3dfd9bb97e..e608f397e11f 100644
--- a/arch/sparc/kernel/ptrace_32.c
+++ b/arch/sparc/kernel/ptrace_32.c
@@ -65,6 +65,7 @@ static int genregs32_get(struct task_struct *target,
65 *k++ = regs->u_regs[pos++]; 65 *k++ = regs->u_regs[pos++];
66 66
67 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 67 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
68 reg_window -= 16;
68 for (; count > 0 && pos < 32; count--) { 69 for (; count > 0 && pos < 32; count--) {
69 if (get_user(*k++, &reg_window[pos++])) 70 if (get_user(*k++, &reg_window[pos++]))
70 return -EFAULT; 71 return -EFAULT;
@@ -76,6 +77,7 @@ static int genregs32_get(struct task_struct *target,
76 } 77 }
77 78
78 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 79 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
80 reg_window -= 16;
79 for (; count > 0 && pos < 32; count--) { 81 for (; count > 0 && pos < 32; count--) {
80 if (get_user(reg, &reg_window[pos++]) || 82 if (get_user(reg, &reg_window[pos++]) ||
81 put_user(reg, u++)) 83 put_user(reg, u++))
@@ -141,6 +143,7 @@ static int genregs32_set(struct task_struct *target,
141 regs->u_regs[pos++] = *k++; 143 regs->u_regs[pos++] = *k++;
142 144
143 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 145 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
146 reg_window -= 16;
144 for (; count > 0 && pos < 32; count--) { 147 for (; count > 0 && pos < 32; count--) {
145 if (put_user(*k++, &reg_window[pos++])) 148 if (put_user(*k++, &reg_window[pos++]))
146 return -EFAULT; 149 return -EFAULT;
@@ -153,6 +156,7 @@ static int genregs32_set(struct task_struct *target,
153 } 156 }
154 157
155 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6]; 158 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];
159 reg_window -= 16;
156 for (; count > 0 && pos < 32; count--) { 160 for (; count > 0 && pos < 32; count--) {
157 if (get_user(reg, u++) || 161 if (get_user(reg, u++) ||
158 put_user(reg, &reg_window[pos++])) 162 put_user(reg, &reg_window[pos++]))
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index 4ae91dc2feb9..aa90da08bf61 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -23,6 +23,7 @@
23#include <linux/signal.h> 23#include <linux/signal.h>
24#include <linux/regset.h> 24#include <linux/regset.h>
25#include <linux/tracehook.h> 25#include <linux/tracehook.h>
26#include <trace/syscall.h>
26#include <linux/compat.h> 27#include <linux/compat.h>
27#include <linux/elf.h> 28#include <linux/elf.h>
28 29
@@ -37,6 +38,9 @@
37#include <asm/cpudata.h> 38#include <asm/cpudata.h>
38#include <asm/cacheflush.h> 39#include <asm/cacheflush.h>
39 40
41#define CREATE_TRACE_POINTS
42#include <trace/events/syscalls.h>
43
40#include "entry.h" 44#include "entry.h"
41 45
42/* #define ALLOW_INIT_TRACING */ 46/* #define ALLOW_INIT_TRACING */
@@ -488,6 +492,7 @@ static int genregs32_get(struct task_struct *target,
488 *k++ = regs->u_regs[pos++]; 492 *k++ = regs->u_regs[pos++];
489 493
490 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 494 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
495 reg_window -= 16;
491 if (target == current) { 496 if (target == current) {
492 for (; count > 0 && pos < 32; count--) { 497 for (; count > 0 && pos < 32; count--) {
493 if (get_user(*k++, &reg_window[pos++])) 498 if (get_user(*k++, &reg_window[pos++]))
@@ -512,6 +517,7 @@ static int genregs32_get(struct task_struct *target,
512 } 517 }
513 518
514 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 519 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
520 reg_window -= 16;
515 if (target == current) { 521 if (target == current) {
516 for (; count > 0 && pos < 32; count--) { 522 for (; count > 0 && pos < 32; count--) {
517 if (get_user(reg, &reg_window[pos++]) || 523 if (get_user(reg, &reg_window[pos++]) ||
@@ -595,6 +601,7 @@ static int genregs32_set(struct task_struct *target,
595 regs->u_regs[pos++] = *k++; 601 regs->u_regs[pos++] = *k++;
596 602
597 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 603 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
604 reg_window -= 16;
598 if (target == current) { 605 if (target == current) {
599 for (; count > 0 && pos < 32; count--) { 606 for (; count > 0 && pos < 32; count--) {
600 if (put_user(*k++, &reg_window[pos++])) 607 if (put_user(*k++, &reg_window[pos++]))
@@ -621,6 +628,7 @@ static int genregs32_set(struct task_struct *target,
621 } 628 }
622 629
623 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6]; 630 reg_window = (compat_ulong_t __user *) regs->u_regs[UREG_I6];
631 reg_window -= 16;
624 if (target == current) { 632 if (target == current) {
625 for (; count > 0 && pos < 32; count--) { 633 for (; count > 0 && pos < 32; count--) {
626 if (get_user(reg, u++) || 634 if (get_user(reg, u++) ||
@@ -1059,6 +1067,9 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1059 if (test_thread_flag(TIF_SYSCALL_TRACE)) 1067 if (test_thread_flag(TIF_SYSCALL_TRACE))
1060 ret = tracehook_report_syscall_entry(regs); 1068 ret = tracehook_report_syscall_entry(regs);
1061 1069
1070 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1071 trace_sys_enter(regs, regs->u_regs[UREG_G1]);
1072
1062 if (unlikely(current->audit_context) && !ret) 1073 if (unlikely(current->audit_context) && !ret)
1063 audit_syscall_entry((test_thread_flag(TIF_32BIT) ? 1074 audit_syscall_entry((test_thread_flag(TIF_32BIT) ?
1064 AUDIT_ARCH_SPARC : 1075 AUDIT_ARCH_SPARC :
@@ -1084,6 +1095,9 @@ asmlinkage void syscall_trace_leave(struct pt_regs *regs)
1084 audit_syscall_exit(result, regs->u_regs[UREG_I0]); 1095 audit_syscall_exit(result, regs->u_regs[UREG_I0]);
1085 } 1096 }
1086 1097
1098 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1099 trace_sys_exit(regs, regs->u_regs[UREG_G1]);
1100
1087 if (test_thread_flag(TIF_SYSCALL_TRACE)) 1101 if (test_thread_flag(TIF_SYSCALL_TRACE))
1088 tracehook_report_syscall_exit(regs, 0); 1102 tracehook_report_syscall_exit(regs, 0);
1089} 1103}
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
index fd3cee4d117c..090b9e9ad5e3 100644
--- a/arch/sparc/kernel/rtrap_64.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -65,48 +65,6 @@ __handle_user_windows:
65 ba,pt %xcc, __handle_user_windows_continue 65 ba,pt %xcc, __handle_user_windows_continue
66 66
67 andn %l1, %l4, %l1 67 andn %l1, %l4, %l1
68__handle_perfctrs:
69 call update_perfctrs
70 wrpr %g0, RTRAP_PSTATE, %pstate
71 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
72 ldub [%g6 + TI_WSAVED], %o2
73 brz,pt %o2, 1f
74 nop
75 /* Redo userwin+sched+sig checks */
76 call fault_in_user_windows
77
78 wrpr %g0, RTRAP_PSTATE, %pstate
79 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
80 ldx [%g6 + TI_FLAGS], %l0
81 andcc %l0, _TIF_NEED_RESCHED, %g0
82 be,pt %xcc, 1f
83
84 nop
85 call schedule
86 wrpr %g0, RTRAP_PSTATE, %pstate
87 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
88 ldx [%g6 + TI_FLAGS], %l0
891: andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
90
91 be,pt %xcc, __handle_perfctrs_continue
92 sethi %hi(TSTATE_PEF), %o0
93 mov %l5, %o1
94 add %sp, PTREGS_OFF, %o0
95 mov %l0, %o2
96 call do_notify_resume
97
98 wrpr %g0, RTRAP_PSTATE, %pstate
99 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
100 /* Signal delivery can modify pt_regs tstate, so we must
101 * reload it.
102 */
103 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
104 sethi %hi(0xf << 20), %l4
105 and %l1, %l4, %l4
106 andn %l1, %l4, %l1
107 ba,pt %xcc, __handle_perfctrs_continue
108
109 sethi %hi(TSTATE_PEF), %o0
110__handle_userfpu: 68__handle_userfpu:
111 rd %fprs, %l5 69 rd %fprs, %l5
112 andcc %l5, FPRS_FEF, %g0 70 andcc %l5, FPRS_FEF, %g0
@@ -149,11 +107,11 @@ rtrap_nmi: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
149rtrap_irq: 107rtrap_irq:
150rtrap: 108rtrap:
151#ifndef CONFIG_SMP 109#ifndef CONFIG_SMP
152 sethi %hi(per_cpu____cpu_data), %l0 110 sethi %hi(__cpu_data), %l0
153 lduw [%l0 + %lo(per_cpu____cpu_data)], %l1 111 lduw [%l0 + %lo(__cpu_data)], %l1
154#else 112#else
155 sethi %hi(per_cpu____cpu_data), %l0 113 sethi %hi(__cpu_data), %l0
156 or %l0, %lo(per_cpu____cpu_data), %l0 114 or %l0, %lo(__cpu_data), %l0
157 lduw [%l0 + %g5], %l1 115 lduw [%l0 + %g5], %l1
158#endif 116#endif
159 cmp %l1, 0 117 cmp %l1, 0
@@ -172,7 +130,17 @@ rtrap_xcall:
172 nop 130 nop
173 call trace_hardirqs_on 131 call trace_hardirqs_on
174 nop 132 nop
175 wrpr %l4, %pil 133 /* Do not actually set the %pil here. We will do that
134 * below after we clear PSTATE_IE in the %pstate register.
135 * If we re-enable interrupts here, we can recurse down
136 * the hardirq stack potentially endlessly, causing a
137 * stack overflow.
138 *
139 * It is tempting to put this test and trace_hardirqs_on
140 * call at the 'rt_continue' label, but that will not work
141 * as that path hits unconditionally and we do not want to
142 * execute this in NMI return paths, for example.
143 */
176#endif 144#endif
177rtrap_no_irq_enable: 145rtrap_no_irq_enable:
178 andcc %l1, TSTATE_PRIV, %l3 146 andcc %l1, TSTATE_PRIV, %l3
@@ -191,9 +159,9 @@ rtrap_no_irq_enable:
191 * take until the next local IRQ before the signal/resched 159 * take until the next local IRQ before the signal/resched
192 * event would be handled. 160 * event would be handled.
193 * 161 *
194 * This also means that if we have to deal with performance 162 * This also means that if we have to deal with user
195 * counters or user windows, we have to redo all of these 163 * windows, we have to redo all of these sched+signal checks
196 * sched+signal checks with IRQs disabled. 164 * with IRQs disabled.
197 */ 165 */
198to_user: wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 166to_user: wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
199 wrpr 0, %pil 167 wrpr 0, %pil
@@ -214,12 +182,8 @@ __handle_signal_continue:
214 brnz,pn %o2, __handle_user_windows 182 brnz,pn %o2, __handle_user_windows
215 nop 183 nop
216__handle_user_windows_continue: 184__handle_user_windows_continue:
217 ldx [%g6 + TI_FLAGS], %l5
218 andcc %l5, _TIF_PERFCTR, %g0
219 sethi %hi(TSTATE_PEF), %o0 185 sethi %hi(TSTATE_PEF), %o0
220 bne,pn %xcc, __handle_perfctrs 186 andcc %l1, %o0, %g0
221__handle_perfctrs_continue:
222 andcc %l1, %o0, %g0
223 187
224 /* This fpdepth clear is necessary for non-syscall rtraps only */ 188 /* This fpdepth clear is necessary for non-syscall rtraps only */
225user_nowork: 189user_nowork:
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index 9be2af55c5cd..b22ce6100403 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -95,8 +95,6 @@ static void prom_sync_me(void)
95 "nop\n\t" 95 "nop\n\t"
96 "nop\n\t" : : "r" (prom_tbr)); 96 "nop\n\t" : : "r" (prom_tbr));
97 local_irq_restore(flags); 97 local_irq_restore(flags);
98
99 return;
100} 98}
101 99
102static unsigned int boot_flags __initdata = 0; 100static unsigned int boot_flags __initdata = 0;
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 21180339cb09..5f72de67588b 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -12,7 +12,6 @@
12#include <linux/stddef.h> 12#include <linux/stddef.h>
13#include <linux/unistd.h> 13#include <linux/unistd.h>
14#include <linux/ptrace.h> 14#include <linux/ptrace.h>
15#include <linux/slab.h>
16#include <asm/smp.h> 15#include <asm/smp.h>
17#include <linux/user.h> 16#include <linux/user.h>
18#include <linux/screen_info.h> 17#include <linux/screen_info.h>
@@ -46,6 +45,7 @@
46#include <asm/setup.h> 45#include <asm/setup.h>
47#include <asm/mmu.h> 46#include <asm/mmu.h>
48#include <asm/ns87303.h> 47#include <asm/ns87303.h>
48#include <asm/btext.h>
49 49
50#ifdef CONFIG_IP_PNP 50#ifdef CONFIG_IP_PNP
51#include <net/ipconfig.h> 51#include <net/ipconfig.h>
@@ -286,7 +286,10 @@ void __init setup_arch(char **cmdline_p)
286 parse_early_param(); 286 parse_early_param();
287 287
288 boot_flags_init(*cmdline_p); 288 boot_flags_init(*cmdline_p);
289 register_console(&prom_early_console); 289#ifdef CONFIG_EARLYFB
290 if (btext_find_display())
291#endif
292 register_console(&prom_early_console);
290 293
291 if (tlb_type == hypervisor) 294 if (tlb_type == hypervisor)
292 printk("ARCH: SUN4V\n"); 295 printk("ARCH: SUN4V\n");
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index ba5b09ad6666..ea22cd373c64 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -120,8 +120,8 @@ struct rt_signal_frame32 {
120}; 120};
121 121
122/* Align macros */ 122/* Align macros */
123#define SF_ALIGNEDSZ (((sizeof(struct signal_frame32) + 7) & (~7))) 123#define SF_ALIGNEDSZ (((sizeof(struct signal_frame32) + 15) & (~15)))
124#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame32) + 7) & (~7))) 124#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame32) + 15) & (~15)))
125 125
126int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 126int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
127{ 127{
@@ -420,15 +420,17 @@ static void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, uns
420 sp = current->sas_ss_sp + current->sas_ss_size; 420 sp = current->sas_ss_sp + current->sas_ss_size;
421 } 421 }
422 422
423 sp -= framesize;
424
423 /* Always align the stack frame. This handles two cases. First, 425 /* Always align the stack frame. This handles two cases. First,
424 * sigaltstack need not be mindful of platform specific stack 426 * sigaltstack need not be mindful of platform specific stack
425 * alignment. Second, if we took this signal because the stack 427 * alignment. Second, if we took this signal because the stack
426 * is not aligned properly, we'd like to take the signal cleanly 428 * is not aligned properly, we'd like to take the signal cleanly
427 * and report that. 429 * and report that.
428 */ 430 */
429 sp &= ~7UL; 431 sp &= ~15UL;
430 432
431 return (void __user *)(sp - framesize); 433 return (void __user *) sp;
432} 434}
433 435
434static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu) 436static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 7ce1a1005b1d..9882df92ba0a 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -267,15 +267,17 @@ static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *re
267 sp = current->sas_ss_sp + current->sas_ss_size; 267 sp = current->sas_ss_sp + current->sas_ss_size;
268 } 268 }
269 269
270 sp -= framesize;
271
270 /* Always align the stack frame. This handles two cases. First, 272 /* Always align the stack frame. This handles two cases. First,
271 * sigaltstack need not be mindful of platform specific stack 273 * sigaltstack need not be mindful of platform specific stack
272 * alignment. Second, if we took this signal because the stack 274 * alignment. Second, if we took this signal because the stack
273 * is not aligned properly, we'd like to take the signal cleanly 275 * is not aligned properly, we'd like to take the signal cleanly
274 * and report that. 276 * and report that.
275 */ 277 */
276 sp &= ~7UL; 278 sp &= ~15UL;
277 279
278 return (void __user *)(sp - framesize); 280 return (void __user *) sp;
279} 281}
280 282
281static inline int 283static inline int
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 647afbda7ae1..9fa48c30037e 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -353,7 +353,7 @@ segv:
353/* Checks if the fp is valid */ 353/* Checks if the fp is valid */
354static int invalid_frame_pointer(void __user *fp, int fplen) 354static int invalid_frame_pointer(void __user *fp, int fplen)
355{ 355{
356 if (((unsigned long) fp) & 7) 356 if (((unsigned long) fp) & 15)
357 return 1; 357 return 1;
358 return 0; 358 return 0;
359} 359}
@@ -396,15 +396,17 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *
396 sp = current->sas_ss_sp + current->sas_ss_size; 396 sp = current->sas_ss_sp + current->sas_ss_size;
397 } 397 }
398 398
399 sp -= framesize;
400
399 /* Always align the stack frame. This handles two cases. First, 401 /* Always align the stack frame. This handles two cases. First,
400 * sigaltstack need not be mindful of platform specific stack 402 * sigaltstack need not be mindful of platform specific stack
401 * alignment. Second, if we took this signal because the stack 403 * alignment. Second, if we took this signal because the stack
402 * is not aligned properly, we'd like to take the signal cleanly 404 * is not aligned properly, we'd like to take the signal cleanly
403 * and report that. 405 * and report that.
404 */ 406 */
405 sp &= ~7UL; 407 sp &= ~15UL;
406 408
407 return (void __user *)(sp - framesize); 409 return (void __user *) sp;
408} 410}
409 411
410static inline void 412static inline void
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index 132d81fb2616..91c10fb70858 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -32,6 +32,7 @@
32#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
33#include <asm/tlbflush.h> 33#include <asm/tlbflush.h>
34#include <asm/cpudata.h> 34#include <asm/cpudata.h>
35#include <asm/leon.h>
35 36
36#include "irq.h" 37#include "irq.h"
37 38
@@ -96,6 +97,9 @@ void __init smp_cpus_done(unsigned int max_cpus)
96 case sun4d: 97 case sun4d:
97 smp4d_smp_done(); 98 smp4d_smp_done();
98 break; 99 break;
100 case sparc_leon:
101 leon_smp_done();
102 break;
99 case sun4e: 103 case sun4e:
100 printk("SUN4E\n"); 104 printk("SUN4E\n");
101 BUG(); 105 BUG();
@@ -306,6 +310,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
306 case sun4d: 310 case sun4d:
307 smp4d_boot_cpus(); 311 smp4d_boot_cpus();
308 break; 312 break;
313 case sparc_leon:
314 leon_boot_cpus();
315 break;
309 case sun4e: 316 case sun4e:
310 printk("SUN4E\n"); 317 printk("SUN4E\n");
311 BUG(); 318 BUG();
@@ -376,6 +383,9 @@ int __cpuinit __cpu_up(unsigned int cpu)
376 case sun4d: 383 case sun4d:
377 ret = smp4d_boot_one_cpu(cpu); 384 ret = smp4d_boot_one_cpu(cpu);
378 break; 385 break;
386 case sparc_leon:
387 ret = leon_boot_one_cpu(cpu);
388 break;
379 case sun4e: 389 case sun4e:
380 printk("SUN4E\n"); 390 printk("SUN4E\n");
381 BUG(); 391 BUG();
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index aa36223497b9..b6a2b8f47040 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -22,7 +22,9 @@
22#include <linux/profile.h> 22#include <linux/profile.h>
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24#include <linux/vmalloc.h> 24#include <linux/vmalloc.h>
25#include <linux/ftrace.h>
25#include <linux/cpu.h> 26#include <linux/cpu.h>
27#include <linux/slab.h>
26 28
27#include <asm/head.h> 29#include <asm/head.h>
28#include <asm/ptrace.h> 30#include <asm/ptrace.h>
@@ -370,7 +372,7 @@ static int __cpuinit smp_boot_one_cpu(unsigned int cpu)
370 } else { 372 } else {
371 struct device_node *dp = of_find_node_by_cpuid(cpu); 373 struct device_node *dp = of_find_node_by_cpuid(cpu);
372 374
373 prom_startcpu(dp->node, entry, cookie); 375 prom_startcpu(dp->phandle, entry, cookie);
374 } 376 }
375 377
376 for (timeout = 0; timeout < 50000; timeout++) { 378 for (timeout = 0; timeout < 50000; timeout++) {
@@ -822,13 +824,13 @@ void arch_send_call_function_single_ipi(int cpu)
822 &cpumask_of_cpu(cpu)); 824 &cpumask_of_cpu(cpu));
823} 825}
824 826
825void smp_call_function_client(int irq, struct pt_regs *regs) 827void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs)
826{ 828{
827 clear_softint(1 << irq); 829 clear_softint(1 << irq);
828 generic_smp_call_function_interrupt(); 830 generic_smp_call_function_interrupt();
829} 831}
830 832
831void smp_call_function_single_client(int irq, struct pt_regs *regs) 833void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs)
832{ 834{
833 clear_softint(1 << irq); 835 clear_softint(1 << irq);
834 generic_smp_call_function_single_interrupt(); 836 generic_smp_call_function_single_interrupt();
@@ -964,7 +966,7 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
964 put_cpu(); 966 put_cpu();
965} 967}
966 968
967void smp_new_mmu_context_version_client(int irq, struct pt_regs *regs) 969void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs)
968{ 970{
969 struct mm_struct *mm; 971 struct mm_struct *mm;
970 unsigned long flags; 972 unsigned long flags;
@@ -1148,7 +1150,7 @@ void smp_release(void)
1148 */ 1150 */
1149extern void prom_world(int); 1151extern void prom_world(int);
1150 1152
1151void smp_penguin_jailcell(int irq, struct pt_regs *regs) 1153void __irq_entry smp_penguin_jailcell(int irq, struct pt_regs *regs)
1152{ 1154{
1153 clear_softint(1 << irq); 1155 clear_softint(1 << irq);
1154 1156
@@ -1364,7 +1366,7 @@ void smp_send_reschedule(int cpu)
1364 &cpumask_of_cpu(cpu)); 1366 &cpumask_of_cpu(cpu));
1365} 1367}
1366 1368
1367void smp_receive_signal_client(int irq, struct pt_regs *regs) 1369void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs)
1368{ 1370{
1369 clear_softint(1 << irq); 1371 clear_softint(1 << irq);
1370} 1372}
diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c
index 0f26066a08d9..372ad59c4cba 100644
--- a/arch/sparc/kernel/sparc_ksyms_64.c
+++ b/arch/sparc/kernel/sparc_ksyms_64.c
@@ -38,17 +38,5 @@ EXPORT_SYMBOL(sun4v_niagara_setperf);
38EXPORT_SYMBOL(sun4v_niagara2_getperf); 38EXPORT_SYMBOL(sun4v_niagara2_getperf);
39EXPORT_SYMBOL(sun4v_niagara2_setperf); 39EXPORT_SYMBOL(sun4v_niagara2_setperf);
40 40
41#ifdef CONFIG_PCI
42/* inline functions in asm/pci_64.h */
43EXPORT_SYMBOL(pci_alloc_consistent);
44EXPORT_SYMBOL(pci_free_consistent);
45EXPORT_SYMBOL(pci_map_single);
46EXPORT_SYMBOL(pci_unmap_single);
47EXPORT_SYMBOL(pci_map_sg);
48EXPORT_SYMBOL(pci_unmap_sg);
49EXPORT_SYMBOL(pci_dma_sync_single_for_cpu);
50EXPORT_SYMBOL(pci_dma_sync_sg_for_cpu);
51#endif
52
53/* Exporting a symbol from /init/main.c */ 41/* Exporting a symbol from /init/main.c */
54EXPORT_SYMBOL(saved_command_line); 42EXPORT_SYMBOL(saved_command_line);
diff --git a/arch/sparc/kernel/sun4c_irq.c b/arch/sparc/kernel/sun4c_irq.c
index bc3adbf79c6a..892fb884910a 100644
--- a/arch/sparc/kernel/sun4c_irq.c
+++ b/arch/sparc/kernel/sun4c_irq.c
@@ -16,7 +16,6 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/ptrace.h> 17#include <linux/ptrace.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/slab.h>
20#include <linux/init.h> 19#include <linux/init.h>
21#include <linux/of.h> 20#include <linux/of.h>
22#include <linux/of_device.h> 21#include <linux/of_device.h>
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index 68791cad7b74..482f2ab92692 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -194,7 +194,7 @@ int __cpuinit smp4d_boot_one_cpu(int i)
194 smp_penguin_ctable.reg_size = 0; 194 smp_penguin_ctable.reg_size = 0;
195 195
196 /* whirrr, whirrr, whirrrrrrrrr... */ 196 /* whirrr, whirrr, whirrrrrrrrr... */
197 SMP_PRINTK(("Starting CPU %d at %p \n", i, entry)); 197 SMP_PRINTK(("Starting CPU %d at %p\n", i, entry));
198 local_flush_cache_all(); 198 local_flush_cache_all();
199 prom_startcpu(cpu_node, 199 prom_startcpu(cpu_node,
200 &smp_penguin_ctable, 0, (char *)entry); 200 &smp_penguin_ctable, 0, (char *)entry);
diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c
index 301892e2d718..7f3b97ff62c1 100644
--- a/arch/sparc/kernel/sun4m_irq.c
+++ b/arch/sparc/kernel/sun4m_irq.c
@@ -17,7 +17,6 @@
17#include <linux/ptrace.h> 17#include <linux/ptrace.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/slab.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/ioport.h> 21#include <linux/ioport.h>
23#include <linux/of.h> 22#include <linux/of.h>
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index e7061138c98a..46a76ba3fb4b 100644
--- a/arch/sparc/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
@@ -51,7 +51,6 @@ SIGN1(sys32_exit_group, sys_exit_group, %o0)
51SIGN1(sys32_wait4, compat_sys_wait4, %o2) 51SIGN1(sys32_wait4, compat_sys_wait4, %o2)
52SIGN1(sys32_creat, sys_creat, %o1) 52SIGN1(sys32_creat, sys_creat, %o1)
53SIGN1(sys32_mknod, sys_mknod, %o1) 53SIGN1(sys32_mknod, sys_mknod, %o1)
54SIGN1(sys32_perfctr, sys_perfctr, %o0)
55SIGN1(sys32_umount, sys_umount, %o1) 54SIGN1(sys32_umount, sys_umount, %o1)
56SIGN1(sys32_signal, sys_signal, %o0) 55SIGN1(sys32_signal, sys_signal, %o0)
57SIGN1(sys32_access, sys_access, %o1) 56SIGN1(sys32_access, sys_access, %o1)
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 04e28b2671c8..c0ca87553e1c 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -21,16 +21,10 @@
21#include <linux/sem.h> 21#include <linux/sem.h>
22#include <linux/msg.h> 22#include <linux/msg.h>
23#include <linux/shm.h> 23#include <linux/shm.h>
24#include <linux/slab.h>
25#include <linux/uio.h> 24#include <linux/uio.h>
26#include <linux/nfs_fs.h> 25#include <linux/nfs_fs.h>
27#include <linux/quota.h> 26#include <linux/quota.h>
28#include <linux/module.h> 27#include <linux/module.h>
29#include <linux/sunrpc/svc.h>
30#include <linux/nfsd/nfsd.h>
31#include <linux/nfsd/cache.h>
32#include <linux/nfsd/xdr.h>
33#include <linux/nfsd/syscall.h>
34#include <linux/poll.h> 28#include <linux/poll.h>
35#include <linux/personality.h> 29#include <linux/personality.h>
36#include <linux/stat.h> 30#include <linux/stat.h>
@@ -48,8 +42,8 @@
48#include <linux/security.h> 42#include <linux/security.h>
49#include <linux/compat.h> 43#include <linux/compat.h>
50#include <linux/vfs.h> 44#include <linux/vfs.h>
51#include <linux/netfilter_ipv4/ip_tables.h>
52#include <linux/ptrace.h> 45#include <linux/ptrace.h>
46#include <linux/slab.h>
53 47
54#include <asm/types.h> 48#include <asm/types.h>
55#include <asm/uaccess.h> 49#include <asm/uaccess.h>
@@ -569,85 +563,6 @@ asmlinkage long sparc32_open(const char __user *filename,
569 return do_sys_open(AT_FDCWD, filename, flags, mode); 563 return do_sys_open(AT_FDCWD, filename, flags, mode);
570} 564}
571 565
572extern unsigned long do_mremap(unsigned long addr,
573 unsigned long old_len, unsigned long new_len,
574 unsigned long flags, unsigned long new_addr);
575
576asmlinkage unsigned long sys32_mremap(unsigned long addr,
577 unsigned long old_len, unsigned long new_len,
578 unsigned long flags, u32 __new_addr)
579{
580 unsigned long ret = -EINVAL;
581 unsigned long new_addr = __new_addr;
582
583 if (unlikely(sparc_mmap_check(addr, old_len)))
584 goto out;
585 if (unlikely(sparc_mmap_check(new_addr, new_len)))
586 goto out;
587 down_write(&current->mm->mmap_sem);
588 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
589 up_write(&current->mm->mmap_sem);
590out:
591 return ret;
592}
593
594struct __sysctl_args32 {
595 u32 name;
596 int nlen;
597 u32 oldval;
598 u32 oldlenp;
599 u32 newval;
600 u32 newlen;
601 u32 __unused[4];
602};
603
604asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
605{
606#ifndef CONFIG_SYSCTL_SYSCALL
607 return -ENOSYS;
608#else
609 struct __sysctl_args32 tmp;
610 int error;
611 size_t oldlen, __user *oldlenp = NULL;
612 unsigned long addr = (((unsigned long)&args->__unused[0]) + 7UL) & ~7UL;
613
614 if (copy_from_user(&tmp, args, sizeof(tmp)))
615 return -EFAULT;
616
617 if (tmp.oldval && tmp.oldlenp) {
618 /* Duh, this is ugly and might not work if sysctl_args
619 is in read-only memory, but do_sysctl does indirectly
620 a lot of uaccess in both directions and we'd have to
621 basically copy the whole sysctl.c here, and
622 glibc's __sysctl uses rw memory for the structure
623 anyway. */
624 if (get_user(oldlen, (u32 __user *)(unsigned long)tmp.oldlenp) ||
625 put_user(oldlen, (size_t __user *)addr))
626 return -EFAULT;
627 oldlenp = (size_t __user *)addr;
628 }
629
630 lock_kernel();
631 error = do_sysctl((int __user *)(unsigned long) tmp.name,
632 tmp.nlen,
633 (void __user *)(unsigned long) tmp.oldval,
634 oldlenp,
635 (void __user *)(unsigned long) tmp.newval,
636 tmp.newlen);
637 unlock_kernel();
638 if (oldlenp) {
639 if (!error) {
640 if (get_user(oldlen, (size_t __user *)addr) ||
641 put_user(oldlen, (u32 __user *)(unsigned long) tmp.oldlenp))
642 error = -EFAULT;
643 }
644 if (copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)))
645 error = -EFAULT;
646 }
647 return error;
648#endif
649}
650
651long sys32_lookup_dcookie(unsigned long cookie_high, 566long sys32_lookup_dcookie(unsigned long cookie_high,
652 unsigned long cookie_low, 567 unsigned long cookie_low,
653 char __user *buf, size_t len) 568 char __user *buf, size_t len)
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 03035c852a43..ee995b7dae7e 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -45,7 +45,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
45 /* We do not accept a shared mapping if it would violate 45 /* We do not accept a shared mapping if it would violate
46 * cache aliasing constraints. 46 * cache aliasing constraints.
47 */ 47 */
48 if ((flags & MAP_SHARED) && (addr & (SHMLBA - 1))) 48 if ((flags & MAP_SHARED) &&
49 ((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)))
49 return -EINVAL; 50 return -EINVAL;
50 return addr; 51 return addr;
51 } 52 }
@@ -79,15 +80,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
79 } 80 }
80} 81}
81 82
82asmlinkage unsigned long sparc_brk(unsigned long brk)
83{
84 if(ARCH_SUN4C) {
85 if ((brk & 0xe0000000) != (current->mm->brk & 0xe0000000))
86 return current->mm->brk;
87 }
88 return sys_brk(brk);
89}
90
91/* 83/*
92 * sys_pipe() is the normal C calling standard for creating 84 * sys_pipe() is the normal C calling standard for creating
93 * a pipe. It's not the way unix traditionally does this, though. 85 * a pipe. It's not the way unix traditionally does this, though.
@@ -106,119 +98,6 @@ out:
106 return error; 98 return error;
107} 99}
108 100
109/*
110 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
111 *
112 * This is really horribly ugly.
113 */
114
115asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user *ptr, long fifth)
116{
117 int version, err;
118
119 version = call >> 16; /* hack for backward compatibility */
120 call &= 0xffff;
121
122 if (call <= SEMCTL)
123 switch (call) {
124 case SEMOP:
125 err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
126 goto out;
127 case SEMTIMEDOP:
128 err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, (const struct timespec __user *) fifth);
129 goto out;
130 case SEMGET:
131 err = sys_semget (first, second, third);
132 goto out;
133 case SEMCTL: {
134 union semun fourth;
135 err = -EINVAL;
136 if (!ptr)
137 goto out;
138 err = -EFAULT;
139 if (get_user(fourth.__pad,
140 (void __user * __user *)ptr))
141 goto out;
142 err = sys_semctl (first, second, third, fourth);
143 goto out;
144 }
145 default:
146 err = -ENOSYS;
147 goto out;
148 }
149 if (call <= MSGCTL)
150 switch (call) {
151 case MSGSND:
152 err = sys_msgsnd (first, (struct msgbuf __user *) ptr,
153 second, third);
154 goto out;
155 case MSGRCV:
156 switch (version) {
157 case 0: {
158 struct ipc_kludge tmp;
159 err = -EINVAL;
160 if (!ptr)
161 goto out;
162 err = -EFAULT;
163 if (copy_from_user(&tmp, (struct ipc_kludge __user *) ptr, sizeof (tmp)))
164 goto out;
165 err = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
166 goto out;
167 }
168 case 1: default:
169 err = sys_msgrcv (first,
170 (struct msgbuf __user *) ptr,
171 second, fifth, third);
172 goto out;
173 }
174 case MSGGET:
175 err = sys_msgget ((key_t) first, second);
176 goto out;
177 case MSGCTL:
178 err = sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
179 goto out;
180 default:
181 err = -ENOSYS;
182 goto out;
183 }
184 if (call <= SHMCTL)
185 switch (call) {
186 case SHMAT:
187 switch (version) {
188 case 0: default: {
189 ulong raddr;
190 err = do_shmat (first, (char __user *) ptr, second, &raddr);
191 if (err)
192 goto out;
193 err = -EFAULT;
194 if (put_user (raddr, (ulong __user *) third))
195 goto out;
196 err = 0;
197 goto out;
198 }
199 case 1: /* iBCS2 emulator entry point */
200 err = -EINVAL;
201 goto out;
202 }
203 case SHMDT:
204 err = sys_shmdt ((char __user *)ptr);
205 goto out;
206 case SHMGET:
207 err = sys_shmget (first, second, third);
208 goto out;
209 case SHMCTL:
210 err = sys_shmctl (first, second, (struct shmid_ds __user *) ptr);
211 goto out;
212 default:
213 err = -ENOSYS;
214 goto out;
215 }
216 else
217 err = -ENOSYS;
218out:
219 return err;
220}
221
222int sparc_mmap_check(unsigned long addr, unsigned long len) 101int sparc_mmap_check(unsigned long addr, unsigned long len)
223{ 102{
224 if (ARCH_SUN4C && 103 if (ARCH_SUN4C &&
@@ -234,31 +113,6 @@ int sparc_mmap_check(unsigned long addr, unsigned long len)
234} 113}
235 114
236/* Linux version of mmap */ 115/* Linux version of mmap */
237static unsigned long do_mmap2(unsigned long addr, unsigned long len,
238 unsigned long prot, unsigned long flags, unsigned long fd,
239 unsigned long pgoff)
240{
241 struct file * file = NULL;
242 unsigned long retval = -EBADF;
243
244 if (!(flags & MAP_ANONYMOUS)) {
245 file = fget(fd);
246 if (!file)
247 goto out;
248 }
249
250 len = PAGE_ALIGN(len);
251 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
252
253 down_write(&current->mm->mmap_sem);
254 retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
255 up_write(&current->mm->mmap_sem);
256
257 if (file)
258 fput(file);
259out:
260 return retval;
261}
262 116
263asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, 117asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
264 unsigned long prot, unsigned long flags, unsigned long fd, 118 unsigned long prot, unsigned long flags, unsigned long fd,
@@ -266,14 +120,16 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
266{ 120{
267 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE 121 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
268 we have. */ 122 we have. */
269 return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12)); 123 return sys_mmap_pgoff(addr, len, prot, flags, fd,
124 pgoff >> (PAGE_SHIFT - 12));
270} 125}
271 126
272asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, 127asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
273 unsigned long prot, unsigned long flags, unsigned long fd, 128 unsigned long prot, unsigned long flags, unsigned long fd,
274 unsigned long off) 129 unsigned long off)
275{ 130{
276 return do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT); 131 /* no alignment check? */
132 return sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
277} 133}
278 134
279long sparc_remap_file_pages(unsigned long start, unsigned long size, 135long sparc_remap_file_pages(unsigned long start, unsigned long size,
@@ -287,27 +143,6 @@ long sparc_remap_file_pages(unsigned long start, unsigned long size,
287 (pgoff >> (PAGE_SHIFT - 12)), flags); 143 (pgoff >> (PAGE_SHIFT - 12)), flags);
288} 144}
289 145
290extern unsigned long do_mremap(unsigned long addr,
291 unsigned long old_len, unsigned long new_len,
292 unsigned long flags, unsigned long new_addr);
293
294asmlinkage unsigned long sparc_mremap(unsigned long addr,
295 unsigned long old_len, unsigned long new_len,
296 unsigned long flags, unsigned long new_addr)
297{
298 unsigned long ret = -EINVAL;
299
300 if (unlikely(sparc_mmap_check(addr, old_len)))
301 goto out;
302 if (unlikely(sparc_mmap_check(new_addr, new_len)))
303 goto out;
304 down_write(&current->mm->mmap_sem);
305 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
306 up_write(&current->mm->mmap_sem);
307out:
308 return ret;
309}
310
311/* we come to here via sys_nis_syscall so it can setup the regs argument */ 146/* we come to here via sys_nis_syscall so it can setup the regs argument */
312asmlinkage unsigned long 147asmlinkage unsigned long
313c_sys_nis_syscall (struct pt_regs *regs) 148c_sys_nis_syscall (struct pt_regs *regs)
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index e2d102447a43..3d435c42e6db 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -27,7 +27,6 @@
27 27
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/utrap.h> 29#include <asm/utrap.h>
30#include <asm/perfctr.h>
31#include <asm/unistd.h> 30#include <asm/unistd.h>
32 31
33#include "entry.h" 32#include "entry.h"
@@ -317,10 +316,14 @@ bottomup:
317unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags) 316unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags)
318{ 317{
319 unsigned long align_goal, addr = -ENOMEM; 318 unsigned long align_goal, addr = -ENOMEM;
319 unsigned long (*get_area)(struct file *, unsigned long,
320 unsigned long, unsigned long, unsigned long);
321
322 get_area = current->mm->get_unmapped_area;
320 323
321 if (flags & MAP_FIXED) { 324 if (flags & MAP_FIXED) {
322 /* Ok, don't mess with it. */ 325 /* Ok, don't mess with it. */
323 return get_unmapped_area(NULL, orig_addr, len, pgoff, flags); 326 return get_area(NULL, orig_addr, len, pgoff, flags);
324 } 327 }
325 flags &= ~MAP_SHARED; 328 flags &= ~MAP_SHARED;
326 329
@@ -333,7 +336,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
333 align_goal = (64UL * 1024); 336 align_goal = (64UL * 1024);
334 337
335 do { 338 do {
336 addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags); 339 addr = get_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags);
337 if (!(addr & ~PAGE_MASK)) { 340 if (!(addr & ~PAGE_MASK)) {
338 addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); 341 addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL);
339 break; 342 break;
@@ -351,7 +354,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
351 * be obtained. 354 * be obtained.
352 */ 355 */
353 if (addr & ~PAGE_MASK) 356 if (addr & ~PAGE_MASK)
354 addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags); 357 addr = get_area(NULL, orig_addr, len, pgoff, flags);
355 358
356 return addr; 359 return addr;
357} 360}
@@ -361,6 +364,7 @@ EXPORT_SYMBOL(get_fb_unmapped_area);
361void arch_pick_mmap_layout(struct mm_struct *mm) 364void arch_pick_mmap_layout(struct mm_struct *mm)
362{ 365{
363 unsigned long random_factor = 0UL; 366 unsigned long random_factor = 0UL;
367 unsigned long gap;
364 368
365 if (current->flags & PF_RANDOMIZE) { 369 if (current->flags & PF_RANDOMIZE) {
366 random_factor = get_random_int(); 370 random_factor = get_random_int();
@@ -375,9 +379,10 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
375 * Fall back to the standard layout if the personality 379 * Fall back to the standard layout if the personality
376 * bit is set, or if the expected stack growth is unlimited: 380 * bit is set, or if the expected stack growth is unlimited:
377 */ 381 */
382 gap = rlimit(RLIMIT_STACK);
378 if (!test_thread_flag(TIF_32BIT) || 383 if (!test_thread_flag(TIF_32BIT) ||
379 (current->personality & ADDR_COMPAT_LAYOUT) || 384 (current->personality & ADDR_COMPAT_LAYOUT) ||
380 current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY || 385 gap == RLIM_INFINITY ||
381 sysctl_legacy_va_layout) { 386 sysctl_legacy_va_layout) {
382 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; 387 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
383 mm->get_unmapped_area = arch_get_unmapped_area; 388 mm->get_unmapped_area = arch_get_unmapped_area;
@@ -385,9 +390,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
385 } else { 390 } else {
386 /* We know it's 32-bit */ 391 /* We know it's 32-bit */
387 unsigned long task_size = STACK_TOP32; 392 unsigned long task_size = STACK_TOP32;
388 unsigned long gap;
389 393
390 gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
391 if (gap < 128 * 1024 * 1024) 394 if (gap < 128 * 1024 * 1024)
392 gap = 128 * 1024 * 1024; 395 gap = 128 * 1024 * 1024;
393 if (gap > (task_size / 6 * 5)) 396 if (gap > (task_size / 6 * 5))
@@ -399,18 +402,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
399 } 402 }
400} 403}
401 404
402SYSCALL_DEFINE1(sparc_brk, unsigned long, brk)
403{
404 /* People could try to be nasty and use ta 0x6d in 32bit programs */
405 if (test_thread_flag(TIF_32BIT) && brk >= STACK_TOP32)
406 return current->mm->brk;
407
408 if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk)))
409 return current->mm->brk;
410
411 return sys_brk(brk);
412}
413
414/* 405/*
415 * sys_pipe() is the normal C calling standard for creating 406 * sys_pipe() is the normal C calling standard for creating
416 * a pipe. It's not the way unix traditionally does this, though. 407 * a pipe. It's not the way unix traditionally does this, though.
@@ -435,7 +426,7 @@ out:
435 * This is really horribly ugly. 426 * This is really horribly ugly.
436 */ 427 */
437 428
438SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, 429SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second,
439 unsigned long, third, void __user *, ptr, long, fifth) 430 unsigned long, third, void __user *, ptr, long, fifth)
440{ 431{
441 long err; 432 long err;
@@ -519,17 +510,6 @@ out:
519 return err; 510 return err;
520} 511}
521 512
522SYSCALL_DEFINE1(sparc64_newuname, struct new_utsname __user *, name)
523{
524 int ret = sys_newuname(name);
525
526 if (current->personality == PER_LINUX32 && !ret) {
527 ret = (copy_to_user(name->machine, "sparc\0\0", 8)
528 ? -EFAULT : 0);
529 }
530 return ret;
531}
532
533SYSCALL_DEFINE1(sparc64_personality, unsigned long, personality) 513SYSCALL_DEFINE1(sparc64_personality, unsigned long, personality)
534{ 514{
535 int ret; 515 int ret;
@@ -568,23 +548,13 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
568 unsigned long, prot, unsigned long, flags, unsigned long, fd, 548 unsigned long, prot, unsigned long, flags, unsigned long, fd,
569 unsigned long, off) 549 unsigned long, off)
570{ 550{
571 struct file * file = NULL; 551 unsigned long retval = -EINVAL;
572 unsigned long retval = -EBADF;
573 552
574 if (!(flags & MAP_ANONYMOUS)) { 553 if ((off + PAGE_ALIGN(len)) < off)
575 file = fget(fd); 554 goto out;
576 if (!file) 555 if (off & ~PAGE_MASK)
577 goto out; 556 goto out;
578 } 557 retval = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
579 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
580 len = PAGE_ALIGN(len);
581
582 down_write(&current->mm->mmap_sem);
583 retval = do_mmap(file, addr, len, prot, flags, off);
584 up_write(&current->mm->mmap_sem);
585
586 if (file)
587 fput(file);
588out: 558out:
589 return retval; 559 return retval;
590} 560}
@@ -614,12 +584,6 @@ SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len,
614 584
615 if (test_thread_flag(TIF_32BIT)) 585 if (test_thread_flag(TIF_32BIT))
616 goto out; 586 goto out;
617 if (unlikely(new_len >= VA_EXCLUDE_START))
618 goto out;
619 if (unlikely(sparc_mmap_check(addr, old_len)))
620 goto out;
621 if (unlikely(sparc_mmap_check(new_addr, new_len)))
622 goto out;
623 587
624 down_write(&current->mm->mmap_sem); 588 down_write(&current->mm->mmap_sem);
625 ret = do_mremap(addr, old_len, new_len, flags, new_addr); 589 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
@@ -790,109 +754,6 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act,
790 return ret; 754 return ret;
791} 755}
792 756
793/* Invoked by rtrap code to update performance counters in
794 * user space.
795 */
796asmlinkage void update_perfctrs(void)
797{
798 unsigned long pic, tmp;
799
800 read_pic(pic);
801 tmp = (current_thread_info()->kernel_cntd0 += (unsigned int)pic);
802 __put_user(tmp, current_thread_info()->user_cntd0);
803 tmp = (current_thread_info()->kernel_cntd1 += (pic >> 32));
804 __put_user(tmp, current_thread_info()->user_cntd1);
805 reset_pic();
806}
807
808SYSCALL_DEFINE4(perfctr, int, opcode, unsigned long, arg0,
809 unsigned long, arg1, unsigned long, arg2)
810{
811 int err = 0;
812
813 switch(opcode) {
814 case PERFCTR_ON:
815 current_thread_info()->pcr_reg = arg2;
816 current_thread_info()->user_cntd0 = (u64 __user *) arg0;
817 current_thread_info()->user_cntd1 = (u64 __user *) arg1;
818 current_thread_info()->kernel_cntd0 =
819 current_thread_info()->kernel_cntd1 = 0;
820 write_pcr(arg2);
821 reset_pic();
822 set_thread_flag(TIF_PERFCTR);
823 break;
824
825 case PERFCTR_OFF:
826 err = -EINVAL;
827 if (test_thread_flag(TIF_PERFCTR)) {
828 current_thread_info()->user_cntd0 =
829 current_thread_info()->user_cntd1 = NULL;
830 current_thread_info()->pcr_reg = 0;
831 write_pcr(0);
832 clear_thread_flag(TIF_PERFCTR);
833 err = 0;
834 }
835 break;
836
837 case PERFCTR_READ: {
838 unsigned long pic, tmp;
839
840 if (!test_thread_flag(TIF_PERFCTR)) {
841 err = -EINVAL;
842 break;
843 }
844 read_pic(pic);
845 tmp = (current_thread_info()->kernel_cntd0 += (unsigned int)pic);
846 err |= __put_user(tmp, current_thread_info()->user_cntd0);
847 tmp = (current_thread_info()->kernel_cntd1 += (pic >> 32));
848 err |= __put_user(tmp, current_thread_info()->user_cntd1);
849 reset_pic();
850 break;
851 }
852
853 case PERFCTR_CLRPIC:
854 if (!test_thread_flag(TIF_PERFCTR)) {
855 err = -EINVAL;
856 break;
857 }
858 current_thread_info()->kernel_cntd0 =
859 current_thread_info()->kernel_cntd1 = 0;
860 reset_pic();
861 break;
862
863 case PERFCTR_SETPCR: {
864 u64 __user *user_pcr = (u64 __user *)arg0;
865
866 if (!test_thread_flag(TIF_PERFCTR)) {
867 err = -EINVAL;
868 break;
869 }
870 err |= __get_user(current_thread_info()->pcr_reg, user_pcr);
871 write_pcr(current_thread_info()->pcr_reg);
872 current_thread_info()->kernel_cntd0 =
873 current_thread_info()->kernel_cntd1 = 0;
874 reset_pic();
875 break;
876 }
877
878 case PERFCTR_GETPCR: {
879 u64 __user *user_pcr = (u64 __user *)arg0;
880
881 if (!test_thread_flag(TIF_PERFCTR)) {
882 err = -EINVAL;
883 break;
884 }
885 err |= __put_user(current_thread_info()->pcr_reg, user_pcr);
886 break;
887 }
888
889 default:
890 err = -EINVAL;
891 break;
892 };
893 return err;
894}
895
896/* 757/*
897 * Do a system call from kernel instead of calling sys_execve so we 758 * Do a system call from kernel instead of calling sys_execve so we
898 * end up with proper pt_regs. 759 * end up with proper pt_regs.
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index d150c2aa98d2..1d7e274f3f2b 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -62,7 +62,7 @@ sys32_rt_sigreturn:
62#endif 62#endif
63 .align 32 63 .align 32
641: ldx [%g6 + TI_FLAGS], %l5 641: ldx [%g6 + TI_FLAGS], %l5
65 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0 65 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
66 be,pt %icc, rtrap 66 be,pt %icc, rtrap
67 nop 67 nop
68 call syscall_trace_leave 68 call syscall_trace_leave
@@ -110,31 +110,12 @@ sys_clone:
110 110
111 .globl ret_from_syscall 111 .globl ret_from_syscall
112ret_from_syscall: 112ret_from_syscall:
113 /* Clear current_thread_info()->new_child, and 113 /* Clear current_thread_info()->new_child. */
114 * check performance counter stuff too.
115 */
116 stb %g0, [%g6 + TI_NEW_CHILD] 114 stb %g0, [%g6 + TI_NEW_CHILD]
117 ldx [%g6 + TI_FLAGS], %l0 115 ldx [%g6 + TI_FLAGS], %l0
118 call schedule_tail 116 call schedule_tail
119 mov %g7, %o0 117 mov %g7, %o0
120 andcc %l0, _TIF_PERFCTR, %g0 118 ba,pt %xcc, ret_sys_call
121 be,pt %icc, 1f
122 nop
123 ldx [%g6 + TI_PCR], %o7
124 wr %g0, %o7, %pcr
125
126 /* Blackbird errata workaround. See commentary in
127 * smp.c:smp_percpu_timer_interrupt() for more
128 * information.
129 */
130 ba,pt %xcc, 99f
131 nop
132
133 .align 64
13499: wr %g0, %g0, %pic
135 rd %pic, %g0
136
1371: ba,pt %xcc, ret_sys_call
138 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0 119 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0
139 120
140 .globl sparc_exit 121 .globl sparc_exit
@@ -187,7 +168,7 @@ linux_syscall_trace:
187 .globl linux_sparc_syscall32 168 .globl linux_sparc_syscall32
188linux_sparc_syscall32: 169linux_sparc_syscall32:
189 /* Direct access to user regs, much faster. */ 170 /* Direct access to user regs, much faster. */
190 cmp %g1, NR_SYSCALLS ! IEU1 Group 171 cmp %g1, NR_syscalls ! IEU1 Group
191 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI 172 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
192 srl %i0, 0, %o0 ! IEU0 173 srl %i0, 0, %o0 ! IEU0
193 sll %g1, 2, %l4 ! IEU0 Group 174 sll %g1, 2, %l4 ! IEU0 Group
@@ -198,7 +179,7 @@ linux_sparc_syscall32:
198 179
199 srl %i5, 0, %o5 ! IEU1 180 srl %i5, 0, %o5 ! IEU1
200 srl %i2, 0, %o2 ! IEU0 Group 181 srl %i2, 0, %o2 ! IEU0 Group
201 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0 182 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
202 bne,pn %icc, linux_syscall_trace32 ! CTI 183 bne,pn %icc, linux_syscall_trace32 ! CTI
203 mov %i0, %l5 ! IEU1 184 mov %i0, %l5 ! IEU1
204 call %l7 ! CTI Group brk forced 185 call %l7 ! CTI Group brk forced
@@ -210,7 +191,7 @@ linux_sparc_syscall32:
210 .globl linux_sparc_syscall 191 .globl linux_sparc_syscall
211linux_sparc_syscall: 192linux_sparc_syscall:
212 /* Direct access to user regs, much faster. */ 193 /* Direct access to user regs, much faster. */
213 cmp %g1, NR_SYSCALLS ! IEU1 Group 194 cmp %g1, NR_syscalls ! IEU1 Group
214 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI 195 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
215 mov %i0, %o0 ! IEU0 196 mov %i0, %o0 ! IEU0
216 sll %g1, 2, %l4 ! IEU0 Group 197 sll %g1, 2, %l4 ! IEU0 Group
@@ -221,7 +202,7 @@ linux_sparc_syscall:
221 202
222 mov %i3, %o3 ! IEU1 203 mov %i3, %o3 ! IEU1
223 mov %i4, %o4 ! IEU0 Group 204 mov %i4, %o4 ! IEU0 Group
224 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0 205 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
225 bne,pn %icc, linux_syscall_trace ! CTI Group 206 bne,pn %icc, linux_syscall_trace ! CTI Group
226 mov %i0, %l5 ! IEU0 207 mov %i0, %l5 ! IEU0
2272: call %l7 ! CTI Group brk forced 2082: call %l7 ! CTI Group brk forced
@@ -245,7 +226,7 @@ ret_sys_call:
245 226
246 cmp %o0, -ERESTART_RESTARTBLOCK 227 cmp %o0, -ERESTART_RESTARTBLOCK
247 bgeu,pn %xcc, 1f 228 bgeu,pn %xcc, 1f
248 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6 229 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
24980: 23080:
250 /* System call success, clear Carry condition code. */ 231 /* System call success, clear Carry condition code. */
251 andn %g3, %g2, %g3 232 andn %g3, %g2, %g3
@@ -260,7 +241,7 @@ ret_sys_call:
260 /* System call failure, set Carry condition code. 241 /* System call failure, set Carry condition code.
261 * Also, get abs(errno) to return to the process. 242 * Also, get abs(errno) to return to the process.
262 */ 243 */
263 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6 244 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
264 sub %g0, %o0, %o0 245 sub %g0, %o0, %o0
265 or %g3, %g2, %g3 246 or %g3, %g2, %g3
266 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 247 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
index ca39c606fe8e..1eb8b00aed75 100644
--- a/arch/sparc/kernel/sysfs.c
+++ b/arch/sparc/kernel/sysfs.c
@@ -107,12 +107,12 @@ static unsigned long run_on_cpu(unsigned long cpu,
107 unsigned long ret; 107 unsigned long ret;
108 108
109 /* should return -EINVAL to userspace */ 109 /* should return -EINVAL to userspace */
110 if (set_cpus_allowed(current, cpumask_of_cpu(cpu))) 110 if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
111 return 0; 111 return 0;
112 112
113 ret = func(arg); 113 ret = func(arg);
114 114
115 set_cpus_allowed(current, old_affinity); 115 set_cpus_allowed_ptr(current, &old_affinity);
116 116
117 return ret; 117 return ret;
118} 118}
diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h
index a63c5d2d9849..118759cd7342 100644
--- a/arch/sparc/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
@@ -6,16 +6,12 @@
6#include <asm/utrap.h> 6#include <asm/utrap.h>
7#include <asm/signal.h> 7#include <asm/signal.h>
8 8
9struct new_utsname;
10
11extern asmlinkage unsigned long sys_getpagesize(void); 9extern asmlinkage unsigned long sys_getpagesize(void);
12extern asmlinkage unsigned long sparc_brk(unsigned long brk);
13extern asmlinkage long sparc_pipe(struct pt_regs *regs); 10extern asmlinkage long sparc_pipe(struct pt_regs *regs);
14extern asmlinkage long sys_ipc(unsigned int call, int first, 11extern asmlinkage long sys_sparc_ipc(unsigned int call, int first,
15 unsigned long second, 12 unsigned long second,
16 unsigned long third, 13 unsigned long third,
17 void __user *ptr, long fifth); 14 void __user *ptr, long fifth);
18extern asmlinkage long sparc64_newuname(struct new_utsname __user *name);
19extern asmlinkage long sparc64_personality(unsigned long personality); 15extern asmlinkage long sparc64_personality(unsigned long personality);
20extern asmlinkage long sys64_munmap(unsigned long addr, size_t len); 16extern asmlinkage long sys64_munmap(unsigned long addr, size_t len);
21extern asmlinkage unsigned long sys64_mremap(unsigned long addr, 17extern asmlinkage unsigned long sys64_mremap(unsigned long addr,
@@ -37,8 +33,6 @@ extern asmlinkage long sys_rt_sigaction(int sig,
37 struct sigaction __user *oact, 33 struct sigaction __user *oact,
38 void __user *restorer, 34 void __user *restorer,
39 size_t sigsetsize); 35 size_t sigsetsize);
40extern asmlinkage long sys_perfctr(int opcode, unsigned long arg0,
41 unsigned long arg1, unsigned long arg2);
42 36
43extern asmlinkage void sparc64_set_context(struct pt_regs *regs); 37extern asmlinkage void sparc64_set_context(struct pt_regs *regs);
44extern asmlinkage void sparc64_get_context(struct pt_regs *regs); 38extern asmlinkage void sparc64_get_context(struct pt_regs *regs);
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 0f1658d37490..801fc8e5a0e8 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -19,7 +19,7 @@ sys_call_table:
19/*0*/ .long sys_restart_syscall, sys_exit, sys_fork, sys_read, sys_write 19/*0*/ .long sys_restart_syscall, sys_exit, sys_fork, sys_read, sys_write
20/*5*/ .long sys_open, sys_close, sys_wait4, sys_creat, sys_link 20/*5*/ .long sys_open, sys_close, sys_wait4, sys_creat, sys_link
21/*10*/ .long sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod 21/*10*/ .long sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod
22/*15*/ .long sys_chmod, sys_lchown16, sparc_brk, sys_nis_syscall, sys_lseek 22/*15*/ .long sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, sys_lseek
23/*20*/ .long sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 23/*20*/ .long sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
24/*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause 24/*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause
25/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice 25/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
@@ -67,7 +67,7 @@ sys_call_table:
67/*235*/ .long sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall 67/*235*/ .long sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
68/*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler 68/*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
69/*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep 69/*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
70/*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl 70/*250*/ .long sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
71/*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep 71/*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
72/*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun 72/*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
73/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy 73/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
@@ -82,5 +82,5 @@ sys_call_table:
82/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate 82/*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
83/*315*/ .long sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 83/*315*/ .long sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1
84/*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv 84/*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open 85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg
86 86
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 009825f6e73c..9db058dd039e 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -21,7 +21,7 @@ sys_call_table32:
21/*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write 21/*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write
22/*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link 22/*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link
23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod 23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod
24/*15*/ .word sys_chmod, sys_lchown16, sys_sparc_brk, sys32_perfctr, sys32_lseek 24/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, sys32_lseek
25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause 26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause
27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice 27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
@@ -55,7 +55,7 @@ sys_call_table32:
55/*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents 55/*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents
56 .word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr 56 .word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr
57/*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall 57/*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
58 .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sys_sparc64_newuname 58 .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sys_newuname
59/*190*/ .word sys32_init_module, sys_sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl 59/*190*/ .word sys32_init_module, sys_sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl
60 .word sys32_epoll_wait, sys32_ioprio_set, sys_getppid, sys32_sigaction, sys_sgetmask 60 .word sys32_epoll_wait, sys32_ioprio_set, sys_getppid, sys32_sigaction, sys_sgetmask
61/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir 61/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
@@ -68,7 +68,7 @@ sys_call_table32:
68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall 68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall
69/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler 69/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler
70 .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep 70 .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
71/*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl 71/*250*/ .word sys_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep 72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun 73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
@@ -83,7 +83,7 @@ sys_call_table32:
83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate 83/*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate
84 .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime, compat_sys_signalfd4, sys_eventfd2, sys_epoll_create1 84 .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime, compat_sys_signalfd4, sys_eventfd2, sys_epoll_create1
85/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv 85/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv
86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open 86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg
87 87
88#endif /* CONFIG_COMPAT */ 88#endif /* CONFIG_COMPAT */
89 89
@@ -96,7 +96,7 @@ sys_call_table:
96/*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write 96/*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write
97/*5*/ .word sys_open, sys_close, sys_wait4, sys_creat, sys_link 97/*5*/ .word sys_open, sys_close, sys_wait4, sys_creat, sys_link
98/*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod 98/*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod
99/*15*/ .word sys_chmod, sys_lchown, sys_sparc_brk, sys_perfctr, sys_lseek 99/*15*/ .word sys_chmod, sys_lchown, sys_brk, sys_nis_syscall, sys_lseek
100/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid 100/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid
101/*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall 101/*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
102/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice 102/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
@@ -130,13 +130,13 @@ sys_call_table:
130/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents 130/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
131 .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr 131 .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
132/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_nis_syscall, sys_ni_syscall 132/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_nis_syscall, sys_ni_syscall
133 .word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_sparc64_newuname 133 .word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname
134/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl 134/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
135 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, sys_nis_syscall, sys_sgetmask 135 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, sys_nis_syscall, sys_sgetmask
136/*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall 136/*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall
137 .word sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64 137 .word sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
138/*210*/ .word sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo 138/*210*/ .word sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo
139 .word sys_ipc, sys_nis_syscall, sys_clone, sys_ioprio_get, sys_adjtimex 139 .word sys_sparc_ipc, sys_nis_syscall, sys_clone, sys_ioprio_get, sys_adjtimex
140/*220*/ .word sys_nis_syscall, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid 140/*220*/ .word sys_nis_syscall, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid
141 .word sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid, sys_setfsgid 141 .word sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid, sys_setfsgid
142/*230*/ .word sys_select, sys_nis_syscall, sys_splice, sys_stime, sys_statfs64 142/*230*/ .word sys_select, sys_nis_syscall, sys_splice, sys_stime, sys_statfs64
@@ -158,4 +158,4 @@ sys_call_table:
158/*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate 158/*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
159 .word sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 159 .word sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1
160/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv 160/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
161 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open 161 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 614ac7b4a9dd..0d4c09b15efc 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -35,6 +35,7 @@
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36 36
37#include <asm/oplib.h> 37#include <asm/oplib.h>
38#include <asm/timex.h>
38#include <asm/timer.h> 39#include <asm/timer.h>
39#include <asm/system.h> 40#include <asm/system.h>
40#include <asm/irq.h> 41#include <asm/irq.h>
@@ -51,7 +52,6 @@ DEFINE_SPINLOCK(rtc_lock);
51EXPORT_SYMBOL(rtc_lock); 52EXPORT_SYMBOL(rtc_lock);
52 53
53static int set_rtc_mmss(unsigned long); 54static int set_rtc_mmss(unsigned long);
54static int sbus_do_settimeofday(struct timespec *tv);
55 55
56unsigned long profile_pc(struct pt_regs *regs) 56unsigned long profile_pc(struct pt_regs *regs)
57{ 57{
@@ -76,6 +76,8 @@ EXPORT_SYMBOL(profile_pc);
76 76
77__volatile__ unsigned int *master_l10_counter; 77__volatile__ unsigned int *master_l10_counter;
78 78
79u32 (*do_arch_gettimeoffset)(void);
80
79/* 81/*
80 * timer_interrupt() needs to keep up the real-time clock, 82 * timer_interrupt() needs to keep up the real-time clock,
81 * as well as call the "do_timer()" routine every clocktick 83 * as well as call the "do_timer()" routine every clocktick
@@ -196,38 +198,14 @@ static int __init clock_init(void)
196{ 198{
197 return of_register_driver(&clock_driver, &of_platform_bus_type); 199 return of_register_driver(&clock_driver, &of_platform_bus_type);
198} 200}
199
200/* Must be after subsys_initcall() so that busses are probed. Must 201/* Must be after subsys_initcall() so that busses are probed. Must
201 * be before device_initcall() because things like the RTC driver 202 * be before device_initcall() because things like the RTC driver
202 * need to see the clock registers. 203 * need to see the clock registers.
203 */ 204 */
204fs_initcall(clock_init); 205fs_initcall(clock_init);
205 206
206static void __init sbus_time_init(void)
207{
208
209 BTFIXUPSET_CALL(bus_do_settimeofday, sbus_do_settimeofday, BTFIXUPCALL_NORM);
210 btfixup();
211
212 sparc_init_timers(timer_interrupt);
213
214 /* Now that OBP ticker has been silenced, it is safe to enable IRQ. */
215 local_irq_enable();
216}
217
218void __init time_init(void)
219{
220#ifdef CONFIG_PCI
221 extern void pci_time_init(void);
222 if (pcic_present()) {
223 pci_time_init();
224 return;
225 }
226#endif
227 sbus_time_init();
228}
229 207
230static inline unsigned long do_gettimeoffset(void) 208u32 sbus_do_gettimeoffset(void)
231{ 209{
232 unsigned long val = *master_l10_counter; 210 unsigned long val = *master_l10_counter;
233 unsigned long usec = (val >> 10) & 0x1fffff; 211 unsigned long usec = (val >> 10) & 0x1fffff;
@@ -236,86 +214,39 @@ static inline unsigned long do_gettimeoffset(void)
236 if (val & 0x80000000) 214 if (val & 0x80000000)
237 usec += 1000000 / HZ; 215 usec += 1000000 / HZ;
238 216
239 return usec; 217 return usec * 1000;
240} 218}
241 219
242/* Ok, my cute asm atomicity trick doesn't work anymore.
243 * There are just too many variables that need to be protected
244 * now (both members of xtime, et al.)
245 */
246void do_gettimeofday(struct timeval *tv)
247{
248 unsigned long flags;
249 unsigned long seq;
250 unsigned long usec, sec;
251 unsigned long max_ntp_tick = tick_usec - tickadj;
252
253 do {
254 seq = read_seqbegin_irqsave(&xtime_lock, flags);
255 usec = do_gettimeoffset();
256
257 /*
258 * If time_adjust is negative then NTP is slowing the clock
259 * so make sure not to go into next possible interval.
260 * Better to lose some accuracy than have time go backwards..
261 */
262 if (unlikely(time_adjust < 0))
263 usec = min(usec, max_ntp_tick);
264
265 sec = xtime.tv_sec;
266 usec += (xtime.tv_nsec / 1000);
267 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
268
269 while (usec >= 1000000) {
270 usec -= 1000000;
271 sec++;
272 }
273 220
274 tv->tv_sec = sec; 221u32 arch_gettimeoffset(void)
275 tv->tv_usec = usec;
276}
277
278EXPORT_SYMBOL(do_gettimeofday);
279
280int do_settimeofday(struct timespec *tv)
281{ 222{
282 int ret; 223 if (unlikely(!do_arch_gettimeoffset))
283 224 return 0;
284 write_seqlock_irq(&xtime_lock); 225 return do_arch_gettimeoffset();
285 ret = bus_do_settimeofday(tv);
286 write_sequnlock_irq(&xtime_lock);
287 clock_was_set();
288 return ret;
289} 226}
290 227
291EXPORT_SYMBOL(do_settimeofday); 228static void __init sbus_time_init(void)
292
293static int sbus_do_settimeofday(struct timespec *tv)
294{ 229{
295 time_t wtm_sec, sec = tv->tv_sec; 230 do_arch_gettimeoffset = sbus_do_gettimeoffset;
296 long wtm_nsec, nsec = tv->tv_nsec;
297 231
298 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) 232 btfixup();
299 return -EINVAL;
300
301 /*
302 * This is revolting. We need to set "xtime" correctly. However, the
303 * value in this location is the value at the most recent update of
304 * wall time. Discover what correction gettimeofday() would have
305 * made, and then undo it!
306 */
307 nsec -= 1000 * do_gettimeoffset();
308
309 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
310 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
311 233
312 set_normalized_timespec(&xtime, sec, nsec); 234 sparc_init_timers(timer_interrupt);
313 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); 235}
314 236
315 ntp_clear(); 237void __init time_init(void)
316 return 0; 238{
239#ifdef CONFIG_PCI
240 extern void pci_time_init(void);
241 if (pcic_present()) {
242 pci_time_init();
243 return;
244 }
245#endif
246 sbus_time_init();
317} 247}
318 248
249
319static int set_rtc_mmss(unsigned long secs) 250static int set_rtc_mmss(unsigned long secs)
320{ 251{
321 struct rtc_device *rtc = rtc_class_open("rtc0"); 252 struct rtc_device *rtc = rtc_class_open("rtc0");
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index da1218e8ee87..c7bbe6cf7b85 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -35,6 +35,7 @@
35#include <linux/clocksource.h> 35#include <linux/clocksource.h>
36#include <linux/of_device.h> 36#include <linux/of_device.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38#include <linux/ftrace.h>
38 39
39#include <asm/oplib.h> 40#include <asm/oplib.h>
40#include <asm/timer.h> 41#include <asm/timer.h>
@@ -717,7 +718,7 @@ static struct clock_event_device sparc64_clockevent = {
717}; 718};
718static DEFINE_PER_CPU(struct clock_event_device, sparc64_events); 719static DEFINE_PER_CPU(struct clock_event_device, sparc64_events);
719 720
720void timer_interrupt(int irq, struct pt_regs *regs) 721void __irq_entry timer_interrupt(int irq, struct pt_regs *regs)
721{ 722{
722 struct pt_regs *old_regs = set_irq_regs(regs); 723 struct pt_regs *old_regs = set_irq_regs(regs);
723 unsigned long tick_mask = tick_ops->softint_mask; 724 unsigned long tick_mask = tick_ops->softint_mask;
@@ -728,6 +729,7 @@ void timer_interrupt(int irq, struct pt_regs *regs)
728 729
729 irq_enter(); 730 irq_enter();
730 731
732 local_cpu_data().irq0_irqs++;
731 kstat_incr_irqs_this_cpu(0, irq_to_desc(0)); 733 kstat_incr_irqs_this_cpu(0, irq_to_desc(0));
732 734
733 if (unlikely(!evt->event_handler)) { 735 if (unlikely(!evt->event_handler)) {
@@ -774,26 +776,9 @@ void __devinit setup_sparc64_timer(void)
774static struct clocksource clocksource_tick = { 776static struct clocksource clocksource_tick = {
775 .rating = 100, 777 .rating = 100,
776 .mask = CLOCKSOURCE_MASK(64), 778 .mask = CLOCKSOURCE_MASK(64),
777 .shift = 16,
778 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 779 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
779}; 780};
780 781
781static void __init setup_clockevent_multiplier(unsigned long hz)
782{
783 unsigned long mult, shift = 32;
784
785 while (1) {
786 mult = div_sc(hz, NSEC_PER_SEC, shift);
787 if (mult && (mult >> 32UL) == 0UL)
788 break;
789
790 shift--;
791 }
792
793 sparc64_clockevent.shift = shift;
794 sparc64_clockevent.mult = mult;
795}
796
797static unsigned long tb_ticks_per_usec __read_mostly; 782static unsigned long tb_ticks_per_usec __read_mostly;
798 783
799void __delay(unsigned long loops) 784void __delay(unsigned long loops)
@@ -828,9 +813,7 @@ void __init time_init(void)
828 clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT); 813 clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT);
829 814
830 clocksource_tick.name = tick_ops->name; 815 clocksource_tick.name = tick_ops->name;
831 clocksource_tick.mult = 816 clocksource_calc_mult_shift(&clocksource_tick, freq, 4);
832 clocksource_hz2mult(freq,
833 clocksource_tick.shift);
834 clocksource_tick.read = clocksource_tick_read; 817 clocksource_tick.read = clocksource_tick_read;
835 818
836 printk("clocksource: mult[%x] shift[%d]\n", 819 printk("clocksource: mult[%x] shift[%d]\n",
@@ -839,15 +822,14 @@ void __init time_init(void)
839 clocksource_register(&clocksource_tick); 822 clocksource_register(&clocksource_tick);
840 823
841 sparc64_clockevent.name = tick_ops->name; 824 sparc64_clockevent.name = tick_ops->name;
842 825 clockevents_calc_mult_shift(&sparc64_clockevent, freq, 4);
843 setup_clockevent_multiplier(freq);
844 826
845 sparc64_clockevent.max_delta_ns = 827 sparc64_clockevent.max_delta_ns =
846 clockevent_delta2ns(0x7fffffffffffffffUL, &sparc64_clockevent); 828 clockevent_delta2ns(0x7fffffffffffffffUL, &sparc64_clockevent);
847 sparc64_clockevent.min_delta_ns = 829 sparc64_clockevent.min_delta_ns =
848 clockevent_delta2ns(0xF, &sparc64_clockevent); 830 clockevent_delta2ns(0xF, &sparc64_clockevent);
849 831
850 printk("clockevent: mult[%lx] shift[%d]\n", 832 printk("clockevent: mult[%x] shift[%d]\n",
851 sparc64_clockevent.mult, sparc64_clockevent.shift); 833 sparc64_clockevent.mult, sparc64_clockevent.shift);
852 834
853 setup_sparc64_timer(); 835 setup_sparc64_timer();
diff --git a/arch/sparc/kernel/trampoline_32.S b/arch/sparc/kernel/trampoline_32.S
index 5e235c52d667..691f484e03b3 100644
--- a/arch/sparc/kernel/trampoline_32.S
+++ b/arch/sparc/kernel/trampoline_32.S
@@ -15,7 +15,7 @@
15#include <asm/contregs.h> 15#include <asm/contregs.h>
16#include <asm/thread_info.h> 16#include <asm/thread_info.h>
17 17
18 .globl sun4m_cpu_startup, __smp4m_processor_id 18 .globl sun4m_cpu_startup, __smp4m_processor_id, __leon_processor_id
19 .globl sun4d_cpu_startup, __smp4d_processor_id 19 .globl sun4d_cpu_startup, __smp4d_processor_id
20 20
21 __CPUINIT 21 __CPUINIT
@@ -106,6 +106,12 @@ __smp4d_processor_id:
106 retl 106 retl
107 mov %g1, %o7 107 mov %g1, %o7
108 108
109__leon_processor_id:
110 rd %asr17,%g2
111 srl %g2,28,%g2
112 retl
113 mov %g1, %o7
114
109/* CPUID in bootbus can be found at PA 0xff0140000 */ 115/* CPUID in bootbus can be found at PA 0xff0140000 */
110#define SUN4D_BOOTBUS_CPUID 0xf0140000 116#define SUN4D_BOOTBUS_CPUID 0xf0140000
111 117
@@ -160,3 +166,64 @@ sun4d_cpu_startup:
160 nop 166 nop
161 167
162 b,a smp_do_cpu_idle 168 b,a smp_do_cpu_idle
169
170#ifdef CONFIG_SPARC_LEON
171
172 __CPUINIT
173 .align 4
174 .global leon_smp_cpu_startup, smp_penguin_ctable
175
176leon_smp_cpu_startup:
177
178 set smp_penguin_ctable,%g1
179 ld [%g1+4],%g1
180 srl %g1,4,%g1
181 set 0x00000100,%g5 /* SRMMU_CTXTBL_PTR */
182 sta %g1, [%g5] ASI_M_MMUREGS
183
184 /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */
185 set (PSR_PIL | PSR_S | PSR_PS), %g1
186 wr %g1, 0x0, %psr ! traps off though
187 WRITE_PAUSE
188
189 /* Our %wim is one behind CWP */
190 mov 2, %g1
191 wr %g1, 0x0, %wim
192 WRITE_PAUSE
193
194 /* Set tbr - we use just one trap table. */
195 set trapbase, %g1
196 wr %g1, 0x0, %tbr
197 WRITE_PAUSE
198
199 /* Get our CPU id */
200 rd %asr17,%g3
201
202 /* Give ourselves a stack and curptr. */
203 set current_set, %g5
204 srl %g3, 28, %g4
205 sll %g4, 2, %g4
206 ld [%g5 + %g4], %g6
207
208 sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp
209 or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp
210 add %g6, %sp, %sp
211
212 /* Turn on traps (PSR_ET). */
213 rd %psr, %g1
214 wr %g1, PSR_ET, %psr ! traps on
215 WRITE_PAUSE
216
217 /* Init our caches, etc. */
218 set poke_srmmu, %g5
219 ld [%g5], %g5
220 call %g5
221 nop
222
223 /* Start this processor. */
224 call leon_callin
225 nop
226
227 b,a smp_do_cpu_idle
228
229#endif
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index 10f7bb9fc140..9da57f032983 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -17,6 +17,7 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/kdebug.h> 19#include <linux/kdebug.h>
20#include <linux/gfp.h>
20 21
21#include <asm/smp.h> 22#include <asm/smp.h>
22#include <asm/delay.h> 23#include <asm/delay.h>
@@ -2202,27 +2203,6 @@ void dump_stack(void)
2202 2203
2203EXPORT_SYMBOL(dump_stack); 2204EXPORT_SYMBOL(dump_stack);
2204 2205
2205static inline int is_kernel_stack(struct task_struct *task,
2206 struct reg_window *rw)
2207{
2208 unsigned long rw_addr = (unsigned long) rw;
2209 unsigned long thread_base, thread_end;
2210
2211 if (rw_addr < PAGE_OFFSET) {
2212 if (task != &init_task)
2213 return 0;
2214 }
2215
2216 thread_base = (unsigned long) task_stack_page(task);
2217 thread_end = thread_base + sizeof(union thread_union);
2218 if (rw_addr >= thread_base &&
2219 rw_addr < thread_end &&
2220 !(rw_addr & 0x7UL))
2221 return 1;
2222
2223 return 0;
2224}
2225
2226static inline struct reg_window *kernel_stack_up(struct reg_window *rw) 2206static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2227{ 2207{
2228 unsigned long fp = rw->ins[6]; 2208 unsigned long fp = rw->ins[6];
@@ -2251,6 +2231,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2251 show_regs(regs); 2231 show_regs(regs);
2252 add_taint(TAINT_DIE); 2232 add_taint(TAINT_DIE);
2253 if (regs->tstate & TSTATE_PRIV) { 2233 if (regs->tstate & TSTATE_PRIV) {
2234 struct thread_info *tp = current_thread_info();
2254 struct reg_window *rw = (struct reg_window *) 2235 struct reg_window *rw = (struct reg_window *)
2255 (regs->u_regs[UREG_FP] + STACK_BIAS); 2236 (regs->u_regs[UREG_FP] + STACK_BIAS);
2256 2237
@@ -2258,8 +2239,8 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2258 * find some badly aligned kernel stack. 2239 * find some badly aligned kernel stack.
2259 */ 2240 */
2260 while (rw && 2241 while (rw &&
2261 count++ < 30&& 2242 count++ < 30 &&
2262 is_kernel_stack(current, rw)) { 2243 kstack_valid(tp, (unsigned long) rw)) {
2263 printk("Caller[%016lx]: %pS\n", rw->ins[7], 2244 printk("Caller[%016lx]: %pS\n", rw->ins[7],
2264 (void *) rw->ins[7]); 2245 (void *) rw->ins[7]);
2265 2246
@@ -2548,15 +2529,6 @@ void __init trap_init(void)
2548 rwbuf_stkptrs) || 2529 rwbuf_stkptrs) ||
2549 TI_GSR != offsetof(struct thread_info, gsr) || 2530 TI_GSR != offsetof(struct thread_info, gsr) ||
2550 TI_XFSR != offsetof(struct thread_info, xfsr) || 2531 TI_XFSR != offsetof(struct thread_info, xfsr) ||
2551 TI_USER_CNTD0 != offsetof(struct thread_info,
2552 user_cntd0) ||
2553 TI_USER_CNTD1 != offsetof(struct thread_info,
2554 user_cntd1) ||
2555 TI_KERN_CNTD0 != offsetof(struct thread_info,
2556 kernel_cntd0) ||
2557 TI_KERN_CNTD1 != offsetof(struct thread_info,
2558 kernel_cntd1) ||
2559 TI_PCR != offsetof(struct thread_info, pcr_reg) ||
2560 TI_PRE_COUNT != offsetof(struct thread_info, 2532 TI_PRE_COUNT != offsetof(struct thread_info,
2561 preempt_count) || 2533 preempt_count) ||
2562 TI_NEW_CHILD != offsetof(struct thread_info, new_child) || 2534 TI_NEW_CHILD != offsetof(struct thread_info, new_child) ||
diff --git a/arch/sparc/kernel/tsb.S b/arch/sparc/kernel/tsb.S
index 8c91d9b29a2f..db15d123f054 100644
--- a/arch/sparc/kernel/tsb.S
+++ b/arch/sparc/kernel/tsb.S
@@ -191,10 +191,12 @@ tsb_dtlb_load:
191 191
192tsb_itlb_load: 192tsb_itlb_load:
193 /* Executable bit must be set. */ 193 /* Executable bit must be set. */
194661: andcc %g5, _PAGE_EXEC_4U, %g0 194661: sethi %hi(_PAGE_EXEC_4U), %g4
195 .section .sun4v_1insn_patch, "ax" 195 andcc %g5, %g4, %g0
196 .section .sun4v_2insn_patch, "ax"
196 .word 661b 197 .word 661b
197 andcc %g5, _PAGE_EXEC_4V, %g0 198 andcc %g5, _PAGE_EXEC_4V, %g0
199 nop
198 .previous 200 .previous
199 201
200 be,pn %xcc, tsb_do_fault 202 be,pn %xcc, tsb_do_fault
diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c
index 6b1e6cde6fff..f8514e291e15 100644
--- a/arch/sparc/kernel/unaligned_32.c
+++ b/arch/sparc/kernel/unaligned_32.c
@@ -17,8 +17,7 @@
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20 20#include <linux/perf_event.h>
21/* #define DEBUG_MNA */
22 21
23enum direction { 22enum direction {
24 load, /* ld, ldd, ldh, ldsh */ 23 load, /* ld, ldd, ldh, ldsh */
@@ -29,12 +28,6 @@ enum direction {
29 invalid, 28 invalid,
30}; 29};
31 30
32#ifdef DEBUG_MNA
33static char *dirstrings[] = {
34 "load", "store", "both", "fpload", "fpstore", "invalid"
35};
36#endif
37
38static inline enum direction decode_direction(unsigned int insn) 31static inline enum direction decode_direction(unsigned int insn)
39{ 32{
40 unsigned long tmp = (insn >> 21) & 1; 33 unsigned long tmp = (insn >> 21) & 1;
@@ -255,10 +248,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
255 unsigned long addr = compute_effective_address(regs, insn); 248 unsigned long addr = compute_effective_address(regs, insn);
256 int err; 249 int err;
257 250
258#ifdef DEBUG_MNA 251 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, addr);
259 printk("KMNA: pc=%08lx [dir=%s addr=%08lx size=%d] retpc[%08lx]\n",
260 regs->pc, dirstrings[dir], addr, size, regs->u_regs[UREG_RETPC]);
261#endif
262 switch (dir) { 252 switch (dir) {
263 case load: 253 case load:
264 err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f), 254 err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f),
@@ -350,6 +340,7 @@ asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn)
350 } 340 }
351 341
352 addr = compute_effective_address(regs, insn); 342 addr = compute_effective_address(regs, insn);
343 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, addr);
353 switch(dir) { 344 switch(dir) {
354 case load: 345 case load:
355 err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f), 346 err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f),
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index 379209982a07..c752c4c479bd 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -20,10 +20,10 @@
20#include <asm/uaccess.h> 20#include <asm/uaccess.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/bitops.h> 22#include <linux/bitops.h>
23#include <linux/perf_event.h>
24#include <linux/ratelimit.h>
23#include <asm/fpumacro.h> 25#include <asm/fpumacro.h>
24 26
25/* #define DEBUG_MNA */
26
27enum direction { 27enum direction {
28 load, /* ld, ldd, ldh, ldsh */ 28 load, /* ld, ldd, ldh, ldsh */
29 store, /* st, std, sth, stsh */ 29 store, /* st, std, sth, stsh */
@@ -33,12 +33,6 @@ enum direction {
33 invalid, 33 invalid,
34}; 34};
35 35
36#ifdef DEBUG_MNA
37static char *dirstrings[] = {
38 "load", "store", "both", "fpload", "fpstore", "invalid"
39};
40#endif
41
42static inline enum direction decode_direction(unsigned int insn) 36static inline enum direction decode_direction(unsigned int insn)
43{ 37{
44 unsigned long tmp = (insn >> 21) & 1; 38 unsigned long tmp = (insn >> 21) & 1;
@@ -56,7 +50,7 @@ static inline enum direction decode_direction(unsigned int insn)
56} 50}
57 51
58/* 16 = double-word, 8 = extra-word, 4 = word, 2 = half-word */ 52/* 16 = double-word, 8 = extra-word, 4 = word, 2 = half-word */
59static inline int decode_access_size(unsigned int insn) 53static inline int decode_access_size(struct pt_regs *regs, unsigned int insn)
60{ 54{
61 unsigned int tmp; 55 unsigned int tmp;
62 56
@@ -72,7 +66,7 @@ static inline int decode_access_size(unsigned int insn)
72 return 2; 66 return 2;
73 else { 67 else {
74 printk("Impossible unaligned trap. insn=%08x\n", insn); 68 printk("Impossible unaligned trap. insn=%08x\n", insn);
75 die_if_kernel("Byte sized unaligned access?!?!", current_thread_info()->kregs); 69 die_if_kernel("Byte sized unaligned access?!?!", regs);
76 70
77 /* GCC should never warn that control reaches the end 71 /* GCC should never warn that control reaches the end
78 * of this function without returning a value because 72 * of this function without returning a value because
@@ -281,13 +275,9 @@ static void kernel_mna_trap_fault(int fixup_tstate_asi)
281 275
282static void log_unaligned(struct pt_regs *regs) 276static void log_unaligned(struct pt_regs *regs)
283{ 277{
284 static unsigned long count, last_time; 278 static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
285 279
286 if (time_after(jiffies, last_time + 5 * HZ)) 280 if (__ratelimit(&ratelimit)) {
287 count = 0;
288 if (count < 5) {
289 last_time = jiffies;
290 count++;
291 printk("Kernel unaligned access at TPC[%lx] %pS\n", 281 printk("Kernel unaligned access at TPC[%lx] %pS\n",
292 regs->tpc, (void *) regs->tpc); 282 regs->tpc, (void *) regs->tpc);
293 } 283 }
@@ -296,7 +286,7 @@ static void log_unaligned(struct pt_regs *regs)
296asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) 286asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
297{ 287{
298 enum direction dir = decode_direction(insn); 288 enum direction dir = decode_direction(insn);
299 int size = decode_access_size(insn); 289 int size = decode_access_size(regs, insn);
300 int orig_asi, asi; 290 int orig_asi, asi;
301 291
302 current_thread_info()->kern_una_regs = regs; 292 current_thread_info()->kern_una_regs = regs;
@@ -327,12 +317,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
327 317
328 addr = compute_effective_address(regs, insn, 318 addr = compute_effective_address(regs, insn,
329 ((insn >> 25) & 0x1f)); 319 ((insn >> 25) & 0x1f));
330#ifdef DEBUG_MNA 320 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, addr);
331 printk("KMNA: pc=%016lx [dir=%s addr=%016lx size=%d] "
332 "retpc[%016lx]\n",
333 regs->tpc, dirstrings[dir], addr, size,
334 regs->u_regs[UREG_RETPC]);
335#endif
336 switch (asi) { 321 switch (asi) {
337 case ASI_NL: 322 case ASI_NL:
338 case ASI_AIUPL: 323 case ASI_AIUPL:
@@ -399,6 +384,7 @@ int handle_popc(u32 insn, struct pt_regs *regs)
399 int ret, i, rd = ((insn >> 25) & 0x1f); 384 int ret, i, rd = ((insn >> 25) & 0x1f);
400 int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; 385 int from_kernel = (regs->tstate & TSTATE_PRIV) != 0;
401 386
387 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0);
402 if (insn & 0x2000) { 388 if (insn & 0x2000) {
403 maybe_flush_windows(0, 0, rd, from_kernel); 389 maybe_flush_windows(0, 0, rd, from_kernel);
404 value = sign_extend_imm13(insn); 390 value = sign_extend_imm13(insn);
@@ -445,6 +431,8 @@ int handle_ldf_stq(u32 insn, struct pt_regs *regs)
445 int asi = decode_asi(insn, regs); 431 int asi = decode_asi(insn, regs);
446 int flag = (freg < 32) ? FPRS_DL : FPRS_DU; 432 int flag = (freg < 32) ? FPRS_DL : FPRS_DU;
447 433
434 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0);
435
448 save_and_clear_fpu(); 436 save_and_clear_fpu();
449 current_thread_info()->xfsr[0] &= ~0x1c000; 437 current_thread_info()->xfsr[0] &= ~0x1c000;
450 if (freg & 3) { 438 if (freg & 3) {
@@ -566,6 +554,8 @@ void handle_ld_nf(u32 insn, struct pt_regs *regs)
566 int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; 554 int from_kernel = (regs->tstate & TSTATE_PRIV) != 0;
567 unsigned long *reg; 555 unsigned long *reg;
568 556
557 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0);
558
569 maybe_flush_windows(0, 0, rd, from_kernel); 559 maybe_flush_windows(0, 0, rd, from_kernel);
570 reg = fetch_reg_addr(rd, regs); 560 reg = fetch_reg_addr(rd, regs);
571 if (from_kernel || rd < 16) { 561 if (from_kernel || rd < 16) {
@@ -596,6 +586,7 @@ void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr
596 586
597 if (tstate & TSTATE_PRIV) 587 if (tstate & TSTATE_PRIV)
598 die_if_kernel("lddfmna from kernel", regs); 588 die_if_kernel("lddfmna from kernel", regs);
589 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, sfar);
599 if (test_thread_flag(TIF_32BIT)) 590 if (test_thread_flag(TIF_32BIT))
600 pc = (u32)pc; 591 pc = (u32)pc;
601 if (get_user(insn, (u32 __user *) pc) != -EFAULT) { 592 if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
@@ -642,7 +633,6 @@ daex:
642 return; 633 return;
643 } 634 }
644 advance(regs); 635 advance(regs);
645 return;
646} 636}
647 637
648void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) 638void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)
@@ -657,6 +647,7 @@ void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr
657 647
658 if (tstate & TSTATE_PRIV) 648 if (tstate & TSTATE_PRIV)
659 die_if_kernel("stdfmna from kernel", regs); 649 die_if_kernel("stdfmna from kernel", regs);
650 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, sfar);
660 if (test_thread_flag(TIF_32BIT)) 651 if (test_thread_flag(TIF_32BIT))
661 pc = (u32)pc; 652 pc = (u32)pc;
662 if (get_user(insn, (u32 __user *) pc) != -EFAULT) { 653 if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
@@ -690,5 +681,4 @@ daex:
690 return; 681 return;
691 } 682 }
692 advance(regs); 683 advance(regs);
693 return;
694} 684}
diff --git a/arch/sparc/kernel/us2e_cpufreq.c b/arch/sparc/kernel/us2e_cpufreq.c
index 791c15138f3a..8f982b76c712 100644
--- a/arch/sparc/kernel/us2e_cpufreq.c
+++ b/arch/sparc/kernel/us2e_cpufreq.c
@@ -238,12 +238,12 @@ static unsigned int us2e_freq_get(unsigned int cpu)
238 return 0; 238 return 0;
239 239
240 cpus_allowed = current->cpus_allowed; 240 cpus_allowed = current->cpus_allowed;
241 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 241 set_cpus_allowed_ptr(current, cpumask_of(cpu));
242 242
243 clock_tick = sparc64_get_clock_tick(cpu) / 1000; 243 clock_tick = sparc64_get_clock_tick(cpu) / 1000;
244 estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR); 244 estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR);
245 245
246 set_cpus_allowed(current, cpus_allowed); 246 set_cpus_allowed_ptr(current, &cpus_allowed);
247 247
248 return clock_tick / estar_to_divisor(estar); 248 return clock_tick / estar_to_divisor(estar);
249} 249}
@@ -259,7 +259,7 @@ static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index)
259 return; 259 return;
260 260
261 cpus_allowed = current->cpus_allowed; 261 cpus_allowed = current->cpus_allowed;
262 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 262 set_cpus_allowed_ptr(current, cpumask_of(cpu));
263 263
264 new_freq = clock_tick = sparc64_get_clock_tick(cpu) / 1000; 264 new_freq = clock_tick = sparc64_get_clock_tick(cpu) / 1000;
265 new_bits = index_to_estar_mode(index); 265 new_bits = index_to_estar_mode(index);
@@ -281,7 +281,7 @@ static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index)
281 281
282 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 282 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
283 283
284 set_cpus_allowed(current, cpus_allowed); 284 set_cpus_allowed_ptr(current, &cpus_allowed);
285} 285}
286 286
287static int us2e_freq_target(struct cpufreq_policy *policy, 287static int us2e_freq_target(struct cpufreq_policy *policy,
diff --git a/arch/sparc/kernel/us3_cpufreq.c b/arch/sparc/kernel/us3_cpufreq.c
index 365b6464e2ce..f35d1e794548 100644
--- a/arch/sparc/kernel/us3_cpufreq.c
+++ b/arch/sparc/kernel/us3_cpufreq.c
@@ -86,12 +86,12 @@ static unsigned int us3_freq_get(unsigned int cpu)
86 return 0; 86 return 0;
87 87
88 cpus_allowed = current->cpus_allowed; 88 cpus_allowed = current->cpus_allowed;
89 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 89 set_cpus_allowed_ptr(current, cpumask_of(cpu));
90 90
91 reg = read_safari_cfg(); 91 reg = read_safari_cfg();
92 ret = get_current_freq(cpu, reg); 92 ret = get_current_freq(cpu, reg);
93 93
94 set_cpus_allowed(current, cpus_allowed); 94 set_cpus_allowed_ptr(current, &cpus_allowed);
95 95
96 return ret; 96 return ret;
97} 97}
@@ -106,7 +106,7 @@ static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index)
106 return; 106 return;
107 107
108 cpus_allowed = current->cpus_allowed; 108 cpus_allowed = current->cpus_allowed;
109 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 109 set_cpus_allowed_ptr(current, cpumask_of(cpu));
110 110
111 new_freq = sparc64_get_clock_tick(cpu) / 1000; 111 new_freq = sparc64_get_clock_tick(cpu) / 1000;
112 switch (index) { 112 switch (index) {
@@ -140,7 +140,7 @@ static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index)
140 140
141 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 141 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
142 142
143 set_cpus_allowed(current, cpus_allowed); 143 set_cpus_allowed_ptr(current, &cpus_allowed);
144} 144}
145 145
146static int us3_freq_target(struct cpufreq_policy *policy, 146static int us3_freq_target(struct cpufreq_policy *policy,
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index c28c71449a6c..3cb1def9806c 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/slab.h>
13#include <linux/irq.h> 14#include <linux/irq.h>
14#include <linux/init.h> 15#include <linux/init.h>
15 16
diff --git a/arch/sparc/kernel/visemul.c b/arch/sparc/kernel/visemul.c
index d231cbd5c526..9dfd2ebcb157 100644
--- a/arch/sparc/kernel/visemul.c
+++ b/arch/sparc/kernel/visemul.c
@@ -5,6 +5,7 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/thread_info.h> 7#include <linux/thread_info.h>
8#include <linux/perf_event.h>
8 9
9#include <asm/ptrace.h> 10#include <asm/ptrace.h>
10#include <asm/pstate.h> 11#include <asm/pstate.h>
@@ -801,6 +802,8 @@ int vis_emul(struct pt_regs *regs, unsigned int insn)
801 802
802 BUG_ON(regs->tstate & TSTATE_PRIV); 803 BUG_ON(regs->tstate & TSTATE_PRIV);
803 804
805 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0);
806
804 if (test_thread_flag(TIF_32BIT)) 807 if (test_thread_flag(TIF_32BIT))
805 pc = (u32)pc; 808 pc = (u32)pc;
806 809
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 4e5992593967..0c1e6783657f 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -46,11 +46,16 @@ SECTIONS
46 SCHED_TEXT 46 SCHED_TEXT
47 LOCK_TEXT 47 LOCK_TEXT
48 KPROBES_TEXT 48 KPROBES_TEXT
49 IRQENTRY_TEXT
49 *(.gnu.warning) 50 *(.gnu.warning)
50 } = 0 51 } = 0
51 _etext = .; 52 _etext = .;
52 53
53 RO_DATA(PAGE_SIZE) 54 RO_DATA(PAGE_SIZE)
55
56 /* Start of data section */
57 _sdata = .;
58
54 .data1 : { 59 .data1 : {
55 *(.data1) 60 *(.data1)
56 } 61 }
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index e75faf0e59ae..c4b5e03af115 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -44,3 +44,4 @@ obj-y += iomap.o
44obj-$(CONFIG_SPARC32) += atomic32.o 44obj-$(CONFIG_SPARC32) += atomic32.o
45obj-y += ksyms.o 45obj-y += ksyms.o
46obj-$(CONFIG_SPARC64) += PeeCeeI.o 46obj-$(CONFIG_SPARC64) += PeeCeeI.o
47obj-y += usercopy.o
diff --git a/arch/sparc/lib/bzero.S b/arch/sparc/lib/bzero.S
index b6557297440f..615f401edf69 100644
--- a/arch/sparc/lib/bzero.S
+++ b/arch/sparc/lib/bzero.S
@@ -6,10 +6,6 @@
6 6
7 .text 7 .text
8 8
9 .globl __memset
10 .type __memset, #function
11__memset: /* %o0=buf, %o1=pat, %o2=len */
12
13 .globl memset 9 .globl memset
14 .type memset, #function 10 .type memset, #function
15memset: /* %o0=buf, %o1=pat, %o2=len */ 11memset: /* %o0=buf, %o1=pat, %o2=len */
@@ -83,7 +79,6 @@ __bzero_done:
83 retl 79 retl
84 mov %o3, %o0 80 mov %o3, %o0
85 .size __bzero, .-__bzero 81 .size __bzero, .-__bzero
86 .size __memset, .-__memset
87 .size memset, .-memset 82 .size memset, .-memset
88 83
89#define EX_ST(x,y) \ 84#define EX_ST(x,y) \
diff --git a/arch/sparc/lib/checksum_32.S b/arch/sparc/lib/checksum_32.S
index 77f228533d47..3632cb34e914 100644
--- a/arch/sparc/lib/checksum_32.S
+++ b/arch/sparc/lib/checksum_32.S
@@ -560,7 +560,7 @@ __csum_partial_copy_end:
560 mov %i0, %o1 560 mov %i0, %o1
561 mov %i1, %o0 561 mov %i1, %o0
5625: 5625:
563 call __memcpy 563 call memcpy
564 mov %i2, %o2 564 mov %i2, %o2
565 tst %o0 565 tst %o0
566 bne,a 2f 566 bne,a 2f
diff --git a/arch/sparc/lib/ksyms.c b/arch/sparc/lib/ksyms.c
index 704b12668388..1b30bb3bfdb1 100644
--- a/arch/sparc/lib/ksyms.c
+++ b/arch/sparc/lib/ksyms.c
@@ -30,7 +30,6 @@ EXPORT_SYMBOL(__memscan_generic);
30EXPORT_SYMBOL(memcmp); 30EXPORT_SYMBOL(memcmp);
31EXPORT_SYMBOL(memcpy); 31EXPORT_SYMBOL(memcpy);
32EXPORT_SYMBOL(memset); 32EXPORT_SYMBOL(memset);
33EXPORT_SYMBOL(__memset);
34EXPORT_SYMBOL(memmove); 33EXPORT_SYMBOL(memmove);
35EXPORT_SYMBOL(__bzero); 34EXPORT_SYMBOL(__bzero);
36 35
@@ -81,7 +80,6 @@ EXPORT_SYMBOL(__csum_partial_copy_sparc_generic);
81 80
82/* Special internal versions of library functions. */ 81/* Special internal versions of library functions. */
83EXPORT_SYMBOL(__copy_1page); 82EXPORT_SYMBOL(__copy_1page);
84EXPORT_SYMBOL(__memcpy);
85EXPORT_SYMBOL(__memmove); 83EXPORT_SYMBOL(__memmove);
86EXPORT_SYMBOL(bzero_1page); 84EXPORT_SYMBOL(bzero_1page);
87 85
diff --git a/arch/sparc/lib/mcount.S b/arch/sparc/lib/mcount.S
index 7ce9c65f3592..3ad6cbdc2163 100644
--- a/arch/sparc/lib/mcount.S
+++ b/arch/sparc/lib/mcount.S
@@ -7,26 +7,11 @@
7 7
8#include <linux/linkage.h> 8#include <linux/linkage.h>
9 9
10#include <asm/ptrace.h>
11#include <asm/thread_info.h>
12
13/* 10/*
14 * This is the main variant and is called by C code. GCC's -pg option 11 * This is the main variant and is called by C code. GCC's -pg option
15 * automatically instruments every C function with a call to this. 12 * automatically instruments every C function with a call to this.
16 */ 13 */
17 14
18#ifdef CONFIG_STACK_DEBUG
19
20#define OVSTACKSIZE 4096 /* lets hope this is enough */
21
22 .data
23 .align 8
24panicstring:
25 .asciz "Stack overflow\n"
26 .align 8
27ovstack:
28 .skip OVSTACKSIZE
29#endif
30 .text 15 .text
31 .align 32 16 .align 32
32 .globl _mcount 17 .globl _mcount
@@ -35,83 +20,48 @@ ovstack:
35 .type mcount,#function 20 .type mcount,#function
36_mcount: 21_mcount:
37mcount: 22mcount:
38#ifdef CONFIG_STACK_DEBUG
39 /*
40 * Check whether %sp is dangerously low.
41 */
42 ldub [%g6 + TI_FPDEPTH], %g1
43 srl %g1, 1, %g3
44 add %g3, 1, %g3
45 sllx %g3, 8, %g3 ! each fpregs frame is 256b
46 add %g3, 192, %g3
47 add %g6, %g3, %g3 ! where does task_struct+frame end?
48 sub %g3, STACK_BIAS, %g3
49 cmp %sp, %g3
50 bg,pt %xcc, 1f
51 nop
52 lduh [%g6 + TI_CPU], %g1
53 sethi %hi(hardirq_stack), %g3
54 or %g3, %lo(hardirq_stack), %g3
55 sllx %g1, 3, %g1
56 ldx [%g3 + %g1], %g7
57 sub %g7, STACK_BIAS, %g7
58 cmp %sp, %g7
59 bleu,pt %xcc, 2f
60 sethi %hi(THREAD_SIZE), %g3
61 add %g7, %g3, %g7
62 cmp %sp, %g7
63 blu,pn %xcc, 1f
642: sethi %hi(softirq_stack), %g3
65 or %g3, %lo(softirq_stack), %g3
66 ldx [%g3 + %g1], %g7
67 cmp %sp, %g7
68 bleu,pt %xcc, 2f
69 sethi %hi(THREAD_SIZE), %g3
70 add %g7, %g3, %g7
71 cmp %sp, %g7
72 blu,pn %xcc, 1f
73 nop
74 /* If we are already on ovstack, don't hop onto it
75 * again, we are already trying to output the stack overflow
76 * message.
77 */
78 sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough
79 or %g7, %lo(ovstack), %g7
80 add %g7, OVSTACKSIZE, %g3
81 sub %g3, STACK_BIAS + 192, %g3
82 sub %g7, STACK_BIAS, %g7
83 cmp %sp, %g7
84 blu,pn %xcc, 2f
85 cmp %sp, %g3
86 bleu,pn %xcc, 1f
87 nop
882: mov %g3, %sp
89 sethi %hi(panicstring), %g3
90 call prom_printf
91 or %g3, %lo(panicstring), %o0
92 call prom_halt
93 nop
941:
95#endif
96#ifdef CONFIG_FUNCTION_TRACER 23#ifdef CONFIG_FUNCTION_TRACER
97#ifdef CONFIG_DYNAMIC_FTRACE 24#ifdef CONFIG_DYNAMIC_FTRACE
98 mov %o7, %o0 25 /* Do nothing, the retl/nop below is all we need. */
99 .globl mcount_call
100mcount_call:
101 call ftrace_stub
102 mov %o0, %o7
103#else 26#else
104 sethi %hi(ftrace_trace_function), %g1 27 sethi %hi(function_trace_stop), %g1
28 lduw [%g1 + %lo(function_trace_stop)], %g2
29 brnz,pn %g2, 2f
30 sethi %hi(ftrace_trace_function), %g1
105 sethi %hi(ftrace_stub), %g2 31 sethi %hi(ftrace_stub), %g2
106 ldx [%g1 + %lo(ftrace_trace_function)], %g1 32 ldx [%g1 + %lo(ftrace_trace_function)], %g1
107 or %g2, %lo(ftrace_stub), %g2 33 or %g2, %lo(ftrace_stub), %g2
108 cmp %g1, %g2 34 cmp %g1, %g2
109 be,pn %icc, 1f 35 be,pn %icc, 1f
110 mov %i7, %o1 36 mov %i7, %g3
111 jmpl %g1, %g0 37 save %sp, -176, %sp
112 mov %o7, %o0 38 mov %g3, %o1
39 jmpl %g1, %o7
40 mov %i7, %o0
41 ret
42 restore
113 /* not reached */ 43 /* not reached */
1141: 441:
45#ifdef CONFIG_FUNCTION_GRAPH_TRACER
46 sethi %hi(ftrace_graph_return), %g1
47 ldx [%g1 + %lo(ftrace_graph_return)], %g3
48 cmp %g2, %g3
49 bne,pn %xcc, 5f
50 sethi %hi(ftrace_graph_entry_stub), %g2
51 sethi %hi(ftrace_graph_entry), %g1
52 or %g2, %lo(ftrace_graph_entry_stub), %g2
53 ldx [%g1 + %lo(ftrace_graph_entry)], %g1
54 cmp %g1, %g2
55 be,pt %xcc, 2f
56 nop
575: mov %i7, %g2
58 mov %fp, %g3
59 save %sp, -176, %sp
60 mov %g2, %l0
61 ba,pt %xcc, ftrace_graph_caller
62 mov %g3, %l1
63#endif
642:
115#endif 65#endif
116#endif 66#endif
117 retl 67 retl
@@ -130,14 +80,50 @@ ftrace_stub:
130 .globl ftrace_caller 80 .globl ftrace_caller
131 .type ftrace_caller,#function 81 .type ftrace_caller,#function
132ftrace_caller: 82ftrace_caller:
133 mov %i7, %o1 83 sethi %hi(function_trace_stop), %g1
134 mov %o7, %o0 84 mov %i7, %g2
85 lduw [%g1 + %lo(function_trace_stop)], %g1
86 brnz,pn %g1, ftrace_stub
87 mov %fp, %g3
88 save %sp, -176, %sp
89 mov %g2, %o1
90 mov %g2, %l0
91 mov %g3, %l1
135 .globl ftrace_call 92 .globl ftrace_call
136ftrace_call: 93ftrace_call:
137 call ftrace_stub 94 call ftrace_stub
138 mov %o0, %o7 95 mov %i7, %o0
139 retl 96#ifdef CONFIG_FUNCTION_GRAPH_TRACER
97 .globl ftrace_graph_call
98ftrace_graph_call:
99 call ftrace_stub
140 nop 100 nop
101#endif
102 ret
103 restore
104#ifdef CONFIG_FUNCTION_GRAPH_TRACER
105 .size ftrace_graph_call,.-ftrace_graph_call
106#endif
107 .size ftrace_call,.-ftrace_call
141 .size ftrace_caller,.-ftrace_caller 108 .size ftrace_caller,.-ftrace_caller
142#endif 109#endif
143#endif 110#endif
111
112#ifdef CONFIG_FUNCTION_GRAPH_TRACER
113ENTRY(ftrace_graph_caller)
114 mov %l0, %o0
115 mov %i7, %o1
116 call prepare_ftrace_return
117 mov %l1, %o2
118 ret
119 restore %o0, -8, %i7
120END(ftrace_graph_caller)
121
122ENTRY(return_to_handler)
123 save %sp, -176, %sp
124 call ftrace_return_to_handler
125 mov %fp, %o0
126 jmpl %o0 + 8, %g0
127 restore
128END(return_to_handler)
129#endif
diff --git a/arch/sparc/lib/memcpy.S b/arch/sparc/lib/memcpy.S
index ce10bc869af9..34fe65751737 100644
--- a/arch/sparc/lib/memcpy.S
+++ b/arch/sparc/lib/memcpy.S
@@ -543,9 +543,6 @@ FUNC(memmove)
543 b 3f 543 b 3f
544 add %o0, 2, %o0 544 add %o0, 2, %o0
545 545
546#ifdef __KERNEL__
547FUNC(__memcpy)
548#endif
549FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ 546FUNC(memcpy) /* %o0=dst %o1=src %o2=len */
550 547
551 sub %o0, %o1, %o4 548 sub %o0, %o1, %o4
diff --git a/arch/sparc/lib/memset.S b/arch/sparc/lib/memset.S
index 1c37ea892deb..99c017be8719 100644
--- a/arch/sparc/lib/memset.S
+++ b/arch/sparc/lib/memset.S
@@ -60,11 +60,10 @@
60 .globl __bzero_begin 60 .globl __bzero_begin
61__bzero_begin: 61__bzero_begin:
62 62
63 .globl __bzero, __memset, 63 .globl __bzero
64 .globl memset 64 .globl memset
65 .globl __memset_start, __memset_end 65 .globl __memset_start, __memset_end
66__memset_start: 66__memset_start:
67__memset:
68memset: 67memset:
69 and %o1, 0xff, %g3 68 and %o1, 0xff, %g3
70 sll %g3, 8, %g2 69 sll %g3, 8, %g2
diff --git a/arch/sparc/lib/usercopy.c b/arch/sparc/lib/usercopy.c
new file mode 100644
index 000000000000..14b363fec8a2
--- /dev/null
+++ b/arch/sparc/lib/usercopy.c
@@ -0,0 +1,8 @@
1#include <linux/module.h>
2#include <linux/bug.h>
3
4void copy_from_user_overflow(void)
5{
6 WARN(1, "Buffer overflow detected!\n");
7}
8EXPORT_SYMBOL(copy_from_user_overflow);
diff --git a/arch/sparc/math-emu/math_32.c b/arch/sparc/math-emu/math_32.c
index e13f65da17df..a3fccde894ec 100644
--- a/arch/sparc/math-emu/math_32.c
+++ b/arch/sparc/math-emu/math_32.c
@@ -67,6 +67,7 @@
67#include <linux/types.h> 67#include <linux/types.h>
68#include <linux/sched.h> 68#include <linux/sched.h>
69#include <linux/mm.h> 69#include <linux/mm.h>
70#include <linux/perf_event.h>
70#include <asm/uaccess.h> 71#include <asm/uaccess.h>
71 72
72#include "sfp-util_32.h" 73#include "sfp-util_32.h"
@@ -163,6 +164,8 @@ int do_mathemu(struct pt_regs *regs, struct task_struct *fpt)
163 int retcode = 0; /* assume all succeed */ 164 int retcode = 0; /* assume all succeed */
164 unsigned long insn; 165 unsigned long insn;
165 166
167 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0);
168
166#ifdef DEBUG_MATHEMU 169#ifdef DEBUG_MATHEMU
167 printk("In do_mathemu()... pc is %08lx\n", regs->pc); 170 printk("In do_mathemu()... pc is %08lx\n", regs->pc);
168 printk("fpqdepth is %ld\n", fpt->thread.fpqdepth); 171 printk("fpqdepth is %ld\n", fpt->thread.fpqdepth);
diff --git a/arch/sparc/math-emu/math_64.c b/arch/sparc/math-emu/math_64.c
index 6863c9bde25c..56d2c44747b8 100644
--- a/arch/sparc/math-emu/math_64.c
+++ b/arch/sparc/math-emu/math_64.c
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/perf_event.h>
14 15
15#include <asm/fpumacro.h> 16#include <asm/fpumacro.h>
16#include <asm/ptrace.h> 17#include <asm/ptrace.h>
@@ -183,6 +184,7 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f)
183 184
184 if (tstate & TSTATE_PRIV) 185 if (tstate & TSTATE_PRIV)
185 die_if_kernel("unfinished/unimplemented FPop from kernel", regs); 186 die_if_kernel("unfinished/unimplemented FPop from kernel", regs);
187 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0);
186 if (test_thread_flag(TIF_32BIT)) 188 if (test_thread_flag(TIF_32BIT))
187 pc = (u32)pc; 189 pc = (u32)pc;
188 if (get_user(insn, (u32 __user *) pc) != -EFAULT) { 190 if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
index b99f81c4906f..bd8601601afa 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -18,6 +18,7 @@
18#include <linux/signal.h> 18#include <linux/signal.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/smp.h> 20#include <linux/smp.h>
21#include <linux/perf_event.h>
21#include <linux/interrupt.h> 22#include <linux/interrupt.h>
22#include <linux/module.h> 23#include <linux/module.h>
23#include <linux/kdebug.h> 24#include <linux/kdebug.h>
@@ -34,6 +35,8 @@
34 35
35extern int prom_node_root; 36extern int prom_node_root;
36 37
38int show_unhandled_signals = 1;
39
37/* At boot time we determine these two values necessary for setting 40/* At boot time we determine these two values necessary for setting
38 * up the segment maps and page table entries (pte's). 41 * up the segment maps and page table entries (pte's).
39 */ 42 */
@@ -148,6 +151,45 @@ asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
148 return 0; 151 return 0;
149} 152}
150 153
154static inline void
155show_signal_msg(struct pt_regs *regs, int sig, int code,
156 unsigned long address, struct task_struct *tsk)
157{
158 if (!unhandled_signal(tsk, sig))
159 return;
160
161 if (!printk_ratelimit())
162 return;
163
164 printk("%s%s[%d]: segfault at %lx ip %p (rpc %p) sp %p error %x",
165 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
166 tsk->comm, task_pid_nr(tsk), address,
167 (void *)regs->pc, (void *)regs->u_regs[UREG_I7],
168 (void *)regs->u_regs[UREG_FP], code);
169
170 print_vma_addr(KERN_CONT " in ", regs->pc);
171
172 printk(KERN_CONT "\n");
173}
174
175static void __do_fault_siginfo(int code, int sig, struct pt_regs *regs,
176 unsigned long addr)
177{
178 siginfo_t info;
179
180 info.si_signo = sig;
181 info.si_code = code;
182 info.si_errno = 0;
183 info.si_addr = (void __user *) addr;
184 info.si_trapno = 0;
185
186 if (unlikely(show_unhandled_signals))
187 show_signal_msg(regs, sig, info.si_code,
188 addr, current);
189
190 force_sig_info (sig, &info, current);
191}
192
151extern unsigned long safe_compute_effective_address(struct pt_regs *, 193extern unsigned long safe_compute_effective_address(struct pt_regs *,
152 unsigned int); 194 unsigned int);
153 195
@@ -167,6 +209,14 @@ static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)
167 return safe_compute_effective_address(regs, insn); 209 return safe_compute_effective_address(regs, insn);
168} 210}
169 211
212static noinline void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
213 int text_fault)
214{
215 unsigned long addr = compute_si_addr(regs, text_fault);
216
217 __do_fault_siginfo(code, sig, regs, addr);
218}
219
170asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, 220asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
171 unsigned long address) 221 unsigned long address)
172{ 222{
@@ -175,9 +225,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
175 struct mm_struct *mm = tsk->mm; 225 struct mm_struct *mm = tsk->mm;
176 unsigned int fixup; 226 unsigned int fixup;
177 unsigned long g2; 227 unsigned long g2;
178 siginfo_t info;
179 int from_user = !(regs->psr & PSR_PS); 228 int from_user = !(regs->psr & PSR_PS);
180 int fault; 229 int fault, code;
181 230
182 if(text_fault) 231 if(text_fault)
183 address = regs->pc; 232 address = regs->pc;
@@ -194,7 +243,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
194 if (!ARCH_SUN4C && address >= TASK_SIZE) 243 if (!ARCH_SUN4C && address >= TASK_SIZE)
195 goto vmalloc_fault; 244 goto vmalloc_fault;
196 245
197 info.si_code = SEGV_MAPERR; 246 code = SEGV_MAPERR;
198 247
199 /* 248 /*
200 * If we're in an interrupt or have no user 249 * If we're in an interrupt or have no user
@@ -203,6 +252,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
203 if (in_atomic() || !mm) 252 if (in_atomic() || !mm)
204 goto no_context; 253 goto no_context;
205 254
255 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
256
206 down_read(&mm->mmap_sem); 257 down_read(&mm->mmap_sem);
207 258
208 /* 259 /*
@@ -226,7 +277,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
226 * we can handle it.. 277 * we can handle it..
227 */ 278 */
228good_area: 279good_area:
229 info.si_code = SEGV_ACCERR; 280 code = SEGV_ACCERR;
230 if(write) { 281 if(write) {
231 if(!(vma->vm_flags & VM_WRITE)) 282 if(!(vma->vm_flags & VM_WRITE))
232 goto bad_area; 283 goto bad_area;
@@ -249,10 +300,15 @@ good_area:
249 goto do_sigbus; 300 goto do_sigbus;
250 BUG(); 301 BUG();
251 } 302 }
252 if (fault & VM_FAULT_MAJOR) 303 if (fault & VM_FAULT_MAJOR) {
253 current->maj_flt++; 304 current->maj_flt++;
254 else 305 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
306 regs, address);
307 } else {
255 current->min_flt++; 308 current->min_flt++;
309 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
310 regs, address);
311 }
256 up_read(&mm->mmap_sem); 312 up_read(&mm->mmap_sem);
257 return; 313 return;
258 314
@@ -265,18 +321,8 @@ bad_area:
265 321
266bad_area_nosemaphore: 322bad_area_nosemaphore:
267 /* User mode accesses just cause a SIGSEGV */ 323 /* User mode accesses just cause a SIGSEGV */
268 if(from_user) { 324 if (from_user) {
269#if 0 325 do_fault_siginfo(code, SIGSEGV, regs, text_fault);
270 printk("Fault whee %s [%d]: segfaults at %08lx pc=%08lx\n",
271 tsk->comm, tsk->pid, address, regs->pc);
272#endif
273 info.si_signo = SIGSEGV;
274 info.si_errno = 0;
275 /* info.si_code set above to make clear whether
276 this was a SEGV_MAPERR or SEGV_ACCERR fault. */
277 info.si_addr = (void __user *)compute_si_addr(regs, text_fault);
278 info.si_trapno = 0;
279 force_sig_info (SIGSEGV, &info, tsk);
280 return; 326 return;
281 } 327 }
282 328
@@ -327,12 +373,7 @@ out_of_memory:
327 373
328do_sigbus: 374do_sigbus:
329 up_read(&mm->mmap_sem); 375 up_read(&mm->mmap_sem);
330 info.si_signo = SIGBUS; 376 do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, text_fault);
331 info.si_errno = 0;
332 info.si_code = BUS_ADRERR;
333 info.si_addr = (void __user *) compute_si_addr(regs, text_fault);
334 info.si_trapno = 0;
335 force_sig_info (SIGBUS, &info, tsk);
336 if (!from_user) 377 if (!from_user)
337 goto no_context; 378 goto no_context;
338 379
@@ -370,7 +411,7 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
370 unsigned long address) 411 unsigned long address)
371{ 412{
372 extern void sun4c_update_mmu_cache(struct vm_area_struct *, 413 extern void sun4c_update_mmu_cache(struct vm_area_struct *,
373 unsigned long,pte_t); 414 unsigned long,pte_t *);
374 extern pte_t *sun4c_pte_offset_kernel(pmd_t *,unsigned long); 415 extern pte_t *sun4c_pte_offset_kernel(pmd_t *,unsigned long);
375 struct task_struct *tsk = current; 416 struct task_struct *tsk = current;
376 struct mm_struct *mm = tsk->mm; 417 struct mm_struct *mm = tsk->mm;
@@ -447,7 +488,7 @@ asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
447 * on the CPU and doing a shrink_mmap() on this vma. 488 * on the CPU and doing a shrink_mmap() on this vma.
448 */ 489 */
449 sun4c_update_mmu_cache (find_vma(current->mm, address), address, 490 sun4c_update_mmu_cache (find_vma(current->mm, address), address,
450 *ptep); 491 ptep);
451 else 492 else
452 do_sparc_fault(regs, text_fault, write, address); 493 do_sparc_fault(regs, text_fault, write, address);
453} 494}
@@ -458,14 +499,10 @@ static void force_user_fault(unsigned long address, int write)
458 struct vm_area_struct *vma; 499 struct vm_area_struct *vma;
459 struct task_struct *tsk = current; 500 struct task_struct *tsk = current;
460 struct mm_struct *mm = tsk->mm; 501 struct mm_struct *mm = tsk->mm;
461 siginfo_t info; 502 int code;
462 503
463 info.si_code = SEGV_MAPERR; 504 code = SEGV_MAPERR;
464 505
465#if 0
466 printk("wf<pid=%d,wr=%d,addr=%08lx>\n",
467 tsk->pid, write, address);
468#endif
469 down_read(&mm->mmap_sem); 506 down_read(&mm->mmap_sem);
470 vma = find_vma(mm, address); 507 vma = find_vma(mm, address);
471 if(!vma) 508 if(!vma)
@@ -477,7 +514,7 @@ static void force_user_fault(unsigned long address, int write)
477 if(expand_stack(vma, address)) 514 if(expand_stack(vma, address))
478 goto bad_area; 515 goto bad_area;
479good_area: 516good_area:
480 info.si_code = SEGV_ACCERR; 517 code = SEGV_ACCERR;
481 if(write) { 518 if(write) {
482 if(!(vma->vm_flags & VM_WRITE)) 519 if(!(vma->vm_flags & VM_WRITE))
483 goto bad_area; 520 goto bad_area;
@@ -494,27 +531,12 @@ good_area:
494 return; 531 return;
495bad_area: 532bad_area:
496 up_read(&mm->mmap_sem); 533 up_read(&mm->mmap_sem);
497#if 0 534 __do_fault_siginfo(code, SIGSEGV, tsk->thread.kregs, address);
498 printk("Window whee %s [%d]: segfaults at %08lx\n",
499 tsk->comm, tsk->pid, address);
500#endif
501 info.si_signo = SIGSEGV;
502 info.si_errno = 0;
503 /* info.si_code set above to make clear whether
504 this was a SEGV_MAPERR or SEGV_ACCERR fault. */
505 info.si_addr = (void __user *) address;
506 info.si_trapno = 0;
507 force_sig_info (SIGSEGV, &info, tsk);
508 return; 535 return;
509 536
510do_sigbus: 537do_sigbus:
511 up_read(&mm->mmap_sem); 538 up_read(&mm->mmap_sem);
512 info.si_signo = SIGBUS; 539 __do_fault_siginfo(BUS_ADRERR, SIGBUS, tsk->thread.kregs, address);
513 info.si_errno = 0;
514 info.si_code = BUS_ADRERR;
515 info.si_addr = (void __user *) address;
516 info.si_trapno = 0;
517 force_sig_info (SIGBUS, &info, tsk);
518} 540}
519 541
520void window_overflow_fault(void) 542void window_overflow_fault(void)
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 43b0da96a4fb..f92ce56a8b22 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -16,6 +16,7 @@
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/perf_event.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20#include <linux/kprobes.h> 21#include <linux/kprobes.h>
21#include <linux/kdebug.h> 22#include <linux/kdebug.h>
@@ -31,13 +32,14 @@
31#include <asm/sections.h> 32#include <asm/sections.h>
32#include <asm/mmu_context.h> 33#include <asm/mmu_context.h>
33 34
34#ifdef CONFIG_KPROBES 35int show_unhandled_signals = 1;
35static inline int notify_page_fault(struct pt_regs *regs) 36
37static inline __kprobes int notify_page_fault(struct pt_regs *regs)
36{ 38{
37 int ret = 0; 39 int ret = 0;
38 40
39 /* kprobe_running() needs smp_processor_id() */ 41 /* kprobe_running() needs smp_processor_id() */
40 if (!user_mode(regs)) { 42 if (kprobes_built_in() && !user_mode(regs)) {
41 preempt_disable(); 43 preempt_disable();
42 if (kprobe_running() && kprobe_fault_handler(regs, 0)) 44 if (kprobe_running() && kprobe_fault_handler(regs, 0))
43 ret = 1; 45 ret = 1;
@@ -45,12 +47,6 @@ static inline int notify_page_fault(struct pt_regs *regs)
45 } 47 }
46 return ret; 48 return ret;
47} 49}
48#else
49static inline int notify_page_fault(struct pt_regs *regs)
50{
51 return 0;
52}
53#endif
54 50
55static void __kprobes unhandled_fault(unsigned long address, 51static void __kprobes unhandled_fault(unsigned long address,
56 struct task_struct *tsk, 52 struct task_struct *tsk,
@@ -73,7 +69,7 @@ static void __kprobes unhandled_fault(unsigned long address,
73 die_if_kernel("Oops", regs); 69 die_if_kernel("Oops", regs);
74} 70}
75 71
76static void bad_kernel_pc(struct pt_regs *regs, unsigned long vaddr) 72static void __kprobes bad_kernel_pc(struct pt_regs *regs, unsigned long vaddr)
77{ 73{
78 printk(KERN_CRIT "OOPS: Bogus kernel PC [%016lx] in fault handler\n", 74 printk(KERN_CRIT "OOPS: Bogus kernel PC [%016lx] in fault handler\n",
79 regs->tpc); 75 regs->tpc);
@@ -134,22 +130,48 @@ outret:
134 return insn; 130 return insn;
135} 131}
136 132
133static inline void
134show_signal_msg(struct pt_regs *regs, int sig, int code,
135 unsigned long address, struct task_struct *tsk)
136{
137 if (!unhandled_signal(tsk, sig))
138 return;
139
140 if (!printk_ratelimit())
141 return;
142
143 printk("%s%s[%d]: segfault at %lx ip %p (rpc %p) sp %p error %x",
144 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
145 tsk->comm, task_pid_nr(tsk), address,
146 (void *)regs->tpc, (void *)regs->u_regs[UREG_I7],
147 (void *)regs->u_regs[UREG_FP], code);
148
149 print_vma_addr(KERN_CONT " in ", regs->tpc);
150
151 printk(KERN_CONT "\n");
152}
153
137extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int); 154extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int);
138 155
139static void do_fault_siginfo(int code, int sig, struct pt_regs *regs, 156static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
140 unsigned int insn, int fault_code) 157 unsigned int insn, int fault_code)
141{ 158{
159 unsigned long addr;
142 siginfo_t info; 160 siginfo_t info;
143 161
144 info.si_code = code; 162 info.si_code = code;
145 info.si_signo = sig; 163 info.si_signo = sig;
146 info.si_errno = 0; 164 info.si_errno = 0;
147 if (fault_code & FAULT_CODE_ITLB) 165 if (fault_code & FAULT_CODE_ITLB)
148 info.si_addr = (void __user *) regs->tpc; 166 addr = regs->tpc;
149 else 167 else
150 info.si_addr = (void __user *) 168 addr = compute_effective_address(regs, insn, 0);
151 compute_effective_address(regs, insn, 0); 169 info.si_addr = (void __user *) addr;
152 info.si_trapno = 0; 170 info.si_trapno = 0;
171
172 if (unlikely(show_unhandled_signals))
173 show_signal_msg(regs, sig, code, addr, current);
174
153 force_sig_info(sig, &info, current); 175 force_sig_info(sig, &info, current);
154} 176}
155 177
@@ -170,8 +192,9 @@ static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn)
170 return insn; 192 return insn;
171} 193}
172 194
173static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code, 195static void __kprobes do_kernel_fault(struct pt_regs *regs, int si_code,
174 unsigned int insn, unsigned long address) 196 int fault_code, unsigned int insn,
197 unsigned long address)
175{ 198{
176 unsigned char asi = ASI_P; 199 unsigned char asi = ASI_P;
177 200
@@ -225,7 +248,7 @@ cannot_handle:
225 unhandled_fault (address, current, regs); 248 unhandled_fault (address, current, regs);
226} 249}
227 250
228static void noinline bogus_32bit_fault_tpc(struct pt_regs *regs) 251static void noinline __kprobes bogus_32bit_fault_tpc(struct pt_regs *regs)
229{ 252{
230 static int times; 253 static int times;
231 254
@@ -237,8 +260,8 @@ static void noinline bogus_32bit_fault_tpc(struct pt_regs *regs)
237 show_regs(regs); 260 show_regs(regs);
238} 261}
239 262
240static void noinline bogus_32bit_fault_address(struct pt_regs *regs, 263static void noinline __kprobes bogus_32bit_fault_address(struct pt_regs *regs,
241 unsigned long addr) 264 unsigned long addr)
242{ 265{
243 static int times; 266 static int times;
244 267
@@ -302,6 +325,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
302 if (in_atomic() || !mm) 325 if (in_atomic() || !mm)
303 goto intr_or_no_mm; 326 goto intr_or_no_mm;
304 327
328 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
329
305 if (!down_read_trylock(&mm->mmap_sem)) { 330 if (!down_read_trylock(&mm->mmap_sem)) {
306 if ((regs->tstate & TSTATE_PRIV) && 331 if ((regs->tstate & TSTATE_PRIV) &&
307 !search_exception_tables(regs->tpc)) { 332 !search_exception_tables(regs->tpc)) {
@@ -406,11 +431,15 @@ good_area:
406 goto do_sigbus; 431 goto do_sigbus;
407 BUG(); 432 BUG();
408 } 433 }
409 if (fault & VM_FAULT_MAJOR) 434 if (fault & VM_FAULT_MAJOR) {
410 current->maj_flt++; 435 current->maj_flt++;
411 else 436 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
437 regs, address);
438 } else {
412 current->min_flt++; 439 current->min_flt++;
413 440 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
441 regs, address);
442 }
414 up_read(&mm->mmap_sem); 443 up_read(&mm->mmap_sem);
415 444
416 mm_rss = get_mm_rss(mm); 445 mm_rss = get_mm_rss(mm);
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
index f27d10369e0c..5fdddf134caa 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -10,7 +10,6 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/hugetlb.h> 11#include <linux/hugetlb.h>
12#include <linux/pagemap.h> 12#include <linux/pagemap.h>
13#include <linux/slab.h>
14#include <linux/sysctl.h> 13#include <linux/sysctl.h>
15 14
16#include <asm/mman.h> 15#include <asm/mman.h>
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index dc7c3b17a15f..6d0e02c4fe09 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -24,6 +24,7 @@
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/pagemap.h> 25#include <linux/pagemap.h>
26#include <linux/poison.h> 26#include <linux/poison.h>
27#include <linux/gfp.h>
27 28
28#include <asm/sections.h> 29#include <asm/sections.h>
29#include <asm/system.h> 30#include <asm/system.h>
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 1886d37d411b..b2831dc3c121 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -13,7 +13,6 @@
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/hugetlb.h> 15#include <linux/hugetlb.h>
16#include <linux/slab.h>
17#include <linux/initrd.h> 16#include <linux/initrd.h>
18#include <linux/swap.h> 17#include <linux/swap.h>
19#include <linux/pagemap.h> 18#include <linux/pagemap.h>
@@ -26,6 +25,7 @@
26#include <linux/percpu.h> 25#include <linux/percpu.h>
27#include <linux/lmb.h> 26#include <linux/lmb.h>
28#include <linux/mmzone.h> 27#include <linux/mmzone.h>
28#include <linux/gfp.h>
29 29
30#include <asm/head.h> 30#include <asm/head.h>
31#include <asm/system.h> 31#include <asm/system.h>
@@ -289,12 +289,13 @@ static void flush_dcache(unsigned long pfn)
289 } 289 }
290} 290}
291 291
292void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) 292void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
293{ 293{
294 struct mm_struct *mm; 294 struct mm_struct *mm;
295 struct tsb *tsb; 295 struct tsb *tsb;
296 unsigned long tag, flags; 296 unsigned long tag, flags;
297 unsigned long tsb_index, tsb_hash_shift; 297 unsigned long tsb_index, tsb_hash_shift;
298 pte_t pte = *ptep;
298 299
299 if (tlb_type != hypervisor) { 300 if (tlb_type != hypervisor) {
300 unsigned long pfn = pte_pfn(pte); 301 unsigned long pfn = pte_pfn(pte);
@@ -2116,7 +2117,7 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
2116 "node=%d entry=%lu/%lu\n", start, block, nr, 2117 "node=%d entry=%lu/%lu\n", start, block, nr,
2117 node, 2118 node,
2118 addr >> VMEMMAP_CHUNK_SHIFT, 2119 addr >> VMEMMAP_CHUNK_SHIFT,
2119 VMEMMAP_SIZE >> VMEMMAP_CHUNK_SHIFT); 2120 VMEMMAP_SIZE);
2120 } 2121 }
2121 } 2122 }
2122 return 0; 2123 return 0;
diff --git a/arch/sparc/mm/nosun4c.c b/arch/sparc/mm/nosun4c.c
index 196263f895b7..4e62c27147c4 100644
--- a/arch/sparc/mm/nosun4c.c
+++ b/arch/sparc/mm/nosun4c.c
@@ -62,7 +62,7 @@ pte_t *sun4c_pte_offset_kernel(pmd_t *dir, unsigned long address)
62 return NULL; 62 return NULL;
63} 63}
64 64
65void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) 65void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
66{ 66{
67} 67}
68 68
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 509b1ffeba66..f5f75a58e0b3 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -10,7 +10,6 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/slab.h>
14#include <linux/vmalloc.h> 13#include <linux/vmalloc.h>
15#include <linux/pagemap.h> 14#include <linux/pagemap.h>
16#include <linux/init.h> 15#include <linux/init.h>
@@ -20,6 +19,7 @@
20#include <linux/seq_file.h> 19#include <linux/seq_file.h>
21#include <linux/kdebug.h> 20#include <linux/kdebug.h>
22#include <linux/log2.h> 21#include <linux/log2.h>
22#include <linux/gfp.h>
23 23
24#include <asm/bitext.h> 24#include <asm/bitext.h>
25#include <asm/page.h> 25#include <asm/page.h>
@@ -694,7 +694,7 @@ extern void tsunami_setup_blockops(void);
694 * The following code is a deadwood that may be necessary when 694 * The following code is a deadwood that may be necessary when
695 * we start to make precise page flushes again. --zaitcev 695 * we start to make precise page flushes again. --zaitcev
696 */ 696 */
697static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t pte) 697static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t *ptep)
698{ 698{
699#if 0 699#if 0
700 static unsigned long last; 700 static unsigned long last;
@@ -703,10 +703,10 @@ static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long ad
703 703
704 if (address == last) { 704 if (address == last) {
705 val = srmmu_hwprobe(address); 705 val = srmmu_hwprobe(address);
706 if (val != 0 && pte_val(pte) != val) { 706 if (val != 0 && pte_val(*ptep) != val) {
707 printk("swift_update_mmu_cache: " 707 printk("swift_update_mmu_cache: "
708 "addr %lx put %08x probed %08x from %p\n", 708 "addr %lx put %08x probed %08x from %p\n",
709 address, pte_val(pte), val, 709 address, pte_val(*ptep), val,
710 __builtin_return_address(0)); 710 __builtin_return_address(0));
711 srmmu_flush_whole_tlb(); 711 srmmu_flush_whole_tlb();
712 } 712 }
@@ -1990,7 +1990,7 @@ void __init poke_leonsparc(void)
1990void __init init_leon(void) 1990void __init init_leon(void)
1991{ 1991{
1992 1992
1993 srmmu_name = "Leon"; 1993 srmmu_name = "LEON";
1994 1994
1995 BTFIXUPSET_CALL(flush_cache_all, leon_flush_cache_all, 1995 BTFIXUPSET_CALL(flush_cache_all, leon_flush_cache_all,
1996 BTFIXUPCALL_NORM); 1996 BTFIXUPCALL_NORM);
@@ -2037,8 +2037,6 @@ static void __init get_srmmu_type(void)
2037 2037
2038 /* First, check for sparc-leon. */ 2038 /* First, check for sparc-leon. */
2039 if (sparc_cpu_model == sparc_leon) { 2039 if (sparc_cpu_model == sparc_leon) {
2040 psr_typ = 0xf; /* hardcoded ids for older models/simulators */
2041 psr_vers = 2;
2042 init_leon(); 2040 init_leon();
2043 return; 2041 return;
2044 } 2042 }
@@ -2301,7 +2299,8 @@ void __init ld_mmu_srmmu(void)
2301 BTFIXUPSET_CALL(flush_cache_mm, smp_flush_cache_mm, BTFIXUPCALL_NORM); 2299 BTFIXUPSET_CALL(flush_cache_mm, smp_flush_cache_mm, BTFIXUPCALL_NORM);
2302 BTFIXUPSET_CALL(flush_cache_range, smp_flush_cache_range, BTFIXUPCALL_NORM); 2300 BTFIXUPSET_CALL(flush_cache_range, smp_flush_cache_range, BTFIXUPCALL_NORM);
2303 BTFIXUPSET_CALL(flush_cache_page, smp_flush_cache_page, BTFIXUPCALL_NORM); 2301 BTFIXUPSET_CALL(flush_cache_page, smp_flush_cache_page, BTFIXUPCALL_NORM);
2304 if (sparc_cpu_model != sun4d) { 2302 if (sparc_cpu_model != sun4d &&
2303 sparc_cpu_model != sparc_leon) {
2305 BTFIXUPSET_CALL(flush_tlb_all, smp_flush_tlb_all, BTFIXUPCALL_NORM); 2304 BTFIXUPSET_CALL(flush_tlb_all, smp_flush_tlb_all, BTFIXUPCALL_NORM);
2306 BTFIXUPSET_CALL(flush_tlb_mm, smp_flush_tlb_mm, BTFIXUPCALL_NORM); 2305 BTFIXUPSET_CALL(flush_tlb_mm, smp_flush_tlb_mm, BTFIXUPCALL_NORM);
2307 BTFIXUPSET_CALL(flush_tlb_range, smp_flush_tlb_range, BTFIXUPCALL_NORM); 2306 BTFIXUPSET_CALL(flush_tlb_range, smp_flush_tlb_range, BTFIXUPCALL_NORM);
@@ -2330,6 +2329,8 @@ void __init ld_mmu_srmmu(void)
2330#ifdef CONFIG_SMP 2329#ifdef CONFIG_SMP
2331 if (sparc_cpu_model == sun4d) 2330 if (sparc_cpu_model == sun4d)
2332 sun4d_init_smp(); 2331 sun4d_init_smp();
2332 else if (sparc_cpu_model == sparc_leon)
2333 leon_init_smp();
2333 else 2334 else
2334 sun4m_init_smp(); 2335 sun4m_init_smp();
2335#endif 2336#endif
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 2ffacd67c424..cf38846753dd 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -12,11 +12,13 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/slab.h>
15#include <linux/bootmem.h> 16#include <linux/bootmem.h>
16#include <linux/highmem.h> 17#include <linux/highmem.h>
17#include <linux/fs.h> 18#include <linux/fs.h>
18#include <linux/seq_file.h> 19#include <linux/seq_file.h>
19#include <linux/scatterlist.h> 20#include <linux/scatterlist.h>
21#include <linux/bitmap.h>
20 22
21#include <asm/sections.h> 23#include <asm/sections.h>
22#include <asm/page.h> 24#include <asm/page.h>
@@ -1021,20 +1023,12 @@ static char *sun4c_lockarea(char *vaddr, unsigned long size)
1021 npages = (((unsigned long)vaddr & ~PAGE_MASK) + 1023 npages = (((unsigned long)vaddr & ~PAGE_MASK) +
1022 size + (PAGE_SIZE-1)) >> PAGE_SHIFT; 1024 size + (PAGE_SIZE-1)) >> PAGE_SHIFT;
1023 1025
1024 scan = 0;
1025 local_irq_save(flags); 1026 local_irq_save(flags);
1026 for (;;) { 1027 base = bitmap_find_next_zero_area(sun4c_iobuffer_map, iobuffer_map_size,
1027 scan = find_next_zero_bit(sun4c_iobuffer_map, 1028 0, npages, 0);
1028 iobuffer_map_size, scan); 1029 if (base >= iobuffer_map_size)
1029 if ((base = scan) + npages > iobuffer_map_size) goto abend; 1030 goto abend;
1030 for (;;) {
1031 if (scan >= base + npages) goto found;
1032 if (test_bit(scan, sun4c_iobuffer_map)) break;
1033 scan++;
1034 }
1035 }
1036 1031
1037found:
1038 high = ((base + npages) << PAGE_SHIFT) + sun4c_iobuffer_start; 1032 high = ((base + npages) << PAGE_SHIFT) + sun4c_iobuffer_start;
1039 high = SUN4C_REAL_PGDIR_ALIGN(high); 1033 high = SUN4C_REAL_PGDIR_ALIGN(high);
1040 while (high > sun4c_iobuffer_high) { 1034 while (high > sun4c_iobuffer_high) {
@@ -1894,7 +1888,7 @@ static void sun4c_check_pgt_cache(int low, int high)
1894/* An experiment, turn off by default for now... -DaveM */ 1888/* An experiment, turn off by default for now... -DaveM */
1895#define SUN4C_PRELOAD_PSEG 1889#define SUN4C_PRELOAD_PSEG
1896 1890
1897void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) 1891void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
1898{ 1892{
1899 unsigned long flags; 1893 unsigned long flags;
1900 int pseg; 1894 int pseg;
@@ -1936,7 +1930,7 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
1936 start += PAGE_SIZE; 1930 start += PAGE_SIZE;
1937 } 1931 }
1938#ifndef SUN4C_PRELOAD_PSEG 1932#ifndef SUN4C_PRELOAD_PSEG
1939 sun4c_put_pte(address, pte_val(pte)); 1933 sun4c_put_pte(address, pte_val(*ptep));
1940#endif 1934#endif
1941 local_irq_restore(flags); 1935 local_irq_restore(flags);
1942 return; 1936 return;
@@ -1947,7 +1941,7 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
1947 add_lru(entry); 1941 add_lru(entry);
1948 } 1942 }
1949 1943
1950 sun4c_put_pte(address, pte_val(pte)); 1944 sun4c_put_pte(address, pte_val(*ptep));
1951 local_irq_restore(flags); 1945 local_irq_restore(flags);
1952} 1946}
1953 1947
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
index 36a0813f9517..101d7c82870b 100644
--- a/arch/sparc/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/preempt.h> 7#include <linux/preempt.h>
8#include <linux/slab.h>
8#include <asm/system.h> 9#include <asm/system.h>
9#include <asm/page.h> 10#include <asm/page.h>
10#include <asm/tlbflush.h> 11#include <asm/tlbflush.h>
diff --git a/arch/sparc/prom/console_32.c b/arch/sparc/prom/console_32.c
index b3075d73fc19..5340264b78f5 100644
--- a/arch/sparc/prom/console_32.c
+++ b/arch/sparc/prom/console_32.c
@@ -94,5 +94,4 @@ void
94prom_putchar(char c) 94prom_putchar(char c)
95{ 95{
96 while(prom_nbputchar(c) == -1) ; 96 while(prom_nbputchar(c) == -1) ;
97 return;
98} 97}
diff --git a/arch/sparc/prom/console_64.c b/arch/sparc/prom/console_64.c
index e1c3fc87484d..f55d58a8a156 100644
--- a/arch/sparc/prom/console_64.c
+++ b/arch/sparc/prom/console_64.c
@@ -62,7 +62,6 @@ void
62prom_putchar(char c) 62prom_putchar(char c)
63{ 63{
64 prom_nbputchar(c); 64 prom_nbputchar(c);
65 return;
66} 65}
67 66
68void 67void
diff --git a/arch/sparc/prom/devmap.c b/arch/sparc/prom/devmap.c
index 1e517915b0df..46157d2aba0d 100644
--- a/arch/sparc/prom/devmap.c
+++ b/arch/sparc/prom/devmap.c
@@ -50,5 +50,4 @@ prom_unmapio(char *vaddr, unsigned int num_bytes)
50 (*(romvec->pv_v2devops.v2_dumb_munmap))(vaddr, num_bytes); 50 (*(romvec->pv_v2devops.v2_dumb_munmap))(vaddr, num_bytes);
51 restore_current(); 51 restore_current();
52 spin_unlock_irqrestore(&prom_lock, flags); 52 spin_unlock_irqrestore(&prom_lock, flags);
53 return;
54} 53}
diff --git a/arch/sparc/prom/devops_32.c b/arch/sparc/prom/devops_32.c
index 9f1a95c91ad1..9c5d4687242a 100644
--- a/arch/sparc/prom/devops_32.c
+++ b/arch/sparc/prom/devops_32.c
@@ -84,6 +84,4 @@ prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo)
84 }; 84 };
85 restore_current(); 85 restore_current();
86 spin_unlock_irqrestore(&prom_lock, flags); 86 spin_unlock_irqrestore(&prom_lock, flags);
87
88 return;
89} 87}
diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c
index 6193c33ed4d4..ccb36c7f9b8c 100644
--- a/arch/sparc/prom/init_32.c
+++ b/arch/sparc/prom/init_32.c
@@ -75,5 +75,4 @@ void __init prom_init(struct linux_romvec *rp)
75 romvec->pv_romvers, prom_rev); 75 romvec->pv_romvers, prom_rev);
76 76
77 /* Initialization successful. */ 77 /* Initialization successful. */
78 return;
79} 78}
diff --git a/arch/sparc/prom/p1275.c b/arch/sparc/prom/p1275.c
index 4b7c937bba61..2d8b70d397f1 100644
--- a/arch/sparc/prom/p1275.c
+++ b/arch/sparc/prom/p1275.c
@@ -32,10 +32,9 @@ extern void prom_cif_interface(void);
32extern void prom_cif_callback(void); 32extern void prom_cif_callback(void);
33 33
34/* 34/*
35 * This provides SMP safety on the p1275buf. prom_callback() drops this lock 35 * This provides SMP safety on the p1275buf.
36 * to allow recursuve acquisition.
37 */ 36 */
38DEFINE_SPINLOCK(prom_entry_lock); 37DEFINE_RAW_SPINLOCK(prom_entry_lock);
39 38
40long p1275_cmd(const char *service, long fmt, ...) 39long p1275_cmd(const char *service, long fmt, ...)
41{ 40{
@@ -47,7 +46,9 @@ long p1275_cmd(const char *service, long fmt, ...)
47 46
48 p = p1275buf.prom_buffer; 47 p = p1275buf.prom_buffer;
49 48
50 spin_lock_irqsave(&prom_entry_lock, flags); 49 raw_local_save_flags(flags);
50 raw_local_irq_restore(PIL_NMI);
51 raw_spin_lock(&prom_entry_lock);
51 52
52 p1275buf.prom_args[0] = (unsigned long)p; /* service */ 53 p1275buf.prom_args[0] = (unsigned long)p; /* service */
53 strcpy (p, service); 54 strcpy (p, service);
@@ -139,7 +140,8 @@ long p1275_cmd(const char *service, long fmt, ...)
139 va_end(list); 140 va_end(list);
140 x = p1275buf.prom_args [nargs + 3]; 141 x = p1275buf.prom_args [nargs + 3];
141 142
142 spin_unlock_irqrestore(&prom_entry_lock, flags); 143 raw_spin_unlock(&prom_entry_lock);
144 raw_local_irq_restore(flags);
143 145
144 return x; 146 return x;
145} 147}
diff --git a/arch/sparc/prom/palloc.c b/arch/sparc/prom/palloc.c
index 20be339cc2ce..2e2a88b211fb 100644
--- a/arch/sparc/prom/palloc.c
+++ b/arch/sparc/prom/palloc.c
@@ -40,5 +40,4 @@ prom_free(char *vaddr, unsigned int num_bytes)
40{ 40{
41 if((prom_vers == PROM_V0) || (num_bytes == 0x0)) return; 41 if((prom_vers == PROM_V0) || (num_bytes == 0x0)) return;
42 (*(romvec->pv_v2devops.v2_dumb_mem_free))(vaddr, num_bytes); 42 (*(romvec->pv_v2devops.v2_dumb_mem_free))(vaddr, num_bytes);
43 return;
44} 43}
diff --git a/arch/sparc/prom/ranges.c b/arch/sparc/prom/ranges.c
index cd5790853ff6..aeff43e44e45 100644
--- a/arch/sparc/prom/ranges.c
+++ b/arch/sparc/prom/ranges.c
@@ -87,8 +87,6 @@ void __init prom_ranges_init(void)
87 87
88 if(num_obio_ranges) 88 if(num_obio_ranges)
89 prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); 89 prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges);
90
91 return;
92} 90}
93 91
94void 92void
diff --git a/arch/sparc/prom/segment.c b/arch/sparc/prom/segment.c
index 04fd03a7f926..86a663f1d3c5 100644
--- a/arch/sparc/prom/segment.c
+++ b/arch/sparc/prom/segment.c
@@ -25,5 +25,4 @@ prom_putsegment(int ctx, unsigned long vaddr, int segment)
25 (*(romvec->pv_setctxt))(ctx, (char *) vaddr, segment); 25 (*(romvec->pv_setctxt))(ctx, (char *) vaddr, segment);
26 restore_current(); 26 restore_current();
27 spin_unlock_irqrestore(&prom_lock, flags); 27 spin_unlock_irqrestore(&prom_lock, flags);
28 return;
29} 28}
diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c
index 646d244b1fdb..b21592f8e3fe 100644
--- a/arch/sparc/prom/tree_32.c
+++ b/arch/sparc/prom/tree_32.c
@@ -173,7 +173,6 @@ void prom_getstring(int node, char *prop, char *user_buf, int ubuf_size)
173 len = prom_getproperty(node, prop, user_buf, ubuf_size); 173 len = prom_getproperty(node, prop, user_buf, ubuf_size);
174 if(len != -1) return; 174 if(len != -1) return;
175 user_buf[0] = 0; 175 user_buf[0] = 0;
176 return;
177} 176}
178EXPORT_SYMBOL(prom_getstring); 177EXPORT_SYMBOL(prom_getstring);
179 178
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
index 8ea73ddc61dc..3c0d2dd9f693 100644
--- a/arch/sparc/prom/tree_64.c
+++ b/arch/sparc/prom/tree_64.c
@@ -154,7 +154,6 @@ void prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size)
154 len = prom_getproperty(node, prop, user_buf, ubuf_size); 154 len = prom_getproperty(node, prop, user_buf, ubuf_size);
155 if(len != -1) return; 155 if(len != -1) return;
156 user_buf[0] = 0; 156 user_buf[0] = 0;
157 return;
158} 157}
159EXPORT_SYMBOL(prom_getstring); 158EXPORT_SYMBOL(prom_getstring);
160 159