diff options
author | David S. Miller <davem@davemloft.net> | 2012-04-13 16:32:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-13 16:32:07 -0400 |
commit | 3423166fdbc2444bf3a4a27af1d7508364a17be7 (patch) | |
tree | 0a42bd5fbe6bcca79802bf1ec5af6acf12aadd82 /arch/sparc | |
parent | e9b57cca3dbdc7a0b90514af8bf613baf97105a5 (diff) | |
parent | 7d93101fc71ec47c7cc66ac99f76ef795c5207aa (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Diffstat (limited to 'arch/sparc')
108 files changed, 874 insertions, 1039 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index ca5580e4d813..6c0683d3fcba 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -29,6 +29,7 @@ config SPARC | |||
29 | select GENERIC_IRQ_SHOW | 29 | select GENERIC_IRQ_SHOW |
30 | select USE_GENERIC_SMP_HELPERS if SMP | 30 | select USE_GENERIC_SMP_HELPERS if SMP |
31 | select GENERIC_PCI_IOMAP | 31 | select GENERIC_PCI_IOMAP |
32 | select HAVE_NMI_WATCHDOG if SPARC64 | ||
32 | 33 | ||
33 | config SPARC32 | 34 | config SPARC32 |
34 | def_bool !64BIT | 35 | def_bool !64BIT |
@@ -576,6 +577,7 @@ config COMPAT | |||
576 | depends on SPARC64 | 577 | depends on SPARC64 |
577 | default y | 578 | default y |
578 | select COMPAT_BINFMT_ELF | 579 | select COMPAT_BINFMT_ELF |
580 | select ARCH_WANT_OLD_COMPAT_IPC | ||
579 | 581 | ||
580 | config SYSVIPC_COMPAT | 582 | config SYSVIPC_COMPAT |
581 | bool | 583 | bool |
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index ad1fb5d969f3..eddcfb36aafb 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile | |||
@@ -31,7 +31,7 @@ UTS_MACHINE := sparc | |||
31 | 31 | ||
32 | #KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 | 32 | #KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 |
33 | KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 | 33 | KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 |
34 | KBUILD_AFLAGS += -m32 | 34 | KBUILD_AFLAGS += -m32 -Wa,-Av8 |
35 | 35 | ||
36 | #LDFLAGS_vmlinux = -N -Ttext 0xf0004000 | 36 | #LDFLAGS_vmlinux = -N -Ttext 0xf0004000 |
37 | # Since 2.5.40, the first stage is left not btfix-ed. | 37 | # Since 2.5.40, the first stage is left not btfix-ed. |
diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile index 9205416b1e67..d56d199c1aa8 100644 --- a/arch/sparc/boot/Makefile +++ b/arch/sparc/boot/Makefile | |||
@@ -5,7 +5,6 @@ | |||
5 | 5 | ||
6 | ROOT_IMG := /usr/src/root.img | 6 | ROOT_IMG := /usr/src/root.img |
7 | ELFTOAOUT := elftoaout | 7 | ELFTOAOUT := elftoaout |
8 | MKIMAGE := $(srctree)/scripts/mkuboot.sh | ||
9 | 8 | ||
10 | hostprogs-y := piggyback btfixupprep | 9 | hostprogs-y := piggyback btfixupprep |
11 | targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout | 10 | targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout |
@@ -92,11 +91,9 @@ $(obj)/image.bin: $(obj)/image FORCE | |||
92 | $(obj)/image.gz: $(obj)/image.bin | 91 | $(obj)/image.gz: $(obj)/image.bin |
93 | $(call if_changed,gzip) | 92 | $(call if_changed,gzip) |
94 | 93 | ||
95 | quiet_cmd_uimage = UIMAGE $@ | 94 | UIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR) |
96 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sparc -O linux -T kernel \ | 95 | UIMAGE_ENTRYADDR = $(CONFIG_UBOOT_ENTRY_ADDR) |
97 | -C gzip -a $(CONFIG_UBOOT_LOAD_ADDR) \ | 96 | UIMAGE_COMPRESSION = gzip |
98 | -e $(CONFIG_UBOOT_ENTRY_ADDR) -n 'Linux-$(KERNELRELEASE)' \ | ||
99 | -d $< $@ | ||
100 | 97 | ||
101 | quiet_cmd_uimage.o = UIMAGE.O $@ | 98 | quiet_cmd_uimage.o = UIMAGE.O $@ |
102 | cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \ | 99 | cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \ |
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index 9dd0a769fa18..905832aa9e9e 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -13,9 +13,9 @@ | |||
13 | 13 | ||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | 15 | ||
16 | #include <asm/cmpxchg.h> | ||
16 | #include <asm-generic/atomic64.h> | 17 | #include <asm-generic/atomic64.h> |
17 | 18 | ||
18 | #include <asm/system.h> | ||
19 | 19 | ||
20 | #define ATOMIC_INIT(i) { (i) } | 20 | #define ATOMIC_INIT(i) { (i) } |
21 | 21 | ||
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index 9f421df46aec..ce35a1cf1a20 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #define __ARCH_SPARC64_ATOMIC__ | 8 | #define __ARCH_SPARC64_ATOMIC__ |
9 | 9 | ||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <asm/system.h> | 11 | #include <asm/cmpxchg.h> |
12 | 12 | ||
13 | #define ATOMIC_INIT(i) { (i) } | 13 | #define ATOMIC_INIT(i) { (i) } |
14 | #define ATOMIC64_INIT(i) { (i) } | 14 | #define ATOMIC64_INIT(i) { (i) } |
@@ -85,7 +85,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) | |||
85 | return c; | 85 | return c; |
86 | } | 86 | } |
87 | 87 | ||
88 | |||
89 | #define atomic64_cmpxchg(v, o, n) \ | 88 | #define atomic64_cmpxchg(v, o, n) \ |
90 | ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n))) | 89 | ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n))) |
91 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) | 90 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) |
diff --git a/arch/sparc/include/asm/auxio_32.h b/arch/sparc/include/asm/auxio_32.h index e03e088be95f..3a319775ae37 100644 --- a/arch/sparc/include/asm/auxio_32.h +++ b/arch/sparc/include/asm/auxio_32.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifndef _SPARC_AUXIO_H | 6 | #ifndef _SPARC_AUXIO_H |
7 | #define _SPARC_AUXIO_H | 7 | #define _SPARC_AUXIO_H |
8 | 8 | ||
9 | #include <asm/system.h> | ||
10 | #include <asm/vaddrs.h> | 9 | #include <asm/vaddrs.h> |
11 | 10 | ||
12 | /* This register is an unsigned char in IO space. It does two things. | 11 | /* This register is an unsigned char in IO space. It does two things. |
diff --git a/arch/sparc/include/asm/barrier.h b/arch/sparc/include/asm/barrier.h new file mode 100644 index 000000000000..b25f02a029e0 --- /dev/null +++ b/arch/sparc/include/asm/barrier.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef ___ASM_SPARC_BARRIER_H | ||
2 | #define ___ASM_SPARC_BARRIER_H | ||
3 | #if defined(__sparc__) && defined(__arch64__) | ||
4 | #include <asm/barrier_64.h> | ||
5 | #else | ||
6 | #include <asm/barrier_32.h> | ||
7 | #endif | ||
8 | #endif | ||
diff --git a/arch/sparc/include/asm/barrier_32.h b/arch/sparc/include/asm/barrier_32.h new file mode 100644 index 000000000000..c1b76654ee76 --- /dev/null +++ b/arch/sparc/include/asm/barrier_32.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef __SPARC_BARRIER_H | ||
2 | #define __SPARC_BARRIER_H | ||
3 | |||
4 | /* XXX Change this if we ever use a PSO mode kernel. */ | ||
5 | #define mb() __asm__ __volatile__ ("" : : : "memory") | ||
6 | #define rmb() mb() | ||
7 | #define wmb() mb() | ||
8 | #define read_barrier_depends() do { } while(0) | ||
9 | #define set_mb(__var, __value) do { __var = __value; mb(); } while(0) | ||
10 | #define smp_mb() __asm__ __volatile__("":::"memory") | ||
11 | #define smp_rmb() __asm__ __volatile__("":::"memory") | ||
12 | #define smp_wmb() __asm__ __volatile__("":::"memory") | ||
13 | #define smp_read_barrier_depends() do { } while(0) | ||
14 | |||
15 | #endif /* !(__SPARC_BARRIER_H) */ | ||
diff --git a/arch/sparc/include/asm/barrier_64.h b/arch/sparc/include/asm/barrier_64.h new file mode 100644 index 000000000000..95d45986f908 --- /dev/null +++ b/arch/sparc/include/asm/barrier_64.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef __SPARC64_BARRIER_H | ||
2 | #define __SPARC64_BARRIER_H | ||
3 | |||
4 | /* These are here in an effort to more fully work around Spitfire Errata | ||
5 | * #51. Essentially, if a memory barrier occurs soon after a mispredicted | ||
6 | * branch, the chip can stop executing instructions until a trap occurs. | ||
7 | * Therefore, if interrupts are disabled, the chip can hang forever. | ||
8 | * | ||
9 | * It used to be believed that the memory barrier had to be right in the | ||
10 | * delay slot, but a case has been traced recently wherein the memory barrier | ||
11 | * was one instruction after the branch delay slot and the chip still hung. | ||
12 | * The offending sequence was the following in sym_wakeup_done() of the | ||
13 | * sym53c8xx_2 driver: | ||
14 | * | ||
15 | * call sym_ccb_from_dsa, 0 | ||
16 | * movge %icc, 0, %l0 | ||
17 | * brz,pn %o0, .LL1303 | ||
18 | * mov %o0, %l2 | ||
19 | * membar #LoadLoad | ||
20 | * | ||
21 | * The branch has to be mispredicted for the bug to occur. Therefore, we put | ||
22 | * the memory barrier explicitly into a "branch always, predicted taken" | ||
23 | * delay slot to avoid the problem case. | ||
24 | */ | ||
25 | #define membar_safe(type) \ | ||
26 | do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ | ||
27 | " membar " type "\n" \ | ||
28 | "1:\n" \ | ||
29 | : : : "memory"); \ | ||
30 | } while (0) | ||
31 | |||
32 | /* The kernel always executes in TSO memory model these days, | ||
33 | * and furthermore most sparc64 chips implement more stringent | ||
34 | * memory ordering than required by the specifications. | ||
35 | */ | ||
36 | #define mb() membar_safe("#StoreLoad") | ||
37 | #define rmb() __asm__ __volatile__("":::"memory") | ||
38 | #define wmb() __asm__ __volatile__("":::"memory") | ||
39 | |||
40 | #define read_barrier_depends() do { } while(0) | ||
41 | #define set_mb(__var, __value) \ | ||
42 | do { __var = __value; membar_safe("#StoreLoad"); } while(0) | ||
43 | |||
44 | #ifdef CONFIG_SMP | ||
45 | #define smp_mb() mb() | ||
46 | #define smp_rmb() rmb() | ||
47 | #define smp_wmb() wmb() | ||
48 | #else | ||
49 | #define smp_mb() __asm__ __volatile__("":::"memory") | ||
50 | #define smp_rmb() __asm__ __volatile__("":::"memory") | ||
51 | #define smp_wmb() __asm__ __volatile__("":::"memory") | ||
52 | #endif | ||
53 | |||
54 | #define smp_read_barrier_depends() do { } while(0) | ||
55 | |||
56 | #endif /* !(__SPARC64_BARRIER_H) */ | ||
diff --git a/arch/sparc/include/asm/bug.h b/arch/sparc/include/asm/bug.h index 8a59e5a8c217..6bd9f43cb5a5 100644 --- a/arch/sparc/include/asm/bug.h +++ b/arch/sparc/include/asm/bug.h | |||
@@ -19,4 +19,7 @@ extern void do_BUG(const char *file, int line); | |||
19 | 19 | ||
20 | #include <asm-generic/bug.h> | 20 | #include <asm-generic/bug.h> |
21 | 21 | ||
22 | struct pt_regs; | ||
23 | extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); | ||
24 | |||
22 | #endif | 25 | #endif |
diff --git a/arch/sparc/include/asm/cacheflush_32.h b/arch/sparc/include/asm/cacheflush_32.h index 2e468773f250..68431b47a22a 100644 --- a/arch/sparc/include/asm/cacheflush_32.h +++ b/arch/sparc/include/asm/cacheflush_32.h | |||
@@ -83,4 +83,13 @@ extern void sparc_flush_page_to_ram(struct page *page); | |||
83 | #define flush_cache_vmap(start, end) flush_cache_all() | 83 | #define flush_cache_vmap(start, end) flush_cache_all() |
84 | #define flush_cache_vunmap(start, end) flush_cache_all() | 84 | #define flush_cache_vunmap(start, end) flush_cache_all() |
85 | 85 | ||
86 | /* When a context switch happens we must flush all user windows so that | ||
87 | * the windows of the current process are flushed onto its stack. This | ||
88 | * way the windows are all clean for the next process and the stack | ||
89 | * frames are up to date. | ||
90 | */ | ||
91 | extern void flush_user_windows(void); | ||
92 | extern void kill_user_windows(void); | ||
93 | extern void flushw_all(void); | ||
94 | |||
86 | #endif /* _SPARC_CACHEFLUSH_H */ | 95 | #endif /* _SPARC_CACHEFLUSH_H */ |
diff --git a/arch/sparc/include/asm/cacheflush_64.h b/arch/sparc/include/asm/cacheflush_64.h index b95384033e89..2efea2ff88b7 100644 --- a/arch/sparc/include/asm/cacheflush_64.h +++ b/arch/sparc/include/asm/cacheflush_64.h | |||
@@ -9,6 +9,16 @@ | |||
9 | 9 | ||
10 | /* Cache flush operations. */ | 10 | /* Cache flush operations. */ |
11 | 11 | ||
12 | |||
13 | #define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") | ||
14 | #define flushw_all() __asm__ __volatile__("flushw") | ||
15 | |||
16 | extern void __flushw_user(void); | ||
17 | #define flushw_user() __flushw_user() | ||
18 | |||
19 | #define flush_user_windows flushw_user | ||
20 | #define flush_register_windows flushw_all | ||
21 | |||
12 | /* These are the same regardless of whether this is an SMP kernel or not. */ | 22 | /* These are the same regardless of whether this is an SMP kernel or not. */ |
13 | #define flush_cache_mm(__mm) \ | 23 | #define flush_cache_mm(__mm) \ |
14 | do { if ((__mm) == current->mm) flushw_user(); } while(0) | 24 | do { if ((__mm) == current->mm) flushw_user(); } while(0) |
diff --git a/arch/sparc/include/asm/cmpxchg.h b/arch/sparc/include/asm/cmpxchg.h new file mode 100644 index 000000000000..9355893efa52 --- /dev/null +++ b/arch/sparc/include/asm/cmpxchg.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef ___ASM_SPARC_CMPXCHG_H | ||
2 | #define ___ASM_SPARC_CMPXCHG_H | ||
3 | #if defined(__sparc__) && defined(__arch64__) | ||
4 | #include <asm/cmpxchg_64.h> | ||
5 | #else | ||
6 | #include <asm/cmpxchg_32.h> | ||
7 | #endif | ||
8 | #endif | ||
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h new file mode 100644 index 000000000000..c786b0a92b51 --- /dev/null +++ b/arch/sparc/include/asm/cmpxchg_32.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* 32-bit atomic xchg() and cmpxchg() definitions. | ||
2 | * | ||
3 | * Copyright (C) 1996 David S. Miller (davem@davemloft.net) | ||
4 | * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com.au) | ||
5 | * Copyright (C) 2007 Kyle McMartin (kyle@parisc-linux.org) | ||
6 | * | ||
7 | * Additions by Keith M Wesolowski (wesolows@foobazco.org) based | ||
8 | * on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ARCH_SPARC_CMPXCHG__ | ||
12 | #define __ARCH_SPARC_CMPXCHG__ | ||
13 | |||
14 | #include <asm/btfixup.h> | ||
15 | |||
16 | /* This has special calling conventions */ | ||
17 | #ifndef CONFIG_SMP | ||
18 | BTFIXUPDEF_CALL(void, ___xchg32, void) | ||
19 | #endif | ||
20 | |||
21 | static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) | ||
22 | { | ||
23 | #ifdef CONFIG_SMP | ||
24 | __asm__ __volatile__("swap [%2], %0" | ||
25 | : "=&r" (val) | ||
26 | : "0" (val), "r" (m) | ||
27 | : "memory"); | ||
28 | return val; | ||
29 | #else | ||
30 | register unsigned long *ptr asm("g1"); | ||
31 | register unsigned long ret asm("g2"); | ||
32 | |||
33 | ptr = (unsigned long *) m; | ||
34 | ret = val; | ||
35 | |||
36 | /* Note: this is magic and the nop there is | ||
37 | really needed. */ | ||
38 | __asm__ __volatile__( | ||
39 | "mov %%o7, %%g4\n\t" | ||
40 | "call ___f____xchg32\n\t" | ||
41 | " nop\n\t" | ||
42 | : "=&r" (ret) | ||
43 | : "0" (ret), "r" (ptr) | ||
44 | : "g3", "g4", "g7", "memory", "cc"); | ||
45 | |||
46 | return ret; | ||
47 | #endif | ||
48 | } | ||
49 | |||
50 | extern void __xchg_called_with_bad_pointer(void); | ||
51 | |||
52 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) | ||
53 | { | ||
54 | switch (size) { | ||
55 | case 4: | ||
56 | return xchg_u32(ptr, x); | ||
57 | } | ||
58 | __xchg_called_with_bad_pointer(); | ||
59 | return x; | ||
60 | } | ||
61 | |||
62 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
63 | |||
64 | /* Emulate cmpxchg() the same way we emulate atomics, | ||
65 | * by hashing the object address and indexing into an array | ||
66 | * of spinlocks to get a bit of performance... | ||
67 | * | ||
68 | * See arch/sparc/lib/atomic32.c for implementation. | ||
69 | * | ||
70 | * Cribbed from <asm-parisc/atomic.h> | ||
71 | */ | ||
72 | #define __HAVE_ARCH_CMPXCHG 1 | ||
73 | |||
74 | /* bug catcher for when unsupported size is used - won't link */ | ||
75 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
76 | /* we only need to support cmpxchg of a u32 on sparc */ | ||
77 | extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); | ||
78 | |||
79 | /* don't worry...optimizer will get rid of most of this */ | ||
80 | static inline unsigned long | ||
81 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) | ||
82 | { | ||
83 | switch (size) { | ||
84 | case 4: | ||
85 | return __cmpxchg_u32((u32 *)ptr, (u32)old, (u32)new_); | ||
86 | default: | ||
87 | __cmpxchg_called_with_bad_pointer(); | ||
88 | break; | ||
89 | } | ||
90 | return old; | ||
91 | } | ||
92 | |||
93 | #define cmpxchg(ptr, o, n) \ | ||
94 | ({ \ | ||
95 | __typeof__(*(ptr)) _o_ = (o); \ | ||
96 | __typeof__(*(ptr)) _n_ = (n); \ | ||
97 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
98 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
99 | }) | ||
100 | |||
101 | #include <asm-generic/cmpxchg-local.h> | ||
102 | |||
103 | /* | ||
104 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
105 | * them available. | ||
106 | */ | ||
107 | #define cmpxchg_local(ptr, o, n) \ | ||
108 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ | ||
109 | (unsigned long)(n), sizeof(*(ptr)))) | ||
110 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
111 | |||
112 | #endif /* __ARCH_SPARC_CMPXCHG__ */ | ||
diff --git a/arch/sparc/include/asm/cmpxchg_64.h b/arch/sparc/include/asm/cmpxchg_64.h new file mode 100644 index 000000000000..b30eb37294c5 --- /dev/null +++ b/arch/sparc/include/asm/cmpxchg_64.h | |||
@@ -0,0 +1,145 @@ | |||
1 | /* 64-bit atomic xchg() and cmpxchg() definitions. | ||
2 | * | ||
3 | * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com) | ||
4 | */ | ||
5 | |||
6 | #ifndef __ARCH_SPARC64_CMPXCHG__ | ||
7 | #define __ARCH_SPARC64_CMPXCHG__ | ||
8 | |||
9 | static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) | ||
10 | { | ||
11 | unsigned long tmp1, tmp2; | ||
12 | |||
13 | __asm__ __volatile__( | ||
14 | " mov %0, %1\n" | ||
15 | "1: lduw [%4], %2\n" | ||
16 | " cas [%4], %2, %0\n" | ||
17 | " cmp %2, %0\n" | ||
18 | " bne,a,pn %%icc, 1b\n" | ||
19 | " mov %1, %0\n" | ||
20 | : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) | ||
21 | : "0" (val), "r" (m) | ||
22 | : "cc", "memory"); | ||
23 | return val; | ||
24 | } | ||
25 | |||
26 | static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long val) | ||
27 | { | ||
28 | unsigned long tmp1, tmp2; | ||
29 | |||
30 | __asm__ __volatile__( | ||
31 | " mov %0, %1\n" | ||
32 | "1: ldx [%4], %2\n" | ||
33 | " casx [%4], %2, %0\n" | ||
34 | " cmp %2, %0\n" | ||
35 | " bne,a,pn %%xcc, 1b\n" | ||
36 | " mov %1, %0\n" | ||
37 | : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) | ||
38 | : "0" (val), "r" (m) | ||
39 | : "cc", "memory"); | ||
40 | return val; | ||
41 | } | ||
42 | |||
43 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
44 | |||
45 | extern void __xchg_called_with_bad_pointer(void); | ||
46 | |||
47 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, | ||
48 | int size) | ||
49 | { | ||
50 | switch (size) { | ||
51 | case 4: | ||
52 | return xchg32(ptr, x); | ||
53 | case 8: | ||
54 | return xchg64(ptr, x); | ||
55 | } | ||
56 | __xchg_called_with_bad_pointer(); | ||
57 | return x; | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * Atomic compare and exchange. Compare OLD with MEM, if identical, | ||
62 | * store NEW in MEM. Return the initial value in MEM. Success is | ||
63 | * indicated by comparing RETURN with OLD. | ||
64 | */ | ||
65 | |||
66 | #include <asm-generic/cmpxchg-local.h> | ||
67 | |||
68 | #define __HAVE_ARCH_CMPXCHG 1 | ||
69 | |||
70 | static inline unsigned long | ||
71 | __cmpxchg_u32(volatile int *m, int old, int new) | ||
72 | { | ||
73 | __asm__ __volatile__("cas [%2], %3, %0" | ||
74 | : "=&r" (new) | ||
75 | : "0" (new), "r" (m), "r" (old) | ||
76 | : "memory"); | ||
77 | |||
78 | return new; | ||
79 | } | ||
80 | |||
81 | static inline unsigned long | ||
82 | __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) | ||
83 | { | ||
84 | __asm__ __volatile__("casx [%2], %3, %0" | ||
85 | : "=&r" (new) | ||
86 | : "0" (new), "r" (m), "r" (old) | ||
87 | : "memory"); | ||
88 | |||
89 | return new; | ||
90 | } | ||
91 | |||
92 | /* This function doesn't exist, so you'll get a linker error | ||
93 | if something tries to do an invalid cmpxchg(). */ | ||
94 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
95 | |||
96 | static inline unsigned long | ||
97 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | ||
98 | { | ||
99 | switch (size) { | ||
100 | case 4: | ||
101 | return __cmpxchg_u32(ptr, old, new); | ||
102 | case 8: | ||
103 | return __cmpxchg_u64(ptr, old, new); | ||
104 | } | ||
105 | __cmpxchg_called_with_bad_pointer(); | ||
106 | return old; | ||
107 | } | ||
108 | |||
109 | #define cmpxchg(ptr,o,n) \ | ||
110 | ({ \ | ||
111 | __typeof__(*(ptr)) _o_ = (o); \ | ||
112 | __typeof__(*(ptr)) _n_ = (n); \ | ||
113 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
114 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
115 | }) | ||
116 | |||
117 | /* | ||
118 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
119 | * them available. | ||
120 | */ | ||
121 | |||
122 | static inline unsigned long __cmpxchg_local(volatile void *ptr, | ||
123 | unsigned long old, | ||
124 | unsigned long new, int size) | ||
125 | { | ||
126 | switch (size) { | ||
127 | case 4: | ||
128 | case 8: return __cmpxchg(ptr, old, new, size); | ||
129 | default: | ||
130 | return __cmpxchg_local_generic(ptr, old, new, size); | ||
131 | } | ||
132 | |||
133 | return old; | ||
134 | } | ||
135 | |||
136 | #define cmpxchg_local(ptr, o, n) \ | ||
137 | ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ | ||
138 | (unsigned long)(n), sizeof(*(ptr)))) | ||
139 | #define cmpxchg64_local(ptr, o, n) \ | ||
140 | ({ \ | ||
141 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
142 | cmpxchg_local((ptr), (o), (n)); \ | ||
143 | }) | ||
144 | |||
145 | #endif /* __ARCH_SPARC64_CMPXCHG__ */ | ||
diff --git a/arch/sparc/include/asm/cpu_type.h b/arch/sparc/include/asm/cpu_type.h new file mode 100644 index 000000000000..4ca184d95d82 --- /dev/null +++ b/arch/sparc/include/asm/cpu_type.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef __ASM_CPU_TYPE_H | ||
2 | #define __ASM_CPU_TYPE_H | ||
3 | |||
4 | /* | ||
5 | * Sparc (general) CPU types | ||
6 | */ | ||
7 | enum sparc_cpu { | ||
8 | sun4 = 0x00, | ||
9 | sun4c = 0x01, | ||
10 | sun4m = 0x02, | ||
11 | sun4d = 0x03, | ||
12 | sun4e = 0x04, | ||
13 | sun4u = 0x05, /* V8 ploos ploos */ | ||
14 | sun_unknown = 0x06, | ||
15 | ap1000 = 0x07, /* almost a sun4m */ | ||
16 | sparc_leon = 0x08, /* Leon SoC */ | ||
17 | }; | ||
18 | |||
19 | #ifdef CONFIG_SPARC32 | ||
20 | extern enum sparc_cpu sparc_cpu_model; | ||
21 | |||
22 | #define ARCH_SUN4C (sparc_cpu_model==sun4c) | ||
23 | |||
24 | #define SUN4M_NCPUS 4 /* Architectural limit of sun4m. */ | ||
25 | |||
26 | #else | ||
27 | |||
28 | #define sparc_cpu_model sun4u | ||
29 | |||
30 | /* This cannot ever be a sun4c :) That's just history. */ | ||
31 | #define ARCH_SUN4C 0 | ||
32 | #endif | ||
33 | |||
34 | #endif /* __ASM_CPU_TYPE_H */ | ||
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 8c0e4f7bb204..48a7c65731d2 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h | |||
@@ -26,24 +26,30 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
26 | 26 | ||
27 | #include <asm-generic/dma-mapping-common.h> | 27 | #include <asm-generic/dma-mapping-common.h> |
28 | 28 | ||
29 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 29 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
30 | dma_addr_t *dma_handle, gfp_t flag) | 30 | |
31 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
32 | dma_addr_t *dma_handle, gfp_t flag, | ||
33 | struct dma_attrs *attrs) | ||
31 | { | 34 | { |
32 | struct dma_map_ops *ops = get_dma_ops(dev); | 35 | struct dma_map_ops *ops = get_dma_ops(dev); |
33 | void *cpu_addr; | 36 | void *cpu_addr; |
34 | 37 | ||
35 | cpu_addr = ops->alloc_coherent(dev, size, dma_handle, flag); | 38 | cpu_addr = ops->alloc(dev, size, dma_handle, flag, attrs); |
36 | debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr); | 39 | debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr); |
37 | return cpu_addr; | 40 | return cpu_addr; |
38 | } | 41 | } |
39 | 42 | ||
40 | static inline void dma_free_coherent(struct device *dev, size_t size, | 43 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
41 | void *cpu_addr, dma_addr_t dma_handle) | 44 | |
45 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
46 | void *cpu_addr, dma_addr_t dma_handle, | ||
47 | struct dma_attrs *attrs) | ||
42 | { | 48 | { |
43 | struct dma_map_ops *ops = get_dma_ops(dev); | 49 | struct dma_map_ops *ops = get_dma_ops(dev); |
44 | 50 | ||
45 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); | 51 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); |
46 | ops->free_coherent(dev, size, cpu_addr, dma_handle); | 52 | ops->free(dev, size, cpu_addr, dma_handle, attrs); |
47 | } | 53 | } |
48 | 54 | ||
49 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 55 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
diff --git a/arch/sparc/include/asm/exec.h b/arch/sparc/include/asm/exec.h new file mode 100644 index 000000000000..2e085881e0d1 --- /dev/null +++ b/arch/sparc/include/asm/exec.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __SPARC_EXEC_H | ||
2 | #define __SPARC_EXEC_H | ||
3 | |||
4 | #define arch_align_stack(x) (x) | ||
5 | |||
6 | #endif /* __SPARC_EXEC_H */ | ||
diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h index 7440915e86d8..698d9559fead 100644 --- a/arch/sparc/include/asm/floppy_32.h +++ b/arch/sparc/include/asm/floppy_32.h | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #include <asm/page.h> | 12 | #include <asm/page.h> |
13 | #include <asm/pgtable.h> | 13 | #include <asm/pgtable.h> |
14 | #include <asm/system.h> | ||
15 | #include <asm/idprom.h> | 14 | #include <asm/idprom.h> |
16 | #include <asm/machines.h> | 15 | #include <asm/machines.h> |
17 | #include <asm/oplib.h> | 16 | #include <asm/oplib.h> |
diff --git a/arch/sparc/include/asm/futex_64.h b/arch/sparc/include/asm/futex_64.h index 444e7bea23bc..4e899b0dabf7 100644 --- a/arch/sparc/include/asm/futex_64.h +++ b/arch/sparc/include/asm/futex_64.h | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <linux/futex.h> | 4 | #include <linux/futex.h> |
5 | #include <linux/uaccess.h> | 5 | #include <linux/uaccess.h> |
6 | #include <asm/errno.h> | 6 | #include <asm/errno.h> |
7 | #include <asm/system.h> | ||
8 | 7 | ||
9 | #define __futex_cas_op(insn, ret, oldval, uaddr, oparg) \ | 8 | #define __futex_cas_op(insn, ret, oldval, uaddr, oparg) \ |
10 | __asm__ __volatile__( \ | 9 | __asm__ __volatile__( \ |
diff --git a/arch/sparc/include/asm/highmem.h b/arch/sparc/include/asm/highmem.h index 3d7afbb7f4bb..3b6e00dd96e5 100644 --- a/arch/sparc/include/asm/highmem.h +++ b/arch/sparc/include/asm/highmem.h | |||
@@ -70,7 +70,7 @@ static inline void kunmap(struct page *page) | |||
70 | kunmap_high(page); | 70 | kunmap_high(page); |
71 | } | 71 | } |
72 | 72 | ||
73 | extern void *__kmap_atomic(struct page *page); | 73 | extern void *kmap_atomic(struct page *page); |
74 | extern void __kunmap_atomic(void *kvaddr); | 74 | extern void __kunmap_atomic(void *kvaddr); |
75 | extern struct page *kmap_atomic_to_page(void *vaddr); | 75 | extern struct page *kmap_atomic_to_page(void *vaddr); |
76 | 76 | ||
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h index 2006e5d359df..c1acbd891cbc 100644 --- a/arch/sparc/include/asm/io_32.h +++ b/arch/sparc/include/asm/io_32.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #include <linux/ioport.h> /* struct resource */ | 6 | #include <linux/ioport.h> /* struct resource */ |
7 | 7 | ||
8 | #include <asm/page.h> /* IO address mapping routines need this */ | 8 | #include <asm/page.h> /* IO address mapping routines need this */ |
9 | #include <asm/system.h> | ||
10 | #include <asm-generic/pci_iomap.h> | 9 | #include <asm-generic/pci_iomap.h> |
11 | 10 | ||
12 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) | 11 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) |
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h index 9481e5a6fa90..09b0b88aeb2a 100644 --- a/arch/sparc/include/asm/io_64.h +++ b/arch/sparc/include/asm/io_64.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | 7 | ||
8 | #include <asm/page.h> /* IO address mapping routines need this */ | 8 | #include <asm/page.h> /* IO address mapping routines need this */ |
9 | #include <asm/system.h> | ||
10 | #include <asm/asi.h> | 9 | #include <asm/asi.h> |
11 | #include <asm-generic/pci_iomap.h> | 10 | #include <asm-generic/pci_iomap.h> |
12 | 11 | ||
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h index 16dcae6d56e7..abf6afe82ca8 100644 --- a/arch/sparc/include/asm/irq_64.h +++ b/arch/sparc/include/asm/irq_64.h | |||
@@ -95,7 +95,6 @@ void arch_trigger_all_cpu_backtrace(void); | |||
95 | extern void *hardirq_stack[NR_CPUS]; | 95 | extern void *hardirq_stack[NR_CPUS]; |
96 | extern void *softirq_stack[NR_CPUS]; | 96 | extern void *softirq_stack[NR_CPUS]; |
97 | #define __ARCH_HAS_DO_SOFTIRQ | 97 | #define __ARCH_HAS_DO_SOFTIRQ |
98 | #define ARCH_HAS_NMI_WATCHDOG | ||
99 | 98 | ||
100 | #define NO_IRQ 0xffffffff | 99 | #define NO_IRQ 0xffffffff |
101 | 100 | ||
diff --git a/arch/sparc/include/asm/irqflags_32.h b/arch/sparc/include/asm/irqflags_32.h index 14848909e0de..e414c06615c1 100644 --- a/arch/sparc/include/asm/irqflags_32.h +++ b/arch/sparc/include/asm/irqflags_32.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #ifndef __ASSEMBLY__ | 13 | #ifndef __ASSEMBLY__ |
14 | 14 | ||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <asm/psr.h> | ||
16 | 17 | ||
17 | extern void arch_local_irq_restore(unsigned long); | 18 | extern void arch_local_irq_restore(unsigned long); |
18 | extern unsigned long arch_local_irq_save(void); | 19 | extern unsigned long arch_local_irq_save(void); |
diff --git a/arch/sparc/include/asm/jump_label.h b/arch/sparc/include/asm/jump_label.h index fc73a82366f8..5080d16a832f 100644 --- a/arch/sparc/include/asm/jump_label.h +++ b/arch/sparc/include/asm/jump_label.h | |||
@@ -7,7 +7,7 @@ | |||
7 | 7 | ||
8 | #define JUMP_LABEL_NOP_SIZE 4 | 8 | #define JUMP_LABEL_NOP_SIZE 4 |
9 | 9 | ||
10 | static __always_inline bool arch_static_branch(struct jump_label_key *key) | 10 | static __always_inline bool arch_static_branch(struct static_key *key) |
11 | { | 11 | { |
12 | asm goto("1:\n\t" | 12 | asm goto("1:\n\t" |
13 | "nop\n\t" | 13 | "nop\n\t" |
diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h index 666a73fef28d..a97fd085cebe 100644 --- a/arch/sparc/include/asm/mmu_context_64.h +++ b/arch/sparc/include/asm/mmu_context_64.h | |||
@@ -6,7 +6,6 @@ | |||
6 | #ifndef __ASSEMBLY__ | 6 | #ifndef __ASSEMBLY__ |
7 | 7 | ||
8 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
9 | #include <asm/system.h> | ||
10 | #include <asm/spitfire.h> | 9 | #include <asm/spitfire.h> |
11 | #include <asm-generic/mm_hooks.h> | 10 | #include <asm-generic/mm_hooks.h> |
12 | 11 | ||
diff --git a/arch/sparc/include/asm/ns87303.h b/arch/sparc/include/asm/ns87303.h index af755483e17d..6b947ee0f6aa 100644 --- a/arch/sparc/include/asm/ns87303.h +++ b/arch/sparc/include/asm/ns87303.h | |||
@@ -79,7 +79,6 @@ | |||
79 | 79 | ||
80 | #include <linux/spinlock.h> | 80 | #include <linux/spinlock.h> |
81 | 81 | ||
82 | #include <asm/system.h> | ||
83 | #include <asm/io.h> | 82 | #include <asm/io.h> |
84 | 83 | ||
85 | extern spinlock_t ns87303_lock; | 84 | extern spinlock_t ns87303_lock; |
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h index 6de7f7bf956a..dc503297481f 100644 --- a/arch/sparc/include/asm/pci_32.h +++ b/arch/sparc/include/asm/pci_32.h | |||
@@ -52,14 +52,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
52 | * 64Kbytes by the Host controller. | 52 | * 64Kbytes by the Host controller. |
53 | */ | 53 | */ |
54 | 54 | ||
55 | extern void | ||
56 | pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
57 | struct resource *res); | ||
58 | |||
59 | extern void | ||
60 | pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
61 | struct pci_bus_region *region); | ||
62 | |||
63 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | 55 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) |
64 | { | 56 | { |
65 | return PCI_IRQ_NONE; | 57 | return PCI_IRQ_NONE; |
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h index 755a4bb6bcd3..1633b718d3bc 100644 --- a/arch/sparc/include/asm/pci_64.h +++ b/arch/sparc/include/asm/pci_64.h | |||
@@ -73,14 +73,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
73 | enum pci_mmap_state mmap_state, | 73 | enum pci_mmap_state mmap_state, |
74 | int write_combine); | 74 | int write_combine); |
75 | 75 | ||
76 | extern void | ||
77 | pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
78 | struct resource *res); | ||
79 | |||
80 | extern void | ||
81 | pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
82 | struct pci_bus_region *region); | ||
83 | |||
84 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | 76 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) |
85 | { | 77 | { |
86 | return PCI_IRQ_NONE; | 78 | return PCI_IRQ_NONE; |
diff --git a/arch/sparc/include/asm/perfctr.h b/arch/sparc/include/asm/perfctr.h index 8d8720a8770d..3332d2cba6c1 100644 --- a/arch/sparc/include/asm/perfctr.h +++ b/arch/sparc/include/asm/perfctr.h | |||
@@ -168,6 +168,29 @@ struct vcounter_struct { | |||
168 | unsigned long long vcnt1; | 168 | unsigned long long vcnt1; |
169 | }; | 169 | }; |
170 | 170 | ||
171 | #else /* !(__KERNEL__) */ | ||
172 | |||
173 | #ifndef CONFIG_SPARC32 | ||
174 | |||
175 | /* Performance counter register access. */ | ||
176 | #define read_pcr(__p) __asm__ __volatile__("rd %%pcr, %0" : "=r" (__p)) | ||
177 | #define write_pcr(__p) __asm__ __volatile__("wr %0, 0x0, %%pcr" : : "r" (__p)) | ||
178 | #define read_pic(__p) __asm__ __volatile__("rd %%pic, %0" : "=r" (__p)) | ||
179 | |||
180 | /* Blackbird errata workaround. See commentary in | ||
181 | * arch/sparc64/kernel/smp.c:smp_percpu_timer_interrupt() | ||
182 | * for more information. | ||
183 | */ | ||
184 | #define write_pic(__p) \ | ||
185 | __asm__ __volatile__("ba,pt %%xcc, 99f\n\t" \ | ||
186 | " nop\n\t" \ | ||
187 | ".align 64\n" \ | ||
188 | "99:wr %0, 0x0, %%pic\n\t" \ | ||
189 | "rd %%pic, %%g0" : : "r" (__p)) | ||
190 | #define reset_pic() write_pic(0) | ||
191 | |||
192 | #endif /* !CONFIG_SPARC32 */ | ||
193 | |||
171 | #endif /* !(__KERNEL__) */ | 194 | #endif /* !(__KERNEL__) */ |
172 | 195 | ||
173 | #endif /* !(PERF_COUNTER_API) */ | 196 | #endif /* !(PERF_COUNTER_API) */ |
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index a790cc657476..3d7101860e68 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <asm/vac-ops.h> | 21 | #include <asm/vac-ops.h> |
22 | #include <asm/oplib.h> | 22 | #include <asm/oplib.h> |
23 | #include <asm/btfixup.h> | 23 | #include <asm/btfixup.h> |
24 | #include <asm/system.h> | 24 | #include <asm/cpu_type.h> |
25 | 25 | ||
26 | 26 | ||
27 | struct vm_area_struct; | 27 | struct vm_area_struct; |
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 38ebb2c60137..76e4a52aa85e 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h | |||
@@ -12,17 +12,16 @@ | |||
12 | * the SpitFire page tables. | 12 | * the SpitFire page tables. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <asm-generic/pgtable-nopud.h> | ||
16 | |||
17 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
18 | #include <linux/const.h> | 16 | #include <linux/const.h> |
19 | #include <asm/types.h> | 17 | #include <asm/types.h> |
20 | #include <asm/spitfire.h> | 18 | #include <asm/spitfire.h> |
21 | #include <asm/asi.h> | 19 | #include <asm/asi.h> |
22 | #include <asm/system.h> | ||
23 | #include <asm/page.h> | 20 | #include <asm/page.h> |
24 | #include <asm/processor.h> | 21 | #include <asm/processor.h> |
25 | 22 | ||
23 | #include <asm-generic/pgtable-nopud.h> | ||
24 | |||
26 | /* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB). | 25 | /* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB). |
27 | * The page copy blockops can use 0x6000000 to 0x8000000. | 26 | * The page copy blockops can use 0x6000000 to 0x8000000. |
28 | * The TSB is mapped in the 0x8000000 to 0xa000000 range. | 27 | * The TSB is mapped in the 0x8000000 to 0xa000000 range. |
diff --git a/arch/sparc/include/asm/posix_types.h b/arch/sparc/include/asm/posix_types.h index dbfc1a34b3a2..3070f25ae90a 100644 --- a/arch/sparc/include/asm/posix_types.h +++ b/arch/sparc/include/asm/posix_types.h | |||
@@ -9,35 +9,16 @@ | |||
9 | 9 | ||
10 | #if defined(__sparc__) && defined(__arch64__) | 10 | #if defined(__sparc__) && defined(__arch64__) |
11 | /* sparc 64 bit */ | 11 | /* sparc 64 bit */ |
12 | typedef unsigned long __kernel_size_t; | ||
13 | typedef long __kernel_ssize_t; | ||
14 | typedef long __kernel_ptrdiff_t; | ||
15 | typedef long __kernel_time_t; | ||
16 | typedef long __kernel_clock_t; | ||
17 | typedef int __kernel_pid_t; | ||
18 | typedef int __kernel_ipc_pid_t; | ||
19 | typedef unsigned int __kernel_uid_t; | ||
20 | typedef unsigned int __kernel_gid_t; | ||
21 | typedef unsigned long __kernel_ino_t; | ||
22 | typedef unsigned int __kernel_mode_t; | ||
23 | typedef unsigned int __kernel_nlink_t; | 12 | typedef unsigned int __kernel_nlink_t; |
24 | typedef int __kernel_daddr_t; | 13 | #define __kernel_nlink_t __kernel_nlink_t |
25 | typedef long __kernel_off_t; | ||
26 | typedef char * __kernel_caddr_t; | ||
27 | typedef unsigned short __kernel_uid16_t; | ||
28 | typedef unsigned short __kernel_gid16_t; | ||
29 | typedef int __kernel_clockid_t; | ||
30 | typedef int __kernel_timer_t; | ||
31 | 14 | ||
32 | typedef unsigned short __kernel_old_uid_t; | 15 | typedef unsigned short __kernel_old_uid_t; |
33 | typedef unsigned short __kernel_old_gid_t; | 16 | typedef unsigned short __kernel_old_gid_t; |
34 | typedef __kernel_uid_t __kernel_uid32_t; | 17 | #define __kernel_old_uid_t __kernel_old_uid_t |
35 | typedef __kernel_gid_t __kernel_gid32_t; | ||
36 | |||
37 | typedef unsigned int __kernel_old_dev_t; | ||
38 | 18 | ||
39 | /* Note this piece of asymmetry from the v9 ABI. */ | 19 | /* Note this piece of asymmetry from the v9 ABI. */ |
40 | typedef int __kernel_suseconds_t; | 20 | typedef int __kernel_suseconds_t; |
21 | #define __kernel_suseconds_t __kernel_suseconds_t | ||
41 | 22 | ||
42 | #else | 23 | #else |
43 | /* sparc 32 bit */ | 24 | /* sparc 32 bit */ |
@@ -45,109 +26,29 @@ typedef int __kernel_suseconds_t; | |||
45 | typedef unsigned int __kernel_size_t; | 26 | typedef unsigned int __kernel_size_t; |
46 | typedef int __kernel_ssize_t; | 27 | typedef int __kernel_ssize_t; |
47 | typedef long int __kernel_ptrdiff_t; | 28 | typedef long int __kernel_ptrdiff_t; |
48 | typedef long __kernel_time_t; | 29 | #define __kernel_size_t __kernel_size_t |
49 | typedef long __kernel_suseconds_t; | 30 | |
50 | typedef long __kernel_clock_t; | ||
51 | typedef int __kernel_pid_t; | ||
52 | typedef unsigned short __kernel_ipc_pid_t; | 31 | typedef unsigned short __kernel_ipc_pid_t; |
32 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | ||
33 | |||
53 | typedef unsigned short __kernel_uid_t; | 34 | typedef unsigned short __kernel_uid_t; |
54 | typedef unsigned short __kernel_gid_t; | 35 | typedef unsigned short __kernel_gid_t; |
55 | typedef unsigned long __kernel_ino_t; | 36 | #define __kernel_uid_t __kernel_uid_t |
37 | |||
56 | typedef unsigned short __kernel_mode_t; | 38 | typedef unsigned short __kernel_mode_t; |
39 | #define __kernel_mode_t __kernel_mode_t | ||
40 | |||
57 | typedef short __kernel_nlink_t; | 41 | typedef short __kernel_nlink_t; |
42 | #define __kernel_nlink_t __kernel_nlink_t | ||
43 | |||
58 | typedef long __kernel_daddr_t; | 44 | typedef long __kernel_daddr_t; |
59 | typedef long __kernel_off_t; | 45 | #define __kernel_daddr_t __kernel_daddr_t |
60 | typedef char * __kernel_caddr_t; | 46 | |
61 | typedef unsigned short __kernel_uid16_t; | ||
62 | typedef unsigned short __kernel_gid16_t; | ||
63 | typedef unsigned int __kernel_uid32_t; | ||
64 | typedef unsigned int __kernel_gid32_t; | ||
65 | typedef unsigned short __kernel_old_uid_t; | ||
66 | typedef unsigned short __kernel_old_gid_t; | ||
67 | typedef unsigned short __kernel_old_dev_t; | 47 | typedef unsigned short __kernel_old_dev_t; |
68 | typedef int __kernel_clockid_t; | 48 | #define __kernel_old_dev_t __kernel_old_dev_t |
69 | typedef int __kernel_timer_t; | ||
70 | 49 | ||
71 | #endif /* defined(__sparc__) && defined(__arch64__) */ | 50 | #endif /* defined(__sparc__) && defined(__arch64__) */ |
72 | 51 | ||
73 | #ifdef __GNUC__ | 52 | #include <asm-generic/posix_types.h> |
74 | typedef long long __kernel_loff_t; | ||
75 | #endif | ||
76 | |||
77 | typedef struct { | ||
78 | int val[2]; | ||
79 | } __kernel_fsid_t; | ||
80 | |||
81 | #ifdef __KERNEL__ | ||
82 | |||
83 | #undef __FD_SET | ||
84 | static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp) | ||
85 | { | ||
86 | unsigned long _tmp = fd / __NFDBITS; | ||
87 | unsigned long _rem = fd % __NFDBITS; | ||
88 | fdsetp->fds_bits[_tmp] |= (1UL<<_rem); | ||
89 | } | ||
90 | |||
91 | #undef __FD_CLR | ||
92 | static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp) | ||
93 | { | ||
94 | unsigned long _tmp = fd / __NFDBITS; | ||
95 | unsigned long _rem = fd % __NFDBITS; | ||
96 | fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem); | ||
97 | } | ||
98 | |||
99 | #undef __FD_ISSET | ||
100 | static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p) | ||
101 | { | ||
102 | unsigned long _tmp = fd / __NFDBITS; | ||
103 | unsigned long _rem = fd % __NFDBITS; | ||
104 | return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0; | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * This will unroll the loop for the normal constant cases (8 or 32 longs, | ||
109 | * for 256 and 1024-bit fd_sets respectively) | ||
110 | */ | ||
111 | #undef __FD_ZERO | ||
112 | static inline void __FD_ZERO(__kernel_fd_set *p) | ||
113 | { | ||
114 | unsigned long *tmp = p->fds_bits; | ||
115 | int i; | ||
116 | |||
117 | if (__builtin_constant_p(__FDSET_LONGS)) { | ||
118 | switch (__FDSET_LONGS) { | ||
119 | case 32: | ||
120 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
121 | tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; | ||
122 | tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; | ||
123 | tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; | ||
124 | tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0; | ||
125 | tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0; | ||
126 | tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0; | ||
127 | tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0; | ||
128 | return; | ||
129 | case 16: | ||
130 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
131 | tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; | ||
132 | tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0; | ||
133 | tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0; | ||
134 | return; | ||
135 | case 8: | ||
136 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
137 | tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0; | ||
138 | return; | ||
139 | case 4: | ||
140 | tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0; | ||
141 | return; | ||
142 | } | ||
143 | } | ||
144 | i = __FDSET_LONGS; | ||
145 | while (i) { | ||
146 | i--; | ||
147 | *tmp = 0; | ||
148 | tmp++; | ||
149 | } | ||
150 | } | ||
151 | 53 | ||
152 | #endif /* __KERNEL__ */ | ||
153 | #endif /* __SPARC_POSIX_TYPES_H */ | 54 | #endif /* __SPARC_POSIX_TYPES_H */ |
diff --git a/arch/sparc/include/asm/processor.h b/arch/sparc/include/asm/processor.h index 9da9646bf6c6..2fe99e66e760 100644 --- a/arch/sparc/include/asm/processor.h +++ b/arch/sparc/include/asm/processor.h | |||
@@ -5,4 +5,7 @@ | |||
5 | #else | 5 | #else |
6 | #include <asm/processor_32.h> | 6 | #include <asm/processor_32.h> |
7 | #endif | 7 | #endif |
8 | |||
9 | #define nop() __asm__ __volatile__ ("nop") | ||
10 | |||
8 | #endif | 11 | #endif |
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h index 59fcebb8f440..e713db249931 100644 --- a/arch/sparc/include/asm/processor_64.h +++ b/arch/sparc/include/asm/processor_64.h | |||
@@ -18,6 +18,9 @@ | |||
18 | #include <asm/ptrace.h> | 18 | #include <asm/ptrace.h> |
19 | #include <asm/page.h> | 19 | #include <asm/page.h> |
20 | 20 | ||
21 | /* Don't hold the runqueue lock over context switch */ | ||
22 | #define __ARCH_WANT_UNLOCKED_CTXSW | ||
23 | |||
21 | /* The sparc has no problems with write protection */ | 24 | /* The sparc has no problems with write protection */ |
22 | #define wp_works_ok 1 | 25 | #define wp_works_ok 1 |
23 | #define wp_works_ok__is_a_macro /* for versions in ksyms.c */ | 26 | #define wp_works_ok__is_a_macro /* for versions in ksyms.c */ |
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h index edd3d3cde460..c28765110706 100644 --- a/arch/sparc/include/asm/prom.h +++ b/arch/sparc/include/asm/prom.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/proc_fs.h> | 22 | #include <linux/proc_fs.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/atomic.h> | 24 | #include <linux/atomic.h> |
25 | #include <linux/irqdomain.h> | ||
25 | 26 | ||
26 | #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2 | 27 | #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2 |
27 | #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 | 28 | #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 |
@@ -55,15 +56,6 @@ struct resource; | |||
55 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); | 56 | extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); |
56 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); | 57 | extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); |
57 | 58 | ||
58 | /* These routines are here to provide compatibility with how powerpc | ||
59 | * handles IRQ mapping for OF device nodes. We precompute and permanently | ||
60 | * register them in the platform_device objects, whereas powerpc computes them | ||
61 | * on request. | ||
62 | */ | ||
63 | static inline void irq_dispose_mapping(unsigned int virq) | ||
64 | { | ||
65 | } | ||
66 | |||
67 | extern struct device_node *of_console_device; | 59 | extern struct device_node *of_console_device; |
68 | extern char *of_console_path; | 60 | extern char *of_console_path; |
69 | extern char *of_console_options; | 61 | extern char *of_console_options; |
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h index c00c3b5c2806..fd9c3f21cbf0 100644 --- a/arch/sparc/include/asm/ptrace.h +++ b/arch/sparc/include/asm/ptrace.h | |||
@@ -98,6 +98,8 @@ struct sparc_trapf { | |||
98 | */ | 98 | */ |
99 | #ifndef __ASSEMBLY__ | 99 | #ifndef __ASSEMBLY__ |
100 | 100 | ||
101 | #include <linux/types.h> | ||
102 | |||
101 | struct pt_regs { | 103 | struct pt_regs { |
102 | unsigned long psr; | 104 | unsigned long psr; |
103 | unsigned long pc; | 105 | unsigned long pc; |
@@ -163,7 +165,7 @@ struct sparc_stackf { | |||
163 | #ifdef __KERNEL__ | 165 | #ifdef __KERNEL__ |
164 | 166 | ||
165 | #include <linux/threads.h> | 167 | #include <linux/threads.h> |
166 | #include <asm/system.h> | 168 | #include <asm/switch_to.h> |
167 | 169 | ||
168 | static inline int pt_regs_trap_type(struct pt_regs *regs) | 170 | static inline int pt_regs_trap_type(struct pt_regs *regs) |
169 | { | 171 | { |
@@ -239,8 +241,7 @@ extern unsigned long profile_pc(struct pt_regs *); | |||
239 | #ifndef __ASSEMBLY__ | 241 | #ifndef __ASSEMBLY__ |
240 | 242 | ||
241 | #ifdef __KERNEL__ | 243 | #ifdef __KERNEL__ |
242 | 244 | #include <asm/switch_to.h> | |
243 | #include <asm/system.h> | ||
244 | 245 | ||
245 | static inline bool pt_regs_is_syscall(struct pt_regs *regs) | 246 | static inline bool pt_regs_is_syscall(struct pt_regs *regs) |
246 | { | 247 | { |
diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h index 64718ba26434..00497abec996 100644 --- a/arch/sparc/include/asm/setup.h +++ b/arch/sparc/include/asm/setup.h | |||
@@ -13,14 +13,30 @@ | |||
13 | 13 | ||
14 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
15 | 15 | ||
16 | extern char reboot_command[]; | ||
17 | |||
16 | #ifdef CONFIG_SPARC32 | 18 | #ifdef CONFIG_SPARC32 |
17 | /* The CPU that was used for booting | 19 | /* The CPU that was used for booting |
18 | * Only sun4d + leon may have boot_cpu_id != 0 | 20 | * Only sun4d + leon may have boot_cpu_id != 0 |
19 | */ | 21 | */ |
20 | extern unsigned char boot_cpu_id; | 22 | extern unsigned char boot_cpu_id; |
21 | extern unsigned char boot_cpu_id4; | 23 | extern unsigned char boot_cpu_id4; |
24 | |||
25 | extern unsigned long empty_bad_page; | ||
26 | extern unsigned long empty_bad_page_table; | ||
27 | extern unsigned long empty_zero_page; | ||
28 | |||
29 | extern int serial_console; | ||
30 | static inline int con_is_present(void) | ||
31 | { | ||
32 | return serial_console ? 0 : 1; | ||
33 | } | ||
22 | #endif | 34 | #endif |
23 | 35 | ||
36 | extern void sun_do_break(void); | ||
37 | extern int stop_a_enabled; | ||
38 | extern int scons_pwroff; | ||
39 | |||
24 | #endif /* __KERNEL__ */ | 40 | #endif /* __KERNEL__ */ |
25 | 41 | ||
26 | #endif /* _SPARC_SETUP_H */ | 42 | #endif /* _SPARC_SETUP_H */ |
diff --git a/arch/sparc/include/asm/socket.h b/arch/sparc/include/asm/socket.h index 8af1b64168b3..bea1568ae4af 100644 --- a/arch/sparc/include/asm/socket.h +++ b/arch/sparc/include/asm/socket.h | |||
@@ -60,6 +60,11 @@ | |||
60 | 60 | ||
61 | #define SO_WIFI_STATUS 0x0025 | 61 | #define SO_WIFI_STATUS 0x0025 |
62 | #define SCM_WIFI_STATUS SO_WIFI_STATUS | 62 | #define SCM_WIFI_STATUS SO_WIFI_STATUS |
63 | #define SO_PEEK_OFF 0x0026 | ||
64 | |||
65 | /* Instruct lower device to use last 4-bytes of skb data as FCS */ | ||
66 | #define SO_NOFCS 0x0027 | ||
67 | |||
63 | 68 | ||
64 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | 69 | /* Security levels - as per NRL IPv6 - don't actually do anything */ |
65 | #define SO_SECURITY_AUTHENTICATION 0x5001 | 70 | #define SO_SECURITY_AUTHENTICATION 0x5001 |
diff --git a/arch/sparc/include/asm/switch_to.h b/arch/sparc/include/asm/switch_to.h new file mode 100644 index 000000000000..2dc4fa5c6f8c --- /dev/null +++ b/arch/sparc/include/asm/switch_to.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef ___ASM_SPARC_SWITCH_TO_H | ||
2 | #define ___ASM_SPARC_SWITCH_TO_H | ||
3 | #if defined(__sparc__) && defined(__arch64__) | ||
4 | #include <asm/switch_to_64.h> | ||
5 | #else | ||
6 | #include <asm/switch_to_32.h> | ||
7 | #endif | ||
8 | #endif | ||
diff --git a/arch/sparc/include/asm/switch_to_32.h b/arch/sparc/include/asm/switch_to_32.h new file mode 100644 index 000000000000..e32e82b76eed --- /dev/null +++ b/arch/sparc/include/asm/switch_to_32.h | |||
@@ -0,0 +1,106 @@ | |||
1 | #ifndef __SPARC_SWITCH_TO_H | ||
2 | #define __SPARC_SWITCH_TO_H | ||
3 | |||
4 | #include <asm/smp.h> | ||
5 | |||
6 | extern struct thread_info *current_set[NR_CPUS]; | ||
7 | |||
8 | /* | ||
9 | * Flush windows so that the VM switch which follows | ||
10 | * would not pull the stack from under us. | ||
11 | * | ||
12 | * SWITCH_ENTER and SWITH_DO_LAZY_FPU do not work yet (e.g. SMP does not work) | ||
13 | * XXX WTF is the above comment? Found in late teen 2.4.x. | ||
14 | */ | ||
15 | #ifdef CONFIG_SMP | ||
16 | #define SWITCH_ENTER(prv) \ | ||
17 | do { \ | ||
18 | if (test_tsk_thread_flag(prv, TIF_USEDFPU)) { \ | ||
19 | put_psr(get_psr() | PSR_EF); \ | ||
20 | fpsave(&(prv)->thread.float_regs[0], &(prv)->thread.fsr, \ | ||
21 | &(prv)->thread.fpqueue[0], &(prv)->thread.fpqdepth); \ | ||
22 | clear_tsk_thread_flag(prv, TIF_USEDFPU); \ | ||
23 | (prv)->thread.kregs->psr &= ~PSR_EF; \ | ||
24 | } \ | ||
25 | } while(0) | ||
26 | |||
27 | #define SWITCH_DO_LAZY_FPU(next) /* */ | ||
28 | #else | ||
29 | #define SWITCH_ENTER(prv) /* */ | ||
30 | #define SWITCH_DO_LAZY_FPU(nxt) \ | ||
31 | do { \ | ||
32 | if (last_task_used_math != (nxt)) \ | ||
33 | (nxt)->thread.kregs->psr&=~PSR_EF; \ | ||
34 | } while(0) | ||
35 | #endif | ||
36 | |||
37 | #define prepare_arch_switch(next) do { \ | ||
38 | __asm__ __volatile__( \ | ||
39 | ".globl\tflush_patch_switch\nflush_patch_switch:\n\t" \ | ||
40 | "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ | ||
41 | "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ | ||
42 | "save %sp, -0x40, %sp\n\t" \ | ||
43 | "restore; restore; restore; restore; restore; restore; restore"); \ | ||
44 | } while(0) | ||
45 | |||
46 | /* Much care has gone into this code, do not touch it. | ||
47 | * | ||
48 | * We need to loadup regs l0/l1 for the newly forked child | ||
49 | * case because the trap return path relies on those registers | ||
50 | * holding certain values, gcc is told that they are clobbered. | ||
51 | * Gcc needs registers for 3 values in and 1 value out, so we | ||
52 | * clobber every non-fixed-usage register besides l2/l3/o4/o5. -DaveM | ||
53 | * | ||
54 | * Hey Dave, that do not touch sign is too much of an incentive | ||
55 | * - Anton & Pete | ||
56 | */ | ||
57 | #define switch_to(prev, next, last) do { \ | ||
58 | SWITCH_ENTER(prev); \ | ||
59 | SWITCH_DO_LAZY_FPU(next); \ | ||
60 | cpumask_set_cpu(smp_processor_id(), mm_cpumask(next->active_mm)); \ | ||
61 | __asm__ __volatile__( \ | ||
62 | "sethi %%hi(here - 0x8), %%o7\n\t" \ | ||
63 | "mov %%g6, %%g3\n\t" \ | ||
64 | "or %%o7, %%lo(here - 0x8), %%o7\n\t" \ | ||
65 | "rd %%psr, %%g4\n\t" \ | ||
66 | "std %%sp, [%%g6 + %4]\n\t" \ | ||
67 | "rd %%wim, %%g5\n\t" \ | ||
68 | "wr %%g4, 0x20, %%psr\n\t" \ | ||
69 | "nop\n\t" \ | ||
70 | "std %%g4, [%%g6 + %3]\n\t" \ | ||
71 | "ldd [%2 + %3], %%g4\n\t" \ | ||
72 | "mov %2, %%g6\n\t" \ | ||
73 | ".globl patchme_store_new_current\n" \ | ||
74 | "patchme_store_new_current:\n\t" \ | ||
75 | "st %2, [%1]\n\t" \ | ||
76 | "wr %%g4, 0x20, %%psr\n\t" \ | ||
77 | "nop\n\t" \ | ||
78 | "nop\n\t" \ | ||
79 | "nop\n\t" /* LEON needs all 3 nops: load to %sp depends on CWP. */ \ | ||
80 | "ldd [%%g6 + %4], %%sp\n\t" \ | ||
81 | "wr %%g5, 0x0, %%wim\n\t" \ | ||
82 | "ldd [%%sp + 0x00], %%l0\n\t" \ | ||
83 | "ldd [%%sp + 0x38], %%i6\n\t" \ | ||
84 | "wr %%g4, 0x0, %%psr\n\t" \ | ||
85 | "nop\n\t" \ | ||
86 | "nop\n\t" \ | ||
87 | "jmpl %%o7 + 0x8, %%g0\n\t" \ | ||
88 | " ld [%%g3 + %5], %0\n\t" \ | ||
89 | "here:\n" \ | ||
90 | : "=&r" (last) \ | ||
91 | : "r" (&(current_set[hard_smp_processor_id()])), \ | ||
92 | "r" (task_thread_info(next)), \ | ||
93 | "i" (TI_KPSR), \ | ||
94 | "i" (TI_KSP), \ | ||
95 | "i" (TI_TASK) \ | ||
96 | : "g1", "g2", "g3", "g4", "g5", "g7", \ | ||
97 | "l0", "l1", "l3", "l4", "l5", "l6", "l7", \ | ||
98 | "i0", "i1", "i2", "i3", "i4", "i5", \ | ||
99 | "o0", "o1", "o2", "o3", "o7"); \ | ||
100 | } while(0) | ||
101 | |||
102 | extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | ||
103 | void *fpqueue, unsigned long *fpqdepth); | ||
104 | extern void synchronize_user_stack(void); | ||
105 | |||
106 | #endif /* __SPARC_SWITCH_TO_H */ | ||
diff --git a/arch/sparc/include/asm/switch_to_64.h b/arch/sparc/include/asm/switch_to_64.h new file mode 100644 index 000000000000..7923c4a2be38 --- /dev/null +++ b/arch/sparc/include/asm/switch_to_64.h | |||
@@ -0,0 +1,72 @@ | |||
1 | #ifndef __SPARC64_SWITCH_TO_64_H | ||
2 | #define __SPARC64_SWITCH_TO_64_H | ||
3 | |||
4 | #include <asm/visasm.h> | ||
5 | |||
6 | #define prepare_arch_switch(next) \ | ||
7 | do { \ | ||
8 | flushw_all(); \ | ||
9 | } while (0) | ||
10 | |||
11 | /* See what happens when you design the chip correctly? | ||
12 | * | ||
13 | * We tell gcc we clobber all non-fixed-usage registers except | ||
14 | * for l0/l1. It will use one for 'next' and the other to hold | ||
15 | * the output value of 'last'. 'next' is not referenced again | ||
16 | * past the invocation of switch_to in the scheduler, so we need | ||
17 | * not preserve it's value. Hairy, but it lets us remove 2 loads | ||
18 | * and 2 stores in this critical code path. -DaveM | ||
19 | */ | ||
20 | #define switch_to(prev, next, last) \ | ||
21 | do { flush_tlb_pending(); \ | ||
22 | save_and_clear_fpu(); \ | ||
23 | /* If you are tempted to conditionalize the following */ \ | ||
24 | /* so that ASI is only written if it changes, think again. */ \ | ||
25 | __asm__ __volatile__("wr %%g0, %0, %%asi" \ | ||
26 | : : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\ | ||
27 | trap_block[current_thread_info()->cpu].thread = \ | ||
28 | task_thread_info(next); \ | ||
29 | __asm__ __volatile__( \ | ||
30 | "mov %%g4, %%g7\n\t" \ | ||
31 | "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \ | ||
32 | "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \ | ||
33 | "rdpr %%wstate, %%o5\n\t" \ | ||
34 | "stx %%o6, [%%g6 + %6]\n\t" \ | ||
35 | "stb %%o5, [%%g6 + %5]\n\t" \ | ||
36 | "rdpr %%cwp, %%o5\n\t" \ | ||
37 | "stb %%o5, [%%g6 + %8]\n\t" \ | ||
38 | "wrpr %%g0, 15, %%pil\n\t" \ | ||
39 | "mov %4, %%g6\n\t" \ | ||
40 | "ldub [%4 + %8], %%g1\n\t" \ | ||
41 | "wrpr %%g1, %%cwp\n\t" \ | ||
42 | "ldx [%%g6 + %6], %%o6\n\t" \ | ||
43 | "ldub [%%g6 + %5], %%o5\n\t" \ | ||
44 | "ldub [%%g6 + %7], %%o7\n\t" \ | ||
45 | "wrpr %%o5, 0x0, %%wstate\n\t" \ | ||
46 | "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ | ||
47 | "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ | ||
48 | "ldx [%%g6 + %9], %%g4\n\t" \ | ||
49 | "wrpr %%g0, 14, %%pil\n\t" \ | ||
50 | "brz,pt %%o7, switch_to_pc\n\t" \ | ||
51 | " mov %%g7, %0\n\t" \ | ||
52 | "sethi %%hi(ret_from_syscall), %%g1\n\t" \ | ||
53 | "jmpl %%g1 + %%lo(ret_from_syscall), %%g0\n\t" \ | ||
54 | " nop\n\t" \ | ||
55 | ".globl switch_to_pc\n\t" \ | ||
56 | "switch_to_pc:\n\t" \ | ||
57 | : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \ | ||
58 | "=r" (__local_per_cpu_offset) \ | ||
59 | : "0" (task_thread_info(next)), \ | ||
60 | "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \ | ||
61 | "i" (TI_CWP), "i" (TI_TASK) \ | ||
62 | : "cc", \ | ||
63 | "g1", "g2", "g3", "g7", \ | ||
64 | "l1", "l2", "l3", "l4", "l5", "l6", "l7", \ | ||
65 | "i0", "i1", "i2", "i3", "i4", "i5", \ | ||
66 | "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \ | ||
67 | } while(0) | ||
68 | |||
69 | extern void synchronize_user_stack(void); | ||
70 | extern void fault_in_user_windows(void); | ||
71 | |||
72 | #endif /* __SPARC64_SWITCH_TO_64_H */ | ||
diff --git a/arch/sparc/include/asm/system.h b/arch/sparc/include/asm/system.h deleted file mode 100644 index 7944a7cfc996..000000000000 --- a/arch/sparc/include/asm/system.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #ifndef ___ASM_SPARC_SYSTEM_H | ||
2 | #define ___ASM_SPARC_SYSTEM_H | ||
3 | #if defined(__sparc__) && defined(__arch64__) | ||
4 | #include <asm/system_64.h> | ||
5 | #else | ||
6 | #include <asm/system_32.h> | ||
7 | #endif | ||
8 | #endif | ||
diff --git a/arch/sparc/include/asm/system_32.h b/arch/sparc/include/asm/system_32.h deleted file mode 100644 index aba16092a81b..000000000000 --- a/arch/sparc/include/asm/system_32.h +++ /dev/null | |||
@@ -1,284 +0,0 @@ | |||
1 | #ifndef __SPARC_SYSTEM_H | ||
2 | #define __SPARC_SYSTEM_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/threads.h> /* NR_CPUS */ | ||
6 | #include <linux/thread_info.h> | ||
7 | |||
8 | #include <asm/page.h> | ||
9 | #include <asm/psr.h> | ||
10 | #include <asm/ptrace.h> | ||
11 | #include <asm/btfixup.h> | ||
12 | #include <asm/smp.h> | ||
13 | |||
14 | #ifndef __ASSEMBLY__ | ||
15 | |||
16 | #include <linux/irqflags.h> | ||
17 | |||
18 | /* | ||
19 | * Sparc (general) CPU types | ||
20 | */ | ||
21 | enum sparc_cpu { | ||
22 | sun4 = 0x00, | ||
23 | sun4c = 0x01, | ||
24 | sun4m = 0x02, | ||
25 | sun4d = 0x03, | ||
26 | sun4e = 0x04, | ||
27 | sun4u = 0x05, /* V8 ploos ploos */ | ||
28 | sun_unknown = 0x06, | ||
29 | ap1000 = 0x07, /* almost a sun4m */ | ||
30 | sparc_leon = 0x08, /* Leon SoC */ | ||
31 | }; | ||
32 | |||
33 | /* Really, userland should not be looking at any of this... */ | ||
34 | #ifdef __KERNEL__ | ||
35 | |||
36 | extern enum sparc_cpu sparc_cpu_model; | ||
37 | |||
38 | #define ARCH_SUN4C (sparc_cpu_model==sun4c) | ||
39 | |||
40 | #define SUN4M_NCPUS 4 /* Architectural limit of sun4m. */ | ||
41 | |||
42 | extern char reboot_command[]; | ||
43 | |||
44 | extern struct thread_info *current_set[NR_CPUS]; | ||
45 | |||
46 | extern unsigned long empty_bad_page; | ||
47 | extern unsigned long empty_bad_page_table; | ||
48 | extern unsigned long empty_zero_page; | ||
49 | |||
50 | extern void sun_do_break(void); | ||
51 | extern int serial_console; | ||
52 | extern int stop_a_enabled; | ||
53 | extern int scons_pwroff; | ||
54 | |||
55 | static inline int con_is_present(void) | ||
56 | { | ||
57 | return serial_console ? 0 : 1; | ||
58 | } | ||
59 | |||
60 | /* When a context switch happens we must flush all user windows so that | ||
61 | * the windows of the current process are flushed onto its stack. This | ||
62 | * way the windows are all clean for the next process and the stack | ||
63 | * frames are up to date. | ||
64 | */ | ||
65 | extern void flush_user_windows(void); | ||
66 | extern void kill_user_windows(void); | ||
67 | extern void synchronize_user_stack(void); | ||
68 | extern void fpsave(unsigned long *fpregs, unsigned long *fsr, | ||
69 | void *fpqueue, unsigned long *fpqdepth); | ||
70 | |||
71 | #ifdef CONFIG_SMP | ||
72 | #define SWITCH_ENTER(prv) \ | ||
73 | do { \ | ||
74 | if (test_tsk_thread_flag(prv, TIF_USEDFPU)) { \ | ||
75 | put_psr(get_psr() | PSR_EF); \ | ||
76 | fpsave(&(prv)->thread.float_regs[0], &(prv)->thread.fsr, \ | ||
77 | &(prv)->thread.fpqueue[0], &(prv)->thread.fpqdepth); \ | ||
78 | clear_tsk_thread_flag(prv, TIF_USEDFPU); \ | ||
79 | (prv)->thread.kregs->psr &= ~PSR_EF; \ | ||
80 | } \ | ||
81 | } while(0) | ||
82 | |||
83 | #define SWITCH_DO_LAZY_FPU(next) /* */ | ||
84 | #else | ||
85 | #define SWITCH_ENTER(prv) /* */ | ||
86 | #define SWITCH_DO_LAZY_FPU(nxt) \ | ||
87 | do { \ | ||
88 | if (last_task_used_math != (nxt)) \ | ||
89 | (nxt)->thread.kregs->psr&=~PSR_EF; \ | ||
90 | } while(0) | ||
91 | #endif | ||
92 | |||
93 | extern void flushw_all(void); | ||
94 | |||
95 | /* | ||
96 | * Flush windows so that the VM switch which follows | ||
97 | * would not pull the stack from under us. | ||
98 | * | ||
99 | * SWITCH_ENTER and SWITH_DO_LAZY_FPU do not work yet (e.g. SMP does not work) | ||
100 | * XXX WTF is the above comment? Found in late teen 2.4.x. | ||
101 | */ | ||
102 | #define prepare_arch_switch(next) do { \ | ||
103 | __asm__ __volatile__( \ | ||
104 | ".globl\tflush_patch_switch\nflush_patch_switch:\n\t" \ | ||
105 | "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ | ||
106 | "save %sp, -0x40, %sp; save %sp, -0x40, %sp; save %sp, -0x40, %sp\n\t" \ | ||
107 | "save %sp, -0x40, %sp\n\t" \ | ||
108 | "restore; restore; restore; restore; restore; restore; restore"); \ | ||
109 | } while(0) | ||
110 | |||
111 | /* Much care has gone into this code, do not touch it. | ||
112 | * | ||
113 | * We need to loadup regs l0/l1 for the newly forked child | ||
114 | * case because the trap return path relies on those registers | ||
115 | * holding certain values, gcc is told that they are clobbered. | ||
116 | * Gcc needs registers for 3 values in and 1 value out, so we | ||
117 | * clobber every non-fixed-usage register besides l2/l3/o4/o5. -DaveM | ||
118 | * | ||
119 | * Hey Dave, that do not touch sign is too much of an incentive | ||
120 | * - Anton & Pete | ||
121 | */ | ||
122 | #define switch_to(prev, next, last) do { \ | ||
123 | SWITCH_ENTER(prev); \ | ||
124 | SWITCH_DO_LAZY_FPU(next); \ | ||
125 | cpumask_set_cpu(smp_processor_id(), mm_cpumask(next->active_mm)); \ | ||
126 | __asm__ __volatile__( \ | ||
127 | "sethi %%hi(here - 0x8), %%o7\n\t" \ | ||
128 | "mov %%g6, %%g3\n\t" \ | ||
129 | "or %%o7, %%lo(here - 0x8), %%o7\n\t" \ | ||
130 | "rd %%psr, %%g4\n\t" \ | ||
131 | "std %%sp, [%%g6 + %4]\n\t" \ | ||
132 | "rd %%wim, %%g5\n\t" \ | ||
133 | "wr %%g4, 0x20, %%psr\n\t" \ | ||
134 | "nop\n\t" \ | ||
135 | "std %%g4, [%%g6 + %3]\n\t" \ | ||
136 | "ldd [%2 + %3], %%g4\n\t" \ | ||
137 | "mov %2, %%g6\n\t" \ | ||
138 | ".globl patchme_store_new_current\n" \ | ||
139 | "patchme_store_new_current:\n\t" \ | ||
140 | "st %2, [%1]\n\t" \ | ||
141 | "wr %%g4, 0x20, %%psr\n\t" \ | ||
142 | "nop\n\t" \ | ||
143 | "nop\n\t" \ | ||
144 | "nop\n\t" /* LEON needs all 3 nops: load to %sp depends on CWP. */ \ | ||
145 | "ldd [%%g6 + %4], %%sp\n\t" \ | ||
146 | "wr %%g5, 0x0, %%wim\n\t" \ | ||
147 | "ldd [%%sp + 0x00], %%l0\n\t" \ | ||
148 | "ldd [%%sp + 0x38], %%i6\n\t" \ | ||
149 | "wr %%g4, 0x0, %%psr\n\t" \ | ||
150 | "nop\n\t" \ | ||
151 | "nop\n\t" \ | ||
152 | "jmpl %%o7 + 0x8, %%g0\n\t" \ | ||
153 | " ld [%%g3 + %5], %0\n\t" \ | ||
154 | "here:\n" \ | ||
155 | : "=&r" (last) \ | ||
156 | : "r" (&(current_set[hard_smp_processor_id()])), \ | ||
157 | "r" (task_thread_info(next)), \ | ||
158 | "i" (TI_KPSR), \ | ||
159 | "i" (TI_KSP), \ | ||
160 | "i" (TI_TASK) \ | ||
161 | : "g1", "g2", "g3", "g4", "g5", "g7", \ | ||
162 | "l0", "l1", "l3", "l4", "l5", "l6", "l7", \ | ||
163 | "i0", "i1", "i2", "i3", "i4", "i5", \ | ||
164 | "o0", "o1", "o2", "o3", "o7"); \ | ||
165 | } while(0) | ||
166 | |||
167 | /* XXX Change this if we ever use a PSO mode kernel. */ | ||
168 | #define mb() __asm__ __volatile__ ("" : : : "memory") | ||
169 | #define rmb() mb() | ||
170 | #define wmb() mb() | ||
171 | #define read_barrier_depends() do { } while(0) | ||
172 | #define set_mb(__var, __value) do { __var = __value; mb(); } while(0) | ||
173 | #define smp_mb() __asm__ __volatile__("":::"memory") | ||
174 | #define smp_rmb() __asm__ __volatile__("":::"memory") | ||
175 | #define smp_wmb() __asm__ __volatile__("":::"memory") | ||
176 | #define smp_read_barrier_depends() do { } while(0) | ||
177 | |||
178 | #define nop() __asm__ __volatile__ ("nop") | ||
179 | |||
180 | /* This has special calling conventions */ | ||
181 | #ifndef CONFIG_SMP | ||
182 | BTFIXUPDEF_CALL(void, ___xchg32, void) | ||
183 | #endif | ||
184 | |||
185 | static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) | ||
186 | { | ||
187 | #ifdef CONFIG_SMP | ||
188 | __asm__ __volatile__("swap [%2], %0" | ||
189 | : "=&r" (val) | ||
190 | : "0" (val), "r" (m) | ||
191 | : "memory"); | ||
192 | return val; | ||
193 | #else | ||
194 | register unsigned long *ptr asm("g1"); | ||
195 | register unsigned long ret asm("g2"); | ||
196 | |||
197 | ptr = (unsigned long *) m; | ||
198 | ret = val; | ||
199 | |||
200 | /* Note: this is magic and the nop there is | ||
201 | really needed. */ | ||
202 | __asm__ __volatile__( | ||
203 | "mov %%o7, %%g4\n\t" | ||
204 | "call ___f____xchg32\n\t" | ||
205 | " nop\n\t" | ||
206 | : "=&r" (ret) | ||
207 | : "0" (ret), "r" (ptr) | ||
208 | : "g3", "g4", "g7", "memory", "cc"); | ||
209 | |||
210 | return ret; | ||
211 | #endif | ||
212 | } | ||
213 | |||
214 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
215 | |||
216 | extern void __xchg_called_with_bad_pointer(void); | ||
217 | |||
218 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) | ||
219 | { | ||
220 | switch (size) { | ||
221 | case 4: | ||
222 | return xchg_u32(ptr, x); | ||
223 | } | ||
224 | __xchg_called_with_bad_pointer(); | ||
225 | return x; | ||
226 | } | ||
227 | |||
228 | /* Emulate cmpxchg() the same way we emulate atomics, | ||
229 | * by hashing the object address and indexing into an array | ||
230 | * of spinlocks to get a bit of performance... | ||
231 | * | ||
232 | * See arch/sparc/lib/atomic32.c for implementation. | ||
233 | * | ||
234 | * Cribbed from <asm-parisc/atomic.h> | ||
235 | */ | ||
236 | #define __HAVE_ARCH_CMPXCHG 1 | ||
237 | |||
238 | /* bug catcher for when unsupported size is used - won't link */ | ||
239 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
240 | /* we only need to support cmpxchg of a u32 on sparc */ | ||
241 | extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); | ||
242 | |||
243 | /* don't worry...optimizer will get rid of most of this */ | ||
244 | static inline unsigned long | ||
245 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) | ||
246 | { | ||
247 | switch (size) { | ||
248 | case 4: | ||
249 | return __cmpxchg_u32((u32 *)ptr, (u32)old, (u32)new_); | ||
250 | default: | ||
251 | __cmpxchg_called_with_bad_pointer(); | ||
252 | break; | ||
253 | } | ||
254 | return old; | ||
255 | } | ||
256 | |||
257 | #define cmpxchg(ptr, o, n) \ | ||
258 | ({ \ | ||
259 | __typeof__(*(ptr)) _o_ = (o); \ | ||
260 | __typeof__(*(ptr)) _n_ = (n); \ | ||
261 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
262 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
263 | }) | ||
264 | |||
265 | #include <asm-generic/cmpxchg-local.h> | ||
266 | |||
267 | /* | ||
268 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
269 | * them available. | ||
270 | */ | ||
271 | #define cmpxchg_local(ptr, o, n) \ | ||
272 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ | ||
273 | (unsigned long)(n), sizeof(*(ptr)))) | ||
274 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
275 | |||
276 | extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); | ||
277 | |||
278 | #endif /* __KERNEL__ */ | ||
279 | |||
280 | #endif /* __ASSEMBLY__ */ | ||
281 | |||
282 | #define arch_align_stack(x) (x) | ||
283 | |||
284 | #endif /* !(__SPARC_SYSTEM_H) */ | ||
diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h deleted file mode 100644 index 10bcabce97b2..000000000000 --- a/arch/sparc/include/asm/system_64.h +++ /dev/null | |||
@@ -1,331 +0,0 @@ | |||
1 | #ifndef __SPARC64_SYSTEM_H | ||
2 | #define __SPARC64_SYSTEM_H | ||
3 | |||
4 | #include <asm/ptrace.h> | ||
5 | #include <asm/processor.h> | ||
6 | #include <asm/visasm.h> | ||
7 | |||
8 | #ifndef __ASSEMBLY__ | ||
9 | |||
10 | #include <linux/irqflags.h> | ||
11 | #include <asm-generic/cmpxchg-local.h> | ||
12 | |||
13 | /* | ||
14 | * Sparc (general) CPU types | ||
15 | */ | ||
16 | enum sparc_cpu { | ||
17 | sun4 = 0x00, | ||
18 | sun4c = 0x01, | ||
19 | sun4m = 0x02, | ||
20 | sun4d = 0x03, | ||
21 | sun4e = 0x04, | ||
22 | sun4u = 0x05, /* V8 ploos ploos */ | ||
23 | sun_unknown = 0x06, | ||
24 | ap1000 = 0x07, /* almost a sun4m */ | ||
25 | }; | ||
26 | |||
27 | #define sparc_cpu_model sun4u | ||
28 | |||
29 | /* This cannot ever be a sun4c :) That's just history. */ | ||
30 | #define ARCH_SUN4C 0 | ||
31 | |||
32 | extern char reboot_command[]; | ||
33 | |||
34 | /* These are here in an effort to more fully work around Spitfire Errata | ||
35 | * #51. Essentially, if a memory barrier occurs soon after a mispredicted | ||
36 | * branch, the chip can stop executing instructions until a trap occurs. | ||
37 | * Therefore, if interrupts are disabled, the chip can hang forever. | ||
38 | * | ||
39 | * It used to be believed that the memory barrier had to be right in the | ||
40 | * delay slot, but a case has been traced recently wherein the memory barrier | ||
41 | * was one instruction after the branch delay slot and the chip still hung. | ||
42 | * The offending sequence was the following in sym_wakeup_done() of the | ||
43 | * sym53c8xx_2 driver: | ||
44 | * | ||
45 | * call sym_ccb_from_dsa, 0 | ||
46 | * movge %icc, 0, %l0 | ||
47 | * brz,pn %o0, .LL1303 | ||
48 | * mov %o0, %l2 | ||
49 | * membar #LoadLoad | ||
50 | * | ||
51 | * The branch has to be mispredicted for the bug to occur. Therefore, we put | ||
52 | * the memory barrier explicitly into a "branch always, predicted taken" | ||
53 | * delay slot to avoid the problem case. | ||
54 | */ | ||
55 | #define membar_safe(type) \ | ||
56 | do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ | ||
57 | " membar " type "\n" \ | ||
58 | "1:\n" \ | ||
59 | : : : "memory"); \ | ||
60 | } while (0) | ||
61 | |||
62 | /* The kernel always executes in TSO memory model these days, | ||
63 | * and furthermore most sparc64 chips implement more stringent | ||
64 | * memory ordering than required by the specifications. | ||
65 | */ | ||
66 | #define mb() membar_safe("#StoreLoad") | ||
67 | #define rmb() __asm__ __volatile__("":::"memory") | ||
68 | #define wmb() __asm__ __volatile__("":::"memory") | ||
69 | |||
70 | #endif | ||
71 | |||
72 | #define nop() __asm__ __volatile__ ("nop") | ||
73 | |||
74 | #define read_barrier_depends() do { } while(0) | ||
75 | #define set_mb(__var, __value) \ | ||
76 | do { __var = __value; membar_safe("#StoreLoad"); } while(0) | ||
77 | |||
78 | #ifdef CONFIG_SMP | ||
79 | #define smp_mb() mb() | ||
80 | #define smp_rmb() rmb() | ||
81 | #define smp_wmb() wmb() | ||
82 | #else | ||
83 | #define smp_mb() __asm__ __volatile__("":::"memory") | ||
84 | #define smp_rmb() __asm__ __volatile__("":::"memory") | ||
85 | #define smp_wmb() __asm__ __volatile__("":::"memory") | ||
86 | #endif | ||
87 | |||
88 | #define smp_read_barrier_depends() do { } while(0) | ||
89 | |||
90 | #define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") | ||
91 | |||
92 | #define flushw_all() __asm__ __volatile__("flushw") | ||
93 | |||
94 | /* Performance counter register access. */ | ||
95 | #define read_pcr(__p) __asm__ __volatile__("rd %%pcr, %0" : "=r" (__p)) | ||
96 | #define write_pcr(__p) __asm__ __volatile__("wr %0, 0x0, %%pcr" : : "r" (__p)) | ||
97 | #define read_pic(__p) __asm__ __volatile__("rd %%pic, %0" : "=r" (__p)) | ||
98 | |||
99 | /* Blackbird errata workaround. See commentary in | ||
100 | * arch/sparc64/kernel/smp.c:smp_percpu_timer_interrupt() | ||
101 | * for more information. | ||
102 | */ | ||
103 | #define write_pic(__p) \ | ||
104 | __asm__ __volatile__("ba,pt %%xcc, 99f\n\t" \ | ||
105 | " nop\n\t" \ | ||
106 | ".align 64\n" \ | ||
107 | "99:wr %0, 0x0, %%pic\n\t" \ | ||
108 | "rd %%pic, %%g0" : : "r" (__p)) | ||
109 | #define reset_pic() write_pic(0) | ||
110 | |||
111 | #ifndef __ASSEMBLY__ | ||
112 | |||
113 | extern void sun_do_break(void); | ||
114 | extern int stop_a_enabled; | ||
115 | extern int scons_pwroff; | ||
116 | |||
117 | extern void fault_in_user_windows(void); | ||
118 | extern void synchronize_user_stack(void); | ||
119 | |||
120 | extern void __flushw_user(void); | ||
121 | #define flushw_user() __flushw_user() | ||
122 | |||
123 | #define flush_user_windows flushw_user | ||
124 | #define flush_register_windows flushw_all | ||
125 | |||
126 | /* Don't hold the runqueue lock over context switch */ | ||
127 | #define __ARCH_WANT_UNLOCKED_CTXSW | ||
128 | #define prepare_arch_switch(next) \ | ||
129 | do { \ | ||
130 | flushw_all(); \ | ||
131 | } while (0) | ||
132 | |||
133 | /* See what happens when you design the chip correctly? | ||
134 | * | ||
135 | * We tell gcc we clobber all non-fixed-usage registers except | ||
136 | * for l0/l1. It will use one for 'next' and the other to hold | ||
137 | * the output value of 'last'. 'next' is not referenced again | ||
138 | * past the invocation of switch_to in the scheduler, so we need | ||
139 | * not preserve it's value. Hairy, but it lets us remove 2 loads | ||
140 | * and 2 stores in this critical code path. -DaveM | ||
141 | */ | ||
142 | #define switch_to(prev, next, last) \ | ||
143 | do { flush_tlb_pending(); \ | ||
144 | save_and_clear_fpu(); \ | ||
145 | /* If you are tempted to conditionalize the following */ \ | ||
146 | /* so that ASI is only written if it changes, think again. */ \ | ||
147 | __asm__ __volatile__("wr %%g0, %0, %%asi" \ | ||
148 | : : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\ | ||
149 | trap_block[current_thread_info()->cpu].thread = \ | ||
150 | task_thread_info(next); \ | ||
151 | __asm__ __volatile__( \ | ||
152 | "mov %%g4, %%g7\n\t" \ | ||
153 | "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \ | ||
154 | "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \ | ||
155 | "rdpr %%wstate, %%o5\n\t" \ | ||
156 | "stx %%o6, [%%g6 + %6]\n\t" \ | ||
157 | "stb %%o5, [%%g6 + %5]\n\t" \ | ||
158 | "rdpr %%cwp, %%o5\n\t" \ | ||
159 | "stb %%o5, [%%g6 + %8]\n\t" \ | ||
160 | "wrpr %%g0, 15, %%pil\n\t" \ | ||
161 | "mov %4, %%g6\n\t" \ | ||
162 | "ldub [%4 + %8], %%g1\n\t" \ | ||
163 | "wrpr %%g1, %%cwp\n\t" \ | ||
164 | "ldx [%%g6 + %6], %%o6\n\t" \ | ||
165 | "ldub [%%g6 + %5], %%o5\n\t" \ | ||
166 | "ldub [%%g6 + %7], %%o7\n\t" \ | ||
167 | "wrpr %%o5, 0x0, %%wstate\n\t" \ | ||
168 | "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ | ||
169 | "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ | ||
170 | "ldx [%%g6 + %9], %%g4\n\t" \ | ||
171 | "wrpr %%g0, 14, %%pil\n\t" \ | ||
172 | "brz,pt %%o7, switch_to_pc\n\t" \ | ||
173 | " mov %%g7, %0\n\t" \ | ||
174 | "sethi %%hi(ret_from_syscall), %%g1\n\t" \ | ||
175 | "jmpl %%g1 + %%lo(ret_from_syscall), %%g0\n\t" \ | ||
176 | " nop\n\t" \ | ||
177 | ".globl switch_to_pc\n\t" \ | ||
178 | "switch_to_pc:\n\t" \ | ||
179 | : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \ | ||
180 | "=r" (__local_per_cpu_offset) \ | ||
181 | : "0" (task_thread_info(next)), \ | ||
182 | "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \ | ||
183 | "i" (TI_CWP), "i" (TI_TASK) \ | ||
184 | : "cc", \ | ||
185 | "g1", "g2", "g3", "g7", \ | ||
186 | "l1", "l2", "l3", "l4", "l5", "l6", "l7", \ | ||
187 | "i0", "i1", "i2", "i3", "i4", "i5", \ | ||
188 | "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \ | ||
189 | } while(0) | ||
190 | |||
191 | static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) | ||
192 | { | ||
193 | unsigned long tmp1, tmp2; | ||
194 | |||
195 | __asm__ __volatile__( | ||
196 | " mov %0, %1\n" | ||
197 | "1: lduw [%4], %2\n" | ||
198 | " cas [%4], %2, %0\n" | ||
199 | " cmp %2, %0\n" | ||
200 | " bne,a,pn %%icc, 1b\n" | ||
201 | " mov %1, %0\n" | ||
202 | : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) | ||
203 | : "0" (val), "r" (m) | ||
204 | : "cc", "memory"); | ||
205 | return val; | ||
206 | } | ||
207 | |||
208 | static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long val) | ||
209 | { | ||
210 | unsigned long tmp1, tmp2; | ||
211 | |||
212 | __asm__ __volatile__( | ||
213 | " mov %0, %1\n" | ||
214 | "1: ldx [%4], %2\n" | ||
215 | " casx [%4], %2, %0\n" | ||
216 | " cmp %2, %0\n" | ||
217 | " bne,a,pn %%xcc, 1b\n" | ||
218 | " mov %1, %0\n" | ||
219 | : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) | ||
220 | : "0" (val), "r" (m) | ||
221 | : "cc", "memory"); | ||
222 | return val; | ||
223 | } | ||
224 | |||
225 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
226 | |||
227 | extern void __xchg_called_with_bad_pointer(void); | ||
228 | |||
229 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, | ||
230 | int size) | ||
231 | { | ||
232 | switch (size) { | ||
233 | case 4: | ||
234 | return xchg32(ptr, x); | ||
235 | case 8: | ||
236 | return xchg64(ptr, x); | ||
237 | } | ||
238 | __xchg_called_with_bad_pointer(); | ||
239 | return x; | ||
240 | } | ||
241 | |||
242 | extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn)); | ||
243 | |||
244 | /* | ||
245 | * Atomic compare and exchange. Compare OLD with MEM, if identical, | ||
246 | * store NEW in MEM. Return the initial value in MEM. Success is | ||
247 | * indicated by comparing RETURN with OLD. | ||
248 | */ | ||
249 | |||
250 | #define __HAVE_ARCH_CMPXCHG 1 | ||
251 | |||
252 | static inline unsigned long | ||
253 | __cmpxchg_u32(volatile int *m, int old, int new) | ||
254 | { | ||
255 | __asm__ __volatile__("cas [%2], %3, %0" | ||
256 | : "=&r" (new) | ||
257 | : "0" (new), "r" (m), "r" (old) | ||
258 | : "memory"); | ||
259 | |||
260 | return new; | ||
261 | } | ||
262 | |||
263 | static inline unsigned long | ||
264 | __cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) | ||
265 | { | ||
266 | __asm__ __volatile__("casx [%2], %3, %0" | ||
267 | : "=&r" (new) | ||
268 | : "0" (new), "r" (m), "r" (old) | ||
269 | : "memory"); | ||
270 | |||
271 | return new; | ||
272 | } | ||
273 | |||
274 | /* This function doesn't exist, so you'll get a linker error | ||
275 | if something tries to do an invalid cmpxchg(). */ | ||
276 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
277 | |||
278 | static inline unsigned long | ||
279 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | ||
280 | { | ||
281 | switch (size) { | ||
282 | case 4: | ||
283 | return __cmpxchg_u32(ptr, old, new); | ||
284 | case 8: | ||
285 | return __cmpxchg_u64(ptr, old, new); | ||
286 | } | ||
287 | __cmpxchg_called_with_bad_pointer(); | ||
288 | return old; | ||
289 | } | ||
290 | |||
291 | #define cmpxchg(ptr,o,n) \ | ||
292 | ({ \ | ||
293 | __typeof__(*(ptr)) _o_ = (o); \ | ||
294 | __typeof__(*(ptr)) _n_ = (n); \ | ||
295 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
296 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
297 | }) | ||
298 | |||
299 | /* | ||
300 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
301 | * them available. | ||
302 | */ | ||
303 | |||
304 | static inline unsigned long __cmpxchg_local(volatile void *ptr, | ||
305 | unsigned long old, | ||
306 | unsigned long new, int size) | ||
307 | { | ||
308 | switch (size) { | ||
309 | case 4: | ||
310 | case 8: return __cmpxchg(ptr, old, new, size); | ||
311 | default: | ||
312 | return __cmpxchg_local_generic(ptr, old, new, size); | ||
313 | } | ||
314 | |||
315 | return old; | ||
316 | } | ||
317 | |||
318 | #define cmpxchg_local(ptr, o, n) \ | ||
319 | ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ | ||
320 | (unsigned long)(n), sizeof(*(ptr)))) | ||
321 | #define cmpxchg64_local(ptr, o, n) \ | ||
322 | ({ \ | ||
323 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
324 | cmpxchg_local((ptr), (o), (n)); \ | ||
325 | }) | ||
326 | |||
327 | #endif /* !(__ASSEMBLY__) */ | ||
328 | |||
329 | #define arch_align_stack(x) (x) | ||
330 | |||
331 | #endif /* !(__SPARC64_SYSTEM_H) */ | ||
diff --git a/arch/sparc/include/asm/timer_32.h b/arch/sparc/include/asm/timer_32.h index 2ec030ef3810..1a91e11dd104 100644 --- a/arch/sparc/include/asm/timer_32.h +++ b/arch/sparc/include/asm/timer_32.h | |||
@@ -8,12 +8,13 @@ | |||
8 | #ifndef _SPARC_TIMER_H | 8 | #ifndef _SPARC_TIMER_H |
9 | #define _SPARC_TIMER_H | 9 | #define _SPARC_TIMER_H |
10 | 10 | ||
11 | #include <asm/system.h> /* For SUN4M_NCPUS */ | 11 | #include <asm/cpu_type.h> /* For SUN4M_NCPUS */ |
12 | #include <asm/btfixup.h> | 12 | #include <asm/btfixup.h> |
13 | 13 | ||
14 | extern __volatile__ unsigned int *master_l10_counter; | 14 | extern __volatile__ unsigned int *master_l10_counter; |
15 | 15 | ||
16 | /* FIXME: Make do_[gs]ettimeofday btfixup calls */ | 16 | /* FIXME: Make do_[gs]ettimeofday btfixup calls */ |
17 | struct timespec; | ||
17 | BTFIXUPDEF_CALL(int, bus_do_settimeofday, struct timespec *tv) | 18 | BTFIXUPDEF_CALL(int, bus_do_settimeofday, struct timespec *tv) |
18 | #define bus_do_settimeofday(tv) BTFIXUP_CALL(bus_do_settimeofday)(tv) | 19 | #define bus_do_settimeofday(tv) BTFIXUP_CALL(bus_do_settimeofday)(tv) |
19 | 20 | ||
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index 3e1449f07798..a1091afb8831 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
12 | #include <linux/thread_info.h> | 12 | #include <linux/thread_info.h> |
13 | #include <asm/asi.h> | 13 | #include <asm/asi.h> |
14 | #include <asm/system.h> | ||
15 | #include <asm/spitfire.h> | 14 | #include <asm/spitfire.h> |
16 | #include <asm-generic/uaccess-unaligned.h> | 15 | #include <asm-generic/uaccess-unaligned.h> |
17 | #endif | 16 | #endif |
diff --git a/arch/sparc/include/asm/vga.h b/arch/sparc/include/asm/vga.h index c69d5b2ba19a..ec0e9967d93d 100644 --- a/arch/sparc/include/asm/vga.h +++ b/arch/sparc/include/asm/vga.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #ifndef _LINUX_ASM_VGA_H_ | 7 | #ifndef _LINUX_ASM_VGA_H_ |
8 | #define _LINUX_ASM_VGA_H_ | 8 | #define _LINUX_ASM_VGA_H_ |
9 | 9 | ||
10 | #include <linux/bug.h> | ||
10 | #include <asm/types.h> | 11 | #include <asm/types.h> |
11 | 12 | ||
12 | #define VT_BUF_HAVE_RW | 13 | #define VT_BUF_HAVE_RW |
diff --git a/arch/sparc/include/asm/vio.h b/arch/sparc/include/asm/vio.h index 9d83d3bcb494..432afa838861 100644 --- a/arch/sparc/include/asm/vio.h +++ b/arch/sparc/include/asm/vio.h | |||
@@ -284,6 +284,7 @@ struct vio_dev { | |||
284 | }; | 284 | }; |
285 | 285 | ||
286 | struct vio_driver { | 286 | struct vio_driver { |
287 | const char *name; | ||
287 | struct list_head node; | 288 | struct list_head node; |
288 | const struct vio_device_id *id_table; | 289 | const struct vio_device_id *id_table; |
289 | int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); | 290 | int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); |
@@ -371,7 +372,13 @@ do { if (vio->debug & VIO_DEBUG_##TYPE) \ | |||
371 | vio->vdev->channel_id, ## a); \ | 372 | vio->vdev->channel_id, ## a); \ |
372 | } while (0) | 373 | } while (0) |
373 | 374 | ||
374 | extern int vio_register_driver(struct vio_driver *drv); | 375 | extern int __vio_register_driver(struct vio_driver *drv, struct module *owner, |
376 | const char *mod_name); | ||
377 | /* | ||
378 | * vio_register_driver must be a macro so that KBUILD_MODNAME can be expanded | ||
379 | */ | ||
380 | #define vio_register_driver(driver) \ | ||
381 | __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) | ||
375 | extern void vio_unregister_driver(struct vio_driver *drv); | 382 | extern void vio_unregister_driver(struct vio_driver *drv); |
376 | 383 | ||
377 | static inline struct vio_driver *to_vio_driver(struct device_driver *drv) | 384 | static inline struct vio_driver *to_vio_driver(struct device_driver *drv) |
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c index f7ea8f032719..56d0f52c3e62 100644 --- a/arch/sparc/kernel/auxio_32.c +++ b/arch/sparc/kernel/auxio_32.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/auxio.h> | 14 | #include <asm/auxio.h> |
15 | #include <asm/string.h> /* memset(), Linux has no bzero() */ | 15 | #include <asm/string.h> /* memset(), Linux has no bzero() */ |
16 | #include <asm/cpu_type.h> | ||
16 | 17 | ||
17 | /* Probe and map in the Auxiliary I/O register */ | 18 | /* Probe and map in the Auxiliary I/O register */ |
18 | 19 | ||
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c index 113c052c3043..6b2f56a6f8af 100644 --- a/arch/sparc/kernel/devices.c +++ b/arch/sparc/kernel/devices.c | |||
@@ -17,8 +17,8 @@ | |||
17 | #include <asm/oplib.h> | 17 | #include <asm/oplib.h> |
18 | #include <asm/prom.h> | 18 | #include <asm/prom.h> |
19 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
20 | #include <asm/system.h> | ||
21 | #include <asm/cpudata.h> | 20 | #include <asm/cpudata.h> |
21 | #include <asm/cpu_type.h> | ||
22 | 22 | ||
23 | extern void clock_stop_probe(void); /* tadpole.c */ | 23 | extern void clock_stop_probe(void); /* tadpole.c */ |
24 | extern void sun4c_probe_memerr_reg(void); | 24 | extern void sun4c_probe_memerr_reg(void); |
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c index e65b9fc52b49..f09257c86107 100644 --- a/arch/sparc/kernel/ds.c +++ b/arch/sparc/kernel/ds.c | |||
@@ -1244,10 +1244,7 @@ static struct vio_driver ds_driver = { | |||
1244 | .id_table = ds_match, | 1244 | .id_table = ds_match, |
1245 | .probe = ds_probe, | 1245 | .probe = ds_probe, |
1246 | .remove = ds_remove, | 1246 | .remove = ds_remove, |
1247 | .driver = { | 1247 | .name = "ds", |
1248 | .name = "ds", | ||
1249 | .owner = THIS_MODULE, | ||
1250 | } | ||
1251 | }; | 1248 | }; |
1252 | 1249 | ||
1253 | static int __init ds_init(void) | 1250 | static int __init ds_init(void) |
@@ -1267,4 +1264,4 @@ static int __init ds_init(void) | |||
1267 | return vio_register_driver(&ds_driver); | 1264 | return vio_register_driver(&ds_driver); |
1268 | } | 1265 | } |
1269 | 1266 | ||
1270 | subsys_initcall(ds_init); | 1267 | fs_initcall(ds_init); |
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c index 4643d68713fa..070ed141aac7 100644 --- a/arch/sparc/kernel/iommu.c +++ b/arch/sparc/kernel/iommu.c | |||
@@ -280,7 +280,8 @@ static inline void iommu_free_ctx(struct iommu *iommu, int ctx) | |||
280 | } | 280 | } |
281 | 281 | ||
282 | static void *dma_4u_alloc_coherent(struct device *dev, size_t size, | 282 | static void *dma_4u_alloc_coherent(struct device *dev, size_t size, |
283 | dma_addr_t *dma_addrp, gfp_t gfp) | 283 | dma_addr_t *dma_addrp, gfp_t gfp, |
284 | struct dma_attrs *attrs) | ||
284 | { | 285 | { |
285 | unsigned long flags, order, first_page; | 286 | unsigned long flags, order, first_page; |
286 | struct iommu *iommu; | 287 | struct iommu *iommu; |
@@ -330,7 +331,8 @@ static void *dma_4u_alloc_coherent(struct device *dev, size_t size, | |||
330 | } | 331 | } |
331 | 332 | ||
332 | static void dma_4u_free_coherent(struct device *dev, size_t size, | 333 | static void dma_4u_free_coherent(struct device *dev, size_t size, |
333 | void *cpu, dma_addr_t dvma) | 334 | void *cpu, dma_addr_t dvma, |
335 | struct dma_attrs *attrs) | ||
334 | { | 336 | { |
335 | struct iommu *iommu; | 337 | struct iommu *iommu; |
336 | unsigned long flags, order, npages; | 338 | unsigned long flags, order, npages; |
@@ -825,8 +827,8 @@ static void dma_4u_sync_sg_for_cpu(struct device *dev, | |||
825 | } | 827 | } |
826 | 828 | ||
827 | static struct dma_map_ops sun4u_dma_ops = { | 829 | static struct dma_map_ops sun4u_dma_ops = { |
828 | .alloc_coherent = dma_4u_alloc_coherent, | 830 | .alloc = dma_4u_alloc_coherent, |
829 | .free_coherent = dma_4u_free_coherent, | 831 | .free = dma_4u_free_coherent, |
830 | .map_page = dma_4u_map_page, | 832 | .map_page = dma_4u_map_page, |
831 | .unmap_page = dma_4u_unmap_page, | 833 | .unmap_page = dma_4u_unmap_page, |
832 | .map_sg = dma_4u_map_sg, | 834 | .map_sg = dma_4u_map_sg, |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index d0479e2163fa..21bd73943f7f 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -261,7 +261,8 @@ EXPORT_SYMBOL(sbus_set_sbus64); | |||
261 | * CPU may access them without any explicit flushing. | 261 | * CPU may access them without any explicit flushing. |
262 | */ | 262 | */ |
263 | static void *sbus_alloc_coherent(struct device *dev, size_t len, | 263 | static void *sbus_alloc_coherent(struct device *dev, size_t len, |
264 | dma_addr_t *dma_addrp, gfp_t gfp) | 264 | dma_addr_t *dma_addrp, gfp_t gfp, |
265 | struct dma_attrs *attrs) | ||
265 | { | 266 | { |
266 | struct platform_device *op = to_platform_device(dev); | 267 | struct platform_device *op = to_platform_device(dev); |
267 | unsigned long len_total = PAGE_ALIGN(len); | 268 | unsigned long len_total = PAGE_ALIGN(len); |
@@ -315,7 +316,7 @@ err_nopages: | |||
315 | } | 316 | } |
316 | 317 | ||
317 | static void sbus_free_coherent(struct device *dev, size_t n, void *p, | 318 | static void sbus_free_coherent(struct device *dev, size_t n, void *p, |
318 | dma_addr_t ba) | 319 | dma_addr_t ba, struct dma_attrs *attrs) |
319 | { | 320 | { |
320 | struct resource *res; | 321 | struct resource *res; |
321 | struct page *pgv; | 322 | struct page *pgv; |
@@ -407,8 +408,8 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | |||
407 | } | 408 | } |
408 | 409 | ||
409 | struct dma_map_ops sbus_dma_ops = { | 410 | struct dma_map_ops sbus_dma_ops = { |
410 | .alloc_coherent = sbus_alloc_coherent, | 411 | .alloc = sbus_alloc_coherent, |
411 | .free_coherent = sbus_free_coherent, | 412 | .free = sbus_free_coherent, |
412 | .map_page = sbus_map_page, | 413 | .map_page = sbus_map_page, |
413 | .unmap_page = sbus_unmap_page, | 414 | .unmap_page = sbus_unmap_page, |
414 | .map_sg = sbus_map_sg, | 415 | .map_sg = sbus_map_sg, |
@@ -436,7 +437,8 @@ arch_initcall(sparc_register_ioport); | |||
436 | * hwdev should be valid struct pci_dev pointer for PCI devices. | 437 | * hwdev should be valid struct pci_dev pointer for PCI devices. |
437 | */ | 438 | */ |
438 | static void *pci32_alloc_coherent(struct device *dev, size_t len, | 439 | static void *pci32_alloc_coherent(struct device *dev, size_t len, |
439 | dma_addr_t *pba, gfp_t gfp) | 440 | dma_addr_t *pba, gfp_t gfp, |
441 | struct dma_attrs *attrs) | ||
440 | { | 442 | { |
441 | unsigned long len_total = PAGE_ALIGN(len); | 443 | unsigned long len_total = PAGE_ALIGN(len); |
442 | void *va; | 444 | void *va; |
@@ -489,7 +491,7 @@ err_nopages: | |||
489 | * past this call are illegal. | 491 | * past this call are illegal. |
490 | */ | 492 | */ |
491 | static void pci32_free_coherent(struct device *dev, size_t n, void *p, | 493 | static void pci32_free_coherent(struct device *dev, size_t n, void *p, |
492 | dma_addr_t ba) | 494 | dma_addr_t ba, struct dma_attrs *attrs) |
493 | { | 495 | { |
494 | struct resource *res; | 496 | struct resource *res; |
495 | 497 | ||
@@ -645,8 +647,8 @@ static void pci32_sync_sg_for_device(struct device *device, struct scatterlist * | |||
645 | } | 647 | } |
646 | 648 | ||
647 | struct dma_map_ops pci32_dma_ops = { | 649 | struct dma_map_ops pci32_dma_ops = { |
648 | .alloc_coherent = pci32_alloc_coherent, | 650 | .alloc = pci32_alloc_coherent, |
649 | .free_coherent = pci32_free_coherent, | 651 | .free = pci32_free_coherent, |
650 | .map_page = pci32_map_page, | 652 | .map_page = pci32_map_page, |
651 | .unmap_page = pci32_unmap_page, | 653 | .unmap_page = pci32_unmap_page, |
652 | .map_sg = pci32_map_sg, | 654 | .map_sg = pci32_map_sg, |
diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h index 42851122bbd9..5a021dd2f854 100644 --- a/arch/sparc/kernel/irq.h +++ b/arch/sparc/kernel/irq.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/platform_device.h> | 1 | #include <linux/platform_device.h> |
2 | 2 | ||
3 | #include <asm/btfixup.h> | 3 | #include <asm/btfixup.h> |
4 | #include <asm/cpu_type.h> | ||
4 | 5 | ||
5 | struct irq_bucket { | 6 | struct irq_bucket { |
6 | struct irq_bucket *next; | 7 | struct irq_bucket *next; |
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c index d45b710ea7e4..dff2c3d7d370 100644 --- a/arch/sparc/kernel/irq_64.c +++ b/arch/sparc/kernel/irq_64.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <asm/ptrace.h> | 26 | #include <asm/ptrace.h> |
27 | #include <asm/processor.h> | 27 | #include <asm/processor.h> |
28 | #include <linux/atomic.h> | 28 | #include <linux/atomic.h> |
29 | #include <asm/system.h> | ||
30 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
31 | #include <asm/io.h> | 30 | #include <asm/io.h> |
32 | #include <asm/iommu.h> | 31 | #include <asm/iommu.h> |
diff --git a/arch/sparc/kernel/jump_label.c b/arch/sparc/kernel/jump_label.c index 971fd435a281..48565c11e82a 100644 --- a/arch/sparc/kernel/jump_label.c +++ b/arch/sparc/kernel/jump_label.c | |||
@@ -6,6 +6,8 @@ | |||
6 | #include <linux/jump_label.h> | 6 | #include <linux/jump_label.h> |
7 | #include <linux/memory.h> | 7 | #include <linux/memory.h> |
8 | 8 | ||
9 | #include <asm/cacheflush.h> | ||
10 | |||
9 | #ifdef HAVE_JUMP_LABEL | 11 | #ifdef HAVE_JUMP_LABEL |
10 | 12 | ||
11 | void arch_jump_label_transform(struct jump_entry *entry, | 13 | void arch_jump_label_transform(struct jump_entry *entry, |
diff --git a/arch/sparc/kernel/kgdb_32.c b/arch/sparc/kernel/kgdb_32.c index 539243b236fa..2e424a576a36 100644 --- a/arch/sparc/kernel/kgdb_32.c +++ b/arch/sparc/kernel/kgdb_32.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <asm/kdebug.h> | 9 | #include <asm/kdebug.h> |
10 | #include <asm/ptrace.h> | 10 | #include <asm/ptrace.h> |
11 | #include <asm/irq.h> | 11 | #include <asm/irq.h> |
12 | #include <asm/cacheflush.h> | ||
12 | 13 | ||
13 | extern unsigned long trapbase; | 14 | extern unsigned long trapbase; |
14 | 15 | ||
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c index 768290a6c028..c8759550799f 100644 --- a/arch/sparc/kernel/kgdb_64.c +++ b/arch/sparc/kernel/kgdb_64.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/kdebug.h> | 7 | #include <linux/kdebug.h> |
8 | #include <linux/ftrace.h> | 8 | #include <linux/ftrace.h> |
9 | 9 | ||
10 | #include <asm/cacheflush.h> | ||
10 | #include <asm/kdebug.h> | 11 | #include <asm/kdebug.h> |
11 | #include <asm/ptrace.h> | 12 | #include <asm/ptrace.h> |
12 | #include <asm/irq.h> | 13 | #include <asm/irq.h> |
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index a19c8a063683..35e43673c453 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -104,11 +104,11 @@ static int irq_choose_cpu(const struct cpumask *affinity) | |||
104 | { | 104 | { |
105 | cpumask_t mask; | 105 | cpumask_t mask; |
106 | 106 | ||
107 | cpus_and(mask, cpu_online_map, *affinity); | 107 | cpumask_and(&mask, cpu_online_mask, affinity); |
108 | if (cpus_equal(mask, cpu_online_map) || cpus_empty(mask)) | 108 | if (cpumask_equal(&mask, cpu_online_mask) || cpumask_empty(&mask)) |
109 | return boot_cpu_id; | 109 | return boot_cpu_id; |
110 | else | 110 | else |
111 | return first_cpu(mask); | 111 | return cpumask_first(&mask); |
112 | } | 112 | } |
113 | #else | 113 | #else |
114 | #define irq_choose_cpu(affinity) boot_cpu_id | 114 | #define irq_choose_cpu(affinity) boot_cpu_id |
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c index c7bec25fdb1c..19f56058742b 100644 --- a/arch/sparc/kernel/leon_pci.c +++ b/arch/sparc/kernel/leon_pci.c | |||
@@ -15,14 +15,19 @@ | |||
15 | 15 | ||
16 | /* The LEON architecture does not rely on a BIOS or bootloader to setup | 16 | /* The LEON architecture does not rely on a BIOS or bootloader to setup |
17 | * PCI for us. The Linux generic routines are used to setup resources, | 17 | * PCI for us. The Linux generic routines are used to setup resources, |
18 | * reset values of confuration-space registers settings ae preseved. | 18 | * reset values of configuration-space register settings are preserved. |
19 | * | ||
20 | * PCI Memory and Prefetchable Memory is direct-mapped. However I/O Space is | ||
21 | * accessed through a Window which is translated to low 64KB in PCI space, the | ||
22 | * first 4KB is not used so 60KB is available. | ||
19 | */ | 23 | */ |
20 | void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info) | 24 | void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info) |
21 | { | 25 | { |
22 | LIST_HEAD(resources); | 26 | LIST_HEAD(resources); |
23 | struct pci_bus *root_bus; | 27 | struct pci_bus *root_bus; |
24 | 28 | ||
25 | pci_add_resource(&resources, &info->io_space); | 29 | pci_add_resource_offset(&resources, &info->io_space, |
30 | info->io_space.start - 0x1000); | ||
26 | pci_add_resource(&resources, &info->mem_space); | 31 | pci_add_resource(&resources, &info->mem_space); |
27 | 32 | ||
28 | root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info, | 33 | root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info, |
@@ -38,47 +43,8 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info) | |||
38 | } | 43 | } |
39 | } | 44 | } |
40 | 45 | ||
41 | /* PCI Memory and Prefetchable Memory is direct-mapped. However I/O Space is | ||
42 | * accessed through a Window which is translated to low 64KB in PCI space, the | ||
43 | * first 4KB is not used so 60KB is available. | ||
44 | * | ||
45 | * This function is used by generic code to translate resource addresses into | ||
46 | * PCI addresses. | ||
47 | */ | ||
48 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
49 | struct resource *res) | ||
50 | { | ||
51 | struct leon_pci_info *info = dev->bus->sysdata; | ||
52 | |||
53 | region->start = res->start; | ||
54 | region->end = res->end; | ||
55 | |||
56 | if (res->flags & IORESOURCE_IO) { | ||
57 | region->start -= (info->io_space.start - 0x1000); | ||
58 | region->end -= (info->io_space.start - 0x1000); | ||
59 | } | ||
60 | } | ||
61 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
62 | |||
63 | /* see pcibios_resource_to_bus() comment */ | ||
64 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
65 | struct pci_bus_region *region) | ||
66 | { | ||
67 | struct leon_pci_info *info = dev->bus->sysdata; | ||
68 | |||
69 | res->start = region->start; | ||
70 | res->end = region->end; | ||
71 | |||
72 | if (res->flags & IORESOURCE_IO) { | ||
73 | res->start += (info->io_space.start - 0x1000); | ||
74 | res->end += (info->io_space.start - 0x1000); | ||
75 | } | ||
76 | } | ||
77 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
78 | |||
79 | void __devinit pcibios_fixup_bus(struct pci_bus *pbus) | 46 | void __devinit pcibios_fixup_bus(struct pci_bus *pbus) |
80 | { | 47 | { |
81 | struct leon_pci_info *info = pbus->sysdata; | ||
82 | struct pci_dev *dev; | 48 | struct pci_dev *dev; |
83 | int i, has_io, has_mem; | 49 | int i, has_io, has_mem; |
84 | u16 cmd; | 50 | u16 cmd; |
@@ -144,18 +110,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
144 | return pci_enable_resources(dev, mask); | 110 | return pci_enable_resources(dev, mask); |
145 | } | 111 | } |
146 | 112 | ||
147 | struct device_node *pci_device_to_OF_node(struct pci_dev *pdev) | ||
148 | { | ||
149 | /* | ||
150 | * Currently the OpenBoot nodes are not connected with the PCI device, | ||
151 | * this is because the LEON PROM does not create PCI nodes. Eventually | ||
152 | * this will change and the same approach as pcic.c can be used to | ||
153 | * match PROM nodes with pci devices. | ||
154 | */ | ||
155 | return NULL; | ||
156 | } | ||
157 | EXPORT_SYMBOL(pci_device_to_OF_node); | ||
158 | |||
159 | void __devinit pcibios_update_irq(struct pci_dev *dev, int irq) | 113 | void __devinit pcibios_update_irq(struct pci_dev *dev, int irq) |
160 | { | 114 | { |
161 | #ifdef CONFIG_PCI_DEBUG | 115 | #ifdef CONFIG_PCI_DEBUG |
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index e5519870c3d9..276359e1ff56 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
18 | #include <asm/spitfire.h> | 18 | #include <asm/spitfire.h> |
19 | #include <asm/cacheflush.h> | ||
19 | 20 | ||
20 | #include "entry.h" | 21 | #include "entry.h" |
21 | 22 | ||
diff --git a/arch/sparc/kernel/muldiv.c b/arch/sparc/kernel/muldiv.c index 6ce1021d487c..f7db516b07d8 100644 --- a/arch/sparc/kernel/muldiv.c +++ b/arch/sparc/kernel/muldiv.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | #include <asm/ptrace.h> | 15 | #include <asm/ptrace.h> |
16 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
17 | #include <asm/system.h> | ||
18 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
19 | 18 | ||
20 | #include "kernel.h" | 19 | #include "kernel.h" |
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c index c76fe0b5bd94..eb1c1f010a47 100644 --- a/arch/sparc/kernel/nmi.c +++ b/arch/sparc/kernel/nmi.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/perf_event.h> | 22 | #include <asm/perf_event.h> |
23 | #include <asm/ptrace.h> | 23 | #include <asm/ptrace.h> |
24 | #include <asm/pcr.h> | 24 | #include <asm/pcr.h> |
25 | #include <asm/perfctr.h> | ||
25 | 26 | ||
26 | #include "kstack.h" | 27 | #include "kstack.h" |
27 | 28 | ||
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index bb8bc2e519ac..fdaf21811670 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -375,13 +375,6 @@ static void __devinit apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p) | |||
375 | *last_p = last; | 375 | *last_p = last; |
376 | } | 376 | } |
377 | 377 | ||
378 | static void pci_resource_adjust(struct resource *res, | ||
379 | struct resource *root) | ||
380 | { | ||
381 | res->start += root->start; | ||
382 | res->end += root->start; | ||
383 | } | ||
384 | |||
385 | /* For PCI bus devices which lack a 'ranges' property we interrogate | 378 | /* For PCI bus devices which lack a 'ranges' property we interrogate |
386 | * the config space values to set the resources, just like the generic | 379 | * the config space values to set the resources, just like the generic |
387 | * Linux PCI probing code does. | 380 | * Linux PCI probing code does. |
@@ -390,7 +383,8 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev, | |||
390 | struct pci_bus *bus, | 383 | struct pci_bus *bus, |
391 | struct pci_pbm_info *pbm) | 384 | struct pci_pbm_info *pbm) |
392 | { | 385 | { |
393 | struct resource *res; | 386 | struct pci_bus_region region; |
387 | struct resource *res, res2; | ||
394 | u8 io_base_lo, io_limit_lo; | 388 | u8 io_base_lo, io_limit_lo; |
395 | u16 mem_base_lo, mem_limit_lo; | 389 | u16 mem_base_lo, mem_limit_lo; |
396 | unsigned long base, limit; | 390 | unsigned long base, limit; |
@@ -412,11 +406,14 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev, | |||
412 | res = bus->resource[0]; | 406 | res = bus->resource[0]; |
413 | if (base <= limit) { | 407 | if (base <= limit) { |
414 | res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; | 408 | res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; |
409 | res2.flags = res->flags; | ||
410 | region.start = base; | ||
411 | region.end = limit + 0xfff; | ||
412 | pcibios_bus_to_resource(dev, &res2, ®ion); | ||
415 | if (!res->start) | 413 | if (!res->start) |
416 | res->start = base; | 414 | res->start = res2.start; |
417 | if (!res->end) | 415 | if (!res->end) |
418 | res->end = limit + 0xfff; | 416 | res->end = res2.end; |
419 | pci_resource_adjust(res, &pbm->io_space); | ||
420 | } | 417 | } |
421 | 418 | ||
422 | pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo); | 419 | pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo); |
@@ -428,9 +425,9 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev, | |||
428 | if (base <= limit) { | 425 | if (base <= limit) { |
429 | res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | | 426 | res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | |
430 | IORESOURCE_MEM); | 427 | IORESOURCE_MEM); |
431 | res->start = base; | 428 | region.start = base; |
432 | res->end = limit + 0xfffff; | 429 | region.end = limit + 0xfffff; |
433 | pci_resource_adjust(res, &pbm->mem_space); | 430 | pcibios_bus_to_resource(dev, res, ®ion); |
434 | } | 431 | } |
435 | 432 | ||
436 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); | 433 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); |
@@ -459,9 +456,9 @@ static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev, | |||
459 | if (base <= limit) { | 456 | if (base <= limit) { |
460 | res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | | 457 | res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | |
461 | IORESOURCE_MEM | IORESOURCE_PREFETCH); | 458 | IORESOURCE_MEM | IORESOURCE_PREFETCH); |
462 | res->start = base; | 459 | region.start = base; |
463 | res->end = limit + 0xfffff; | 460 | region.end = limit + 0xfffff; |
464 | pci_resource_adjust(res, &pbm->mem_space); | 461 | pcibios_bus_to_resource(dev, res, ®ion); |
465 | } | 462 | } |
466 | } | 463 | } |
467 | 464 | ||
@@ -472,6 +469,7 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev, | |||
472 | struct pci_bus *bus, | 469 | struct pci_bus *bus, |
473 | struct pci_pbm_info *pbm) | 470 | struct pci_pbm_info *pbm) |
474 | { | 471 | { |
472 | struct pci_bus_region region; | ||
475 | struct resource *res; | 473 | struct resource *res; |
476 | u32 first, last; | 474 | u32 first, last; |
477 | u8 map; | 475 | u8 map; |
@@ -479,18 +477,18 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev, | |||
479 | pci_read_config_byte(dev, APB_IO_ADDRESS_MAP, &map); | 477 | pci_read_config_byte(dev, APB_IO_ADDRESS_MAP, &map); |
480 | apb_calc_first_last(map, &first, &last); | 478 | apb_calc_first_last(map, &first, &last); |
481 | res = bus->resource[0]; | 479 | res = bus->resource[0]; |
482 | res->start = (first << 21); | ||
483 | res->end = (last << 21) + ((1 << 21) - 1); | ||
484 | res->flags = IORESOURCE_IO; | 480 | res->flags = IORESOURCE_IO; |
485 | pci_resource_adjust(res, &pbm->io_space); | 481 | region.start = (first << 21); |
482 | region.end = (last << 21) + ((1 << 21) - 1); | ||
483 | pcibios_bus_to_resource(dev, res, ®ion); | ||
486 | 484 | ||
487 | pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map); | 485 | pci_read_config_byte(dev, APB_MEM_ADDRESS_MAP, &map); |
488 | apb_calc_first_last(map, &first, &last); | 486 | apb_calc_first_last(map, &first, &last); |
489 | res = bus->resource[1]; | 487 | res = bus->resource[1]; |
490 | res->start = (first << 21); | ||
491 | res->end = (last << 21) + ((1 << 21) - 1); | ||
492 | res->flags = IORESOURCE_MEM; | 488 | res->flags = IORESOURCE_MEM; |
493 | pci_resource_adjust(res, &pbm->mem_space); | 489 | region.start = (first << 21); |
490 | region.end = (last << 21) + ((1 << 21) - 1); | ||
491 | pcibios_bus_to_resource(dev, res, ®ion); | ||
494 | } | 492 | } |
495 | 493 | ||
496 | static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, | 494 | static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, |
@@ -506,6 +504,7 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
506 | struct pci_bus *bus; | 504 | struct pci_bus *bus; |
507 | const u32 *busrange, *ranges; | 505 | const u32 *busrange, *ranges; |
508 | int len, i, simba; | 506 | int len, i, simba; |
507 | struct pci_bus_region region; | ||
509 | struct resource *res; | 508 | struct resource *res; |
510 | unsigned int flags; | 509 | unsigned int flags; |
511 | u64 size; | 510 | u64 size; |
@@ -556,8 +555,6 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
556 | } | 555 | } |
557 | i = 1; | 556 | i = 1; |
558 | for (; len >= 32; len -= 32, ranges += 8) { | 557 | for (; len >= 32; len -= 32, ranges += 8) { |
559 | struct resource *root; | ||
560 | |||
561 | flags = pci_parse_of_flags(ranges[0]); | 558 | flags = pci_parse_of_flags(ranges[0]); |
562 | size = GET_64BIT(ranges, 6); | 559 | size = GET_64BIT(ranges, 6); |
563 | if (flags == 0 || size == 0) | 560 | if (flags == 0 || size == 0) |
@@ -569,7 +566,6 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
569 | " for bridge %s\n", node->full_name); | 566 | " for bridge %s\n", node->full_name); |
570 | continue; | 567 | continue; |
571 | } | 568 | } |
572 | root = &pbm->io_space; | ||
573 | } else { | 569 | } else { |
574 | if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) { | 570 | if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) { |
575 | printk(KERN_ERR "PCI: too many memory ranges" | 571 | printk(KERN_ERR "PCI: too many memory ranges" |
@@ -578,18 +574,12 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
578 | } | 574 | } |
579 | res = bus->resource[i]; | 575 | res = bus->resource[i]; |
580 | ++i; | 576 | ++i; |
581 | root = &pbm->mem_space; | ||
582 | } | 577 | } |
583 | 578 | ||
584 | res->start = GET_64BIT(ranges, 1); | ||
585 | res->end = res->start + size - 1; | ||
586 | res->flags = flags; | 579 | res->flags = flags; |
587 | 580 | region.start = GET_64BIT(ranges, 1); | |
588 | /* Another way to implement this would be to add an of_device | 581 | region.end = region.start + size - 1; |
589 | * layer routine that can calculate a resource for a given | 582 | pcibios_bus_to_resource(dev, res, ®ion); |
590 | * range property value in a PCI device. | ||
591 | */ | ||
592 | pci_resource_adjust(res, root); | ||
593 | } | 583 | } |
594 | after_ranges: | 584 | after_ranges: |
595 | sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), | 585 | sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), |
@@ -691,8 +681,10 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm, | |||
691 | 681 | ||
692 | printk("PCI: Scanning PBM %s\n", node->full_name); | 682 | printk("PCI: Scanning PBM %s\n", node->full_name); |
693 | 683 | ||
694 | pci_add_resource(&resources, &pbm->io_space); | 684 | pci_add_resource_offset(&resources, &pbm->io_space, |
695 | pci_add_resource(&resources, &pbm->mem_space); | 685 | pbm->io_space.start); |
686 | pci_add_resource_offset(&resources, &pbm->mem_space, | ||
687 | pbm->mem_space.start); | ||
696 | bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops, | 688 | bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops, |
697 | pbm, &resources); | 689 | pbm, &resources); |
698 | if (!bus) { | 690 | if (!bus) { |
@@ -755,46 +747,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
755 | return 0; | 747 | return 0; |
756 | } | 748 | } |
757 | 749 | ||
758 | void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region, | ||
759 | struct resource *res) | ||
760 | { | ||
761 | struct pci_pbm_info *pbm = pdev->bus->sysdata; | ||
762 | struct resource zero_res, *root; | ||
763 | |||
764 | zero_res.start = 0; | ||
765 | zero_res.end = 0; | ||
766 | zero_res.flags = res->flags; | ||
767 | |||
768 | if (res->flags & IORESOURCE_IO) | ||
769 | root = &pbm->io_space; | ||
770 | else | ||
771 | root = &pbm->mem_space; | ||
772 | |||
773 | pci_resource_adjust(&zero_res, root); | ||
774 | |||
775 | region->start = res->start - zero_res.start; | ||
776 | region->end = res->end - zero_res.start; | ||
777 | } | ||
778 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
779 | |||
780 | void pcibios_bus_to_resource(struct pci_dev *pdev, struct resource *res, | ||
781 | struct pci_bus_region *region) | ||
782 | { | ||
783 | struct pci_pbm_info *pbm = pdev->bus->sysdata; | ||
784 | struct resource *root; | ||
785 | |||
786 | res->start = region->start; | ||
787 | res->end = region->end; | ||
788 | |||
789 | if (res->flags & IORESOURCE_IO) | ||
790 | root = &pbm->io_space; | ||
791 | else | ||
792 | root = &pbm->mem_space; | ||
793 | |||
794 | pci_resource_adjust(res, root); | ||
795 | } | ||
796 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
797 | |||
798 | char * __devinit pcibios_setup(char *str) | 750 | char * __devinit pcibios_setup(char *str) |
799 | { | 751 | { |
800 | return str; | 752 | return str; |
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c index af5755d20fbe..7661e84a05a0 100644 --- a/arch/sparc/kernel/pci_sun4v.c +++ b/arch/sparc/kernel/pci_sun4v.c | |||
@@ -128,7 +128,8 @@ static inline long iommu_batch_end(void) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | 130 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, |
131 | dma_addr_t *dma_addrp, gfp_t gfp) | 131 | dma_addr_t *dma_addrp, gfp_t gfp, |
132 | struct dma_attrs *attrs) | ||
132 | { | 133 | { |
133 | unsigned long flags, order, first_page, npages, n; | 134 | unsigned long flags, order, first_page, npages, n; |
134 | struct iommu *iommu; | 135 | struct iommu *iommu; |
@@ -198,7 +199,7 @@ range_alloc_fail: | |||
198 | } | 199 | } |
199 | 200 | ||
200 | static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu, | 201 | static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu, |
201 | dma_addr_t dvma) | 202 | dma_addr_t dvma, struct dma_attrs *attrs) |
202 | { | 203 | { |
203 | struct pci_pbm_info *pbm; | 204 | struct pci_pbm_info *pbm; |
204 | struct iommu *iommu; | 205 | struct iommu *iommu; |
@@ -527,8 +528,8 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, | |||
527 | } | 528 | } |
528 | 529 | ||
529 | static struct dma_map_ops sun4v_dma_ops = { | 530 | static struct dma_map_ops sun4v_dma_ops = { |
530 | .alloc_coherent = dma_4v_alloc_coherent, | 531 | .alloc = dma_4v_alloc_coherent, |
531 | .free_coherent = dma_4v_free_coherent, | 532 | .free = dma_4v_free_coherent, |
532 | .map_page = dma_4v_map_page, | 533 | .map_page = dma_4v_map_page, |
533 | .unmap_page = dma_4v_unmap_page, | 534 | .unmap_page = dma_4v_unmap_page, |
534 | .map_sg = dma_4v_map_sg, | 535 | .map_sg = dma_4v_map_sg, |
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c index a24072a49270..0ce0dd2332aa 100644 --- a/arch/sparc/kernel/pcr.c +++ b/arch/sparc/kernel/pcr.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/pcr.h> | 14 | #include <asm/pcr.h> |
15 | #include <asm/nmi.h> | 15 | #include <asm/nmi.h> |
16 | #include <asm/spitfire.h> | 16 | #include <asm/spitfire.h> |
17 | #include <asm/perfctr.h> | ||
17 | 18 | ||
18 | /* This code is shared between various users of the performance | 19 | /* This code is shared between various users of the performance |
19 | * counters. Users will be oprofile, pseudo-NMI watchdog, and the | 20 | * counters. Users will be oprofile, pseudo-NMI watchdog, and the |
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 614da624330c..28559ce5eeb5 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/atomic.h> | 25 | #include <linux/atomic.h> |
26 | #include <asm/nmi.h> | 26 | #include <asm/nmi.h> |
27 | #include <asm/pcr.h> | 27 | #include <asm/pcr.h> |
28 | #include <asm/perfctr.h> | ||
29 | #include <asm/cacheflush.h> | ||
28 | 30 | ||
29 | #include "kernel.h" | 31 | #include "kernel.h" |
30 | #include "kstack.h" | 32 | #include "kstack.h" |
@@ -1105,6 +1107,10 @@ static int sparc_pmu_event_init(struct perf_event *event) | |||
1105 | if (atomic_read(&nmi_active) < 0) | 1107 | if (atomic_read(&nmi_active) < 0) |
1106 | return -ENODEV; | 1108 | return -ENODEV; |
1107 | 1109 | ||
1110 | /* does not support taken branch sampling */ | ||
1111 | if (has_branch_stack(event)) | ||
1112 | return -EOPNOTSUPP; | ||
1113 | |||
1108 | switch (attr->type) { | 1114 | switch (attr->type) { |
1109 | case PERF_TYPE_HARDWARE: | 1115 | case PERF_TYPE_HARDWARE: |
1110 | if (attr->config >= sparc_pmu->max_events) | 1116 | if (attr->config >= sparc_pmu->max_events) |
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c index f793742eec2b..efa07542e85f 100644 --- a/arch/sparc/kernel/process_32.c +++ b/arch/sparc/kernel/process_32.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <asm/auxio.h> | 28 | #include <asm/auxio.h> |
29 | #include <asm/oplib.h> | 29 | #include <asm/oplib.h> |
30 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
31 | #include <asm/system.h> | ||
32 | #include <asm/page.h> | 31 | #include <asm/page.h> |
33 | #include <asm/pgalloc.h> | 32 | #include <asm/pgalloc.h> |
34 | #include <asm/pgtable.h> | 33 | #include <asm/pgtable.h> |
@@ -38,6 +37,7 @@ | |||
38 | #include <asm/elf.h> | 37 | #include <asm/elf.h> |
39 | #include <asm/prom.h> | 38 | #include <asm/prom.h> |
40 | #include <asm/unistd.h> | 39 | #include <asm/unistd.h> |
40 | #include <asm/setup.h> | ||
41 | 41 | ||
42 | /* | 42 | /* |
43 | * Power management idle function | 43 | * Power management idle function |
@@ -113,9 +113,7 @@ void cpu_idle(void) | |||
113 | while (!need_resched()) | 113 | while (!need_resched()) |
114 | cpu_relax(); | 114 | cpu_relax(); |
115 | } | 115 | } |
116 | preempt_enable_no_resched(); | 116 | schedule_preempt_disabled(); |
117 | schedule(); | ||
118 | preempt_disable(); | ||
119 | check_pgt_cache(); | 117 | check_pgt_cache(); |
120 | } | 118 | } |
121 | } | 119 | } |
@@ -138,9 +136,7 @@ void cpu_idle(void) | |||
138 | while (!need_resched()) | 136 | while (!need_resched()) |
139 | cpu_relax(); | 137 | cpu_relax(); |
140 | } | 138 | } |
141 | preempt_enable_no_resched(); | 139 | schedule_preempt_disabled(); |
142 | schedule(); | ||
143 | preempt_disable(); | ||
144 | check_pgt_cache(); | 140 | check_pgt_cache(); |
145 | } | 141 | } |
146 | } | 142 | } |
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index 39d8b05201a2..aff0c72fac09 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/nmi.h> | 32 | #include <linux/nmi.h> |
33 | 33 | ||
34 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
35 | #include <asm/system.h> | ||
36 | #include <asm/page.h> | 35 | #include <asm/page.h> |
37 | #include <asm/pgalloc.h> | 36 | #include <asm/pgalloc.h> |
38 | #include <asm/pgtable.h> | 37 | #include <asm/pgtable.h> |
@@ -104,15 +103,13 @@ void cpu_idle(void) | |||
104 | rcu_idle_exit(); | 103 | rcu_idle_exit(); |
105 | tick_nohz_idle_exit(); | 104 | tick_nohz_idle_exit(); |
106 | 105 | ||
107 | preempt_enable_no_resched(); | ||
108 | |||
109 | #ifdef CONFIG_HOTPLUG_CPU | 106 | #ifdef CONFIG_HOTPLUG_CPU |
110 | if (cpu_is_offline(cpu)) | 107 | if (cpu_is_offline(cpu)) { |
108 | sched_preempt_enable_no_resched(); | ||
111 | cpu_play_dead(); | 109 | cpu_play_dead(); |
110 | } | ||
112 | #endif | 111 | #endif |
113 | 112 | schedule_preempt_disabled(); | |
114 | schedule(); | ||
115 | preempt_disable(); | ||
116 | } | 113 | } |
117 | } | 114 | } |
118 | 115 | ||
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c index 27b9e93d0121..896ba7c5cd8e 100644 --- a/arch/sparc/kernel/ptrace_32.c +++ b/arch/sparc/kernel/ptrace_32.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include <linux/tracehook.h> | 23 | #include <linux/tracehook.h> |
24 | 24 | ||
25 | #include <asm/pgtable.h> | 25 | #include <asm/pgtable.h> |
26 | #include <asm/system.h> | ||
27 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
27 | #include <asm/cacheflush.h> | ||
28 | 28 | ||
29 | /* #define ALLOW_INIT_TRACING */ | 29 | /* #define ALLOW_INIT_TRACING */ |
30 | 30 | ||
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c index 9388844cd88c..6f97c0767995 100644 --- a/arch/sparc/kernel/ptrace_64.c +++ b/arch/sparc/kernel/ptrace_64.c | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | #include <asm/asi.h> | 30 | #include <asm/asi.h> |
31 | #include <asm/pgtable.h> | 31 | #include <asm/pgtable.h> |
32 | #include <asm/system.h> | ||
33 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
34 | #include <asm/psrcompat.h> | 33 | #include <asm/psrcompat.h> |
35 | #include <asm/visasm.h> | 34 | #include <asm/visasm.h> |
diff --git a/arch/sparc/kernel/reboot.c b/arch/sparc/kernel/reboot.c index 006a42dd2007..eba7d918162a 100644 --- a/arch/sparc/kernel/reboot.c +++ b/arch/sparc/kernel/reboot.c | |||
@@ -7,9 +7,9 @@ | |||
7 | #include <linux/export.h> | 7 | #include <linux/export.h> |
8 | #include <linux/pm.h> | 8 | #include <linux/pm.h> |
9 | 9 | ||
10 | #include <asm/system.h> | ||
11 | #include <asm/oplib.h> | 10 | #include <asm/oplib.h> |
12 | #include <asm/prom.h> | 11 | #include <asm/prom.h> |
12 | #include <asm/setup.h> | ||
13 | 13 | ||
14 | /* sysctl - toggle power-off restriction for serial console | 14 | /* sysctl - toggle power-off restriction for serial console |
15 | * systems in machine_power_off() | 15 | * systems in machine_power_off() |
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S index 77f1b95e0806..9171fc238def 100644 --- a/arch/sparc/kernel/rtrap_64.S +++ b/arch/sparc/kernel/rtrap_64.S | |||
@@ -20,11 +20,6 @@ | |||
20 | 20 | ||
21 | .text | 21 | .text |
22 | .align 32 | 22 | .align 32 |
23 | __handle_softirq: | ||
24 | call do_softirq | ||
25 | nop | ||
26 | ba,a,pt %xcc, __handle_softirq_continue | ||
27 | nop | ||
28 | __handle_preemption: | 23 | __handle_preemption: |
29 | call schedule | 24 | call schedule |
30 | wrpr %g0, RTRAP_PSTATE, %pstate | 25 | wrpr %g0, RTRAP_PSTATE, %pstate |
@@ -89,9 +84,7 @@ rtrap: | |||
89 | cmp %l1, 0 | 84 | cmp %l1, 0 |
90 | 85 | ||
91 | /* mm/ultra.S:xcall_report_regs KNOWS about this load. */ | 86 | /* mm/ultra.S:xcall_report_regs KNOWS about this load. */ |
92 | bne,pn %icc, __handle_softirq | ||
93 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 | 87 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 |
94 | __handle_softirq_continue: | ||
95 | rtrap_xcall: | 88 | rtrap_xcall: |
96 | sethi %hi(0xf << 20), %l4 | 89 | sethi %hi(0xf << 20), %l4 |
97 | and %l1, %l4, %l4 | 90 | and %l1, %l4, %l4 |
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index ffb883ddd0f0..d444468b27f6 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/kdebug.h> | 33 | #include <linux/kdebug.h> |
34 | #include <linux/export.h> | 34 | #include <linux/export.h> |
35 | 35 | ||
36 | #include <asm/system.h> | ||
37 | #include <asm/io.h> | 36 | #include <asm/io.h> |
38 | #include <asm/processor.h> | 37 | #include <asm/processor.h> |
39 | #include <asm/oplib.h> | 38 | #include <asm/oplib.h> |
@@ -46,6 +45,7 @@ | |||
46 | #include <asm/machines.h> | 45 | #include <asm/machines.h> |
47 | #include <asm/cpudata.h> | 46 | #include <asm/cpudata.h> |
48 | #include <asm/setup.h> | 47 | #include <asm/setup.h> |
48 | #include <asm/cacheflush.h> | ||
49 | 49 | ||
50 | #include "kernel.h" | 50 | #include "kernel.h" |
51 | 51 | ||
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index a854a1c240ff..1414d16712b2 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/initrd.h> | 31 | #include <linux/initrd.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | 33 | ||
34 | #include <asm/system.h> | ||
35 | #include <asm/io.h> | 34 | #include <asm/io.h> |
36 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
37 | #include <asm/oplib.h> | 36 | #include <asm/oplib.h> |
@@ -49,6 +48,7 @@ | |||
49 | #include <asm/btext.h> | 48 | #include <asm/btext.h> |
50 | #include <asm/elf.h> | 49 | #include <asm/elf.h> |
51 | #include <asm/mdesc.h> | 50 | #include <asm/mdesc.h> |
51 | #include <asm/cacheflush.h> | ||
52 | 52 | ||
53 | #ifdef CONFIG_IP_PNP | 53 | #ifdef CONFIG_IP_PNP |
54 | #include <net/ipconfig.h> | 54 | #include <net/ipconfig.h> |
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index 023b8860dc97..948700fb9036 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/fpumacro.h> | 28 | #include <asm/fpumacro.h> |
29 | #include <asm/visasm.h> | 29 | #include <asm/visasm.h> |
30 | #include <asm/compat_signal.h> | 30 | #include <asm/compat_signal.h> |
31 | #include <asm/switch_to.h> | ||
31 | 32 | ||
32 | #include "sigutil.h" | 33 | #include "sigutil.h" |
33 | 34 | ||
@@ -776,7 +777,6 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka, | |||
776 | siginfo_t *info, | 777 | siginfo_t *info, |
777 | sigset_t *oldset, struct pt_regs *regs) | 778 | sigset_t *oldset, struct pt_regs *regs) |
778 | { | 779 | { |
779 | sigset_t blocked; | ||
780 | int err; | 780 | int err; |
781 | 781 | ||
782 | if (ka->sa.sa_flags & SA_SIGINFO) | 782 | if (ka->sa.sa_flags & SA_SIGINFO) |
@@ -787,11 +787,7 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka, | |||
787 | if (err) | 787 | if (err) |
788 | return err; | 788 | return err; |
789 | 789 | ||
790 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); | 790 | block_sigmask(ka, signr); |
791 | if (!(ka->sa.sa_flags & SA_NOMASK)) | ||
792 | sigaddset(&blocked, signr); | ||
793 | set_current_blocked(&blocked); | ||
794 | |||
795 | tracehook_signal_handler(signr, info, ka, regs, 0); | 791 | tracehook_signal_handler(signr, info, ka, regs, 0); |
796 | 792 | ||
797 | return 0; | 793 | return 0; |
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c index d54c6e53aba0..1e750e415d7a 100644 --- a/arch/sparc/kernel/signal_32.c +++ b/arch/sparc/kernel/signal_32.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <asm/pgalloc.h> | 25 | #include <asm/pgalloc.h> |
26 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
27 | #include <asm/cacheflush.h> /* flush_sig_insns */ | 27 | #include <asm/cacheflush.h> /* flush_sig_insns */ |
28 | #include <asm/switch_to.h> | ||
28 | 29 | ||
29 | #include "sigutil.h" | 30 | #include "sigutil.h" |
30 | 31 | ||
@@ -465,7 +466,6 @@ static inline int | |||
465 | handle_signal(unsigned long signr, struct k_sigaction *ka, | 466 | handle_signal(unsigned long signr, struct k_sigaction *ka, |
466 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) | 467 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) |
467 | { | 468 | { |
468 | sigset_t blocked; | ||
469 | int err; | 469 | int err; |
470 | 470 | ||
471 | if (ka->sa.sa_flags & SA_SIGINFO) | 471 | if (ka->sa.sa_flags & SA_SIGINFO) |
@@ -476,11 +476,7 @@ handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
476 | if (err) | 476 | if (err) |
477 | return err; | 477 | return err; |
478 | 478 | ||
479 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); | 479 | block_sigmask(ka, signr); |
480 | if (!(ka->sa.sa_flags & SA_NOMASK)) | ||
481 | sigaddset(&blocked, signr); | ||
482 | set_current_blocked(&blocked); | ||
483 | |||
484 | tracehook_signal_handler(signr, info, ka, regs, 0); | 480 | tracehook_signal_handler(signr, info, ka, regs, 0); |
485 | 481 | ||
486 | return 0; | 482 | return 0; |
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index f0836cd0e2f2..48b0f57b65f7 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include <asm/uctx.h> | 31 | #include <asm/uctx.h> |
32 | #include <asm/siginfo.h> | 32 | #include <asm/siginfo.h> |
33 | #include <asm/visasm.h> | 33 | #include <asm/visasm.h> |
34 | #include <asm/switch_to.h> | ||
35 | #include <asm/cacheflush.h> | ||
34 | 36 | ||
35 | #include "entry.h" | 37 | #include "entry.h" |
36 | #include "systbls.h" | 38 | #include "systbls.h" |
@@ -479,18 +481,14 @@ static inline int handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
479 | siginfo_t *info, | 481 | siginfo_t *info, |
480 | sigset_t *oldset, struct pt_regs *regs) | 482 | sigset_t *oldset, struct pt_regs *regs) |
481 | { | 483 | { |
482 | sigset_t blocked; | ||
483 | int err; | 484 | int err; |
484 | 485 | ||
485 | err = setup_rt_frame(ka, regs, signr, oldset, | 486 | err = setup_rt_frame(ka, regs, signr, oldset, |
486 | (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); | 487 | (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); |
487 | if (err) | 488 | if (err) |
488 | return err; | 489 | return err; |
489 | sigorsets(&blocked, ¤t->blocked, &ka->sa.sa_mask); | ||
490 | if (!(ka->sa.sa_flags & SA_NOMASK)) | ||
491 | sigaddset(&blocked, signr); | ||
492 | set_current_blocked(&blocked); | ||
493 | 490 | ||
491 | block_sigmask(ka, signr); | ||
494 | tracehook_signal_handler(signr, info, ka, regs, 0); | 492 | tracehook_signal_handler(signr, info, ka, regs, 0); |
495 | 493 | ||
496 | return 0; | 494 | return 0; |
diff --git a/arch/sparc/kernel/sigutil_32.c b/arch/sparc/kernel/sigutil_32.c index 35c7897b009a..0f6eebe71e6c 100644 --- a/arch/sparc/kernel/sigutil_32.c +++ b/arch/sparc/kernel/sigutil_32.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <asm/sigcontext.h> | 7 | #include <asm/sigcontext.h> |
8 | #include <asm/fpumacro.h> | 8 | #include <asm/fpumacro.h> |
9 | #include <asm/ptrace.h> | 9 | #include <asm/ptrace.h> |
10 | #include <asm/switch_to.h> | ||
10 | 11 | ||
11 | #include "sigutil.h" | 12 | #include "sigutil.h" |
12 | 13 | ||
diff --git a/arch/sparc/kernel/sigutil_64.c b/arch/sparc/kernel/sigutil_64.c index b19570d41a39..387834a9c56a 100644 --- a/arch/sparc/kernel/sigutil_64.c +++ b/arch/sparc/kernel/sigutil_64.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <asm/sigcontext.h> | 7 | #include <asm/sigcontext.h> |
8 | #include <asm/fpumacro.h> | 8 | #include <asm/fpumacro.h> |
9 | #include <asm/ptrace.h> | 9 | #include <asm/ptrace.h> |
10 | #include <asm/switch_to.h> | ||
10 | 11 | ||
11 | #include "sigutil.h" | 12 | #include "sigutil.h" |
12 | 13 | ||
diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c index 12ff09824cd9..9f5e24ddcc70 100644 --- a/arch/sparc/kernel/sparc_ksyms_64.c +++ b/arch/sparc/kernel/sparc_ksyms_64.c | |||
@@ -10,12 +10,12 @@ | |||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/bitops.h> | 11 | #include <linux/bitops.h> |
12 | 12 | ||
13 | #include <asm/system.h> | ||
14 | #include <asm/cpudata.h> | 13 | #include <asm/cpudata.h> |
15 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
16 | #include <asm/spitfire.h> | 15 | #include <asm/spitfire.h> |
17 | #include <asm/oplib.h> | 16 | #include <asm/oplib.h> |
18 | #include <asm/hypervisor.h> | 17 | #include <asm/hypervisor.h> |
18 | #include <asm/cacheflush.h> | ||
19 | 19 | ||
20 | struct poll { | 20 | struct poll { |
21 | int fd; | 21 | int fd; |
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index 133387980b56..540b2fec09f0 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/sbi.h> | 14 | #include <asm/sbi.h> |
15 | #include <asm/mmu.h> | 15 | #include <asm/mmu.h> |
16 | #include <asm/tlbflush.h> | 16 | #include <asm/tlbflush.h> |
17 | #include <asm/switch_to.h> | ||
17 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
18 | 19 | ||
19 | #include "kernel.h" | 20 | #include "kernel.h" |
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index 594768686525..02db9a0412ce 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/cpu.h> | 10 | #include <linux/cpu.h> |
11 | 11 | ||
12 | #include <asm/cacheflush.h> | 12 | #include <asm/cacheflush.h> |
13 | #include <asm/switch_to.h> | ||
13 | #include <asm/tlbflush.h> | 14 | #include <asm/tlbflush.h> |
14 | 15 | ||
15 | #include "irq.h" | 16 | #include "irq.h" |
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c index 1060e0672a4b..7d0c088e8aba 100644 --- a/arch/sparc/kernel/time_32.c +++ b/arch/sparc/kernel/time_32.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <asm/oplib.h> | 37 | #include <asm/oplib.h> |
38 | #include <asm/timex.h> | 38 | #include <asm/timex.h> |
39 | #include <asm/timer.h> | 39 | #include <asm/timer.h> |
40 | #include <asm/system.h> | ||
41 | #include <asm/irq.h> | 40 | #include <asm/irq.h> |
42 | #include <asm/io.h> | 41 | #include <asm/io.h> |
43 | #include <asm/idprom.h> | 42 | #include <asm/idprom.h> |
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c index 591f20ca9e48..d2de21333146 100644 --- a/arch/sparc/kernel/traps_32.c +++ b/arch/sparc/kernel/traps_32.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/export.h> | 17 | #include <linux/export.h> |
18 | 18 | ||
19 | #include <asm/delay.h> | 19 | #include <asm/delay.h> |
20 | #include <asm/system.h> | ||
21 | #include <asm/ptrace.h> | 20 | #include <asm/ptrace.h> |
22 | #include <asm/oplib.h> | 21 | #include <asm/oplib.h> |
23 | #include <asm/page.h> | 22 | #include <asm/page.h> |
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index 0cbdaa41cd1e..c72fdf55e1c1 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | #include <asm/smp.h> | 23 | #include <asm/smp.h> |
24 | #include <asm/delay.h> | 24 | #include <asm/delay.h> |
25 | #include <asm/system.h> | ||
26 | #include <asm/ptrace.h> | 25 | #include <asm/ptrace.h> |
27 | #include <asm/oplib.h> | 26 | #include <asm/oplib.h> |
28 | #include <asm/page.h> | 27 | #include <asm/page.h> |
@@ -41,6 +40,7 @@ | |||
41 | #include <asm/head.h> | 40 | #include <asm/head.h> |
42 | #include <asm/prom.h> | 41 | #include <asm/prom.h> |
43 | #include <asm/memctrl.h> | 42 | #include <asm/memctrl.h> |
43 | #include <asm/cacheflush.h> | ||
44 | 44 | ||
45 | #include "entry.h" | 45 | #include "entry.h" |
46 | #include "kstack.h" | 46 | #include "kstack.h" |
diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c index 4d043a1b2492..c0ec89786193 100644 --- a/arch/sparc/kernel/unaligned_32.c +++ b/arch/sparc/kernel/unaligned_32.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <asm/ptrace.h> | 13 | #include <asm/ptrace.h> |
14 | #include <asm/processor.h> | 14 | #include <asm/processor.h> |
15 | #include <asm/system.h> | ||
16 | #include <asm/uaccess.h> | 15 | #include <asm/uaccess.h> |
17 | #include <linux/smp.h> | 16 | #include <linux/smp.h> |
18 | #include <linux/perf_event.h> | 17 | #include <linux/perf_event.h> |
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c index 626e7b06d6b1..f81d038f7340 100644 --- a/arch/sparc/kernel/unaligned_64.c +++ b/arch/sparc/kernel/unaligned_64.c | |||
@@ -16,13 +16,13 @@ | |||
16 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
17 | #include <asm/pstate.h> | 17 | #include <asm/pstate.h> |
18 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
19 | #include <asm/system.h> | ||
20 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
21 | #include <linux/smp.h> | 20 | #include <linux/smp.h> |
22 | #include <linux/bitops.h> | 21 | #include <linux/bitops.h> |
23 | #include <linux/perf_event.h> | 22 | #include <linux/perf_event.h> |
24 | #include <linux/ratelimit.h> | 23 | #include <linux/ratelimit.h> |
25 | #include <asm/fpumacro.h> | 24 | #include <asm/fpumacro.h> |
25 | #include <asm/cacheflush.h> | ||
26 | 26 | ||
27 | enum direction { | 27 | enum direction { |
28 | load, /* ld, ldd, ldh, ldsh */ | 28 | load, /* ld, ldd, ldh, ldsh */ |
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c index f67e28ef598c..5cffdc55f075 100644 --- a/arch/sparc/kernel/vio.c +++ b/arch/sparc/kernel/vio.c | |||
@@ -119,13 +119,17 @@ static struct bus_type vio_bus_type = { | |||
119 | .remove = vio_device_remove, | 119 | .remove = vio_device_remove, |
120 | }; | 120 | }; |
121 | 121 | ||
122 | int vio_register_driver(struct vio_driver *viodrv) | 122 | int __vio_register_driver(struct vio_driver *viodrv, struct module *owner, |
123 | const char *mod_name) | ||
123 | { | 124 | { |
124 | viodrv->driver.bus = &vio_bus_type; | 125 | viodrv->driver.bus = &vio_bus_type; |
126 | viodrv->driver.name = viodrv->name; | ||
127 | viodrv->driver.owner = owner; | ||
128 | viodrv->driver.mod_name = mod_name; | ||
125 | 129 | ||
126 | return driver_register(&viodrv->driver); | 130 | return driver_register(&viodrv->driver); |
127 | } | 131 | } |
128 | EXPORT_SYMBOL(vio_register_driver); | 132 | EXPORT_SYMBOL(__vio_register_driver); |
129 | 133 | ||
130 | void vio_unregister_driver(struct vio_driver *viodrv) | 134 | void vio_unregister_driver(struct vio_driver *viodrv) |
131 | { | 135 | { |
diff --git a/arch/sparc/kernel/visemul.c b/arch/sparc/kernel/visemul.c index 73370674ccff..08e074b7eb6a 100644 --- a/arch/sparc/kernel/visemul.c +++ b/arch/sparc/kernel/visemul.c | |||
@@ -9,9 +9,9 @@ | |||
9 | 9 | ||
10 | #include <asm/ptrace.h> | 10 | #include <asm/ptrace.h> |
11 | #include <asm/pstate.h> | 11 | #include <asm/pstate.h> |
12 | #include <asm/system.h> | ||
13 | #include <asm/fpumacro.h> | 12 | #include <asm/fpumacro.h> |
14 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
14 | #include <asm/cacheflush.h> | ||
15 | 15 | ||
16 | /* OPF field of various VIS instructions. */ | 16 | /* OPF field of various VIS instructions. */ |
17 | 17 | ||
diff --git a/arch/sparc/math-emu/math_64.c b/arch/sparc/math-emu/math_64.c index e575bd2fe381..2bbe2f28ad23 100644 --- a/arch/sparc/math-emu/math_64.c +++ b/arch/sparc/math-emu/math_64.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <asm/fpumacro.h> | 16 | #include <asm/fpumacro.h> |
17 | #include <asm/ptrace.h> | 17 | #include <asm/ptrace.h> |
18 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
19 | #include <asm/cacheflush.h> | ||
19 | 20 | ||
20 | #include "sfp-util_64.h" | 21 | #include "sfp-util_64.h" |
21 | #include <math-emu/soft-fp.h> | 22 | #include <math-emu/soft-fp.h> |
diff --git a/arch/sparc/mm/btfixup.c b/arch/sparc/mm/btfixup.c index 8a7f81743c12..09d6af22db2d 100644 --- a/arch/sparc/mm/btfixup.c +++ b/arch/sparc/mm/btfixup.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <asm/pgalloc.h> | 12 | #include <asm/pgalloc.h> |
13 | #include <asm/pgtable.h> | 13 | #include <asm/pgtable.h> |
14 | #include <asm/oplib.h> | 14 | #include <asm/oplib.h> |
15 | #include <asm/system.h> | ||
16 | #include <asm/cacheflush.h> | 15 | #include <asm/cacheflush.h> |
17 | 16 | ||
18 | #define BTFIXUP_OPTIMIZE_NOP | 17 | #define BTFIXUP_OPTIMIZE_NOP |
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c index 8023fd7e77b5..df3155a17991 100644 --- a/arch/sparc/mm/fault_32.c +++ b/arch/sparc/mm/fault_32.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/kdebug.h> | 23 | #include <linux/kdebug.h> |
24 | 24 | ||
25 | #include <asm/system.h> | ||
26 | #include <asm/page.h> | 25 | #include <asm/page.h> |
27 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
28 | #include <asm/memreg.h> | 27 | #include <asm/memreg.h> |
@@ -226,6 +225,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | |||
226 | unsigned long g2; | 225 | unsigned long g2; |
227 | int from_user = !(regs->psr & PSR_PS); | 226 | int from_user = !(regs->psr & PSR_PS); |
228 | int fault, code; | 227 | int fault, code; |
228 | unsigned int flags = (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | | ||
229 | (write ? FAULT_FLAG_WRITE : 0)); | ||
229 | 230 | ||
230 | if(text_fault) | 231 | if(text_fault) |
231 | address = regs->pc; | 232 | address = regs->pc; |
@@ -252,6 +253,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, | |||
252 | 253 | ||
253 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); | 254 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); |
254 | 255 | ||
256 | retry: | ||
255 | down_read(&mm->mmap_sem); | 257 | down_read(&mm->mmap_sem); |
256 | 258 | ||
257 | /* | 259 | /* |
@@ -290,7 +292,11 @@ good_area: | |||
290 | * make sure we exit gracefully rather than endlessly redo | 292 | * make sure we exit gracefully rather than endlessly redo |
291 | * the fault. | 293 | * the fault. |
292 | */ | 294 | */ |
293 | fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); | 295 | fault = handle_mm_fault(mm, vma, address, flags); |
296 | |||
297 | if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) | ||
298 | return; | ||
299 | |||
294 | if (unlikely(fault & VM_FAULT_ERROR)) { | 300 | if (unlikely(fault & VM_FAULT_ERROR)) { |
295 | if (fault & VM_FAULT_OOM) | 301 | if (fault & VM_FAULT_OOM) |
296 | goto out_of_memory; | 302 | goto out_of_memory; |
@@ -298,13 +304,29 @@ good_area: | |||
298 | goto do_sigbus; | 304 | goto do_sigbus; |
299 | BUG(); | 305 | BUG(); |
300 | } | 306 | } |
301 | if (fault & VM_FAULT_MAJOR) { | 307 | |
302 | current->maj_flt++; | 308 | if (flags & FAULT_FLAG_ALLOW_RETRY) { |
303 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address); | 309 | if (fault & VM_FAULT_MAJOR) { |
304 | } else { | 310 | current->maj_flt++; |
305 | current->min_flt++; | 311 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, |
306 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); | 312 | 1, regs, address); |
313 | } else { | ||
314 | current->min_flt++; | ||
315 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, | ||
316 | 1, regs, address); | ||
317 | } | ||
318 | if (fault & VM_FAULT_RETRY) { | ||
319 | flags &= ~FAULT_FLAG_ALLOW_RETRY; | ||
320 | |||
321 | /* No need to up_read(&mm->mmap_sem) as we would | ||
322 | * have already released it in __lock_page_or_retry | ||
323 | * in mm/filemap.c. | ||
324 | */ | ||
325 | |||
326 | goto retry; | ||
327 | } | ||
307 | } | 328 | } |
329 | |||
308 | up_read(&mm->mmap_sem); | 330 | up_read(&mm->mmap_sem); |
309 | return; | 331 | return; |
310 | 332 | ||
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c index 504c0622f729..1fe0429b6314 100644 --- a/arch/sparc/mm/fault_64.c +++ b/arch/sparc/mm/fault_64.c | |||
@@ -279,6 +279,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) | |||
279 | unsigned int insn = 0; | 279 | unsigned int insn = 0; |
280 | int si_code, fault_code, fault; | 280 | int si_code, fault_code, fault; |
281 | unsigned long address, mm_rss; | 281 | unsigned long address, mm_rss; |
282 | unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; | ||
282 | 283 | ||
283 | fault_code = get_thread_fault_code(); | 284 | fault_code = get_thread_fault_code(); |
284 | 285 | ||
@@ -333,6 +334,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) | |||
333 | insn = get_fault_insn(regs, insn); | 334 | insn = get_fault_insn(regs, insn); |
334 | goto handle_kernel_fault; | 335 | goto handle_kernel_fault; |
335 | } | 336 | } |
337 | |||
338 | retry: | ||
336 | down_read(&mm->mmap_sem); | 339 | down_read(&mm->mmap_sem); |
337 | } | 340 | } |
338 | 341 | ||
@@ -423,7 +426,12 @@ good_area: | |||
423 | goto bad_area; | 426 | goto bad_area; |
424 | } | 427 | } |
425 | 428 | ||
426 | fault = handle_mm_fault(mm, vma, address, (fault_code & FAULT_CODE_WRITE) ? FAULT_FLAG_WRITE : 0); | 429 | flags |= ((fault_code & FAULT_CODE_WRITE) ? FAULT_FLAG_WRITE : 0); |
430 | fault = handle_mm_fault(mm, vma, address, flags); | ||
431 | |||
432 | if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) | ||
433 | return; | ||
434 | |||
427 | if (unlikely(fault & VM_FAULT_ERROR)) { | 435 | if (unlikely(fault & VM_FAULT_ERROR)) { |
428 | if (fault & VM_FAULT_OOM) | 436 | if (fault & VM_FAULT_OOM) |
429 | goto out_of_memory; | 437 | goto out_of_memory; |
@@ -431,12 +439,27 @@ good_area: | |||
431 | goto do_sigbus; | 439 | goto do_sigbus; |
432 | BUG(); | 440 | BUG(); |
433 | } | 441 | } |
434 | if (fault & VM_FAULT_MAJOR) { | 442 | |
435 | current->maj_flt++; | 443 | if (flags & FAULT_FLAG_ALLOW_RETRY) { |
436 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address); | 444 | if (fault & VM_FAULT_MAJOR) { |
437 | } else { | 445 | current->maj_flt++; |
438 | current->min_flt++; | 446 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, |
439 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); | 447 | 1, regs, address); |
448 | } else { | ||
449 | current->min_flt++; | ||
450 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, | ||
451 | 1, regs, address); | ||
452 | } | ||
453 | if (fault & VM_FAULT_RETRY) { | ||
454 | flags &= ~FAULT_FLAG_ALLOW_RETRY; | ||
455 | |||
456 | /* No need to up_read(&mm->mmap_sem) as we would | ||
457 | * have already released it in __lock_page_or_retry | ||
458 | * in mm/filemap.c. | ||
459 | */ | ||
460 | |||
461 | goto retry; | ||
462 | } | ||
440 | } | 463 | } |
441 | up_read(&mm->mmap_sem); | 464 | up_read(&mm->mmap_sem); |
442 | 465 | ||
diff --git a/arch/sparc/mm/highmem.c b/arch/sparc/mm/highmem.c index 77140a02c86a..055c66cf1bf4 100644 --- a/arch/sparc/mm/highmem.c +++ b/arch/sparc/mm/highmem.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <asm/tlbflush.h> | 30 | #include <asm/tlbflush.h> |
31 | #include <asm/fixmap.h> | 31 | #include <asm/fixmap.h> |
32 | 32 | ||
33 | void *__kmap_atomic(struct page *page) | 33 | void *kmap_atomic(struct page *page) |
34 | { | 34 | { |
35 | unsigned long vaddr; | 35 | unsigned long vaddr; |
36 | long idx, type; | 36 | long idx, type; |
@@ -64,7 +64,7 @@ void *__kmap_atomic(struct page *page) | |||
64 | 64 | ||
65 | return (void*) vaddr; | 65 | return (void*) vaddr; |
66 | } | 66 | } |
67 | EXPORT_SYMBOL(__kmap_atomic); | 67 | EXPORT_SYMBOL(kmap_atomic); |
68 | 68 | ||
69 | void __kunmap_atomic(void *kvaddr) | 69 | void __kunmap_atomic(void *kvaddr) |
70 | { | 70 | { |
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index 7b00de61c5f1..c5f9021b1a01 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/gfp.h> | 27 | #include <linux/gfp.h> |
28 | 28 | ||
29 | #include <asm/sections.h> | 29 | #include <asm/sections.h> |
30 | #include <asm/system.h> | ||
31 | #include <asm/vac-ops.h> | 30 | #include <asm/vac-ops.h> |
32 | #include <asm/page.h> | 31 | #include <asm/page.h> |
33 | #include <asm/pgtable.h> | 32 | #include <asm/pgtable.h> |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index b3f5e7dfea51..21faaeea85de 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/gfp.h> | 28 | #include <linux/gfp.h> |
29 | 29 | ||
30 | #include <asm/head.h> | 30 | #include <asm/head.h> |
31 | #include <asm/system.h> | ||
32 | #include <asm/page.h> | 31 | #include <asm/page.h> |
33 | #include <asm/pgalloc.h> | 32 | #include <asm/pgalloc.h> |
34 | #include <asm/pgtable.h> | 33 | #include <asm/pgtable.h> |
diff --git a/arch/sparc/mm/init_64.h b/arch/sparc/mm/init_64.h index 77d1b313e344..3e1ac8b96cae 100644 --- a/arch/sparc/mm/init_64.h +++ b/arch/sparc/mm/init_64.h | |||
@@ -36,8 +36,6 @@ extern unsigned long kern_locked_tte_data; | |||
36 | 36 | ||
37 | extern void prom_world(int enter); | 37 | extern void prom_world(int enter); |
38 | 38 | ||
39 | extern void free_initmem(void); | ||
40 | |||
41 | #ifdef CONFIG_SPARSEMEM_VMEMMAP | 39 | #ifdef CONFIG_SPARSEMEM_VMEMMAP |
42 | #define VMEMMAP_CHUNK_SHIFT 22 | 40 | #define VMEMMAP_CHUNK_SHIFT 22 |
43 | #define VMEMMAP_CHUNK (1UL << VMEMMAP_CHUNK_SHIFT) | 41 | #define VMEMMAP_CHUNK (1UL << VMEMMAP_CHUNK_SHIFT) |
diff --git a/arch/sparc/mm/loadmmu.c b/arch/sparc/mm/loadmmu.c index 82ec8f666036..c5bf2a6c3858 100644 --- a/arch/sparc/mm/loadmmu.c +++ b/arch/sparc/mm/loadmmu.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | 13 | ||
14 | #include <asm/system.h> | ||
15 | #include <asm/page.h> | 14 | #include <asm/page.h> |
16 | #include <asm/pgtable.h> | 15 | #include <asm/pgtable.h> |
17 | #include <asm/mmu_context.h> | 16 | #include <asm/mmu_context.h> |
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c index 536412d8f416..c52add79b83d 100644 --- a/arch/sparc/mm/tsb.c +++ b/arch/sparc/mm/tsb.c | |||
@@ -6,7 +6,6 @@ | |||
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
7 | #include <linux/preempt.h> | 7 | #include <linux/preempt.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <asm/system.h> | ||
10 | #include <asm/page.h> | 9 | #include <asm/page.h> |
11 | #include <asm/tlbflush.h> | 10 | #include <asm/tlbflush.h> |
12 | #include <asm/tlb.h> | 11 | #include <asm/tlb.h> |
diff --git a/arch/sparc/prom/console_32.c b/arch/sparc/prom/console_32.c index a00f47b16c10..1cfb50f4cb9c 100644 --- a/arch/sparc/prom/console_32.c +++ b/arch/sparc/prom/console_32.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
12 | #include <asm/openprom.h> | 12 | #include <asm/openprom.h> |
13 | #include <asm/oplib.h> | 13 | #include <asm/oplib.h> |
14 | #include <asm/system.h> | ||
15 | #include <linux/string.h> | 14 | #include <linux/string.h> |
16 | 15 | ||
17 | extern void restore_current(void); | 16 | extern void restore_current(void); |
diff --git a/arch/sparc/prom/console_64.c b/arch/sparc/prom/console_64.c index 9de6c8cfe04a..f95edcc54fd5 100644 --- a/arch/sparc/prom/console_64.c +++ b/arch/sparc/prom/console_64.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
11 | #include <asm/openprom.h> | 11 | #include <asm/openprom.h> |
12 | #include <asm/oplib.h> | 12 | #include <asm/oplib.h> |
13 | #include <asm/system.h> | ||
14 | #include <linux/string.h> | 13 | #include <linux/string.h> |
15 | 14 | ||
16 | static int __prom_console_write_buf(const char *buf, int len) | 15 | static int __prom_console_write_buf(const char *buf, int len) |
diff --git a/arch/sparc/prom/misc_32.c b/arch/sparc/prom/misc_32.c index 677b6a10fbde..8dc0b6b271e8 100644 --- a/arch/sparc/prom/misc_32.c +++ b/arch/sparc/prom/misc_32.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <asm/openprom.h> | 13 | #include <asm/openprom.h> |
14 | #include <asm/oplib.h> | 14 | #include <asm/oplib.h> |
15 | #include <asm/auxio.h> | 15 | #include <asm/auxio.h> |
16 | #include <asm/system.h> | ||
17 | 16 | ||
18 | extern void restore_current(void); | 17 | extern void restore_current(void); |
19 | 18 | ||
diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c index e4f31d4d3715..f178b9dcc7b7 100644 --- a/arch/sparc/prom/misc_64.c +++ b/arch/sparc/prom/misc_64.c | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <asm/openprom.h> | 16 | #include <asm/openprom.h> |
17 | #include <asm/oplib.h> | 17 | #include <asm/oplib.h> |
18 | #include <asm/system.h> | ||
19 | #include <asm/ldc.h> | 18 | #include <asm/ldc.h> |
20 | 19 | ||
21 | static int prom_service_exists(const char *service_name) | 20 | static int prom_service_exists(const char *service_name) |
diff --git a/arch/sparc/prom/p1275.c b/arch/sparc/prom/p1275.c index d9850c2b9bf2..04a4540509dd 100644 --- a/arch/sparc/prom/p1275.c +++ b/arch/sparc/prom/p1275.c | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | #include <asm/openprom.h> | 14 | #include <asm/openprom.h> |
15 | #include <asm/oplib.h> | 15 | #include <asm/oplib.h> |
16 | #include <asm/system.h> | ||
17 | #include <asm/spitfire.h> | 16 | #include <asm/spitfire.h> |
18 | #include <asm/pstate.h> | 17 | #include <asm/pstate.h> |
19 | #include <asm/ldc.h> | 18 | #include <asm/ldc.h> |
diff --git a/arch/sparc/prom/ranges.c b/arch/sparc/prom/ranges.c index 0857aa9e839d..ad143c13bdc0 100644 --- a/arch/sparc/prom/ranges.c +++ b/arch/sparc/prom/ranges.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <asm/openprom.h> | 11 | #include <asm/openprom.h> |
12 | #include <asm/oplib.h> | 12 | #include <asm/oplib.h> |
13 | #include <asm/types.h> | 13 | #include <asm/types.h> |
14 | #include <asm/system.h> | ||
15 | 14 | ||
16 | static struct linux_prom_ranges promlib_obio_ranges[PROMREG_MAX]; | 15 | static struct linux_prom_ranges promlib_obio_ranges[PROMREG_MAX]; |
17 | static int num_obio_ranges; | 16 | static int num_obio_ranges; |