diff options
Diffstat (limited to 'arch/sh/include/asm')
67 files changed, 542 insertions, 1021 deletions
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild index 280bea9e5e2..7beb42322f6 100644 --- a/arch/sh/include/asm/Kbuild +++ b/arch/sh/include/asm/Kbuild | |||
@@ -1,36 +1,11 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
1 | 2 | ||
2 | generic-y += bitsperlong.h | 3 | header-y += cachectl.h |
3 | generic-y += cputime.h | 4 | header-y += cpu-features.h |
4 | generic-y += current.h | 5 | header-y += hw_breakpoint.h |
5 | generic-y += delay.h | 6 | header-y += posix_types_32.h |
6 | generic-y += div64.h | 7 | header-y += posix_types_64.h |
7 | generic-y += emergency-restart.h | 8 | header-y += ptrace_32.h |
8 | generic-y += errno.h | 9 | header-y += ptrace_64.h |
9 | generic-y += exec.h | 10 | header-y += unistd_32.h |
10 | generic-y += fcntl.h | 11 | header-y += unistd_64.h |
11 | generic-y += ioctl.h | ||
12 | generic-y += ipcbuf.h | ||
13 | generic-y += irq_regs.h | ||
14 | generic-y += kvm_para.h | ||
15 | generic-y += local.h | ||
16 | generic-y += local64.h | ||
17 | generic-y += param.h | ||
18 | generic-y += parport.h | ||
19 | generic-y += percpu.h | ||
20 | generic-y += poll.h | ||
21 | generic-y += mman.h | ||
22 | generic-y += msgbuf.h | ||
23 | generic-y += resource.h | ||
24 | generic-y += scatterlist.h | ||
25 | generic-y += sembuf.h | ||
26 | generic-y += serial.h | ||
27 | generic-y += shmbuf.h | ||
28 | generic-y += siginfo.h | ||
29 | generic-y += sizes.h | ||
30 | generic-y += socket.h | ||
31 | generic-y += statfs.h | ||
32 | generic-y += termbits.h | ||
33 | generic-y += termios.h | ||
34 | generic-y += trace_clock.h | ||
35 | generic-y += ucontext.h | ||
36 | generic-y += xor.h | ||
diff --git a/arch/sh/include/asm/atomic-irq.h b/arch/sh/include/asm/atomic-irq.h index 9f7c56609e5..467d9415a32 100644 --- a/arch/sh/include/asm/atomic-irq.h +++ b/arch/sh/include/asm/atomic-irq.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef __ASM_SH_ATOMIC_IRQ_H | 1 | #ifndef __ASM_SH_ATOMIC_IRQ_H |
2 | #define __ASM_SH_ATOMIC_IRQ_H | 2 | #define __ASM_SH_ATOMIC_IRQ_H |
3 | 3 | ||
4 | #include <linux/irqflags.h> | ||
5 | |||
6 | /* | 4 | /* |
7 | * To get proper branch prediction for the main line, we must branch | 5 | * To get proper branch prediction for the main line, we must branch |
8 | * forward to code at the end of this object's .text section, then | 6 | * forward to code at the end of this object's .text section, then |
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h index f4c1c20bcdf..63a27dbc952 100644 --- a/arch/sh/include/asm/atomic.h +++ b/arch/sh/include/asm/atomic.h | |||
@@ -9,9 +9,9 @@ | |||
9 | 9 | ||
10 | #include <linux/compiler.h> | 10 | #include <linux/compiler.h> |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <asm/cmpxchg.h> | 12 | #include <asm/system.h> |
13 | 13 | ||
14 | #define ATOMIC_INIT(i) { (i) } | 14 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) |
15 | 15 | ||
16 | #define atomic_read(v) (*(volatile int *)&(v)->counter) | 16 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
17 | #define atomic_set(v,i) ((v)->counter = (i)) | 17 | #define atomic_set(v,i) ((v)->counter = (i)) |
diff --git a/arch/sh/include/asm/barrier.h b/arch/sh/include/asm/barrier.h deleted file mode 100644 index 72c103dae30..00000000000 --- a/arch/sh/include/asm/barrier.h +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima | ||
3 | * Copyright (C) 2002 Paul Mundt | ||
4 | */ | ||
5 | #ifndef __ASM_SH_BARRIER_H | ||
6 | #define __ASM_SH_BARRIER_H | ||
7 | |||
8 | #if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5) | ||
9 | #include <asm/cache_insns.h> | ||
10 | #endif | ||
11 | |||
12 | /* | ||
13 | * A brief note on ctrl_barrier(), the control register write barrier. | ||
14 | * | ||
15 | * Legacy SH cores typically require a sequence of 8 nops after | ||
16 | * modification of a control register in order for the changes to take | ||
17 | * effect. On newer cores (like the sh4a and sh5) this is accomplished | ||
18 | * with icbi. | ||
19 | * | ||
20 | * Also note that on sh4a in the icbi case we can forego a synco for the | ||
21 | * write barrier, as it's not necessary for control registers. | ||
22 | * | ||
23 | * Historically we have only done this type of barrier for the MMUCR, but | ||
24 | * it's also necessary for the CCR, so we make it generic here instead. | ||
25 | */ | ||
26 | #if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5) | ||
27 | #define mb() __asm__ __volatile__ ("synco": : :"memory") | ||
28 | #define rmb() mb() | ||
29 | #define wmb() __asm__ __volatile__ ("synco": : :"memory") | ||
30 | #define ctrl_barrier() __icbi(PAGE_OFFSET) | ||
31 | #define read_barrier_depends() do { } while(0) | ||
32 | #else | ||
33 | #define mb() __asm__ __volatile__ ("": : :"memory") | ||
34 | #define rmb() mb() | ||
35 | #define wmb() __asm__ __volatile__ ("": : :"memory") | ||
36 | #define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop") | ||
37 | #define read_barrier_depends() do { } while(0) | ||
38 | #endif | ||
39 | |||
40 | #ifdef CONFIG_SMP | ||
41 | #define smp_mb() mb() | ||
42 | #define smp_rmb() rmb() | ||
43 | #define smp_wmb() wmb() | ||
44 | #define smp_read_barrier_depends() read_barrier_depends() | ||
45 | #else | ||
46 | #define smp_mb() barrier() | ||
47 | #define smp_rmb() barrier() | ||
48 | #define smp_wmb() barrier() | ||
49 | #define smp_read_barrier_depends() do { } while(0) | ||
50 | #endif | ||
51 | |||
52 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | ||
53 | |||
54 | #endif /* __ASM_SH_BARRIER_H */ | ||
diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h index ea8706d94f0..90fa3e48b4d 100644 --- a/arch/sh/include/asm/bitops.h +++ b/arch/sh/include/asm/bitops.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #error only <linux/bitops.h> can be included directly | 7 | #error only <linux/bitops.h> can be included directly |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | #include <asm/system.h> | ||
10 | /* For __swab32 */ | 11 | /* For __swab32 */ |
11 | #include <asm/byteorder.h> | 12 | #include <asm/byteorder.h> |
12 | 13 | ||
diff --git a/arch/sh/include/asm/bl_bit.h b/arch/sh/include/asm/bl_bit.h deleted file mode 100644 index 06e4163c674..00000000000 --- a/arch/sh/include/asm/bl_bit.h +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | #ifndef __ASM_SH_BL_BIT_H | ||
2 | #define __ASM_SH_BL_BIT_H | ||
3 | |||
4 | #ifdef CONFIG_SUPERH32 | ||
5 | # include <asm/bl_bit_32.h> | ||
6 | #else | ||
7 | # include <asm/bl_bit_64.h> | ||
8 | #endif | ||
9 | |||
10 | #endif /* __ASM_SH_BL_BIT_H */ | ||
diff --git a/arch/sh/include/asm/bl_bit_32.h b/arch/sh/include/asm/bl_bit_32.h deleted file mode 100644 index fd21eee6214..00000000000 --- a/arch/sh/include/asm/bl_bit_32.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | #ifndef __ASM_SH_BL_BIT_32_H | ||
2 | #define __ASM_SH_BL_BIT_32_H | ||
3 | |||
4 | static inline void set_bl_bit(void) | ||
5 | { | ||
6 | unsigned long __dummy0, __dummy1; | ||
7 | |||
8 | __asm__ __volatile__ ( | ||
9 | "stc sr, %0\n\t" | ||
10 | "or %2, %0\n\t" | ||
11 | "and %3, %0\n\t" | ||
12 | "ldc %0, sr\n\t" | ||
13 | : "=&r" (__dummy0), "=r" (__dummy1) | ||
14 | : "r" (0x10000000), "r" (0xffffff0f) | ||
15 | : "memory" | ||
16 | ); | ||
17 | } | ||
18 | |||
19 | static inline void clear_bl_bit(void) | ||
20 | { | ||
21 | unsigned long __dummy0, __dummy1; | ||
22 | |||
23 | __asm__ __volatile__ ( | ||
24 | "stc sr, %0\n\t" | ||
25 | "and %2, %0\n\t" | ||
26 | "ldc %0, sr\n\t" | ||
27 | : "=&r" (__dummy0), "=r" (__dummy1) | ||
28 | : "1" (~0x10000000) | ||
29 | : "memory" | ||
30 | ); | ||
31 | } | ||
32 | |||
33 | #endif /* __ASM_SH_BL_BIT_32_H */ | ||
diff --git a/arch/sh/include/asm/bl_bit_64.h b/arch/sh/include/asm/bl_bit_64.h deleted file mode 100644 index 6cc8711af43..00000000000 --- a/arch/sh/include/asm/bl_bit_64.h +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001 Paolo Alberelli | ||
3 | * Copyright (C) 2003 Paul Mundt | ||
4 | * Copyright (C) 2004 Richard Curnow | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef __ASM_SH_BL_BIT_64_H | ||
11 | #define __ASM_SH_BL_BIT_64_H | ||
12 | |||
13 | #include <asm/processor.h> | ||
14 | |||
15 | #define SR_BL_LL 0x0000000010000000LL | ||
16 | |||
17 | static inline void set_bl_bit(void) | ||
18 | { | ||
19 | unsigned long long __dummy0, __dummy1 = SR_BL_LL; | ||
20 | |||
21 | __asm__ __volatile__("getcon " __SR ", %0\n\t" | ||
22 | "or %0, %1, %0\n\t" | ||
23 | "putcon %0, " __SR "\n\t" | ||
24 | : "=&r" (__dummy0) | ||
25 | : "r" (__dummy1)); | ||
26 | |||
27 | } | ||
28 | |||
29 | static inline void clear_bl_bit(void) | ||
30 | { | ||
31 | unsigned long long __dummy0, __dummy1 = ~SR_BL_LL; | ||
32 | |||
33 | __asm__ __volatile__("getcon " __SR ", %0\n\t" | ||
34 | "and %0, %1, %0\n\t" | ||
35 | "putcon %0, " __SR "\n\t" | ||
36 | : "=&r" (__dummy0) | ||
37 | : "r" (__dummy1)); | ||
38 | } | ||
39 | |||
40 | #endif /* __ASM_SH_BL_BIT_64_H */ | ||
diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h index dcf27807542..6323f864d11 100644 --- a/arch/sh/include/asm/bug.h +++ b/arch/sh/include/asm/bug.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef __ASM_SH_BUG_H | 1 | #ifndef __ASM_SH_BUG_H |
2 | #define __ASM_SH_BUG_H | 2 | #define __ASM_SH_BUG_H |
3 | 3 | ||
4 | #include <linux/linkage.h> | ||
5 | |||
6 | #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ | 4 | #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ |
7 | #define BUGFLAG_UNWINDER (1 << 1) | 5 | #define BUGFLAG_UNWINDER (1 << 1) |
8 | 6 | ||
@@ -109,11 +107,4 @@ do { \ | |||
109 | 107 | ||
110 | #include <asm-generic/bug.h> | 108 | #include <asm-generic/bug.h> |
111 | 109 | ||
112 | struct pt_regs; | ||
113 | |||
114 | /* arch/sh/kernel/traps.c */ | ||
115 | extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn)); | ||
116 | extern void die_if_kernel(const char *str, struct pt_regs *regs, long err); | ||
117 | extern void die_if_no_fixup(const char *str, struct pt_regs *regs, long err); | ||
118 | |||
119 | #endif /* __ASM_SH_BUG_H */ | 110 | #endif /* __ASM_SH_BUG_H */ |
diff --git a/arch/sh/include/asm/cache_insns.h b/arch/sh/include/asm/cache_insns.h deleted file mode 100644 index 355cb06b7a3..00000000000 --- a/arch/sh/include/asm/cache_insns.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | #ifndef __ASM_SH_CACHE_INSNS_H | ||
2 | #define __ASM_SH_CACHE_INSNS_H | ||
3 | |||
4 | |||
5 | #ifdef CONFIG_SUPERH32 | ||
6 | # include <asm/cache_insns_32.h> | ||
7 | #else | ||
8 | # include <asm/cache_insns_64.h> | ||
9 | #endif | ||
10 | |||
11 | #endif /* __ASM_SH_CACHE_INSNS_H */ | ||
diff --git a/arch/sh/include/asm/cache_insns_32.h b/arch/sh/include/asm/cache_insns_32.h deleted file mode 100644 index b92fe541609..00000000000 --- a/arch/sh/include/asm/cache_insns_32.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | #ifndef __ASM_SH_CACHE_INSNS_32_H | ||
2 | #define __ASM_SH_CACHE_INSNS_32_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #if defined(CONFIG_CPU_SH4A) | ||
7 | #define __icbi(addr) __asm__ __volatile__ ( "icbi @%0\n\t" : : "r" (addr)) | ||
8 | #else | ||
9 | #define __icbi(addr) mb() | ||
10 | #endif | ||
11 | |||
12 | #define __ocbp(addr) __asm__ __volatile__ ( "ocbp @%0\n\t" : : "r" (addr)) | ||
13 | #define __ocbi(addr) __asm__ __volatile__ ( "ocbi @%0\n\t" : : "r" (addr)) | ||
14 | #define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb @%0\n\t" : : "r" (addr)) | ||
15 | |||
16 | static inline reg_size_t register_align(void *val) | ||
17 | { | ||
18 | return (unsigned long)(signed long)val; | ||
19 | } | ||
20 | |||
21 | #endif /* __ASM_SH_CACHE_INSNS_32_H */ | ||
diff --git a/arch/sh/include/asm/cache_insns_64.h b/arch/sh/include/asm/cache_insns_64.h deleted file mode 100644 index 70b6357eaf1..00000000000 --- a/arch/sh/include/asm/cache_insns_64.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001 Paolo Alberelli | ||
3 | * Copyright (C) 2003 Paul Mundt | ||
4 | * Copyright (C) 2004 Richard Curnow | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef __ASM_SH_CACHE_INSNS_64_H | ||
11 | #define __ASM_SH_CACHE_INSNS_64_H | ||
12 | |||
13 | #define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr)) | ||
14 | #define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr)) | ||
15 | #define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr)) | ||
16 | #define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb %0, 0\n\t" : : "r" (addr)) | ||
17 | |||
18 | static inline reg_size_t register_align(void *val) | ||
19 | { | ||
20 | return (unsigned long long)(signed long long)(signed long)val; | ||
21 | } | ||
22 | |||
23 | #endif /* __ASM_SH_CACHE_INSNS_64_H */ | ||
diff --git a/arch/sh/include/asm/checksum.h b/arch/sh/include/asm/checksum.h index 34ae2620452..fc26d1f4b59 100644 --- a/arch/sh/include/asm/checksum.h +++ b/arch/sh/include/asm/checksum.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifdef CONFIG_SUPERH32 | 1 | #ifdef CONFIG_SUPERH32 |
2 | # include <asm/checksum_32.h> | 2 | # include "checksum_32.h" |
3 | #else | 3 | #else |
4 | # include <asm-generic/checksum.h> | 4 | # include <asm-generic/checksum.h> |
5 | #endif | 5 | #endif |
diff --git a/arch/sh/include/asm/clock.h b/arch/sh/include/asm/clock.h index 0390a07e7e3..803d4c7f09d 100644 --- a/arch/sh/include/asm/clock.h +++ b/arch/sh/include/asm/clock.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/sh_clk.h> | 4 | #include <linux/sh_clk.h> |
5 | 5 | ||
6 | /* Should be defined by processor-specific code */ | 6 | /* Should be defined by processor-specific code */ |
7 | void __deprecated arch_init_clk_ops(struct sh_clk_ops **, int type); | 7 | void __deprecated arch_init_clk_ops(struct clk_ops **, int type); |
8 | int __init arch_clk_init(void); | 8 | int __init arch_clk_init(void); |
9 | 9 | ||
10 | /* arch/sh/kernel/cpu/clock-cpg.c */ | 10 | /* arch/sh/kernel/cpu/clock-cpg.c */ |
diff --git a/arch/sh/include/asm/cmpxchg-irq.h b/arch/sh/include/asm/cmpxchg-irq.h index bd11f630414..43049ec0554 100644 --- a/arch/sh/include/asm/cmpxchg-irq.h +++ b/arch/sh/include/asm/cmpxchg-irq.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef __ASM_SH_CMPXCHG_IRQ_H | 1 | #ifndef __ASM_SH_CMPXCHG_IRQ_H |
2 | #define __ASM_SH_CMPXCHG_IRQ_H | 2 | #define __ASM_SH_CMPXCHG_IRQ_H |
3 | 3 | ||
4 | #include <linux/irqflags.h> | ||
5 | |||
6 | static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) | 4 | static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) |
7 | { | 5 | { |
8 | unsigned long flags, retval; | 6 | unsigned long flags, retval; |
diff --git a/arch/sh/include/asm/cmpxchg.h b/arch/sh/include/asm/cmpxchg.h deleted file mode 100644 index f6bd1406b89..00000000000 --- a/arch/sh/include/asm/cmpxchg.h +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | #ifndef __ASM_SH_CMPXCHG_H | ||
2 | #define __ASM_SH_CMPXCHG_H | ||
3 | |||
4 | /* | ||
5 | * Atomic operations that C can't guarantee us. Useful for | ||
6 | * resource counting etc.. | ||
7 | */ | ||
8 | |||
9 | #include <linux/compiler.h> | ||
10 | #include <linux/types.h> | ||
11 | |||
12 | #if defined(CONFIG_GUSA_RB) | ||
13 | #include <asm/cmpxchg-grb.h> | ||
14 | #elif defined(CONFIG_CPU_SH4A) | ||
15 | #include <asm/cmpxchg-llsc.h> | ||
16 | #else | ||
17 | #include <asm/cmpxchg-irq.h> | ||
18 | #endif | ||
19 | |||
20 | extern void __xchg_called_with_bad_pointer(void); | ||
21 | |||
22 | #define __xchg(ptr, x, size) \ | ||
23 | ({ \ | ||
24 | unsigned long __xchg__res; \ | ||
25 | volatile void *__xchg_ptr = (ptr); \ | ||
26 | switch (size) { \ | ||
27 | case 4: \ | ||
28 | __xchg__res = xchg_u32(__xchg_ptr, x); \ | ||
29 | break; \ | ||
30 | case 1: \ | ||
31 | __xchg__res = xchg_u8(__xchg_ptr, x); \ | ||
32 | break; \ | ||
33 | default: \ | ||
34 | __xchg_called_with_bad_pointer(); \ | ||
35 | __xchg__res = x; \ | ||
36 | break; \ | ||
37 | } \ | ||
38 | \ | ||
39 | __xchg__res; \ | ||
40 | }) | ||
41 | |||
42 | #define xchg(ptr,x) \ | ||
43 | ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr)))) | ||
44 | |||
45 | /* This function doesn't exist, so you'll get a linker error | ||
46 | * if something tries to do an invalid cmpxchg(). */ | ||
47 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
48 | |||
49 | #define __HAVE_ARCH_CMPXCHG 1 | ||
50 | |||
51 | static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old, | ||
52 | unsigned long new, int size) | ||
53 | { | ||
54 | switch (size) { | ||
55 | case 4: | ||
56 | return __cmpxchg_u32(ptr, old, new); | ||
57 | } | ||
58 | __cmpxchg_called_with_bad_pointer(); | ||
59 | return old; | ||
60 | } | ||
61 | |||
62 | #define cmpxchg(ptr,o,n) \ | ||
63 | ({ \ | ||
64 | __typeof__(*(ptr)) _o_ = (o); \ | ||
65 | __typeof__(*(ptr)) _n_ = (n); \ | ||
66 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
67 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
68 | }) | ||
69 | |||
70 | #endif /* __ASM_SH_CMPXCHG_H */ | ||
diff --git a/arch/sh/include/asm/device.h b/arch/sh/include/asm/device.h index 071bcb4d4bf..b16debfe8c1 100644 --- a/arch/sh/include/asm/device.h +++ b/arch/sh/include/asm/device.h | |||
@@ -3,10 +3,9 @@ | |||
3 | * | 3 | * |
4 | * This file is released under the GPLv2 | 4 | * This file is released under the GPLv2 |
5 | */ | 5 | */ |
6 | #ifndef __ASM_SH_DEVICE_H | ||
7 | #define __ASM_SH_DEVICE_H | ||
8 | 6 | ||
9 | #include <asm-generic/device.h> | 7 | struct dev_archdata { |
8 | }; | ||
10 | 9 | ||
11 | struct platform_device; | 10 | struct platform_device; |
12 | /* allocate contiguous memory chunk and fill in struct resource */ | 11 | /* allocate contiguous memory chunk and fill in struct resource */ |
@@ -15,4 +14,15 @@ int platform_resource_setup_memory(struct platform_device *pdev, | |||
15 | 14 | ||
16 | void plat_early_device_setup(void); | 15 | void plat_early_device_setup(void); |
17 | 16 | ||
18 | #endif /* __ASM_SH_DEVICE_H */ | 17 | #define PDEV_ARCHDATA_FLAG_INIT 0 |
18 | #define PDEV_ARCHDATA_FLAG_IDLE 1 | ||
19 | #define PDEV_ARCHDATA_FLAG_SUSP 2 | ||
20 | |||
21 | struct pdev_archdata { | ||
22 | int hwblk_id; | ||
23 | #ifdef CONFIG_PM_RUNTIME | ||
24 | unsigned long flags; | ||
25 | struct list_head entry; | ||
26 | struct mutex mutex; | ||
27 | #endif | ||
28 | }; | ||
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h index b437f2c780b..1a73c3e759a 100644 --- a/arch/sh/include/asm/dma-mapping.h +++ b/arch/sh/include/asm/dma-mapping.h | |||
@@ -46,38 +46,31 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
46 | { | 46 | { |
47 | struct dma_map_ops *ops = get_dma_ops(dev); | 47 | struct dma_map_ops *ops = get_dma_ops(dev); |
48 | 48 | ||
49 | debug_dma_mapping_error(dev, dma_addr); | ||
50 | if (ops->mapping_error) | 49 | if (ops->mapping_error) |
51 | return ops->mapping_error(dev, dma_addr); | 50 | return ops->mapping_error(dev, dma_addr); |
52 | 51 | ||
53 | return dma_addr == 0; | 52 | return dma_addr == 0; |
54 | } | 53 | } |
55 | 54 | ||
56 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) | 55 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, |
57 | 56 | dma_addr_t *dma_handle, gfp_t gfp) | |
58 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
59 | dma_addr_t *dma_handle, gfp_t gfp, | ||
60 | struct dma_attrs *attrs) | ||
61 | { | 57 | { |
62 | struct dma_map_ops *ops = get_dma_ops(dev); | 58 | struct dma_map_ops *ops = get_dma_ops(dev); |
63 | void *memory; | 59 | void *memory; |
64 | 60 | ||
65 | if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) | 61 | if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) |
66 | return memory; | 62 | return memory; |
67 | if (!ops->alloc) | 63 | if (!ops->alloc_coherent) |
68 | return NULL; | 64 | return NULL; |
69 | 65 | ||
70 | memory = ops->alloc(dev, size, dma_handle, gfp, attrs); | 66 | memory = ops->alloc_coherent(dev, size, dma_handle, gfp); |
71 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); | 67 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); |
72 | 68 | ||
73 | return memory; | 69 | return memory; |
74 | } | 70 | } |
75 | 71 | ||
76 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) | 72 | static inline void dma_free_coherent(struct device *dev, size_t size, |
77 | 73 | void *vaddr, dma_addr_t dma_handle) | |
78 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
79 | void *vaddr, dma_addr_t dma_handle, | ||
80 | struct dma_attrs *attrs) | ||
81 | { | 74 | { |
82 | struct dma_map_ops *ops = get_dma_ops(dev); | 75 | struct dma_map_ops *ops = get_dma_ops(dev); |
83 | 76 | ||
@@ -85,16 +78,14 @@ static inline void dma_free_attrs(struct device *dev, size_t size, | |||
85 | return; | 78 | return; |
86 | 79 | ||
87 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); | 80 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); |
88 | if (ops->free) | 81 | if (ops->free_coherent) |
89 | ops->free(dev, size, vaddr, dma_handle, attrs); | 82 | ops->free_coherent(dev, size, vaddr, dma_handle); |
90 | } | 83 | } |
91 | 84 | ||
92 | /* arch/sh/mm/consistent.c */ | 85 | /* arch/sh/mm/consistent.c */ |
93 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 86 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
94 | dma_addr_t *dma_addr, gfp_t flag, | 87 | dma_addr_t *dma_addr, gfp_t flag); |
95 | struct dma_attrs *attrs); | ||
96 | extern void dma_generic_free_coherent(struct device *dev, size_t size, | 88 | extern void dma_generic_free_coherent(struct device *dev, size_t size, |
97 | void *vaddr, dma_addr_t dma_handle, | 89 | void *vaddr, dma_addr_t dma_handle); |
98 | struct dma_attrs *attrs); | ||
99 | 90 | ||
100 | #endif /* __ASM_SH_DMA_MAPPING_H */ | 91 | #endif /* __ASM_SH_DMA_MAPPING_H */ |
diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h index fb6e4f7b00a..07373a07409 100644 --- a/arch/sh/include/asm/dma.h +++ b/arch/sh/include/asm/dma.h | |||
@@ -14,9 +14,18 @@ | |||
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/wait.h> | 15 | #include <linux/wait.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/device.h> | 17 | #include <linux/sysdev.h> |
18 | #include <cpu/dma.h> | ||
18 | #include <asm-generic/dma.h> | 19 | #include <asm-generic/dma.h> |
19 | 20 | ||
21 | #ifdef CONFIG_NR_DMA_CHANNELS | ||
22 | # define MAX_DMA_CHANNELS (CONFIG_NR_DMA_CHANNELS) | ||
23 | #elif defined(CONFIG_NR_ONCHIP_DMA_CHANNELS) | ||
24 | # define MAX_DMA_CHANNELS (CONFIG_NR_ONCHIP_DMA_CHANNELS) | ||
25 | #else | ||
26 | # define MAX_DMA_CHANNELS 0 | ||
27 | #endif | ||
28 | |||
20 | /* | 29 | /* |
21 | * Read and write modes can mean drastically different things depending on the | 30 | * Read and write modes can mean drastically different things depending on the |
22 | * channel configuration. Consult your DMAC documentation and module | 31 | * channel configuration. Consult your DMAC documentation and module |
@@ -82,7 +91,7 @@ struct dma_channel { | |||
82 | 91 | ||
83 | wait_queue_head_t wait_queue; | 92 | wait_queue_head_t wait_queue; |
84 | 93 | ||
85 | struct device dev; | 94 | struct sys_device dev; |
86 | void *priv_data; | 95 | void *priv_data; |
87 | }; | 96 | }; |
88 | 97 | ||
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h index 37924afa8d8..f38112be67d 100644 --- a/arch/sh/include/asm/elf.h +++ b/arch/sh/include/asm/elf.h | |||
@@ -183,8 +183,7 @@ do { \ | |||
183 | } while (0) | 183 | } while (0) |
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | #define SET_PERSONALITY(ex) \ | 186 | #define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT) |
187 | set_personality(PER_LINUX_32BIT | (current->personality & (~PER_MASK))) | ||
188 | 187 | ||
189 | #ifdef CONFIG_VSYSCALL | 188 | #ifdef CONFIG_VSYSCALL |
190 | /* vDSO has arch_setup_additional_pages */ | 189 | /* vDSO has arch_setup_additional_pages */ |
diff --git a/arch/sh/include/asm/fixmap.h b/arch/sh/include/asm/fixmap.h index cbe0186b679..bd7e79a1265 100644 --- a/arch/sh/include/asm/fixmap.h +++ b/arch/sh/include/asm/fixmap.h | |||
@@ -96,7 +96,7 @@ extern void __clear_fixmap(enum fixed_addresses idx, pgprot_t flags); | |||
96 | #ifdef CONFIG_SUPERH32 | 96 | #ifdef CONFIG_SUPERH32 |
97 | #define FIXADDR_TOP (P4SEG - PAGE_SIZE) | 97 | #define FIXADDR_TOP (P4SEG - PAGE_SIZE) |
98 | #else | 98 | #else |
99 | #define FIXADDR_TOP ((unsigned long)(-PAGE_SIZE)) | 99 | #define FIXADDR_TOP (0xff000000 - PAGE_SIZE) |
100 | #endif | 100 | #endif |
101 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | 101 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
102 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | 102 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) |
diff --git a/arch/sh/include/asm/futex-irq.h b/arch/sh/include/asm/futex-irq.h index 63d33129ea2..6cb9f193a95 100644 --- a/arch/sh/include/asm/futex-irq.h +++ b/arch/sh/include/asm/futex-irq.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __ASM_SH_FUTEX_IRQ_H | 1 | #ifndef __ASM_SH_FUTEX_IRQ_H |
2 | #define __ASM_SH_FUTEX_IRQ_H | 2 | #define __ASM_SH_FUTEX_IRQ_H |
3 | 3 | ||
4 | #include <asm/system.h> | ||
4 | 5 | ||
5 | static inline int atomic_futex_op_xchg_set(int oparg, u32 __user *uaddr, | 6 | static inline int atomic_futex_op_xchg_set(int oparg, u32 __user *uaddr, |
6 | int *oldval) | 7 | int *oldval) |
diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index b3808c7d67b..967068fb79a 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _ASM_SH_HUGETLB_H | 1 | #ifndef _ASM_SH_HUGETLB_H |
2 | #define _ASM_SH_HUGETLB_H | 2 | #define _ASM_SH_HUGETLB_H |
3 | 3 | ||
4 | #include <asm/cacheflush.h> | ||
5 | #include <asm/page.h> | 4 | #include <asm/page.h> |
6 | 5 | ||
7 | 6 | ||
@@ -90,9 +89,4 @@ static inline void arch_release_hugepage(struct page *page) | |||
90 | { | 89 | { |
91 | } | 90 | } |
92 | 91 | ||
93 | static inline void arch_clear_hugepage_flags(struct page *page) | ||
94 | { | ||
95 | clear_bit(PG_dcache_clean, &page->flags); | ||
96 | } | ||
97 | |||
98 | #endif /* _ASM_SH_HUGETLB_H */ | 92 | #endif /* _ASM_SH_HUGETLB_H */ |
diff --git a/arch/sh/include/asm/hw_breakpoint.h b/arch/sh/include/asm/hw_breakpoint.h index ec9ad593c3d..89890f61a7b 100644 --- a/arch/sh/include/asm/hw_breakpoint.h +++ b/arch/sh/include/asm/hw_breakpoint.h | |||
@@ -1,8 +1,7 @@ | |||
1 | #ifndef __ASM_SH_HW_BREAKPOINT_H | 1 | #ifndef __ASM_SH_HW_BREAKPOINT_H |
2 | #define __ASM_SH_HW_BREAKPOINT_H | 2 | #define __ASM_SH_HW_BREAKPOINT_H |
3 | 3 | ||
4 | #include <uapi/asm/hw_breakpoint.h> | 4 | #ifdef __KERNEL__ |
5 | |||
6 | #define __ARCH_HW_BREAKPOINT_H | 5 | #define __ARCH_HW_BREAKPOINT_H |
7 | 6 | ||
8 | #include <linux/kdebug.h> | 7 | #include <linux/kdebug.h> |
@@ -67,4 +66,5 @@ extern int register_sh_ubc(struct sh_ubc *); | |||
67 | 66 | ||
68 | extern struct pmu perf_ops_bp; | 67 | extern struct pmu perf_ops_bp; |
69 | 68 | ||
69 | #endif /* __KERNEL__ */ | ||
70 | #endif /* __ASM_SH_HW_BREAKPOINT_H */ | 70 | #endif /* __ASM_SH_HW_BREAKPOINT_H */ |
diff --git a/arch/sh/include/asm/i2c-sh7760.h b/arch/sh/include/asm/i2c-sh7760.h index 69fee1239b0..24182116711 100644 --- a/arch/sh/include/asm/i2c-sh7760.h +++ b/arch/sh/include/asm/i2c-sh7760.h | |||
@@ -9,9 +9,11 @@ | |||
9 | 9 | ||
10 | #define SH7760_I2C0_MMIO 0xFE140000 | 10 | #define SH7760_I2C0_MMIO 0xFE140000 |
11 | #define SH7760_I2C0_MMIOEND 0xFE14003B | 11 | #define SH7760_I2C0_MMIOEND 0xFE14003B |
12 | #define SH7760_I2C0_IRQ 62 | ||
12 | 13 | ||
13 | #define SH7760_I2C1_MMIO 0xFE150000 | 14 | #define SH7760_I2C1_MMIO 0xFE150000 |
14 | #define SH7760_I2C1_MMIOEND 0xFE15003B | 15 | #define SH7760_I2C1_MMIOEND 0xFE15003B |
16 | #define SH7760_I2C1_IRQ 63 | ||
15 | 17 | ||
16 | struct sh7760_i2c_platdata { | 18 | struct sh7760_i2c_platdata { |
17 | unsigned int speed_khz; | 19 | unsigned int speed_khz; |
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index 629db2ad791..28c5aa58bb4 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <asm/cache.h> | 16 | #include <asm/cache.h> |
17 | #include <asm/system.h> | ||
17 | #include <asm/addrspace.h> | 18 | #include <asm/addrspace.h> |
18 | #include <asm/machvec.h> | 19 | #include <asm/machvec.h> |
19 | #include <asm/pgtable.h> | 20 | #include <asm/pgtable.h> |
@@ -23,7 +24,6 @@ | |||
23 | #define __IO_PREFIX generic | 24 | #define __IO_PREFIX generic |
24 | #include <asm/io_generic.h> | 25 | #include <asm/io_generic.h> |
25 | #include <asm/io_trapped.h> | 26 | #include <asm/io_trapped.h> |
26 | #include <mach/mangle-port.h> | ||
27 | 27 | ||
28 | #define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v)) | 28 | #define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v)) |
29 | #define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v)) | 29 | #define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v)) |
@@ -35,15 +35,21 @@ | |||
35 | #define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a)) | 35 | #define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a)) |
36 | #define __raw_readq(a) (__chk_io_ptr(a), *(volatile u64 __force *)(a)) | 36 | #define __raw_readq(a) (__chk_io_ptr(a), *(volatile u64 __force *)(a)) |
37 | 37 | ||
38 | #define readb_relaxed(c) ({ u8 __v = ioswabb(__raw_readb(c)); __v; }) | 38 | #define readb_relaxed(c) ({ u8 __v = __raw_readb(c); __v; }) |
39 | #define readw_relaxed(c) ({ u16 __v = ioswabw(__raw_readw(c)); __v; }) | 39 | #define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16) \ |
40 | #define readl_relaxed(c) ({ u32 __v = ioswabl(__raw_readl(c)); __v; }) | 40 | __raw_readw(c)); __v; }) |
41 | #define readq_relaxed(c) ({ u64 __v = ioswabq(__raw_readq(c)); __v; }) | 41 | #define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32) \ |
42 | 42 | __raw_readl(c)); __v; }) | |
43 | #define writeb_relaxed(v,c) ((void)__raw_writeb((__force u8)ioswabb(v),c)) | 43 | #define readq_relaxed(c) ({ u64 __v = le64_to_cpu((__force __le64) \ |
44 | #define writew_relaxed(v,c) ((void)__raw_writew((__force u16)ioswabw(v),c)) | 44 | __raw_readq(c)); __v; }) |
45 | #define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c)) | 45 | |
46 | #define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64)ioswabq(v),c)) | 46 | #define writeb_relaxed(v,c) ((void)__raw_writeb(v,c)) |
47 | #define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \ | ||
48 | cpu_to_le16(v),c)) | ||
49 | #define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \ | ||
50 | cpu_to_le32(v),c)) | ||
51 | #define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64) \ | ||
52 | cpu_to_le64(v),c)) | ||
47 | 53 | ||
48 | #define readb(a) ({ u8 r_ = readb_relaxed(a); rmb(); r_; }) | 54 | #define readb(a) ({ u8 r_ = readb_relaxed(a); rmb(); r_; }) |
49 | #define readw(a) ({ u16 r_ = readw_relaxed(a); rmb(); r_; }) | 55 | #define readw(a) ({ u16 r_ = readw_relaxed(a); rmb(); r_; }) |
@@ -134,7 +140,7 @@ __BUILD_MEMORY_STRING(__raw_, q, u64) | |||
134 | * load/store instructions. sh_io_port_base is the virtual address to | 140 | * load/store instructions. sh_io_port_base is the virtual address to |
135 | * which all ports are being mapped. | 141 | * which all ports are being mapped. |
136 | */ | 142 | */ |
137 | extern unsigned long sh_io_port_base; | 143 | extern const unsigned long sh_io_port_base; |
138 | 144 | ||
139 | static inline void __set_io_port_base(unsigned long pbase) | 145 | static inline void __set_io_port_base(unsigned long pbase) |
140 | { | 146 | { |
@@ -218,13 +224,8 @@ __BUILD_IOPORT_STRING(w, u16) | |||
218 | __BUILD_IOPORT_STRING(l, u32) | 224 | __BUILD_IOPORT_STRING(l, u32) |
219 | __BUILD_IOPORT_STRING(q, u64) | 225 | __BUILD_IOPORT_STRING(q, u64) |
220 | 226 | ||
221 | #else /* !CONFIG_HAS_IOPORT */ | ||
222 | |||
223 | #include <asm/io_noioport.h> | ||
224 | |||
225 | #endif | 227 | #endif |
226 | 228 | ||
227 | |||
228 | #define IO_SPACE_LIMIT 0xffffffff | 229 | #define IO_SPACE_LIMIT 0xffffffff |
229 | 230 | ||
230 | /* synco on SH-4A, otherwise a nop */ | 231 | /* synco on SH-4A, otherwise a nop */ |
@@ -382,7 +383,7 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; } | |||
382 | #define xlate_dev_kmem_ptr(p) p | 383 | #define xlate_dev_kmem_ptr(p) p |
383 | 384 | ||
384 | #define ARCH_HAS_VALID_PHYS_ADDR_RANGE | 385 | #define ARCH_HAS_VALID_PHYS_ADDR_RANGE |
385 | int valid_phys_addr_range(phys_addr_t addr, size_t size); | 386 | int valid_phys_addr_range(unsigned long addr, size_t size); |
386 | int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); | 387 | int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); |
387 | 388 | ||
388 | #endif /* __KERNEL__ */ | 389 | #endif /* __KERNEL__ */ |
diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h deleted file mode 100644 index 4d48f1436a6..00000000000 --- a/arch/sh/include/asm/io_noioport.h +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | #ifndef __ASM_SH_IO_NOIOPORT_H | ||
2 | #define __ASM_SH_IO_NOIOPORT_H | ||
3 | |||
4 | static inline u8 inb(unsigned long addr) | ||
5 | { | ||
6 | BUG(); | ||
7 | return -1; | ||
8 | } | ||
9 | |||
10 | static inline u16 inw(unsigned long addr) | ||
11 | { | ||
12 | BUG(); | ||
13 | return -1; | ||
14 | } | ||
15 | |||
16 | static inline u32 inl(unsigned long addr) | ||
17 | { | ||
18 | BUG(); | ||
19 | return -1; | ||
20 | } | ||
21 | |||
22 | static inline void outb(unsigned char x, unsigned long port) | ||
23 | { | ||
24 | BUG(); | ||
25 | } | ||
26 | |||
27 | static inline void outw(unsigned short x, unsigned long port) | ||
28 | { | ||
29 | BUG(); | ||
30 | } | ||
31 | |||
32 | static inline void outl(unsigned int x, unsigned long port) | ||
33 | { | ||
34 | BUG(); | ||
35 | } | ||
36 | |||
37 | #define inb_p(addr) inb(addr) | ||
38 | #define inw_p(addr) inw(addr) | ||
39 | #define inl_p(addr) inl(addr) | ||
40 | #define outb_p(x, addr) outb((x), (addr)) | ||
41 | #define outw_p(x, addr) outw((x), (addr)) | ||
42 | #define outl_p(x, addr) outl((x), (addr)) | ||
43 | |||
44 | #define insb(a, b, c) BUG() | ||
45 | #define insw(a, b, c) BUG() | ||
46 | #define insl(a, b, c) BUG() | ||
47 | |||
48 | #define outsb(a, b, c) BUG() | ||
49 | #define outsw(a, b, c) BUG() | ||
50 | #define outsl(a, b, c) BUG() | ||
51 | |||
52 | #endif /* __ASM_SH_IO_NOIOPORT_H */ | ||
diff --git a/arch/sh/include/asm/irq.h b/arch/sh/include/asm/irq.h index 0e4f532e473..45d08b6a5ef 100644 --- a/arch/sh/include/asm/irq.h +++ b/arch/sh/include/asm/irq.h | |||
@@ -5,15 +5,12 @@ | |||
5 | #include <asm/machvec.h> | 5 | #include <asm/machvec.h> |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Only legacy non-sparseirq platforms have to set a reasonably sane | 8 | * A sane default based on a reasonable vector table size, platforms are |
9 | * value here. sparseirq platforms allocate their irq_descs on the fly, | 9 | * advised to cap this at the hard limit that they're interested in |
10 | * so will expand automatically based on the number of registered IRQs. | 10 | * through the machvec. |
11 | */ | 11 | */ |
12 | #ifdef CONFIG_SPARSE_IRQ | 12 | #define NR_IRQS 512 |
13 | # define NR_IRQS 8 | 13 | #define NR_IRQS_LEGACY 8 /* Legacy external IRQ0-7 */ |
14 | #else | ||
15 | # define NR_IRQS 512 | ||
16 | #endif | ||
17 | 14 | ||
18 | /* | 15 | /* |
19 | * This is a special IRQ number for indicating that no IRQ has been | 16 | * This is a special IRQ number for indicating that no IRQ has been |
@@ -24,6 +21,17 @@ | |||
24 | #define NO_IRQ_IGNORE ((unsigned int)-1) | 21 | #define NO_IRQ_IGNORE ((unsigned int)-1) |
25 | 22 | ||
26 | /* | 23 | /* |
24 | * Convert back and forth between INTEVT and IRQ values. | ||
25 | */ | ||
26 | #ifdef CONFIG_CPU_HAS_INTEVT | ||
27 | #define evt2irq(evt) (((evt) >> 5) - 16) | ||
28 | #define irq2evt(irq) (((irq) + 16) << 5) | ||
29 | #else | ||
30 | #define evt2irq(evt) (evt) | ||
31 | #define irq2evt(irq) (irq) | ||
32 | #endif | ||
33 | |||
34 | /* | ||
27 | * Simple Mask Register Support | 35 | * Simple Mask Register Support |
28 | */ | 36 | */ |
29 | extern void make_maskreg_irq(unsigned int irq); | 37 | extern void make_maskreg_irq(unsigned int irq); |
diff --git a/arch/sh/include/asm/kdebug.h b/arch/sh/include/asm/kdebug.h index 8d6a831e7ba..5f6d2e9ccb7 100644 --- a/arch/sh/include/asm/kdebug.h +++ b/arch/sh/include/asm/kdebug.h | |||
@@ -10,8 +10,4 @@ enum die_val { | |||
10 | DIE_SSTEP, | 10 | DIE_SSTEP, |
11 | }; | 11 | }; |
12 | 12 | ||
13 | /* arch/sh/kernel/dumpstack.c */ | ||
14 | extern void printk_address(unsigned long address, int reliable); | ||
15 | extern void dump_mem(const char *str, unsigned long bottom, unsigned long top); | ||
16 | |||
17 | #endif /* __ASM_SH_KDEBUG_H */ | 13 | #endif /* __ASM_SH_KDEBUG_H */ |
diff --git a/arch/sh/include/asm/kgdb.h b/arch/sh/include/asm/kgdb.h index 9e7d2d1b03e..f3613952d1a 100644 --- a/arch/sh/include/asm/kgdb.h +++ b/arch/sh/include/asm/kgdb.h | |||
@@ -4,6 +4,18 @@ | |||
4 | #include <asm/cacheflush.h> | 4 | #include <asm/cacheflush.h> |
5 | #include <asm/ptrace.h> | 5 | #include <asm/ptrace.h> |
6 | 6 | ||
7 | /* Same as pt_regs but has vbr in place of syscall_nr */ | ||
8 | struct kgdb_regs { | ||
9 | unsigned long regs[16]; | ||
10 | unsigned long pc; | ||
11 | unsigned long pr; | ||
12 | unsigned long sr; | ||
13 | unsigned long gbr; | ||
14 | unsigned long mach; | ||
15 | unsigned long macl; | ||
16 | unsigned long vbr; | ||
17 | }; | ||
18 | |||
7 | enum regnames { | 19 | enum regnames { |
8 | GDB_R0, GDB_R1, GDB_R2, GDB_R3, GDB_R4, GDB_R5, GDB_R6, GDB_R7, | 20 | GDB_R0, GDB_R1, GDB_R2, GDB_R3, GDB_R4, GDB_R5, GDB_R6, GDB_R7, |
9 | GDB_R8, GDB_R9, GDB_R10, GDB_R11, GDB_R12, GDB_R13, GDB_R14, GDB_R15, | 21 | GDB_R8, GDB_R9, GDB_R10, GDB_R11, GDB_R12, GDB_R13, GDB_R14, GDB_R15, |
@@ -11,27 +23,17 @@ enum regnames { | |||
11 | GDB_PC, GDB_PR, GDB_SR, GDB_GBR, GDB_MACH, GDB_MACL, GDB_VBR, | 23 | GDB_PC, GDB_PR, GDB_SR, GDB_GBR, GDB_MACH, GDB_MACL, GDB_VBR, |
12 | }; | 24 | }; |
13 | 25 | ||
14 | #define _GP_REGS 16 | 26 | #define NUMREGBYTES ((GDB_VBR + 1) * 4) |
15 | #define _EXTRA_REGS 7 | ||
16 | #define GDB_SIZEOF_REG sizeof(u32) | ||
17 | |||
18 | #define DBG_MAX_REG_NUM (_GP_REGS + _EXTRA_REGS) | ||
19 | #define NUMREGBYTES (DBG_MAX_REG_NUM * sizeof(GDB_SIZEOF_REG)) | ||
20 | 27 | ||
21 | static inline void arch_kgdb_breakpoint(void) | 28 | static inline void arch_kgdb_breakpoint(void) |
22 | { | 29 | { |
23 | __asm__ __volatile__ ("trapa #0x3c\n"); | 30 | __asm__ __volatile__ ("trapa #0x3c\n"); |
24 | } | 31 | } |
25 | 32 | ||
26 | #define BREAK_INSTR_SIZE 2 | 33 | #define BUFMAX 2048 |
27 | #define BUFMAX 2048 | ||
28 | |||
29 | #ifdef CONFIG_SMP | ||
30 | # define CACHE_FLUSH_IS_SAFE 0 | ||
31 | #else | ||
32 | # define CACHE_FLUSH_IS_SAFE 1 | ||
33 | #endif | ||
34 | 34 | ||
35 | #define CACHE_FLUSH_IS_SAFE 1 | ||
36 | #define BREAK_INSTR_SIZE 2 | ||
35 | #define GDB_ADJUSTS_BREAK_OFFSET | 37 | #define GDB_ADJUSTS_BREAK_OFFSET |
36 | 38 | ||
37 | #endif /* __ASM_SH_KGDB_H */ | 39 | #endif /* __ASM_SH_KGDB_H */ |
diff --git a/arch/sh/include/asm/machvec.h b/arch/sh/include/asm/machvec.h index eb9c20d971d..57c5c3d0f39 100644 --- a/arch/sh/include/asm/machvec.h +++ b/arch/sh/include/asm/machvec.h | |||
@@ -17,6 +17,7 @@ | |||
17 | struct sh_machine_vector { | 17 | struct sh_machine_vector { |
18 | void (*mv_setup)(char **cmdline_p); | 18 | void (*mv_setup)(char **cmdline_p); |
19 | const char *mv_name; | 19 | const char *mv_name; |
20 | int mv_nr_irqs; | ||
20 | 21 | ||
21 | int (*mv_irq_demux)(int irq); | 22 | int (*mv_irq_demux)(int irq); |
22 | void (*mv_init_irq)(void); | 23 | void (*mv_init_irq)(void); |
diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h index 21c5088788d..384c7471a37 100644 --- a/arch/sh/include/asm/mmu_context.h +++ b/arch/sh/include/asm/mmu_context.h | |||
@@ -46,9 +46,9 @@ | |||
46 | #define MMU_VPN_MASK 0xfffff000 | 46 | #define MMU_VPN_MASK 0xfffff000 |
47 | 47 | ||
48 | #if defined(CONFIG_SUPERH32) | 48 | #if defined(CONFIG_SUPERH32) |
49 | #include <asm/mmu_context_32.h> | 49 | #include "mmu_context_32.h" |
50 | #else | 50 | #else |
51 | #include <asm/mmu_context_64.h> | 51 | #include "mmu_context_64.h" |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | /* | 54 | /* |
diff --git a/arch/sh/include/asm/module.h b/arch/sh/include/asm/module.h index 81300d8b544..b7927de86f9 100644 --- a/arch/sh/include/asm/module.h +++ b/arch/sh/include/asm/module.h | |||
@@ -1,13 +1,21 @@ | |||
1 | #ifndef _ASM_SH_MODULE_H | 1 | #ifndef _ASM_SH_MODULE_H |
2 | #define _ASM_SH_MODULE_H | 2 | #define _ASM_SH_MODULE_H |
3 | 3 | ||
4 | #include <asm-generic/module.h> | ||
5 | |||
6 | #ifdef CONFIG_DWARF_UNWINDER | ||
7 | struct mod_arch_specific { | 4 | struct mod_arch_specific { |
5 | #ifdef CONFIG_DWARF_UNWINDER | ||
8 | struct list_head fde_list; | 6 | struct list_head fde_list; |
9 | struct list_head cie_list; | 7 | struct list_head cie_list; |
8 | #endif | ||
10 | }; | 9 | }; |
10 | |||
11 | #ifdef CONFIG_64BIT | ||
12 | #define Elf_Shdr Elf64_Shdr | ||
13 | #define Elf_Sym Elf64_Sym | ||
14 | #define Elf_Ehdr Elf64_Ehdr | ||
15 | #else | ||
16 | #define Elf_Shdr Elf32_Shdr | ||
17 | #define Elf_Sym Elf32_Sym | ||
18 | #define Elf_Ehdr Elf32_Ehdr | ||
11 | #endif | 19 | #endif |
12 | 20 | ||
13 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | 21 | #ifdef CONFIG_CPU_LITTLE_ENDIAN |
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h index 15d970328f7..abcc4dcc2d9 100644 --- a/arch/sh/include/asm/page.h +++ b/arch/sh/include/asm/page.h | |||
@@ -113,16 +113,6 @@ typedef struct page *pgtable_t; | |||
113 | #define __MEMORY_SIZE CONFIG_MEMORY_SIZE | 113 | #define __MEMORY_SIZE CONFIG_MEMORY_SIZE |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * PHYSICAL_OFFSET is the offset in physical memory where the base | ||
117 | * of the kernel is loaded. | ||
118 | */ | ||
119 | #ifdef CONFIG_PHYSICAL_START | ||
120 | #define PHYSICAL_OFFSET (CONFIG_PHYSICAL_START - __MEMORY_START) | ||
121 | #else | ||
122 | #define PHYSICAL_OFFSET 0 | ||
123 | #endif | ||
124 | |||
125 | /* | ||
126 | * PAGE_OFFSET is the virtual address of the start of kernel address | 116 | * PAGE_OFFSET is the virtual address of the start of kernel address |
127 | * space. | 117 | * space. |
128 | */ | 118 | */ |
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h index bff96c2e7d2..cb21e2399dc 100644 --- a/arch/sh/include/asm/pci.h +++ b/arch/sh/include/asm/pci.h | |||
@@ -114,6 +114,12 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
114 | /* Board-specific fixup routines. */ | 114 | /* Board-specific fixup routines. */ |
115 | int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin); | 115 | int pcibios_map_platform_irq(const struct pci_dev *dev, u8 slot, u8 pin); |
116 | 116 | ||
117 | extern void pcibios_resource_to_bus(struct pci_dev *dev, | ||
118 | struct pci_bus_region *region, struct resource *res); | ||
119 | |||
120 | extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
121 | struct pci_bus_region *region); | ||
122 | |||
117 | #define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index | 123 | #define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index |
118 | 124 | ||
119 | static inline int pci_proc_domain(struct pci_bus *bus) | 125 | static inline int pci_proc_domain(struct pci_bus *bus) |
diff --git a/arch/sh/include/asm/pgtable_64.h b/arch/sh/include/asm/pgtable_64.h index dda8c82601b..42cb9dd5216 100644 --- a/arch/sh/include/asm/pgtable_64.h +++ b/arch/sh/include/asm/pgtable_64.h | |||
@@ -87,6 +87,9 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval) | |||
87 | #define pte_unmap(pte) do { } while (0) | 87 | #define pte_unmap(pte) do { } while (0) |
88 | 88 | ||
89 | #ifndef __ASSEMBLY__ | 89 | #ifndef __ASSEMBLY__ |
90 | #define IOBASE_VADDR 0xff000000 | ||
91 | #define IOBASE_END 0xffffffff | ||
92 | |||
90 | /* | 93 | /* |
91 | * PTEL coherent flags. | 94 | * PTEL coherent flags. |
92 | * See Chapter 17 ST50 CPU Core Volume 1, Architecture. | 95 | * See Chapter 17 ST50 CPU Core Volume 1, Architecture. |
diff --git a/arch/sh/include/asm/posix_types.h b/arch/sh/include/asm/posix_types.h index 1aa781079b1..4eeb723aee7 100644 --- a/arch/sh/include/asm/posix_types.h +++ b/arch/sh/include/asm/posix_types.h | |||
@@ -1,5 +1,13 @@ | |||
1 | #ifdef __KERNEL__ | ||
1 | # ifdef CONFIG_SUPERH32 | 2 | # ifdef CONFIG_SUPERH32 |
2 | # include <asm/posix_types_32.h> | 3 | # include "posix_types_32.h" |
3 | # else | 4 | # else |
4 | # include <asm/posix_types_64.h> | 5 | # include "posix_types_64.h" |
5 | # endif | 6 | # endif |
7 | #else | ||
8 | # ifdef __SH5__ | ||
9 | # include "posix_types_64.h" | ||
10 | # else | ||
11 | # include "posix_types_32.h" | ||
12 | # endif | ||
13 | #endif /* __KERNEL__ */ | ||
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h index 5448f9bbf4a..9c7bdfcaebb 100644 --- a/arch/sh/include/asm/processor.h +++ b/arch/sh/include/asm/processor.h | |||
@@ -18,8 +18,7 @@ enum cpu_type { | |||
18 | CPU_SH7619, | 18 | CPU_SH7619, |
19 | 19 | ||
20 | /* SH-2A types */ | 20 | /* SH-2A types */ |
21 | CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_SH7264, CPU_SH7269, | 21 | CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG, |
22 | CPU_MXG, | ||
23 | 22 | ||
24 | /* SH-3 types */ | 23 | /* SH-3 types */ |
25 | CPU_SH7705, CPU_SH7706, CPU_SH7707, | 24 | CPU_SH7705, CPU_SH7706, CPU_SH7707, |
@@ -33,7 +32,7 @@ enum cpu_type { | |||
33 | 32 | ||
34 | /* SH-4A types */ | 33 | /* SH-4A types */ |
35 | CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786, | 34 | CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786, |
36 | CPU_SH7723, CPU_SH7724, CPU_SH7757, CPU_SH7734, CPU_SHX3, | 35 | CPU_SH7723, CPU_SH7724, CPU_SH7757, CPU_SHX3, |
37 | 36 | ||
38 | /* SH4AL-DSP types */ | 37 | /* SH4AL-DSP types */ |
39 | CPU_SH7343, CPU_SH7722, CPU_SH7366, CPU_SH7372, | 38 | CPU_SH7343, CPU_SH7722, CPU_SH7366, CPU_SH7372, |
@@ -86,6 +85,10 @@ struct sh_cpuinfo { | |||
86 | struct tlb_info itlb; | 85 | struct tlb_info itlb; |
87 | struct tlb_info dtlb; | 86 | struct tlb_info dtlb; |
88 | 87 | ||
88 | #ifdef CONFIG_SMP | ||
89 | struct task_struct *idle; | ||
90 | #endif | ||
91 | |||
89 | unsigned int phys_bits; | 92 | unsigned int phys_bits; |
90 | unsigned long flags; | 93 | unsigned long flags; |
91 | } __attribute__ ((aligned(L1_CACHE_BYTES))); | 94 | } __attribute__ ((aligned(L1_CACHE_BYTES))); |
@@ -98,9 +101,6 @@ extern struct sh_cpuinfo cpu_data[]; | |||
98 | #define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory") | 101 | #define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory") |
99 | #define cpu_relax() barrier() | 102 | #define cpu_relax() barrier() |
100 | 103 | ||
101 | void default_idle(void); | ||
102 | void stop_this_cpu(void *); | ||
103 | |||
104 | /* Forward decl */ | 104 | /* Forward decl */ |
105 | struct seq_operations; | 105 | struct seq_operations; |
106 | struct task_struct; | 106 | struct task_struct; |
@@ -161,23 +161,12 @@ int vsyscall_init(void); | |||
161 | #define vsyscall_init() do { } while (0) | 161 | #define vsyscall_init() do { } while (0) |
162 | #endif | 162 | #endif |
163 | 163 | ||
164 | /* | ||
165 | * SH-2A has both 16 and 32-bit opcodes, do lame encoding checks. | ||
166 | */ | ||
167 | #ifdef CONFIG_CPU_SH2A | ||
168 | extern unsigned int instruction_size(unsigned int insn); | ||
169 | #elif defined(CONFIG_SUPERH32) | ||
170 | #define instruction_size(insn) (2) | ||
171 | #else | ||
172 | #define instruction_size(insn) (4) | ||
173 | #endif | ||
174 | |||
175 | #endif /* __ASSEMBLY__ */ | 164 | #endif /* __ASSEMBLY__ */ |
176 | 165 | ||
177 | #ifdef CONFIG_SUPERH32 | 166 | #ifdef CONFIG_SUPERH32 |
178 | # include <asm/processor_32.h> | 167 | # include "processor_32.h" |
179 | #else | 168 | #else |
180 | # include <asm/processor_64.h> | 169 | # include "processor_64.h" |
181 | #endif | 170 | #endif |
182 | 171 | ||
183 | #endif /* __ASM_SH_PROCESSOR_H */ | 172 | #endif /* __ASM_SH_PROCESSOR_H */ |
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h index b1320d55ca3..900f8d72ffe 100644 --- a/arch/sh/include/asm/processor_32.h +++ b/arch/sh/include/asm/processor_32.h | |||
@@ -126,6 +126,14 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned lo | |||
126 | /* Free all resources held by a thread. */ | 126 | /* Free all resources held by a thread. */ |
127 | extern void release_thread(struct task_struct *); | 127 | extern void release_thread(struct task_struct *); |
128 | 128 | ||
129 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
130 | void prepare_to_copy(struct task_struct *tsk); | ||
131 | |||
132 | /* | ||
133 | * create a kernel thread without removing it from tasklists | ||
134 | */ | ||
135 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
136 | |||
129 | /* Copy and release all segment info associated with a VM */ | 137 | /* Copy and release all segment info associated with a VM */ |
130 | #define copy_segments(p, mm) do { } while(0) | 138 | #define copy_segments(p, mm) do { } while(0) |
131 | #define release_segments(mm) do { } while(0) | 139 | #define release_segments(mm) do { } while(0) |
diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h index 1ee8946f095..e25c4c7d6b6 100644 --- a/arch/sh/include/asm/processor_64.h +++ b/arch/sh/include/asm/processor_64.h | |||
@@ -121,6 +121,7 @@ struct thread_struct { | |||
121 | NULL for a kernel thread. */ | 121 | NULL for a kernel thread. */ |
122 | struct pt_regs *uregs; | 122 | struct pt_regs *uregs; |
123 | 123 | ||
124 | unsigned long trap_no, error_code; | ||
124 | unsigned long address; | 125 | unsigned long address; |
125 | /* Hardware debugging registers may come here */ | 126 | /* Hardware debugging registers may come here */ |
126 | 127 | ||
@@ -137,6 +138,8 @@ struct thread_struct { | |||
137 | .pc = 0, \ | 138 | .pc = 0, \ |
138 | .kregs = &fake_swapper_regs, \ | 139 | .kregs = &fake_swapper_regs, \ |
139 | .uregs = NULL, \ | 140 | .uregs = NULL, \ |
141 | .trap_no = 0, \ | ||
142 | .error_code = 0, \ | ||
140 | .address = 0, \ | 143 | .address = 0, \ |
141 | .flags = 0, \ | 144 | .flags = 0, \ |
142 | } | 145 | } |
@@ -159,11 +162,17 @@ struct mm_struct; | |||
159 | 162 | ||
160 | /* Free all resources held by a thread. */ | 163 | /* Free all resources held by a thread. */ |
161 | extern void release_thread(struct task_struct *); | 164 | extern void release_thread(struct task_struct *); |
165 | /* | ||
166 | * create a kernel thread without removing it from tasklists | ||
167 | */ | ||
168 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
169 | |||
162 | 170 | ||
163 | /* Copy and release all segment info associated with a VM */ | 171 | /* Copy and release all segment info associated with a VM */ |
164 | #define copy_segments(p, mm) do { } while (0) | 172 | #define copy_segments(p, mm) do { } while (0) |
165 | #define release_segments(mm) do { } while (0) | 173 | #define release_segments(mm) do { } while (0) |
166 | #define forget_segments() do { } while (0) | 174 | #define forget_segments() do { } while (0) |
175 | #define prepare_to_copy(tsk) do { } while (0) | ||
167 | /* | 176 | /* |
168 | * FPU lazy state save handling. | 177 | * FPU lazy state save handling. |
169 | */ | 178 | */ |
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h index 2506c7db76b..2d3679b2447 100644 --- a/arch/sh/include/asm/ptrace.h +++ b/arch/sh/include/asm/ptrace.h | |||
@@ -1,16 +1,43 @@ | |||
1 | #ifndef __ASM_SH_PTRACE_H | ||
2 | #define __ASM_SH_PTRACE_H | ||
3 | |||
1 | /* | 4 | /* |
2 | * Copyright (C) 1999, 2000 Niibe Yutaka | 5 | * Copyright (C) 1999, 2000 Niibe Yutaka |
3 | */ | 6 | */ |
4 | #ifndef __ASM_SH_PTRACE_H | ||
5 | #define __ASM_SH_PTRACE_H | ||
6 | 7 | ||
8 | #define PTRACE_GETREGS 12 /* General registers */ | ||
9 | #define PTRACE_SETREGS 13 | ||
10 | |||
11 | #define PTRACE_GETFPREGS 14 /* FPU registers */ | ||
12 | #define PTRACE_SETFPREGS 15 | ||
13 | |||
14 | #define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */ | ||
15 | |||
16 | #define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ | ||
17 | #define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ | ||
18 | |||
19 | #define PTRACE_GETDSPREGS 55 /* DSP registers */ | ||
20 | #define PTRACE_SETDSPREGS 56 | ||
21 | |||
22 | #define PT_TEXT_END_ADDR 240 | ||
23 | #define PT_TEXT_ADDR 244 /* &(struct user)->start_code */ | ||
24 | #define PT_DATA_ADDR 248 /* &(struct user)->start_data */ | ||
25 | #define PT_TEXT_LEN 252 | ||
26 | |||
27 | #if defined(__SH5__) || defined(CONFIG_CPU_SH5) | ||
28 | #include "ptrace_64.h" | ||
29 | #else | ||
30 | #include "ptrace_32.h" | ||
31 | #endif | ||
32 | |||
33 | #ifdef __KERNEL__ | ||
7 | 34 | ||
8 | #include <linux/stringify.h> | 35 | #include <linux/stringify.h> |
9 | #include <linux/stddef.h> | 36 | #include <linux/stddef.h> |
10 | #include <linux/thread_info.h> | 37 | #include <linux/thread_info.h> |
11 | #include <asm/addrspace.h> | 38 | #include <asm/addrspace.h> |
12 | #include <asm/page.h> | 39 | #include <asm/page.h> |
13 | #include <uapi/asm/ptrace.h> | 40 | #include <asm/system.h> |
14 | 41 | ||
15 | #define user_mode(regs) (((regs)->sr & 0x40000000)==0) | 42 | #define user_mode(regs) (((regs)->sr & 0x40000000)==0) |
16 | #define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15]) | 43 | #define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15]) |
@@ -114,4 +141,6 @@ static inline unsigned long profile_pc(struct pt_regs *regs) | |||
114 | #define profile_pc profile_pc | 141 | #define profile_pc profile_pc |
115 | 142 | ||
116 | #include <asm-generic/ptrace.h> | 143 | #include <asm-generic/ptrace.h> |
144 | #endif /* __KERNEL__ */ | ||
145 | |||
117 | #endif /* __ASM_SH_PTRACE_H */ | 146 | #endif /* __ASM_SH_PTRACE_H */ |
diff --git a/arch/sh/include/asm/ptrace_32.h b/arch/sh/include/asm/ptrace_32.h index 1dd4480c536..6c2239cca1a 100644 --- a/arch/sh/include/asm/ptrace_32.h +++ b/arch/sh/include/asm/ptrace_32.h | |||
@@ -1,13 +1,83 @@ | |||
1 | #ifndef __ASM_SH_PTRACE_32_H | 1 | #ifndef __ASM_SH_PTRACE_32_H |
2 | #define __ASM_SH_PTRACE_32_H | 2 | #define __ASM_SH_PTRACE_32_H |
3 | 3 | ||
4 | #include <uapi/asm/ptrace_32.h> | 4 | /* |
5 | * GCC defines register number like this: | ||
6 | * ----------------------------- | ||
7 | * 0 - 15 are integer registers | ||
8 | * 17 - 22 are control/special registers | ||
9 | * 24 - 39 fp registers | ||
10 | * 40 - 47 xd registers | ||
11 | * 48 - fpscr register | ||
12 | * ----------------------------- | ||
13 | * | ||
14 | * We follows above, except: | ||
15 | * 16 --- program counter (PC) | ||
16 | * 22 --- syscall # | ||
17 | * 23 --- floating point communication register | ||
18 | */ | ||
19 | #define REG_REG0 0 | ||
20 | #define REG_REG15 15 | ||
5 | 21 | ||
22 | #define REG_PC 16 | ||
23 | |||
24 | #define REG_PR 17 | ||
25 | #define REG_SR 18 | ||
26 | #define REG_GBR 19 | ||
27 | #define REG_MACH 20 | ||
28 | #define REG_MACL 21 | ||
29 | |||
30 | #define REG_SYSCALL 22 | ||
31 | |||
32 | #define REG_FPREG0 23 | ||
33 | #define REG_FPREG15 38 | ||
34 | #define REG_XFREG0 39 | ||
35 | #define REG_XFREG15 54 | ||
36 | |||
37 | #define REG_FPSCR 55 | ||
38 | #define REG_FPUL 56 | ||
39 | |||
40 | /* | ||
41 | * This struct defines the way the registers are stored on the | ||
42 | * kernel stack during a system call or other kernel entry. | ||
43 | */ | ||
44 | struct pt_regs { | ||
45 | unsigned long regs[16]; | ||
46 | unsigned long pc; | ||
47 | unsigned long pr; | ||
48 | unsigned long sr; | ||
49 | unsigned long gbr; | ||
50 | unsigned long mach; | ||
51 | unsigned long macl; | ||
52 | long tra; | ||
53 | }; | ||
54 | |||
55 | /* | ||
56 | * This struct defines the way the DSP registers are stored on the | ||
57 | * kernel stack during a system call or other kernel entry. | ||
58 | */ | ||
59 | struct pt_dspregs { | ||
60 | unsigned long a1; | ||
61 | unsigned long a0g; | ||
62 | unsigned long a1g; | ||
63 | unsigned long m0; | ||
64 | unsigned long m1; | ||
65 | unsigned long a0; | ||
66 | unsigned long x0; | ||
67 | unsigned long x1; | ||
68 | unsigned long y0; | ||
69 | unsigned long y1; | ||
70 | unsigned long dsr; | ||
71 | unsigned long rs; | ||
72 | unsigned long re; | ||
73 | unsigned long mod; | ||
74 | }; | ||
75 | |||
76 | #ifdef __KERNEL__ | ||
6 | 77 | ||
7 | #define MAX_REG_OFFSET offsetof(struct pt_regs, tra) | 78 | #define MAX_REG_OFFSET offsetof(struct pt_regs, tra) |
8 | static inline long regs_return_value(struct pt_regs *regs) | 79 | #define regs_return_value(_regs) ((_regs)->regs[0]) |
9 | { | 80 | |
10 | return regs->regs[0]; | 81 | #endif /* __KERNEL__ */ |
11 | } | ||
12 | 82 | ||
13 | #endif /* __ASM_SH_PTRACE_32_H */ | 83 | #endif /* __ASM_SH_PTRACE_32_H */ |
diff --git a/arch/sh/include/asm/ptrace_64.h b/arch/sh/include/asm/ptrace_64.h index 97f4b5660f2..bf9be7764d6 100644 --- a/arch/sh/include/asm/ptrace_64.h +++ b/arch/sh/include/asm/ptrace_64.h | |||
@@ -1,13 +1,20 @@ | |||
1 | #ifndef __ASM_SH_PTRACE_64_H | 1 | #ifndef __ASM_SH_PTRACE_64_H |
2 | #define __ASM_SH_PTRACE_64_H | 2 | #define __ASM_SH_PTRACE_64_H |
3 | 3 | ||
4 | #include <uapi/asm/ptrace_64.h> | 4 | struct pt_regs { |
5 | unsigned long long pc; | ||
6 | unsigned long long sr; | ||
7 | long long syscall_nr; | ||
8 | unsigned long long regs[63]; | ||
9 | unsigned long long tregs[8]; | ||
10 | unsigned long long pad[2]; | ||
11 | }; | ||
5 | 12 | ||
13 | #ifdef __KERNEL__ | ||
6 | 14 | ||
7 | #define MAX_REG_OFFSET offsetof(struct pt_regs, tregs[7]) | 15 | #define MAX_REG_OFFSET offsetof(struct pt_regs, tregs[7]) |
8 | static inline long regs_return_value(struct pt_regs *regs) | 16 | #define regs_return_value(_regs) ((_regs)->regs[3]) |
9 | { | 17 | |
10 | return regs->regs[3]; | 18 | #endif /* __KERNEL__ */ |
11 | } | ||
12 | 19 | ||
13 | #endif /* __ASM_SH_PTRACE_64_H */ | 20 | #endif /* __ASM_SH_PTRACE_64_H */ |
diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h index 1b6199740e9..4a5350037c8 100644 --- a/arch/sh/include/asm/sections.h +++ b/arch/sh/include/asm/sections.h | |||
@@ -6,6 +6,7 @@ | |||
6 | extern long __nosave_begin, __nosave_end; | 6 | extern long __nosave_begin, __nosave_end; |
7 | extern long __machvec_start, __machvec_end; | 7 | extern long __machvec_start, __machvec_end; |
8 | extern char __uncached_start, __uncached_end; | 8 | extern char __uncached_start, __uncached_end; |
9 | extern char _ebss[]; | ||
9 | extern char __start_eh_frame[], __stop_eh_frame[]; | 10 | extern char __start_eh_frame[], __stop_eh_frame[]; |
10 | 11 | ||
11 | #endif /* __ASM_SH_SECTIONS_H */ | 12 | #endif /* __ASM_SH_SECTIONS_H */ |
diff --git a/arch/sh/include/asm/setup.h b/arch/sh/include/asm/setup.h index 99238108e7a..01fa17a3d75 100644 --- a/arch/sh/include/asm/setup.h +++ b/arch/sh/include/asm/setup.h | |||
@@ -1,8 +1,9 @@ | |||
1 | #ifndef _SH_SETUP_H | 1 | #ifndef _SH_SETUP_H |
2 | #define _SH_SETUP_H | 2 | #define _SH_SETUP_H |
3 | 3 | ||
4 | #include <uapi/asm/setup.h> | 4 | #include <asm-generic/setup.h> |
5 | 5 | ||
6 | #ifdef __KERNEL__ | ||
6 | /* | 7 | /* |
7 | * This is set up by the setup-routine at boot-time | 8 | * This is set up by the setup-routine at boot-time |
8 | */ | 9 | */ |
@@ -19,6 +20,7 @@ | |||
19 | 20 | ||
20 | void sh_mv_setup(void); | 21 | void sh_mv_setup(void); |
21 | void check_for_initrd(void); | 22 | void check_for_initrd(void); |
22 | void per_cpu_trap_init(void); | 23 | |
24 | #endif /* __KERNEL__ */ | ||
23 | 25 | ||
24 | #endif /* _SH_SETUP_H */ | 26 | #endif /* _SH_SETUP_H */ |
diff --git a/arch/sh/include/asm/siu.h b/arch/sh/include/asm/siu.h index 580b7ac228b..1d95c78808d 100644 --- a/arch/sh/include/asm/siu.h +++ b/arch/sh/include/asm/siu.h | |||
@@ -14,6 +14,7 @@ | |||
14 | struct device; | 14 | struct device; |
15 | 15 | ||
16 | struct siu_platform { | 16 | struct siu_platform { |
17 | struct device *dma_dev; | ||
17 | unsigned int dma_slave_tx_a; | 18 | unsigned int dma_slave_tx_a; |
18 | unsigned int dma_slave_rx_a; | 19 | unsigned int dma_slave_rx_a; |
19 | unsigned int dma_slave_tx_b; | 20 | unsigned int dma_slave_tx_b; |
diff --git a/arch/sh/include/asm/stackprotector.h b/arch/sh/include/asm/stackprotector.h deleted file mode 100644 index d9df3a76847..00000000000 --- a/arch/sh/include/asm/stackprotector.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | #ifndef __ASM_SH_STACKPROTECTOR_H | ||
2 | #define __ASM_SH_STACKPROTECTOR_H | ||
3 | |||
4 | #include <linux/random.h> | ||
5 | #include <linux/version.h> | ||
6 | |||
7 | extern unsigned long __stack_chk_guard; | ||
8 | |||
9 | /* | ||
10 | * Initialize the stackprotector canary value. | ||
11 | * | ||
12 | * NOTE: this must only be called from functions that never return, | ||
13 | * and it must always be inlined. | ||
14 | */ | ||
15 | static __always_inline void boot_init_stack_canary(void) | ||
16 | { | ||
17 | unsigned long canary; | ||
18 | |||
19 | /* Try to get a semi random initial value. */ | ||
20 | get_random_bytes(&canary, sizeof(canary)); | ||
21 | canary ^= LINUX_VERSION_CODE; | ||
22 | |||
23 | current->stack_canary = canary; | ||
24 | __stack_chk_guard = current->stack_canary; | ||
25 | } | ||
26 | |||
27 | #endif /* __ASM_SH_STACKPROTECTOR_H */ | ||
diff --git a/arch/sh/include/asm/string.h b/arch/sh/include/asm/string.h index 114011fa08a..8c1ea21dc0a 100644 --- a/arch/sh/include/asm/string.h +++ b/arch/sh/include/asm/string.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifdef CONFIG_SUPERH32 | 1 | #ifdef CONFIG_SUPERH32 |
2 | # include <asm/string_32.h> | 2 | # include "string_32.h" |
3 | #else | 3 | #else |
4 | # include <asm/string_64.h> | 4 | # include "string_64.h" |
5 | #endif | 5 | #endif |
diff --git a/arch/sh/include/asm/switch_to.h b/arch/sh/include/asm/switch_to.h deleted file mode 100644 index bcd722fc834..00000000000 --- a/arch/sh/include/asm/switch_to.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001 Paolo Alberelli | ||
3 | * Copyright (C) 2003 Paul Mundt | ||
4 | * Copyright (C) 2004 Richard Curnow | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef __ASM_SH_SWITCH_TO_H | ||
11 | #define __ASM_SH_SWITCH_TO_H | ||
12 | |||
13 | #ifdef CONFIG_SUPERH32 | ||
14 | # include <asm/switch_to_32.h> | ||
15 | #else | ||
16 | # include <asm/switch_to_64.h> | ||
17 | #endif | ||
18 | |||
19 | #endif /* __ASM_SH_SWITCH_TO_H */ | ||
diff --git a/arch/sh/include/asm/switch_to_32.h b/arch/sh/include/asm/switch_to_32.h deleted file mode 100644 index 0c065513e7a..00000000000 --- a/arch/sh/include/asm/switch_to_32.h +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | #ifndef __ASM_SH_SWITCH_TO_32_H | ||
2 | #define __ASM_SH_SWITCH_TO_32_H | ||
3 | |||
4 | #ifdef CONFIG_SH_DSP | ||
5 | |||
6 | #define is_dsp_enabled(tsk) \ | ||
7 | (!!(tsk->thread.dsp_status.status & SR_DSP)) | ||
8 | |||
9 | #define __restore_dsp(tsk) \ | ||
10 | do { \ | ||
11 | register u32 *__ts2 __asm__ ("r2") = \ | ||
12 | (u32 *)&tsk->thread.dsp_status; \ | ||
13 | __asm__ __volatile__ ( \ | ||
14 | ".balign 4\n\t" \ | ||
15 | "movs.l @r2+, a0\n\t" \ | ||
16 | "movs.l @r2+, a1\n\t" \ | ||
17 | "movs.l @r2+, a0g\n\t" \ | ||
18 | "movs.l @r2+, a1g\n\t" \ | ||
19 | "movs.l @r2+, m0\n\t" \ | ||
20 | "movs.l @r2+, m1\n\t" \ | ||
21 | "movs.l @r2+, x0\n\t" \ | ||
22 | "movs.l @r2+, x1\n\t" \ | ||
23 | "movs.l @r2+, y0\n\t" \ | ||
24 | "movs.l @r2+, y1\n\t" \ | ||
25 | "lds.l @r2+, dsr\n\t" \ | ||
26 | "ldc.l @r2+, rs\n\t" \ | ||
27 | "ldc.l @r2+, re\n\t" \ | ||
28 | "ldc.l @r2+, mod\n\t" \ | ||
29 | : : "r" (__ts2)); \ | ||
30 | } while (0) | ||
31 | |||
32 | #define __save_dsp(tsk) \ | ||
33 | do { \ | ||
34 | register u32 *__ts2 __asm__ ("r2") = \ | ||
35 | (u32 *)&tsk->thread.dsp_status + 14; \ | ||
36 | \ | ||
37 | __asm__ __volatile__ ( \ | ||
38 | ".balign 4\n\t" \ | ||
39 | "stc.l mod, @-r2\n\t" \ | ||
40 | "stc.l re, @-r2\n\t" \ | ||
41 | "stc.l rs, @-r2\n\t" \ | ||
42 | "sts.l dsr, @-r2\n\t" \ | ||
43 | "movs.l y1, @-r2\n\t" \ | ||
44 | "movs.l y0, @-r2\n\t" \ | ||
45 | "movs.l x1, @-r2\n\t" \ | ||
46 | "movs.l x0, @-r2\n\t" \ | ||
47 | "movs.l m1, @-r2\n\t" \ | ||
48 | "movs.l m0, @-r2\n\t" \ | ||
49 | "movs.l a1g, @-r2\n\t" \ | ||
50 | "movs.l a0g, @-r2\n\t" \ | ||
51 | "movs.l a1, @-r2\n\t" \ | ||
52 | "movs.l a0, @-r2\n\t" \ | ||
53 | : : "r" (__ts2)); \ | ||
54 | } while (0) | ||
55 | |||
56 | #else | ||
57 | |||
58 | #define is_dsp_enabled(tsk) (0) | ||
59 | #define __save_dsp(tsk) do { } while (0) | ||
60 | #define __restore_dsp(tsk) do { } while (0) | ||
61 | #endif | ||
62 | |||
63 | struct task_struct *__switch_to(struct task_struct *prev, | ||
64 | struct task_struct *next); | ||
65 | |||
66 | /* | ||
67 | * switch_to() should switch tasks to task nr n, first | ||
68 | */ | ||
69 | #define switch_to(prev, next, last) \ | ||
70 | do { \ | ||
71 | register u32 *__ts1 __asm__ ("r1"); \ | ||
72 | register u32 *__ts2 __asm__ ("r2"); \ | ||
73 | register u32 *__ts4 __asm__ ("r4"); \ | ||
74 | register u32 *__ts5 __asm__ ("r5"); \ | ||
75 | register u32 *__ts6 __asm__ ("r6"); \ | ||
76 | register u32 __ts7 __asm__ ("r7"); \ | ||
77 | struct task_struct *__last; \ | ||
78 | \ | ||
79 | if (is_dsp_enabled(prev)) \ | ||
80 | __save_dsp(prev); \ | ||
81 | \ | ||
82 | __ts1 = (u32 *)&prev->thread.sp; \ | ||
83 | __ts2 = (u32 *)&prev->thread.pc; \ | ||
84 | __ts4 = (u32 *)prev; \ | ||
85 | __ts5 = (u32 *)next; \ | ||
86 | __ts6 = (u32 *)&next->thread.sp; \ | ||
87 | __ts7 = next->thread.pc; \ | ||
88 | \ | ||
89 | __asm__ __volatile__ ( \ | ||
90 | ".balign 4\n\t" \ | ||
91 | "stc.l gbr, @-r15\n\t" \ | ||
92 | "sts.l pr, @-r15\n\t" \ | ||
93 | "mov.l r8, @-r15\n\t" \ | ||
94 | "mov.l r9, @-r15\n\t" \ | ||
95 | "mov.l r10, @-r15\n\t" \ | ||
96 | "mov.l r11, @-r15\n\t" \ | ||
97 | "mov.l r12, @-r15\n\t" \ | ||
98 | "mov.l r13, @-r15\n\t" \ | ||
99 | "mov.l r14, @-r15\n\t" \ | ||
100 | "mov.l r15, @r1\t! save SP\n\t" \ | ||
101 | "mov.l @r6, r15\t! change to new stack\n\t" \ | ||
102 | "mova 1f, %0\n\t" \ | ||
103 | "mov.l %0, @r2\t! save PC\n\t" \ | ||
104 | "mov.l 2f, %0\n\t" \ | ||
105 | "jmp @%0\t! call __switch_to\n\t" \ | ||
106 | " lds r7, pr\t! with return to new PC\n\t" \ | ||
107 | ".balign 4\n" \ | ||
108 | "2:\n\t" \ | ||
109 | ".long __switch_to\n" \ | ||
110 | "1:\n\t" \ | ||
111 | "mov.l @r15+, r14\n\t" \ | ||
112 | "mov.l @r15+, r13\n\t" \ | ||
113 | "mov.l @r15+, r12\n\t" \ | ||
114 | "mov.l @r15+, r11\n\t" \ | ||
115 | "mov.l @r15+, r10\n\t" \ | ||
116 | "mov.l @r15+, r9\n\t" \ | ||
117 | "mov.l @r15+, r8\n\t" \ | ||
118 | "lds.l @r15+, pr\n\t" \ | ||
119 | "ldc.l @r15+, gbr\n\t" \ | ||
120 | : "=z" (__last) \ | ||
121 | : "r" (__ts1), "r" (__ts2), "r" (__ts4), \ | ||
122 | "r" (__ts5), "r" (__ts6), "r" (__ts7) \ | ||
123 | : "r3", "t"); \ | ||
124 | \ | ||
125 | last = __last; \ | ||
126 | } while (0) | ||
127 | |||
128 | #define finish_arch_switch(prev) \ | ||
129 | do { \ | ||
130 | if (is_dsp_enabled(prev)) \ | ||
131 | __restore_dsp(prev); \ | ||
132 | } while (0) | ||
133 | |||
134 | #endif /* __ASM_SH_SWITCH_TO_32_H */ | ||
diff --git a/arch/sh/include/asm/switch_to_64.h b/arch/sh/include/asm/switch_to_64.h deleted file mode 100644 index ba3129d6bc2..00000000000 --- a/arch/sh/include/asm/switch_to_64.h +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001 Paolo Alberelli | ||
3 | * Copyright (C) 2003 Paul Mundt | ||
4 | * Copyright (C) 2004 Richard Curnow | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef __ASM_SH_SWITCH_TO_64_H | ||
11 | #define __ASM_SH_SWITCH_TO_64_H | ||
12 | |||
13 | struct thread_struct; | ||
14 | struct task_struct; | ||
15 | |||
16 | /* | ||
17 | * switch_to() should switch tasks to task nr n, first | ||
18 | */ | ||
19 | struct task_struct *sh64_switch_to(struct task_struct *prev, | ||
20 | struct thread_struct *prev_thread, | ||
21 | struct task_struct *next, | ||
22 | struct thread_struct *next_thread); | ||
23 | |||
24 | #define switch_to(prev,next,last) \ | ||
25 | do { \ | ||
26 | if (last_task_used_math != next) { \ | ||
27 | struct pt_regs *regs = next->thread.uregs; \ | ||
28 | if (regs) regs->sr |= SR_FD; \ | ||
29 | } \ | ||
30 | last = sh64_switch_to(prev, &prev->thread, next, \ | ||
31 | &next->thread); \ | ||
32 | } while (0) | ||
33 | |||
34 | |||
35 | #endif /* __ASM_SH_SWITCH_TO_64_H */ | ||
diff --git a/arch/sh/include/asm/syscall.h b/arch/sh/include/asm/syscall.h index 847128da6ea..aa7777bdc37 100644 --- a/arch/sh/include/asm/syscall.h +++ b/arch/sh/include/asm/syscall.h | |||
@@ -4,9 +4,9 @@ | |||
4 | extern const unsigned long sys_call_table[]; | 4 | extern const unsigned long sys_call_table[]; |
5 | 5 | ||
6 | #ifdef CONFIG_SUPERH32 | 6 | #ifdef CONFIG_SUPERH32 |
7 | # include <asm/syscall_32.h> | 7 | # include "syscall_32.h" |
8 | #else | 8 | #else |
9 | # include <asm/syscall_64.h> | 9 | # include "syscall_64.h" |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #endif /* __ASM_SH_SYSCALL_H */ | 12 | #endif /* __ASM_SH_SYSCALL_H */ |
diff --git a/arch/sh/include/asm/syscalls.h b/arch/sh/include/asm/syscalls.h index 3dbfef06f6b..507725af2e5 100644 --- a/arch/sh/include/asm/syscalls.h +++ b/arch/sh/include/asm/syscalls.h | |||
@@ -11,9 +11,9 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | |||
11 | unsigned long fd, unsigned long pgoff); | 11 | unsigned long fd, unsigned long pgoff); |
12 | 12 | ||
13 | #ifdef CONFIG_SUPERH32 | 13 | #ifdef CONFIG_SUPERH32 |
14 | # include <asm/syscalls_32.h> | 14 | # include "syscalls_32.h" |
15 | #else | 15 | #else |
16 | # include <asm/syscalls_64.h> | 16 | # include "syscalls_64.h" |
17 | #endif | 17 | #endif |
18 | 18 | ||
19 | #endif /* __KERNEL__ */ | 19 | #endif /* __KERNEL__ */ |
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h index cc25485996b..ae717e3c26d 100644 --- a/arch/sh/include/asm/syscalls_32.h +++ b/arch/sh/include/asm/syscalls_32.h | |||
@@ -9,7 +9,23 @@ | |||
9 | 9 | ||
10 | struct pt_regs; | 10 | struct pt_regs; |
11 | 11 | ||
12 | asmlinkage int sys_sigsuspend(old_sigset_t mask); | 12 | asmlinkage int sys_fork(unsigned long r4, unsigned long r5, |
13 | unsigned long r6, unsigned long r7, | ||
14 | struct pt_regs __regs); | ||
15 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
16 | unsigned long parent_tidptr, | ||
17 | unsigned long child_tidptr, | ||
18 | struct pt_regs __regs); | ||
19 | asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, | ||
20 | unsigned long r6, unsigned long r7, | ||
21 | struct pt_regs __regs); | ||
22 | asmlinkage int sys_execve(const char __user *ufilename, | ||
23 | const char __user *const __user *uargv, | ||
24 | const char __user *const __user *uenvp, | ||
25 | unsigned long r7, struct pt_regs __regs); | ||
26 | asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5, | ||
27 | unsigned long r6, unsigned long r7, | ||
28 | struct pt_regs __regs); | ||
13 | asmlinkage int sys_sigaction(int sig, const struct old_sigaction __user *act, | 29 | asmlinkage int sys_sigaction(int sig, const struct old_sigaction __user *act, |
14 | struct old_sigaction __user *oact); | 30 | struct old_sigaction __user *oact); |
15 | asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 31 | asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
diff --git a/arch/sh/include/asm/syscalls_64.h b/arch/sh/include/asm/syscalls_64.h index d62e8eb22f7..ee519f41d95 100644 --- a/arch/sh/include/asm/syscalls_64.h +++ b/arch/sh/include/asm/syscalls_64.h | |||
@@ -9,6 +9,23 @@ | |||
9 | 9 | ||
10 | struct pt_regs; | 10 | struct pt_regs; |
11 | 11 | ||
12 | asmlinkage int sys_fork(unsigned long r2, unsigned long r3, | ||
13 | unsigned long r4, unsigned long r5, | ||
14 | unsigned long r6, unsigned long r7, | ||
15 | struct pt_regs *pregs); | ||
16 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
17 | unsigned long r4, unsigned long r5, | ||
18 | unsigned long r6, unsigned long r7, | ||
19 | struct pt_regs *pregs); | ||
20 | asmlinkage int sys_vfork(unsigned long r2, unsigned long r3, | ||
21 | unsigned long r4, unsigned long r5, | ||
22 | unsigned long r6, unsigned long r7, | ||
23 | struct pt_regs *pregs); | ||
24 | asmlinkage int sys_execve(const char *ufilename, char **uargv, | ||
25 | char **uenvp, unsigned long r5, | ||
26 | unsigned long r6, unsigned long r7, | ||
27 | struct pt_regs *pregs); | ||
28 | |||
12 | /* Misc syscall related bits */ | 29 | /* Misc syscall related bits */ |
13 | asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs); | 30 | asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs); |
14 | asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); | 31 | asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); |
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h index 7d5ac4e4848..ea2d5089de1 100644 --- a/arch/sh/include/asm/thread_info.h +++ b/arch/sh/include/asm/thread_info.h | |||
@@ -10,18 +10,8 @@ | |||
10 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller | 10 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller |
11 | */ | 11 | */ |
12 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
13 | |||
14 | #include <asm/page.h> | 13 | #include <asm/page.h> |
15 | 14 | ||
16 | /* | ||
17 | * Page fault error code bits | ||
18 | */ | ||
19 | #define FAULT_CODE_WRITE (1 << 0) /* write access */ | ||
20 | #define FAULT_CODE_INITIAL (1 << 1) /* initial page write */ | ||
21 | #define FAULT_CODE_ITLB (1 << 2) /* ITLB miss */ | ||
22 | #define FAULT_CODE_PROT (1 << 3) /* protection fault */ | ||
23 | #define FAULT_CODE_USER (1 << 4) /* user-mode access */ | ||
24 | |||
25 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
26 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
27 | 17 | ||
@@ -98,23 +88,29 @@ static inline struct thread_info *current_thread_info(void) | |||
98 | return ti; | 88 | return ti; |
99 | } | 89 | } |
100 | 90 | ||
91 | /* thread information allocation */ | ||
92 | #if THREAD_SHIFT >= PAGE_SHIFT | ||
93 | |||
101 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) | 94 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) |
102 | 95 | ||
96 | #endif | ||
97 | |||
98 | extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node); | ||
99 | extern void free_thread_info(struct thread_info *ti); | ||
103 | extern void arch_task_cache_init(void); | 100 | extern void arch_task_cache_init(void); |
101 | #define arch_task_cache_init arch_task_cache_init | ||
104 | extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); | 102 | extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); |
105 | extern void arch_release_task_struct(struct task_struct *tsk); | ||
106 | extern void init_thread_xstate(void); | 103 | extern void init_thread_xstate(void); |
107 | 104 | ||
105 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
106 | |||
108 | #endif /* __ASSEMBLY__ */ | 107 | #endif /* __ASSEMBLY__ */ |
109 | 108 | ||
110 | /* | 109 | /* |
111 | * Thread information flags | 110 | * thread information flags |
112 | * | 111 | * - these are process state flags that various assembly files may need to access |
113 | * - Limited to 24 bits, upper byte used for fault code encoding. | 112 | * - pending work-to-be-done flags are in LSW |
114 | * | 113 | * - other flags in MSW |
115 | * - _TIF_ALLWORK_MASK and _TIF_WORK_MASK need to fit within 2 bytes, or | ||
116 | * we blow the tst immediate size constraints and need to fix up | ||
117 | * arch/sh/kernel/entry-common.S. | ||
118 | */ | 114 | */ |
119 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | 115 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
120 | #define TIF_SIGPENDING 1 /* signal pending */ | 116 | #define TIF_SIGPENDING 1 /* signal pending */ |
@@ -126,6 +122,7 @@ extern void init_thread_xstate(void); | |||
126 | #define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */ | 122 | #define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */ |
127 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | 123 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
128 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 124 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
125 | #define TIF_FREEZE 19 /* Freezing for suspend */ | ||
129 | 126 | ||
130 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 127 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
131 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 128 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
@@ -136,6 +133,13 @@ extern void init_thread_xstate(void); | |||
136 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 133 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
137 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) | 134 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) |
138 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | 135 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) |
136 | #define _TIF_FREEZE (1 << TIF_FREEZE) | ||
137 | |||
138 | /* | ||
139 | * _TIF_ALLWORK_MASK and _TIF_WORK_MASK need to fit within 2 bytes, or we | ||
140 | * blow the tst immediate size constraints and need to fix up | ||
141 | * arch/sh/kernel/entry-common.S. | ||
142 | */ | ||
139 | 143 | ||
140 | /* work to do in syscall trace */ | 144 | /* work to do in syscall trace */ |
141 | #define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ | 145 | #define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ |
@@ -163,52 +167,13 @@ extern void init_thread_xstate(void); | |||
163 | #define TS_USEDFPU 0x0002 /* FPU used by this task this quantum */ | 167 | #define TS_USEDFPU 0x0002 /* FPU used by this task this quantum */ |
164 | 168 | ||
165 | #ifndef __ASSEMBLY__ | 169 | #ifndef __ASSEMBLY__ |
166 | |||
167 | #define HAVE_SET_RESTORE_SIGMASK 1 | 170 | #define HAVE_SET_RESTORE_SIGMASK 1 |
168 | static inline void set_restore_sigmask(void) | 171 | static inline void set_restore_sigmask(void) |
169 | { | 172 | { |
170 | struct thread_info *ti = current_thread_info(); | 173 | struct thread_info *ti = current_thread_info(); |
171 | ti->status |= TS_RESTORE_SIGMASK; | 174 | ti->status |= TS_RESTORE_SIGMASK; |
172 | WARN_ON(!test_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags)); | 175 | set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags); |
173 | } | 176 | } |
174 | |||
175 | #define TI_FLAG_FAULT_CODE_SHIFT 24 | ||
176 | |||
177 | /* | ||
178 | * Additional thread flag encoding | ||
179 | */ | ||
180 | static inline void set_thread_fault_code(unsigned int val) | ||
181 | { | ||
182 | struct thread_info *ti = current_thread_info(); | ||
183 | ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT))) | ||
184 | | (val << TI_FLAG_FAULT_CODE_SHIFT); | ||
185 | } | ||
186 | |||
187 | static inline unsigned int get_thread_fault_code(void) | ||
188 | { | ||
189 | struct thread_info *ti = current_thread_info(); | ||
190 | return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT; | ||
191 | } | ||
192 | |||
193 | static inline void clear_restore_sigmask(void) | ||
194 | { | ||
195 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
196 | } | ||
197 | static inline bool test_restore_sigmask(void) | ||
198 | { | ||
199 | return current_thread_info()->status & TS_RESTORE_SIGMASK; | ||
200 | } | ||
201 | static inline bool test_and_clear_restore_sigmask(void) | ||
202 | { | ||
203 | struct thread_info *ti = current_thread_info(); | ||
204 | if (!(ti->status & TS_RESTORE_SIGMASK)) | ||
205 | return false; | ||
206 | ti->status &= ~TS_RESTORE_SIGMASK; | ||
207 | return true; | ||
208 | } | ||
209 | |||
210 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
211 | |||
212 | #endif /* !__ASSEMBLY__ */ | 177 | #endif /* !__ASSEMBLY__ */ |
213 | 178 | ||
214 | #endif /* __KERNEL__ */ | 179 | #endif /* __KERNEL__ */ |
diff --git a/arch/sh/include/asm/tlb.h b/arch/sh/include/asm/tlb.h index e61d43d9f68..ec88bfcdf7c 100644 --- a/arch/sh/include/asm/tlb.h +++ b/arch/sh/include/asm/tlb.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __ASM_SH_TLB_H | 2 | #define __ASM_SH_TLB_H |
3 | 3 | ||
4 | #ifdef CONFIG_SUPERH64 | 4 | #ifdef CONFIG_SUPERH64 |
5 | # include <asm/tlb_64.h> | 5 | # include "tlb_64.h" |
6 | #endif | 6 | #endif |
7 | 7 | ||
8 | #ifndef __ASSEMBLY__ | 8 | #ifndef __ASSEMBLY__ |
diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h index b0a282d65f6..88e734069fa 100644 --- a/arch/sh/include/asm/topology.h +++ b/arch/sh/include/asm/topology.h | |||
@@ -3,6 +3,31 @@ | |||
3 | 3 | ||
4 | #ifdef CONFIG_NUMA | 4 | #ifdef CONFIG_NUMA |
5 | 5 | ||
6 | /* sched_domains SD_NODE_INIT for sh machines */ | ||
7 | #define SD_NODE_INIT (struct sched_domain) { \ | ||
8 | .parent = NULL, \ | ||
9 | .child = NULL, \ | ||
10 | .groups = NULL, \ | ||
11 | .min_interval = 8, \ | ||
12 | .max_interval = 32, \ | ||
13 | .busy_factor = 32, \ | ||
14 | .imbalance_pct = 125, \ | ||
15 | .cache_nice_tries = 2, \ | ||
16 | .busy_idx = 3, \ | ||
17 | .idle_idx = 2, \ | ||
18 | .newidle_idx = 0, \ | ||
19 | .wake_idx = 0, \ | ||
20 | .forkexec_idx = 0, \ | ||
21 | .flags = SD_LOAD_BALANCE \ | ||
22 | | SD_BALANCE_FORK \ | ||
23 | | SD_BALANCE_EXEC \ | ||
24 | | SD_BALANCE_NEWIDLE \ | ||
25 | | SD_SERIALIZE, \ | ||
26 | .last_balance = jiffies, \ | ||
27 | .balance_interval = 1, \ | ||
28 | .nr_balance_failed = 0, \ | ||
29 | } | ||
30 | |||
6 | #define cpu_to_node(cpu) ((void)(cpu),0) | 31 | #define cpu_to_node(cpu) ((void)(cpu),0) |
7 | #define parent_node(node) ((void)(node),0) | 32 | #define parent_node(node) ((void)(node),0) |
8 | 33 | ||
diff --git a/arch/sh/include/asm/traps.h b/arch/sh/include/asm/traps.h deleted file mode 100644 index 9cc149a0dbd..00000000000 --- a/arch/sh/include/asm/traps.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | #ifndef __ASM_SH_TRAPS_H | ||
2 | #define __ASM_SH_TRAPS_H | ||
3 | |||
4 | #include <linux/compiler.h> | ||
5 | |||
6 | #ifdef CONFIG_SUPERH32 | ||
7 | # include <asm/traps_32.h> | ||
8 | #else | ||
9 | # include <asm/traps_64.h> | ||
10 | #endif | ||
11 | |||
12 | BUILD_TRAP_HANDLER(address_error); | ||
13 | BUILD_TRAP_HANDLER(debug); | ||
14 | BUILD_TRAP_HANDLER(bug); | ||
15 | BUILD_TRAP_HANDLER(breakpoint); | ||
16 | BUILD_TRAP_HANDLER(singlestep); | ||
17 | BUILD_TRAP_HANDLER(fpu_error); | ||
18 | BUILD_TRAP_HANDLER(fpu_state_restore); | ||
19 | BUILD_TRAP_HANDLER(nmi); | ||
20 | |||
21 | #endif /* __ASM_SH_TRAPS_H */ | ||
diff --git a/arch/sh/include/asm/traps_32.h b/arch/sh/include/asm/traps_32.h deleted file mode 100644 index cfd55ff9dff..00000000000 --- a/arch/sh/include/asm/traps_32.h +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | #ifndef __ASM_SH_TRAPS_32_H | ||
2 | #define __ASM_SH_TRAPS_32_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/mmu.h> | ||
6 | |||
7 | #ifdef CONFIG_CPU_HAS_SR_RB | ||
8 | #define lookup_exception_vector() \ | ||
9 | ({ \ | ||
10 | unsigned long _vec; \ | ||
11 | \ | ||
12 | __asm__ __volatile__ ( \ | ||
13 | "stc r2_bank, %0\n\t" \ | ||
14 | : "=r" (_vec) \ | ||
15 | ); \ | ||
16 | \ | ||
17 | _vec; \ | ||
18 | }) | ||
19 | #else | ||
20 | #define lookup_exception_vector() \ | ||
21 | ({ \ | ||
22 | unsigned long _vec; \ | ||
23 | __asm__ __volatile__ ( \ | ||
24 | "mov r4, %0\n\t" \ | ||
25 | : "=r" (_vec) \ | ||
26 | ); \ | ||
27 | \ | ||
28 | _vec; \ | ||
29 | }) | ||
30 | #endif | ||
31 | |||
32 | static inline void trigger_address_error(void) | ||
33 | { | ||
34 | __asm__ __volatile__ ( | ||
35 | "ldc %0, sr\n\t" | ||
36 | "mov.l @%1, %0" | ||
37 | : | ||
38 | : "r" (0x10000000), "r" (0x80000001) | ||
39 | ); | ||
40 | } | ||
41 | |||
42 | asmlinkage void do_address_error(struct pt_regs *regs, | ||
43 | unsigned long writeaccess, | ||
44 | unsigned long address); | ||
45 | asmlinkage void do_divide_error(unsigned long r4, unsigned long r5, | ||
46 | unsigned long r6, unsigned long r7, | ||
47 | struct pt_regs __regs); | ||
48 | asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5, | ||
49 | unsigned long r6, unsigned long r7, | ||
50 | struct pt_regs __regs); | ||
51 | asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5, | ||
52 | unsigned long r6, unsigned long r7, | ||
53 | struct pt_regs __regs); | ||
54 | asmlinkage void do_exception_error(unsigned long r4, unsigned long r5, | ||
55 | unsigned long r6, unsigned long r7, | ||
56 | struct pt_regs __regs); | ||
57 | |||
58 | #define BUILD_TRAP_HANDLER(name) \ | ||
59 | asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \ | ||
60 | unsigned long r6, unsigned long r7, \ | ||
61 | struct pt_regs __regs) | ||
62 | |||
63 | #define TRAP_HANDLER_DECL \ | ||
64 | struct pt_regs *regs = RELOC_HIDE(&__regs, 0); \ | ||
65 | unsigned int vec = regs->tra; \ | ||
66 | (void)vec; | ||
67 | |||
68 | #endif /* __ASM_SH_TRAPS_32_H */ | ||
diff --git a/arch/sh/include/asm/traps_64.h b/arch/sh/include/asm/traps_64.h deleted file mode 100644 index ef5eff91944..00000000000 --- a/arch/sh/include/asm/traps_64.h +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001 Paolo Alberelli | ||
3 | * Copyright (C) 2003 Paul Mundt | ||
4 | * Copyright (C) 2004 Richard Curnow | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef __ASM_SH_TRAPS_64_H | ||
11 | #define __ASM_SH_TRAPS_64_H | ||
12 | |||
13 | #include <cpu/registers.h> | ||
14 | |||
15 | extern void phys_stext(void); | ||
16 | |||
17 | #define lookup_exception_vector() \ | ||
18 | ({ \ | ||
19 | unsigned long _vec; \ | ||
20 | \ | ||
21 | __asm__ __volatile__ ( \ | ||
22 | "getcon " __EXPEVT ", %0\n\t" \ | ||
23 | : "=r" (_vec) \ | ||
24 | ); \ | ||
25 | \ | ||
26 | _vec; \ | ||
27 | }) | ||
28 | |||
29 | static inline void trigger_address_error(void) | ||
30 | { | ||
31 | phys_stext(); | ||
32 | } | ||
33 | |||
34 | #define BUILD_TRAP_HANDLER(name) \ | ||
35 | asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs) | ||
36 | #define TRAP_HANDLER_DECL | ||
37 | |||
38 | #endif /* __ASM_SH_TRAPS_64_H */ | ||
diff --git a/arch/sh/include/asm/types.h b/arch/sh/include/asm/types.h index 6a31053fa5e..f8421f7ad63 100644 --- a/arch/sh/include/asm/types.h +++ b/arch/sh/include/asm/types.h | |||
@@ -1,11 +1,12 @@ | |||
1 | #ifndef __ASM_SH_TYPES_H | 1 | #ifndef __ASM_SH_TYPES_H |
2 | #define __ASM_SH_TYPES_H | 2 | #define __ASM_SH_TYPES_H |
3 | 3 | ||
4 | #include <uapi/asm/types.h> | 4 | #include <asm-generic/types.h> |
5 | 5 | ||
6 | /* | 6 | /* |
7 | * These aren't exported outside the kernel to avoid name space clashes | 7 | * These aren't exported outside the kernel to avoid name space clashes |
8 | */ | 8 | */ |
9 | #ifdef __KERNEL__ | ||
9 | #ifndef __ASSEMBLY__ | 10 | #ifndef __ASSEMBLY__ |
10 | 11 | ||
11 | #ifdef CONFIG_SUPERH32 | 12 | #ifdef CONFIG_SUPERH32 |
@@ -17,4 +18,6 @@ typedef u64 reg_size_t; | |||
17 | #endif | 18 | #endif |
18 | 19 | ||
19 | #endif /* __ASSEMBLY__ */ | 20 | #endif /* __ASSEMBLY__ */ |
21 | #endif /* __KERNEL__ */ | ||
22 | |||
20 | #endif /* __ASM_SH_TYPES_H */ | 23 | #endif /* __ASM_SH_TYPES_H */ |
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index 9486376605f..075848f43b6 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h | |||
@@ -25,8 +25,6 @@ | |||
25 | (__chk_user_ptr(addr), \ | 25 | (__chk_user_ptr(addr), \ |
26 | __access_ok((unsigned long __force)(addr), (size))) | 26 | __access_ok((unsigned long __force)(addr), (size))) |
27 | 27 | ||
28 | #define user_addr_max() (current_thread_info()->addr_limit.seg) | ||
29 | |||
30 | /* | 28 | /* |
31 | * Uh, these should become the main single-value transfer routines ... | 29 | * Uh, these should become the main single-value transfer routines ... |
32 | * They automatically use the right size if we just have the right | 30 | * They automatically use the right size if we just have the right |
@@ -97,16 +95,11 @@ struct __large_struct { unsigned long buf[100]; }; | |||
97 | }) | 95 | }) |
98 | 96 | ||
99 | #ifdef CONFIG_SUPERH32 | 97 | #ifdef CONFIG_SUPERH32 |
100 | # include <asm/uaccess_32.h> | 98 | # include "uaccess_32.h" |
101 | #else | 99 | #else |
102 | # include <asm/uaccess_64.h> | 100 | # include "uaccess_64.h" |
103 | #endif | 101 | #endif |
104 | 102 | ||
105 | extern long strncpy_from_user(char *dest, const char __user *src, long count); | ||
106 | |||
107 | extern __must_check long strlen_user(const char __user *str); | ||
108 | extern __must_check long strnlen_user(const char __user *str, long n); | ||
109 | |||
110 | /* Generic arbitrary sized copy. */ | 103 | /* Generic arbitrary sized copy. */ |
111 | /* Return the number of bytes NOT copied */ | 104 | /* Return the number of bytes NOT copied */ |
112 | __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); | 105 | __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); |
@@ -144,6 +137,37 @@ __kernel_size_t __clear_user(void *addr, __kernel_size_t size); | |||
144 | __cl_size; \ | 137 | __cl_size; \ |
145 | }) | 138 | }) |
146 | 139 | ||
140 | /** | ||
141 | * strncpy_from_user: - Copy a NUL terminated string from userspace. | ||
142 | * @dst: Destination address, in kernel space. This buffer must be at | ||
143 | * least @count bytes long. | ||
144 | * @src: Source address, in user space. | ||
145 | * @count: Maximum number of bytes to copy, including the trailing NUL. | ||
146 | * | ||
147 | * Copies a NUL-terminated string from userspace to kernel space. | ||
148 | * | ||
149 | * On success, returns the length of the string (not including the trailing | ||
150 | * NUL). | ||
151 | * | ||
152 | * If access to userspace fails, returns -EFAULT (some data may have been | ||
153 | * copied). | ||
154 | * | ||
155 | * If @count is smaller than the length of the string, copies @count bytes | ||
156 | * and returns @count. | ||
157 | */ | ||
158 | #define strncpy_from_user(dest,src,count) \ | ||
159 | ({ \ | ||
160 | unsigned long __sfu_src = (unsigned long)(src); \ | ||
161 | int __sfu_count = (int)(count); \ | ||
162 | long __sfu_res = -EFAULT; \ | ||
163 | \ | ||
164 | if (__access_ok(__sfu_src, __sfu_count)) \ | ||
165 | __sfu_res = __strncpy_from_user((unsigned long)(dest), \ | ||
166 | __sfu_src, __sfu_count); \ | ||
167 | \ | ||
168 | __sfu_res; \ | ||
169 | }) | ||
170 | |||
147 | static inline unsigned long | 171 | static inline unsigned long |
148 | copy_from_user(void *to, const void __user *from, unsigned long n) | 172 | copy_from_user(void *to, const void __user *from, unsigned long n) |
149 | { | 173 | { |
@@ -168,6 +192,43 @@ copy_to_user(void __user *to, const void *from, unsigned long n) | |||
168 | return __copy_size; | 192 | return __copy_size; |
169 | } | 193 | } |
170 | 194 | ||
195 | /** | ||
196 | * strnlen_user: - Get the size of a string in user space. | ||
197 | * @s: The string to measure. | ||
198 | * @n: The maximum valid length | ||
199 | * | ||
200 | * Context: User context only. This function may sleep. | ||
201 | * | ||
202 | * Get the size of a NUL-terminated string in user space. | ||
203 | * | ||
204 | * Returns the size of the string INCLUDING the terminating NUL. | ||
205 | * On exception, returns 0. | ||
206 | * If the string is too long, returns a value greater than @n. | ||
207 | */ | ||
208 | static inline long strnlen_user(const char __user *s, long n) | ||
209 | { | ||
210 | if (!__addr_ok(s)) | ||
211 | return 0; | ||
212 | else | ||
213 | return __strnlen_user(s, n); | ||
214 | } | ||
215 | |||
216 | /** | ||
217 | * strlen_user: - Get the size of a string in user space. | ||
218 | * @str: The string to measure. | ||
219 | * | ||
220 | * Context: User context only. This function may sleep. | ||
221 | * | ||
222 | * Get the size of a NUL-terminated string in user space. | ||
223 | * | ||
224 | * Returns the size of the string INCLUDING the terminating NUL. | ||
225 | * On exception, returns 0. | ||
226 | * | ||
227 | * If there is a limit on the length of a valid string, you may wish to | ||
228 | * consider using strnlen_user() instead. | ||
229 | */ | ||
230 | #define strlen_user(str) strnlen_user(str, ~0UL >> 1) | ||
231 | |||
171 | /* | 232 | /* |
172 | * The exception table consists of pairs of addresses: the first is the | 233 | * The exception table consists of pairs of addresses: the first is the |
173 | * address of an instruction that is allowed to fault, and the second is | 234 | * address of an instruction that is allowed to fault, and the second is |
@@ -193,19 +254,5 @@ int fixup_exception(struct pt_regs *regs); | |||
193 | unsigned long search_exception_table(unsigned long addr); | 254 | unsigned long search_exception_table(unsigned long addr); |
194 | const struct exception_table_entry *search_exception_tables(unsigned long addr); | 255 | const struct exception_table_entry *search_exception_tables(unsigned long addr); |
195 | 256 | ||
196 | extern void *set_exception_table_vec(unsigned int vec, void *handler); | ||
197 | |||
198 | static inline void *set_exception_table_evt(unsigned int evt, void *handler) | ||
199 | { | ||
200 | return set_exception_table_vec(evt >> 5, handler); | ||
201 | } | ||
202 | |||
203 | struct mem_access { | ||
204 | unsigned long (*from)(void *dst, const void __user *src, unsigned long cnt); | ||
205 | unsigned long (*to)(void __user *dst, const void *src, unsigned long cnt); | ||
206 | }; | ||
207 | |||
208 | int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, | ||
209 | struct mem_access *ma, int, unsigned long address); | ||
210 | 257 | ||
211 | #endif /* __ASM_SH_UACCESS_H */ | 258 | #endif /* __ASM_SH_UACCESS_H */ |
diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h index c0de7ee35ab..ae0d24f6653 100644 --- a/arch/sh/include/asm/uaccess_32.h +++ b/arch/sh/include/asm/uaccess_32.h | |||
@@ -170,4 +170,79 @@ __asm__ __volatile__( \ | |||
170 | 170 | ||
171 | extern void __put_user_unknown(void); | 171 | extern void __put_user_unknown(void); |
172 | 172 | ||
173 | static inline int | ||
174 | __strncpy_from_user(unsigned long __dest, unsigned long __user __src, int __count) | ||
175 | { | ||
176 | __kernel_size_t res; | ||
177 | unsigned long __dummy, _d, _s, _c; | ||
178 | |||
179 | __asm__ __volatile__( | ||
180 | "9:\n" | ||
181 | "mov.b @%2+, %1\n\t" | ||
182 | "cmp/eq #0, %1\n\t" | ||
183 | "bt/s 2f\n" | ||
184 | "1:\n" | ||
185 | "mov.b %1, @%3\n\t" | ||
186 | "dt %4\n\t" | ||
187 | "bf/s 9b\n\t" | ||
188 | " add #1, %3\n\t" | ||
189 | "2:\n\t" | ||
190 | "sub %4, %0\n" | ||
191 | "3:\n" | ||
192 | ".section .fixup,\"ax\"\n" | ||
193 | "4:\n\t" | ||
194 | "mov.l 5f, %1\n\t" | ||
195 | "jmp @%1\n\t" | ||
196 | " mov %9, %0\n\t" | ||
197 | ".balign 4\n" | ||
198 | "5: .long 3b\n" | ||
199 | ".previous\n" | ||
200 | ".section __ex_table,\"a\"\n" | ||
201 | " .balign 4\n" | ||
202 | " .long 9b,4b\n" | ||
203 | ".previous" | ||
204 | : "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d), "=r"(_c) | ||
205 | : "0" (__count), "2" (__src), "3" (__dest), "4" (__count), | ||
206 | "i" (-EFAULT) | ||
207 | : "memory", "t"); | ||
208 | |||
209 | return res; | ||
210 | } | ||
211 | |||
212 | /* | ||
213 | * Return the size of a string (including the ending 0 even when we have | ||
214 | * exceeded the maximum string length). | ||
215 | */ | ||
216 | static inline long __strnlen_user(const char __user *__s, long __n) | ||
217 | { | ||
218 | unsigned long res; | ||
219 | unsigned long __dummy; | ||
220 | |||
221 | __asm__ __volatile__( | ||
222 | "1:\t" | ||
223 | "mov.b @(%0,%3), %1\n\t" | ||
224 | "cmp/eq %4, %0\n\t" | ||
225 | "bt/s 2f\n\t" | ||
226 | " add #1, %0\n\t" | ||
227 | "tst %1, %1\n\t" | ||
228 | "bf 1b\n\t" | ||
229 | "2:\n" | ||
230 | ".section .fixup,\"ax\"\n" | ||
231 | "3:\n\t" | ||
232 | "mov.l 4f, %1\n\t" | ||
233 | "jmp @%1\n\t" | ||
234 | " mov #0, %0\n" | ||
235 | ".balign 4\n" | ||
236 | "4: .long 2b\n" | ||
237 | ".previous\n" | ||
238 | ".section __ex_table,\"a\"\n" | ||
239 | " .balign 4\n" | ||
240 | " .long 1b,3b\n" | ||
241 | ".previous" | ||
242 | : "=z" (res), "=&r" (__dummy) | ||
243 | : "0" (0), "r" (__s), "r" (__n) | ||
244 | : "t"); | ||
245 | return res; | ||
246 | } | ||
247 | |||
173 | #endif /* __ASM_SH_UACCESS_32_H */ | 248 | #endif /* __ASM_SH_UACCESS_32_H */ |
diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h index 2e07e0f40c6..56fd20b8cdc 100644 --- a/arch/sh/include/asm/uaccess_64.h +++ b/arch/sh/include/asm/uaccess_64.h | |||
@@ -84,4 +84,8 @@ extern long __put_user_asm_l(void *, long); | |||
84 | extern long __put_user_asm_q(void *, long); | 84 | extern long __put_user_asm_q(void *, long); |
85 | extern void __put_user_unknown(void); | 85 | extern void __put_user_unknown(void); |
86 | 86 | ||
87 | extern long __strnlen_user(const char *__s, long __n); | ||
88 | extern int __strncpy_from_user(unsigned long __dest, | ||
89 | unsigned long __user __src, int __count); | ||
90 | |||
87 | #endif /* __ASM_SH_UACCESS_64_H */ | 91 | #endif /* __ASM_SH_UACCESS_64_H */ |
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h index 012004ed333..65be656ead7 100644 --- a/arch/sh/include/asm/unistd.h +++ b/arch/sh/include/asm/unistd.h | |||
@@ -1,43 +1,13 @@ | |||
1 | #ifdef __KERNEL__ | ||
1 | # ifdef CONFIG_SUPERH32 | 2 | # ifdef CONFIG_SUPERH32 |
2 | # include <asm/unistd_32.h> | 3 | # include "unistd_32.h" |
3 | # else | 4 | # else |
4 | # include <asm/unistd_64.h> | 5 | # include "unistd_64.h" |
5 | # endif | 6 | # endif |
6 | 7 | #else | |
7 | # define __ARCH_WANT_SYS_RT_SIGSUSPEND | 8 | # ifdef __SH5__ |
8 | # define __ARCH_WANT_OLD_READDIR | 9 | # include "unistd_64.h" |
9 | # define __ARCH_WANT_OLD_STAT | 10 | # else |
10 | # define __ARCH_WANT_STAT64 | 11 | # include "unistd_32.h" |
11 | # define __ARCH_WANT_SYS_ALARM | 12 | # endif |
12 | # define __ARCH_WANT_SYS_GETHOSTNAME | 13 | #endif |
13 | # define __ARCH_WANT_SYS_IPC | ||
14 | # define __ARCH_WANT_SYS_PAUSE | ||
15 | # define __ARCH_WANT_SYS_SGETMASK | ||
16 | # define __ARCH_WANT_SYS_SIGNAL | ||
17 | # define __ARCH_WANT_SYS_TIME | ||
18 | # define __ARCH_WANT_SYS_UTIME | ||
19 | # define __ARCH_WANT_SYS_WAITPID | ||
20 | # define __ARCH_WANT_SYS_SOCKETCALL | ||
21 | # define __ARCH_WANT_SYS_FADVISE64 | ||
22 | # define __ARCH_WANT_SYS_GETPGRP | ||
23 | # define __ARCH_WANT_SYS_LLSEEK | ||
24 | # define __ARCH_WANT_SYS_NICE | ||
25 | # define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
26 | # define __ARCH_WANT_SYS_OLD_UNAME | ||
27 | # define __ARCH_WANT_SYS_OLDUMOUNT | ||
28 | # define __ARCH_WANT_SYS_SIGPENDING | ||
29 | # define __ARCH_WANT_SYS_SIGPROCMASK | ||
30 | # define __ARCH_WANT_SYS_RT_SIGACTION | ||
31 | # define __ARCH_WANT_SYS_FORK | ||
32 | # define __ARCH_WANT_SYS_VFORK | ||
33 | # define __ARCH_WANT_SYS_CLONE | ||
34 | |||
35 | /* | ||
36 | * "Conditional" syscalls | ||
37 | * | ||
38 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
39 | * but it doesn't work on all toolchains, so we just do it by hand | ||
40 | */ | ||
41 | # define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") | ||
42 | |||
43 | #include <uapi/asm/unistd.h> | ||
diff --git a/arch/sh/include/asm/word-at-a-time.h b/arch/sh/include/asm/word-at-a-time.h deleted file mode 100644 index 6e38953ff7f..00000000000 --- a/arch/sh/include/asm/word-at-a-time.h +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | #ifndef __ASM_SH_WORD_AT_A_TIME_H | ||
2 | #define __ASM_SH_WORD_AT_A_TIME_H | ||
3 | |||
4 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
5 | # include <asm-generic/word-at-a-time.h> | ||
6 | #else | ||
7 | /* | ||
8 | * Little-endian version cribbed from x86. | ||
9 | */ | ||
10 | struct word_at_a_time { | ||
11 | const unsigned long one_bits, high_bits; | ||
12 | }; | ||
13 | |||
14 | #define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) } | ||
15 | |||
16 | /* Carl Chatfield / Jan Achrenius G+ version for 32-bit */ | ||
17 | static inline long count_masked_bytes(long mask) | ||
18 | { | ||
19 | /* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */ | ||
20 | long a = (0x0ff0001+mask) >> 23; | ||
21 | /* Fix the 1 for 00 case */ | ||
22 | return a & mask; | ||
23 | } | ||
24 | |||
25 | /* Return nonzero if it has a zero */ | ||
26 | static inline unsigned long has_zero(unsigned long a, unsigned long *bits, const struct word_at_a_time *c) | ||
27 | { | ||
28 | unsigned long mask = ((a - c->one_bits) & ~a) & c->high_bits; | ||
29 | *bits = mask; | ||
30 | return mask; | ||
31 | } | ||
32 | |||
33 | static inline unsigned long prep_zero_mask(unsigned long a, unsigned long bits, const struct word_at_a_time *c) | ||
34 | { | ||
35 | return bits; | ||
36 | } | ||
37 | |||
38 | static inline unsigned long create_zero_mask(unsigned long bits) | ||
39 | { | ||
40 | bits = (bits - 1) & ~bits; | ||
41 | return bits >> 7; | ||
42 | } | ||
43 | |||
44 | /* The mask we created is directly usable as a bytemask */ | ||
45 | #define zero_bytemask(mask) (mask) | ||
46 | |||
47 | static inline unsigned long find_zero(unsigned long mask) | ||
48 | { | ||
49 | return count_masked_bytes(mask); | ||
50 | } | ||
51 | #endif | ||
52 | |||
53 | #endif | ||