aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r--arch/sparc/kernel/Makefile1
-rw-r--r--arch/sparc/kernel/audit.c8
-rw-r--r--arch/sparc/kernel/auxio_32.c9
-rw-r--r--arch/sparc/kernel/btext.c2
-rw-r--r--arch/sparc/kernel/compat_audit.c1
-rw-r--r--arch/sparc/kernel/cpu.c1
-rw-r--r--arch/sparc/kernel/cpumap.h4
-rw-r--r--arch/sparc/kernel/devices.c12
-rw-r--r--arch/sparc/kernel/entry.h259
-rw-r--r--arch/sparc/kernel/iommu.c3
-rw-r--r--arch/sparc/kernel/iommu_common.h14
-rw-r--r--arch/sparc/kernel/ioport.c6
-rw-r--r--arch/sparc/kernel/irq.h11
-rw-r--r--arch/sparc/kernel/irq_32.c1
-rw-r--r--arch/sparc/kernel/kernel.h124
-rw-r--r--arch/sparc/kernel/kgdb_64.c2
-rw-r--r--arch/sparc/kernel/kprobes.c5
-rw-r--r--arch/sparc/kernel/leon_kernel.c10
-rw-r--r--arch/sparc/kernel/leon_pci.c79
-rw-r--r--arch/sparc/kernel/leon_pci_grpci1.c16
-rw-r--r--arch/sparc/kernel/leon_pci_grpci2.c22
-rw-r--r--arch/sparc/kernel/leon_pmc.c8
-rw-r--r--arch/sparc/kernel/leon_smp.c13
-rw-r--r--arch/sparc/kernel/of_device_common.c4
-rw-r--r--arch/sparc/kernel/pci.c1
-rw-r--r--arch/sparc/kernel/pci_impl.h30
-rw-r--r--arch/sparc/kernel/pci_sun4v.h156
-rw-r--r--arch/sparc/kernel/pcic.c116
-rw-r--r--arch/sparc/kernel/perf_event.c23
-rw-r--r--arch/sparc/kernel/process_32.c12
-rw-r--r--arch/sparc/kernel/process_64.c20
-rw-r--r--arch/sparc/kernel/prom.h2
-rw-r--r--arch/sparc/kernel/prom_64.c5
-rw-r--r--arch/sparc/kernel/psycho_common.h22
-rw-r--r--arch/sparc/kernel/ptrace_32.c2
-rw-r--r--arch/sparc/kernel/setup_32.c4
-rw-r--r--arch/sparc/kernel/signal32.c56
-rw-r--r--arch/sparc/kernel/signal_32.c11
-rw-r--r--arch/sparc/kernel/signal_64.c6
-rw-r--r--arch/sparc/kernel/smp_32.c13
-rw-r--r--arch/sparc/kernel/smp_64.c16
-rw-r--r--arch/sparc/kernel/sun4d_irq.c17
-rw-r--r--arch/sparc/kernel/sys_sparc32.c2
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c10
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c1
-rw-r--r--arch/sparc/kernel/systbls.h124
-rw-r--r--arch/sparc/kernel/tadpole.c126
-rw-r--r--arch/sparc/kernel/time_32.c8
-rw-r--r--arch/sparc/kernel/traps_32.c4
-rw-r--r--arch/sparc/kernel/traps_64.c11
-rw-r--r--arch/sparc/kernel/unaligned_32.c4
-rw-r--r--arch/sparc/kernel/unaligned_64.c2
-rw-r--r--arch/sparc/kernel/windows.c3
53 files changed, 629 insertions, 793 deletions
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index d15cc1794b0e..7cf9c6ea3f1f 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -42,7 +42,6 @@ obj-y += time_$(BITS).o
42obj-$(CONFIG_SPARC32) += windows.o 42obj-$(CONFIG_SPARC32) += windows.o
43obj-y += cpu.o 43obj-y += cpu.o
44obj-$(CONFIG_SPARC32) += devices.o 44obj-$(CONFIG_SPARC32) += devices.o
45obj-$(CONFIG_SPARC32) += tadpole.o
46obj-y += ptrace_$(BITS).o 45obj-y += ptrace_$(BITS).o
47obj-y += unaligned_$(BITS).o 46obj-y += unaligned_$(BITS).o
48obj-y += una_asm_$(BITS).o 47obj-y += una_asm_$(BITS).o
diff --git a/arch/sparc/kernel/audit.c b/arch/sparc/kernel/audit.c
index 8fff0ac63d56..24361b494a93 100644
--- a/arch/sparc/kernel/audit.c
+++ b/arch/sparc/kernel/audit.c
@@ -3,6 +3,8 @@
3#include <linux/audit.h> 3#include <linux/audit.h>
4#include <asm/unistd.h> 4#include <asm/unistd.h>
5 5
6#include "kernel.h"
7
6static unsigned dir_class[] = { 8static unsigned dir_class[] = {
7#include <asm-generic/audit_dir_write.h> 9#include <asm-generic/audit_dir_write.h>
8~0U 10~0U
@@ -40,7 +42,6 @@ int audit_classify_arch(int arch)
40int audit_classify_syscall(int abi, unsigned syscall) 42int audit_classify_syscall(int abi, unsigned syscall)
41{ 43{
42#ifdef CONFIG_COMPAT 44#ifdef CONFIG_COMPAT
43 extern int sparc32_classify_syscall(unsigned);
44 if (abi == AUDIT_ARCH_SPARC) 45 if (abi == AUDIT_ARCH_SPARC)
45 return sparc32_classify_syscall(syscall); 46 return sparc32_classify_syscall(syscall);
46#endif 47#endif
@@ -61,11 +62,6 @@ int audit_classify_syscall(int abi, unsigned syscall)
61static int __init audit_classes_init(void) 62static int __init audit_classes_init(void)
62{ 63{
63#ifdef CONFIG_COMPAT 64#ifdef CONFIG_COMPAT
64 extern __u32 sparc32_dir_class[];
65 extern __u32 sparc32_write_class[];
66 extern __u32 sparc32_read_class[];
67 extern __u32 sparc32_chattr_class[];
68 extern __u32 sparc32_signal_class[];
69 audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class); 65 audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class);
70 audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class); 66 audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class);
71 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class); 67 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class);
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
index e20cc55fb768..ae88c223e4d3 100644
--- a/arch/sparc/kernel/auxio_32.c
+++ b/arch/sparc/kernel/auxio_32.c
@@ -9,12 +9,15 @@
9#include <linux/of.h> 9#include <linux/of.h>
10#include <linux/of_device.h> 10#include <linux/of_device.h>
11#include <linux/export.h> 11#include <linux/export.h>
12
12#include <asm/oplib.h> 13#include <asm/oplib.h>
13#include <asm/io.h> 14#include <asm/io.h>
14#include <asm/auxio.h> 15#include <asm/auxio.h>
15#include <asm/string.h> /* memset(), Linux has no bzero() */ 16#include <asm/string.h> /* memset(), Linux has no bzero() */
16#include <asm/cpu_type.h> 17#include <asm/cpu_type.h>
17 18
19#include "kernel.h"
20
18/* Probe and map in the Auxiliary I/O register */ 21/* Probe and map in the Auxiliary I/O register */
19 22
20/* auxio_register is not static because it is referenced 23/* auxio_register is not static because it is referenced
@@ -103,7 +106,7 @@ EXPORT_SYMBOL(set_auxio);
103 106
104/* sun4m power control register (AUXIO2) */ 107/* sun4m power control register (AUXIO2) */
105 108
106volatile unsigned char * auxio_power_register = NULL; 109volatile u8 __iomem *auxio_power_register = NULL;
107 110
108void __init auxio_power_probe(void) 111void __init auxio_power_probe(void)
109{ 112{
@@ -127,8 +130,8 @@ void __init auxio_power_probe(void)
127 r.flags = regs.which_io & 0xF; 130 r.flags = regs.which_io & 0xF;
128 r.start = regs.phys_addr; 131 r.start = regs.phys_addr;
129 r.end = regs.phys_addr + regs.reg_size - 1; 132 r.end = regs.phys_addr + regs.reg_size - 1;
130 auxio_power_register = (unsigned char *) of_ioremap(&r, 0, 133 auxio_power_register =
131 regs.reg_size, "auxpower"); 134 (u8 __iomem *)of_ioremap(&r, 0, regs.reg_size, "auxpower");
132 135
133 /* Display a quick message on the console. */ 136 /* Display a quick message on the console. */
134 if (auxio_power_register) 137 if (auxio_power_register)
diff --git a/arch/sparc/kernel/btext.c b/arch/sparc/kernel/btext.c
index 57073e56ba9e..987f7ec497cc 100644
--- a/arch/sparc/kernel/btext.c
+++ b/arch/sparc/kernel/btext.c
@@ -137,7 +137,7 @@ static void scrollscreen(void)
137} 137}
138#endif /* ndef NO_SCROLL */ 138#endif /* ndef NO_SCROLL */
139 139
140void btext_drawchar(char c) 140static void btext_drawchar(char c)
141{ 141{
142 int cline = 0; 142 int cline = 0;
143#ifdef NO_SCROLL 143#ifdef NO_SCROLL
diff --git a/arch/sparc/kernel/compat_audit.c b/arch/sparc/kernel/compat_audit.c
index d865575b25bf..7062263d09c1 100644
--- a/arch/sparc/kernel/compat_audit.c
+++ b/arch/sparc/kernel/compat_audit.c
@@ -1,5 +1,6 @@
1#define __32bit_syscall_numbers__ 1#define __32bit_syscall_numbers__
2#include <asm/unistd.h> 2#include <asm/unistd.h>
3#include "kernel.h"
3 4
4unsigned sparc32_dir_class[] = { 5unsigned sparc32_dir_class[] = {
5#include <asm-generic/audit_dir_write.h> 6#include <asm-generic/audit_dir_write.h>
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 5c5125895db8..82a3a71c451e 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -22,6 +22,7 @@
22#include <asm/cpudata.h> 22#include <asm/cpudata.h>
23 23
24#include "kernel.h" 24#include "kernel.h"
25#include "entry.h"
25 26
26DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; 27DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
27EXPORT_PER_CPU_SYMBOL(__cpu_data); 28EXPORT_PER_CPU_SYMBOL(__cpu_data);
diff --git a/arch/sparc/kernel/cpumap.h b/arch/sparc/kernel/cpumap.h
index e639880ab864..9dac398c434a 100644
--- a/arch/sparc/kernel/cpumap.h
+++ b/arch/sparc/kernel/cpumap.h
@@ -2,8 +2,8 @@
2#define _CPUMAP_H 2#define _CPUMAP_H
3 3
4#ifdef CONFIG_SMP 4#ifdef CONFIG_SMP
5extern void cpu_map_rebuild(void); 5void cpu_map_rebuild(void);
6extern int map_to_cpu(unsigned int index); 6int map_to_cpu(unsigned int index);
7#define cpu_map_init() cpu_map_rebuild() 7#define cpu_map_init() cpu_map_rebuild()
8#else 8#else
9#define cpu_map_init() do {} while (0) 9#define cpu_map_init() do {} while (0)
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index 3d465e87f7e2..8d5d09f09caf 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -19,8 +19,9 @@
19#include <asm/smp.h> 19#include <asm/smp.h>
20#include <asm/cpudata.h> 20#include <asm/cpudata.h>
21#include <asm/cpu_type.h> 21#include <asm/cpu_type.h>
22#include <asm/setup.h>
22 23
23extern void clock_stop_probe(void); /* tadpole.c */ 24#include "kernel.h"
24 25
25static char *cpu_mid_prop(void) 26static char *cpu_mid_prop(void)
26{ 27{
@@ -131,11 +132,6 @@ void __init device_scan(void)
131 } 132 }
132#endif /* !CONFIG_SMP */ 133#endif /* !CONFIG_SMP */
133 134
134 { 135 auxio_probe();
135 extern void auxio_probe(void); 136 auxio_power_probe();
136 extern void auxio_power_probe(void);
137 auxio_probe();
138 auxio_power_probe();
139 }
140 clock_stop_probe();
141} 137}
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index 140966fbd303..ebaba6167dd4 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -6,40 +6,39 @@
6#include <linux/init.h> 6#include <linux/init.h>
7 7
8/* irq */ 8/* irq */
9extern void handler_irq(int irq, struct pt_regs *regs); 9void handler_irq(int irq, struct pt_regs *regs);
10 10
11#ifdef CONFIG_SPARC32 11#ifdef CONFIG_SPARC32
12/* traps */ 12/* traps */
13extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type); 13void do_hw_interrupt(struct pt_regs *regs, unsigned long type);
14extern void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, 14void do_illegal_instruction(struct pt_regs *regs, unsigned long pc,
15 unsigned long npc, unsigned long psr); 15 unsigned long npc, unsigned long psr);
16 16
17extern void do_priv_instruction(struct pt_regs *regs, unsigned long pc, 17void do_priv_instruction(struct pt_regs *regs, unsigned long pc,
18 unsigned long npc, unsigned long psr); 18 unsigned long npc, unsigned long psr);
19extern void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc, 19void do_memaccess_unaligned(struct pt_regs *regs, unsigned long pc,
20 unsigned long npc, 20 unsigned long npc, unsigned long psr);
21 unsigned long psr); 21void do_fpd_trap(struct pt_regs *regs, unsigned long pc,
22extern void do_fpd_trap(struct pt_regs *regs, unsigned long pc, 22 unsigned long npc, unsigned long psr);
23void do_fpe_trap(struct pt_regs *regs, unsigned long pc,
24 unsigned long npc, unsigned long psr);
25void handle_tag_overflow(struct pt_regs *regs, unsigned long pc,
26 unsigned long npc, unsigned long psr);
27void handle_watchpoint(struct pt_regs *regs, unsigned long pc,
28 unsigned long npc, unsigned long psr);
29void handle_reg_access(struct pt_regs *regs, unsigned long pc,
30 unsigned long npc, unsigned long psr);
31void handle_cp_disabled(struct pt_regs *regs, unsigned long pc,
23 unsigned long npc, unsigned long psr); 32 unsigned long npc, unsigned long psr);
24extern void do_fpe_trap(struct pt_regs *regs, unsigned long pc, 33void handle_cp_exception(struct pt_regs *regs, unsigned long pc,
25 unsigned long npc, unsigned long psr); 34 unsigned long npc, unsigned long psr);
26extern void handle_tag_overflow(struct pt_regs *regs, unsigned long pc,
27 unsigned long npc, unsigned long psr);
28extern void handle_watchpoint(struct pt_regs *regs, unsigned long pc,
29 unsigned long npc, unsigned long psr);
30extern void handle_reg_access(struct pt_regs *regs, unsigned long pc,
31 unsigned long npc, unsigned long psr);
32extern void handle_cp_disabled(struct pt_regs *regs, unsigned long pc,
33 unsigned long npc, unsigned long psr);
34extern void handle_cp_exception(struct pt_regs *regs, unsigned long pc,
35 unsigned long npc, unsigned long psr);
36 35
37 36
38 37
39/* entry.S */ 38/* entry.S */
40extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 39void fpsave(unsigned long *fpregs, unsigned long *fsr,
41 void *fpqueue, unsigned long *fpqdepth); 40 void *fpqueue, unsigned long *fpqdepth);
42extern void fpload(unsigned long *fpregs, unsigned long *fsr); 41void fpload(unsigned long *fpregs, unsigned long *fsr);
43 42
44#else /* CONFIG_SPARC32 */ 43#else /* CONFIG_SPARC32 */
45 44
@@ -66,123 +65,123 @@ struct pause_patch_entry {
66extern struct pause_patch_entry __pause_3insn_patch, 65extern struct pause_patch_entry __pause_3insn_patch,
67 __pause_3insn_patch_end; 66 __pause_3insn_patch_end;
68 67
69extern void __init per_cpu_patch(void); 68void __init per_cpu_patch(void);
70extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, 69void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *,
71 struct sun4v_1insn_patch_entry *); 70 struct sun4v_1insn_patch_entry *);
72extern void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, 71void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *,
73 struct sun4v_2insn_patch_entry *); 72 struct sun4v_2insn_patch_entry *);
74extern void __init sun4v_patch(void); 73void __init sun4v_patch(void);
75extern void __init boot_cpu_id_too_large(int cpu); 74void __init boot_cpu_id_too_large(int cpu);
76extern unsigned int dcache_parity_tl1_occurred; 75extern unsigned int dcache_parity_tl1_occurred;
77extern unsigned int icache_parity_tl1_occurred; 76extern unsigned int icache_parity_tl1_occurred;
78 77
79extern asmlinkage void sparc_breakpoint(struct pt_regs *regs); 78asmlinkage void sparc_breakpoint(struct pt_regs *regs);
80extern void timer_interrupt(int irq, struct pt_regs *regs); 79void timer_interrupt(int irq, struct pt_regs *regs);
81 80
82extern void do_notify_resume(struct pt_regs *regs, 81void do_notify_resume(struct pt_regs *regs,
83 unsigned long orig_i0, 82 unsigned long orig_i0,
84 unsigned long thread_info_flags); 83 unsigned long thread_info_flags);
85 84
86extern asmlinkage int syscall_trace_enter(struct pt_regs *regs); 85asmlinkage int syscall_trace_enter(struct pt_regs *regs);
87extern asmlinkage void syscall_trace_leave(struct pt_regs *regs); 86asmlinkage void syscall_trace_leave(struct pt_regs *regs);
88 87
89extern void bad_trap_tl1(struct pt_regs *regs, long lvl); 88void bad_trap_tl1(struct pt_regs *regs, long lvl);
90 89
91extern void do_fpieee(struct pt_regs *regs); 90void do_fpieee(struct pt_regs *regs);
92extern void do_fpother(struct pt_regs *regs); 91void do_fpother(struct pt_regs *regs);
93extern void do_tof(struct pt_regs *regs); 92void do_tof(struct pt_regs *regs);
94extern void do_div0(struct pt_regs *regs); 93void do_div0(struct pt_regs *regs);
95extern void do_illegal_instruction(struct pt_regs *regs); 94void do_illegal_instruction(struct pt_regs *regs);
96extern void mem_address_unaligned(struct pt_regs *regs, 95void mem_address_unaligned(struct pt_regs *regs,
97 unsigned long sfar, 96 unsigned long sfar,
98 unsigned long sfsr); 97 unsigned long sfsr);
99extern void sun4v_do_mna(struct pt_regs *regs, 98void sun4v_do_mna(struct pt_regs *regs,
100 unsigned long addr, 99 unsigned long addr,
101 unsigned long type_ctx); 100 unsigned long type_ctx);
102extern void do_privop(struct pt_regs *regs); 101void do_privop(struct pt_regs *regs);
103extern void do_privact(struct pt_regs *regs); 102void do_privact(struct pt_regs *regs);
104extern void do_cee(struct pt_regs *regs); 103void do_cee(struct pt_regs *regs);
105extern void do_cee_tl1(struct pt_regs *regs); 104void do_cee_tl1(struct pt_regs *regs);
106extern void do_dae_tl1(struct pt_regs *regs); 105void do_dae_tl1(struct pt_regs *regs);
107extern void do_iae_tl1(struct pt_regs *regs); 106void do_iae_tl1(struct pt_regs *regs);
108extern void do_div0_tl1(struct pt_regs *regs); 107void do_div0_tl1(struct pt_regs *regs);
109extern void do_fpdis_tl1(struct pt_regs *regs); 108void do_fpdis_tl1(struct pt_regs *regs);
110extern void do_fpieee_tl1(struct pt_regs *regs); 109void do_fpieee_tl1(struct pt_regs *regs);
111extern void do_fpother_tl1(struct pt_regs *regs); 110void do_fpother_tl1(struct pt_regs *regs);
112extern void do_ill_tl1(struct pt_regs *regs); 111void do_ill_tl1(struct pt_regs *regs);
113extern void do_irq_tl1(struct pt_regs *regs); 112void do_irq_tl1(struct pt_regs *regs);
114extern void do_lddfmna_tl1(struct pt_regs *regs); 113void do_lddfmna_tl1(struct pt_regs *regs);
115extern void do_stdfmna_tl1(struct pt_regs *regs); 114void do_stdfmna_tl1(struct pt_regs *regs);
116extern void do_paw(struct pt_regs *regs); 115void do_paw(struct pt_regs *regs);
117extern void do_paw_tl1(struct pt_regs *regs); 116void do_paw_tl1(struct pt_regs *regs);
118extern void do_vaw(struct pt_regs *regs); 117void do_vaw(struct pt_regs *regs);
119extern void do_vaw_tl1(struct pt_regs *regs); 118void do_vaw_tl1(struct pt_regs *regs);
120extern void do_tof_tl1(struct pt_regs *regs); 119void do_tof_tl1(struct pt_regs *regs);
121extern void do_getpsr(struct pt_regs *regs); 120void do_getpsr(struct pt_regs *regs);
122 121
123extern void spitfire_insn_access_exception(struct pt_regs *regs, 122void spitfire_insn_access_exception(struct pt_regs *regs,
124 unsigned long sfsr, 123 unsigned long sfsr,
125 unsigned long sfar); 124 unsigned long sfar);
126extern void spitfire_insn_access_exception_tl1(struct pt_regs *regs, 125void spitfire_insn_access_exception_tl1(struct pt_regs *regs,
127 unsigned long sfsr, 126 unsigned long sfsr,
128 unsigned long sfar); 127 unsigned long sfar);
129extern void spitfire_data_access_exception(struct pt_regs *regs, 128void spitfire_data_access_exception(struct pt_regs *regs,
130 unsigned long sfsr, 129 unsigned long sfsr,
131 unsigned long sfar); 130 unsigned long sfar);
132extern void spitfire_data_access_exception_tl1(struct pt_regs *regs, 131void spitfire_data_access_exception_tl1(struct pt_regs *regs,
133 unsigned long sfsr, 132 unsigned long sfsr,
134 unsigned long sfar); 133 unsigned long sfar);
135extern void spitfire_access_error(struct pt_regs *regs, 134void spitfire_access_error(struct pt_regs *regs,
136 unsigned long status_encoded, 135 unsigned long status_encoded,
137 unsigned long afar); 136 unsigned long afar);
138 137
139extern void cheetah_fecc_handler(struct pt_regs *regs, 138void cheetah_fecc_handler(struct pt_regs *regs,
140 unsigned long afsr, 139 unsigned long afsr,
141 unsigned long afar); 140 unsigned long afar);
142extern void cheetah_cee_handler(struct pt_regs *regs, 141void cheetah_cee_handler(struct pt_regs *regs,
143 unsigned long afsr, 142 unsigned long afsr,
144 unsigned long afar); 143 unsigned long afar);
145extern void cheetah_deferred_handler(struct pt_regs *regs, 144void cheetah_deferred_handler(struct pt_regs *regs,
146 unsigned long afsr, 145 unsigned long afsr,
147 unsigned long afar); 146 unsigned long afar);
148extern void cheetah_plus_parity_error(int type, struct pt_regs *regs); 147void cheetah_plus_parity_error(int type, struct pt_regs *regs);
149 148
150extern void sun4v_insn_access_exception(struct pt_regs *regs, 149void sun4v_insn_access_exception(struct pt_regs *regs,
151 unsigned long addr, 150 unsigned long addr,
152 unsigned long type_ctx); 151 unsigned long type_ctx);
153extern void sun4v_insn_access_exception_tl1(struct pt_regs *regs, 152void sun4v_insn_access_exception_tl1(struct pt_regs *regs,
154 unsigned long addr, 153 unsigned long addr,
155 unsigned long type_ctx); 154 unsigned long type_ctx);
156extern void sun4v_data_access_exception(struct pt_regs *regs, 155void sun4v_data_access_exception(struct pt_regs *regs,
157 unsigned long addr, 156 unsigned long addr,
158 unsigned long type_ctx); 157 unsigned long type_ctx);
159extern void sun4v_data_access_exception_tl1(struct pt_regs *regs, 158void sun4v_data_access_exception_tl1(struct pt_regs *regs,
160 unsigned long addr, 159 unsigned long addr,
161 unsigned long type_ctx); 160 unsigned long type_ctx);
162extern void sun4v_resum_error(struct pt_regs *regs, 161void sun4v_resum_error(struct pt_regs *regs,
163 unsigned long offset); 162 unsigned long offset);
164extern void sun4v_resum_overflow(struct pt_regs *regs); 163void sun4v_resum_overflow(struct pt_regs *regs);
165extern void sun4v_nonresum_error(struct pt_regs *regs, 164void sun4v_nonresum_error(struct pt_regs *regs,
166 unsigned long offset); 165 unsigned long offset);
167extern void sun4v_nonresum_overflow(struct pt_regs *regs); 166void sun4v_nonresum_overflow(struct pt_regs *regs);
168 167
169extern unsigned long sun4v_err_itlb_vaddr; 168extern unsigned long sun4v_err_itlb_vaddr;
170extern unsigned long sun4v_err_itlb_ctx; 169extern unsigned long sun4v_err_itlb_ctx;
171extern unsigned long sun4v_err_itlb_pte; 170extern unsigned long sun4v_err_itlb_pte;
172extern unsigned long sun4v_err_itlb_error; 171extern unsigned long sun4v_err_itlb_error;
173 172
174extern void sun4v_itlb_error_report(struct pt_regs *regs, int tl); 173void sun4v_itlb_error_report(struct pt_regs *regs, int tl);
175 174
176extern unsigned long sun4v_err_dtlb_vaddr; 175extern unsigned long sun4v_err_dtlb_vaddr;
177extern unsigned long sun4v_err_dtlb_ctx; 176extern unsigned long sun4v_err_dtlb_ctx;
178extern unsigned long sun4v_err_dtlb_pte; 177extern unsigned long sun4v_err_dtlb_pte;
179extern unsigned long sun4v_err_dtlb_error; 178extern unsigned long sun4v_err_dtlb_error;
180 179
181extern void sun4v_dtlb_error_report(struct pt_regs *regs, int tl); 180void sun4v_dtlb_error_report(struct pt_regs *regs, int tl);
182extern void hypervisor_tlbop_error(unsigned long err, 181void hypervisor_tlbop_error(unsigned long err,
183 unsigned long op); 182 unsigned long op);
184extern void hypervisor_tlbop_error_xcall(unsigned long err, 183void hypervisor_tlbop_error_xcall(unsigned long err,
185 unsigned long op); 184 unsigned long op);
186 185
187/* WARNING: The error trap handlers in assembly know the precise 186/* WARNING: The error trap handlers in assembly know the precise
188 * layout of the following structure. 187 * layout of the following structure.
@@ -248,8 +247,8 @@ struct ino_bucket {
248extern struct ino_bucket *ivector_table; 247extern struct ino_bucket *ivector_table;
249extern unsigned long ivector_table_pa; 248extern unsigned long ivector_table_pa;
250 249
251extern void init_irqwork_curcpu(void); 250void init_irqwork_curcpu(void);
252extern void sun4v_register_mondo_queues(int this_cpu); 251void sun4v_register_mondo_queues(int this_cpu);
253 252
254#endif /* CONFIG_SPARC32 */ 253#endif /* CONFIG_SPARC32 */
255#endif /* _ENTRY_H */ 254#endif /* _ENTRY_H */
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 76663b019eb5..bfa4d0c2df42 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -21,6 +21,7 @@
21#include <asm/iommu.h> 21#include <asm/iommu.h>
22 22
23#include "iommu_common.h" 23#include "iommu_common.h"
24#include "kernel.h"
24 25
25#define STC_CTXMATCH_ADDR(STC, CTX) \ 26#define STC_CTXMATCH_ADDR(STC, CTX) \
26 ((STC)->strbuf_ctxmatch_base + ((CTX) << 3)) 27 ((STC)->strbuf_ctxmatch_base + ((CTX) << 3))
@@ -840,8 +841,6 @@ static struct dma_map_ops sun4u_dma_ops = {
840struct dma_map_ops *dma_ops = &sun4u_dma_ops; 841struct dma_map_ops *dma_ops = &sun4u_dma_ops;
841EXPORT_SYMBOL(dma_ops); 842EXPORT_SYMBOL(dma_ops);
842 843
843extern int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask);
844
845int dma_supported(struct device *dev, u64 device_mask) 844int dma_supported(struct device *dev, u64 device_mask)
846{ 845{
847 struct iommu *iommu = dev->archdata.iommu; 846 struct iommu *iommu = dev->archdata.iommu;
diff --git a/arch/sparc/kernel/iommu_common.h b/arch/sparc/kernel/iommu_common.h
index 591f5879039c..1ec0de4156e7 100644
--- a/arch/sparc/kernel/iommu_common.h
+++ b/arch/sparc/kernel/iommu_common.h
@@ -48,12 +48,12 @@ static inline int is_span_boundary(unsigned long entry,
48 return iommu_is_span_boundary(entry, nr, shift, boundary_size); 48 return iommu_is_span_boundary(entry, nr, shift, boundary_size);
49} 49}
50 50
51extern unsigned long iommu_range_alloc(struct device *dev, 51unsigned long iommu_range_alloc(struct device *dev,
52 struct iommu *iommu, 52 struct iommu *iommu,
53 unsigned long npages, 53 unsigned long npages,
54 unsigned long *handle); 54 unsigned long *handle);
55extern void iommu_range_free(struct iommu *iommu, 55void iommu_range_free(struct iommu *iommu,
56 dma_addr_t dma_addr, 56 dma_addr_t dma_addr,
57 unsigned long npages); 57 unsigned long npages);
58 58
59#endif /* _IOMMU_COMMON_H */ 59#endif /* _IOMMU_COMMON_H */
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index e7e215dfa866..7f08ec8a7c68 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -186,7 +186,7 @@ static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
186 186
187 if (name == NULL) name = "???"; 187 if (name == NULL) name = "???";
188 188
189 if ((xres = xres_alloc()) != 0) { 189 if ((xres = xres_alloc()) != NULL) {
190 tack = xres->xname; 190 tack = xres->xname;
191 res = &xres->xres; 191 res = &xres->xres;
192 } else { 192 } else {
@@ -400,7 +400,7 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
400 BUG(); 400 BUG();
401} 401}
402 402
403struct dma_map_ops sbus_dma_ops = { 403static struct dma_map_ops sbus_dma_ops = {
404 .alloc = sbus_alloc_coherent, 404 .alloc = sbus_alloc_coherent,
405 .free = sbus_free_coherent, 405 .free = sbus_free_coherent,
406 .map_page = sbus_map_page, 406 .map_page = sbus_map_page,
@@ -681,7 +681,7 @@ static int sparc_io_proc_show(struct seq_file *m, void *v)
681 const char *nm; 681 const char *nm;
682 682
683 for (r = root->child; r != NULL; r = r->sibling) { 683 for (r = root->child; r != NULL; r = r->sibling) {
684 if ((nm = r->name) == 0) nm = "???"; 684 if ((nm = r->name) == NULL) nm = "???";
685 seq_printf(m, "%016llx-%016llx: %s\n", 685 seq_printf(m, "%016llx-%016llx: %s\n",
686 (unsigned long long)r->start, 686 (unsigned long long)r->start,
687 (unsigned long long)r->end, nm); 687 (unsigned long long)r->end, nm);
diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h
index b66b6aad1d6d..70a0b8ddd0ba 100644
--- a/arch/sparc/kernel/irq.h
+++ b/arch/sparc/kernel/irq.h
@@ -82,11 +82,20 @@ void handler_irq(unsigned int pil, struct pt_regs *regs);
82 82
83unsigned long leon_get_irqmask(unsigned int irq); 83unsigned long leon_get_irqmask(unsigned int irq);
84 84
85/* irq_32.c */
86void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs);
87
88/* sun4m_irq.c */
89void sun4m_nmi(struct pt_regs *regs);
90
91/* sun4d_irq.c */
92void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs);
93
85#ifdef CONFIG_SMP 94#ifdef CONFIG_SMP
86 95
87/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ 96/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */
88#define SUN4D_IPI_IRQ 13 97#define SUN4D_IPI_IRQ 13
89 98
90extern void sun4d_ipi_interrupt(void); 99void sun4d_ipi_interrupt(void);
91 100
92#endif 101#endif
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index c145f6fd123b..a979e99f8751 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -17,6 +17,7 @@
17 17
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/cpudata.h> 19#include <asm/cpudata.h>
20#include <asm/setup.h>
20#include <asm/pcic.h> 21#include <asm/pcic.h>
21#include <asm/leon.h> 22#include <asm/leon.h>
22 23
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
index a702d9ab019c..e7f652be9e61 100644
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -2,6 +2,7 @@
2#define __SPARC_KERNEL_H 2#define __SPARC_KERNEL_H
3 3
4#include <linux/interrupt.h> 4#include <linux/interrupt.h>
5#include <linux/ftrace.h>
5 6
6#include <asm/traps.h> 7#include <asm/traps.h>
7#include <asm/head.h> 8#include <asm/head.h>
@@ -15,62 +16,111 @@ extern int ncpus_probed;
15#ifdef CONFIG_SPARC64 16#ifdef CONFIG_SPARC64
16/* setup_64.c */ 17/* setup_64.c */
17struct seq_file; 18struct seq_file;
18extern void cpucap_info(struct seq_file *); 19void cpucap_info(struct seq_file *);
19 20
20static inline unsigned long kimage_addr_to_ra(const char *p) 21static inline unsigned long kimage_addr_to_ra(const void *p)
21{ 22{
22 unsigned long val = (unsigned long) p; 23 unsigned long val = (unsigned long) p;
23 24
24 return kern_base + (val - KERNBASE); 25 return kern_base + (val - KERNBASE);
25} 26}
27
28/* sys_sparc_64.c */
29asmlinkage long sys_kern_features(void);
30
31/* unaligned_64.c */
32asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
33int handle_popc(u32 insn, struct pt_regs *regs);
34void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr);
35void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr);
36
37/* smp_64.c */
38void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs);
39void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs);
40void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs);
41void __irq_entry smp_penguin_jailcell(int irq, struct pt_regs *regs);
42void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs);
43
44/* kgdb_64.c */
45void __irq_entry smp_kgdb_capture_client(int irq, struct pt_regs *regs);
46
47/* pci.c */
48int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask);
49
50/* signal32.c */
51void do_sigreturn32(struct pt_regs *regs);
52asmlinkage void do_rt_sigreturn32(struct pt_regs *regs);
53void do_signal32(struct pt_regs * regs);
54asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp);
55
56/* compat_audit.c */
57extern unsigned sparc32_dir_class[];
58extern unsigned sparc32_chattr_class[];
59extern unsigned sparc32_write_class[];
60extern unsigned sparc32_read_class[];
61extern unsigned sparc32_signal_class[];
62int sparc32_classify_syscall(unsigned syscall);
26#endif 63#endif
27 64
28#ifdef CONFIG_SPARC32 65#ifdef CONFIG_SPARC32
29/* setup_32.c */ 66/* setup_32.c */
67struct linux_romvec;
30void sparc32_start_kernel(struct linux_romvec *rp); 68void sparc32_start_kernel(struct linux_romvec *rp);
31 69
32/* cpu.c */ 70/* cpu.c */
33extern void cpu_probe(void); 71void cpu_probe(void);
34 72
35/* traps_32.c */ 73/* traps_32.c */
36extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, 74void handle_hw_divzero(struct pt_regs *regs, unsigned long pc,
37 unsigned long npc, unsigned long psr); 75 unsigned long npc, unsigned long psr);
38/* irq_32.c */ 76/* irq_32.c */
39extern struct irqaction static_irqaction[]; 77extern struct irqaction static_irqaction[];
40extern int static_irq_count; 78extern int static_irq_count;
41extern spinlock_t irq_action_lock; 79extern spinlock_t irq_action_lock;
42 80
43extern void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); 81void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs);
44extern void init_IRQ(void); 82void init_IRQ(void);
45 83
46/* sun4m_irq.c */ 84/* sun4m_irq.c */
47extern void sun4m_init_IRQ(void); 85void sun4m_init_IRQ(void);
48extern void sun4m_unmask_profile_irq(void); 86void sun4m_unmask_profile_irq(void);
49extern void sun4m_clear_profile_irq(int cpu); 87void sun4m_clear_profile_irq(int cpu);
50 88
51/* sun4m_smp.c */ 89/* sun4m_smp.c */
52void sun4m_cpu_pre_starting(void *arg); 90void sun4m_cpu_pre_starting(void *arg);
53void sun4m_cpu_pre_online(void *arg); 91void sun4m_cpu_pre_online(void *arg);
92void __init smp4m_boot_cpus(void);
93int smp4m_boot_one_cpu(int i, struct task_struct *idle);
94void __init smp4m_smp_done(void);
95void smp4m_cross_call_irq(void);
96void smp4m_percpu_timer_interrupt(struct pt_regs *regs);
54 97
55/* sun4d_irq.c */ 98/* sun4d_irq.c */
56extern spinlock_t sun4d_imsk_lock; 99extern spinlock_t sun4d_imsk_lock;
57 100
58extern void sun4d_init_IRQ(void); 101void sun4d_init_IRQ(void);
59extern int sun4d_request_irq(unsigned int irq, 102int sun4d_request_irq(unsigned int irq,
60 irq_handler_t handler, 103 irq_handler_t handler,
61 unsigned long irqflags, 104 unsigned long irqflags,
62 const char *devname, void *dev_id); 105 const char *devname, void *dev_id);
63extern int show_sun4d_interrupts(struct seq_file *, void *); 106int show_sun4d_interrupts(struct seq_file *, void *);
64extern void sun4d_distribute_irqs(void); 107void sun4d_distribute_irqs(void);
65extern void sun4d_free_irq(unsigned int irq, void *dev_id); 108void sun4d_free_irq(unsigned int irq, void *dev_id);
66 109
67/* sun4d_smp.c */ 110/* sun4d_smp.c */
68void sun4d_cpu_pre_starting(void *arg); 111void sun4d_cpu_pre_starting(void *arg);
69void sun4d_cpu_pre_online(void *arg); 112void sun4d_cpu_pre_online(void *arg);
113void __init smp4d_boot_cpus(void);
114int smp4d_boot_one_cpu(int i, struct task_struct *idle);
115void __init smp4d_smp_done(void);
116void smp4d_cross_call_irq(void);
117void smp4d_percpu_timer_interrupt(struct pt_regs *regs);
70 118
71/* leon_smp.c */ 119/* leon_smp.c */
72void leon_cpu_pre_starting(void *arg); 120void leon_cpu_pre_starting(void *arg);
73void leon_cpu_pre_online(void *arg); 121void leon_cpu_pre_online(void *arg);
122void leonsmp_ipi_interrupt(void);
123void leon_cross_call_irq(void);
74 124
75/* head_32.S */ 125/* head_32.S */
76extern unsigned int t_nmi[]; 126extern unsigned int t_nmi[];
@@ -89,12 +139,48 @@ extern unsigned int real_irq_entry[];
89extern unsigned int smp4d_ticker[]; 139extern unsigned int smp4d_ticker[];
90extern unsigned int patchme_maybe_smp_msg[]; 140extern unsigned int patchme_maybe_smp_msg[];
91 141
92extern void floppy_hardint(void); 142void floppy_hardint(void);
93 143
94/* trampoline_32.S */ 144/* trampoline_32.S */
95extern unsigned long sun4m_cpu_startup; 145extern unsigned long sun4m_cpu_startup;
96extern unsigned long sun4d_cpu_startup; 146extern unsigned long sun4d_cpu_startup;
97 147
148/* process_32.c */
149asmlinkage int sparc_do_fork(unsigned long clone_flags,
150 unsigned long stack_start,
151 struct pt_regs *regs,
152 unsigned long stack_size);
153
154/* signal_32.c */
155asmlinkage void do_sigreturn(struct pt_regs *regs);
156asmlinkage void do_rt_sigreturn(struct pt_regs *regs);
157void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
158 unsigned long thread_info_flags);
159asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr,
160 struct sigstack __user *ossptr,
161 unsigned long sp);
162
163/* ptrace_32.c */
164asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p);
165
166/* unaligned_32.c */
167asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
168asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn);
169
170/* windows.c */
171void try_to_clear_window_buffer(struct pt_regs *regs, int who);
172
173/* auxio_32.c */
174void __init auxio_probe(void);
175void __init auxio_power_probe(void);
176
177/* pcic.c */
178extern void __iomem *pcic_regs;
179void pcic_nmi(unsigned int pend, struct pt_regs *regs);
180
181/* time_32.c */
182void __init time_init(void);
183
98#else /* CONFIG_SPARC32 */ 184#else /* CONFIG_SPARC32 */
99#endif /* CONFIG_SPARC32 */ 185#endif /* CONFIG_SPARC32 */
100#endif /* !(__SPARC_KERNEL_H) */ 186#endif /* !(__SPARC_KERNEL_H) */
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c
index b45fe3fb4d2c..cbf21d0870e0 100644
--- a/arch/sparc/kernel/kgdb_64.c
+++ b/arch/sparc/kernel/kgdb_64.c
@@ -13,6 +13,8 @@
13#include <asm/ptrace.h> 13#include <asm/ptrace.h>
14#include <asm/irq.h> 14#include <asm/irq.h>
15 15
16#include "kernel.h"
17
16void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 18void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
17{ 19{
18 struct reg_window *win; 20 struct reg_window *win;
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 1b0973503197..98d712843413 100644
--- a/arch/sparc/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
@@ -512,7 +512,8 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
512/* 512/*
513 * Called when the probe at kretprobe trampoline is hit 513 * Called when the probe at kretprobe trampoline is hit
514 */ 514 */
515int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 515static int __kprobes trampoline_probe_handler(struct kprobe *p,
516 struct pt_regs *regs)
516{ 517{
517 struct kretprobe_instance *ri = NULL; 518 struct kretprobe_instance *ri = NULL;
518 struct hlist_head *head, empty_rp; 519 struct hlist_head *head, empty_rp;
@@ -576,7 +577,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
576 return 1; 577 return 1;
577} 578}
578 579
579void kretprobe_trampoline_holder(void) 580static void __used kretprobe_trampoline_holder(void)
580{ 581{
581 asm volatile(".global kretprobe_trampoline\n" 582 asm volatile(".global kretprobe_trampoline\n"
582 "kretprobe_trampoline:\n" 583 "kretprobe_trampoline:\n"
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index b7c68976cbc7..683c4af999de 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -32,12 +32,12 @@ struct leon3_gptimer_regs_map *leon3_gptimer_regs; /* timer controller base addr
32 32
33int leondebug_irq_disable; 33int leondebug_irq_disable;
34int leon_debug_irqout; 34int leon_debug_irqout;
35static int dummy_master_l10_counter; 35static volatile u32 dummy_master_l10_counter;
36unsigned long amba_system_id; 36unsigned long amba_system_id;
37static DEFINE_SPINLOCK(leon_irq_lock); 37static DEFINE_SPINLOCK(leon_irq_lock);
38 38
39static unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
39unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ 40unsigned long leon3_gptimer_irq; /* interrupt controller irq number */
40unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
41unsigned int sparc_leon_eirq; 41unsigned int sparc_leon_eirq;
42#define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu]) 42#define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu])
43#define LEON_IACK (&leon3_irqctrl_regs->iclear) 43#define LEON_IACK (&leon3_irqctrl_regs->iclear)
@@ -65,7 +65,7 @@ static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)
65} 65}
66 66
67/* The extended IRQ controller has been found, this function registers it */ 67/* The extended IRQ controller has been found, this function registers it */
68void leon_eirq_setup(unsigned int eirq) 68static void leon_eirq_setup(unsigned int eirq)
69{ 69{
70 unsigned long mask, oldmask; 70 unsigned long mask, oldmask;
71 unsigned int veirq; 71 unsigned int veirq;
@@ -270,7 +270,7 @@ static u32 leon_cycles_offset(void)
270#ifdef CONFIG_SMP 270#ifdef CONFIG_SMP
271 271
272/* smp clockevent irq */ 272/* smp clockevent irq */
273irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused) 273static irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused)
274{ 274{
275 struct clock_event_device *ce; 275 struct clock_event_device *ce;
276 int cpu = smp_processor_id(); 276 int cpu = smp_processor_id();
@@ -313,7 +313,7 @@ void __init leon_init_timers(void)
313 313
314 leondebug_irq_disable = 0; 314 leondebug_irq_disable = 0;
315 leon_debug_irqout = 0; 315 leon_debug_irqout = 0;
316 master_l10_counter = (unsigned int *)&dummy_master_l10_counter; 316 master_l10_counter = (u32 __iomem *)&dummy_master_l10_counter;
317 dummy_master_l10_counter = 0; 317 dummy_master_l10_counter = 0;
318 318
319 rootnp = of_find_node_by_path("/ambapp0"); 319 rootnp = of_find_node_by_path("/ambapp0");
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index e16c4157e1ae..899b7203a4e4 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -98,82 +98,3 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
98{ 98{
99 return res->start; 99 return res->start;
100} 100}
101
102/* in/out routines taken from pcic.c
103 *
104 * This probably belongs here rather than ioport.c because
105 * we do not want this crud linked into SBus kernels.
106 * Also, think for a moment about likes of floppy.c that
107 * include architecture specific parts. They may want to redefine ins/outs.
108 *
109 * We do not use horrible macros here because we want to
110 * advance pointer by sizeof(size).
111 */
112void outsb(unsigned long addr, const void *src, unsigned long count)
113{
114 while (count) {
115 count -= 1;
116 outb(*(const char *)src, addr);
117 src += 1;
118 /* addr += 1; */
119 }
120}
121EXPORT_SYMBOL(outsb);
122
123void outsw(unsigned long addr, const void *src, unsigned long count)
124{
125 while (count) {
126 count -= 2;
127 outw(*(const short *)src, addr);
128 src += 2;
129 /* addr += 2; */
130 }
131}
132EXPORT_SYMBOL(outsw);
133
134void outsl(unsigned long addr, const void *src, unsigned long count)
135{
136 while (count) {
137 count -= 4;
138 outl(*(const long *)src, addr);
139 src += 4;
140 /* addr += 4; */
141 }
142}
143EXPORT_SYMBOL(outsl);
144
145void insb(unsigned long addr, void *dst, unsigned long count)
146{
147 while (count) {
148 count -= 1;
149 *(unsigned char *)dst = inb(addr);
150 dst += 1;
151 /* addr += 1; */
152 }
153}
154EXPORT_SYMBOL(insb);
155
156void insw(unsigned long addr, void *dst, unsigned long count)
157{
158 while (count) {
159 count -= 2;
160 *(unsigned short *)dst = inw(addr);
161 dst += 2;
162 /* addr += 2; */
163 }
164}
165EXPORT_SYMBOL(insw);
166
167void insl(unsigned long addr, void *dst, unsigned long count)
168{
169 while (count) {
170 count -= 4;
171 /*
172 * XXX I am sure we are in for an unaligned trap here.
173 */
174 *(unsigned long *)dst = inl(addr);
175 dst += 4;
176 /* addr += 4; */
177 }
178}
179EXPORT_SYMBOL(insl);
diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c
index 6df26e37f879..c8bf26edfa7c 100644
--- a/arch/sparc/kernel/leon_pci_grpci1.c
+++ b/arch/sparc/kernel/leon_pci_grpci1.c
@@ -80,7 +80,7 @@ struct grpci1_regs {
80 80
81struct grpci1_priv { 81struct grpci1_priv {
82 struct leon_pci_info info; /* must be on top of this structure */ 82 struct leon_pci_info info; /* must be on top of this structure */
83 struct grpci1_regs *regs; /* GRPCI register map */ 83 struct grpci1_regs __iomem *regs; /* GRPCI register map */
84 struct device *dev; 84 struct device *dev;
85 int pci_err_mask; /* STATUS register error mask */ 85 int pci_err_mask; /* STATUS register error mask */
86 int irq; /* LEON irqctrl GRPCI IRQ */ 86 int irq; /* LEON irqctrl GRPCI IRQ */
@@ -101,7 +101,7 @@ static struct grpci1_priv *grpci1priv;
101static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus, 101static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus,
102 unsigned int devfn, int where, u32 val); 102 unsigned int devfn, int where, u32 val);
103 103
104int grpci1_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 104static int grpci1_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
105{ 105{
106 struct grpci1_priv *priv = dev->bus->sysdata; 106 struct grpci1_priv *priv = dev->bus->sysdata;
107 int irq_group; 107 int irq_group;
@@ -144,7 +144,7 @@ static int grpci1_cfg_r32(struct grpci1_priv *priv, unsigned int bus,
144 grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp); 144 grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp);
145 } else { 145 } else {
146 /* Bus always little endian (unaffected by byte-swapping) */ 146 /* Bus always little endian (unaffected by byte-swapping) */
147 *val = flip_dword(tmp); 147 *val = swab32(tmp);
148 } 148 }
149 149
150 return 0; 150 return 0;
@@ -197,7 +197,7 @@ static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus,
197 197
198 pci_conf = (unsigned int *) (priv->pci_conf | 198 pci_conf = (unsigned int *) (priv->pci_conf |
199 (devfn << 8) | (where & 0xfc)); 199 (devfn << 8) | (where & 0xfc));
200 LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); 200 LEON3_BYPASS_STORE_PA(pci_conf, swab32(val));
201 201
202 return 0; 202 return 0;
203} 203}
@@ -417,10 +417,10 @@ out:
417 * BAR1: peripheral DMA to host's memory (size at least 256MByte) 417 * BAR1: peripheral DMA to host's memory (size at least 256MByte)
418 * BAR2..BAR5: not implemented in hardware 418 * BAR2..BAR5: not implemented in hardware
419 */ 419 */
420void grpci1_hw_init(struct grpci1_priv *priv) 420static void grpci1_hw_init(struct grpci1_priv *priv)
421{ 421{
422 u32 ahbadr, bar_sz, data, pciadr; 422 u32 ahbadr, bar_sz, data, pciadr;
423 struct grpci1_regs *regs = priv->regs; 423 struct grpci1_regs __iomem *regs = priv->regs;
424 424
425 /* set 1:1 mapping between AHB -> PCI memory space */ 425 /* set 1:1 mapping between AHB -> PCI memory space */
426 REGSTORE(regs->cfg_stat, priv->pci_area & 0xf0000000); 426 REGSTORE(regs->cfg_stat, priv->pci_area & 0xf0000000);
@@ -509,7 +509,7 @@ static irqreturn_t grpci1_err_interrupt(int irq, void *arg)
509 509
510static int grpci1_of_probe(struct platform_device *ofdev) 510static int grpci1_of_probe(struct platform_device *ofdev)
511{ 511{
512 struct grpci1_regs *regs; 512 struct grpci1_regs __iomem *regs;
513 struct grpci1_priv *priv; 513 struct grpci1_priv *priv;
514 int err, len; 514 int err, len;
515 const int *tmp; 515 const int *tmp;
@@ -690,7 +690,7 @@ err3:
690err2: 690err2:
691 release_resource(&priv->info.mem_space); 691 release_resource(&priv->info.mem_space);
692err1: 692err1:
693 iounmap((void *)priv->pci_io_va); 693 iounmap((void __iomem *)priv->pci_io_va);
694 grpci1priv = NULL; 694 grpci1priv = NULL;
695 return err; 695 return err;
696} 696}
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c
index 24d6a4446349..e433a4d69fe0 100644
--- a/arch/sparc/kernel/leon_pci_grpci2.c
+++ b/arch/sparc/kernel/leon_pci_grpci2.c
@@ -191,7 +191,7 @@ struct grpci2_cap_first {
191 191
192struct grpci2_priv { 192struct grpci2_priv {
193 struct leon_pci_info info; /* must be on top of this structure */ 193 struct leon_pci_info info; /* must be on top of this structure */
194 struct grpci2_regs *regs; 194 struct grpci2_regs __iomem *regs;
195 char irq; 195 char irq;
196 char irq_mode; /* IRQ Mode from CAPSTS REG */ 196 char irq_mode; /* IRQ Mode from CAPSTS REG */
197 char bt_enabled; 197 char bt_enabled;
@@ -215,10 +215,10 @@ struct grpci2_priv {
215 struct grpci2_barcfg tgtbars[6]; 215 struct grpci2_barcfg tgtbars[6];
216}; 216};
217 217
218DEFINE_SPINLOCK(grpci2_dev_lock); 218static DEFINE_SPINLOCK(grpci2_dev_lock);
219struct grpci2_priv *grpci2priv; 219static struct grpci2_priv *grpci2priv;
220 220
221int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 221static int grpci2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
222{ 222{
223 struct grpci2_priv *priv = dev->bus->sysdata; 223 struct grpci2_priv *priv = dev->bus->sysdata;
224 int irq_group; 224 int irq_group;
@@ -270,7 +270,7 @@ static int grpci2_cfg_r32(struct grpci2_priv *priv, unsigned int bus,
270 *val = 0xffffffff; 270 *val = 0xffffffff;
271 } else { 271 } else {
272 /* Bus always little endian (unaffected by byte-swapping) */ 272 /* Bus always little endian (unaffected by byte-swapping) */
273 *val = flip_dword(tmp); 273 *val = swab32(tmp);
274 } 274 }
275 275
276 return 0; 276 return 0;
@@ -328,7 +328,7 @@ static int grpci2_cfg_w32(struct grpci2_priv *priv, unsigned int bus,
328 328
329 pci_conf = (unsigned int *) (priv->pci_conf | 329 pci_conf = (unsigned int *) (priv->pci_conf |
330 (devfn << 8) | (where & 0xfc)); 330 (devfn << 8) | (where & 0xfc));
331 LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val)); 331 LEON3_BYPASS_STORE_PA(pci_conf, swab32(val));
332 332
333 /* Wait until GRPCI2 signals that CFG access is done, it should be 333 /* Wait until GRPCI2 signals that CFG access is done, it should be
334 * done instantaneously unless a DMA operation is ongoing... 334 * done instantaneously unless a DMA operation is ongoing...
@@ -561,10 +561,10 @@ out:
561 return virq; 561 return virq;
562} 562}
563 563
564void grpci2_hw_init(struct grpci2_priv *priv) 564static void grpci2_hw_init(struct grpci2_priv *priv)
565{ 565{
566 u32 ahbadr, pciadr, bar_sz, capptr, io_map, data; 566 u32 ahbadr, pciadr, bar_sz, capptr, io_map, data;
567 struct grpci2_regs *regs = priv->regs; 567 struct grpci2_regs __iomem *regs = priv->regs;
568 int i; 568 int i;
569 struct grpci2_barcfg *barcfg = priv->tgtbars; 569 struct grpci2_barcfg *barcfg = priv->tgtbars;
570 570
@@ -655,7 +655,7 @@ static irqreturn_t grpci2_jump_interrupt(int irq, void *arg)
655static irqreturn_t grpci2_err_interrupt(int irq, void *arg) 655static irqreturn_t grpci2_err_interrupt(int irq, void *arg)
656{ 656{
657 struct grpci2_priv *priv = arg; 657 struct grpci2_priv *priv = arg;
658 struct grpci2_regs *regs = priv->regs; 658 struct grpci2_regs __iomem *regs = priv->regs;
659 unsigned int status; 659 unsigned int status;
660 660
661 status = REGLOAD(regs->sts_cap); 661 status = REGLOAD(regs->sts_cap);
@@ -682,7 +682,7 @@ static irqreturn_t grpci2_err_interrupt(int irq, void *arg)
682 682
683static int grpci2_of_probe(struct platform_device *ofdev) 683static int grpci2_of_probe(struct platform_device *ofdev)
684{ 684{
685 struct grpci2_regs *regs; 685 struct grpci2_regs __iomem *regs;
686 struct grpci2_priv *priv; 686 struct grpci2_priv *priv;
687 int err, i, len; 687 int err, i, len;
688 const int *tmp; 688 const int *tmp;
@@ -878,7 +878,7 @@ err4:
878 release_resource(&priv->info.mem_space); 878 release_resource(&priv->info.mem_space);
879err3: 879err3:
880 err = -ENOMEM; 880 err = -ENOMEM;
881 iounmap((void *)priv->pci_io_va); 881 iounmap((void __iomem *)priv->pci_io_va);
882err2: 882err2:
883 kfree(priv); 883 kfree(priv);
884err1: 884err1:
diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c
index b0b3967a2dd2..ddcf950282ed 100644
--- a/arch/sparc/kernel/leon_pmc.c
+++ b/arch/sparc/kernel/leon_pmc.c
@@ -12,14 +12,14 @@
12#include <asm/processor.h> 12#include <asm/processor.h>
13 13
14/* List of Systems that need fixup instructions around power-down instruction */ 14/* List of Systems that need fixup instructions around power-down instruction */
15unsigned int pmc_leon_fixup_ids[] = { 15static unsigned int pmc_leon_fixup_ids[] = {
16 AEROFLEX_UT699, 16 AEROFLEX_UT699,
17 GAISLER_GR712RC, 17 GAISLER_GR712RC,
18 LEON4_NEXTREME1, 18 LEON4_NEXTREME1,
19 0 19 0
20}; 20};
21 21
22int pmc_leon_need_fixup(void) 22static int pmc_leon_need_fixup(void)
23{ 23{
24 unsigned int systemid = amba_system_id >> 16; 24 unsigned int systemid = amba_system_id >> 16;
25 unsigned int *id; 25 unsigned int *id;
@@ -38,7 +38,7 @@ int pmc_leon_need_fixup(void)
38 * CPU idle callback function for systems that need some extra handling 38 * CPU idle callback function for systems that need some extra handling
39 * See .../arch/sparc/kernel/process.c 39 * See .../arch/sparc/kernel/process.c
40 */ 40 */
41void pmc_leon_idle_fixup(void) 41static void pmc_leon_idle_fixup(void)
42{ 42{
43 /* Prepare an address to a non-cachable region. APB is always 43 /* Prepare an address to a non-cachable region. APB is always
44 * none-cachable. One instruction is executed after the Sleep 44 * none-cachable. One instruction is executed after the Sleep
@@ -62,7 +62,7 @@ void pmc_leon_idle_fixup(void)
62 * CPU idle callback function 62 * CPU idle callback function
63 * See .../arch/sparc/kernel/process.c 63 * See .../arch/sparc/kernel/process.c
64 */ 64 */
65void pmc_leon_idle(void) 65static void pmc_leon_idle(void)
66{ 66{
67 /* Interrupts need to be enabled to not hang the CPU */ 67 /* Interrupts need to be enabled to not hang the CPU */
68 local_irq_enable(); 68 local_irq_enable();
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 6edf955f987c..018ef11f57df 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -130,7 +130,7 @@ void leon_configure_cache_smp(void)
130 local_ops->tlb_all(); 130 local_ops->tlb_all();
131} 131}
132 132
133void leon_smp_setbroadcast(unsigned int mask) 133static void leon_smp_setbroadcast(unsigned int mask)
134{ 134{
135 int broadcast = 135 int broadcast =
136 ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >> 136 ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >>
@@ -148,13 +148,6 @@ void leon_smp_setbroadcast(unsigned int mask)
148 LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask); 148 LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask);
149} 149}
150 150
151unsigned int leon_smp_getbroadcast(void)
152{
153 unsigned int mask;
154 mask = LEON_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpbroadcast));
155 return mask;
156}
157
158int leon_smp_nrcpus(void) 151int leon_smp_nrcpus(void)
159{ 152{
160 int nrcpu = 153 int nrcpu =
@@ -266,10 +259,6 @@ void __init leon_smp_done(void)
266 259
267} 260}
268 261
269void leon_irq_rotate(int cpu)
270{
271}
272
273struct leon_ipi_work { 262struct leon_ipi_work {
274 int single; 263 int single;
275 int msk; 264 int msk;
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 3241f56331c2..de0ee3971f00 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -5,8 +5,10 @@
5#include <linux/mod_devicetable.h> 5#include <linux/mod_devicetable.h>
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/irq.h> 7#include <linux/irq.h>
8#include <linux/of_device.h>
9#include <linux/of_platform.h> 8#include <linux/of_platform.h>
9#include <linux/of_address.h>
10#include <linux/of_device.h>
11#include <linux/of_irq.h>
10 12
11#include "of_device_common.h" 13#include "of_device_common.h"
12 14
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 857ad77df9c0..539babf00bb2 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -28,6 +28,7 @@
28#include <asm/apb.h> 28#include <asm/apb.h>
29 29
30#include "pci_impl.h" 30#include "pci_impl.h"
31#include "kernel.h"
31 32
32/* List of all PCI controllers found in the system. */ 33/* List of all PCI controllers found in the system. */
33struct pci_pbm_info *pci_pbm_root = NULL; 34struct pci_pbm_info *pci_pbm_root = NULL;
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 5f688531f48c..75803c780af3 100644
--- a/arch/sparc/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
@@ -48,8 +48,8 @@ struct sparc64_msiq_ops {
48 unsigned long devino); 48 unsigned long devino);
49}; 49};
50 50
51extern void sparc64_pbm_msi_init(struct pci_pbm_info *pbm, 51void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
52 const struct sparc64_msiq_ops *ops); 52 const struct sparc64_msiq_ops *ops);
53 53
54struct sparc64_msiq_cookie { 54struct sparc64_msiq_cookie {
55 struct pci_pbm_info *pbm; 55 struct pci_pbm_info *pbm;
@@ -158,23 +158,23 @@ extern struct pci_pbm_info *pci_pbm_root;
158extern int pci_num_pbms; 158extern int pci_num_pbms;
159 159
160/* PCI bus scanning and fixup support. */ 160/* PCI bus scanning and fixup support. */
161extern void pci_get_pbm_props(struct pci_pbm_info *pbm); 161void pci_get_pbm_props(struct pci_pbm_info *pbm);
162extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, 162struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
163 struct device *parent); 163 struct device *parent);
164extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm); 164void pci_determine_mem_io_space(struct pci_pbm_info *pbm);
165 165
166/* Error reporting support. */ 166/* Error reporting support. */
167extern void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *); 167void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *);
168extern void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *); 168void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *);
169extern void pci_scan_for_parity_error(struct pci_pbm_info *, struct pci_bus *); 169void pci_scan_for_parity_error(struct pci_pbm_info *, struct pci_bus *);
170 170
171/* Configuration space access. */ 171/* Configuration space access. */
172extern void pci_config_read8(u8 *addr, u8 *ret); 172void pci_config_read8(u8 *addr, u8 *ret);
173extern void pci_config_read16(u16 *addr, u16 *ret); 173void pci_config_read16(u16 *addr, u16 *ret);
174extern void pci_config_read32(u32 *addr, u32 *ret); 174void pci_config_read32(u32 *addr, u32 *ret);
175extern void pci_config_write8(u8 *addr, u8 val); 175void pci_config_write8(u8 *addr, u8 val);
176extern void pci_config_write16(u16 *addr, u16 val); 176void pci_config_write16(u16 *addr, u16 val);
177extern void pci_config_write32(u32 *addr, u32 val); 177void pci_config_write32(u32 *addr, u32 val);
178 178
179extern struct pci_ops sun4u_pci_ops; 179extern struct pci_ops sun4u_pci_ops;
180extern struct pci_ops sun4v_pci_ops; 180extern struct pci_ops sun4v_pci_ops;
diff --git a/arch/sparc/kernel/pci_sun4v.h b/arch/sparc/kernel/pci_sun4v.h
index 8e9fc3a5b4f5..5642212390b2 100644
--- a/arch/sparc/kernel/pci_sun4v.h
+++ b/arch/sparc/kernel/pci_sun4v.h
@@ -6,87 +6,87 @@
6#ifndef _PCI_SUN4V_H 6#ifndef _PCI_SUN4V_H
7#define _PCI_SUN4V_H 7#define _PCI_SUN4V_H
8 8
9extern long pci_sun4v_iommu_map(unsigned long devhandle, 9long pci_sun4v_iommu_map(unsigned long devhandle,
10 unsigned long tsbid, 10 unsigned long tsbid,
11 unsigned long num_ttes, 11 unsigned long num_ttes,
12 unsigned long io_attributes, 12 unsigned long io_attributes,
13 unsigned long io_page_list_pa); 13 unsigned long io_page_list_pa);
14extern unsigned long pci_sun4v_iommu_demap(unsigned long devhandle, 14unsigned long pci_sun4v_iommu_demap(unsigned long devhandle,
15 unsigned long tsbid, 15 unsigned long tsbid,
16 unsigned long num_ttes); 16 unsigned long num_ttes);
17extern unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle, 17unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle,
18 unsigned long tsbid, 18 unsigned long tsbid,
19 unsigned long *io_attributes, 19 unsigned long *io_attributes,
20 unsigned long *real_address); 20 unsigned long *real_address);
21extern unsigned long pci_sun4v_config_get(unsigned long devhandle, 21unsigned long pci_sun4v_config_get(unsigned long devhandle,
22 unsigned long pci_device, 22 unsigned long pci_device,
23 unsigned long config_offset, 23 unsigned long config_offset,
24 unsigned long size); 24 unsigned long size);
25extern int pci_sun4v_config_put(unsigned long devhandle, 25int pci_sun4v_config_put(unsigned long devhandle,
26 unsigned long pci_device, 26 unsigned long pci_device,
27 unsigned long config_offset, 27 unsigned long config_offset,
28 unsigned long size, 28 unsigned long size,
29 unsigned long data); 29 unsigned long data);
30 30
31extern unsigned long pci_sun4v_msiq_conf(unsigned long devhandle, 31unsigned long pci_sun4v_msiq_conf(unsigned long devhandle,
32 unsigned long msiqid, 32 unsigned long msiqid,
33 unsigned long msiq_paddr, 33 unsigned long msiq_paddr,
34 unsigned long num_entries); 34 unsigned long num_entries);
35extern unsigned long pci_sun4v_msiq_info(unsigned long devhandle, 35unsigned long pci_sun4v_msiq_info(unsigned long devhandle,
36 unsigned long msiqid, 36 unsigned long msiqid,
37 unsigned long *msiq_paddr, 37 unsigned long *msiq_paddr,
38 unsigned long *num_entries); 38 unsigned long *num_entries);
39extern unsigned long pci_sun4v_msiq_getvalid(unsigned long devhandle, 39unsigned long pci_sun4v_msiq_getvalid(unsigned long devhandle,
40 unsigned long msiqid, 40 unsigned long msiqid,
41 unsigned long *valid); 41 unsigned long *valid);
42extern unsigned long pci_sun4v_msiq_setvalid(unsigned long devhandle, 42unsigned long pci_sun4v_msiq_setvalid(unsigned long devhandle,
43 unsigned long msiqid, 43 unsigned long msiqid,
44 unsigned long valid); 44 unsigned long valid);
45extern unsigned long pci_sun4v_msiq_getstate(unsigned long devhandle, 45unsigned long pci_sun4v_msiq_getstate(unsigned long devhandle,
46 unsigned long msiqid, 46 unsigned long msiqid,
47 unsigned long *state); 47 unsigned long *state);
48extern unsigned long pci_sun4v_msiq_setstate(unsigned long devhandle, 48unsigned long pci_sun4v_msiq_setstate(unsigned long devhandle,
49 unsigned long msiqid, 49 unsigned long msiqid,
50 unsigned long state); 50 unsigned long state);
51extern unsigned long pci_sun4v_msiq_gethead(unsigned long devhandle, 51unsigned long pci_sun4v_msiq_gethead(unsigned long devhandle,
52 unsigned long msiqid, 52 unsigned long msiqid,
53 unsigned long *head); 53 unsigned long *head);
54extern unsigned long pci_sun4v_msiq_sethead(unsigned long devhandle, 54unsigned long pci_sun4v_msiq_sethead(unsigned long devhandle,
55 unsigned long msiqid, 55 unsigned long msiqid,
56 unsigned long head); 56 unsigned long head);
57extern unsigned long pci_sun4v_msiq_gettail(unsigned long devhandle, 57unsigned long pci_sun4v_msiq_gettail(unsigned long devhandle,
58 unsigned long msiqid, 58 unsigned long msiqid,
59 unsigned long *head); 59 unsigned long *head);
60extern unsigned long pci_sun4v_msi_getvalid(unsigned long devhandle, 60unsigned long pci_sun4v_msi_getvalid(unsigned long devhandle,
61 unsigned long msinum, 61 unsigned long msinum,
62 unsigned long *valid); 62 unsigned long *valid);
63extern unsigned long pci_sun4v_msi_setvalid(unsigned long devhandle, 63unsigned long pci_sun4v_msi_setvalid(unsigned long devhandle,
64 unsigned long msinum, 64 unsigned long msinum,
65 unsigned long valid); 65 unsigned long valid);
66extern unsigned long pci_sun4v_msi_getmsiq(unsigned long devhandle, 66unsigned long pci_sun4v_msi_getmsiq(unsigned long devhandle,
67 unsigned long msinum, 67 unsigned long msinum,
68 unsigned long *msiq); 68 unsigned long *msiq);
69extern unsigned long pci_sun4v_msi_setmsiq(unsigned long devhandle, 69unsigned long pci_sun4v_msi_setmsiq(unsigned long devhandle,
70 unsigned long msinum, 70 unsigned long msinum,
71 unsigned long msiq, 71 unsigned long msiq,
72 unsigned long msitype); 72 unsigned long msitype);
73extern unsigned long pci_sun4v_msi_getstate(unsigned long devhandle, 73unsigned long pci_sun4v_msi_getstate(unsigned long devhandle,
74 unsigned long msinum, 74 unsigned long msinum,
75 unsigned long *state); 75 unsigned long *state);
76extern unsigned long pci_sun4v_msi_setstate(unsigned long devhandle, 76unsigned long pci_sun4v_msi_setstate(unsigned long devhandle,
77 unsigned long msinum, 77 unsigned long msinum,
78 unsigned long state); 78 unsigned long state);
79extern unsigned long pci_sun4v_msg_getmsiq(unsigned long devhandle, 79unsigned long pci_sun4v_msg_getmsiq(unsigned long devhandle,
80 unsigned long msinum, 80 unsigned long msinum,
81 unsigned long *msiq); 81 unsigned long *msiq);
82extern unsigned long pci_sun4v_msg_setmsiq(unsigned long devhandle, 82unsigned long pci_sun4v_msg_setmsiq(unsigned long devhandle,
83 unsigned long msinum, 83 unsigned long msinum,
84 unsigned long msiq); 84 unsigned long msiq);
85extern unsigned long pci_sun4v_msg_getvalid(unsigned long devhandle, 85unsigned long pci_sun4v_msg_getvalid(unsigned long devhandle,
86 unsigned long msinum, 86 unsigned long msinum,
87 unsigned long *valid); 87 unsigned long *valid);
88extern unsigned long pci_sun4v_msg_setvalid(unsigned long devhandle, 88unsigned long pci_sun4v_msg_setvalid(unsigned long devhandle,
89 unsigned long msinum, 89 unsigned long msinum,
90 unsigned long valid); 90 unsigned long valid);
91 91
92#endif /* !(_PCI_SUN4V_H) */ 92#endif /* !(_PCI_SUN4V_H) */
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 09f4fdd8d808..6cc78c213c01 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -36,6 +36,7 @@
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/irq_regs.h> 37#include <asm/irq_regs.h>
38 38
39#include "kernel.h"
39#include "irq.h" 40#include "irq.h"
40 41
41/* 42/*
@@ -162,8 +163,8 @@ static int pcic0_up;
162static struct linux_pcic pcic0; 163static struct linux_pcic pcic0;
163 164
164void __iomem *pcic_regs; 165void __iomem *pcic_regs;
165volatile int pcic_speculative; 166static volatile int pcic_speculative;
166volatile int pcic_trapped; 167static volatile int pcic_trapped;
167 168
168/* forward */ 169/* forward */
169unsigned int pcic_build_device_irq(struct platform_device *op, 170unsigned int pcic_build_device_irq(struct platform_device *op,
@@ -329,7 +330,7 @@ int __init pcic_probe(void)
329 330
330 pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr"; 331 pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr";
331 if ((pcic->pcic_config_space_addr = 332 if ((pcic->pcic_config_space_addr =
332 ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == 0) { 333 ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == NULL) {
333 prom_printf("PCIC: Error, cannot map " 334 prom_printf("PCIC: Error, cannot map "
334 "PCI Configuration Space Address.\n"); 335 "PCI Configuration Space Address.\n");
335 prom_halt(); 336 prom_halt();
@@ -341,7 +342,7 @@ int __init pcic_probe(void)
341 */ 342 */
342 pcic->pcic_res_cfg_data.name = "pcic_cfg_data"; 343 pcic->pcic_res_cfg_data.name = "pcic_cfg_data";
343 if ((pcic->pcic_config_space_data = 344 if ((pcic->pcic_config_space_data =
344 ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == 0) { 345 ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == NULL) {
345 prom_printf("PCIC: Error, cannot map " 346 prom_printf("PCIC: Error, cannot map "
346 "PCI Configuration Space Data.\n"); 347 "PCI Configuration Space Data.\n");
347 prom_halt(); 348 prom_halt();
@@ -353,7 +354,6 @@ int __init pcic_probe(void)
353 strcpy(pbm->prom_name, namebuf); 354 strcpy(pbm->prom_name, namebuf);
354 355
355 { 356 {
356 extern volatile int t_nmi[4];
357 extern int pcic_nmi_trap_patch[4]; 357 extern int pcic_nmi_trap_patch[4];
358 358
359 t_nmi[0] = pcic_nmi_trap_patch[0]; 359 t_nmi[0] = pcic_nmi_trap_patch[0];
@@ -536,7 +536,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
536 prom_getstring(node, "name", namebuf, sizeof(namebuf)); 536 prom_getstring(node, "name", namebuf, sizeof(namebuf));
537 } 537 }
538 538
539 if ((p = pcic->pcic_imap) == 0) { 539 if ((p = pcic->pcic_imap) == NULL) {
540 dev->irq = 0; 540 dev->irq = 0;
541 return; 541 return;
542 } 542 }
@@ -670,30 +670,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
670 } 670 }
671} 671}
672 672
673/*
674 * pcic_pin_to_irq() is exported to bus probing code
675 */
676unsigned int
677pcic_pin_to_irq(unsigned int pin, const char *name)
678{
679 struct linux_pcic *pcic = &pcic0;
680 unsigned int irq;
681 unsigned int ivec;
682
683 if (pin < 4) {
684 ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_LO);
685 irq = ivec >> (pin << 2) & 0xF;
686 } else if (pin < 8) {
687 ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_HI);
688 irq = ivec >> ((pin-4) << 2) & 0xF;
689 } else { /* Corrupted map */
690 printk("PCIC: BAD PIN %d FOR %s\n", pin, name);
691 for (;;) {} /* XXX Cannot panic properly in case of PROLL */
692 }
693/* P3 */ /* printk("PCIC: dev %s pin %d ivec 0x%x irq %x\n", name, pin, ivec, irq); */
694 return irq;
695}
696
697/* Makes compiler happy */ 673/* Makes compiler happy */
698static volatile int pcic_timer_dummy; 674static volatile int pcic_timer_dummy;
699 675
@@ -783,7 +759,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask)
783void pcic_nmi(unsigned int pend, struct pt_regs *regs) 759void pcic_nmi(unsigned int pend, struct pt_regs *regs)
784{ 760{
785 761
786 pend = flip_dword(pend); 762 pend = swab32(pend);
787 763
788 if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) { 764 if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) {
789 /* 765 /*
@@ -875,82 +851,4 @@ void __init sun4m_pci_init_IRQ(void)
875 sparc_config.load_profile_irq = pcic_load_profile_irq; 851 sparc_config.load_profile_irq = pcic_load_profile_irq;
876} 852}
877 853
878/*
879 * This probably belongs here rather than ioport.c because
880 * we do not want this crud linked into SBus kernels.
881 * Also, think for a moment about likes of floppy.c that
882 * include architecture specific parts. They may want to redefine ins/outs.
883 *
884 * We do not use horrible macros here because we want to
885 * advance pointer by sizeof(size).
886 */
887void outsb(unsigned long addr, const void *src, unsigned long count)
888{
889 while (count) {
890 count -= 1;
891 outb(*(const char *)src, addr);
892 src += 1;
893 /* addr += 1; */
894 }
895}
896EXPORT_SYMBOL(outsb);
897
898void outsw(unsigned long addr, const void *src, unsigned long count)
899{
900 while (count) {
901 count -= 2;
902 outw(*(const short *)src, addr);
903 src += 2;
904 /* addr += 2; */
905 }
906}
907EXPORT_SYMBOL(outsw);
908
909void outsl(unsigned long addr, const void *src, unsigned long count)
910{
911 while (count) {
912 count -= 4;
913 outl(*(const long *)src, addr);
914 src += 4;
915 /* addr += 4; */
916 }
917}
918EXPORT_SYMBOL(outsl);
919
920void insb(unsigned long addr, void *dst, unsigned long count)
921{
922 while (count) {
923 count -= 1;
924 *(unsigned char *)dst = inb(addr);
925 dst += 1;
926 /* addr += 1; */
927 }
928}
929EXPORT_SYMBOL(insb);
930
931void insw(unsigned long addr, void *dst, unsigned long count)
932{
933 while (count) {
934 count -= 2;
935 *(unsigned short *)dst = inw(addr);
936 dst += 2;
937 /* addr += 2; */
938 }
939}
940EXPORT_SYMBOL(insw);
941
942void insl(unsigned long addr, void *dst, unsigned long count)
943{
944 while (count) {
945 count -= 4;
946 /*
947 * XXX I am sure we are in for an unaligned trap here.
948 */
949 *(unsigned long *)dst = inl(addr);
950 dst += 4;
951 /* addr += 4; */
952 }
953}
954EXPORT_SYMBOL(insl);
955
956subsys_initcall(pcic_init); 854subsys_initcall(pcic_init);
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index b5c38faa4ead..8efd33753ad3 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -110,7 +110,7 @@ struct cpu_hw_events {
110 110
111 unsigned int group_flag; 111 unsigned int group_flag;
112}; 112};
113DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; 113static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, };
114 114
115/* An event map describes the characteristics of a performance 115/* An event map describes the characteristics of a performance
116 * counter event. In particular it gives the encoding as well as 116 * counter event. In particular it gives the encoding as well as
@@ -1153,7 +1153,7 @@ static void perf_stop_nmi_watchdog(void *unused)
1153 cpuc->pcr[i] = pcr_ops->read_pcr(i); 1153 cpuc->pcr[i] = pcr_ops->read_pcr(i);
1154} 1154}
1155 1155
1156void perf_event_grab_pmc(void) 1156static void perf_event_grab_pmc(void)
1157{ 1157{
1158 if (atomic_inc_not_zero(&active_events)) 1158 if (atomic_inc_not_zero(&active_events))
1159 return; 1159 return;
@@ -1169,7 +1169,7 @@ void perf_event_grab_pmc(void)
1169 mutex_unlock(&pmc_grab_mutex); 1169 mutex_unlock(&pmc_grab_mutex);
1170} 1170}
1171 1171
1172void perf_event_release_pmc(void) 1172static void perf_event_release_pmc(void)
1173{ 1173{
1174 if (atomic_dec_and_mutex_lock(&active_events, &pmc_grab_mutex)) { 1174 if (atomic_dec_and_mutex_lock(&active_events, &pmc_grab_mutex)) {
1175 if (atomic_read(&nmi_active) == 0) 1175 if (atomic_read(&nmi_active) == 0)
@@ -1669,7 +1669,7 @@ static bool __init supported_pmu(void)
1669 return false; 1669 return false;
1670} 1670}
1671 1671
1672int __init init_hw_perf_events(void) 1672static int __init init_hw_perf_events(void)
1673{ 1673{
1674 pr_info("Performance events: "); 1674 pr_info("Performance events: ");
1675 1675
@@ -1742,10 +1742,11 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
1742 1742
1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS; 1743 ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
1744 do { 1744 do {
1745 struct sparc_stackf *usf, sf; 1745 struct sparc_stackf __user *usf;
1746 struct sparc_stackf sf;
1746 unsigned long pc; 1747 unsigned long pc;
1747 1748
1748 usf = (struct sparc_stackf *) ufp; 1749 usf = (struct sparc_stackf __user *)ufp;
1749 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1750 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1750 break; 1751 break;
1751 1752
@@ -1765,17 +1766,19 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1765 unsigned long pc; 1766 unsigned long pc;
1766 1767
1767 if (thread32_stack_is_64bit(ufp)) { 1768 if (thread32_stack_is_64bit(ufp)) {
1768 struct sparc_stackf *usf, sf; 1769 struct sparc_stackf __user *usf;
1770 struct sparc_stackf sf;
1769 1771
1770 ufp += STACK_BIAS; 1772 ufp += STACK_BIAS;
1771 usf = (struct sparc_stackf *) ufp; 1773 usf = (struct sparc_stackf __user *)ufp;
1772 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1774 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1773 break; 1775 break;
1774 pc = sf.callers_pc & 0xffffffff; 1776 pc = sf.callers_pc & 0xffffffff;
1775 ufp = ((unsigned long) sf.fp) & 0xffffffff; 1777 ufp = ((unsigned long) sf.fp) & 0xffffffff;
1776 } else { 1778 } else {
1777 struct sparc_stackf32 *usf, sf; 1779 struct sparc_stackf32 __user *usf;
1778 usf = (struct sparc_stackf32 *) ufp; 1780 struct sparc_stackf32 sf;
1781 usf = (struct sparc_stackf32 __user *)ufp;
1779 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf))) 1782 if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1780 break; 1783 break;
1781 pc = sf.callers_pc; 1784 pc = sf.callers_pc;
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 510baec1b69b..50e7b626afe8 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -10,6 +10,7 @@
10 10
11#include <stdarg.h> 11#include <stdarg.h>
12 12
13#include <linux/elfcore.h>
13#include <linux/errno.h> 14#include <linux/errno.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
@@ -23,6 +24,7 @@
23#include <linux/delay.h> 24#include <linux/delay.h>
24#include <linux/pm.h> 25#include <linux/pm.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/cpu.h>
26 28
27#include <asm/auxio.h> 29#include <asm/auxio.h>
28#include <asm/oplib.h> 30#include <asm/oplib.h>
@@ -38,6 +40,8 @@
38#include <asm/unistd.h> 40#include <asm/unistd.h>
39#include <asm/setup.h> 41#include <asm/setup.h>
40 42
43#include "kernel.h"
44
41/* 45/*
42 * Power management idle function 46 * Power management idle function
43 * Set in pm platform drivers (apc.c and pmc.c) 47 * Set in pm platform drivers (apc.c and pmc.c)
@@ -102,8 +106,12 @@ void machine_restart(char * cmd)
102void machine_power_off(void) 106void machine_power_off(void)
103{ 107{
104 if (auxio_power_register && 108 if (auxio_power_register &&
105 (strcmp(of_console_device->type, "serial") || scons_pwroff)) 109 (strcmp(of_console_device->type, "serial") || scons_pwroff)) {
106 *auxio_power_register |= AUXIO_POWER_OFF; 110 u8 power_register = sbus_readb(auxio_power_register);
111 power_register |= AUXIO_POWER_OFF;
112 sbus_writeb(power_register, auxio_power_register);
113 }
114
107 machine_halt(); 115 machine_halt();
108} 116}
109 117
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index d7b4967f8fa6..027e09986194 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -88,7 +88,7 @@ void arch_cpu_idle(void)
88} 88}
89 89
90#ifdef CONFIG_HOTPLUG_CPU 90#ifdef CONFIG_HOTPLUG_CPU
91void arch_cpu_idle_dead() 91void arch_cpu_idle_dead(void)
92{ 92{
93 sched_preempt_enable_no_resched(); 93 sched_preempt_enable_no_resched();
94 cpu_play_dead(); 94 cpu_play_dead();
@@ -239,7 +239,7 @@ static void __global_reg_poll(struct global_reg_snapshot *gp)
239 } 239 }
240} 240}
241 241
242void arch_trigger_all_cpu_backtrace(void) 242void arch_trigger_all_cpu_backtrace(bool include_self)
243{ 243{
244 struct thread_info *tp = current_thread_info(); 244 struct thread_info *tp = current_thread_info();
245 struct pt_regs *regs = get_irq_regs(); 245 struct pt_regs *regs = get_irq_regs();
@@ -251,16 +251,22 @@ void arch_trigger_all_cpu_backtrace(void)
251 251
252 spin_lock_irqsave(&global_cpu_snapshot_lock, flags); 252 spin_lock_irqsave(&global_cpu_snapshot_lock, flags);
253 253
254 memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));
255
256 this_cpu = raw_smp_processor_id(); 254 this_cpu = raw_smp_processor_id();
257 255
258 __global_reg_self(tp, regs, this_cpu); 256 memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot));
257
258 if (include_self)
259 __global_reg_self(tp, regs, this_cpu);
259 260
260 smp_fetch_global_regs(); 261 smp_fetch_global_regs();
261 262
262 for_each_online_cpu(cpu) { 263 for_each_online_cpu(cpu) {
263 struct global_reg_snapshot *gp = &global_cpu_snapshot[cpu].reg; 264 struct global_reg_snapshot *gp;
265
266 if (!include_self && cpu == this_cpu)
267 continue;
268
269 gp = &global_cpu_snapshot[cpu].reg;
264 270
265 __global_reg_poll(gp); 271 __global_reg_poll(gp);
266 272
@@ -292,7 +298,7 @@ void arch_trigger_all_cpu_backtrace(void)
292 298
293static void sysrq_handle_globreg(int key) 299static void sysrq_handle_globreg(int key)
294{ 300{
295 arch_trigger_all_cpu_backtrace(); 301 arch_trigger_all_cpu_backtrace(true);
296} 302}
297 303
298static struct sysrq_key_op sparc_globalreg_op = { 304static struct sysrq_key_op sparc_globalreg_op = {
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index cf5fe1c0b024..890281b12b28 100644
--- a/arch/sparc/kernel/prom.h
+++ b/arch/sparc/kernel/prom.h
@@ -4,7 +4,7 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <asm/prom.h> 5#include <asm/prom.h>
6 6
7extern void of_console_init(void); 7void of_console_init(void);
8 8
9extern unsigned int prom_early_allocated; 9extern unsigned int prom_early_allocated;
10 10
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index 9a690d39c01b..20cc5d80a471 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -15,11 +15,12 @@
15 * 2 of the License, or (at your option) any later version. 15 * 2 of the License, or (at your option) any later version.
16 */ 16 */
17 17
18#include <linux/memblock.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/types.h>
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/types.h>
22#include <linux/cpu.h>
21#include <linux/mm.h> 23#include <linux/mm.h>
22#include <linux/memblock.h>
23#include <linux/of.h> 24#include <linux/of.h>
24 25
25#include <asm/prom.h> 26#include <asm/prom.h>
diff --git a/arch/sparc/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h
index 590b4ed8ab5e..05a6e30a928e 100644
--- a/arch/sparc/kernel/psycho_common.h
+++ b/arch/sparc/kernel/psycho_common.h
@@ -30,19 +30,19 @@ enum psycho_error_type {
30 UE_ERR, CE_ERR, PCI_ERR 30 UE_ERR, CE_ERR, PCI_ERR
31}; 31};
32 32
33extern void psycho_check_iommu_error(struct pci_pbm_info *pbm, 33void psycho_check_iommu_error(struct pci_pbm_info *pbm,
34 unsigned long afsr, 34 unsigned long afsr,
35 unsigned long afar, 35 unsigned long afar,
36 enum psycho_error_type type); 36 enum psycho_error_type type);
37 37
38extern irqreturn_t psycho_pcierr_intr(int irq, void *dev_id); 38irqreturn_t psycho_pcierr_intr(int irq, void *dev_id);
39 39
40extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize, 40int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
41 u32 dvma_offset, u32 dma_mask, 41 u32 dvma_offset, u32 dma_mask,
42 unsigned long write_complete_offset); 42 unsigned long write_complete_offset);
43 43
44extern void psycho_pbm_init_common(struct pci_pbm_info *pbm, 44void psycho_pbm_init_common(struct pci_pbm_info *pbm,
45 struct platform_device *op, 45 struct platform_device *op,
46 const char *chip_name, int chip_type); 46 const char *chip_name, int chip_type);
47 47
48#endif /* _PSYCHO_COMMON_H */ 48#endif /* _PSYCHO_COMMON_H */
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
index 896ba7c5cd8e..a331fdc11a2c 100644
--- a/arch/sparc/kernel/ptrace_32.c
+++ b/arch/sparc/kernel/ptrace_32.c
@@ -26,6 +26,8 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
28 28
29#include "kernel.h"
30
29/* #define ALLOW_INIT_TRACING */ 31/* #define ALLOW_INIT_TRACING */
30 32
31/* 33/*
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index 1434526970a6..baef495c06bd 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -267,7 +267,7 @@ static __init void leon_patch(void)
267} 267}
268 268
269struct tt_entry *sparc_ttable; 269struct tt_entry *sparc_ttable;
270struct pt_regs fake_swapper_regs; 270static struct pt_regs fake_swapper_regs;
271 271
272/* Called from head_32.S - before we have setup anything 272/* Called from head_32.S - before we have setup anything
273 * in the kernel. Be very careful with what you do here. 273 * in the kernel. Be very careful with what you do here.
@@ -365,7 +365,7 @@ void __init setup_arch(char **cmdline_p)
365 365
366 prom_setsync(prom_sync_me); 366 prom_setsync(prom_sync_me);
367 367
368 if((boot_flags&BOOTME_DEBUG) && (linux_dbvec!=0) && 368 if((boot_flags & BOOTME_DEBUG) && (linux_dbvec != NULL) &&
369 ((*(short *)linux_dbvec) != -1)) { 369 ((*(short *)linux_dbvec) != -1)) {
370 printk("Booted under KADB. Syncing trap table.\n"); 370 printk("Booted under KADB. Syncing trap table.\n");
371 (*(linux_dbvec->teach_debugger))(); 371 (*(linux_dbvec->teach_debugger))();
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index ee789d2ef05d..62deba7be1a9 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -31,6 +31,7 @@
31#include <asm/switch_to.h> 31#include <asm/switch_to.h>
32 32
33#include "sigutil.h" 33#include "sigutil.h"
34#include "kernel.h"
34 35
35/* This magic should be in g_upper[0] for all upper parts 36/* This magic should be in g_upper[0] for all upper parts
36 * to be valid. 37 * to be valid.
@@ -145,7 +146,7 @@ void do_sigreturn32(struct pt_regs *regs)
145 unsigned int psr; 146 unsigned int psr;
146 unsigned pc, npc; 147 unsigned pc, npc;
147 sigset_t set; 148 sigset_t set;
148 unsigned seta[_COMPAT_NSIG_WORDS]; 149 compat_sigset_t seta;
149 int err, i; 150 int err, i;
150 151
151 /* Always make any pending restarted system calls return -EINTR */ 152 /* Always make any pending restarted system calls return -EINTR */
@@ -209,17 +210,13 @@ void do_sigreturn32(struct pt_regs *regs)
209 if (restore_rwin_state(compat_ptr(rwin_save))) 210 if (restore_rwin_state(compat_ptr(rwin_save)))
210 goto segv; 211 goto segv;
211 } 212 }
212 err |= __get_user(seta[0], &sf->info.si_mask); 213 err |= __get_user(seta.sig[0], &sf->info.si_mask);
213 err |= copy_from_user(seta+1, &sf->extramask, 214 err |= copy_from_user(&seta.sig[1], &sf->extramask,
214 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 215 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
215 if (err) 216 if (err)
216 goto segv; 217 goto segv;
217 switch (_NSIG_WORDS) { 218
218 case 4: set.sig[3] = seta[6] + (((long)seta[7]) << 32); 219 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
219 case 3: set.sig[2] = seta[4] + (((long)seta[5]) << 32);
220 case 2: set.sig[1] = seta[2] + (((long)seta[3]) << 32);
221 case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32);
222 }
223 set_current_blocked(&set); 220 set_current_blocked(&set);
224 return; 221 return;
225 222
@@ -303,12 +300,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
303 goto segv; 300 goto segv;
304 } 301 }
305 302
306 switch (_NSIG_WORDS) { 303 set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
307 case 4: set.sig[3] = seta.sig[6] + (((long)seta.sig[7]) << 32);
308 case 3: set.sig[2] = seta.sig[4] + (((long)seta.sig[5]) << 32);
309 case 2: set.sig[1] = seta.sig[2] + (((long)seta.sig[3]) << 32);
310 case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
311 }
312 set_current_blocked(&set); 304 set_current_blocked(&set);
313 return; 305 return;
314segv: 306segv:
@@ -417,7 +409,7 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
417 void __user *tail; 409 void __user *tail;
418 int sigframe_size; 410 int sigframe_size;
419 u32 psr; 411 u32 psr;
420 unsigned int seta[_COMPAT_NSIG_WORDS]; 412 compat_sigset_t seta;
421 413
422 /* 1. Make sure everything is clean */ 414 /* 1. Make sure everything is clean */
423 synchronize_user_stack(); 415 synchronize_user_stack();
@@ -481,18 +473,14 @@ static int setup_frame32(struct ksignal *ksig, struct pt_regs *regs,
481 err |= __put_user(0, &sf->rwin_save); 473 err |= __put_user(0, &sf->rwin_save);
482 } 474 }
483 475
484 switch (_NSIG_WORDS) { 476 /* If these change we need to know - assignments to seta relies on these sizes */
485 case 4: seta[7] = (oldset->sig[3] >> 32); 477 BUILD_BUG_ON(_NSIG_WORDS != 1);
486 seta[6] = oldset->sig[3]; 478 BUILD_BUG_ON(_COMPAT_NSIG_WORDS != 2);
487 case 3: seta[5] = (oldset->sig[2] >> 32); 479 seta.sig[1] = (oldset->sig[0] >> 32);
488 seta[4] = oldset->sig[2]; 480 seta.sig[0] = oldset->sig[0];
489 case 2: seta[3] = (oldset->sig[1] >> 32); 481
490 seta[2] = oldset->sig[1]; 482 err |= __put_user(seta.sig[0], &sf->info.si_mask);
491 case 1: seta[1] = (oldset->sig[0] >> 32); 483 err |= __copy_to_user(sf->extramask, &seta.sig[1],
492 seta[0] = oldset->sig[0];
493 }
494 err |= __put_user(seta[0], &sf->info.si_mask);
495 err |= __copy_to_user(sf->extramask, seta + 1,
496 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 484 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
497 485
498 if (!wsaved) { 486 if (!wsaved) {
@@ -622,16 +610,8 @@ static int setup_rt_frame32(struct ksignal *ksig, struct pt_regs *regs,
622 /* Setup sigaltstack */ 610 /* Setup sigaltstack */
623 err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]); 611 err |= __compat_save_altstack(&sf->stack, regs->u_regs[UREG_FP]);
624 612
625 switch (_NSIG_WORDS) { 613 seta.sig[1] = (oldset->sig[0] >> 32);
626 case 4: seta.sig[7] = (oldset->sig[3] >> 32); 614 seta.sig[0] = oldset->sig[0];
627 seta.sig[6] = oldset->sig[3];
628 case 3: seta.sig[5] = (oldset->sig[2] >> 32);
629 seta.sig[4] = oldset->sig[2];
630 case 2: seta.sig[3] = (oldset->sig[1] >> 32);
631 seta.sig[2] = oldset->sig[1];
632 case 1: seta.sig[1] = (oldset->sig[0] >> 32);
633 seta.sig[0] = oldset->sig[0];
634 }
635 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t)); 615 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t));
636 616
637 if (!wsaved) { 617 if (!wsaved) {
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 7d5d8e1f8415..9ee72fc8e0e4 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -28,6 +28,7 @@
28#include <asm/switch_to.h> 28#include <asm/switch_to.h>
29 29
30#include "sigutil.h" 30#include "sigutil.h"
31#include "kernel.h"
31 32
32extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 33extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
33 void *fpqueue, unsigned long *fpqdepth); 34 void *fpqueue, unsigned long *fpqdepth);
@@ -341,7 +342,7 @@ static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
341 err |= __put_user(0, &sf->extra_size); 342 err |= __put_user(0, &sf->extra_size);
342 343
343 if (psr & PSR_EF) { 344 if (psr & PSR_EF) {
344 __siginfo_fpu_t *fp = tail; 345 __siginfo_fpu_t __user *fp = tail;
345 tail += sizeof(*fp); 346 tail += sizeof(*fp);
346 err |= save_fpu_state(regs, fp); 347 err |= save_fpu_state(regs, fp);
347 err |= __put_user(fp, &sf->fpu_save); 348 err |= __put_user(fp, &sf->fpu_save);
@@ -349,7 +350,7 @@ static int setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs,
349 err |= __put_user(0, &sf->fpu_save); 350 err |= __put_user(0, &sf->fpu_save);
350 } 351 }
351 if (wsaved) { 352 if (wsaved) {
352 __siginfo_rwin_t *rwp = tail; 353 __siginfo_rwin_t __user *rwp = tail;
353 tail += sizeof(*rwp); 354 tail += sizeof(*rwp);
354 err |= save_rwin_state(wsaved, rwp); 355 err |= save_rwin_state(wsaved, rwp);
355 err |= __put_user(rwp, &sf->rwin_save); 356 err |= __put_user(rwp, &sf->rwin_save);
@@ -517,9 +518,9 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
517 } 518 }
518} 519}
519 520
520asmlinkage int 521asmlinkage int do_sys_sigstack(struct sigstack __user *ssptr,
521do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr, 522 struct sigstack __user *ossptr,
522 unsigned long sp) 523 unsigned long sp)
523{ 524{
524 int ret = -EFAULT; 525 int ret = -EFAULT;
525 526
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index cd91d010e6d3..1a6999868031 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -35,9 +35,10 @@
35#include <asm/switch_to.h> 35#include <asm/switch_to.h>
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37 37
38#include "entry.h"
39#include "systbls.h"
40#include "sigutil.h" 38#include "sigutil.h"
39#include "systbls.h"
40#include "kernel.h"
41#include "entry.h"
41 42
42/* {set, get}context() needed for 64-bit SparcLinux userland. */ 43/* {set, get}context() needed for 64-bit SparcLinux userland. */
43asmlinkage void sparc64_set_context(struct pt_regs *regs) 44asmlinkage void sparc64_set_context(struct pt_regs *regs)
@@ -492,7 +493,6 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
492 493
493#ifdef CONFIG_COMPAT 494#ifdef CONFIG_COMPAT
494 if (test_thread_flag(TIF_32BIT)) { 495 if (test_thread_flag(TIF_32BIT)) {
495 extern void do_signal32(struct pt_regs *);
496 do_signal32(regs); 496 do_signal32(regs);
497 return; 497 return;
498 } 498 }
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index a102bfba6ea8..7958242d63c5 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -20,6 +20,7 @@
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/cache.h> 21#include <linux/cache.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/profile.h>
23#include <linux/cpu.h> 24#include <linux/cpu.h>
24 25
25#include <asm/ptrace.h> 26#include <asm/ptrace.h>
@@ -75,8 +76,6 @@ void smp_store_cpu_info(int id)
75 76
76void __init smp_cpus_done(unsigned int max_cpus) 77void __init smp_cpus_done(unsigned int max_cpus)
77{ 78{
78 extern void smp4m_smp_done(void);
79 extern void smp4d_smp_done(void);
80 unsigned long bogosum = 0; 79 unsigned long bogosum = 0;
81 int cpu, num = 0; 80 int cpu, num = 0;
82 81
@@ -183,8 +182,6 @@ int setup_profiling_timer(unsigned int multiplier)
183 182
184void __init smp_prepare_cpus(unsigned int max_cpus) 183void __init smp_prepare_cpus(unsigned int max_cpus)
185{ 184{
186 extern void __init smp4m_boot_cpus(void);
187 extern void __init smp4d_boot_cpus(void);
188 int i, cpuid, extra; 185 int i, cpuid, extra;
189 186
190 printk("Entering SMP Mode...\n"); 187 printk("Entering SMP Mode...\n");
@@ -261,8 +258,6 @@ void __init smp_prepare_boot_cpu(void)
261 258
262int __cpu_up(unsigned int cpu, struct task_struct *tidle) 259int __cpu_up(unsigned int cpu, struct task_struct *tidle)
263{ 260{
264 extern int smp4m_boot_one_cpu(int, struct task_struct *);
265 extern int smp4d_boot_one_cpu(int, struct task_struct *);
266 int ret=0; 261 int ret=0;
267 262
268 switch(sparc_cpu_model) { 263 switch(sparc_cpu_model) {
@@ -297,7 +292,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
297 return ret; 292 return ret;
298} 293}
299 294
300void arch_cpu_pre_starting(void *arg) 295static void arch_cpu_pre_starting(void *arg)
301{ 296{
302 local_ops->cache_all(); 297 local_ops->cache_all();
303 local_ops->tlb_all(); 298 local_ops->tlb_all();
@@ -317,7 +312,7 @@ void arch_cpu_pre_starting(void *arg)
317 } 312 }
318} 313}
319 314
320void arch_cpu_pre_online(void *arg) 315static void arch_cpu_pre_online(void *arg)
321{ 316{
322 unsigned int cpuid = hard_smp_processor_id(); 317 unsigned int cpuid = hard_smp_processor_id();
323 318
@@ -344,7 +339,7 @@ void arch_cpu_pre_online(void *arg)
344 } 339 }
345} 340}
346 341
347void sparc_start_secondary(void *arg) 342static void sparc_start_secondary(void *arg)
348{ 343{
349 unsigned int cpu; 344 unsigned int cpu;
350 345
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 745a3633ce14..41aa2478f3ca 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -25,6 +25,7 @@
25#include <linux/ftrace.h> 25#include <linux/ftrace.h>
26#include <linux/cpu.h> 26#include <linux/cpu.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/kgdb.h>
28 29
29#include <asm/head.h> 30#include <asm/head.h>
30#include <asm/ptrace.h> 31#include <asm/ptrace.h>
@@ -35,6 +36,7 @@
35#include <asm/hvtramp.h> 36#include <asm/hvtramp.h>
36#include <asm/io.h> 37#include <asm/io.h>
37#include <asm/timer.h> 38#include <asm/timer.h>
39#include <asm/setup.h>
38 40
39#include <asm/irq.h> 41#include <asm/irq.h>
40#include <asm/irq_regs.h> 42#include <asm/irq_regs.h>
@@ -52,6 +54,7 @@
52#include <asm/pcr.h> 54#include <asm/pcr.h>
53 55
54#include "cpumap.h" 56#include "cpumap.h"
57#include "kernel.h"
55 58
56DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; 59DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
57cpumask_t cpu_core_map[NR_CPUS] __read_mostly = 60cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
@@ -272,14 +275,6 @@ static void smp_synchronize_one_tick(int cpu)
272} 275}
273 276
274#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) 277#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
275/* XXX Put this in some common place. XXX */
276static unsigned long kimage_addr_to_ra(void *p)
277{
278 unsigned long val = (unsigned long) p;
279
280 return kern_base + (val - KERNBASE);
281}
282
283static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg, 278static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg,
284 void **descrp) 279 void **descrp)
285{ 280{
@@ -867,11 +862,6 @@ extern unsigned long xcall_flush_dcache_page_cheetah;
867#endif 862#endif
868extern unsigned long xcall_flush_dcache_page_spitfire; 863extern unsigned long xcall_flush_dcache_page_spitfire;
869 864
870#ifdef CONFIG_DEBUG_DCFLUSH
871extern atomic_t dcpage_flushes;
872extern atomic_t dcpage_flushes_xcall;
873#endif
874
875static inline void __local_flush_dcache_page(struct page *page) 865static inline void __local_flush_dcache_page(struct page *page)
876{ 866{
877#ifdef DCACHE_ALIASING_POSSIBLE 867#ifdef DCACHE_ALIASING_POSSIBLE
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index f8933be3ca8b..a1bb2675b280 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -143,7 +143,7 @@ static void sun4d_sbus_handler_irq(int sbusl)
143 } 143 }
144} 144}
145 145
146void sun4d_handler_irq(int pil, struct pt_regs *regs) 146void sun4d_handler_irq(unsigned int pil, struct pt_regs *regs)
147{ 147{
148 struct pt_regs *old_regs; 148 struct pt_regs *old_regs;
149 /* SBUS IRQ level (1 - 7) */ 149 /* SBUS IRQ level (1 - 7) */
@@ -236,7 +236,7 @@ static void sun4d_shutdown_irq(struct irq_data *data)
236 irq_unlink(data->irq); 236 irq_unlink(data->irq);
237} 237}
238 238
239struct irq_chip sun4d_irq = { 239static struct irq_chip sun4d_irq = {
240 .name = "sun4d", 240 .name = "sun4d",
241 .irq_startup = sun4d_startup_irq, 241 .irq_startup = sun4d_startup_irq,
242 .irq_shutdown = sun4d_shutdown_irq, 242 .irq_shutdown = sun4d_shutdown_irq,
@@ -285,9 +285,9 @@ static void __init sun4d_load_profile_irqs(void)
285 } 285 }
286} 286}
287 287
288unsigned int _sun4d_build_device_irq(unsigned int real_irq, 288static unsigned int _sun4d_build_device_irq(unsigned int real_irq,
289 unsigned int pil, 289 unsigned int pil,
290 unsigned int board) 290 unsigned int board)
291{ 291{
292 struct sun4d_handler_data *handler_data; 292 struct sun4d_handler_data *handler_data;
293 unsigned int irq; 293 unsigned int irq;
@@ -320,8 +320,8 @@ err_out:
320 320
321 321
322 322
323unsigned int sun4d_build_device_irq(struct platform_device *op, 323static unsigned int sun4d_build_device_irq(struct platform_device *op,
324 unsigned int real_irq) 324 unsigned int real_irq)
325{ 325{
326 struct device_node *dp = op->dev.of_node; 326 struct device_node *dp = op->dev.of_node;
327 struct device_node *board_parent, *bus = dp->parent; 327 struct device_node *board_parent, *bus = dp->parent;
@@ -383,7 +383,8 @@ err_out:
383 return irq; 383 return irq;
384} 384}
385 385
386unsigned int sun4d_build_timer_irq(unsigned int board, unsigned int real_irq) 386static unsigned int sun4d_build_timer_irq(unsigned int board,
387 unsigned int real_irq)
387{ 388{
388 return _sun4d_build_device_irq(real_irq, real_irq, board); 389 return _sun4d_build_device_irq(real_irq, real_irq, board);
389} 390}
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 71368850dfc0..022c30c72ebd 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -49,6 +49,8 @@
49#include <asm/mmu_context.h> 49#include <asm/mmu_context.h>
50#include <asm/compat_signal.h> 50#include <asm/compat_signal.h>
51 51
52#include "systbls.h"
53
52asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) 54asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
53{ 55{
54 if ((int)high < 0) 56 if ((int)high < 0)
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 3a8d1844402e..646988d4c1a3 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -24,6 +24,8 @@
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/unistd.h> 25#include <asm/unistd.h>
26 26
27#include "systbls.h"
28
27/* #define DEBUG_UNIMP_SYSCALL */ 29/* #define DEBUG_UNIMP_SYSCALL */
28 30
29/* XXX Make this per-binary type, this way we can detect the type of 31/* XXX Make this per-binary type, this way we can detect the type of
@@ -68,7 +70,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
68 * sys_pipe() is the normal C calling standard for creating 70 * sys_pipe() is the normal C calling standard for creating
69 * a pipe. It's not the way unix traditionally does this, though. 71 * a pipe. It's not the way unix traditionally does this, though.
70 */ 72 */
71asmlinkage int sparc_pipe(struct pt_regs *regs) 73asmlinkage long sparc_pipe(struct pt_regs *regs)
72{ 74{
73 int fd[2]; 75 int fd[2];
74 int error; 76 int error;
@@ -93,7 +95,7 @@ int sparc_mmap_check(unsigned long addr, unsigned long len)
93 95
94/* Linux version of mmap */ 96/* Linux version of mmap */
95 97
96asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, 98asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
97 unsigned long prot, unsigned long flags, unsigned long fd, 99 unsigned long prot, unsigned long flags, unsigned long fd,
98 unsigned long pgoff) 100 unsigned long pgoff)
99{ 101{
@@ -103,7 +105,7 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
103 pgoff >> (PAGE_SHIFT - 12)); 105 pgoff >> (PAGE_SHIFT - 12));
104} 106}
105 107
106asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, 108asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
107 unsigned long prot, unsigned long flags, unsigned long fd, 109 unsigned long prot, unsigned long flags, unsigned long fd,
108 unsigned long off) 110 unsigned long off)
109{ 111{
@@ -197,7 +199,7 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig,
197 return ret; 199 return ret;
198} 200}
199 201
200asmlinkage int sys_getdomainname(char __user *name, int len) 202asmlinkage long sys_getdomainname(char __user *name, int len)
201{ 203{
202 int nlen, err; 204 int nlen, err;
203 205
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index beb0b5a5f21f..c85403d0496c 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -31,6 +31,7 @@
31#include <asm/unistd.h> 31#include <asm/unistd.h>
32 32
33#include "entry.h" 33#include "entry.h"
34#include "kernel.h"
34#include "systbls.h" 35#include "systbls.h"
35 36
36/* #define DEBUG_UNIMP_SYSCALL */ 37/* #define DEBUG_UNIMP_SYSCALL */
diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h
index 26e6dd72e92a..2dab8236d490 100644
--- a/arch/sparc/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
@@ -1,41 +1,103 @@
1#ifndef _SYSTBLS_H 1#ifndef _SYSTBLS_H
2#define _SYSTBLS_H 2#define _SYSTBLS_H
3 3
4#include <linux/signal.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/compat.h>
5#include <linux/types.h> 7#include <linux/types.h>
6#include <linux/signal.h> 8
7#include <asm/utrap.h> 9#include <asm/utrap.h>
8 10
9extern asmlinkage unsigned long sys_getpagesize(void); 11asmlinkage unsigned long sys_getpagesize(void);
10extern asmlinkage long sparc_pipe(struct pt_regs *regs); 12asmlinkage long sparc_pipe(struct pt_regs *regs);
11extern asmlinkage long sys_sparc_ipc(unsigned int call, int first, 13asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs);
12 unsigned long second, 14asmlinkage long sys_getdomainname(char __user *name, int len);
13 unsigned long third, 15void do_rt_sigreturn(struct pt_regs *regs);
14 void __user *ptr, long fifth); 16asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
15extern asmlinkage long sparc64_personality(unsigned long personality); 17 unsigned long prot, unsigned long flags,
16extern asmlinkage long sys64_munmap(unsigned long addr, size_t len); 18 unsigned long fd, unsigned long off);
17extern asmlinkage unsigned long sys64_mremap(unsigned long addr, 19asmlinkage void sparc_breakpoint(struct pt_regs *regs);
18 unsigned long old_len, 20
19 unsigned long new_len, 21#ifdef CONFIG_SPARC32
20 unsigned long flags, 22asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
21 unsigned long new_addr); 23 unsigned long prot, unsigned long flags,
22extern asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs); 24 unsigned long fd, unsigned long pgoff);
23extern asmlinkage long sys_getdomainname(char __user *name, int len); 25long sparc_remap_file_pages(unsigned long start, unsigned long size,
24extern asmlinkage long sys_utrap_install(utrap_entry_t type, 26 unsigned long prot, unsigned long pgoff,
25 utrap_handler_t new_p, 27 unsigned long flags);
26 utrap_handler_t new_d,
27 utrap_handler_t __user *old_p,
28 utrap_handler_t __user *old_d);
29extern asmlinkage long sparc_memory_ordering(unsigned long model,
30 struct pt_regs *regs);
31extern asmlinkage long sys_rt_sigaction(int sig,
32 const struct sigaction __user *act,
33 struct sigaction __user *oact,
34 void __user *restorer,
35 size_t sigsetsize);
36 28
37extern asmlinkage void sparc64_set_context(struct pt_regs *regs); 29#endif /* CONFIG_SPARC32 */
38extern asmlinkage void sparc64_get_context(struct pt_regs *regs);
39extern void do_rt_sigreturn(struct pt_regs *regs);
40 30
31#ifdef CONFIG_SPARC64
32asmlinkage long sys_sparc_ipc(unsigned int call, int first,
33 unsigned long second,
34 unsigned long third,
35 void __user *ptr, long fifth);
36asmlinkage long sparc64_personality(unsigned long personality);
37asmlinkage long sys64_munmap(unsigned long addr, size_t len);
38asmlinkage unsigned long sys64_mremap(unsigned long addr,
39 unsigned long old_len,
40 unsigned long new_len,
41 unsigned long flags,
42 unsigned long new_addr);
43asmlinkage long sys_utrap_install(utrap_entry_t type,
44 utrap_handler_t new_p,
45 utrap_handler_t new_d,
46 utrap_handler_t __user *old_p,
47 utrap_handler_t __user *old_d);
48asmlinkage long sparc_memory_ordering(unsigned long model,
49 struct pt_regs *regs);
50asmlinkage void sparc64_set_context(struct pt_regs *regs);
51asmlinkage void sparc64_get_context(struct pt_regs *regs);
52asmlinkage long sys32_truncate64(const char __user * path,
53 unsigned long high,
54 unsigned long low);
55asmlinkage long sys32_ftruncate64(unsigned int fd,
56 unsigned long high,
57 unsigned long low);
58struct compat_stat64;
59asmlinkage long compat_sys_stat64(const char __user * filename,
60 struct compat_stat64 __user *statbuf);
61asmlinkage long compat_sys_lstat64(const char __user * filename,
62 struct compat_stat64 __user *statbuf);
63asmlinkage long compat_sys_fstat64(unsigned int fd,
64 struct compat_stat64 __user * statbuf);
65asmlinkage long compat_sys_fstatat64(unsigned int dfd,
66 const char __user *filename,
67 struct compat_stat64 __user * statbuf, int flag);
68asmlinkage compat_ssize_t sys32_pread64(unsigned int fd,
69 char __user *ubuf,
70 compat_size_t count,
71 unsigned long poshi,
72 unsigned long poslo);
73asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd,
74 char __user *ubuf,
75 compat_size_t count,
76 unsigned long poshi,
77 unsigned long poslo);
78asmlinkage long compat_sys_readahead(int fd,
79 unsigned long offhi,
80 unsigned long offlo,
81 compat_size_t count);
82long compat_sys_fadvise64(int fd,
83 unsigned long offhi,
84 unsigned long offlo,
85 compat_size_t len, int advice);
86long compat_sys_fadvise64_64(int fd,
87 unsigned long offhi, unsigned long offlo,
88 unsigned long lenhi, unsigned long lenlo,
89 int advice);
90long sys32_sync_file_range(unsigned int fd,
91 unsigned long off_high, unsigned long off_low,
92 unsigned long nb_high, unsigned long nb_low,
93 unsigned int flags);
94asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo,
95 u32 lenhi, u32 lenlo);
96asmlinkage long compat_sys_fstat64(unsigned int fd,
97 struct compat_stat64 __user * statbuf);
98asmlinkage long compat_sys_fstatat64(unsigned int dfd,
99 const char __user *filename,
100 struct compat_stat64 __user * statbuf,
101 int flag);
102#endif /* CONFIG_SPARC64 */
41#endif /* _SYSTBLS_H */ 103#endif /* _SYSTBLS_H */
diff --git a/arch/sparc/kernel/tadpole.c b/arch/sparc/kernel/tadpole.c
deleted file mode 100644
index 9aba8bd5a78b..000000000000
--- a/arch/sparc/kernel/tadpole.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/* tadpole.c: Probing for the tadpole clock stopping h/w at boot time.
2 *
3 * Copyright (C) 1996 David Redman (djhr@tadpole.co.uk)
4 */
5
6#include <linux/string.h>
7#include <linux/kernel.h>
8#include <linux/sched.h>
9#include <linux/init.h>
10
11#include <asm/asi.h>
12#include <asm/oplib.h>
13#include <asm/io.h>
14
15#define MACIO_SCSI_CSR_ADDR 0x78400000
16#define MACIO_EN_DMA 0x00000200
17#define CLOCK_INIT_DONE 1
18
19static int clk_state;
20static volatile unsigned char *clk_ctrl;
21void (*cpu_pwr_save)(void);
22
23static inline unsigned int ldphys(unsigned int addr)
24{
25 unsigned long data;
26
27 __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" :
28 "=r" (data) :
29 "r" (addr), "i" (ASI_M_BYPASS));
30 return data;
31}
32
33static void clk_init(void)
34{
35 __asm__ __volatile__("mov 0x6c, %%g1\n\t"
36 "mov 0x4c, %%g2\n\t"
37 "mov 0xdf, %%g3\n\t"
38 "stb %%g1, [%0+3]\n\t"
39 "stb %%g2, [%0+3]\n\t"
40 "stb %%g3, [%0+3]\n\t" : :
41 "r" (clk_ctrl) :
42 "g1", "g2", "g3");
43}
44
45static void clk_slow(void)
46{
47 __asm__ __volatile__("mov 0xcc, %%g2\n\t"
48 "mov 0x4c, %%g3\n\t"
49 "mov 0xcf, %%g4\n\t"
50 "mov 0xdf, %%g5\n\t"
51 "stb %%g2, [%0+3]\n\t"
52 "stb %%g3, [%0+3]\n\t"
53 "stb %%g4, [%0+3]\n\t"
54 "stb %%g5, [%0+3]\n\t" : :
55 "r" (clk_ctrl) :
56 "g2", "g3", "g4", "g5");
57}
58
59/*
60 * Tadpole is guaranteed to be UP, using local_irq_save.
61 */
62static void tsu_clockstop(void)
63{
64 unsigned int mcsr;
65 unsigned long flags;
66
67 if (!clk_ctrl)
68 return;
69 if (!(clk_state & CLOCK_INIT_DONE)) {
70 local_irq_save(flags);
71 clk_init();
72 clk_state |= CLOCK_INIT_DONE; /* all done */
73 local_irq_restore(flags);
74 return;
75 }
76 if (!(clk_ctrl[2] & 1))
77 return; /* no speed up yet */
78
79 local_irq_save(flags);
80
81 /* if SCSI DMA in progress, don't slow clock */
82 mcsr = ldphys(MACIO_SCSI_CSR_ADDR);
83 if ((mcsr&MACIO_EN_DMA) != 0) {
84 local_irq_restore(flags);
85 return;
86 }
87 /* TODO... the minimum clock setting ought to increase the
88 * memory refresh interval..
89 */
90 clk_slow();
91 local_irq_restore(flags);
92}
93
94static void swift_clockstop(void)
95{
96 if (!clk_ctrl)
97 return;
98 clk_ctrl[0] = 0;
99}
100
101void __init clock_stop_probe(void)
102{
103 phandle node, clk_nd;
104 char name[20];
105
106 prom_getstring(prom_root_node, "name", name, sizeof(name));
107 if (strncmp(name, "Tadpole", 7))
108 return;
109 node = prom_getchild(prom_root_node);
110 node = prom_searchsiblings(node, "obio");
111 node = prom_getchild(node);
112 clk_nd = prom_searchsiblings(node, "clk-ctrl");
113 if (!clk_nd)
114 return;
115 printk("Clock Stopping h/w detected... ");
116 clk_ctrl = (char *) prom_getint(clk_nd, "address");
117 clk_state = 0;
118 if (name[10] == '\0') {
119 cpu_pwr_save = tsu_clockstop;
120 printk("enabled (S3)\n");
121 } else if ((name[10] == 'X') || (name[10] == 'G')) {
122 cpu_pwr_save = swift_clockstop;
123 printk("enabled (%s)\n",name+7);
124 } else
125 printk("disabled %s\n",name+7);
126}
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index c4c27b0f9063..5923d1e4e7c9 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -36,6 +36,7 @@
36#include <linux/of_device.h> 36#include <linux/of_device.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38 38
39#include <asm/mc146818rtc.h>
39#include <asm/oplib.h> 40#include <asm/oplib.h>
40#include <asm/timex.h> 41#include <asm/timex.h>
41#include <asm/timer.h> 42#include <asm/timer.h>
@@ -47,6 +48,7 @@
47#include <asm/irq_regs.h> 48#include <asm/irq_regs.h>
48#include <asm/setup.h> 49#include <asm/setup.h>
49 50
51#include "kernel.h"
50#include "irq.h" 52#include "irq.h"
51 53
52static __cacheline_aligned_in_smp DEFINE_SEQLOCK(timer_cs_lock); 54static __cacheline_aligned_in_smp DEFINE_SEQLOCK(timer_cs_lock);
@@ -83,7 +85,7 @@ unsigned long profile_pc(struct pt_regs *regs)
83 85
84EXPORT_SYMBOL(profile_pc); 86EXPORT_SYMBOL(profile_pc);
85 87
86__volatile__ unsigned int *master_l10_counter; 88volatile u32 __iomem *master_l10_counter;
87 89
88int update_persistent_clock(struct timespec now) 90int update_persistent_clock(struct timespec now)
89{ 91{
@@ -143,9 +145,9 @@ static __init void setup_timer_ce(void)
143 145
144static unsigned int sbus_cycles_offset(void) 146static unsigned int sbus_cycles_offset(void)
145{ 147{
146 unsigned int val, offset; 148 u32 val, offset;
147 149
148 val = *master_l10_counter; 150 val = sbus_readl(master_l10_counter);
149 offset = (val >> TIMER_VALUE_SHIFT) & TIMER_VALUE_MASK; 151 offset = (val >> TIMER_VALUE_SHIFT) & TIMER_VALUE_MASK;
150 152
151 /* Limit hit? */ 153 /* Limit hit? */
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
index 662982946a89..6fd386c5232a 100644
--- a/arch/sparc/kernel/traps_32.c
+++ b/arch/sparc/kernel/traps_32.c
@@ -44,7 +44,7 @@ static void instruction_dump(unsigned long *pc)
44#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t") 44#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t")
45#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t") 45#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t")
46 46
47void die_if_kernel(char *str, struct pt_regs *regs) 47void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
48{ 48{
49 static int die_counter; 49 static int die_counter;
50 int count = 0; 50 int count = 0;
@@ -219,8 +219,6 @@ static unsigned long fake_fsr;
219static unsigned long fake_queue[32] __attribute__ ((aligned (8))); 219static unsigned long fake_queue[32] __attribute__ ((aligned (8)));
220static unsigned long fake_depth; 220static unsigned long fake_depth;
221 221
222extern int do_mathemu(struct pt_regs *, struct task_struct *);
223
224void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, 222void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
225 unsigned long psr) 223 unsigned long psr)
226{ 224{
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index 4ced92f05358..fb6640ec8557 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -43,8 +43,10 @@
43#include <asm/prom.h> 43#include <asm/prom.h>
44#include <asm/memctrl.h> 44#include <asm/memctrl.h>
45#include <asm/cacheflush.h> 45#include <asm/cacheflush.h>
46#include <asm/setup.h>
46 47
47#include "entry.h" 48#include "entry.h"
49#include "kernel.h"
48#include "kstack.h" 50#include "kstack.h"
49 51
50/* When an irrecoverable trap occurs at tl > 0, the trap entry 52/* When an irrecoverable trap occurs at tl > 0, the trap entry
@@ -2209,8 +2211,6 @@ out:
2209 exception_exit(prev_state); 2211 exception_exit(prev_state);
2210} 2212}
2211 2213
2212extern int do_mathemu(struct pt_regs *, struct fpustate *, bool);
2213
2214void do_fpother(struct pt_regs *regs) 2214void do_fpother(struct pt_regs *regs)
2215{ 2215{
2216 enum ctx_state prev_state = exception_enter(); 2216 enum ctx_state prev_state = exception_enter();
@@ -2383,7 +2383,7 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2383 return (struct reg_window *) (fp + STACK_BIAS); 2383 return (struct reg_window *) (fp + STACK_BIAS);
2384} 2384}
2385 2385
2386void die_if_kernel(char *str, struct pt_regs *regs) 2386void __noreturn die_if_kernel(char *str, struct pt_regs *regs)
2387{ 2387{
2388 static int die_counter; 2388 static int die_counter;
2389 int count = 0; 2389 int count = 0;
@@ -2433,9 +2433,6 @@ EXPORT_SYMBOL(die_if_kernel);
2433#define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19)) 2433#define VIS_OPCODE_MASK ((0x3 << 30) | (0x3f << 19))
2434#define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19)) 2434#define VIS_OPCODE_VAL ((0x2 << 30) | (0x36 << 19))
2435 2435
2436extern int handle_popc(u32 insn, struct pt_regs *regs);
2437extern int handle_ldf_stq(u32 insn, struct pt_regs *regs);
2438
2439void do_illegal_instruction(struct pt_regs *regs) 2436void do_illegal_instruction(struct pt_regs *regs)
2440{ 2437{
2441 enum ctx_state prev_state = exception_enter(); 2438 enum ctx_state prev_state = exception_enter();
@@ -2486,8 +2483,6 @@ out:
2486 exception_exit(prev_state); 2483 exception_exit(prev_state);
2487} 2484}
2488 2485
2489extern void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn);
2490
2491void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr) 2486void mem_address_unaligned(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)
2492{ 2487{
2493 enum ctx_state prev_state = exception_enter(); 2488 enum ctx_state prev_state = exception_enter();
diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c
index c0ec89786193..c5c61b3c6b56 100644
--- a/arch/sparc/kernel/unaligned_32.c
+++ b/arch/sparc/kernel/unaligned_32.c
@@ -16,6 +16,10 @@
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/perf_event.h> 17#include <linux/perf_event.h>
18 18
19#include <asm/setup.h>
20
21#include "kernel.h"
22
19enum direction { 23enum direction {
20 load, /* ld, ldd, ldh, ldsh */ 24 load, /* ld, ldd, ldh, ldsh */
21 store, /* st, std, sth, stsh */ 25 store, /* st, std, sth, stsh */
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index 35ab8b60d256..62098a89bbbf 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -24,8 +24,10 @@
24#include <linux/context_tracking.h> 24#include <linux/context_tracking.h>
25#include <asm/fpumacro.h> 25#include <asm/fpumacro.h>
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/setup.h>
27 28
28#include "entry.h" 29#include "entry.h"
30#include "kernel.h"
29 31
30enum direction { 32enum direction {
31 load, /* ld, ldd, ldh, ldsh */ 33 load, /* ld, ldd, ldh, ldsh */
diff --git a/arch/sparc/kernel/windows.c b/arch/sparc/kernel/windows.c
index 3107381e576d..87bab0a3857a 100644
--- a/arch/sparc/kernel/windows.c
+++ b/arch/sparc/kernel/windows.c
@@ -10,8 +10,11 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/smp.h> 11#include <linux/smp.h>
12 12
13#include <asm/cacheflush.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14 15
16#include "kernel.h"
17
15/* Do save's until all user register windows are out of the cpu. */ 18/* Do save's until all user register windows are out of the cpu. */
16void flush_user_windows(void) 19void flush_user_windows(void)
17{ 20{