diff options
author | Tejun Heo <tj@kernel.org> | 2010-01-04 19:17:33 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-01-04 19:17:33 -0500 |
commit | 32032df6c2f6c9c6b2ada2ce42322231824f70c2 (patch) | |
tree | b1ce838a37044bb38dfc128e2116ca35630e629a /arch/sparc | |
parent | 22b737f4c75197372d64afc6ed1bccd58c00e549 (diff) | |
parent | c5974b835a909ff15c3b7e6cf6789b5eb919f419 (diff) |
Merge branch 'master' into percpu
Conflicts:
arch/powerpc/platforms/pseries/hvCall.S
include/linux/percpu.h
Diffstat (limited to 'arch/sparc')
87 files changed, 2325 insertions, 688 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index ac45aab741a5..108197ac0d56 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -26,6 +26,7 @@ config SPARC | |||
26 | select RTC_CLASS | 26 | select RTC_CLASS |
27 | select RTC_DRV_M48T59 | 27 | select RTC_DRV_M48T59 |
28 | select HAVE_PERF_EVENTS | 28 | select HAVE_PERF_EVENTS |
29 | select PERF_USE_VMALLOC | ||
29 | select HAVE_DMA_ATTRS | 30 | select HAVE_DMA_ATTRS |
30 | select HAVE_DMA_API_DEBUG | 31 | select HAVE_DMA_API_DEBUG |
31 | 32 | ||
@@ -42,12 +43,14 @@ config SPARC64 | |||
42 | select HAVE_SYSCALL_WRAPPERS | 43 | select HAVE_SYSCALL_WRAPPERS |
43 | select HAVE_DYNAMIC_FTRACE | 44 | select HAVE_DYNAMIC_FTRACE |
44 | select HAVE_FTRACE_MCOUNT_RECORD | 45 | select HAVE_FTRACE_MCOUNT_RECORD |
46 | select HAVE_SYSCALL_TRACEPOINTS | ||
45 | select USE_GENERIC_SMP_HELPERS if SMP | 47 | select USE_GENERIC_SMP_HELPERS if SMP |
46 | select RTC_DRV_CMOS | 48 | select RTC_DRV_CMOS |
47 | select RTC_DRV_BQ4802 | 49 | select RTC_DRV_BQ4802 |
48 | select RTC_DRV_SUN4V | 50 | select RTC_DRV_SUN4V |
49 | select RTC_DRV_STARFIRE | 51 | select RTC_DRV_STARFIRE |
50 | select HAVE_PERF_EVENTS | 52 | select HAVE_PERF_EVENTS |
53 | select PERF_USE_VMALLOC | ||
51 | 54 | ||
52 | config ARCH_DEFCONFIG | 55 | config ARCH_DEFCONFIG |
53 | string | 56 | string |
@@ -219,6 +222,13 @@ config SPARC64_SMP | |||
219 | default y | 222 | default y |
220 | depends on SPARC64 && SMP | 223 | depends on SPARC64 && SMP |
221 | 224 | ||
225 | config EARLYFB | ||
226 | bool "Support for early boot text console" | ||
227 | default y | ||
228 | depends on SPARC64 | ||
229 | help | ||
230 | Say Y here to enable a faster early framebuffer boot console. | ||
231 | |||
222 | choice | 232 | choice |
223 | prompt "Kernel page size" if SPARC64 | 233 | prompt "Kernel page size" if SPARC64 |
224 | default SPARC64_PAGE_SIZE_8KB | 234 | default SPARC64_PAGE_SIZE_8KB |
diff --git a/arch/sparc/Kconfig.debug b/arch/sparc/Kconfig.debug index 90d5fe223a74..9d3c889718ac 100644 --- a/arch/sparc/Kconfig.debug +++ b/arch/sparc/Kconfig.debug | |||
@@ -33,4 +33,18 @@ config FRAME_POINTER | |||
33 | depends on MCOUNT | 33 | depends on MCOUNT |
34 | default y | 34 | default y |
35 | 35 | ||
36 | config DEBUG_STRICT_USER_COPY_CHECKS | ||
37 | bool "Strict copy size checks" | ||
38 | depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING | ||
39 | ---help--- | ||
40 | Enabling this option turns a certain set of sanity checks for user | ||
41 | copy operations into compile time failures. | ||
42 | |||
43 | The copy_from_user() etc checks are there to help test if there | ||
44 | are sufficient security checks on the length argument of | ||
45 | the copy operation, by having gcc prove that the argument is | ||
46 | within bounds. | ||
47 | |||
48 | If unsure, or if you run an older (pre 4.4) gcc, say N. | ||
49 | |||
36 | endmenu | 50 | endmenu |
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index dfe272d14465..113225b241e0 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile | |||
@@ -27,6 +27,7 @@ AS := $(AS) -32 | |||
27 | LDFLAGS := -m elf32_sparc | 27 | LDFLAGS := -m elf32_sparc |
28 | CHECKFLAGS += -D__sparc__ | 28 | CHECKFLAGS += -D__sparc__ |
29 | export BITS := 32 | 29 | export BITS := 32 |
30 | UTS_MACHINE := sparc | ||
30 | 31 | ||
31 | #KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 | 32 | #KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 |
32 | KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 | 33 | KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 |
@@ -46,6 +47,7 @@ CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 | |||
46 | 47 | ||
47 | LDFLAGS := -m elf64_sparc | 48 | LDFLAGS := -m elf64_sparc |
48 | export BITS := 64 | 49 | export BITS := 64 |
50 | UTS_MACHINE := sparc64 | ||
49 | 51 | ||
50 | KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \ | 52 | KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \ |
51 | -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \ | 53 | -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \ |
diff --git a/arch/sparc/boot/btfixupprep.c b/arch/sparc/boot/btfixupprep.c index 52a4208fe4f0..bbf91b9c3d39 100644 --- a/arch/sparc/boot/btfixupprep.c +++ b/arch/sparc/boot/btfixupprep.c | |||
@@ -61,14 +61,14 @@ unsigned long lastfoffset = -1; | |||
61 | unsigned long lastfrelno; | 61 | unsigned long lastfrelno; |
62 | btfixup *lastf; | 62 | btfixup *lastf; |
63 | 63 | ||
64 | void fatal(void) __attribute__((noreturn)); | 64 | static void fatal(void) __attribute__((noreturn)); |
65 | void fatal(void) | 65 | static void fatal(void) |
66 | { | 66 | { |
67 | fprintf(stderr, "Malformed output from objdump\n%s\n", buffer); | 67 | fprintf(stderr, "Malformed output from objdump\n%s\n", buffer); |
68 | exit(1); | 68 | exit(1); |
69 | } | 69 | } |
70 | 70 | ||
71 | btfixup *find(int type, char *name) | 71 | static btfixup *find(int type, char *name) |
72 | { | 72 | { |
73 | int i; | 73 | int i; |
74 | for (i = 0; i < last; i++) { | 74 | for (i = 0; i < last; i++) { |
@@ -88,7 +88,7 @@ btfixup *find(int type, char *name) | |||
88 | return array + last - 1; | 88 | return array + last - 1; |
89 | } | 89 | } |
90 | 90 | ||
91 | void set_mode (char *buffer) | 91 | static void set_mode (char *buffer) |
92 | { | 92 | { |
93 | for (mode = 0;; mode++) | 93 | for (mode = 0;; mode++) |
94 | if (buffer[mode] < '0' || buffer[mode] > '9') | 94 | if (buffer[mode] < '0' || buffer[mode] > '9') |
diff --git a/arch/sparc/boot/piggyback_32.c b/arch/sparc/boot/piggyback_32.c index e8dc9adfcd61..ac944aec7301 100644 --- a/arch/sparc/boot/piggyback_32.c +++ b/arch/sparc/boot/piggyback_32.c | |||
@@ -35,17 +35,17 @@ | |||
35 | * as PROM looks for a.out image only. | 35 | * as PROM looks for a.out image only. |
36 | */ | 36 | */ |
37 | 37 | ||
38 | unsigned short ld2(char *p) | 38 | static unsigned short ld2(char *p) |
39 | { | 39 | { |
40 | return (p[0] << 8) | p[1]; | 40 | return (p[0] << 8) | p[1]; |
41 | } | 41 | } |
42 | 42 | ||
43 | unsigned int ld4(char *p) | 43 | static unsigned int ld4(char *p) |
44 | { | 44 | { |
45 | return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; | 45 | return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; |
46 | } | 46 | } |
47 | 47 | ||
48 | void st4(char *p, unsigned int x) | 48 | static void st4(char *p, unsigned int x) |
49 | { | 49 | { |
50 | p[0] = x >> 24; | 50 | p[0] = x >> 24; |
51 | p[1] = x >> 16; | 51 | p[1] = x >> 16; |
@@ -53,7 +53,7 @@ void st4(char *p, unsigned int x) | |||
53 | p[3] = x; | 53 | p[3] = x; |
54 | } | 54 | } |
55 | 55 | ||
56 | void usage(void) | 56 | static void usage(void) |
57 | { | 57 | { |
58 | /* fs_img.gz is an image of initial ramdisk. */ | 58 | /* fs_img.gz is an image of initial ramdisk. */ |
59 | fprintf(stderr, "Usage: piggyback vmlinux.aout System.map fs_img.gz\n"); | 59 | fprintf(stderr, "Usage: piggyback vmlinux.aout System.map fs_img.gz\n"); |
@@ -61,7 +61,7 @@ void usage(void) | |||
61 | exit(1); | 61 | exit(1); |
62 | } | 62 | } |
63 | 63 | ||
64 | void die(char *str) | 64 | static void die(char *str) |
65 | { | 65 | { |
66 | perror (str); | 66 | perror (str); |
67 | exit(1); | 67 | exit(1); |
diff --git a/arch/sparc/boot/piggyback_64.c b/arch/sparc/boot/piggyback_64.c index c63fd1b6bdd4..a26a686cb5aa 100644 --- a/arch/sparc/boot/piggyback_64.c +++ b/arch/sparc/boot/piggyback_64.c | |||
@@ -32,7 +32,7 @@ | |||
32 | /* Note: run this on an a.out kernel (use elftoaout for it), as PROM looks for a.out image onlly | 32 | /* Note: run this on an a.out kernel (use elftoaout for it), as PROM looks for a.out image onlly |
33 | usage: piggyback vmlinux System.map tail, where tail is gzipped fs of the initial ramdisk */ | 33 | usage: piggyback vmlinux System.map tail, where tail is gzipped fs of the initial ramdisk */ |
34 | 34 | ||
35 | void die(char *str) | 35 | static void die(char *str) |
36 | { | 36 | { |
37 | perror (str); | 37 | perror (str); |
38 | exit(1); | 38 | exit(1); |
diff --git a/arch/sparc/include/asm/asm-offsets.h b/arch/sparc/include/asm/asm-offsets.h new file mode 100644 index 000000000000..d370ee36a182 --- /dev/null +++ b/arch/sparc/include/asm/asm-offsets.h | |||
@@ -0,0 +1 @@ | |||
#include <generated/asm-offsets.h> | |||
diff --git a/arch/sparc/include/asm/btext.h b/arch/sparc/include/asm/btext.h new file mode 100644 index 000000000000..9b2bc6b6ed0a --- /dev/null +++ b/arch/sparc/include/asm/btext.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _SPARC_BTEXT_H | ||
2 | #define _SPARC_BTEXT_H | ||
3 | |||
4 | extern int btext_find_display(void); | ||
5 | |||
6 | #endif /* _SPARC_BTEXT_H */ | ||
diff --git a/arch/sparc/include/asm/cacheflush_32.h b/arch/sparc/include/asm/cacheflush_32.h index 68ac10910271..2e468773f250 100644 --- a/arch/sparc/include/asm/cacheflush_32.h +++ b/arch/sparc/include/asm/cacheflush_32.h | |||
@@ -75,6 +75,7 @@ BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long) | |||
75 | 75 | ||
76 | extern void sparc_flush_page_to_ram(struct page *page); | 76 | extern void sparc_flush_page_to_ram(struct page *page); |
77 | 77 | ||
78 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||
78 | #define flush_dcache_page(page) sparc_flush_page_to_ram(page) | 79 | #define flush_dcache_page(page) sparc_flush_page_to_ram(page) |
79 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | 80 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
80 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | 81 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) |
diff --git a/arch/sparc/include/asm/cacheflush_64.h b/arch/sparc/include/asm/cacheflush_64.h index c43321729b3b..b95384033e89 100644 --- a/arch/sparc/include/asm/cacheflush_64.h +++ b/arch/sparc/include/asm/cacheflush_64.h | |||
@@ -37,6 +37,7 @@ extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page); | |||
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | extern void __flush_dcache_range(unsigned long start, unsigned long end); | 39 | extern void __flush_dcache_range(unsigned long start, unsigned long end); |
40 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||
40 | extern void flush_dcache_page(struct page *page); | 41 | extern void flush_dcache_page(struct page *page); |
41 | 42 | ||
42 | #define flush_icache_page(vma, pg) do { } while(0) | 43 | #define flush_icache_page(vma, pg) do { } while(0) |
diff --git a/arch/sparc/include/asm/elf_32.h b/arch/sparc/include/asm/elf_32.h index 381a1b5256d6..4269ca6ad18a 100644 --- a/arch/sparc/include/asm/elf_32.h +++ b/arch/sparc/include/asm/elf_32.h | |||
@@ -104,8 +104,6 @@ typedef struct { | |||
104 | #define ELF_CLASS ELFCLASS32 | 104 | #define ELF_CLASS ELFCLASS32 |
105 | #define ELF_DATA ELFDATA2MSB | 105 | #define ELF_DATA ELFDATA2MSB |
106 | 106 | ||
107 | #define USE_ELF_CORE_DUMP | ||
108 | |||
109 | #define ELF_EXEC_PAGESIZE 4096 | 107 | #define ELF_EXEC_PAGESIZE 4096 |
110 | 108 | ||
111 | 109 | ||
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h index d42e393078c4..ff66bb88537b 100644 --- a/arch/sparc/include/asm/elf_64.h +++ b/arch/sparc/include/asm/elf_64.h | |||
@@ -152,7 +152,6 @@ typedef struct { | |||
152 | (x)->e_machine == EM_SPARC32PLUS) | 152 | (x)->e_machine == EM_SPARC32PLUS) |
153 | #define compat_start_thread start_thread32 | 153 | #define compat_start_thread start_thread32 |
154 | 154 | ||
155 | #define USE_ELF_CORE_DUMP | ||
156 | #define ELF_EXEC_PAGESIZE PAGE_SIZE | 155 | #define ELF_EXEC_PAGESIZE PAGE_SIZE |
157 | 156 | ||
158 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | 157 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical |
diff --git a/arch/sparc/include/asm/fcntl.h b/arch/sparc/include/asm/fcntl.h index d4d9c9d852c3..38f37b333cc7 100644 --- a/arch/sparc/include/asm/fcntl.h +++ b/arch/sparc/include/asm/fcntl.h | |||
@@ -1,14 +1,12 @@ | |||
1 | #ifndef _SPARC_FCNTL_H | 1 | #ifndef _SPARC_FCNTL_H |
2 | #define _SPARC_FCNTL_H | 2 | #define _SPARC_FCNTL_H |
3 | 3 | ||
4 | /* open/fcntl - O_SYNC is only implemented on blocks devices and on files | ||
5 | located on an ext2 file system */ | ||
6 | #define O_APPEND 0x0008 | 4 | #define O_APPEND 0x0008 |
7 | #define FASYNC 0x0040 /* fcntl, for BSD compatibility */ | 5 | #define FASYNC 0x0040 /* fcntl, for BSD compatibility */ |
8 | #define O_CREAT 0x0200 /* not fcntl */ | 6 | #define O_CREAT 0x0200 /* not fcntl */ |
9 | #define O_TRUNC 0x0400 /* not fcntl */ | 7 | #define O_TRUNC 0x0400 /* not fcntl */ |
10 | #define O_EXCL 0x0800 /* not fcntl */ | 8 | #define O_EXCL 0x0800 /* not fcntl */ |
11 | #define O_SYNC 0x2000 | 9 | #define O_DSYNC 0x2000 /* used to be O_SYNC, see below */ |
12 | #define O_NONBLOCK 0x4000 | 10 | #define O_NONBLOCK 0x4000 |
13 | #if defined(__sparc__) && defined(__arch64__) | 11 | #if defined(__sparc__) && defined(__arch64__) |
14 | #define O_NDELAY 0x0004 | 12 | #define O_NDELAY 0x0004 |
@@ -20,6 +18,21 @@ | |||
20 | #define O_DIRECT 0x100000 /* direct disk access hint */ | 18 | #define O_DIRECT 0x100000 /* direct disk access hint */ |
21 | #define O_NOATIME 0x200000 | 19 | #define O_NOATIME 0x200000 |
22 | #define O_CLOEXEC 0x400000 | 20 | #define O_CLOEXEC 0x400000 |
21 | /* | ||
22 | * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using | ||
23 | * the O_SYNC flag. We continue to use the existing numerical value | ||
24 | * for O_DSYNC semantics now, but using the correct symbolic name for it. | ||
25 | * This new value is used to request true Posix O_SYNC semantics. It is | ||
26 | * defined in this strange way to make sure applications compiled against | ||
27 | * new headers get at least O_DSYNC semantics on older kernels. | ||
28 | * | ||
29 | * This has the nice side-effect that we can simply test for O_DSYNC | ||
30 | * wherever we do not care if O_DSYNC or O_SYNC is used. | ||
31 | * | ||
32 | * Note: __O_SYNC must never be used directly. | ||
33 | */ | ||
34 | #define __O_SYNC 0x800000 | ||
35 | #define O_SYNC (__O_SYNC|O_DSYNC) | ||
23 | 36 | ||
24 | #define F_GETOWN 5 /* for sockets. */ | 37 | #define F_GETOWN 5 /* for sockets. */ |
25 | #define F_SETOWN 6 /* for sockets. */ | 38 | #define F_SETOWN 6 /* for sockets. */ |
diff --git a/arch/sparc/include/asm/hardirq_32.h b/arch/sparc/include/asm/hardirq_32.h index 4f63ed8df551..162007643cdc 100644 --- a/arch/sparc/include/asm/hardirq_32.h +++ b/arch/sparc/include/asm/hardirq_32.h | |||
@@ -7,17 +7,7 @@ | |||
7 | #ifndef __SPARC_HARDIRQ_H | 7 | #ifndef __SPARC_HARDIRQ_H |
8 | #define __SPARC_HARDIRQ_H | 8 | #define __SPARC_HARDIRQ_H |
9 | 9 | ||
10 | #include <linux/threads.h> | ||
11 | #include <linux/spinlock.h> | ||
12 | #include <linux/cache.h> | ||
13 | |||
14 | /* entry.S is sensitive to the offsets of these fields */ /* XXX P3 Is it? */ | ||
15 | typedef struct { | ||
16 | unsigned int __softirq_pending; | ||
17 | } ____cacheline_aligned irq_cpustat_t; | ||
18 | |||
19 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | ||
20 | |||
21 | #define HARDIRQ_BITS 8 | 10 | #define HARDIRQ_BITS 8 |
11 | #include <asm-generic/hardirq.h> | ||
22 | 12 | ||
23 | #endif /* __SPARC_HARDIRQ_H */ | 13 | #endif /* __SPARC_HARDIRQ_H */ |
diff --git a/arch/sparc/include/asm/irq_32.h b/arch/sparc/include/asm/irq_32.h index ea43057d4763..cbf4801deaaf 100644 --- a/arch/sparc/include/asm/irq_32.h +++ b/arch/sparc/include/asm/irq_32.h | |||
@@ -6,10 +6,10 @@ | |||
6 | #ifndef _SPARC_IRQ_H | 6 | #ifndef _SPARC_IRQ_H |
7 | #define _SPARC_IRQ_H | 7 | #define _SPARC_IRQ_H |
8 | 8 | ||
9 | #include <linux/interrupt.h> | ||
10 | |||
11 | #define NR_IRQS 16 | 9 | #define NR_IRQS 16 |
12 | 10 | ||
11 | #include <linux/interrupt.h> | ||
12 | |||
13 | #define irq_canonicalize(irq) (irq) | 13 | #define irq_canonicalize(irq) (irq) |
14 | 14 | ||
15 | extern void __init init_IRQ(void); | 15 | extern void __init init_IRQ(void); |
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h index 28a42b73f64f..3ea5964c43b4 100644 --- a/arch/sparc/include/asm/leon.h +++ b/arch/sparc/include/asm/leon.h | |||
@@ -148,7 +148,7 @@ static inline unsigned long leon_load_reg(unsigned long paddr) | |||
148 | return retval; | 148 | return retval; |
149 | } | 149 | } |
150 | 150 | ||
151 | extern inline void leon_srmmu_disabletlb(void) | 151 | static inline void leon_srmmu_disabletlb(void) |
152 | { | 152 | { |
153 | unsigned int retval; | 153 | unsigned int retval; |
154 | __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), | 154 | __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), |
@@ -158,7 +158,7 @@ extern inline void leon_srmmu_disabletlb(void) | |||
158 | "i"(ASI_LEON_MMUREGS) : "memory"); | 158 | "i"(ASI_LEON_MMUREGS) : "memory"); |
159 | } | 159 | } |
160 | 160 | ||
161 | extern inline void leon_srmmu_enabletlb(void) | 161 | static inline void leon_srmmu_enabletlb(void) |
162 | { | 162 | { |
163 | unsigned int retval; | 163 | unsigned int retval; |
164 | __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), | 164 | __asm__ __volatile__("lda [%%g0] %2, %0\n\t" : "=r"(retval) : "r"(0), |
@@ -190,7 +190,7 @@ extern void leon_init_IRQ(void); | |||
190 | 190 | ||
191 | extern unsigned long last_valid_pfn; | 191 | extern unsigned long last_valid_pfn; |
192 | 192 | ||
193 | extern inline unsigned long sparc_leon3_get_dcachecfg(void) | 193 | static inline unsigned long sparc_leon3_get_dcachecfg(void) |
194 | { | 194 | { |
195 | unsigned int retval; | 195 | unsigned int retval; |
196 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : | 196 | __asm__ __volatile__("lda [%1] %2, %0\n\t" : |
@@ -201,7 +201,7 @@ extern inline unsigned long sparc_leon3_get_dcachecfg(void) | |||
201 | } | 201 | } |
202 | 202 | ||
203 | /* enable snooping */ | 203 | /* enable snooping */ |
204 | extern inline void sparc_leon3_enable_snooping(void) | 204 | static inline void sparc_leon3_enable_snooping(void) |
205 | { | 205 | { |
206 | __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t" | 206 | __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t" |
207 | "set 0x800000, %%l2\n\t" | 207 | "set 0x800000, %%l2\n\t" |
@@ -209,7 +209,14 @@ extern inline void sparc_leon3_enable_snooping(void) | |||
209 | "sta %%l2, [%%g0] 2\n\t" : : : "l1", "l2"); | 209 | "sta %%l2, [%%g0] 2\n\t" : : : "l1", "l2"); |
210 | }; | 210 | }; |
211 | 211 | ||
212 | extern inline void sparc_leon3_disable_cache(void) | 212 | static inline int sparc_leon3_snooping_enabled(void) |
213 | { | ||
214 | u32 cctrl; | ||
215 | __asm__ __volatile__("lda [%%g0] 2, %0\n\t" : "=r"(cctrl)); | ||
216 | return (cctrl >> 23) & 1; | ||
217 | }; | ||
218 | |||
219 | static inline void sparc_leon3_disable_cache(void) | ||
213 | { | 220 | { |
214 | __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t" | 221 | __asm__ __volatile__ ("lda [%%g0] 2, %%l1\n\t" |
215 | "set 0x00000f, %%l2\n\t" | 222 | "set 0x00000f, %%l2\n\t" |
@@ -340,6 +347,30 @@ extern int leon_flush_needed(void); | |||
340 | extern void leon_switch_mm(void); | 347 | extern void leon_switch_mm(void); |
341 | extern int srmmu_swprobe_trace; | 348 | extern int srmmu_swprobe_trace; |
342 | 349 | ||
350 | #ifdef CONFIG_SMP | ||
351 | extern int leon_smp_nrcpus(void); | ||
352 | extern void leon_clear_profile_irq(int cpu); | ||
353 | extern void leon_smp_done(void); | ||
354 | extern void leon_boot_cpus(void); | ||
355 | extern int leon_boot_one_cpu(int i); | ||
356 | void leon_init_smp(void); | ||
357 | extern void cpu_probe(void); | ||
358 | extern void cpu_idle(void); | ||
359 | extern void init_IRQ(void); | ||
360 | extern void cpu_panic(void); | ||
361 | extern int __leon_processor_id(void); | ||
362 | void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu); | ||
363 | |||
364 | extern unsigned int real_irq_entry[], smpleon_ticker[]; | ||
365 | extern unsigned int patchme_maybe_smp_msg[]; | ||
366 | extern unsigned long trapbase_cpu1[]; | ||
367 | extern unsigned long trapbase_cpu2[]; | ||
368 | extern unsigned long trapbase_cpu3[]; | ||
369 | extern unsigned int t_nmi[], linux_trap_ipi15_leon[]; | ||
370 | extern unsigned int linux_trap_ipi15_sun4m[]; | ||
371 | |||
372 | #endif /* CONFIG_SMP */ | ||
373 | |||
343 | #endif /* __KERNEL__ */ | 374 | #endif /* __KERNEL__ */ |
344 | 375 | ||
345 | #endif /* __ASSEMBLY__ */ | 376 | #endif /* __ASSEMBLY__ */ |
@@ -356,6 +387,10 @@ extern int srmmu_swprobe_trace; | |||
356 | #define leon_switch_mm() do {} while (0) | 387 | #define leon_switch_mm() do {} while (0) |
357 | #define leon_init_IRQ() do {} while (0) | 388 | #define leon_init_IRQ() do {} while (0) |
358 | #define init_leon() do {} while (0) | 389 | #define init_leon() do {} while (0) |
390 | #define leon_smp_done() do {} while (0) | ||
391 | #define leon_boot_cpus() do {} while (0) | ||
392 | #define leon_boot_one_cpu(i) 1 | ||
393 | #define leon_init_smp() do {} while (0) | ||
359 | 394 | ||
360 | #endif /* !defined(CONFIG_SPARC_LEON) */ | 395 | #endif /* !defined(CONFIG_SPARC_LEON) */ |
361 | 396 | ||
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h index b63e51c3c3ee..b0576df6ec83 100644 --- a/arch/sparc/include/asm/pci_64.h +++ b/arch/sparc/include/asm/pci_64.h | |||
@@ -16,8 +16,6 @@ | |||
16 | 16 | ||
17 | #define PCI_IRQ_NONE 0xffffffff | 17 | #define PCI_IRQ_NONE 0xffffffff |
18 | 18 | ||
19 | #define PCI_CACHE_LINE_BYTES 64 | ||
20 | |||
21 | static inline void pcibios_set_master(struct pci_dev *dev) | 19 | static inline void pcibios_set_master(struct pci_dev *dev) |
22 | { | 20 | { |
23 | /* No special bus mastering setup handling */ | 21 | /* No special bus mastering setup handling */ |
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 0ff92fa22064..f3cb790fa2ae 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h | |||
@@ -41,8 +41,8 @@ | |||
41 | #define LOW_OBP_ADDRESS _AC(0x00000000f0000000,UL) | 41 | #define LOW_OBP_ADDRESS _AC(0x00000000f0000000,UL) |
42 | #define HI_OBP_ADDRESS _AC(0x0000000100000000,UL) | 42 | #define HI_OBP_ADDRESS _AC(0x0000000100000000,UL) |
43 | #define VMALLOC_START _AC(0x0000000100000000,UL) | 43 | #define VMALLOC_START _AC(0x0000000100000000,UL) |
44 | #define VMALLOC_END _AC(0x0000000200000000,UL) | 44 | #define VMALLOC_END _AC(0x0000010000000000,UL) |
45 | #define VMEMMAP_BASE _AC(0x0000000200000000,UL) | 45 | #define VMEMMAP_BASE _AC(0x0000010000000000,UL) |
46 | 46 | ||
47 | #define vmemmap ((struct page *)VMEMMAP_BASE) | 47 | #define vmemmap ((struct page *)VMEMMAP_BASE) |
48 | 48 | ||
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h index 82a190d7efc1..f845828ca4c6 100644 --- a/arch/sparc/include/asm/prom.h +++ b/arch/sparc/include/asm/prom.h | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/of.h> /* linux/of.h gets to determine #include ordering */ | ||
1 | #ifndef _SPARC_PROM_H | 2 | #ifndef _SPARC_PROM_H |
2 | #define _SPARC_PROM_H | 3 | #define _SPARC_PROM_H |
3 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
@@ -28,50 +29,11 @@ | |||
28 | #define of_prop_cmp(s1, s2) strcasecmp((s1), (s2)) | 29 | #define of_prop_cmp(s1, s2) strcasecmp((s1), (s2)) |
29 | #define of_node_cmp(s1, s2) strcmp((s1), (s2)) | 30 | #define of_node_cmp(s1, s2) strcmp((s1), (s2)) |
30 | 31 | ||
31 | typedef u32 phandle; | ||
32 | typedef u32 ihandle; | ||
33 | |||
34 | struct property { | ||
35 | char *name; | ||
36 | int length; | ||
37 | void *value; | ||
38 | struct property *next; | ||
39 | unsigned long _flags; | ||
40 | unsigned int unique_id; | ||
41 | }; | ||
42 | |||
43 | struct of_irq_controller; | ||
44 | struct device_node { | ||
45 | const char *name; | ||
46 | const char *type; | ||
47 | phandle node; | ||
48 | char *path_component_name; | ||
49 | char *full_name; | ||
50 | |||
51 | struct property *properties; | ||
52 | struct property *deadprops; /* removed properties */ | ||
53 | struct device_node *parent; | ||
54 | struct device_node *child; | ||
55 | struct device_node *sibling; | ||
56 | struct device_node *next; /* next device of same type */ | ||
57 | struct device_node *allnext; /* next in list of all nodes */ | ||
58 | struct proc_dir_entry *pde; /* this node's proc directory */ | ||
59 | struct kref kref; | ||
60 | unsigned long _flags; | ||
61 | void *data; | ||
62 | unsigned int unique_id; | ||
63 | |||
64 | struct of_irq_controller *irq_trans; | ||
65 | }; | ||
66 | |||
67 | struct of_irq_controller { | 32 | struct of_irq_controller { |
68 | unsigned int (*irq_build)(struct device_node *, unsigned int, void *); | 33 | unsigned int (*irq_build)(struct device_node *, unsigned int, void *); |
69 | void *data; | 34 | void *data; |
70 | }; | 35 | }; |
71 | 36 | ||
72 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | ||
73 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | ||
74 | |||
75 | extern struct device_node *of_find_node_by_cpuid(int cpuid); | 37 | extern struct device_node *of_find_node_by_cpuid(int cpuid); |
76 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 38 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); |
77 | extern struct mutex of_set_property_mutex; | 39 | extern struct mutex of_set_property_mutex; |
@@ -89,15 +51,6 @@ extern void prom_build_devicetree(void); | |||
89 | extern void of_populate_present_mask(void); | 51 | extern void of_populate_present_mask(void); |
90 | extern void of_fill_in_cpu_data(void); | 52 | extern void of_fill_in_cpu_data(void); |
91 | 53 | ||
92 | /* Dummy ref counting routines - to be implemented later */ | ||
93 | static inline struct device_node *of_node_get(struct device_node *node) | ||
94 | { | ||
95 | return node; | ||
96 | } | ||
97 | static inline void of_node_put(struct device_node *node) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | /* These routines are here to provide compatibility with how powerpc | 54 | /* These routines are here to provide compatibility with how powerpc |
102 | * handles IRQ mapping for OF device nodes. We precompute and permanently | 55 | * handles IRQ mapping for OF device nodes. We precompute and permanently |
103 | * register them in the of_device objects, whereas powerpc computes them | 56 | * register them in the of_device objects, whereas powerpc computes them |
@@ -108,12 +61,6 @@ static inline void irq_dispose_mapping(unsigned int virq) | |||
108 | { | 61 | { |
109 | } | 62 | } |
110 | 63 | ||
111 | /* | ||
112 | * NB: This is here while we transition from using asm/prom.h | ||
113 | * to linux/of.h | ||
114 | */ | ||
115 | #include <linux/of.h> | ||
116 | |||
117 | extern struct device_node *of_console_device; | 64 | extern struct device_node *of_console_device; |
118 | extern char *of_console_path; | 65 | extern char *of_console_path; |
119 | extern char *of_console_options; | 66 | extern char *of_console_options; |
diff --git a/arch/sparc/include/asm/rwsem.h b/arch/sparc/include/asm/rwsem.h index 1dc129ac2feb..6e5621006f85 100644 --- a/arch/sparc/include/asm/rwsem.h +++ b/arch/sparc/include/asm/rwsem.h | |||
@@ -35,8 +35,8 @@ struct rw_semaphore { | |||
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #define __RWSEM_INITIALIZER(name) \ | 37 | #define __RWSEM_INITIALIZER(name) \ |
38 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \ | 38 | { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ |
39 | __RWSEM_DEP_MAP_INIT(name) } | 39 | LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } |
40 | 40 | ||
41 | #define DECLARE_RWSEM(name) \ | 41 | #define DECLARE_RWSEM(name) \ |
42 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | 42 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) |
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h index 58101dc70493..841905c10215 100644 --- a/arch/sparc/include/asm/smp_32.h +++ b/arch/sparc/include/asm/smp_32.h | |||
@@ -106,6 +106,15 @@ static inline int hard_smp4d_processor_id(void) | |||
106 | return cpuid; | 106 | return cpuid; |
107 | } | 107 | } |
108 | 108 | ||
109 | extern inline int hard_smpleon_processor_id(void) | ||
110 | { | ||
111 | int cpuid; | ||
112 | __asm__ __volatile__("rd %%asr17,%0\n\t" | ||
113 | "srl %0,28,%0" : | ||
114 | "=&r" (cpuid) : ); | ||
115 | return cpuid; | ||
116 | } | ||
117 | |||
109 | #ifndef MODULE | 118 | #ifndef MODULE |
110 | static inline int hard_smp_processor_id(void) | 119 | static inline int hard_smp_processor_id(void) |
111 | { | 120 | { |
diff --git a/arch/sparc/include/asm/socket.h b/arch/sparc/include/asm/socket.h index 3a5ae3d12088..9d3fefcff2f5 100644 --- a/arch/sparc/include/asm/socket.h +++ b/arch/sparc/include/asm/socket.h | |||
@@ -56,6 +56,8 @@ | |||
56 | #define SO_TIMESTAMPING 0x0023 | 56 | #define SO_TIMESTAMPING 0x0023 |
57 | #define SCM_TIMESTAMPING SO_TIMESTAMPING | 57 | #define SCM_TIMESTAMPING SO_TIMESTAMPING |
58 | 58 | ||
59 | #define SO_RXQ_OVFL 0x0024 | ||
60 | |||
59 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | 61 | /* Security levels - as per NRL IPv6 - don't actually do anything */ |
60 | #define SO_SECURITY_AUTHENTICATION 0x5001 | 62 | #define SO_SECURITY_AUTHENTICATION 0x5001 |
61 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 | 63 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 |
diff --git a/arch/sparc/include/asm/spinlock_32.h b/arch/sparc/include/asm/spinlock_32.h index 857630cff636..7f9b9dba38a6 100644 --- a/arch/sparc/include/asm/spinlock_32.h +++ b/arch/sparc/include/asm/spinlock_32.h | |||
@@ -10,12 +10,12 @@ | |||
10 | 10 | ||
11 | #include <asm/psr.h> | 11 | #include <asm/psr.h> |
12 | 12 | ||
13 | #define __raw_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) | 13 | #define arch_spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) |
14 | 14 | ||
15 | #define __raw_spin_unlock_wait(lock) \ | 15 | #define arch_spin_unlock_wait(lock) \ |
16 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) | 16 | do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0) |
17 | 17 | ||
18 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | 18 | static inline void arch_spin_lock(arch_spinlock_t *lock) |
19 | { | 19 | { |
20 | __asm__ __volatile__( | 20 | __asm__ __volatile__( |
21 | "\n1:\n\t" | 21 | "\n1:\n\t" |
@@ -35,7 +35,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock) | |||
35 | : "g2", "memory", "cc"); | 35 | : "g2", "memory", "cc"); |
36 | } | 36 | } |
37 | 37 | ||
38 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | 38 | static inline int arch_spin_trylock(arch_spinlock_t *lock) |
39 | { | 39 | { |
40 | unsigned int result; | 40 | unsigned int result; |
41 | __asm__ __volatile__("ldstub [%1], %0" | 41 | __asm__ __volatile__("ldstub [%1], %0" |
@@ -45,7 +45,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
45 | return (result == 0); | 45 | return (result == 0); |
46 | } | 46 | } |
47 | 47 | ||
48 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 48 | static inline void arch_spin_unlock(arch_spinlock_t *lock) |
49 | { | 49 | { |
50 | __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); | 50 | __asm__ __volatile__("stb %%g0, [%0]" : : "r" (lock) : "memory"); |
51 | } | 51 | } |
@@ -65,7 +65,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
65 | * Sort of like atomic_t's on Sparc, but even more clever. | 65 | * Sort of like atomic_t's on Sparc, but even more clever. |
66 | * | 66 | * |
67 | * ------------------------------------ | 67 | * ------------------------------------ |
68 | * | 24-bit counter | wlock | raw_rwlock_t | 68 | * | 24-bit counter | wlock | arch_rwlock_t |
69 | * ------------------------------------ | 69 | * ------------------------------------ |
70 | * 31 8 7 0 | 70 | * 31 8 7 0 |
71 | * | 71 | * |
@@ -76,9 +76,9 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
76 | * | 76 | * |
77 | * Unfortunately this scheme limits us to ~16,000,000 cpus. | 77 | * Unfortunately this scheme limits us to ~16,000,000 cpus. |
78 | */ | 78 | */ |
79 | static inline void arch_read_lock(raw_rwlock_t *rw) | 79 | static inline void __arch_read_lock(arch_rwlock_t *rw) |
80 | { | 80 | { |
81 | register raw_rwlock_t *lp asm("g1"); | 81 | register arch_rwlock_t *lp asm("g1"); |
82 | lp = rw; | 82 | lp = rw; |
83 | __asm__ __volatile__( | 83 | __asm__ __volatile__( |
84 | "mov %%o7, %%g4\n\t" | 84 | "mov %%o7, %%g4\n\t" |
@@ -89,16 +89,16 @@ static inline void arch_read_lock(raw_rwlock_t *rw) | |||
89 | : "g2", "g4", "memory", "cc"); | 89 | : "g2", "g4", "memory", "cc"); |
90 | } | 90 | } |
91 | 91 | ||
92 | #define __raw_read_lock(lock) \ | 92 | #define arch_read_lock(lock) \ |
93 | do { unsigned long flags; \ | 93 | do { unsigned long flags; \ |
94 | local_irq_save(flags); \ | 94 | local_irq_save(flags); \ |
95 | arch_read_lock(lock); \ | 95 | __arch_read_lock(lock); \ |
96 | local_irq_restore(flags); \ | 96 | local_irq_restore(flags); \ |
97 | } while(0) | 97 | } while(0) |
98 | 98 | ||
99 | static inline void arch_read_unlock(raw_rwlock_t *rw) | 99 | static inline void __arch_read_unlock(arch_rwlock_t *rw) |
100 | { | 100 | { |
101 | register raw_rwlock_t *lp asm("g1"); | 101 | register arch_rwlock_t *lp asm("g1"); |
102 | lp = rw; | 102 | lp = rw; |
103 | __asm__ __volatile__( | 103 | __asm__ __volatile__( |
104 | "mov %%o7, %%g4\n\t" | 104 | "mov %%o7, %%g4\n\t" |
@@ -109,16 +109,16 @@ static inline void arch_read_unlock(raw_rwlock_t *rw) | |||
109 | : "g2", "g4", "memory", "cc"); | 109 | : "g2", "g4", "memory", "cc"); |
110 | } | 110 | } |
111 | 111 | ||
112 | #define __raw_read_unlock(lock) \ | 112 | #define arch_read_unlock(lock) \ |
113 | do { unsigned long flags; \ | 113 | do { unsigned long flags; \ |
114 | local_irq_save(flags); \ | 114 | local_irq_save(flags); \ |
115 | arch_read_unlock(lock); \ | 115 | __arch_read_unlock(lock); \ |
116 | local_irq_restore(flags); \ | 116 | local_irq_restore(flags); \ |
117 | } while(0) | 117 | } while(0) |
118 | 118 | ||
119 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 119 | static inline void arch_write_lock(arch_rwlock_t *rw) |
120 | { | 120 | { |
121 | register raw_rwlock_t *lp asm("g1"); | 121 | register arch_rwlock_t *lp asm("g1"); |
122 | lp = rw; | 122 | lp = rw; |
123 | __asm__ __volatile__( | 123 | __asm__ __volatile__( |
124 | "mov %%o7, %%g4\n\t" | 124 | "mov %%o7, %%g4\n\t" |
@@ -130,7 +130,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) | |||
130 | *(volatile __u32 *)&lp->lock = ~0U; | 130 | *(volatile __u32 *)&lp->lock = ~0U; |
131 | } | 131 | } |
132 | 132 | ||
133 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 133 | static inline int arch_write_trylock(arch_rwlock_t *rw) |
134 | { | 134 | { |
135 | unsigned int val; | 135 | unsigned int val; |
136 | 136 | ||
@@ -150,9 +150,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw) | |||
150 | return (val == 0); | 150 | return (val == 0); |
151 | } | 151 | } |
152 | 152 | ||
153 | static inline int arch_read_trylock(raw_rwlock_t *rw) | 153 | static inline int __arch_read_trylock(arch_rwlock_t *rw) |
154 | { | 154 | { |
155 | register raw_rwlock_t *lp asm("g1"); | 155 | register arch_rwlock_t *lp asm("g1"); |
156 | register int res asm("o0"); | 156 | register int res asm("o0"); |
157 | lp = rw; | 157 | lp = rw; |
158 | __asm__ __volatile__( | 158 | __asm__ __volatile__( |
@@ -165,27 +165,27 @@ static inline int arch_read_trylock(raw_rwlock_t *rw) | |||
165 | return res; | 165 | return res; |
166 | } | 166 | } |
167 | 167 | ||
168 | #define __raw_read_trylock(lock) \ | 168 | #define arch_read_trylock(lock) \ |
169 | ({ unsigned long flags; \ | 169 | ({ unsigned long flags; \ |
170 | int res; \ | 170 | int res; \ |
171 | local_irq_save(flags); \ | 171 | local_irq_save(flags); \ |
172 | res = arch_read_trylock(lock); \ | 172 | res = __arch_read_trylock(lock); \ |
173 | local_irq_restore(flags); \ | 173 | local_irq_restore(flags); \ |
174 | res; \ | 174 | res; \ |
175 | }) | 175 | }) |
176 | 176 | ||
177 | #define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) | 177 | #define arch_write_unlock(rw) do { (rw)->lock = 0; } while(0) |
178 | 178 | ||
179 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) | 179 | #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) |
180 | #define __raw_read_lock_flags(rw, flags) __raw_read_lock(rw) | 180 | #define arch_read_lock_flags(rw, flags) arch_read_lock(rw) |
181 | #define __raw_write_lock_flags(rw, flags) __raw_write_lock(rw) | 181 | #define arch_write_lock_flags(rw, flags) arch_write_lock(rw) |
182 | 182 | ||
183 | #define _raw_spin_relax(lock) cpu_relax() | 183 | #define arch_spin_relax(lock) cpu_relax() |
184 | #define _raw_read_relax(lock) cpu_relax() | 184 | #define arch_read_relax(lock) cpu_relax() |
185 | #define _raw_write_relax(lock) cpu_relax() | 185 | #define arch_write_relax(lock) cpu_relax() |
186 | 186 | ||
187 | #define __raw_read_can_lock(rw) (!((rw)->lock & 0xff)) | 187 | #define arch_read_can_lock(rw) (!((rw)->lock & 0xff)) |
188 | #define __raw_write_can_lock(rw) (!(rw)->lock) | 188 | #define arch_write_can_lock(rw) (!(rw)->lock) |
189 | 189 | ||
190 | #endif /* !(__ASSEMBLY__) */ | 190 | #endif /* !(__ASSEMBLY__) */ |
191 | 191 | ||
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h index 43e514783582..073936a8b275 100644 --- a/arch/sparc/include/asm/spinlock_64.h +++ b/arch/sparc/include/asm/spinlock_64.h | |||
@@ -21,13 +21,13 @@ | |||
21 | * the spinner sections must be pre-V9 branches. | 21 | * the spinner sections must be pre-V9 branches. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define __raw_spin_is_locked(lp) ((lp)->lock != 0) | 24 | #define arch_spin_is_locked(lp) ((lp)->lock != 0) |
25 | 25 | ||
26 | #define __raw_spin_unlock_wait(lp) \ | 26 | #define arch_spin_unlock_wait(lp) \ |
27 | do { rmb(); \ | 27 | do { rmb(); \ |
28 | } while((lp)->lock) | 28 | } while((lp)->lock) |
29 | 29 | ||
30 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | 30 | static inline void arch_spin_lock(arch_spinlock_t *lock) |
31 | { | 31 | { |
32 | unsigned long tmp; | 32 | unsigned long tmp; |
33 | 33 | ||
@@ -46,7 +46,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock) | |||
46 | : "memory"); | 46 | : "memory"); |
47 | } | 47 | } |
48 | 48 | ||
49 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | 49 | static inline int arch_spin_trylock(arch_spinlock_t *lock) |
50 | { | 50 | { |
51 | unsigned long result; | 51 | unsigned long result; |
52 | 52 | ||
@@ -59,7 +59,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
59 | return (result == 0UL); | 59 | return (result == 0UL); |
60 | } | 60 | } |
61 | 61 | ||
62 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 62 | static inline void arch_spin_unlock(arch_spinlock_t *lock) |
63 | { | 63 | { |
64 | __asm__ __volatile__( | 64 | __asm__ __volatile__( |
65 | " stb %%g0, [%0]" | 65 | " stb %%g0, [%0]" |
@@ -68,7 +68,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
68 | : "memory"); | 68 | : "memory"); |
69 | } | 69 | } |
70 | 70 | ||
71 | static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) | 71 | static inline void arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) |
72 | { | 72 | { |
73 | unsigned long tmp1, tmp2; | 73 | unsigned long tmp1, tmp2; |
74 | 74 | ||
@@ -92,7 +92,7 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long fla | |||
92 | 92 | ||
93 | /* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ | 93 | /* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ |
94 | 94 | ||
95 | static void inline arch_read_lock(raw_rwlock_t *lock) | 95 | static void inline arch_read_lock(arch_rwlock_t *lock) |
96 | { | 96 | { |
97 | unsigned long tmp1, tmp2; | 97 | unsigned long tmp1, tmp2; |
98 | 98 | ||
@@ -115,7 +115,7 @@ static void inline arch_read_lock(raw_rwlock_t *lock) | |||
115 | : "memory"); | 115 | : "memory"); |
116 | } | 116 | } |
117 | 117 | ||
118 | static int inline arch_read_trylock(raw_rwlock_t *lock) | 118 | static int inline arch_read_trylock(arch_rwlock_t *lock) |
119 | { | 119 | { |
120 | int tmp1, tmp2; | 120 | int tmp1, tmp2; |
121 | 121 | ||
@@ -136,7 +136,7 @@ static int inline arch_read_trylock(raw_rwlock_t *lock) | |||
136 | return tmp1; | 136 | return tmp1; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void inline arch_read_unlock(raw_rwlock_t *lock) | 139 | static void inline arch_read_unlock(arch_rwlock_t *lock) |
140 | { | 140 | { |
141 | unsigned long tmp1, tmp2; | 141 | unsigned long tmp1, tmp2; |
142 | 142 | ||
@@ -152,7 +152,7 @@ static void inline arch_read_unlock(raw_rwlock_t *lock) | |||
152 | : "memory"); | 152 | : "memory"); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void inline arch_write_lock(raw_rwlock_t *lock) | 155 | static void inline arch_write_lock(arch_rwlock_t *lock) |
156 | { | 156 | { |
157 | unsigned long mask, tmp1, tmp2; | 157 | unsigned long mask, tmp1, tmp2; |
158 | 158 | ||
@@ -177,7 +177,7 @@ static void inline arch_write_lock(raw_rwlock_t *lock) | |||
177 | : "memory"); | 177 | : "memory"); |
178 | } | 178 | } |
179 | 179 | ||
180 | static void inline arch_write_unlock(raw_rwlock_t *lock) | 180 | static void inline arch_write_unlock(arch_rwlock_t *lock) |
181 | { | 181 | { |
182 | __asm__ __volatile__( | 182 | __asm__ __volatile__( |
183 | " stw %%g0, [%0]" | 183 | " stw %%g0, [%0]" |
@@ -186,7 +186,7 @@ static void inline arch_write_unlock(raw_rwlock_t *lock) | |||
186 | : "memory"); | 186 | : "memory"); |
187 | } | 187 | } |
188 | 188 | ||
189 | static int inline arch_write_trylock(raw_rwlock_t *lock) | 189 | static int inline arch_write_trylock(arch_rwlock_t *lock) |
190 | { | 190 | { |
191 | unsigned long mask, tmp1, tmp2, result; | 191 | unsigned long mask, tmp1, tmp2, result; |
192 | 192 | ||
@@ -210,21 +210,21 @@ static int inline arch_write_trylock(raw_rwlock_t *lock) | |||
210 | return result; | 210 | return result; |
211 | } | 211 | } |
212 | 212 | ||
213 | #define __raw_read_lock(p) arch_read_lock(p) | 213 | #define arch_read_lock(p) arch_read_lock(p) |
214 | #define __raw_read_lock_flags(p, f) arch_read_lock(p) | 214 | #define arch_read_lock_flags(p, f) arch_read_lock(p) |
215 | #define __raw_read_trylock(p) arch_read_trylock(p) | 215 | #define arch_read_trylock(p) arch_read_trylock(p) |
216 | #define __raw_read_unlock(p) arch_read_unlock(p) | 216 | #define arch_read_unlock(p) arch_read_unlock(p) |
217 | #define __raw_write_lock(p) arch_write_lock(p) | 217 | #define arch_write_lock(p) arch_write_lock(p) |
218 | #define __raw_write_lock_flags(p, f) arch_write_lock(p) | 218 | #define arch_write_lock_flags(p, f) arch_write_lock(p) |
219 | #define __raw_write_unlock(p) arch_write_unlock(p) | 219 | #define arch_write_unlock(p) arch_write_unlock(p) |
220 | #define __raw_write_trylock(p) arch_write_trylock(p) | 220 | #define arch_write_trylock(p) arch_write_trylock(p) |
221 | 221 | ||
222 | #define __raw_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) | 222 | #define arch_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) |
223 | #define __raw_write_can_lock(rw) (!(rw)->lock) | 223 | #define arch_write_can_lock(rw) (!(rw)->lock) |
224 | 224 | ||
225 | #define _raw_spin_relax(lock) cpu_relax() | 225 | #define arch_spin_relax(lock) cpu_relax() |
226 | #define _raw_read_relax(lock) cpu_relax() | 226 | #define arch_read_relax(lock) cpu_relax() |
227 | #define _raw_write_relax(lock) cpu_relax() | 227 | #define arch_write_relax(lock) cpu_relax() |
228 | 228 | ||
229 | #endif /* !(__ASSEMBLY__) */ | 229 | #endif /* !(__ASSEMBLY__) */ |
230 | 230 | ||
diff --git a/arch/sparc/include/asm/spinlock_types.h b/arch/sparc/include/asm/spinlock_types.h index 37cbe01c585b..9c454fdeaad8 100644 --- a/arch/sparc/include/asm/spinlock_types.h +++ b/arch/sparc/include/asm/spinlock_types.h | |||
@@ -7,14 +7,14 @@ | |||
7 | 7 | ||
8 | typedef struct { | 8 | typedef struct { |
9 | volatile unsigned char lock; | 9 | volatile unsigned char lock; |
10 | } raw_spinlock_t; | 10 | } arch_spinlock_t; |
11 | 11 | ||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | 12 | #define __ARCH_SPIN_LOCK_UNLOCKED { 0 } |
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile unsigned int lock; | 15 | volatile unsigned int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | 18 | #define __ARCH_RW_LOCK_UNLOCKED { 0 } |
19 | 19 | ||
20 | #endif | 20 | #endif |
diff --git a/arch/sparc/include/asm/string_32.h b/arch/sparc/include/asm/string_32.h index 6c5fddb7e6b5..edf196ee4ef8 100644 --- a/arch/sparc/include/asm/string_32.h +++ b/arch/sparc/include/asm/string_32.h | |||
@@ -16,8 +16,6 @@ | |||
16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
17 | 17 | ||
18 | extern void __memmove(void *,const void *,__kernel_size_t); | 18 | extern void __memmove(void *,const void *,__kernel_size_t); |
19 | extern __kernel_size_t __memcpy(void *,const void *,__kernel_size_t); | ||
20 | extern __kernel_size_t __memset(void *,int,__kernel_size_t); | ||
21 | 19 | ||
22 | #ifndef EXPORT_SYMTAB_STROPS | 20 | #ifndef EXPORT_SYMTAB_STROPS |
23 | 21 | ||
@@ -32,82 +30,10 @@ extern __kernel_size_t __memset(void *,int,__kernel_size_t); | |||
32 | }) | 30 | }) |
33 | 31 | ||
34 | #define __HAVE_ARCH_MEMCPY | 32 | #define __HAVE_ARCH_MEMCPY |
35 | 33 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n) | |
36 | static inline void *__constant_memcpy(void *to, const void *from, __kernel_size_t n) | ||
37 | { | ||
38 | extern void __copy_1page(void *, const void *); | ||
39 | |||
40 | if(n <= 32) { | ||
41 | __builtin_memcpy(to, from, n); | ||
42 | } else if (((unsigned int) to & 7) != 0) { | ||
43 | /* Destination is not aligned on the double-word boundary */ | ||
44 | __memcpy(to, from, n); | ||
45 | } else { | ||
46 | switch(n) { | ||
47 | case PAGE_SIZE: | ||
48 | __copy_1page(to, from); | ||
49 | break; | ||
50 | default: | ||
51 | __memcpy(to, from, n); | ||
52 | break; | ||
53 | } | ||
54 | } | ||
55 | return to; | ||
56 | } | ||
57 | |||
58 | static inline void *__nonconstant_memcpy(void *to, const void *from, __kernel_size_t n) | ||
59 | { | ||
60 | __memcpy(to, from, n); | ||
61 | return to; | ||
62 | } | ||
63 | |||
64 | #undef memcpy | ||
65 | #define memcpy(t, f, n) \ | ||
66 | (__builtin_constant_p(n) ? \ | ||
67 | __constant_memcpy((t),(f),(n)) : \ | ||
68 | __nonconstant_memcpy((t),(f),(n))) | ||
69 | 34 | ||
70 | #define __HAVE_ARCH_MEMSET | 35 | #define __HAVE_ARCH_MEMSET |
71 | 36 | #define memset(s, c, count) __builtin_memset(s, c, count) | |
72 | static inline void *__constant_c_and_count_memset(void *s, char c, __kernel_size_t count) | ||
73 | { | ||
74 | extern void bzero_1page(void *); | ||
75 | extern __kernel_size_t __bzero(void *, __kernel_size_t); | ||
76 | |||
77 | if(!c) { | ||
78 | if(count == PAGE_SIZE) | ||
79 | bzero_1page(s); | ||
80 | else | ||
81 | __bzero(s, count); | ||
82 | } else { | ||
83 | __memset(s, c, count); | ||
84 | } | ||
85 | return s; | ||
86 | } | ||
87 | |||
88 | static inline void *__constant_c_memset(void *s, char c, __kernel_size_t count) | ||
89 | { | ||
90 | extern __kernel_size_t __bzero(void *, __kernel_size_t); | ||
91 | |||
92 | if(!c) | ||
93 | __bzero(s, count); | ||
94 | else | ||
95 | __memset(s, c, count); | ||
96 | return s; | ||
97 | } | ||
98 | |||
99 | static inline void *__nonconstant_memset(void *s, char c, __kernel_size_t count) | ||
100 | { | ||
101 | __memset(s, c, count); | ||
102 | return s; | ||
103 | } | ||
104 | |||
105 | #undef memset | ||
106 | #define memset(s, c, count) \ | ||
107 | (__builtin_constant_p(c) ? (__builtin_constant_p(count) ? \ | ||
108 | __constant_c_and_count_memset((s), (c), (count)) : \ | ||
109 | __constant_c_memset((s), (c), (count))) \ | ||
110 | : __nonconstant_memset((s), (c), (count))) | ||
111 | 37 | ||
112 | #define __HAVE_ARCH_MEMSCAN | 38 | #define __HAVE_ARCH_MEMSCAN |
113 | 39 | ||
diff --git a/arch/sparc/include/asm/string_64.h b/arch/sparc/include/asm/string_64.h index 43161f2d17eb..9623bc213158 100644 --- a/arch/sparc/include/asm/string_64.h +++ b/arch/sparc/include/asm/string_64.h | |||
@@ -15,8 +15,6 @@ | |||
15 | 15 | ||
16 | #include <asm/asi.h> | 16 | #include <asm/asi.h> |
17 | 17 | ||
18 | extern void *__memset(void *,int,__kernel_size_t); | ||
19 | |||
20 | #ifndef EXPORT_SYMTAB_STROPS | 18 | #ifndef EXPORT_SYMTAB_STROPS |
21 | 19 | ||
22 | /* First the mem*() things. */ | 20 | /* First the mem*() things. */ |
@@ -24,29 +22,10 @@ extern void *__memset(void *,int,__kernel_size_t); | |||
24 | extern void *memmove(void *, const void *, __kernel_size_t); | 22 | extern void *memmove(void *, const void *, __kernel_size_t); |
25 | 23 | ||
26 | #define __HAVE_ARCH_MEMCPY | 24 | #define __HAVE_ARCH_MEMCPY |
27 | extern void *memcpy(void *, const void *, __kernel_size_t); | 25 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n) |
28 | 26 | ||
29 | #define __HAVE_ARCH_MEMSET | 27 | #define __HAVE_ARCH_MEMSET |
30 | extern void *__builtin_memset(void *,int,__kernel_size_t); | 28 | #define memset(s, c, count) __builtin_memset(s, c, count) |
31 | |||
32 | static inline void *__constant_memset(void *s, int c, __kernel_size_t count) | ||
33 | { | ||
34 | extern __kernel_size_t __bzero(void *, __kernel_size_t); | ||
35 | |||
36 | if (!c) { | ||
37 | __bzero(s, count); | ||
38 | return s; | ||
39 | } else | ||
40 | return __memset(s, c, count); | ||
41 | } | ||
42 | |||
43 | #undef memset | ||
44 | #define memset(s, c, count) \ | ||
45 | ((__builtin_constant_p(count) && (count) <= 32) ? \ | ||
46 | __builtin_memset((s), (c), (count)) : \ | ||
47 | (__builtin_constant_p(c) ? \ | ||
48 | __constant_memset((s), (c), (count)) : \ | ||
49 | __memset((s), (c), (count)))) | ||
50 | 29 | ||
51 | #define __HAVE_ARCH_MEMSCAN | 30 | #define __HAVE_ARCH_MEMSCAN |
52 | 31 | ||
diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h index 25e848f0cad7..d47a98e66972 100644 --- a/arch/sparc/include/asm/system_64.h +++ b/arch/sparc/include/asm/system_64.h | |||
@@ -63,6 +63,10 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ | |||
63 | : : : "memory"); \ | 63 | : : : "memory"); \ |
64 | } while (0) | 64 | } while (0) |
65 | 65 | ||
66 | /* The kernel always executes in TSO memory model these days, | ||
67 | * and furthermore most sparc64 chips implement more stringent | ||
68 | * memory ordering than required by the specifications. | ||
69 | */ | ||
66 | #define mb() membar_safe("#StoreLoad") | 70 | #define mb() membar_safe("#StoreLoad") |
67 | #define rmb() __asm__ __volatile__("":::"memory") | 71 | #define rmb() __asm__ __volatile__("":::"memory") |
68 | #define wmb() __asm__ __volatile__("":::"memory") | 72 | #define wmb() __asm__ __volatile__("":::"memory") |
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h index 1b45a7bbe407..7257ebb8f394 100644 --- a/arch/sparc/include/asm/thread_info_64.h +++ b/arch/sparc/include/asm/thread_info_64.h | |||
@@ -227,6 +227,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); | |||
227 | /* flag bit 8 is available */ | 227 | /* flag bit 8 is available */ |
228 | #define TIF_SECCOMP 9 /* secure computing */ | 228 | #define TIF_SECCOMP 9 /* secure computing */ |
229 | #define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */ | 229 | #define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */ |
230 | #define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ | ||
230 | /* flag bit 11 is available */ | 231 | /* flag bit 11 is available */ |
231 | /* NOTE: Thread flags >= 12 should be ones we have no interest | 232 | /* NOTE: Thread flags >= 12 should be ones we have no interest |
232 | * in using in assembly, else we can't use the mask as | 233 | * in using in assembly, else we can't use the mask as |
@@ -246,6 +247,7 @@ register struct thread_info *current_thread_info_reg asm("g6"); | |||
246 | #define _TIF_32BIT (1<<TIF_32BIT) | 247 | #define _TIF_32BIT (1<<TIF_32BIT) |
247 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 248 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
248 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 249 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
250 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) | ||
249 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) | 251 | #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) |
250 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 252 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
251 | #define _TIF_FREEZE (1<<TIF_FREEZE) | 253 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h index 8303ac481034..489d2ba92bcb 100644 --- a/arch/sparc/include/asm/uaccess_32.h +++ b/arch/sparc/include/asm/uaccess_32.h | |||
@@ -260,8 +260,23 @@ static inline unsigned long __copy_to_user(void __user *to, const void *from, un | |||
260 | return __copy_user(to, (__force void __user *) from, n); | 260 | return __copy_user(to, (__force void __user *) from, n); |
261 | } | 261 | } |
262 | 262 | ||
263 | extern void copy_from_user_overflow(void) | ||
264 | #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS | ||
265 | __compiletime_error("copy_from_user() buffer size is not provably correct") | ||
266 | #else | ||
267 | __compiletime_warning("copy_from_user() buffer size is not provably correct") | ||
268 | #endif | ||
269 | ; | ||
270 | |||
263 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) | 271 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) |
264 | { | 272 | { |
273 | int sz = __compiletime_object_size(to); | ||
274 | |||
275 | if (unlikely(sz != -1 && sz < n)) { | ||
276 | copy_from_user_overflow(); | ||
277 | return -EFAULT; | ||
278 | } | ||
279 | |||
265 | if (n && __access_ok((unsigned long) from, n)) | 280 | if (n && __access_ok((unsigned long) from, n)) |
266 | return __copy_user((__force void __user *) to, from, n); | 281 | return __copy_user((__force void __user *) to, from, n); |
267 | else | 282 | else |
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index 9ea271e19c70..dbc141660994 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifdef __KERNEL__ | 8 | #ifdef __KERNEL__ |
9 | #include <linux/errno.h> | ||
9 | #include <linux/compiler.h> | 10 | #include <linux/compiler.h> |
10 | #include <linux/string.h> | 11 | #include <linux/string.h> |
11 | #include <linux/thread_info.h> | 12 | #include <linux/thread_info.h> |
@@ -204,6 +205,14 @@ __asm__ __volatile__( \ | |||
204 | 205 | ||
205 | extern int __get_user_bad(void); | 206 | extern int __get_user_bad(void); |
206 | 207 | ||
208 | extern void copy_from_user_overflow(void) | ||
209 | #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS | ||
210 | __compiletime_error("copy_from_user() buffer size is not provably correct") | ||
211 | #else | ||
212 | __compiletime_warning("copy_from_user() buffer size is not provably correct") | ||
213 | #endif | ||
214 | ; | ||
215 | |||
207 | extern unsigned long __must_check ___copy_from_user(void *to, | 216 | extern unsigned long __must_check ___copy_from_user(void *to, |
208 | const void __user *from, | 217 | const void __user *from, |
209 | unsigned long size); | 218 | unsigned long size); |
@@ -212,10 +221,16 @@ extern unsigned long copy_from_user_fixup(void *to, const void __user *from, | |||
212 | static inline unsigned long __must_check | 221 | static inline unsigned long __must_check |
213 | copy_from_user(void *to, const void __user *from, unsigned long size) | 222 | copy_from_user(void *to, const void __user *from, unsigned long size) |
214 | { | 223 | { |
215 | unsigned long ret = ___copy_from_user(to, from, size); | 224 | unsigned long ret = (unsigned long) -EFAULT; |
216 | 225 | int sz = __compiletime_object_size(to); | |
217 | if (unlikely(ret)) | 226 | |
218 | ret = copy_from_user_fixup(to, from, size); | 227 | if (likely(sz == -1 || sz >= size)) { |
228 | ret = ___copy_from_user(to, from, size); | ||
229 | if (unlikely(ret)) | ||
230 | ret = copy_from_user_fixup(to, from, size); | ||
231 | } else { | ||
232 | copy_from_user_overflow(); | ||
233 | } | ||
219 | return ret; | 234 | return ret; |
220 | } | 235 | } |
221 | #define __copy_from_user copy_from_user | 236 | #define __copy_from_user copy_from_user |
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h index 42f2316c3eaa..cb4b9bfd0d87 100644 --- a/arch/sparc/include/asm/unistd.h +++ b/arch/sparc/include/asm/unistd.h | |||
@@ -396,8 +396,9 @@ | |||
396 | #define __NR_pwritev 325 | 396 | #define __NR_pwritev 325 |
397 | #define __NR_rt_tgsigqueueinfo 326 | 397 | #define __NR_rt_tgsigqueueinfo 326 |
398 | #define __NR_perf_event_open 327 | 398 | #define __NR_perf_event_open 327 |
399 | #define __NR_recvmmsg 328 | ||
399 | 400 | ||
400 | #define NR_SYSCALLS 328 | 401 | #define NR_syscalls 329 |
401 | 402 | ||
402 | #ifdef __32bit_syscall_numbers__ | 403 | #ifdef __32bit_syscall_numbers__ |
403 | /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, | 404 | /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, |
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 5b47fab9966e..c6316142db4e 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile | |||
@@ -72,7 +72,7 @@ obj-y += dma.o | |||
72 | obj-$(CONFIG_SPARC32_PCI) += pcic.o | 72 | obj-$(CONFIG_SPARC32_PCI) += pcic.o |
73 | 73 | ||
74 | obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o | 74 | obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o |
75 | obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o | 75 | obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o leon_smp.o |
76 | obj-$(CONFIG_SPARC64_SMP) += hvtramp.o | 76 | obj-$(CONFIG_SPARC64_SMP) += hvtramp.o |
77 | 77 | ||
78 | obj-y += auxio_$(BITS).o | 78 | obj-y += auxio_$(BITS).o |
@@ -87,6 +87,7 @@ obj-$(CONFIG_KGDB) += kgdb_$(BITS).o | |||
87 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o | 87 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o |
88 | CFLAGS_REMOVE_ftrace.o := -pg | 88 | CFLAGS_REMOVE_ftrace.o := -pg |
89 | 89 | ||
90 | obj-$(CONFIG_EARLYFB) += btext.o | ||
90 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 91 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
91 | # sparc64 PCI | 92 | # sparc64 PCI |
92 | obj-$(CONFIG_SPARC64_PCI) += pci.o pci_common.o psycho_common.o | 93 | obj-$(CONFIG_SPARC64_PCI) += pci.o pci_common.o psycho_common.o |
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c index 9c115823c4b5..71ec90b9e316 100644 --- a/arch/sparc/kernel/apc.c +++ b/arch/sparc/kernel/apc.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/miscdevice.h> | 12 | #include <linux/miscdevice.h> |
13 | #include <linux/smp_lock.h> | ||
14 | #include <linux/pm.h> | 13 | #include <linux/pm.h> |
15 | #include <linux/of.h> | 14 | #include <linux/of.h> |
16 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
@@ -76,7 +75,6 @@ static inline void apc_free(struct of_device *op) | |||
76 | 75 | ||
77 | static int apc_open(struct inode *inode, struct file *f) | 76 | static int apc_open(struct inode *inode, struct file *f) |
78 | { | 77 | { |
79 | cycle_kernel_lock(); | ||
80 | return 0; | 78 | return 0; |
81 | } | 79 | } |
82 | 80 | ||
@@ -87,61 +85,46 @@ static int apc_release(struct inode *inode, struct file *f) | |||
87 | 85 | ||
88 | static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg) | 86 | static long apc_ioctl(struct file *f, unsigned int cmd, unsigned long __arg) |
89 | { | 87 | { |
90 | __u8 inarg, __user *arg; | 88 | __u8 inarg, __user *arg = (__u8 __user *) __arg; |
91 | |||
92 | arg = (__u8 __user *) __arg; | ||
93 | |||
94 | lock_kernel(); | ||
95 | 89 | ||
96 | switch (cmd) { | 90 | switch (cmd) { |
97 | case APCIOCGFANCTL: | 91 | case APCIOCGFANCTL: |
98 | if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) { | 92 | if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg)) |
99 | unlock_kernel(); | ||
100 | return -EFAULT; | 93 | return -EFAULT; |
101 | } | ||
102 | break; | 94 | break; |
103 | 95 | ||
104 | case APCIOCGCPWR: | 96 | case APCIOCGCPWR: |
105 | if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) { | 97 | if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg)) |
106 | unlock_kernel(); | ||
107 | return -EFAULT; | 98 | return -EFAULT; |
108 | } | ||
109 | break; | 99 | break; |
110 | 100 | ||
111 | case APCIOCGBPORT: | 101 | case APCIOCGBPORT: |
112 | if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) { | 102 | if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg)) |
113 | unlock_kernel(); | ||
114 | return -EFAULT; | 103 | return -EFAULT; |
115 | } | ||
116 | break; | 104 | break; |
117 | 105 | ||
118 | case APCIOCSFANCTL: | 106 | case APCIOCSFANCTL: |
119 | if (get_user(inarg, arg)) { | 107 | if (get_user(inarg, arg)) |
120 | unlock_kernel(); | ||
121 | return -EFAULT; | 108 | return -EFAULT; |
122 | } | ||
123 | apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); | 109 | apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG); |
124 | break; | 110 | break; |
111 | |||
125 | case APCIOCSCPWR: | 112 | case APCIOCSCPWR: |
126 | if (get_user(inarg, arg)) { | 113 | if (get_user(inarg, arg)) |
127 | unlock_kernel(); | ||
128 | return -EFAULT; | 114 | return -EFAULT; |
129 | } | ||
130 | apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); | 115 | apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG); |
131 | break; | 116 | break; |
117 | |||
132 | case APCIOCSBPORT: | 118 | case APCIOCSBPORT: |
133 | if (get_user(inarg, arg)) { | 119 | if (get_user(inarg, arg)) |
134 | unlock_kernel(); | ||
135 | return -EFAULT; | 120 | return -EFAULT; |
136 | } | ||
137 | apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); | 121 | apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG); |
138 | break; | 122 | break; |
123 | |||
139 | default: | 124 | default: |
140 | unlock_kernel(); | ||
141 | return -EINVAL; | 125 | return -EINVAL; |
142 | }; | 126 | }; |
143 | 127 | ||
144 | unlock_kernel(); | ||
145 | return 0; | 128 | return 0; |
146 | } | 129 | } |
147 | 130 | ||
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c index 45c41232fc4c..ee8d214cae1e 100644 --- a/arch/sparc/kernel/auxio_32.c +++ b/arch/sparc/kernel/auxio_32.c | |||
@@ -28,6 +28,7 @@ void __init auxio_probe(void) | |||
28 | struct resource r; | 28 | struct resource r; |
29 | 29 | ||
30 | switch (sparc_cpu_model) { | 30 | switch (sparc_cpu_model) { |
31 | case sparc_leon: | ||
31 | case sun4d: | 32 | case sun4d: |
32 | case sun4: | 33 | case sun4: |
33 | return; | 34 | return; |
diff --git a/arch/sparc/kernel/btext.c b/arch/sparc/kernel/btext.c new file mode 100644 index 000000000000..8cc2d56ffe9a --- /dev/null +++ b/arch/sparc/kernel/btext.c | |||
@@ -0,0 +1,673 @@ | |||
1 | /* | ||
2 | * Procedures for drawing on the screen early on in the boot process. | ||
3 | * | ||
4 | * Benjamin Herrenschmidt <benh@kernel.crashing.org> | ||
5 | */ | ||
6 | #include <linux/kernel.h> | ||
7 | #include <linux/string.h> | ||
8 | #include <linux/init.h> | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/console.h> | ||
11 | |||
12 | #include <asm/btext.h> | ||
13 | #include <asm/oplib.h> | ||
14 | #include <asm/io.h> | ||
15 | |||
16 | #define NO_SCROLL | ||
17 | |||
18 | #ifndef NO_SCROLL | ||
19 | static void scrollscreen(void); | ||
20 | #endif | ||
21 | |||
22 | static void draw_byte(unsigned char c, long locX, long locY); | ||
23 | static void draw_byte_32(unsigned char *bits, unsigned int *base, int rb); | ||
24 | static void draw_byte_16(unsigned char *bits, unsigned int *base, int rb); | ||
25 | static void draw_byte_8(unsigned char *bits, unsigned int *base, int rb); | ||
26 | |||
27 | #define __force_data __attribute__((__section__(".data"))) | ||
28 | |||
29 | static int g_loc_X __force_data; | ||
30 | static int g_loc_Y __force_data; | ||
31 | static int g_max_loc_X __force_data; | ||
32 | static int g_max_loc_Y __force_data; | ||
33 | |||
34 | static int dispDeviceRowBytes __force_data; | ||
35 | static int dispDeviceDepth __force_data; | ||
36 | static int dispDeviceRect[4] __force_data; | ||
37 | static unsigned char *dispDeviceBase __force_data; | ||
38 | |||
39 | #define cmapsz (16*256) | ||
40 | |||
41 | static unsigned char vga_font[cmapsz]; | ||
42 | |||
43 | static int __init btext_initialize(unsigned int node) | ||
44 | { | ||
45 | unsigned int width, height, depth, pitch; | ||
46 | unsigned long address = 0; | ||
47 | u32 prop; | ||
48 | |||
49 | if (prom_getproperty(node, "width", (char *)&width, 4) < 0) | ||
50 | return -EINVAL; | ||
51 | if (prom_getproperty(node, "height", (char *)&height, 4) < 0) | ||
52 | return -EINVAL; | ||
53 | if (prom_getproperty(node, "depth", (char *)&depth, 4) < 0) | ||
54 | return -EINVAL; | ||
55 | pitch = width * ((depth + 7) / 8); | ||
56 | |||
57 | if (prom_getproperty(node, "linebytes", (char *)&prop, 4) >= 0 && | ||
58 | prop != 0xffffffffu) | ||
59 | pitch = prop; | ||
60 | |||
61 | if (pitch == 1) | ||
62 | pitch = 0x1000; | ||
63 | |||
64 | if (prom_getproperty(node, "address", (char *)&prop, 4) >= 0) | ||
65 | address = prop; | ||
66 | |||
67 | /* FIXME: Add support for PCI reg properties. Right now, only | ||
68 | * reliable on macs | ||
69 | */ | ||
70 | if (address == 0) | ||
71 | return -EINVAL; | ||
72 | |||
73 | g_loc_X = 0; | ||
74 | g_loc_Y = 0; | ||
75 | g_max_loc_X = width / 8; | ||
76 | g_max_loc_Y = height / 16; | ||
77 | dispDeviceBase = (unsigned char *)address; | ||
78 | dispDeviceRowBytes = pitch; | ||
79 | dispDeviceDepth = depth == 15 ? 16 : depth; | ||
80 | dispDeviceRect[0] = dispDeviceRect[1] = 0; | ||
81 | dispDeviceRect[2] = width; | ||
82 | dispDeviceRect[3] = height; | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | /* Calc the base address of a given point (x,y) */ | ||
88 | static unsigned char * calc_base(int x, int y) | ||
89 | { | ||
90 | unsigned char *base = dispDeviceBase; | ||
91 | |||
92 | base += (x + dispDeviceRect[0]) * (dispDeviceDepth >> 3); | ||
93 | base += (y + dispDeviceRect[1]) * dispDeviceRowBytes; | ||
94 | return base; | ||
95 | } | ||
96 | |||
97 | static void btext_clearscreen(void) | ||
98 | { | ||
99 | unsigned int *base = (unsigned int *)calc_base(0, 0); | ||
100 | unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) * | ||
101 | (dispDeviceDepth >> 3)) >> 2; | ||
102 | int i,j; | ||
103 | |||
104 | for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1]); i++) | ||
105 | { | ||
106 | unsigned int *ptr = base; | ||
107 | for(j=width; j; --j) | ||
108 | *(ptr++) = 0; | ||
109 | base += (dispDeviceRowBytes >> 2); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | #ifndef NO_SCROLL | ||
114 | static void scrollscreen(void) | ||
115 | { | ||
116 | unsigned int *src = (unsigned int *)calc_base(0,16); | ||
117 | unsigned int *dst = (unsigned int *)calc_base(0,0); | ||
118 | unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) * | ||
119 | (dispDeviceDepth >> 3)) >> 2; | ||
120 | int i,j; | ||
121 | |||
122 | for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1] - 16); i++) | ||
123 | { | ||
124 | unsigned int *src_ptr = src; | ||
125 | unsigned int *dst_ptr = dst; | ||
126 | for(j=width; j; --j) | ||
127 | *(dst_ptr++) = *(src_ptr++); | ||
128 | src += (dispDeviceRowBytes >> 2); | ||
129 | dst += (dispDeviceRowBytes >> 2); | ||
130 | } | ||
131 | for (i=0; i<16; i++) | ||
132 | { | ||
133 | unsigned int *dst_ptr = dst; | ||
134 | for(j=width; j; --j) | ||
135 | *(dst_ptr++) = 0; | ||
136 | dst += (dispDeviceRowBytes >> 2); | ||
137 | } | ||
138 | } | ||
139 | #endif /* ndef NO_SCROLL */ | ||
140 | |||
141 | void btext_drawchar(char c) | ||
142 | { | ||
143 | int cline = 0; | ||
144 | #ifdef NO_SCROLL | ||
145 | int x; | ||
146 | #endif | ||
147 | switch (c) { | ||
148 | case '\b': | ||
149 | if (g_loc_X > 0) | ||
150 | --g_loc_X; | ||
151 | break; | ||
152 | case '\t': | ||
153 | g_loc_X = (g_loc_X & -8) + 8; | ||
154 | break; | ||
155 | case '\r': | ||
156 | g_loc_X = 0; | ||
157 | break; | ||
158 | case '\n': | ||
159 | g_loc_X = 0; | ||
160 | g_loc_Y++; | ||
161 | cline = 1; | ||
162 | break; | ||
163 | default: | ||
164 | draw_byte(c, g_loc_X++, g_loc_Y); | ||
165 | } | ||
166 | if (g_loc_X >= g_max_loc_X) { | ||
167 | g_loc_X = 0; | ||
168 | g_loc_Y++; | ||
169 | cline = 1; | ||
170 | } | ||
171 | #ifndef NO_SCROLL | ||
172 | while (g_loc_Y >= g_max_loc_Y) { | ||
173 | scrollscreen(); | ||
174 | g_loc_Y--; | ||
175 | } | ||
176 | #else | ||
177 | /* wrap around from bottom to top of screen so we don't | ||
178 | waste time scrolling each line. -- paulus. */ | ||
179 | if (g_loc_Y >= g_max_loc_Y) | ||
180 | g_loc_Y = 0; | ||
181 | if (cline) { | ||
182 | for (x = 0; x < g_max_loc_X; ++x) | ||
183 | draw_byte(' ', x, g_loc_Y); | ||
184 | } | ||
185 | #endif | ||
186 | } | ||
187 | |||
188 | static void btext_drawtext(const char *c, unsigned int len) | ||
189 | { | ||
190 | while (len--) | ||
191 | btext_drawchar(*c++); | ||
192 | } | ||
193 | |||
194 | static void draw_byte(unsigned char c, long locX, long locY) | ||
195 | { | ||
196 | unsigned char *base = calc_base(locX << 3, locY << 4); | ||
197 | unsigned char *font = &vga_font[((unsigned int)c) * 16]; | ||
198 | int rb = dispDeviceRowBytes; | ||
199 | |||
200 | switch(dispDeviceDepth) { | ||
201 | case 24: | ||
202 | case 32: | ||
203 | draw_byte_32(font, (unsigned int *)base, rb); | ||
204 | break; | ||
205 | case 15: | ||
206 | case 16: | ||
207 | draw_byte_16(font, (unsigned int *)base, rb); | ||
208 | break; | ||
209 | case 8: | ||
210 | draw_byte_8(font, (unsigned int *)base, rb); | ||
211 | break; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | static unsigned int expand_bits_8[16] = { | ||
216 | 0x00000000, | ||
217 | 0x000000ff, | ||
218 | 0x0000ff00, | ||
219 | 0x0000ffff, | ||
220 | 0x00ff0000, | ||
221 | 0x00ff00ff, | ||
222 | 0x00ffff00, | ||
223 | 0x00ffffff, | ||
224 | 0xff000000, | ||
225 | 0xff0000ff, | ||
226 | 0xff00ff00, | ||
227 | 0xff00ffff, | ||
228 | 0xffff0000, | ||
229 | 0xffff00ff, | ||
230 | 0xffffff00, | ||
231 | 0xffffffff | ||
232 | }; | ||
233 | |||
234 | static unsigned int expand_bits_16[4] = { | ||
235 | 0x00000000, | ||
236 | 0x0000ffff, | ||
237 | 0xffff0000, | ||
238 | 0xffffffff | ||
239 | }; | ||
240 | |||
241 | |||
242 | static void draw_byte_32(unsigned char *font, unsigned int *base, int rb) | ||
243 | { | ||
244 | int l, bits; | ||
245 | int fg = 0xFFFFFFFFUL; | ||
246 | int bg = 0x00000000UL; | ||
247 | |||
248 | for (l = 0; l < 16; ++l) | ||
249 | { | ||
250 | bits = *font++; | ||
251 | base[0] = (-(bits >> 7) & fg) ^ bg; | ||
252 | base[1] = (-((bits >> 6) & 1) & fg) ^ bg; | ||
253 | base[2] = (-((bits >> 5) & 1) & fg) ^ bg; | ||
254 | base[3] = (-((bits >> 4) & 1) & fg) ^ bg; | ||
255 | base[4] = (-((bits >> 3) & 1) & fg) ^ bg; | ||
256 | base[5] = (-((bits >> 2) & 1) & fg) ^ bg; | ||
257 | base[6] = (-((bits >> 1) & 1) & fg) ^ bg; | ||
258 | base[7] = (-(bits & 1) & fg) ^ bg; | ||
259 | base = (unsigned int *) ((char *)base + rb); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | static void draw_byte_16(unsigned char *font, unsigned int *base, int rb) | ||
264 | { | ||
265 | int l, bits; | ||
266 | int fg = 0xFFFFFFFFUL; | ||
267 | int bg = 0x00000000UL; | ||
268 | unsigned int *eb = (int *)expand_bits_16; | ||
269 | |||
270 | for (l = 0; l < 16; ++l) | ||
271 | { | ||
272 | bits = *font++; | ||
273 | base[0] = (eb[bits >> 6] & fg) ^ bg; | ||
274 | base[1] = (eb[(bits >> 4) & 3] & fg) ^ bg; | ||
275 | base[2] = (eb[(bits >> 2) & 3] & fg) ^ bg; | ||
276 | base[3] = (eb[bits & 3] & fg) ^ bg; | ||
277 | base = (unsigned int *) ((char *)base + rb); | ||
278 | } | ||
279 | } | ||
280 | |||
281 | static void draw_byte_8(unsigned char *font, unsigned int *base, int rb) | ||
282 | { | ||
283 | int l, bits; | ||
284 | int fg = 0x0F0F0F0FUL; | ||
285 | int bg = 0x00000000UL; | ||
286 | unsigned int *eb = (int *)expand_bits_8; | ||
287 | |||
288 | for (l = 0; l < 16; ++l) | ||
289 | { | ||
290 | bits = *font++; | ||
291 | base[0] = (eb[bits >> 4] & fg) ^ bg; | ||
292 | base[1] = (eb[bits & 0xf] & fg) ^ bg; | ||
293 | base = (unsigned int *) ((char *)base + rb); | ||
294 | } | ||
295 | } | ||
296 | |||
297 | static void btext_console_write(struct console *con, const char *s, | ||
298 | unsigned int n) | ||
299 | { | ||
300 | btext_drawtext(s, n); | ||
301 | } | ||
302 | |||
303 | static struct console btext_console = { | ||
304 | .name = "btext", | ||
305 | .write = btext_console_write, | ||
306 | .flags = CON_PRINTBUFFER | CON_ENABLED | CON_BOOT | CON_ANYTIME, | ||
307 | .index = 0, | ||
308 | }; | ||
309 | |||
310 | int __init btext_find_display(void) | ||
311 | { | ||
312 | unsigned int node; | ||
313 | char type[32]; | ||
314 | int ret; | ||
315 | |||
316 | node = prom_inst2pkg(prom_stdout); | ||
317 | if (prom_getproperty(node, "device_type", type, 32) < 0) | ||
318 | return -ENODEV; | ||
319 | if (strcmp(type, "display")) | ||
320 | return -ENODEV; | ||
321 | |||
322 | ret = btext_initialize(node); | ||
323 | if (!ret) { | ||
324 | btext_clearscreen(); | ||
325 | register_console(&btext_console); | ||
326 | } | ||
327 | return ret; | ||
328 | } | ||
329 | |||
330 | static unsigned char vga_font[cmapsz] = { | ||
331 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
332 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, | ||
333 | 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, | ||
334 | 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, | ||
335 | 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, | ||
336 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, | ||
337 | 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, | ||
338 | 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, | ||
339 | 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, | ||
340 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, | ||
341 | 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, | ||
342 | 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
343 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, | ||
344 | 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, | ||
345 | 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x1e, 0x0e, | ||
346 | 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, | ||
347 | 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, | ||
348 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, | ||
349 | 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x63, | ||
350 | 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00, | ||
351 | 0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, | ||
352 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, | ||
353 | 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0e, | ||
354 | 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, | ||
355 | 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, | ||
356 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, | ||
357 | 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xdb, | ||
358 | 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, | ||
359 | 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, | ||
360 | 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
361 | 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, | ||
362 | 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, | ||
363 | 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
364 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
365 | 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
366 | 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
367 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, | ||
368 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, | ||
369 | 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
370 | 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
371 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, | ||
372 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, | ||
373 | 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
374 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
375 | 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, | ||
376 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, | ||
377 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, | ||
378 | 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, | ||
379 | 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, | ||
380 | 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, | ||
381 | 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, | ||
382 | 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, | ||
383 | 0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
384 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, | ||
385 | 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, | ||
386 | 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, | ||
387 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, | ||
388 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, | ||
389 | 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
390 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, | ||
391 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, | ||
392 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
393 | 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
394 | 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, | ||
395 | 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0xc6, 0x7c, | ||
396 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, | ||
397 | 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, | ||
398 | 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, | ||
399 | 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, | ||
400 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, | ||
401 | 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, | ||
402 | 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, | ||
403 | 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, | ||
404 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, | ||
405 | 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, | ||
406 | 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, | ||
407 | 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, | ||
408 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, | ||
409 | 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
410 | 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, | ||
411 | 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, | ||
412 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, | ||
413 | 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, | ||
414 | 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, | ||
415 | 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, | ||
416 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xde, | ||
417 | 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, | ||
418 | 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, | ||
419 | 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, | ||
420 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, | ||
421 | 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x6c, | ||
422 | 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00, | ||
423 | 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, | ||
424 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, | ||
425 | 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, | ||
426 | 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00, | ||
427 | 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, | ||
428 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
429 | 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, | ||
430 | 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, | ||
431 | 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, | ||
432 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, | ||
433 | 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xe7, | ||
434 | 0xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, | ||
435 | 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, | ||
436 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, | ||
437 | 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, | ||
438 | 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, | ||
439 | 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, | ||
440 | 0x0c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, | ||
441 | 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, | ||
442 | 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, | ||
443 | 0x00, 0x00, 0xff, 0xdb, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, | ||
444 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, | ||
445 | 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, | ||
446 | 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, | ||
447 | 0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x66, | ||
448 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18, | ||
449 | 0x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, | ||
450 | 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, | ||
451 | 0x00, 0x00, 0xff, 0xc3, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc1, 0xc3, 0xff, | ||
452 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, | ||
453 | 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, | ||
454 | 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, | ||
455 | 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, | ||
456 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, | ||
457 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
458 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, | ||
459 | 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
460 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, | ||
461 | 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x60, | ||
462 | 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, | ||
463 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, | ||
464 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, | ||
465 | 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
466 | 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, | ||
467 | 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, | ||
468 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, | ||
469 | 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, 0xe0, 0x60, | ||
470 | 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, | ||
471 | 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, | ||
472 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, | ||
473 | 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0xe0, 0x60, | ||
474 | 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, | ||
475 | 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, | ||
476 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xff, 0xdb, | ||
477 | 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
478 | 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, | ||
479 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, | ||
480 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, | ||
481 | 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
482 | 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00, | ||
483 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, | ||
484 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, | ||
485 | 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, | ||
486 | 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, | ||
487 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, | ||
488 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3, | ||
489 | 0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
490 | 0x00, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x00, 0x00, 0x00, 0x00, | ||
491 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, | ||
492 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, | ||
493 | 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
494 | 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, | ||
495 | 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, | ||
496 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, | ||
497 | 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, | ||
498 | 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, | ||
499 | 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
500 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, | ||
501 | 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, | ||
502 | 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00, | ||
503 | 0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, | ||
504 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, | ||
505 | 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, | ||
506 | 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, | ||
507 | 0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, | ||
508 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, | ||
509 | 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38, | ||
510 | 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, | ||
511 | 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, | ||
512 | 0x3c, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, | ||
513 | 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, | ||
514 | 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, | ||
515 | 0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, | ||
516 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, | ||
517 | 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, | ||
518 | 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, | ||
519 | 0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, | ||
520 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, | ||
521 | 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x38, 0x00, | ||
522 | 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, | ||
523 | 0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, | ||
524 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x1b, | ||
525 | 0x7e, 0xd8, 0xdc, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x6c, | ||
526 | 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00, | ||
527 | 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, | ||
528 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, | ||
529 | 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, | ||
530 | 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, | ||
531 | 0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, | ||
532 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, | ||
533 | 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, | ||
534 | 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00, | ||
535 | 0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, | ||
536 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, | ||
537 | 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, | ||
538 | 0xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, | ||
539 | 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, | ||
540 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0xff, 0x18, | ||
541 | 0xff, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, | ||
542 | 0x7c, 0x62, 0x66, 0x6f, 0x66, 0x66, 0x66, 0xf3, 0x00, 0x00, 0x00, 0x00, | ||
543 | 0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
544 | 0xd8, 0x70, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, | ||
545 | 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, | ||
546 | 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, | ||
547 | 0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, | ||
548 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, | ||
549 | 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, | ||
550 | 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, | ||
551 | 0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, | ||
552 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, | ||
553 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c, | ||
554 | 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
555 | 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, | ||
556 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, | ||
557 | 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
558 | 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
559 | 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xce, 0x9b, 0x06, | ||
560 | 0x0c, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, | ||
561 | 0x66, 0xce, 0x96, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, | ||
562 | 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, | ||
563 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, | ||
564 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, | ||
565 | 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x44, 0x11, 0x44, | ||
566 | 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, | ||
567 | 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, | ||
568 | 0x55, 0xaa, 0x55, 0xaa, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, | ||
569 | 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0x18, 0x18, 0x18, 0x18, | ||
570 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
571 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, | ||
572 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, | ||
573 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, | ||
574 | 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, | ||
575 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, | ||
576 | 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, | ||
577 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, | ||
578 | 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, | ||
579 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, | ||
580 | 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, | ||
581 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, | ||
582 | 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
583 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, | ||
584 | 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, | ||
585 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
586 | 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
587 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, | ||
588 | 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, | ||
589 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
590 | 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
591 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, | ||
592 | 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
593 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, | ||
594 | 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
595 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, | ||
596 | 0x18, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, | ||
597 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, | ||
598 | 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
599 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, | ||
600 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, | ||
601 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
602 | 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, | ||
603 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, | ||
604 | 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, | ||
605 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, | ||
606 | 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, | ||
607 | 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, | ||
608 | 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, | ||
609 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
610 | 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
611 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, | ||
612 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, | ||
613 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, | ||
614 | 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
615 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, | ||
616 | 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, | ||
617 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, | ||
618 | 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, | ||
619 | 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, | ||
620 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, | ||
621 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
622 | 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
623 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
624 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
625 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, | ||
626 | 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, | ||
627 | 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, | ||
628 | 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, | ||
629 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
630 | 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, | ||
631 | 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, | ||
632 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, | ||
633 | 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
634 | 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, | ||
635 | 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, | ||
636 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, | ||
637 | 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
638 | 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, | ||
639 | 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
640 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, | ||
641 | 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, | ||
642 | 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, | ||
643 | 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, | ||
644 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, | ||
645 | 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
646 | 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
647 | 0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, | ||
648 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, | ||
649 | 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, | ||
650 | 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, | ||
651 | 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, | ||
652 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, | ||
653 | 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, | ||
654 | 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, | ||
655 | 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, | ||
656 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x1b, 0x18, 0x18, | ||
657 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, | ||
658 | 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, | ||
659 | 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, | ||
660 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, | ||
661 | 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c, 0x6c, | ||
662 | 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
663 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, | ||
664 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
665 | 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0c, 0x0c, | ||
666 | 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, | ||
667 | 0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
668 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, | ||
669 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
670 | 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
671 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
672 | 0x00, 0x00, 0x00, 0x00, | ||
673 | }; | ||
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c index 1446df90ef85..e447938d39cf 100644 --- a/arch/sparc/kernel/cpu.c +++ b/arch/sparc/kernel/cpu.c | |||
@@ -185,6 +185,17 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { | |||
185 | FPU(-1, NULL) | 185 | FPU(-1, NULL) |
186 | } | 186 | } |
187 | },{ | 187 | },{ |
188 | 0xF, /* Aeroflex Gaisler */ | ||
189 | .cpu_info = { | ||
190 | CPU(3, "LEON"), | ||
191 | CPU(-1, NULL) | ||
192 | }, | ||
193 | .fpu_info = { | ||
194 | FPU(2, "GRFPU"), | ||
195 | FPU(3, "GRFPU-Lite"), | ||
196 | FPU(-1, NULL) | ||
197 | } | ||
198 | },{ | ||
188 | 0x17, | 199 | 0x17, |
189 | .cpu_info = { | 200 | .cpu_info = { |
190 | CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"), | 201 | CPU_PMU(0x10, "TI UltraSparc I (SpitFire)", "ultra12"), |
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S index f41ecc5ac0b4..1504df8ddf70 100644 --- a/arch/sparc/kernel/entry.S +++ b/arch/sparc/kernel/entry.S | |||
@@ -400,6 +400,39 @@ linux_trap_ipi15_sun4d: | |||
400 | /* FIXME */ | 400 | /* FIXME */ |
401 | 1: b,a 1b | 401 | 1: b,a 1b |
402 | 402 | ||
403 | #ifdef CONFIG_SPARC_LEON | ||
404 | |||
405 | .globl smpleon_ticker | ||
406 | /* SMP per-cpu ticker interrupts are handled specially. */ | ||
407 | smpleon_ticker: | ||
408 | SAVE_ALL | ||
409 | or %l0, PSR_PIL, %g2 | ||
410 | wr %g2, 0x0, %psr | ||
411 | WRITE_PAUSE | ||
412 | wr %g2, PSR_ET, %psr | ||
413 | WRITE_PAUSE | ||
414 | call leon_percpu_timer_interrupt | ||
415 | add %sp, STACKFRAME_SZ, %o0 | ||
416 | wr %l0, PSR_ET, %psr | ||
417 | WRITE_PAUSE | ||
418 | RESTORE_ALL | ||
419 | |||
420 | .align 4 | ||
421 | .globl linux_trap_ipi15_leon | ||
422 | linux_trap_ipi15_leon: | ||
423 | SAVE_ALL | ||
424 | or %l0, PSR_PIL, %l4 | ||
425 | wr %l4, 0x0, %psr | ||
426 | WRITE_PAUSE | ||
427 | wr %l4, PSR_ET, %psr | ||
428 | WRITE_PAUSE | ||
429 | call leon_cross_call_irq | ||
430 | nop | ||
431 | b ret_trap_lockless_ipi | ||
432 | clr %l6 | ||
433 | |||
434 | #endif /* CONFIG_SPARC_LEON */ | ||
435 | |||
403 | #endif /* CONFIG_SMP */ | 436 | #endif /* CONFIG_SMP */ |
404 | 437 | ||
405 | /* This routine handles illegal instructions and privileged | 438 | /* This routine handles illegal instructions and privileged |
@@ -1261,7 +1294,7 @@ linux_sparc_syscall: | |||
1261 | sethi %hi(PSR_SYSCALL), %l4 | 1294 | sethi %hi(PSR_SYSCALL), %l4 |
1262 | or %l0, %l4, %l0 | 1295 | or %l0, %l4, %l0 |
1263 | /* Direct access to user regs, must faster. */ | 1296 | /* Direct access to user regs, must faster. */ |
1264 | cmp %g1, NR_SYSCALLS | 1297 | cmp %g1, NR_syscalls |
1265 | bgeu linux_sparc_ni_syscall | 1298 | bgeu linux_sparc_ni_syscall |
1266 | sll %g1, 2, %l4 | 1299 | sll %g1, 2, %l4 |
1267 | ld [%l7 + %l4], %l7 | 1300 | ld [%l7 + %l4], %l7 |
diff --git a/arch/sparc/kernel/ftrace.c b/arch/sparc/kernel/ftrace.c index d3b1a3076569..29973daa9930 100644 --- a/arch/sparc/kernel/ftrace.c +++ b/arch/sparc/kernel/ftrace.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/percpu.h> | 4 | #include <linux/percpu.h> |
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/list.h> | 6 | #include <linux/list.h> |
7 | #include <trace/syscall.h> | ||
7 | 8 | ||
8 | #include <asm/ftrace.h> | 9 | #include <asm/ftrace.h> |
9 | 10 | ||
@@ -91,3 +92,13 @@ int __init ftrace_dyn_arch_init(void *data) | |||
91 | } | 92 | } |
92 | #endif | 93 | #endif |
93 | 94 | ||
95 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
96 | |||
97 | extern unsigned int sys_call_table[]; | ||
98 | |||
99 | unsigned long __init arch_syscall_addr(int nr) | ||
100 | { | ||
101 | return (unsigned long)sys_call_table[nr]; | ||
102 | } | ||
103 | |||
104 | #endif | ||
diff --git a/arch/sparc/kernel/head_32.S b/arch/sparc/kernel/head_32.S index 439d82a95ac9..21bb2590d4ae 100644 --- a/arch/sparc/kernel/head_32.S +++ b/arch/sparc/kernel/head_32.S | |||
@@ -811,9 +811,31 @@ found_version: | |||
811 | got_prop: | 811 | got_prop: |
812 | #ifdef CONFIG_SPARC_LEON | 812 | #ifdef CONFIG_SPARC_LEON |
813 | /* no cpu-type check is needed, it is a SPARC-LEON */ | 813 | /* no cpu-type check is needed, it is a SPARC-LEON */ |
814 | #ifdef CONFIG_SMP | ||
815 | ba leon_smp_init | ||
816 | nop | ||
817 | |||
818 | .global leon_smp_init | ||
819 | leon_smp_init: | ||
820 | sethi %hi(boot_cpu_id), %g1 ! master always 0 | ||
821 | stb %g0, [%g1 + %lo(boot_cpu_id)] | ||
822 | sethi %hi(boot_cpu_id4), %g1 ! master always 0 | ||
823 | stb %g0, [%g1 + %lo(boot_cpu_id4)] | ||
824 | |||
825 | rd %asr17,%g1 | ||
826 | srl %g1,28,%g1 | ||
827 | |||
828 | cmp %g0,%g1 | ||
829 | beq sun4c_continue_boot !continue with master | ||
830 | nop | ||
831 | |||
832 | ba leon_smp_cpu_startup | ||
833 | nop | ||
834 | #else | ||
814 | ba sun4c_continue_boot | 835 | ba sun4c_continue_boot |
815 | nop | 836 | nop |
816 | #endif | 837 | #endif |
838 | #endif | ||
817 | set cputypval, %o2 | 839 | set cputypval, %o2 |
818 | ldub [%o2 + 0x4], %l1 | 840 | ldub [%o2 + 0x4], %l1 |
819 | 841 | ||
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c index 7690cc219ecc..5fad94950e76 100644 --- a/arch/sparc/kernel/iommu.c +++ b/arch/sparc/kernel/iommu.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/dma-mapping.h> | 11 | #include <linux/dma-mapping.h> |
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <linux/iommu-helper.h> | 13 | #include <linux/iommu-helper.h> |
14 | #include <linux/bitmap.h> | ||
14 | 15 | ||
15 | #ifdef CONFIG_PCI | 16 | #ifdef CONFIG_PCI |
16 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
@@ -169,7 +170,7 @@ void iommu_range_free(struct iommu *iommu, dma_addr_t dma_addr, unsigned long np | |||
169 | 170 | ||
170 | entry = (dma_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT; | 171 | entry = (dma_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT; |
171 | 172 | ||
172 | iommu_area_free(arena->map, entry, npages); | 173 | bitmap_clear(arena->map, entry, npages); |
173 | } | 174 | } |
174 | 175 | ||
175 | int iommu_table_init(struct iommu *iommu, int tsbsize, | 176 | int iommu_table_init(struct iommu *iommu, int tsbsize, |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 9f61fd8cbb7b..3c8c44f6a41c 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -48,8 +48,13 @@ | |||
48 | #include <asm/dma.h> | 48 | #include <asm/dma.h> |
49 | #include <asm/iommu.h> | 49 | #include <asm/iommu.h> |
50 | #include <asm/io-unit.h> | 50 | #include <asm/io-unit.h> |
51 | #include <asm/leon.h> | ||
51 | 52 | ||
53 | #ifdef CONFIG_SPARC_LEON | ||
54 | #define mmu_inval_dma_area(p, l) leon_flush_dcache_all() | ||
55 | #else | ||
52 | #define mmu_inval_dma_area(p, l) /* Anton pulled it out for 2.4.0-xx */ | 56 | #define mmu_inval_dma_area(p, l) /* Anton pulled it out for 2.4.0-xx */ |
57 | #endif | ||
53 | 58 | ||
54 | static struct resource *_sparc_find_resource(struct resource *r, | 59 | static struct resource *_sparc_find_resource(struct resource *r, |
55 | unsigned long); | 60 | unsigned long); |
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c index 8ab1d4728a4b..8d6882bb480a 100644 --- a/arch/sparc/kernel/irq_64.c +++ b/arch/sparc/kernel/irq_64.c | |||
@@ -176,7 +176,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
176 | } | 176 | } |
177 | 177 | ||
178 | if (i < NR_IRQS) { | 178 | if (i < NR_IRQS) { |
179 | spin_lock_irqsave(&irq_desc[i].lock, flags); | 179 | raw_spin_lock_irqsave(&irq_desc[i].lock, flags); |
180 | action = irq_desc[i].action; | 180 | action = irq_desc[i].action; |
181 | if (!action) | 181 | if (!action) |
182 | goto skip; | 182 | goto skip; |
@@ -187,7 +187,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
187 | for_each_online_cpu(j) | 187 | for_each_online_cpu(j) |
188 | seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); | 188 | seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); |
189 | #endif | 189 | #endif |
190 | seq_printf(p, " %9s", irq_desc[i].chip->typename); | 190 | seq_printf(p, " %9s", irq_desc[i].chip->name); |
191 | seq_printf(p, " %s", action->name); | 191 | seq_printf(p, " %s", action->name); |
192 | 192 | ||
193 | for (action=action->next; action; action = action->next) | 193 | for (action=action->next; action; action = action->next) |
@@ -195,7 +195,7 @@ int show_interrupts(struct seq_file *p, void *v) | |||
195 | 195 | ||
196 | seq_putc(p, '\n'); | 196 | seq_putc(p, '\n'); |
197 | skip: | 197 | skip: |
198 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 198 | raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
199 | } else if (i == NR_IRQS) { | 199 | } else if (i == NR_IRQS) { |
200 | seq_printf(p, "NMI: "); | 200 | seq_printf(p, "NMI: "); |
201 | for_each_online_cpu(j) | 201 | for_each_online_cpu(j) |
@@ -484,7 +484,7 @@ static void sun4v_virq_eoi(unsigned int virt_irq) | |||
484 | } | 484 | } |
485 | 485 | ||
486 | static struct irq_chip sun4u_irq = { | 486 | static struct irq_chip sun4u_irq = { |
487 | .typename = "sun4u", | 487 | .name = "sun4u", |
488 | .enable = sun4u_irq_enable, | 488 | .enable = sun4u_irq_enable, |
489 | .disable = sun4u_irq_disable, | 489 | .disable = sun4u_irq_disable, |
490 | .eoi = sun4u_irq_eoi, | 490 | .eoi = sun4u_irq_eoi, |
@@ -492,7 +492,7 @@ static struct irq_chip sun4u_irq = { | |||
492 | }; | 492 | }; |
493 | 493 | ||
494 | static struct irq_chip sun4v_irq = { | 494 | static struct irq_chip sun4v_irq = { |
495 | .typename = "sun4v", | 495 | .name = "sun4v", |
496 | .enable = sun4v_irq_enable, | 496 | .enable = sun4v_irq_enable, |
497 | .disable = sun4v_irq_disable, | 497 | .disable = sun4v_irq_disable, |
498 | .eoi = sun4v_irq_eoi, | 498 | .eoi = sun4v_irq_eoi, |
@@ -500,7 +500,7 @@ static struct irq_chip sun4v_irq = { | |||
500 | }; | 500 | }; |
501 | 501 | ||
502 | static struct irq_chip sun4v_virq = { | 502 | static struct irq_chip sun4v_virq = { |
503 | .typename = "vsun4v", | 503 | .name = "vsun4v", |
504 | .enable = sun4v_virq_enable, | 504 | .enable = sun4v_virq_enable, |
505 | .disable = sun4v_virq_disable, | 505 | .disable = sun4v_virq_disable, |
506 | .eoi = sun4v_virq_eoi, | 506 | .eoi = sun4v_virq_eoi, |
@@ -785,14 +785,14 @@ void fixup_irqs(void) | |||
785 | for (irq = 0; irq < NR_IRQS; irq++) { | 785 | for (irq = 0; irq < NR_IRQS; irq++) { |
786 | unsigned long flags; | 786 | unsigned long flags; |
787 | 787 | ||
788 | spin_lock_irqsave(&irq_desc[irq].lock, flags); | 788 | raw_spin_lock_irqsave(&irq_desc[irq].lock, flags); |
789 | if (irq_desc[irq].action && | 789 | if (irq_desc[irq].action && |
790 | !(irq_desc[irq].status & IRQ_PER_CPU)) { | 790 | !(irq_desc[irq].status & IRQ_PER_CPU)) { |
791 | if (irq_desc[irq].chip->set_affinity) | 791 | if (irq_desc[irq].chip->set_affinity) |
792 | irq_desc[irq].chip->set_affinity(irq, | 792 | irq_desc[irq].chip->set_affinity(irq, |
793 | irq_desc[irq].affinity); | 793 | irq_desc[irq].affinity); |
794 | } | 794 | } |
795 | spin_unlock_irqrestore(&irq_desc[irq].lock, flags); | 795 | raw_spin_unlock_irqrestore(&irq_desc[irq].lock, flags); |
796 | } | 796 | } |
797 | 797 | ||
798 | tick_ops->disable_irq(); | 798 | tick_ops->disable_irq(); |
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c index 3bc6527c95af..6716584e48ab 100644 --- a/arch/sparc/kernel/kprobes.c +++ b/arch/sparc/kernel/kprobes.c | |||
@@ -46,6 +46,9 @@ struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}}; | |||
46 | 46 | ||
47 | int __kprobes arch_prepare_kprobe(struct kprobe *p) | 47 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
48 | { | 48 | { |
49 | if ((unsigned long) p->addr & 0x3UL) | ||
50 | return -EILSEQ; | ||
51 | |||
49 | p->ainsn.insn[0] = *p->addr; | 52 | p->ainsn.insn[0] = *p->addr; |
50 | flushi(&p->ainsn.insn[0]); | 53 | flushi(&p->ainsn.insn[0]); |
51 | 54 | ||
diff --git a/arch/sparc/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S index 3ea6e8cde8c5..1d361477d7d6 100644 --- a/arch/sparc/kernel/ktlb.S +++ b/arch/sparc/kernel/ktlb.S | |||
@@ -280,8 +280,8 @@ kvmap_dtlb_nonlinear: | |||
280 | 280 | ||
281 | #ifdef CONFIG_SPARSEMEM_VMEMMAP | 281 | #ifdef CONFIG_SPARSEMEM_VMEMMAP |
282 | /* Do not use the TSB for vmemmap. */ | 282 | /* Do not use the TSB for vmemmap. */ |
283 | mov (VMEMMAP_BASE >> 24), %g5 | 283 | mov (VMEMMAP_BASE >> 40), %g5 |
284 | sllx %g5, 24, %g5 | 284 | sllx %g5, 40, %g5 |
285 | cmp %g4,%g5 | 285 | cmp %g4,%g5 |
286 | bgeu,pn %xcc, kvmap_vmemmap | 286 | bgeu,pn %xcc, kvmap_vmemmap |
287 | nop | 287 | nop |
@@ -293,8 +293,8 @@ kvmap_dtlb_tsbmiss: | |||
293 | sethi %hi(MODULES_VADDR), %g5 | 293 | sethi %hi(MODULES_VADDR), %g5 |
294 | cmp %g4, %g5 | 294 | cmp %g4, %g5 |
295 | blu,pn %xcc, kvmap_dtlb_longpath | 295 | blu,pn %xcc, kvmap_dtlb_longpath |
296 | mov (VMALLOC_END >> 24), %g5 | 296 | mov (VMALLOC_END >> 40), %g5 |
297 | sllx %g5, 24, %g5 | 297 | sllx %g5, 40, %g5 |
298 | cmp %g4, %g5 | 298 | cmp %g4, %g5 |
299 | bgeu,pn %xcc, kvmap_dtlb_longpath | 299 | bgeu,pn %xcc, kvmap_dtlb_longpath |
300 | nop | 300 | nop |
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c index adf5f273868a..df39a0f0d27a 100644 --- a/arch/sparc/kernel/ldc.c +++ b/arch/sparc/kernel/ldc.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/bitmap.h> | ||
17 | 18 | ||
18 | #include <asm/hypervisor.h> | 19 | #include <asm/hypervisor.h> |
19 | #include <asm/iommu.h> | 20 | #include <asm/iommu.h> |
@@ -1242,13 +1243,13 @@ int ldc_bind(struct ldc_channel *lp, const char *name) | |||
1242 | snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); | 1243 | snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); |
1243 | 1244 | ||
1244 | err = request_irq(lp->cfg.rx_irq, ldc_rx, | 1245 | err = request_irq(lp->cfg.rx_irq, ldc_rx, |
1245 | IRQF_SAMPLE_RANDOM | IRQF_SHARED, | 1246 | IRQF_SAMPLE_RANDOM | IRQF_DISABLED, |
1246 | lp->rx_irq_name, lp); | 1247 | lp->rx_irq_name, lp); |
1247 | if (err) | 1248 | if (err) |
1248 | return err; | 1249 | return err; |
1249 | 1250 | ||
1250 | err = request_irq(lp->cfg.tx_irq, ldc_tx, | 1251 | err = request_irq(lp->cfg.tx_irq, ldc_tx, |
1251 | IRQF_SAMPLE_RANDOM | IRQF_SHARED, | 1252 | IRQF_SAMPLE_RANDOM | IRQF_DISABLED, |
1252 | lp->tx_irq_name, lp); | 1253 | lp->tx_irq_name, lp); |
1253 | if (err) { | 1254 | if (err) { |
1254 | free_irq(lp->cfg.rx_irq, lp); | 1255 | free_irq(lp->cfg.rx_irq, lp); |
@@ -1875,7 +1876,7 @@ EXPORT_SYMBOL(ldc_read); | |||
1875 | static long arena_alloc(struct ldc_iommu *iommu, unsigned long npages) | 1876 | static long arena_alloc(struct ldc_iommu *iommu, unsigned long npages) |
1876 | { | 1877 | { |
1877 | struct iommu_arena *arena = &iommu->arena; | 1878 | struct iommu_arena *arena = &iommu->arena; |
1878 | unsigned long n, i, start, end, limit; | 1879 | unsigned long n, start, end, limit; |
1879 | int pass; | 1880 | int pass; |
1880 | 1881 | ||
1881 | limit = arena->limit; | 1882 | limit = arena->limit; |
@@ -1883,7 +1884,7 @@ static long arena_alloc(struct ldc_iommu *iommu, unsigned long npages) | |||
1883 | pass = 0; | 1884 | pass = 0; |
1884 | 1885 | ||
1885 | again: | 1886 | again: |
1886 | n = find_next_zero_bit(arena->map, limit, start); | 1887 | n = bitmap_find_next_zero_area(arena->map, limit, start, npages, 0); |
1887 | end = n + npages; | 1888 | end = n + npages; |
1888 | if (unlikely(end >= limit)) { | 1889 | if (unlikely(end >= limit)) { |
1889 | if (likely(pass < 1)) { | 1890 | if (likely(pass < 1)) { |
@@ -1896,16 +1897,7 @@ again: | |||
1896 | return -1; | 1897 | return -1; |
1897 | } | 1898 | } |
1898 | } | 1899 | } |
1899 | 1900 | bitmap_set(arena->map, n, npages); | |
1900 | for (i = n; i < end; i++) { | ||
1901 | if (test_bit(i, arena->map)) { | ||
1902 | start = i + 1; | ||
1903 | goto again; | ||
1904 | } | ||
1905 | } | ||
1906 | |||
1907 | for (i = n; i < end; i++) | ||
1908 | __set_bit(i, arena->map); | ||
1909 | 1901 | ||
1910 | arena->hint = end; | 1902 | arena->hint = end; |
1911 | 1903 | ||
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index 54d8a5bd4824..87f1760c0aa2 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -12,11 +12,14 @@ | |||
12 | #include <linux/of_platform.h> | 12 | #include <linux/of_platform.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/of_device.h> | 14 | #include <linux/of_device.h> |
15 | |||
15 | #include <asm/oplib.h> | 16 | #include <asm/oplib.h> |
16 | #include <asm/timer.h> | 17 | #include <asm/timer.h> |
17 | #include <asm/prom.h> | 18 | #include <asm/prom.h> |
18 | #include <asm/leon.h> | 19 | #include <asm/leon.h> |
19 | #include <asm/leon_amba.h> | 20 | #include <asm/leon_amba.h> |
21 | #include <asm/traps.h> | ||
22 | #include <asm/cacheflush.h> | ||
20 | 23 | ||
21 | #include "prom.h" | 24 | #include "prom.h" |
22 | #include "irq.h" | 25 | #include "irq.h" |
@@ -115,6 +118,21 @@ void __init leon_init_timers(irq_handler_t counter_fn) | |||
115 | (((1000000 / 100) - 1))); | 118 | (((1000000 / 100) - 1))); |
116 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 0); | 119 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 0); |
117 | 120 | ||
121 | #ifdef CONFIG_SMP | ||
122 | leon_percpu_timer_dev[0].start = (int)leon3_gptimer_regs; | ||
123 | leon_percpu_timer_dev[0].irq = leon3_gptimer_irq+1; | ||
124 | |||
125 | if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) & | ||
126 | (1<<LEON3_GPTIMER_SEPIRQ))) { | ||
127 | prom_printf("irq timer not configured with seperate irqs \n"); | ||
128 | BUG(); | ||
129 | } | ||
130 | |||
131 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].val, 0); | ||
132 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/100) - 1))); | ||
133 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl, 0); | ||
134 | # endif | ||
135 | |||
118 | } else { | 136 | } else { |
119 | printk(KERN_ERR "No Timer/irqctrl found\n"); | 137 | printk(KERN_ERR "No Timer/irqctrl found\n"); |
120 | BUG(); | 138 | BUG(); |
@@ -130,11 +148,41 @@ void __init leon_init_timers(irq_handler_t counter_fn) | |||
130 | prom_halt(); | 148 | prom_halt(); |
131 | } | 149 | } |
132 | 150 | ||
151 | # ifdef CONFIG_SMP | ||
152 | { | ||
153 | unsigned long flags; | ||
154 | struct tt_entry *trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (leon_percpu_timer_dev[0].irq - 1)]; | ||
155 | |||
156 | /* For SMP we use the level 14 ticker, however the bootup code | ||
157 | * has copied the firmwares level 14 vector into boot cpu's | ||
158 | * trap table, we must fix this now or we get squashed. | ||
159 | */ | ||
160 | local_irq_save(flags); | ||
161 | |||
162 | patchme_maybe_smp_msg[0] = 0x01000000; /* NOP out the branch */ | ||
163 | |||
164 | /* Adjust so that we jump directly to smpleon_ticker */ | ||
165 | trap_table->inst_three += smpleon_ticker - real_irq_entry; | ||
166 | |||
167 | local_flush_cache_all(); | ||
168 | local_irq_restore(flags); | ||
169 | } | ||
170 | # endif | ||
171 | |||
133 | if (leon3_gptimer_regs) { | 172 | if (leon3_gptimer_regs) { |
134 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, | 173 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, |
135 | LEON3_GPTIMER_EN | | 174 | LEON3_GPTIMER_EN | |
136 | LEON3_GPTIMER_RL | | 175 | LEON3_GPTIMER_RL | |
137 | LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN); | 176 | LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN); |
177 | |||
178 | #ifdef CONFIG_SMP | ||
179 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl, | ||
180 | LEON3_GPTIMER_EN | | ||
181 | LEON3_GPTIMER_RL | | ||
182 | LEON3_GPTIMER_LD | | ||
183 | LEON3_GPTIMER_IRQEN); | ||
184 | #endif | ||
185 | |||
138 | } | 186 | } |
139 | } | 187 | } |
140 | 188 | ||
@@ -175,6 +223,42 @@ void __init leon_node_init(struct device_node *dp, struct device_node ***nextp) | |||
175 | } | 223 | } |
176 | } | 224 | } |
177 | 225 | ||
226 | #ifdef CONFIG_SMP | ||
227 | |||
228 | void leon_set_cpu_int(int cpu, int level) | ||
229 | { | ||
230 | unsigned long mask; | ||
231 | mask = get_irqmask(level); | ||
232 | LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask); | ||
233 | } | ||
234 | |||
235 | static void leon_clear_ipi(int cpu, int level) | ||
236 | { | ||
237 | unsigned long mask; | ||
238 | mask = get_irqmask(level); | ||
239 | LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask<<16); | ||
240 | } | ||
241 | |||
242 | static void leon_set_udt(int cpu) | ||
243 | { | ||
244 | } | ||
245 | |||
246 | void leon_clear_profile_irq(int cpu) | ||
247 | { | ||
248 | } | ||
249 | |||
250 | void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu) | ||
251 | { | ||
252 | unsigned long mask, flags, *addr; | ||
253 | mask = get_irqmask(irq_nr); | ||
254 | local_irq_save(flags); | ||
255 | addr = (unsigned long *)&(leon3_irqctrl_regs->mask[cpu]); | ||
256 | LEON3_BYPASS_STORE_PA(addr, (LEON3_BYPASS_LOAD_PA(addr) | (mask))); | ||
257 | local_irq_restore(flags); | ||
258 | } | ||
259 | |||
260 | #endif | ||
261 | |||
178 | void __init leon_init_IRQ(void) | 262 | void __init leon_init_IRQ(void) |
179 | { | 263 | { |
180 | sparc_init_timers = leon_init_timers; | 264 | sparc_init_timers = leon_init_timers; |
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c new file mode 100644 index 000000000000..05c0dadd6371 --- /dev/null +++ b/arch/sparc/kernel/leon_smp.c | |||
@@ -0,0 +1,468 @@ | |||
1 | /* leon_smp.c: Sparc-Leon SMP support. | ||
2 | * | ||
3 | * based on sun4m_smp.c | ||
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
5 | * Copyright (C) 2009 Daniel Hellstrom (daniel@gaisler.com) Aeroflex Gaisler AB | ||
6 | * Copyright (C) 2009 Konrad Eisele (konrad@gaisler.com) Aeroflex Gaisler AB | ||
7 | */ | ||
8 | |||
9 | #include <asm/head.h> | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/threads.h> | ||
14 | #include <linux/smp.h> | ||
15 | #include <linux/smp_lock.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/kernel_stat.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/spinlock.h> | ||
20 | #include <linux/mm.h> | ||
21 | #include <linux/swap.h> | ||
22 | #include <linux/profile.h> | ||
23 | #include <linux/pm.h> | ||
24 | #include <linux/delay.h> | ||
25 | |||
26 | #include <asm/cacheflush.h> | ||
27 | #include <asm/tlbflush.h> | ||
28 | |||
29 | #include <asm/ptrace.h> | ||
30 | #include <asm/atomic.h> | ||
31 | #include <asm/irq_regs.h> | ||
32 | |||
33 | #include <asm/delay.h> | ||
34 | #include <asm/irq.h> | ||
35 | #include <asm/page.h> | ||
36 | #include <asm/pgalloc.h> | ||
37 | #include <asm/pgtable.h> | ||
38 | #include <asm/oplib.h> | ||
39 | #include <asm/cpudata.h> | ||
40 | #include <asm/asi.h> | ||
41 | #include <asm/leon.h> | ||
42 | #include <asm/leon_amba.h> | ||
43 | |||
44 | #ifdef CONFIG_SPARC_LEON | ||
45 | |||
46 | #include "irq.h" | ||
47 | |||
48 | extern ctxd_t *srmmu_ctx_table_phys; | ||
49 | static int smp_processors_ready; | ||
50 | extern volatile unsigned long cpu_callin_map[NR_CPUS]; | ||
51 | extern unsigned char boot_cpu_id; | ||
52 | extern cpumask_t smp_commenced_mask; | ||
53 | void __init leon_configure_cache_smp(void); | ||
54 | |||
55 | static inline unsigned long do_swap(volatile unsigned long *ptr, | ||
56 | unsigned long val) | ||
57 | { | ||
58 | __asm__ __volatile__("swapa [%1] %2, %0\n\t" : "=&r"(val) | ||
59 | : "r"(ptr), "i"(ASI_LEON_DCACHE_MISS) | ||
60 | : "memory"); | ||
61 | return val; | ||
62 | } | ||
63 | |||
64 | static void smp_setup_percpu_timer(void); | ||
65 | |||
66 | void __cpuinit leon_callin(void) | ||
67 | { | ||
68 | int cpuid = hard_smpleon_processor_id(); | ||
69 | |||
70 | local_flush_cache_all(); | ||
71 | local_flush_tlb_all(); | ||
72 | leon_configure_cache_smp(); | ||
73 | |||
74 | /* Get our local ticker going. */ | ||
75 | smp_setup_percpu_timer(); | ||
76 | |||
77 | calibrate_delay(); | ||
78 | smp_store_cpu_info(cpuid); | ||
79 | |||
80 | local_flush_cache_all(); | ||
81 | local_flush_tlb_all(); | ||
82 | |||
83 | /* | ||
84 | * Unblock the master CPU _only_ when the scheduler state | ||
85 | * of all secondary CPUs will be up-to-date, so after | ||
86 | * the SMP initialization the master will be just allowed | ||
87 | * to call the scheduler code. | ||
88 | * Allow master to continue. | ||
89 | */ | ||
90 | do_swap(&cpu_callin_map[cpuid], 1); | ||
91 | |||
92 | local_flush_cache_all(); | ||
93 | local_flush_tlb_all(); | ||
94 | |||
95 | cpu_probe(); | ||
96 | |||
97 | /* Fix idle thread fields. */ | ||
98 | __asm__ __volatile__("ld [%0], %%g6\n\t" : : "r"(¤t_set[cpuid]) | ||
99 | : "memory" /* paranoid */); | ||
100 | |||
101 | /* Attach to the address space of init_task. */ | ||
102 | atomic_inc(&init_mm.mm_count); | ||
103 | current->active_mm = &init_mm; | ||
104 | |||
105 | while (!cpu_isset(cpuid, smp_commenced_mask)) | ||
106 | mb(); | ||
107 | |||
108 | local_irq_enable(); | ||
109 | cpu_set(cpuid, cpu_online_map); | ||
110 | } | ||
111 | |||
112 | /* | ||
113 | * Cycle through the processors asking the PROM to start each one. | ||
114 | */ | ||
115 | |||
116 | extern struct linux_prom_registers smp_penguin_ctable; | ||
117 | |||
118 | void __init leon_configure_cache_smp(void) | ||
119 | { | ||
120 | unsigned long cfg = sparc_leon3_get_dcachecfg(); | ||
121 | int me = smp_processor_id(); | ||
122 | |||
123 | if (ASI_LEON3_SYSCTRL_CFG_SSIZE(cfg) > 4) { | ||
124 | printk(KERN_INFO "Note: SMP with snooping only works on 4k cache, found %dk(0x%x) on cpu %d, disabling caches\n", | ||
125 | (unsigned int)ASI_LEON3_SYSCTRL_CFG_SSIZE(cfg), | ||
126 | (unsigned int)cfg, (unsigned int)me); | ||
127 | sparc_leon3_disable_cache(); | ||
128 | } else { | ||
129 | if (cfg & ASI_LEON3_SYSCTRL_CFG_SNOOPING) { | ||
130 | sparc_leon3_enable_snooping(); | ||
131 | } else { | ||
132 | printk(KERN_INFO "Note: You have to enable snooping in the vhdl model cpu %d, disabling caches\n", | ||
133 | me); | ||
134 | sparc_leon3_disable_cache(); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | local_flush_cache_all(); | ||
139 | local_flush_tlb_all(); | ||
140 | } | ||
141 | |||
142 | void leon_smp_setbroadcast(unsigned int mask) | ||
143 | { | ||
144 | int broadcast = | ||
145 | ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >> | ||
146 | LEON3_IRQMPSTATUS_BROADCAST) & 1); | ||
147 | if (!broadcast) { | ||
148 | prom_printf("######## !!!! The irqmp-ctrl must have broadcast enabled, smp wont work !!!!! ####### nr cpus: %d\n", | ||
149 | leon_smp_nrcpus()); | ||
150 | if (leon_smp_nrcpus() > 1) { | ||
151 | BUG(); | ||
152 | } else { | ||
153 | prom_printf("continue anyway\n"); | ||
154 | return; | ||
155 | } | ||
156 | } | ||
157 | LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpbroadcast), mask); | ||
158 | } | ||
159 | |||
160 | unsigned int leon_smp_getbroadcast(void) | ||
161 | { | ||
162 | unsigned int mask; | ||
163 | mask = LEON_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpbroadcast)); | ||
164 | return mask; | ||
165 | } | ||
166 | |||
167 | int leon_smp_nrcpus(void) | ||
168 | { | ||
169 | int nrcpu = | ||
170 | ((LEON3_BYPASS_LOAD_PA(&(leon3_irqctrl_regs->mpstatus)) >> | ||
171 | LEON3_IRQMPSTATUS_CPUNR) & 0xf) + 1; | ||
172 | return nrcpu; | ||
173 | } | ||
174 | |||
175 | void __init leon_boot_cpus(void) | ||
176 | { | ||
177 | int nrcpu = leon_smp_nrcpus(); | ||
178 | int me = smp_processor_id(); | ||
179 | |||
180 | printk(KERN_INFO "%d:(%d:%d) cpus mpirq at 0x%x \n", (unsigned int)me, | ||
181 | (unsigned int)nrcpu, (unsigned int)NR_CPUS, | ||
182 | (unsigned int)&(leon3_irqctrl_regs->mpstatus)); | ||
183 | |||
184 | leon_enable_irq_cpu(LEON3_IRQ_CROSS_CALL, me); | ||
185 | leon_enable_irq_cpu(LEON3_IRQ_TICKER, me); | ||
186 | leon_enable_irq_cpu(LEON3_IRQ_RESCHEDULE, me); | ||
187 | |||
188 | leon_smp_setbroadcast(1 << LEON3_IRQ_TICKER); | ||
189 | |||
190 | leon_configure_cache_smp(); | ||
191 | smp_setup_percpu_timer(); | ||
192 | local_flush_cache_all(); | ||
193 | |||
194 | } | ||
195 | |||
196 | int __cpuinit leon_boot_one_cpu(int i) | ||
197 | { | ||
198 | |||
199 | struct task_struct *p; | ||
200 | int timeout; | ||
201 | |||
202 | /* Cook up an idler for this guy. */ | ||
203 | p = fork_idle(i); | ||
204 | |||
205 | current_set[i] = task_thread_info(p); | ||
206 | |||
207 | /* See trampoline.S:leon_smp_cpu_startup for details... | ||
208 | * Initialize the contexts table | ||
209 | * Since the call to prom_startcpu() trashes the structure, | ||
210 | * we need to re-initialize it for each cpu | ||
211 | */ | ||
212 | smp_penguin_ctable.which_io = 0; | ||
213 | smp_penguin_ctable.phys_addr = (unsigned int)srmmu_ctx_table_phys; | ||
214 | smp_penguin_ctable.reg_size = 0; | ||
215 | |||
216 | /* whirrr, whirrr, whirrrrrrrrr... */ | ||
217 | printk(KERN_INFO "Starting CPU %d : (irqmp: 0x%x)\n", (unsigned int)i, | ||
218 | (unsigned int)&leon3_irqctrl_regs->mpstatus); | ||
219 | local_flush_cache_all(); | ||
220 | |||
221 | LEON_BYPASS_STORE_PA(&(leon3_irqctrl_regs->mpstatus), 1 << i); | ||
222 | |||
223 | /* wheee... it's going... */ | ||
224 | for (timeout = 0; timeout < 10000; timeout++) { | ||
225 | if (cpu_callin_map[i]) | ||
226 | break; | ||
227 | udelay(200); | ||
228 | } | ||
229 | printk(KERN_INFO "Started CPU %d \n", (unsigned int)i); | ||
230 | |||
231 | if (!(cpu_callin_map[i])) { | ||
232 | printk(KERN_ERR "Processor %d is stuck.\n", i); | ||
233 | return -ENODEV; | ||
234 | } else { | ||
235 | leon_enable_irq_cpu(LEON3_IRQ_CROSS_CALL, i); | ||
236 | leon_enable_irq_cpu(LEON3_IRQ_TICKER, i); | ||
237 | leon_enable_irq_cpu(LEON3_IRQ_RESCHEDULE, i); | ||
238 | } | ||
239 | |||
240 | local_flush_cache_all(); | ||
241 | return 0; | ||
242 | } | ||
243 | |||
244 | void __init leon_smp_done(void) | ||
245 | { | ||
246 | |||
247 | int i, first; | ||
248 | int *prev; | ||
249 | |||
250 | /* setup cpu list for irq rotation */ | ||
251 | first = 0; | ||
252 | prev = &first; | ||
253 | for (i = 0; i < NR_CPUS; i++) { | ||
254 | if (cpu_online(i)) { | ||
255 | *prev = i; | ||
256 | prev = &cpu_data(i).next; | ||
257 | } | ||
258 | } | ||
259 | *prev = first; | ||
260 | local_flush_cache_all(); | ||
261 | |||
262 | /* Free unneeded trap tables */ | ||
263 | if (!cpu_isset(1, cpu_present_map)) { | ||
264 | ClearPageReserved(virt_to_page(trapbase_cpu1)); | ||
265 | init_page_count(virt_to_page(trapbase_cpu1)); | ||
266 | free_page((unsigned long)trapbase_cpu1); | ||
267 | totalram_pages++; | ||
268 | num_physpages++; | ||
269 | } | ||
270 | if (!cpu_isset(2, cpu_present_map)) { | ||
271 | ClearPageReserved(virt_to_page(trapbase_cpu2)); | ||
272 | init_page_count(virt_to_page(trapbase_cpu2)); | ||
273 | free_page((unsigned long)trapbase_cpu2); | ||
274 | totalram_pages++; | ||
275 | num_physpages++; | ||
276 | } | ||
277 | if (!cpu_isset(3, cpu_present_map)) { | ||
278 | ClearPageReserved(virt_to_page(trapbase_cpu3)); | ||
279 | init_page_count(virt_to_page(trapbase_cpu3)); | ||
280 | free_page((unsigned long)trapbase_cpu3); | ||
281 | totalram_pages++; | ||
282 | num_physpages++; | ||
283 | } | ||
284 | /* Ok, they are spinning and ready to go. */ | ||
285 | smp_processors_ready = 1; | ||
286 | |||
287 | } | ||
288 | |||
289 | void leon_irq_rotate(int cpu) | ||
290 | { | ||
291 | } | ||
292 | |||
293 | static struct smp_funcall { | ||
294 | smpfunc_t func; | ||
295 | unsigned long arg1; | ||
296 | unsigned long arg2; | ||
297 | unsigned long arg3; | ||
298 | unsigned long arg4; | ||
299 | unsigned long arg5; | ||
300 | unsigned long processors_in[NR_CPUS]; /* Set when ipi entered. */ | ||
301 | unsigned long processors_out[NR_CPUS]; /* Set when ipi exited. */ | ||
302 | } ccall_info; | ||
303 | |||
304 | static DEFINE_SPINLOCK(cross_call_lock); | ||
305 | |||
306 | /* Cross calls must be serialized, at least currently. */ | ||
307 | static void leon_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, | ||
308 | unsigned long arg2, unsigned long arg3, | ||
309 | unsigned long arg4) | ||
310 | { | ||
311 | if (smp_processors_ready) { | ||
312 | register int high = NR_CPUS - 1; | ||
313 | unsigned long flags; | ||
314 | |||
315 | spin_lock_irqsave(&cross_call_lock, flags); | ||
316 | |||
317 | { | ||
318 | /* If you make changes here, make sure gcc generates proper code... */ | ||
319 | register smpfunc_t f asm("i0") = func; | ||
320 | register unsigned long a1 asm("i1") = arg1; | ||
321 | register unsigned long a2 asm("i2") = arg2; | ||
322 | register unsigned long a3 asm("i3") = arg3; | ||
323 | register unsigned long a4 asm("i4") = arg4; | ||
324 | register unsigned long a5 asm("i5") = 0; | ||
325 | |||
326 | __asm__ __volatile__("std %0, [%6]\n\t" | ||
327 | "std %2, [%6 + 8]\n\t" | ||
328 | "std %4, [%6 + 16]\n\t" : : | ||
329 | "r"(f), "r"(a1), "r"(a2), "r"(a3), | ||
330 | "r"(a4), "r"(a5), | ||
331 | "r"(&ccall_info.func)); | ||
332 | } | ||
333 | |||
334 | /* Init receive/complete mapping, plus fire the IPI's off. */ | ||
335 | { | ||
336 | register int i; | ||
337 | |||
338 | cpu_clear(smp_processor_id(), mask); | ||
339 | cpus_and(mask, cpu_online_map, mask); | ||
340 | for (i = 0; i <= high; i++) { | ||
341 | if (cpu_isset(i, mask)) { | ||
342 | ccall_info.processors_in[i] = 0; | ||
343 | ccall_info.processors_out[i] = 0; | ||
344 | set_cpu_int(i, LEON3_IRQ_CROSS_CALL); | ||
345 | |||
346 | } | ||
347 | } | ||
348 | } | ||
349 | |||
350 | { | ||
351 | register int i; | ||
352 | |||
353 | i = 0; | ||
354 | do { | ||
355 | if (!cpu_isset(i, mask)) | ||
356 | continue; | ||
357 | |||
358 | while (!ccall_info.processors_in[i]) | ||
359 | barrier(); | ||
360 | } while (++i <= high); | ||
361 | |||
362 | i = 0; | ||
363 | do { | ||
364 | if (!cpu_isset(i, mask)) | ||
365 | continue; | ||
366 | |||
367 | while (!ccall_info.processors_out[i]) | ||
368 | barrier(); | ||
369 | } while (++i <= high); | ||
370 | } | ||
371 | |||
372 | spin_unlock_irqrestore(&cross_call_lock, flags); | ||
373 | } | ||
374 | } | ||
375 | |||
376 | /* Running cross calls. */ | ||
377 | void leon_cross_call_irq(void) | ||
378 | { | ||
379 | int i = smp_processor_id(); | ||
380 | |||
381 | ccall_info.processors_in[i] = 1; | ||
382 | ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, | ||
383 | ccall_info.arg4, ccall_info.arg5); | ||
384 | ccall_info.processors_out[i] = 1; | ||
385 | } | ||
386 | |||
387 | void leon_percpu_timer_interrupt(struct pt_regs *regs) | ||
388 | { | ||
389 | struct pt_regs *old_regs; | ||
390 | int cpu = smp_processor_id(); | ||
391 | |||
392 | old_regs = set_irq_regs(regs); | ||
393 | |||
394 | leon_clear_profile_irq(cpu); | ||
395 | |||
396 | profile_tick(CPU_PROFILING); | ||
397 | |||
398 | if (!--prof_counter(cpu)) { | ||
399 | int user = user_mode(regs); | ||
400 | |||
401 | irq_enter(); | ||
402 | update_process_times(user); | ||
403 | irq_exit(); | ||
404 | |||
405 | prof_counter(cpu) = prof_multiplier(cpu); | ||
406 | } | ||
407 | set_irq_regs(old_regs); | ||
408 | } | ||
409 | |||
410 | static void __init smp_setup_percpu_timer(void) | ||
411 | { | ||
412 | int cpu = smp_processor_id(); | ||
413 | |||
414 | prof_counter(cpu) = prof_multiplier(cpu) = 1; | ||
415 | } | ||
416 | |||
417 | void __init leon_blackbox_id(unsigned *addr) | ||
418 | { | ||
419 | int rd = *addr & 0x3e000000; | ||
420 | int rs1 = rd >> 11; | ||
421 | |||
422 | /* patch places where ___b_hard_smp_processor_id appears */ | ||
423 | addr[0] = 0x81444000 | rd; /* rd %asr17, reg */ | ||
424 | addr[1] = 0x8130201c | rd | rs1; /* srl reg, 0x1c, reg */ | ||
425 | addr[2] = 0x01000000; /* nop */ | ||
426 | } | ||
427 | |||
428 | void __init leon_blackbox_current(unsigned *addr) | ||
429 | { | ||
430 | int rd = *addr & 0x3e000000; | ||
431 | int rs1 = rd >> 11; | ||
432 | |||
433 | /* patch LOAD_CURRENT macro where ___b_load_current appears */ | ||
434 | addr[0] = 0x81444000 | rd; /* rd %asr17, reg */ | ||
435 | addr[2] = 0x8130201c | rd | rs1; /* srl reg, 0x1c, reg */ | ||
436 | addr[4] = 0x81282002 | rd | rs1; /* sll reg, 0x2, reg */ | ||
437 | |||
438 | } | ||
439 | |||
440 | /* | ||
441 | * CPU idle callback function | ||
442 | * See .../arch/sparc/kernel/process.c | ||
443 | */ | ||
444 | void pmc_leon_idle(void) | ||
445 | { | ||
446 | __asm__ volatile ("mov %g0, %asr19"); | ||
447 | } | ||
448 | |||
449 | void __init leon_init_smp(void) | ||
450 | { | ||
451 | /* Patch ipi15 trap table */ | ||
452 | t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_leon - linux_trap_ipi15_sun4m); | ||
453 | |||
454 | BTFIXUPSET_BLACKBOX(hard_smp_processor_id, leon_blackbox_id); | ||
455 | BTFIXUPSET_BLACKBOX(load_current, leon_blackbox_current); | ||
456 | BTFIXUPSET_CALL(smp_cross_call, leon_cross_call, BTFIXUPCALL_NORM); | ||
457 | BTFIXUPSET_CALL(__hard_smp_processor_id, __leon_processor_id, | ||
458 | BTFIXUPCALL_NORM); | ||
459 | |||
460 | #ifndef PMC_NO_IDLE | ||
461 | /* Assign power management IDLE handler */ | ||
462 | pm_idle = pmc_leon_idle; | ||
463 | printk(KERN_INFO "leon: power management initialized\n"); | ||
464 | #endif | ||
465 | |||
466 | } | ||
467 | |||
468 | #endif /* CONFIG_SPARC_LEON */ | ||
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index 938da19dc065..cdc91d919e93 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
12 | #include <linux/miscdevice.h> | 12 | #include <linux/miscdevice.h> |
13 | #include <linux/bootmem.h> | ||
13 | 14 | ||
14 | #include <asm/cpudata.h> | 15 | #include <asm/cpudata.h> |
15 | #include <asm/hypervisor.h> | 16 | #include <asm/hypervisor.h> |
@@ -108,25 +109,15 @@ static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size) | |||
108 | 109 | ||
109 | static void mdesc_lmb_free(struct mdesc_handle *hp) | 110 | static void mdesc_lmb_free(struct mdesc_handle *hp) |
110 | { | 111 | { |
111 | unsigned int alloc_size, handle_size = hp->handle_size; | 112 | unsigned int alloc_size; |
112 | unsigned long start, end; | 113 | unsigned long start; |
113 | 114 | ||
114 | BUG_ON(atomic_read(&hp->refcnt) != 0); | 115 | BUG_ON(atomic_read(&hp->refcnt) != 0); |
115 | BUG_ON(!list_empty(&hp->list)); | 116 | BUG_ON(!list_empty(&hp->list)); |
116 | 117 | ||
117 | alloc_size = PAGE_ALIGN(handle_size); | 118 | alloc_size = PAGE_ALIGN(hp->handle_size); |
118 | 119 | start = __pa(hp); | |
119 | start = (unsigned long) hp; | 120 | free_bootmem_late(start, alloc_size); |
120 | end = start + alloc_size; | ||
121 | |||
122 | while (start < end) { | ||
123 | struct page *p; | ||
124 | |||
125 | p = virt_to_page(start); | ||
126 | ClearPageReserved(p); | ||
127 | __free_page(p); | ||
128 | start += PAGE_SIZE; | ||
129 | } | ||
130 | } | 121 | } |
131 | 122 | ||
132 | static struct mdesc_mem_ops lmb_mdesc_ops = { | 123 | static struct mdesc_mem_ops lmb_mdesc_ops = { |
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c index 881947e59e95..0a6f2d1798d1 100644 --- a/arch/sparc/kernel/of_device_64.c +++ b/arch/sparc/kernel/of_device_64.c | |||
@@ -104,9 +104,19 @@ static int of_bus_pci_map(u32 *addr, const u32 *range, | |||
104 | int i; | 104 | int i; |
105 | 105 | ||
106 | /* Check address type match */ | 106 | /* Check address type match */ |
107 | if ((addr[0] ^ range[0]) & 0x03000000) | 107 | if (!((addr[0] ^ range[0]) & 0x03000000)) |
108 | return -EINVAL; | 108 | goto type_match; |
109 | |||
110 | /* Special exception, we can map a 64-bit address into | ||
111 | * a 32-bit range. | ||
112 | */ | ||
113 | if ((addr[0] & 0x03000000) == 0x03000000 && | ||
114 | (range[0] & 0x03000000) == 0x02000000) | ||
115 | goto type_match; | ||
116 | |||
117 | return -EINVAL; | ||
109 | 118 | ||
119 | type_match: | ||
110 | if (of_out_of_range(addr + 1, range + 1, range + na + pna, | 120 | if (of_out_of_range(addr + 1, range + 1, range + na + pna, |
111 | na - 1, ns)) | 121 | na - 1, ns)) |
112 | return -EINVAL; | 122 | return -EINVAL; |
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index c68648662802..539e83f8e087 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -1064,7 +1064,6 @@ int pci64_dma_supported(struct pci_dev *pdev, u64 device_mask) | |||
1064 | 1064 | ||
1065 | return (device_mask & dma_addr_mask) == dma_addr_mask; | 1065 | return (device_mask & dma_addr_mask) == dma_addr_mask; |
1066 | } | 1066 | } |
1067 | EXPORT_SYMBOL(pci_dma_supported); | ||
1068 | 1067 | ||
1069 | void pci_resource_to_user(const struct pci_dev *pdev, int bar, | 1068 | void pci_resource_to_user(const struct pci_dev *pdev, int bar, |
1070 | const struct resource *rp, resource_size_t *start, | 1069 | const struct resource *rp, resource_size_t *start, |
@@ -1081,3 +1080,10 @@ void pci_resource_to_user(const struct pci_dev *pdev, int bar, | |||
1081 | *start = rp->start - offset; | 1080 | *start = rp->start - offset; |
1082 | *end = rp->end - offset; | 1081 | *end = rp->end - offset; |
1083 | } | 1082 | } |
1083 | |||
1084 | static int __init pcibios_init(void) | ||
1085 | { | ||
1086 | pci_dfl_cache_line_size = 64 >> 2; | ||
1087 | return 0; | ||
1088 | } | ||
1089 | subsys_initcall(pcibios_init); | ||
diff --git a/arch/sparc/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c index f1be37a7b123..e1b0541feb19 100644 --- a/arch/sparc/kernel/pci_msi.c +++ b/arch/sparc/kernel/pci_msi.c | |||
@@ -112,7 +112,7 @@ static void free_msi(struct pci_pbm_info *pbm, int msi_num) | |||
112 | } | 112 | } |
113 | 113 | ||
114 | static struct irq_chip msi_irq = { | 114 | static struct irq_chip msi_irq = { |
115 | .typename = "PCI-MSI", | 115 | .name = "PCI-MSI", |
116 | .mask = mask_msi_irq, | 116 | .mask = mask_msi_irq, |
117 | .unmask = unmask_msi_irq, | 117 | .unmask = unmask_msi_irq, |
118 | .enable = unmask_msi_irq, | 118 | .enable = unmask_msi_irq, |
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 2d6a1b10c81d..fa5936e1c3b9 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
@@ -56,7 +56,8 @@ struct cpu_hw_events { | |||
56 | struct perf_event *events[MAX_HWEVENTS]; | 56 | struct perf_event *events[MAX_HWEVENTS]; |
57 | unsigned long used_mask[BITS_TO_LONGS(MAX_HWEVENTS)]; | 57 | unsigned long used_mask[BITS_TO_LONGS(MAX_HWEVENTS)]; |
58 | unsigned long active_mask[BITS_TO_LONGS(MAX_HWEVENTS)]; | 58 | unsigned long active_mask[BITS_TO_LONGS(MAX_HWEVENTS)]; |
59 | int enabled; | 59 | u64 pcr; |
60 | int enabled; | ||
60 | }; | 61 | }; |
61 | DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; | 62 | DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = { .enabled = 1, }; |
62 | 63 | ||
@@ -68,8 +69,30 @@ struct perf_event_map { | |||
68 | #define PIC_LOWER 0x02 | 69 | #define PIC_LOWER 0x02 |
69 | }; | 70 | }; |
70 | 71 | ||
72 | static unsigned long perf_event_encode(const struct perf_event_map *pmap) | ||
73 | { | ||
74 | return ((unsigned long) pmap->encoding << 16) | pmap->pic_mask; | ||
75 | } | ||
76 | |||
77 | static void perf_event_decode(unsigned long val, u16 *enc, u8 *msk) | ||
78 | { | ||
79 | *msk = val & 0xff; | ||
80 | *enc = val >> 16; | ||
81 | } | ||
82 | |||
83 | #define C(x) PERF_COUNT_HW_CACHE_##x | ||
84 | |||
85 | #define CACHE_OP_UNSUPPORTED 0xfffe | ||
86 | #define CACHE_OP_NONSENSE 0xffff | ||
87 | |||
88 | typedef struct perf_event_map cache_map_t | ||
89 | [PERF_COUNT_HW_CACHE_MAX] | ||
90 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
91 | [PERF_COUNT_HW_CACHE_RESULT_MAX]; | ||
92 | |||
71 | struct sparc_pmu { | 93 | struct sparc_pmu { |
72 | const struct perf_event_map *(*event_map)(int); | 94 | const struct perf_event_map *(*event_map)(int); |
95 | const cache_map_t *cache_map; | ||
73 | int max_events; | 96 | int max_events; |
74 | int upper_shift; | 97 | int upper_shift; |
75 | int lower_shift; | 98 | int lower_shift; |
@@ -80,21 +103,109 @@ struct sparc_pmu { | |||
80 | int lower_nop; | 103 | int lower_nop; |
81 | }; | 104 | }; |
82 | 105 | ||
83 | static const struct perf_event_map ultra3i_perfmon_event_map[] = { | 106 | static const struct perf_event_map ultra3_perfmon_event_map[] = { |
84 | [PERF_COUNT_HW_CPU_CYCLES] = { 0x0000, PIC_UPPER | PIC_LOWER }, | 107 | [PERF_COUNT_HW_CPU_CYCLES] = { 0x0000, PIC_UPPER | PIC_LOWER }, |
85 | [PERF_COUNT_HW_INSTRUCTIONS] = { 0x0001, PIC_UPPER | PIC_LOWER }, | 108 | [PERF_COUNT_HW_INSTRUCTIONS] = { 0x0001, PIC_UPPER | PIC_LOWER }, |
86 | [PERF_COUNT_HW_CACHE_REFERENCES] = { 0x0009, PIC_LOWER }, | 109 | [PERF_COUNT_HW_CACHE_REFERENCES] = { 0x0009, PIC_LOWER }, |
87 | [PERF_COUNT_HW_CACHE_MISSES] = { 0x0009, PIC_UPPER }, | 110 | [PERF_COUNT_HW_CACHE_MISSES] = { 0x0009, PIC_UPPER }, |
88 | }; | 111 | }; |
89 | 112 | ||
90 | static const struct perf_event_map *ultra3i_event_map(int event_id) | 113 | static const struct perf_event_map *ultra3_event_map(int event_id) |
91 | { | 114 | { |
92 | return &ultra3i_perfmon_event_map[event_id]; | 115 | return &ultra3_perfmon_event_map[event_id]; |
93 | } | 116 | } |
94 | 117 | ||
95 | static const struct sparc_pmu ultra3i_pmu = { | 118 | static const cache_map_t ultra3_cache_map = { |
96 | .event_map = ultra3i_event_map, | 119 | [C(L1D)] = { |
97 | .max_events = ARRAY_SIZE(ultra3i_perfmon_event_map), | 120 | [C(OP_READ)] = { |
121 | [C(RESULT_ACCESS)] = { 0x09, PIC_LOWER, }, | ||
122 | [C(RESULT_MISS)] = { 0x09, PIC_UPPER, }, | ||
123 | }, | ||
124 | [C(OP_WRITE)] = { | ||
125 | [C(RESULT_ACCESS)] = { 0x0a, PIC_LOWER }, | ||
126 | [C(RESULT_MISS)] = { 0x0a, PIC_UPPER }, | ||
127 | }, | ||
128 | [C(OP_PREFETCH)] = { | ||
129 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
130 | [C(RESULT_MISS)] = { CACHE_OP_UNSUPPORTED }, | ||
131 | }, | ||
132 | }, | ||
133 | [C(L1I)] = { | ||
134 | [C(OP_READ)] = { | ||
135 | [C(RESULT_ACCESS)] = { 0x09, PIC_LOWER, }, | ||
136 | [C(RESULT_MISS)] = { 0x09, PIC_UPPER, }, | ||
137 | }, | ||
138 | [ C(OP_WRITE) ] = { | ||
139 | [ C(RESULT_ACCESS) ] = { CACHE_OP_NONSENSE }, | ||
140 | [ C(RESULT_MISS) ] = { CACHE_OP_NONSENSE }, | ||
141 | }, | ||
142 | [ C(OP_PREFETCH) ] = { | ||
143 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
144 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
145 | }, | ||
146 | }, | ||
147 | [C(LL)] = { | ||
148 | [C(OP_READ)] = { | ||
149 | [C(RESULT_ACCESS)] = { 0x0c, PIC_LOWER, }, | ||
150 | [C(RESULT_MISS)] = { 0x0c, PIC_UPPER, }, | ||
151 | }, | ||
152 | [C(OP_WRITE)] = { | ||
153 | [C(RESULT_ACCESS)] = { 0x0c, PIC_LOWER }, | ||
154 | [C(RESULT_MISS)] = { 0x0c, PIC_UPPER }, | ||
155 | }, | ||
156 | [C(OP_PREFETCH)] = { | ||
157 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
158 | [C(RESULT_MISS)] = { CACHE_OP_UNSUPPORTED }, | ||
159 | }, | ||
160 | }, | ||
161 | [C(DTLB)] = { | ||
162 | [C(OP_READ)] = { | ||
163 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
164 | [C(RESULT_MISS)] = { 0x12, PIC_UPPER, }, | ||
165 | }, | ||
166 | [ C(OP_WRITE) ] = { | ||
167 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
168 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
169 | }, | ||
170 | [ C(OP_PREFETCH) ] = { | ||
171 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
172 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
173 | }, | ||
174 | }, | ||
175 | [C(ITLB)] = { | ||
176 | [C(OP_READ)] = { | ||
177 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
178 | [C(RESULT_MISS)] = { 0x11, PIC_UPPER, }, | ||
179 | }, | ||
180 | [ C(OP_WRITE) ] = { | ||
181 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
182 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
183 | }, | ||
184 | [ C(OP_PREFETCH) ] = { | ||
185 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
186 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
187 | }, | ||
188 | }, | ||
189 | [C(BPU)] = { | ||
190 | [C(OP_READ)] = { | ||
191 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
192 | [C(RESULT_MISS)] = { CACHE_OP_UNSUPPORTED }, | ||
193 | }, | ||
194 | [ C(OP_WRITE) ] = { | ||
195 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
196 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
197 | }, | ||
198 | [ C(OP_PREFETCH) ] = { | ||
199 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
200 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
201 | }, | ||
202 | }, | ||
203 | }; | ||
204 | |||
205 | static const struct sparc_pmu ultra3_pmu = { | ||
206 | .event_map = ultra3_event_map, | ||
207 | .cache_map = &ultra3_cache_map, | ||
208 | .max_events = ARRAY_SIZE(ultra3_perfmon_event_map), | ||
98 | .upper_shift = 11, | 209 | .upper_shift = 11, |
99 | .lower_shift = 4, | 210 | .lower_shift = 4, |
100 | .event_mask = 0x3f, | 211 | .event_mask = 0x3f, |
@@ -102,6 +213,121 @@ static const struct sparc_pmu ultra3i_pmu = { | |||
102 | .lower_nop = 0x14, | 213 | .lower_nop = 0x14, |
103 | }; | 214 | }; |
104 | 215 | ||
216 | /* Niagara1 is very limited. The upper PIC is hard-locked to count | ||
217 | * only instructions, so it is free running which creates all kinds of | ||
218 | * problems. Some hardware designs make one wonder if the creator | ||
219 | * even looked at how this stuff gets used by software. | ||
220 | */ | ||
221 | static const struct perf_event_map niagara1_perfmon_event_map[] = { | ||
222 | [PERF_COUNT_HW_CPU_CYCLES] = { 0x00, PIC_UPPER }, | ||
223 | [PERF_COUNT_HW_INSTRUCTIONS] = { 0x00, PIC_UPPER }, | ||
224 | [PERF_COUNT_HW_CACHE_REFERENCES] = { 0, PIC_NONE }, | ||
225 | [PERF_COUNT_HW_CACHE_MISSES] = { 0x03, PIC_LOWER }, | ||
226 | }; | ||
227 | |||
228 | static const struct perf_event_map *niagara1_event_map(int event_id) | ||
229 | { | ||
230 | return &niagara1_perfmon_event_map[event_id]; | ||
231 | } | ||
232 | |||
233 | static const cache_map_t niagara1_cache_map = { | ||
234 | [C(L1D)] = { | ||
235 | [C(OP_READ)] = { | ||
236 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
237 | [C(RESULT_MISS)] = { 0x03, PIC_LOWER, }, | ||
238 | }, | ||
239 | [C(OP_WRITE)] = { | ||
240 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
241 | [C(RESULT_MISS)] = { 0x03, PIC_LOWER, }, | ||
242 | }, | ||
243 | [C(OP_PREFETCH)] = { | ||
244 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
245 | [C(RESULT_MISS)] = { CACHE_OP_UNSUPPORTED }, | ||
246 | }, | ||
247 | }, | ||
248 | [C(L1I)] = { | ||
249 | [C(OP_READ)] = { | ||
250 | [C(RESULT_ACCESS)] = { 0x00, PIC_UPPER }, | ||
251 | [C(RESULT_MISS)] = { 0x02, PIC_LOWER, }, | ||
252 | }, | ||
253 | [ C(OP_WRITE) ] = { | ||
254 | [ C(RESULT_ACCESS) ] = { CACHE_OP_NONSENSE }, | ||
255 | [ C(RESULT_MISS) ] = { CACHE_OP_NONSENSE }, | ||
256 | }, | ||
257 | [ C(OP_PREFETCH) ] = { | ||
258 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
259 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
260 | }, | ||
261 | }, | ||
262 | [C(LL)] = { | ||
263 | [C(OP_READ)] = { | ||
264 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
265 | [C(RESULT_MISS)] = { 0x07, PIC_LOWER, }, | ||
266 | }, | ||
267 | [C(OP_WRITE)] = { | ||
268 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
269 | [C(RESULT_MISS)] = { 0x07, PIC_LOWER, }, | ||
270 | }, | ||
271 | [C(OP_PREFETCH)] = { | ||
272 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
273 | [C(RESULT_MISS)] = { CACHE_OP_UNSUPPORTED }, | ||
274 | }, | ||
275 | }, | ||
276 | [C(DTLB)] = { | ||
277 | [C(OP_READ)] = { | ||
278 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
279 | [C(RESULT_MISS)] = { 0x05, PIC_LOWER, }, | ||
280 | }, | ||
281 | [ C(OP_WRITE) ] = { | ||
282 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
283 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
284 | }, | ||
285 | [ C(OP_PREFETCH) ] = { | ||
286 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
287 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
288 | }, | ||
289 | }, | ||
290 | [C(ITLB)] = { | ||
291 | [C(OP_READ)] = { | ||
292 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
293 | [C(RESULT_MISS)] = { 0x04, PIC_LOWER, }, | ||
294 | }, | ||
295 | [ C(OP_WRITE) ] = { | ||
296 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
297 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
298 | }, | ||
299 | [ C(OP_PREFETCH) ] = { | ||
300 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
301 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
302 | }, | ||
303 | }, | ||
304 | [C(BPU)] = { | ||
305 | [C(OP_READ)] = { | ||
306 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
307 | [C(RESULT_MISS)] = { CACHE_OP_UNSUPPORTED }, | ||
308 | }, | ||
309 | [ C(OP_WRITE) ] = { | ||
310 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
311 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
312 | }, | ||
313 | [ C(OP_PREFETCH) ] = { | ||
314 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
315 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
316 | }, | ||
317 | }, | ||
318 | }; | ||
319 | |||
320 | static const struct sparc_pmu niagara1_pmu = { | ||
321 | .event_map = niagara1_event_map, | ||
322 | .cache_map = &niagara1_cache_map, | ||
323 | .max_events = ARRAY_SIZE(niagara1_perfmon_event_map), | ||
324 | .upper_shift = 0, | ||
325 | .lower_shift = 4, | ||
326 | .event_mask = 0x7, | ||
327 | .upper_nop = 0x0, | ||
328 | .lower_nop = 0x0, | ||
329 | }; | ||
330 | |||
105 | static const struct perf_event_map niagara2_perfmon_event_map[] = { | 331 | static const struct perf_event_map niagara2_perfmon_event_map[] = { |
106 | [PERF_COUNT_HW_CPU_CYCLES] = { 0x02ff, PIC_UPPER | PIC_LOWER }, | 332 | [PERF_COUNT_HW_CPU_CYCLES] = { 0x02ff, PIC_UPPER | PIC_LOWER }, |
107 | [PERF_COUNT_HW_INSTRUCTIONS] = { 0x02ff, PIC_UPPER | PIC_LOWER }, | 333 | [PERF_COUNT_HW_INSTRUCTIONS] = { 0x02ff, PIC_UPPER | PIC_LOWER }, |
@@ -116,14 +342,102 @@ static const struct perf_event_map *niagara2_event_map(int event_id) | |||
116 | return &niagara2_perfmon_event_map[event_id]; | 342 | return &niagara2_perfmon_event_map[event_id]; |
117 | } | 343 | } |
118 | 344 | ||
345 | static const cache_map_t niagara2_cache_map = { | ||
346 | [C(L1D)] = { | ||
347 | [C(OP_READ)] = { | ||
348 | [C(RESULT_ACCESS)] = { 0x0208, PIC_UPPER | PIC_LOWER, }, | ||
349 | [C(RESULT_MISS)] = { 0x0302, PIC_UPPER | PIC_LOWER, }, | ||
350 | }, | ||
351 | [C(OP_WRITE)] = { | ||
352 | [C(RESULT_ACCESS)] = { 0x0210, PIC_UPPER | PIC_LOWER, }, | ||
353 | [C(RESULT_MISS)] = { 0x0302, PIC_UPPER | PIC_LOWER, }, | ||
354 | }, | ||
355 | [C(OP_PREFETCH)] = { | ||
356 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
357 | [C(RESULT_MISS)] = { CACHE_OP_UNSUPPORTED }, | ||
358 | }, | ||
359 | }, | ||
360 | [C(L1I)] = { | ||
361 | [C(OP_READ)] = { | ||
362 | [C(RESULT_ACCESS)] = { 0x02ff, PIC_UPPER | PIC_LOWER, }, | ||
363 | [C(RESULT_MISS)] = { 0x0301, PIC_UPPER | PIC_LOWER, }, | ||
364 | }, | ||
365 | [ C(OP_WRITE) ] = { | ||
366 | [ C(RESULT_ACCESS) ] = { CACHE_OP_NONSENSE }, | ||
367 | [ C(RESULT_MISS) ] = { CACHE_OP_NONSENSE }, | ||
368 | }, | ||
369 | [ C(OP_PREFETCH) ] = { | ||
370 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
371 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
372 | }, | ||
373 | }, | ||
374 | [C(LL)] = { | ||
375 | [C(OP_READ)] = { | ||
376 | [C(RESULT_ACCESS)] = { 0x0208, PIC_UPPER | PIC_LOWER, }, | ||
377 | [C(RESULT_MISS)] = { 0x0330, PIC_UPPER | PIC_LOWER, }, | ||
378 | }, | ||
379 | [C(OP_WRITE)] = { | ||
380 | [C(RESULT_ACCESS)] = { 0x0210, PIC_UPPER | PIC_LOWER, }, | ||
381 | [C(RESULT_MISS)] = { 0x0320, PIC_UPPER | PIC_LOWER, }, | ||
382 | }, | ||
383 | [C(OP_PREFETCH)] = { | ||
384 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
385 | [C(RESULT_MISS)] = { CACHE_OP_UNSUPPORTED }, | ||
386 | }, | ||
387 | }, | ||
388 | [C(DTLB)] = { | ||
389 | [C(OP_READ)] = { | ||
390 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
391 | [C(RESULT_MISS)] = { 0x0b08, PIC_UPPER | PIC_LOWER, }, | ||
392 | }, | ||
393 | [ C(OP_WRITE) ] = { | ||
394 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
395 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
396 | }, | ||
397 | [ C(OP_PREFETCH) ] = { | ||
398 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
399 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
400 | }, | ||
401 | }, | ||
402 | [C(ITLB)] = { | ||
403 | [C(OP_READ)] = { | ||
404 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
405 | [C(RESULT_MISS)] = { 0xb04, PIC_UPPER | PIC_LOWER, }, | ||
406 | }, | ||
407 | [ C(OP_WRITE) ] = { | ||
408 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
409 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
410 | }, | ||
411 | [ C(OP_PREFETCH) ] = { | ||
412 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
413 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
414 | }, | ||
415 | }, | ||
416 | [C(BPU)] = { | ||
417 | [C(OP_READ)] = { | ||
418 | [C(RESULT_ACCESS)] = { CACHE_OP_UNSUPPORTED }, | ||
419 | [C(RESULT_MISS)] = { CACHE_OP_UNSUPPORTED }, | ||
420 | }, | ||
421 | [ C(OP_WRITE) ] = { | ||
422 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
423 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
424 | }, | ||
425 | [ C(OP_PREFETCH) ] = { | ||
426 | [ C(RESULT_ACCESS) ] = { CACHE_OP_UNSUPPORTED }, | ||
427 | [ C(RESULT_MISS) ] = { CACHE_OP_UNSUPPORTED }, | ||
428 | }, | ||
429 | }, | ||
430 | }; | ||
431 | |||
119 | static const struct sparc_pmu niagara2_pmu = { | 432 | static const struct sparc_pmu niagara2_pmu = { |
120 | .event_map = niagara2_event_map, | 433 | .event_map = niagara2_event_map, |
434 | .cache_map = &niagara2_cache_map, | ||
121 | .max_events = ARRAY_SIZE(niagara2_perfmon_event_map), | 435 | .max_events = ARRAY_SIZE(niagara2_perfmon_event_map), |
122 | .upper_shift = 19, | 436 | .upper_shift = 19, |
123 | .lower_shift = 6, | 437 | .lower_shift = 6, |
124 | .event_mask = 0xfff, | 438 | .event_mask = 0xfff, |
125 | .hv_bit = 0x8, | 439 | .hv_bit = 0x8, |
126 | .irq_bit = 0x03, | 440 | .irq_bit = 0x30, |
127 | .upper_nop = 0x220, | 441 | .upper_nop = 0x220, |
128 | .lower_nop = 0x220, | 442 | .lower_nop = 0x220, |
129 | }; | 443 | }; |
@@ -151,23 +465,30 @@ static u64 nop_for_index(int idx) | |||
151 | sparc_pmu->lower_nop, idx); | 465 | sparc_pmu->lower_nop, idx); |
152 | } | 466 | } |
153 | 467 | ||
154 | static inline void sparc_pmu_enable_event(struct hw_perf_event *hwc, | 468 | static inline void sparc_pmu_enable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx) |
155 | int idx) | ||
156 | { | 469 | { |
157 | u64 val, mask = mask_for_index(idx); | 470 | u64 val, mask = mask_for_index(idx); |
158 | 471 | ||
159 | val = pcr_ops->read(); | 472 | val = cpuc->pcr; |
160 | pcr_ops->write((val & ~mask) | hwc->config); | 473 | val &= ~mask; |
474 | val |= hwc->config; | ||
475 | cpuc->pcr = val; | ||
476 | |||
477 | pcr_ops->write(cpuc->pcr); | ||
161 | } | 478 | } |
162 | 479 | ||
163 | static inline void sparc_pmu_disable_event(struct hw_perf_event *hwc, | 480 | static inline void sparc_pmu_disable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx) |
164 | int idx) | ||
165 | { | 481 | { |
166 | u64 mask = mask_for_index(idx); | 482 | u64 mask = mask_for_index(idx); |
167 | u64 nop = nop_for_index(idx); | 483 | u64 nop = nop_for_index(idx); |
168 | u64 val = pcr_ops->read(); | 484 | u64 val; |
169 | 485 | ||
170 | pcr_ops->write((val & ~mask) | nop); | 486 | val = cpuc->pcr; |
487 | val &= ~mask; | ||
488 | val |= nop; | ||
489 | cpuc->pcr = val; | ||
490 | |||
491 | pcr_ops->write(cpuc->pcr); | ||
171 | } | 492 | } |
172 | 493 | ||
173 | void hw_perf_enable(void) | 494 | void hw_perf_enable(void) |
@@ -182,7 +503,7 @@ void hw_perf_enable(void) | |||
182 | cpuc->enabled = 1; | 503 | cpuc->enabled = 1; |
183 | barrier(); | 504 | barrier(); |
184 | 505 | ||
185 | val = pcr_ops->read(); | 506 | val = cpuc->pcr; |
186 | 507 | ||
187 | for (i = 0; i < MAX_HWEVENTS; i++) { | 508 | for (i = 0; i < MAX_HWEVENTS; i++) { |
188 | struct perf_event *cp = cpuc->events[i]; | 509 | struct perf_event *cp = cpuc->events[i]; |
@@ -194,7 +515,9 @@ void hw_perf_enable(void) | |||
194 | val |= hwc->config_base; | 515 | val |= hwc->config_base; |
195 | } | 516 | } |
196 | 517 | ||
197 | pcr_ops->write(val); | 518 | cpuc->pcr = val; |
519 | |||
520 | pcr_ops->write(cpuc->pcr); | ||
198 | } | 521 | } |
199 | 522 | ||
200 | void hw_perf_disable(void) | 523 | void hw_perf_disable(void) |
@@ -207,10 +530,12 @@ void hw_perf_disable(void) | |||
207 | 530 | ||
208 | cpuc->enabled = 0; | 531 | cpuc->enabled = 0; |
209 | 532 | ||
210 | val = pcr_ops->read(); | 533 | val = cpuc->pcr; |
211 | val &= ~(PCR_UTRACE | PCR_STRACE | | 534 | val &= ~(PCR_UTRACE | PCR_STRACE | |
212 | sparc_pmu->hv_bit | sparc_pmu->irq_bit); | 535 | sparc_pmu->hv_bit | sparc_pmu->irq_bit); |
213 | pcr_ops->write(val); | 536 | cpuc->pcr = val; |
537 | |||
538 | pcr_ops->write(cpuc->pcr); | ||
214 | } | 539 | } |
215 | 540 | ||
216 | static u32 read_pmc(int idx) | 541 | static u32 read_pmc(int idx) |
@@ -242,7 +567,7 @@ static void write_pmc(int idx, u64 val) | |||
242 | } | 567 | } |
243 | 568 | ||
244 | static int sparc_perf_event_set_period(struct perf_event *event, | 569 | static int sparc_perf_event_set_period(struct perf_event *event, |
245 | struct hw_perf_event *hwc, int idx) | 570 | struct hw_perf_event *hwc, int idx) |
246 | { | 571 | { |
247 | s64 left = atomic64_read(&hwc->period_left); | 572 | s64 left = atomic64_read(&hwc->period_left); |
248 | s64 period = hwc->sample_period; | 573 | s64 period = hwc->sample_period; |
@@ -282,19 +607,19 @@ static int sparc_pmu_enable(struct perf_event *event) | |||
282 | if (test_and_set_bit(idx, cpuc->used_mask)) | 607 | if (test_and_set_bit(idx, cpuc->used_mask)) |
283 | return -EAGAIN; | 608 | return -EAGAIN; |
284 | 609 | ||
285 | sparc_pmu_disable_event(hwc, idx); | 610 | sparc_pmu_disable_event(cpuc, hwc, idx); |
286 | 611 | ||
287 | cpuc->events[idx] = event; | 612 | cpuc->events[idx] = event; |
288 | set_bit(idx, cpuc->active_mask); | 613 | set_bit(idx, cpuc->active_mask); |
289 | 614 | ||
290 | sparc_perf_event_set_period(event, hwc, idx); | 615 | sparc_perf_event_set_period(event, hwc, idx); |
291 | sparc_pmu_enable_event(hwc, idx); | 616 | sparc_pmu_enable_event(cpuc, hwc, idx); |
292 | perf_event_update_userpage(event); | 617 | perf_event_update_userpage(event); |
293 | return 0; | 618 | return 0; |
294 | } | 619 | } |
295 | 620 | ||
296 | static u64 sparc_perf_event_update(struct perf_event *event, | 621 | static u64 sparc_perf_event_update(struct perf_event *event, |
297 | struct hw_perf_event *hwc, int idx) | 622 | struct hw_perf_event *hwc, int idx) |
298 | { | 623 | { |
299 | int shift = 64 - 32; | 624 | int shift = 64 - 32; |
300 | u64 prev_raw_count, new_raw_count; | 625 | u64 prev_raw_count, new_raw_count; |
@@ -324,7 +649,7 @@ static void sparc_pmu_disable(struct perf_event *event) | |||
324 | int idx = hwc->idx; | 649 | int idx = hwc->idx; |
325 | 650 | ||
326 | clear_bit(idx, cpuc->active_mask); | 651 | clear_bit(idx, cpuc->active_mask); |
327 | sparc_pmu_disable_event(hwc, idx); | 652 | sparc_pmu_disable_event(cpuc, hwc, idx); |
328 | 653 | ||
329 | barrier(); | 654 | barrier(); |
330 | 655 | ||
@@ -338,18 +663,29 @@ static void sparc_pmu_disable(struct perf_event *event) | |||
338 | static void sparc_pmu_read(struct perf_event *event) | 663 | static void sparc_pmu_read(struct perf_event *event) |
339 | { | 664 | { |
340 | struct hw_perf_event *hwc = &event->hw; | 665 | struct hw_perf_event *hwc = &event->hw; |
666 | |||
341 | sparc_perf_event_update(event, hwc, hwc->idx); | 667 | sparc_perf_event_update(event, hwc, hwc->idx); |
342 | } | 668 | } |
343 | 669 | ||
344 | static void sparc_pmu_unthrottle(struct perf_event *event) | 670 | static void sparc_pmu_unthrottle(struct perf_event *event) |
345 | { | 671 | { |
672 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
346 | struct hw_perf_event *hwc = &event->hw; | 673 | struct hw_perf_event *hwc = &event->hw; |
347 | sparc_pmu_enable_event(hwc, hwc->idx); | 674 | |
675 | sparc_pmu_enable_event(cpuc, hwc, hwc->idx); | ||
348 | } | 676 | } |
349 | 677 | ||
350 | static atomic_t active_events = ATOMIC_INIT(0); | 678 | static atomic_t active_events = ATOMIC_INIT(0); |
351 | static DEFINE_MUTEX(pmc_grab_mutex); | 679 | static DEFINE_MUTEX(pmc_grab_mutex); |
352 | 680 | ||
681 | static void perf_stop_nmi_watchdog(void *unused) | ||
682 | { | ||
683 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
684 | |||
685 | stop_nmi_watchdog(NULL); | ||
686 | cpuc->pcr = pcr_ops->read(); | ||
687 | } | ||
688 | |||
353 | void perf_event_grab_pmc(void) | 689 | void perf_event_grab_pmc(void) |
354 | { | 690 | { |
355 | if (atomic_inc_not_zero(&active_events)) | 691 | if (atomic_inc_not_zero(&active_events)) |
@@ -358,7 +694,7 @@ void perf_event_grab_pmc(void) | |||
358 | mutex_lock(&pmc_grab_mutex); | 694 | mutex_lock(&pmc_grab_mutex); |
359 | if (atomic_read(&active_events) == 0) { | 695 | if (atomic_read(&active_events) == 0) { |
360 | if (atomic_read(&nmi_active) > 0) { | 696 | if (atomic_read(&nmi_active) > 0) { |
361 | on_each_cpu(stop_nmi_watchdog, NULL, 1); | 697 | on_each_cpu(perf_stop_nmi_watchdog, NULL, 1); |
362 | BUG_ON(atomic_read(&nmi_active) != 0); | 698 | BUG_ON(atomic_read(&nmi_active) != 0); |
363 | } | 699 | } |
364 | atomic_inc(&active_events); | 700 | atomic_inc(&active_events); |
@@ -375,30 +711,160 @@ void perf_event_release_pmc(void) | |||
375 | } | 711 | } |
376 | } | 712 | } |
377 | 713 | ||
714 | static const struct perf_event_map *sparc_map_cache_event(u64 config) | ||
715 | { | ||
716 | unsigned int cache_type, cache_op, cache_result; | ||
717 | const struct perf_event_map *pmap; | ||
718 | |||
719 | if (!sparc_pmu->cache_map) | ||
720 | return ERR_PTR(-ENOENT); | ||
721 | |||
722 | cache_type = (config >> 0) & 0xff; | ||
723 | if (cache_type >= PERF_COUNT_HW_CACHE_MAX) | ||
724 | return ERR_PTR(-EINVAL); | ||
725 | |||
726 | cache_op = (config >> 8) & 0xff; | ||
727 | if (cache_op >= PERF_COUNT_HW_CACHE_OP_MAX) | ||
728 | return ERR_PTR(-EINVAL); | ||
729 | |||
730 | cache_result = (config >> 16) & 0xff; | ||
731 | if (cache_result >= PERF_COUNT_HW_CACHE_RESULT_MAX) | ||
732 | return ERR_PTR(-EINVAL); | ||
733 | |||
734 | pmap = &((*sparc_pmu->cache_map)[cache_type][cache_op][cache_result]); | ||
735 | |||
736 | if (pmap->encoding == CACHE_OP_UNSUPPORTED) | ||
737 | return ERR_PTR(-ENOENT); | ||
738 | |||
739 | if (pmap->encoding == CACHE_OP_NONSENSE) | ||
740 | return ERR_PTR(-EINVAL); | ||
741 | |||
742 | return pmap; | ||
743 | } | ||
744 | |||
378 | static void hw_perf_event_destroy(struct perf_event *event) | 745 | static void hw_perf_event_destroy(struct perf_event *event) |
379 | { | 746 | { |
380 | perf_event_release_pmc(); | 747 | perf_event_release_pmc(); |
381 | } | 748 | } |
382 | 749 | ||
750 | /* Make sure all events can be scheduled into the hardware at | ||
751 | * the same time. This is simplified by the fact that we only | ||
752 | * need to support 2 simultaneous HW events. | ||
753 | */ | ||
754 | static int sparc_check_constraints(unsigned long *events, int n_ev) | ||
755 | { | ||
756 | if (n_ev <= perf_max_events) { | ||
757 | u8 msk1, msk2; | ||
758 | u16 dummy; | ||
759 | |||
760 | if (n_ev == 1) | ||
761 | return 0; | ||
762 | BUG_ON(n_ev != 2); | ||
763 | perf_event_decode(events[0], &dummy, &msk1); | ||
764 | perf_event_decode(events[1], &dummy, &msk2); | ||
765 | |||
766 | /* If both events can go on any counter, OK. */ | ||
767 | if (msk1 == (PIC_UPPER | PIC_LOWER) && | ||
768 | msk2 == (PIC_UPPER | PIC_LOWER)) | ||
769 | return 0; | ||
770 | |||
771 | /* If one event is limited to a specific counter, | ||
772 | * and the other can go on both, OK. | ||
773 | */ | ||
774 | if ((msk1 == PIC_UPPER || msk1 == PIC_LOWER) && | ||
775 | msk2 == (PIC_UPPER | PIC_LOWER)) | ||
776 | return 0; | ||
777 | if ((msk2 == PIC_UPPER || msk2 == PIC_LOWER) && | ||
778 | msk1 == (PIC_UPPER | PIC_LOWER)) | ||
779 | return 0; | ||
780 | |||
781 | /* If the events are fixed to different counters, OK. */ | ||
782 | if ((msk1 == PIC_UPPER && msk2 == PIC_LOWER) || | ||
783 | (msk1 == PIC_LOWER && msk2 == PIC_UPPER)) | ||
784 | return 0; | ||
785 | |||
786 | /* Otherwise, there is a conflict. */ | ||
787 | } | ||
788 | |||
789 | return -1; | ||
790 | } | ||
791 | |||
792 | static int check_excludes(struct perf_event **evts, int n_prev, int n_new) | ||
793 | { | ||
794 | int eu = 0, ek = 0, eh = 0; | ||
795 | struct perf_event *event; | ||
796 | int i, n, first; | ||
797 | |||
798 | n = n_prev + n_new; | ||
799 | if (n <= 1) | ||
800 | return 0; | ||
801 | |||
802 | first = 1; | ||
803 | for (i = 0; i < n; i++) { | ||
804 | event = evts[i]; | ||
805 | if (first) { | ||
806 | eu = event->attr.exclude_user; | ||
807 | ek = event->attr.exclude_kernel; | ||
808 | eh = event->attr.exclude_hv; | ||
809 | first = 0; | ||
810 | } else if (event->attr.exclude_user != eu || | ||
811 | event->attr.exclude_kernel != ek || | ||
812 | event->attr.exclude_hv != eh) { | ||
813 | return -EAGAIN; | ||
814 | } | ||
815 | } | ||
816 | |||
817 | return 0; | ||
818 | } | ||
819 | |||
820 | static int collect_events(struct perf_event *group, int max_count, | ||
821 | struct perf_event *evts[], unsigned long *events) | ||
822 | { | ||
823 | struct perf_event *event; | ||
824 | int n = 0; | ||
825 | |||
826 | if (!is_software_event(group)) { | ||
827 | if (n >= max_count) | ||
828 | return -1; | ||
829 | evts[n] = group; | ||
830 | events[n++] = group->hw.event_base; | ||
831 | } | ||
832 | list_for_each_entry(event, &group->sibling_list, group_entry) { | ||
833 | if (!is_software_event(event) && | ||
834 | event->state != PERF_EVENT_STATE_OFF) { | ||
835 | if (n >= max_count) | ||
836 | return -1; | ||
837 | evts[n] = event; | ||
838 | events[n++] = event->hw.event_base; | ||
839 | } | ||
840 | } | ||
841 | return n; | ||
842 | } | ||
843 | |||
383 | static int __hw_perf_event_init(struct perf_event *event) | 844 | static int __hw_perf_event_init(struct perf_event *event) |
384 | { | 845 | { |
385 | struct perf_event_attr *attr = &event->attr; | 846 | struct perf_event_attr *attr = &event->attr; |
847 | struct perf_event *evts[MAX_HWEVENTS]; | ||
386 | struct hw_perf_event *hwc = &event->hw; | 848 | struct hw_perf_event *hwc = &event->hw; |
849 | unsigned long events[MAX_HWEVENTS]; | ||
387 | const struct perf_event_map *pmap; | 850 | const struct perf_event_map *pmap; |
388 | u64 enc; | 851 | u64 enc; |
852 | int n; | ||
389 | 853 | ||
390 | if (atomic_read(&nmi_active) < 0) | 854 | if (atomic_read(&nmi_active) < 0) |
391 | return -ENODEV; | 855 | return -ENODEV; |
392 | 856 | ||
393 | if (attr->type != PERF_TYPE_HARDWARE) | 857 | if (attr->type == PERF_TYPE_HARDWARE) { |
858 | if (attr->config >= sparc_pmu->max_events) | ||
859 | return -EINVAL; | ||
860 | pmap = sparc_pmu->event_map(attr->config); | ||
861 | } else if (attr->type == PERF_TYPE_HW_CACHE) { | ||
862 | pmap = sparc_map_cache_event(attr->config); | ||
863 | if (IS_ERR(pmap)) | ||
864 | return PTR_ERR(pmap); | ||
865 | } else | ||
394 | return -EOPNOTSUPP; | 866 | return -EOPNOTSUPP; |
395 | 867 | ||
396 | if (attr->config >= sparc_pmu->max_events) | ||
397 | return -EINVAL; | ||
398 | |||
399 | perf_event_grab_pmc(); | ||
400 | event->destroy = hw_perf_event_destroy; | ||
401 | |||
402 | /* We save the enable bits in the config_base. So to | 868 | /* We save the enable bits in the config_base. So to |
403 | * turn off sampling just write 'config', and to enable | 869 | * turn off sampling just write 'config', and to enable |
404 | * things write 'config | config_base'. | 870 | * things write 'config | config_base'. |
@@ -411,15 +877,39 @@ static int __hw_perf_event_init(struct perf_event *event) | |||
411 | if (!attr->exclude_hv) | 877 | if (!attr->exclude_hv) |
412 | hwc->config_base |= sparc_pmu->hv_bit; | 878 | hwc->config_base |= sparc_pmu->hv_bit; |
413 | 879 | ||
880 | hwc->event_base = perf_event_encode(pmap); | ||
881 | |||
882 | enc = pmap->encoding; | ||
883 | |||
884 | n = 0; | ||
885 | if (event->group_leader != event) { | ||
886 | n = collect_events(event->group_leader, | ||
887 | perf_max_events - 1, | ||
888 | evts, events); | ||
889 | if (n < 0) | ||
890 | return -EINVAL; | ||
891 | } | ||
892 | events[n] = hwc->event_base; | ||
893 | evts[n] = event; | ||
894 | |||
895 | if (check_excludes(evts, n, 1)) | ||
896 | return -EINVAL; | ||
897 | |||
898 | if (sparc_check_constraints(events, n + 1)) | ||
899 | return -EINVAL; | ||
900 | |||
901 | /* Try to do all error checking before this point, as unwinding | ||
902 | * state after grabbing the PMC is difficult. | ||
903 | */ | ||
904 | perf_event_grab_pmc(); | ||
905 | event->destroy = hw_perf_event_destroy; | ||
906 | |||
414 | if (!hwc->sample_period) { | 907 | if (!hwc->sample_period) { |
415 | hwc->sample_period = MAX_PERIOD; | 908 | hwc->sample_period = MAX_PERIOD; |
416 | hwc->last_period = hwc->sample_period; | 909 | hwc->last_period = hwc->sample_period; |
417 | atomic64_set(&hwc->period_left, hwc->sample_period); | 910 | atomic64_set(&hwc->period_left, hwc->sample_period); |
418 | } | 911 | } |
419 | 912 | ||
420 | pmap = sparc_pmu->event_map(attr->config); | ||
421 | |||
422 | enc = pmap->encoding; | ||
423 | if (pmap->pic_mask & PIC_UPPER) { | 913 | if (pmap->pic_mask & PIC_UPPER) { |
424 | hwc->idx = PIC_UPPER_INDEX; | 914 | hwc->idx = PIC_UPPER_INDEX; |
425 | enc <<= sparc_pmu->upper_shift; | 915 | enc <<= sparc_pmu->upper_shift; |
@@ -472,7 +962,7 @@ void perf_event_print_debug(void) | |||
472 | } | 962 | } |
473 | 963 | ||
474 | static int __kprobes perf_event_nmi_handler(struct notifier_block *self, | 964 | static int __kprobes perf_event_nmi_handler(struct notifier_block *self, |
475 | unsigned long cmd, void *__args) | 965 | unsigned long cmd, void *__args) |
476 | { | 966 | { |
477 | struct die_args *args = __args; | 967 | struct die_args *args = __args; |
478 | struct perf_sample_data data; | 968 | struct perf_sample_data data; |
@@ -513,7 +1003,7 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self, | |||
513 | continue; | 1003 | continue; |
514 | 1004 | ||
515 | if (perf_event_overflow(event, 1, &data, regs)) | 1005 | if (perf_event_overflow(event, 1, &data, regs)) |
516 | sparc_pmu_disable_event(hwc, idx); | 1006 | sparc_pmu_disable_event(cpuc, hwc, idx); |
517 | } | 1007 | } |
518 | 1008 | ||
519 | return NOTIFY_STOP; | 1009 | return NOTIFY_STOP; |
@@ -525,8 +1015,15 @@ static __read_mostly struct notifier_block perf_event_nmi_notifier = { | |||
525 | 1015 | ||
526 | static bool __init supported_pmu(void) | 1016 | static bool __init supported_pmu(void) |
527 | { | 1017 | { |
528 | if (!strcmp(sparc_pmu_type, "ultra3i")) { | 1018 | if (!strcmp(sparc_pmu_type, "ultra3") || |
529 | sparc_pmu = &ultra3i_pmu; | 1019 | !strcmp(sparc_pmu_type, "ultra3+") || |
1020 | !strcmp(sparc_pmu_type, "ultra3i") || | ||
1021 | !strcmp(sparc_pmu_type, "ultra4+")) { | ||
1022 | sparc_pmu = &ultra3_pmu; | ||
1023 | return true; | ||
1024 | } | ||
1025 | if (!strcmp(sparc_pmu_type, "niagara")) { | ||
1026 | sparc_pmu = &niagara1_pmu; | ||
530 | return true; | 1027 | return true; |
531 | } | 1028 | } |
532 | if (!strcmp(sparc_pmu_type, "niagara2")) { | 1029 | if (!strcmp(sparc_pmu_type, "niagara2")) { |
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 138910c67206..d80a65d9e893 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c | |||
@@ -79,6 +79,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len | |||
79 | 79 | ||
80 | err = -ENODEV; | 80 | err = -ENODEV; |
81 | 81 | ||
82 | mutex_lock(&of_set_property_mutex); | ||
82 | write_lock(&devtree_lock); | 83 | write_lock(&devtree_lock); |
83 | prevp = &dp->properties; | 84 | prevp = &dp->properties; |
84 | while (*prevp) { | 85 | while (*prevp) { |
@@ -88,9 +89,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len | |||
88 | void *old_val = prop->value; | 89 | void *old_val = prop->value; |
89 | int ret; | 90 | int ret; |
90 | 91 | ||
91 | mutex_lock(&of_set_property_mutex); | ||
92 | ret = prom_setprop(dp->node, name, val, len); | 92 | ret = prom_setprop(dp->node, name, val, len); |
93 | mutex_unlock(&of_set_property_mutex); | ||
94 | 93 | ||
95 | err = -EINVAL; | 94 | err = -EINVAL; |
96 | if (ret >= 0) { | 95 | if (ret >= 0) { |
@@ -109,6 +108,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len | |||
109 | prevp = &(*prevp)->next; | 108 | prevp = &(*prevp)->next; |
110 | } | 109 | } |
111 | write_unlock(&devtree_lock); | 110 | write_unlock(&devtree_lock); |
111 | mutex_unlock(&of_set_property_mutex); | ||
112 | 112 | ||
113 | /* XXX Upate procfs if necessary... */ | 113 | /* XXX Upate procfs if necessary... */ |
114 | 114 | ||
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c index 4ae91dc2feb9..2f6524d1a817 100644 --- a/arch/sparc/kernel/ptrace_64.c +++ b/arch/sparc/kernel/ptrace_64.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/signal.h> | 23 | #include <linux/signal.h> |
24 | #include <linux/regset.h> | 24 | #include <linux/regset.h> |
25 | #include <linux/tracehook.h> | 25 | #include <linux/tracehook.h> |
26 | #include <trace/syscall.h> | ||
26 | #include <linux/compat.h> | 27 | #include <linux/compat.h> |
27 | #include <linux/elf.h> | 28 | #include <linux/elf.h> |
28 | 29 | ||
@@ -37,6 +38,9 @@ | |||
37 | #include <asm/cpudata.h> | 38 | #include <asm/cpudata.h> |
38 | #include <asm/cacheflush.h> | 39 | #include <asm/cacheflush.h> |
39 | 40 | ||
41 | #define CREATE_TRACE_POINTS | ||
42 | #include <trace/events/syscalls.h> | ||
43 | |||
40 | #include "entry.h" | 44 | #include "entry.h" |
41 | 45 | ||
42 | /* #define ALLOW_INIT_TRACING */ | 46 | /* #define ALLOW_INIT_TRACING */ |
@@ -1059,6 +1063,9 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs) | |||
1059 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 1063 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
1060 | ret = tracehook_report_syscall_entry(regs); | 1064 | ret = tracehook_report_syscall_entry(regs); |
1061 | 1065 | ||
1066 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) | ||
1067 | trace_sys_enter(regs, regs->u_regs[UREG_G1]); | ||
1068 | |||
1062 | if (unlikely(current->audit_context) && !ret) | 1069 | if (unlikely(current->audit_context) && !ret) |
1063 | audit_syscall_entry((test_thread_flag(TIF_32BIT) ? | 1070 | audit_syscall_entry((test_thread_flag(TIF_32BIT) ? |
1064 | AUDIT_ARCH_SPARC : | 1071 | AUDIT_ARCH_SPARC : |
@@ -1084,6 +1091,9 @@ asmlinkage void syscall_trace_leave(struct pt_regs *regs) | |||
1084 | audit_syscall_exit(result, regs->u_regs[UREG_I0]); | 1091 | audit_syscall_exit(result, regs->u_regs[UREG_I0]); |
1085 | } | 1092 | } |
1086 | 1093 | ||
1094 | if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) | ||
1095 | trace_sys_exit(regs, regs->u_regs[UREG_G1]); | ||
1096 | |||
1087 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 1097 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
1088 | tracehook_report_syscall_exit(regs, 0); | 1098 | tracehook_report_syscall_exit(regs, 0); |
1089 | } | 1099 | } |
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index 21180339cb09..a2a79e76344f 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/setup.h> | 46 | #include <asm/setup.h> |
47 | #include <asm/mmu.h> | 47 | #include <asm/mmu.h> |
48 | #include <asm/ns87303.h> | 48 | #include <asm/ns87303.h> |
49 | #include <asm/btext.h> | ||
49 | 50 | ||
50 | #ifdef CONFIG_IP_PNP | 51 | #ifdef CONFIG_IP_PNP |
51 | #include <net/ipconfig.h> | 52 | #include <net/ipconfig.h> |
@@ -286,7 +287,10 @@ void __init setup_arch(char **cmdline_p) | |||
286 | parse_early_param(); | 287 | parse_early_param(); |
287 | 288 | ||
288 | boot_flags_init(*cmdline_p); | 289 | boot_flags_init(*cmdline_p); |
289 | register_console(&prom_early_console); | 290 | #ifdef CONFIG_EARLYFB |
291 | if (btext_find_display()) | ||
292 | #endif | ||
293 | register_console(&prom_early_console); | ||
290 | 294 | ||
291 | if (tlb_type == hypervisor) | 295 | if (tlb_type == hypervisor) |
292 | printk("ARCH: SUN4V\n"); | 296 | printk("ARCH: SUN4V\n"); |
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c index 132d81fb2616..91c10fb70858 100644 --- a/arch/sparc/kernel/smp_32.c +++ b/arch/sparc/kernel/smp_32.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/cacheflush.h> | 32 | #include <asm/cacheflush.h> |
33 | #include <asm/tlbflush.h> | 33 | #include <asm/tlbflush.h> |
34 | #include <asm/cpudata.h> | 34 | #include <asm/cpudata.h> |
35 | #include <asm/leon.h> | ||
35 | 36 | ||
36 | #include "irq.h" | 37 | #include "irq.h" |
37 | 38 | ||
@@ -96,6 +97,9 @@ void __init smp_cpus_done(unsigned int max_cpus) | |||
96 | case sun4d: | 97 | case sun4d: |
97 | smp4d_smp_done(); | 98 | smp4d_smp_done(); |
98 | break; | 99 | break; |
100 | case sparc_leon: | ||
101 | leon_smp_done(); | ||
102 | break; | ||
99 | case sun4e: | 103 | case sun4e: |
100 | printk("SUN4E\n"); | 104 | printk("SUN4E\n"); |
101 | BUG(); | 105 | BUG(); |
@@ -306,6 +310,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
306 | case sun4d: | 310 | case sun4d: |
307 | smp4d_boot_cpus(); | 311 | smp4d_boot_cpus(); |
308 | break; | 312 | break; |
313 | case sparc_leon: | ||
314 | leon_boot_cpus(); | ||
315 | break; | ||
309 | case sun4e: | 316 | case sun4e: |
310 | printk("SUN4E\n"); | 317 | printk("SUN4E\n"); |
311 | BUG(); | 318 | BUG(); |
@@ -376,6 +383,9 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
376 | case sun4d: | 383 | case sun4d: |
377 | ret = smp4d_boot_one_cpu(cpu); | 384 | ret = smp4d_boot_one_cpu(cpu); |
378 | break; | 385 | break; |
386 | case sparc_leon: | ||
387 | ret = leon_boot_one_cpu(cpu); | ||
388 | break; | ||
379 | case sun4e: | 389 | case sun4e: |
380 | printk("SUN4E\n"); | 390 | printk("SUN4E\n"); |
381 | BUG(); | 391 | BUG(); |
diff --git a/arch/sparc/kernel/sparc_ksyms_64.c b/arch/sparc/kernel/sparc_ksyms_64.c index 0f26066a08d9..372ad59c4cba 100644 --- a/arch/sparc/kernel/sparc_ksyms_64.c +++ b/arch/sparc/kernel/sparc_ksyms_64.c | |||
@@ -38,17 +38,5 @@ EXPORT_SYMBOL(sun4v_niagara_setperf); | |||
38 | EXPORT_SYMBOL(sun4v_niagara2_getperf); | 38 | EXPORT_SYMBOL(sun4v_niagara2_getperf); |
39 | EXPORT_SYMBOL(sun4v_niagara2_setperf); | 39 | EXPORT_SYMBOL(sun4v_niagara2_setperf); |
40 | 40 | ||
41 | #ifdef CONFIG_PCI | ||
42 | /* inline functions in asm/pci_64.h */ | ||
43 | EXPORT_SYMBOL(pci_alloc_consistent); | ||
44 | EXPORT_SYMBOL(pci_free_consistent); | ||
45 | EXPORT_SYMBOL(pci_map_single); | ||
46 | EXPORT_SYMBOL(pci_unmap_single); | ||
47 | EXPORT_SYMBOL(pci_map_sg); | ||
48 | EXPORT_SYMBOL(pci_unmap_sg); | ||
49 | EXPORT_SYMBOL(pci_dma_sync_single_for_cpu); | ||
50 | EXPORT_SYMBOL(pci_dma_sync_sg_for_cpu); | ||
51 | #endif | ||
52 | |||
53 | /* Exporting a symbol from /init/main.c */ | 41 | /* Exporting a symbol from /init/main.c */ |
54 | EXPORT_SYMBOL(saved_command_line); | 42 | EXPORT_SYMBOL(saved_command_line); |
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c index 04e28b2671c8..dc0ac197e7e2 100644 --- a/arch/sparc/kernel/sys_sparc32.c +++ b/arch/sparc/kernel/sys_sparc32.c | |||
@@ -26,11 +26,6 @@ | |||
26 | #include <linux/nfs_fs.h> | 26 | #include <linux/nfs_fs.h> |
27 | #include <linux/quota.h> | 27 | #include <linux/quota.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/sunrpc/svc.h> | ||
30 | #include <linux/nfsd/nfsd.h> | ||
31 | #include <linux/nfsd/cache.h> | ||
32 | #include <linux/nfsd/xdr.h> | ||
33 | #include <linux/nfsd/syscall.h> | ||
34 | #include <linux/poll.h> | 29 | #include <linux/poll.h> |
35 | #include <linux/personality.h> | 30 | #include <linux/personality.h> |
36 | #include <linux/stat.h> | 31 | #include <linux/stat.h> |
@@ -569,85 +564,6 @@ asmlinkage long sparc32_open(const char __user *filename, | |||
569 | return do_sys_open(AT_FDCWD, filename, flags, mode); | 564 | return do_sys_open(AT_FDCWD, filename, flags, mode); |
570 | } | 565 | } |
571 | 566 | ||
572 | extern unsigned long do_mremap(unsigned long addr, | ||
573 | unsigned long old_len, unsigned long new_len, | ||
574 | unsigned long flags, unsigned long new_addr); | ||
575 | |||
576 | asmlinkage unsigned long sys32_mremap(unsigned long addr, | ||
577 | unsigned long old_len, unsigned long new_len, | ||
578 | unsigned long flags, u32 __new_addr) | ||
579 | { | ||
580 | unsigned long ret = -EINVAL; | ||
581 | unsigned long new_addr = __new_addr; | ||
582 | |||
583 | if (unlikely(sparc_mmap_check(addr, old_len))) | ||
584 | goto out; | ||
585 | if (unlikely(sparc_mmap_check(new_addr, new_len))) | ||
586 | goto out; | ||
587 | down_write(¤t->mm->mmap_sem); | ||
588 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); | ||
589 | up_write(¤t->mm->mmap_sem); | ||
590 | out: | ||
591 | return ret; | ||
592 | } | ||
593 | |||
594 | struct __sysctl_args32 { | ||
595 | u32 name; | ||
596 | int nlen; | ||
597 | u32 oldval; | ||
598 | u32 oldlenp; | ||
599 | u32 newval; | ||
600 | u32 newlen; | ||
601 | u32 __unused[4]; | ||
602 | }; | ||
603 | |||
604 | asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) | ||
605 | { | ||
606 | #ifndef CONFIG_SYSCTL_SYSCALL | ||
607 | return -ENOSYS; | ||
608 | #else | ||
609 | struct __sysctl_args32 tmp; | ||
610 | int error; | ||
611 | size_t oldlen, __user *oldlenp = NULL; | ||
612 | unsigned long addr = (((unsigned long)&args->__unused[0]) + 7UL) & ~7UL; | ||
613 | |||
614 | if (copy_from_user(&tmp, args, sizeof(tmp))) | ||
615 | return -EFAULT; | ||
616 | |||
617 | if (tmp.oldval && tmp.oldlenp) { | ||
618 | /* Duh, this is ugly and might not work if sysctl_args | ||
619 | is in read-only memory, but do_sysctl does indirectly | ||
620 | a lot of uaccess in both directions and we'd have to | ||
621 | basically copy the whole sysctl.c here, and | ||
622 | glibc's __sysctl uses rw memory for the structure | ||
623 | anyway. */ | ||
624 | if (get_user(oldlen, (u32 __user *)(unsigned long)tmp.oldlenp) || | ||
625 | put_user(oldlen, (size_t __user *)addr)) | ||
626 | return -EFAULT; | ||
627 | oldlenp = (size_t __user *)addr; | ||
628 | } | ||
629 | |||
630 | lock_kernel(); | ||
631 | error = do_sysctl((int __user *)(unsigned long) tmp.name, | ||
632 | tmp.nlen, | ||
633 | (void __user *)(unsigned long) tmp.oldval, | ||
634 | oldlenp, | ||
635 | (void __user *)(unsigned long) tmp.newval, | ||
636 | tmp.newlen); | ||
637 | unlock_kernel(); | ||
638 | if (oldlenp) { | ||
639 | if (!error) { | ||
640 | if (get_user(oldlen, (size_t __user *)addr) || | ||
641 | put_user(oldlen, (u32 __user *)(unsigned long) tmp.oldlenp)) | ||
642 | error = -EFAULT; | ||
643 | } | ||
644 | if (copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused))) | ||
645 | error = -EFAULT; | ||
646 | } | ||
647 | return error; | ||
648 | #endif | ||
649 | } | ||
650 | |||
651 | long sys32_lookup_dcookie(unsigned long cookie_high, | 567 | long sys32_lookup_dcookie(unsigned long cookie_high, |
652 | unsigned long cookie_low, | 568 | unsigned long cookie_low, |
653 | char __user *buf, size_t len) | 569 | char __user *buf, size_t len) |
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c index 03035c852a43..3a82e65d8db2 100644 --- a/arch/sparc/kernel/sys_sparc_32.c +++ b/arch/sparc/kernel/sys_sparc_32.c | |||
@@ -45,7 +45,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi | |||
45 | /* We do not accept a shared mapping if it would violate | 45 | /* We do not accept a shared mapping if it would violate |
46 | * cache aliasing constraints. | 46 | * cache aliasing constraints. |
47 | */ | 47 | */ |
48 | if ((flags & MAP_SHARED) && (addr & (SHMLBA - 1))) | 48 | if ((flags & MAP_SHARED) && |
49 | ((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1))) | ||
49 | return -EINVAL; | 50 | return -EINVAL; |
50 | return addr; | 51 | return addr; |
51 | } | 52 | } |
@@ -79,15 +80,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi | |||
79 | } | 80 | } |
80 | } | 81 | } |
81 | 82 | ||
82 | asmlinkage unsigned long sparc_brk(unsigned long brk) | ||
83 | { | ||
84 | if(ARCH_SUN4C) { | ||
85 | if ((brk & 0xe0000000) != (current->mm->brk & 0xe0000000)) | ||
86 | return current->mm->brk; | ||
87 | } | ||
88 | return sys_brk(brk); | ||
89 | } | ||
90 | |||
91 | /* | 83 | /* |
92 | * sys_pipe() is the normal C calling standard for creating | 84 | * sys_pipe() is the normal C calling standard for creating |
93 | * a pipe. It's not the way unix traditionally does this, though. | 85 | * a pipe. It's not the way unix traditionally does this, though. |
@@ -234,31 +226,6 @@ int sparc_mmap_check(unsigned long addr, unsigned long len) | |||
234 | } | 226 | } |
235 | 227 | ||
236 | /* Linux version of mmap */ | 228 | /* Linux version of mmap */ |
237 | static unsigned long do_mmap2(unsigned long addr, unsigned long len, | ||
238 | unsigned long prot, unsigned long flags, unsigned long fd, | ||
239 | unsigned long pgoff) | ||
240 | { | ||
241 | struct file * file = NULL; | ||
242 | unsigned long retval = -EBADF; | ||
243 | |||
244 | if (!(flags & MAP_ANONYMOUS)) { | ||
245 | file = fget(fd); | ||
246 | if (!file) | ||
247 | goto out; | ||
248 | } | ||
249 | |||
250 | len = PAGE_ALIGN(len); | ||
251 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
252 | |||
253 | down_write(¤t->mm->mmap_sem); | ||
254 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
255 | up_write(¤t->mm->mmap_sem); | ||
256 | |||
257 | if (file) | ||
258 | fput(file); | ||
259 | out: | ||
260 | return retval; | ||
261 | } | ||
262 | 229 | ||
263 | asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, | 230 | asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, |
264 | unsigned long prot, unsigned long flags, unsigned long fd, | 231 | unsigned long prot, unsigned long flags, unsigned long fd, |
@@ -266,14 +233,16 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, | |||
266 | { | 233 | { |
267 | /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE | 234 | /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE |
268 | we have. */ | 235 | we have. */ |
269 | return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12)); | 236 | return sys_mmap_pgoff(addr, len, prot, flags, fd, |
237 | pgoff >> (PAGE_SHIFT - 12)); | ||
270 | } | 238 | } |
271 | 239 | ||
272 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, | 240 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, |
273 | unsigned long prot, unsigned long flags, unsigned long fd, | 241 | unsigned long prot, unsigned long flags, unsigned long fd, |
274 | unsigned long off) | 242 | unsigned long off) |
275 | { | 243 | { |
276 | return do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT); | 244 | /* no alignment check? */ |
245 | return sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); | ||
277 | } | 246 | } |
278 | 247 | ||
279 | long sparc_remap_file_pages(unsigned long start, unsigned long size, | 248 | long sparc_remap_file_pages(unsigned long start, unsigned long size, |
@@ -287,27 +256,6 @@ long sparc_remap_file_pages(unsigned long start, unsigned long size, | |||
287 | (pgoff >> (PAGE_SHIFT - 12)), flags); | 256 | (pgoff >> (PAGE_SHIFT - 12)), flags); |
288 | } | 257 | } |
289 | 258 | ||
290 | extern unsigned long do_mremap(unsigned long addr, | ||
291 | unsigned long old_len, unsigned long new_len, | ||
292 | unsigned long flags, unsigned long new_addr); | ||
293 | |||
294 | asmlinkage unsigned long sparc_mremap(unsigned long addr, | ||
295 | unsigned long old_len, unsigned long new_len, | ||
296 | unsigned long flags, unsigned long new_addr) | ||
297 | { | ||
298 | unsigned long ret = -EINVAL; | ||
299 | |||
300 | if (unlikely(sparc_mmap_check(addr, old_len))) | ||
301 | goto out; | ||
302 | if (unlikely(sparc_mmap_check(new_addr, new_len))) | ||
303 | goto out; | ||
304 | down_write(¤t->mm->mmap_sem); | ||
305 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); | ||
306 | up_write(¤t->mm->mmap_sem); | ||
307 | out: | ||
308 | return ret; | ||
309 | } | ||
310 | |||
311 | /* we come to here via sys_nis_syscall so it can setup the regs argument */ | 259 | /* we come to here via sys_nis_syscall so it can setup the regs argument */ |
312 | asmlinkage unsigned long | 260 | asmlinkage unsigned long |
313 | c_sys_nis_syscall (struct pt_regs *regs) | 261 | c_sys_nis_syscall (struct pt_regs *regs) |
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index e2d102447a43..cfa0e19abe3b 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c | |||
@@ -317,10 +317,14 @@ bottomup: | |||
317 | unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags) | 317 | unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags) |
318 | { | 318 | { |
319 | unsigned long align_goal, addr = -ENOMEM; | 319 | unsigned long align_goal, addr = -ENOMEM; |
320 | unsigned long (*get_area)(struct file *, unsigned long, | ||
321 | unsigned long, unsigned long, unsigned long); | ||
322 | |||
323 | get_area = current->mm->get_unmapped_area; | ||
320 | 324 | ||
321 | if (flags & MAP_FIXED) { | 325 | if (flags & MAP_FIXED) { |
322 | /* Ok, don't mess with it. */ | 326 | /* Ok, don't mess with it. */ |
323 | return get_unmapped_area(NULL, orig_addr, len, pgoff, flags); | 327 | return get_area(NULL, orig_addr, len, pgoff, flags); |
324 | } | 328 | } |
325 | flags &= ~MAP_SHARED; | 329 | flags &= ~MAP_SHARED; |
326 | 330 | ||
@@ -333,7 +337,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u | |||
333 | align_goal = (64UL * 1024); | 337 | align_goal = (64UL * 1024); |
334 | 338 | ||
335 | do { | 339 | do { |
336 | addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags); | 340 | addr = get_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags); |
337 | if (!(addr & ~PAGE_MASK)) { | 341 | if (!(addr & ~PAGE_MASK)) { |
338 | addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); | 342 | addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); |
339 | break; | 343 | break; |
@@ -351,7 +355,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u | |||
351 | * be obtained. | 355 | * be obtained. |
352 | */ | 356 | */ |
353 | if (addr & ~PAGE_MASK) | 357 | if (addr & ~PAGE_MASK) |
354 | addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags); | 358 | addr = get_area(NULL, orig_addr, len, pgoff, flags); |
355 | 359 | ||
356 | return addr; | 360 | return addr; |
357 | } | 361 | } |
@@ -399,18 +403,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm) | |||
399 | } | 403 | } |
400 | } | 404 | } |
401 | 405 | ||
402 | SYSCALL_DEFINE1(sparc_brk, unsigned long, brk) | ||
403 | { | ||
404 | /* People could try to be nasty and use ta 0x6d in 32bit programs */ | ||
405 | if (test_thread_flag(TIF_32BIT) && brk >= STACK_TOP32) | ||
406 | return current->mm->brk; | ||
407 | |||
408 | if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk))) | ||
409 | return current->mm->brk; | ||
410 | |||
411 | return sys_brk(brk); | ||
412 | } | ||
413 | |||
414 | /* | 406 | /* |
415 | * sys_pipe() is the normal C calling standard for creating | 407 | * sys_pipe() is the normal C calling standard for creating |
416 | * a pipe. It's not the way unix traditionally does this, though. | 408 | * a pipe. It's not the way unix traditionally does this, though. |
@@ -568,23 +560,13 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, | |||
568 | unsigned long, prot, unsigned long, flags, unsigned long, fd, | 560 | unsigned long, prot, unsigned long, flags, unsigned long, fd, |
569 | unsigned long, off) | 561 | unsigned long, off) |
570 | { | 562 | { |
571 | struct file * file = NULL; | 563 | unsigned long retval = -EINVAL; |
572 | unsigned long retval = -EBADF; | ||
573 | |||
574 | if (!(flags & MAP_ANONYMOUS)) { | ||
575 | file = fget(fd); | ||
576 | if (!file) | ||
577 | goto out; | ||
578 | } | ||
579 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
580 | len = PAGE_ALIGN(len); | ||
581 | 564 | ||
582 | down_write(¤t->mm->mmap_sem); | 565 | if ((off + PAGE_ALIGN(len)) < off) |
583 | retval = do_mmap(file, addr, len, prot, flags, off); | 566 | goto out; |
584 | up_write(¤t->mm->mmap_sem); | 567 | if (off & ~PAGE_MASK) |
585 | 568 | goto out; | |
586 | if (file) | 569 | retval = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); |
587 | fput(file); | ||
588 | out: | 570 | out: |
589 | return retval; | 571 | return retval; |
590 | } | 572 | } |
@@ -614,12 +596,6 @@ SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len, | |||
614 | 596 | ||
615 | if (test_thread_flag(TIF_32BIT)) | 597 | if (test_thread_flag(TIF_32BIT)) |
616 | goto out; | 598 | goto out; |
617 | if (unlikely(new_len >= VA_EXCLUDE_START)) | ||
618 | goto out; | ||
619 | if (unlikely(sparc_mmap_check(addr, old_len))) | ||
620 | goto out; | ||
621 | if (unlikely(sparc_mmap_check(new_addr, new_len))) | ||
622 | goto out; | ||
623 | 599 | ||
624 | down_write(¤t->mm->mmap_sem); | 600 | down_write(¤t->mm->mmap_sem); |
625 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); | 601 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); |
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S index d150c2aa98d2..dc4a458f74dc 100644 --- a/arch/sparc/kernel/syscalls.S +++ b/arch/sparc/kernel/syscalls.S | |||
@@ -62,7 +62,7 @@ sys32_rt_sigreturn: | |||
62 | #endif | 62 | #endif |
63 | .align 32 | 63 | .align 32 |
64 | 1: ldx [%g6 + TI_FLAGS], %l5 | 64 | 1: ldx [%g6 + TI_FLAGS], %l5 |
65 | andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0 | 65 | andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 |
66 | be,pt %icc, rtrap | 66 | be,pt %icc, rtrap |
67 | nop | 67 | nop |
68 | call syscall_trace_leave | 68 | call syscall_trace_leave |
@@ -187,7 +187,7 @@ linux_syscall_trace: | |||
187 | .globl linux_sparc_syscall32 | 187 | .globl linux_sparc_syscall32 |
188 | linux_sparc_syscall32: | 188 | linux_sparc_syscall32: |
189 | /* Direct access to user regs, much faster. */ | 189 | /* Direct access to user regs, much faster. */ |
190 | cmp %g1, NR_SYSCALLS ! IEU1 Group | 190 | cmp %g1, NR_syscalls ! IEU1 Group |
191 | bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI | 191 | bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI |
192 | srl %i0, 0, %o0 ! IEU0 | 192 | srl %i0, 0, %o0 ! IEU0 |
193 | sll %g1, 2, %l4 ! IEU0 Group | 193 | sll %g1, 2, %l4 ! IEU0 Group |
@@ -198,7 +198,7 @@ linux_sparc_syscall32: | |||
198 | 198 | ||
199 | srl %i5, 0, %o5 ! IEU1 | 199 | srl %i5, 0, %o5 ! IEU1 |
200 | srl %i2, 0, %o2 ! IEU0 Group | 200 | srl %i2, 0, %o2 ! IEU0 Group |
201 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0 | 201 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 |
202 | bne,pn %icc, linux_syscall_trace32 ! CTI | 202 | bne,pn %icc, linux_syscall_trace32 ! CTI |
203 | mov %i0, %l5 ! IEU1 | 203 | mov %i0, %l5 ! IEU1 |
204 | call %l7 ! CTI Group brk forced | 204 | call %l7 ! CTI Group brk forced |
@@ -210,7 +210,7 @@ linux_sparc_syscall32: | |||
210 | .globl linux_sparc_syscall | 210 | .globl linux_sparc_syscall |
211 | linux_sparc_syscall: | 211 | linux_sparc_syscall: |
212 | /* Direct access to user regs, much faster. */ | 212 | /* Direct access to user regs, much faster. */ |
213 | cmp %g1, NR_SYSCALLS ! IEU1 Group | 213 | cmp %g1, NR_syscalls ! IEU1 Group |
214 | bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI | 214 | bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI |
215 | mov %i0, %o0 ! IEU0 | 215 | mov %i0, %o0 ! IEU0 |
216 | sll %g1, 2, %l4 ! IEU0 Group | 216 | sll %g1, 2, %l4 ! IEU0 Group |
@@ -221,7 +221,7 @@ linux_sparc_syscall: | |||
221 | 221 | ||
222 | mov %i3, %o3 ! IEU1 | 222 | mov %i3, %o3 ! IEU1 |
223 | mov %i4, %o4 ! IEU0 Group | 223 | mov %i4, %o4 ! IEU0 Group |
224 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0 | 224 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 |
225 | bne,pn %icc, linux_syscall_trace ! CTI Group | 225 | bne,pn %icc, linux_syscall_trace ! CTI Group |
226 | mov %i0, %l5 ! IEU0 | 226 | mov %i0, %l5 ! IEU0 |
227 | 2: call %l7 ! CTI Group brk forced | 227 | 2: call %l7 ! CTI Group brk forced |
@@ -245,7 +245,7 @@ ret_sys_call: | |||
245 | 245 | ||
246 | cmp %o0, -ERESTART_RESTARTBLOCK | 246 | cmp %o0, -ERESTART_RESTARTBLOCK |
247 | bgeu,pn %xcc, 1f | 247 | bgeu,pn %xcc, 1f |
248 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6 | 248 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6 |
249 | 80: | 249 | 80: |
250 | /* System call success, clear Carry condition code. */ | 250 | /* System call success, clear Carry condition code. */ |
251 | andn %g3, %g2, %g3 | 251 | andn %g3, %g2, %g3 |
@@ -260,7 +260,7 @@ ret_sys_call: | |||
260 | /* System call failure, set Carry condition code. | 260 | /* System call failure, set Carry condition code. |
261 | * Also, get abs(errno) to return to the process. | 261 | * Also, get abs(errno) to return to the process. |
262 | */ | 262 | */ |
263 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6 | 263 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6 |
264 | sub %g0, %o0, %o0 | 264 | sub %g0, %o0, %o0 |
265 | or %g3, %g2, %g3 | 265 | or %g3, %g2, %g3 |
266 | stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] | 266 | stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] |
diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h index a63c5d2d9849..d2f999ae2b85 100644 --- a/arch/sparc/kernel/systbls.h +++ b/arch/sparc/kernel/systbls.h | |||
@@ -9,7 +9,6 @@ | |||
9 | struct new_utsname; | 9 | struct new_utsname; |
10 | 10 | ||
11 | extern asmlinkage unsigned long sys_getpagesize(void); | 11 | extern asmlinkage unsigned long sys_getpagesize(void); |
12 | extern asmlinkage unsigned long sparc_brk(unsigned long brk); | ||
13 | extern asmlinkage long sparc_pipe(struct pt_regs *regs); | 12 | extern asmlinkage long sparc_pipe(struct pt_regs *regs); |
14 | extern asmlinkage long sys_ipc(unsigned int call, int first, | 13 | extern asmlinkage long sys_ipc(unsigned int call, int first, |
15 | unsigned long second, | 14 | unsigned long second, |
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index 0f1658d37490..801fc8e5a0e8 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S | |||
@@ -19,7 +19,7 @@ sys_call_table: | |||
19 | /*0*/ .long sys_restart_syscall, sys_exit, sys_fork, sys_read, sys_write | 19 | /*0*/ .long sys_restart_syscall, sys_exit, sys_fork, sys_read, sys_write |
20 | /*5*/ .long sys_open, sys_close, sys_wait4, sys_creat, sys_link | 20 | /*5*/ .long sys_open, sys_close, sys_wait4, sys_creat, sys_link |
21 | /*10*/ .long sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod | 21 | /*10*/ .long sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod |
22 | /*15*/ .long sys_chmod, sys_lchown16, sparc_brk, sys_nis_syscall, sys_lseek | 22 | /*15*/ .long sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, sys_lseek |
23 | /*20*/ .long sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 | 23 | /*20*/ .long sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 |
24 | /*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause | 24 | /*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause |
25 | /*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice | 25 | /*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice |
@@ -67,7 +67,7 @@ sys_call_table: | |||
67 | /*235*/ .long sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall | 67 | /*235*/ .long sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall |
68 | /*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler | 68 | /*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler |
69 | /*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep | 69 | /*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep |
70 | /*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl | 70 | /*250*/ .long sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl |
71 | /*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep | 71 | /*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep |
72 | /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun | 72 | /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun |
73 | /*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy | 73 | /*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy |
@@ -82,5 +82,5 @@ sys_call_table: | |||
82 | /*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate | 82 | /*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate |
83 | /*315*/ .long sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 | 83 | /*315*/ .long sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 |
84 | /*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv | 84 | /*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv |
85 | /*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open | 85 | /*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg |
86 | 86 | ||
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index 009825f6e73c..e575b46bd7a9 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S | |||
@@ -21,7 +21,7 @@ sys_call_table32: | |||
21 | /*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write | 21 | /*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write |
22 | /*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link | 22 | /*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link |
23 | /*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod | 23 | /*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod |
24 | /*15*/ .word sys_chmod, sys_lchown16, sys_sparc_brk, sys32_perfctr, sys32_lseek | 24 | /*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys32_perfctr, sys32_lseek |
25 | /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 | 25 | /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 |
26 | /*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause | 26 | /*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause |
27 | /*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice | 27 | /*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice |
@@ -68,7 +68,7 @@ sys_call_table32: | |||
68 | .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall | 68 | .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall |
69 | /*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler | 69 | /*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler |
70 | .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep | 70 | .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep |
71 | /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl | 71 | /*250*/ .word sys_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl |
72 | .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep | 72 | .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep |
73 | /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun | 73 | /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun |
74 | .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy | 74 | .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy |
@@ -83,7 +83,7 @@ sys_call_table32: | |||
83 | /*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate | 83 | /*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_timerfd_create, sys_eventfd, compat_sys_fallocate |
84 | .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime, compat_sys_signalfd4, sys_eventfd2, sys_epoll_create1 | 84 | .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime, compat_sys_signalfd4, sys_eventfd2, sys_epoll_create1 |
85 | /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv | 85 | /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv |
86 | .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open | 86 | .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg |
87 | 87 | ||
88 | #endif /* CONFIG_COMPAT */ | 88 | #endif /* CONFIG_COMPAT */ |
89 | 89 | ||
@@ -96,7 +96,7 @@ sys_call_table: | |||
96 | /*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write | 96 | /*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write |
97 | /*5*/ .word sys_open, sys_close, sys_wait4, sys_creat, sys_link | 97 | /*5*/ .word sys_open, sys_close, sys_wait4, sys_creat, sys_link |
98 | /*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod | 98 | /*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod |
99 | /*15*/ .word sys_chmod, sys_lchown, sys_sparc_brk, sys_perfctr, sys_lseek | 99 | /*15*/ .word sys_chmod, sys_lchown, sys_brk, sys_perfctr, sys_lseek |
100 | /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid | 100 | /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid |
101 | /*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall | 101 | /*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall |
102 | /*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice | 102 | /*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice |
@@ -158,4 +158,4 @@ sys_call_table: | |||
158 | /*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate | 158 | /*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate |
159 | .word sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 | 159 | .word sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1 |
160 | /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv | 160 | /*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv |
161 | .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open | 161 | .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg |
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c index 614ac7b4a9dd..5b2f595fe65b 100644 --- a/arch/sparc/kernel/time_32.c +++ b/arch/sparc/kernel/time_32.c | |||
@@ -210,9 +210,6 @@ static void __init sbus_time_init(void) | |||
210 | btfixup(); | 210 | btfixup(); |
211 | 211 | ||
212 | sparc_init_timers(timer_interrupt); | 212 | sparc_init_timers(timer_interrupt); |
213 | |||
214 | /* Now that OBP ticker has been silenced, it is safe to enable IRQ. */ | ||
215 | local_irq_enable(); | ||
216 | } | 213 | } |
217 | 214 | ||
218 | void __init time_init(void) | 215 | void __init time_init(void) |
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c index da1218e8ee87..67e165102885 100644 --- a/arch/sparc/kernel/time_64.c +++ b/arch/sparc/kernel/time_64.c | |||
@@ -774,26 +774,9 @@ void __devinit setup_sparc64_timer(void) | |||
774 | static struct clocksource clocksource_tick = { | 774 | static struct clocksource clocksource_tick = { |
775 | .rating = 100, | 775 | .rating = 100, |
776 | .mask = CLOCKSOURCE_MASK(64), | 776 | .mask = CLOCKSOURCE_MASK(64), |
777 | .shift = 16, | ||
778 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 777 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
779 | }; | 778 | }; |
780 | 779 | ||
781 | static void __init setup_clockevent_multiplier(unsigned long hz) | ||
782 | { | ||
783 | unsigned long mult, shift = 32; | ||
784 | |||
785 | while (1) { | ||
786 | mult = div_sc(hz, NSEC_PER_SEC, shift); | ||
787 | if (mult && (mult >> 32UL) == 0UL) | ||
788 | break; | ||
789 | |||
790 | shift--; | ||
791 | } | ||
792 | |||
793 | sparc64_clockevent.shift = shift; | ||
794 | sparc64_clockevent.mult = mult; | ||
795 | } | ||
796 | |||
797 | static unsigned long tb_ticks_per_usec __read_mostly; | 780 | static unsigned long tb_ticks_per_usec __read_mostly; |
798 | 781 | ||
799 | void __delay(unsigned long loops) | 782 | void __delay(unsigned long loops) |
@@ -828,9 +811,7 @@ void __init time_init(void) | |||
828 | clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT); | 811 | clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT); |
829 | 812 | ||
830 | clocksource_tick.name = tick_ops->name; | 813 | clocksource_tick.name = tick_ops->name; |
831 | clocksource_tick.mult = | 814 | clocksource_calc_mult_shift(&clocksource_tick, freq, 4); |
832 | clocksource_hz2mult(freq, | ||
833 | clocksource_tick.shift); | ||
834 | clocksource_tick.read = clocksource_tick_read; | 815 | clocksource_tick.read = clocksource_tick_read; |
835 | 816 | ||
836 | printk("clocksource: mult[%x] shift[%d]\n", | 817 | printk("clocksource: mult[%x] shift[%d]\n", |
@@ -839,15 +820,14 @@ void __init time_init(void) | |||
839 | clocksource_register(&clocksource_tick); | 820 | clocksource_register(&clocksource_tick); |
840 | 821 | ||
841 | sparc64_clockevent.name = tick_ops->name; | 822 | sparc64_clockevent.name = tick_ops->name; |
842 | 823 | clockevents_calc_mult_shift(&sparc64_clockevent, freq, 4); | |
843 | setup_clockevent_multiplier(freq); | ||
844 | 824 | ||
845 | sparc64_clockevent.max_delta_ns = | 825 | sparc64_clockevent.max_delta_ns = |
846 | clockevent_delta2ns(0x7fffffffffffffffUL, &sparc64_clockevent); | 826 | clockevent_delta2ns(0x7fffffffffffffffUL, &sparc64_clockevent); |
847 | sparc64_clockevent.min_delta_ns = | 827 | sparc64_clockevent.min_delta_ns = |
848 | clockevent_delta2ns(0xF, &sparc64_clockevent); | 828 | clockevent_delta2ns(0xF, &sparc64_clockevent); |
849 | 829 | ||
850 | printk("clockevent: mult[%lx] shift[%d]\n", | 830 | printk("clockevent: mult[%x] shift[%d]\n", |
851 | sparc64_clockevent.mult, sparc64_clockevent.shift); | 831 | sparc64_clockevent.mult, sparc64_clockevent.shift); |
852 | 832 | ||
853 | setup_sparc64_timer(); | 833 | setup_sparc64_timer(); |
diff --git a/arch/sparc/kernel/trampoline_32.S b/arch/sparc/kernel/trampoline_32.S index 5e235c52d667..691f484e03b3 100644 --- a/arch/sparc/kernel/trampoline_32.S +++ b/arch/sparc/kernel/trampoline_32.S | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <asm/contregs.h> | 15 | #include <asm/contregs.h> |
16 | #include <asm/thread_info.h> | 16 | #include <asm/thread_info.h> |
17 | 17 | ||
18 | .globl sun4m_cpu_startup, __smp4m_processor_id | 18 | .globl sun4m_cpu_startup, __smp4m_processor_id, __leon_processor_id |
19 | .globl sun4d_cpu_startup, __smp4d_processor_id | 19 | .globl sun4d_cpu_startup, __smp4d_processor_id |
20 | 20 | ||
21 | __CPUINIT | 21 | __CPUINIT |
@@ -106,6 +106,12 @@ __smp4d_processor_id: | |||
106 | retl | 106 | retl |
107 | mov %g1, %o7 | 107 | mov %g1, %o7 |
108 | 108 | ||
109 | __leon_processor_id: | ||
110 | rd %asr17,%g2 | ||
111 | srl %g2,28,%g2 | ||
112 | retl | ||
113 | mov %g1, %o7 | ||
114 | |||
109 | /* CPUID in bootbus can be found at PA 0xff0140000 */ | 115 | /* CPUID in bootbus can be found at PA 0xff0140000 */ |
110 | #define SUN4D_BOOTBUS_CPUID 0xf0140000 | 116 | #define SUN4D_BOOTBUS_CPUID 0xf0140000 |
111 | 117 | ||
@@ -160,3 +166,64 @@ sun4d_cpu_startup: | |||
160 | nop | 166 | nop |
161 | 167 | ||
162 | b,a smp_do_cpu_idle | 168 | b,a smp_do_cpu_idle |
169 | |||
170 | #ifdef CONFIG_SPARC_LEON | ||
171 | |||
172 | __CPUINIT | ||
173 | .align 4 | ||
174 | .global leon_smp_cpu_startup, smp_penguin_ctable | ||
175 | |||
176 | leon_smp_cpu_startup: | ||
177 | |||
178 | set smp_penguin_ctable,%g1 | ||
179 | ld [%g1+4],%g1 | ||
180 | srl %g1,4,%g1 | ||
181 | set 0x00000100,%g5 /* SRMMU_CTXTBL_PTR */ | ||
182 | sta %g1, [%g5] ASI_M_MMUREGS | ||
183 | |||
184 | /* Set up a sane %psr -- PIL<0xf> S<0x1> PS<0x1> CWP<0x0> */ | ||
185 | set (PSR_PIL | PSR_S | PSR_PS), %g1 | ||
186 | wr %g1, 0x0, %psr ! traps off though | ||
187 | WRITE_PAUSE | ||
188 | |||
189 | /* Our %wim is one behind CWP */ | ||
190 | mov 2, %g1 | ||
191 | wr %g1, 0x0, %wim | ||
192 | WRITE_PAUSE | ||
193 | |||
194 | /* Set tbr - we use just one trap table. */ | ||
195 | set trapbase, %g1 | ||
196 | wr %g1, 0x0, %tbr | ||
197 | WRITE_PAUSE | ||
198 | |||
199 | /* Get our CPU id */ | ||
200 | rd %asr17,%g3 | ||
201 | |||
202 | /* Give ourselves a stack and curptr. */ | ||
203 | set current_set, %g5 | ||
204 | srl %g3, 28, %g4 | ||
205 | sll %g4, 2, %g4 | ||
206 | ld [%g5 + %g4], %g6 | ||
207 | |||
208 | sethi %hi(THREAD_SIZE - STACKFRAME_SZ), %sp | ||
209 | or %sp, %lo(THREAD_SIZE - STACKFRAME_SZ), %sp | ||
210 | add %g6, %sp, %sp | ||
211 | |||
212 | /* Turn on traps (PSR_ET). */ | ||
213 | rd %psr, %g1 | ||
214 | wr %g1, PSR_ET, %psr ! traps on | ||
215 | WRITE_PAUSE | ||
216 | |||
217 | /* Init our caches, etc. */ | ||
218 | set poke_srmmu, %g5 | ||
219 | ld [%g5], %g5 | ||
220 | call %g5 | ||
221 | nop | ||
222 | |||
223 | /* Start this processor. */ | ||
224 | call leon_callin | ||
225 | nop | ||
226 | |||
227 | b,a smp_do_cpu_idle | ||
228 | |||
229 | #endif | ||
diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c index 6b1e6cde6fff..f8514e291e15 100644 --- a/arch/sparc/kernel/unaligned_32.c +++ b/arch/sparc/kernel/unaligned_32.c | |||
@@ -17,8 +17,7 @@ | |||
17 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | 20 | #include <linux/perf_event.h> | |
21 | /* #define DEBUG_MNA */ | ||
22 | 21 | ||
23 | enum direction { | 22 | enum direction { |
24 | load, /* ld, ldd, ldh, ldsh */ | 23 | load, /* ld, ldd, ldh, ldsh */ |
@@ -29,12 +28,6 @@ enum direction { | |||
29 | invalid, | 28 | invalid, |
30 | }; | 29 | }; |
31 | 30 | ||
32 | #ifdef DEBUG_MNA | ||
33 | static char *dirstrings[] = { | ||
34 | "load", "store", "both", "fpload", "fpstore", "invalid" | ||
35 | }; | ||
36 | #endif | ||
37 | |||
38 | static inline enum direction decode_direction(unsigned int insn) | 31 | static inline enum direction decode_direction(unsigned int insn) |
39 | { | 32 | { |
40 | unsigned long tmp = (insn >> 21) & 1; | 33 | unsigned long tmp = (insn >> 21) & 1; |
@@ -255,10 +248,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) | |||
255 | unsigned long addr = compute_effective_address(regs, insn); | 248 | unsigned long addr = compute_effective_address(regs, insn); |
256 | int err; | 249 | int err; |
257 | 250 | ||
258 | #ifdef DEBUG_MNA | 251 | perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, addr); |
259 | printk("KMNA: pc=%08lx [dir=%s addr=%08lx size=%d] retpc[%08lx]\n", | ||
260 | regs->pc, dirstrings[dir], addr, size, regs->u_regs[UREG_RETPC]); | ||
261 | #endif | ||
262 | switch (dir) { | 252 | switch (dir) { |
263 | case load: | 253 | case load: |
264 | err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f), | 254 | err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f), |
@@ -350,6 +340,7 @@ asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn) | |||
350 | } | 340 | } |
351 | 341 | ||
352 | addr = compute_effective_address(regs, insn); | 342 | addr = compute_effective_address(regs, insn); |
343 | perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, addr); | ||
353 | switch(dir) { | 344 | switch(dir) { |
354 | case load: | 345 | case load: |
355 | err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f), | 346 | err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f), |
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c index 379209982a07..378ca82b9ccc 100644 --- a/arch/sparc/kernel/unaligned_64.c +++ b/arch/sparc/kernel/unaligned_64.c | |||
@@ -20,10 +20,9 @@ | |||
20 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
21 | #include <linux/smp.h> | 21 | #include <linux/smp.h> |
22 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
23 | #include <linux/perf_event.h> | ||
23 | #include <asm/fpumacro.h> | 24 | #include <asm/fpumacro.h> |
24 | 25 | ||
25 | /* #define DEBUG_MNA */ | ||
26 | |||
27 | enum direction { | 26 | enum direction { |
28 | load, /* ld, ldd, ldh, ldsh */ | 27 | load, /* ld, ldd, ldh, ldsh */ |
29 | store, /* st, std, sth, stsh */ | 28 | store, /* st, std, sth, stsh */ |
@@ -33,12 +32,6 @@ enum direction { | |||
33 | invalid, | 32 | invalid, |
34 | }; | 33 | }; |
35 | 34 | ||
36 | #ifdef DEBUG_MNA | ||
37 | static char *dirstrings[] = { | ||
38 | "load", "store", "both", "fpload", "fpstore", "invalid" | ||
39 | }; | ||
40 | #endif | ||
41 | |||
42 | static inline enum direction decode_direction(unsigned int insn) | 35 | static inline enum direction decode_direction(unsigned int insn) |
43 | { | 36 | { |
44 | unsigned long tmp = (insn >> 21) & 1; | 37 | unsigned long tmp = (insn >> 21) & 1; |
@@ -327,12 +320,7 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) | |||
327 | 320 | ||
328 | addr = compute_effective_address(regs, insn, | 321 | addr = compute_effective_address(regs, insn, |
329 | ((insn >> 25) & 0x1f)); | 322 | ((insn >> 25) & 0x1f)); |
330 | #ifdef DEBUG_MNA | 323 | perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, addr); |
331 | printk("KMNA: pc=%016lx [dir=%s addr=%016lx size=%d] " | ||
332 | "retpc[%016lx]\n", | ||
333 | regs->tpc, dirstrings[dir], addr, size, | ||
334 | regs->u_regs[UREG_RETPC]); | ||
335 | #endif | ||
336 | switch (asi) { | 324 | switch (asi) { |
337 | case ASI_NL: | 325 | case ASI_NL: |
338 | case ASI_AIUPL: | 326 | case ASI_AIUPL: |
@@ -399,6 +387,7 @@ int handle_popc(u32 insn, struct pt_regs *regs) | |||
399 | int ret, i, rd = ((insn >> 25) & 0x1f); | 387 | int ret, i, rd = ((insn >> 25) & 0x1f); |
400 | int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; | 388 | int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; |
401 | 389 | ||
390 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0); | ||
402 | if (insn & 0x2000) { | 391 | if (insn & 0x2000) { |
403 | maybe_flush_windows(0, 0, rd, from_kernel); | 392 | maybe_flush_windows(0, 0, rd, from_kernel); |
404 | value = sign_extend_imm13(insn); | 393 | value = sign_extend_imm13(insn); |
@@ -445,6 +434,8 @@ int handle_ldf_stq(u32 insn, struct pt_regs *regs) | |||
445 | int asi = decode_asi(insn, regs); | 434 | int asi = decode_asi(insn, regs); |
446 | int flag = (freg < 32) ? FPRS_DL : FPRS_DU; | 435 | int flag = (freg < 32) ? FPRS_DL : FPRS_DU; |
447 | 436 | ||
437 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0); | ||
438 | |||
448 | save_and_clear_fpu(); | 439 | save_and_clear_fpu(); |
449 | current_thread_info()->xfsr[0] &= ~0x1c000; | 440 | current_thread_info()->xfsr[0] &= ~0x1c000; |
450 | if (freg & 3) { | 441 | if (freg & 3) { |
@@ -566,6 +557,8 @@ void handle_ld_nf(u32 insn, struct pt_regs *regs) | |||
566 | int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; | 557 | int from_kernel = (regs->tstate & TSTATE_PRIV) != 0; |
567 | unsigned long *reg; | 558 | unsigned long *reg; |
568 | 559 | ||
560 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0); | ||
561 | |||
569 | maybe_flush_windows(0, 0, rd, from_kernel); | 562 | maybe_flush_windows(0, 0, rd, from_kernel); |
570 | reg = fetch_reg_addr(rd, regs); | 563 | reg = fetch_reg_addr(rd, regs); |
571 | if (from_kernel || rd < 16) { | 564 | if (from_kernel || rd < 16) { |
@@ -596,6 +589,7 @@ void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr | |||
596 | 589 | ||
597 | if (tstate & TSTATE_PRIV) | 590 | if (tstate & TSTATE_PRIV) |
598 | die_if_kernel("lddfmna from kernel", regs); | 591 | die_if_kernel("lddfmna from kernel", regs); |
592 | perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, sfar); | ||
599 | if (test_thread_flag(TIF_32BIT)) | 593 | if (test_thread_flag(TIF_32BIT)) |
600 | pc = (u32)pc; | 594 | pc = (u32)pc; |
601 | if (get_user(insn, (u32 __user *) pc) != -EFAULT) { | 595 | if (get_user(insn, (u32 __user *) pc) != -EFAULT) { |
@@ -657,6 +651,7 @@ void handle_stdfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr | |||
657 | 651 | ||
658 | if (tstate & TSTATE_PRIV) | 652 | if (tstate & TSTATE_PRIV) |
659 | die_if_kernel("stdfmna from kernel", regs); | 653 | die_if_kernel("stdfmna from kernel", regs); |
654 | perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, sfar); | ||
660 | if (test_thread_flag(TIF_32BIT)) | 655 | if (test_thread_flag(TIF_32BIT)) |
661 | pc = (u32)pc; | 656 | pc = (u32)pc; |
662 | if (get_user(insn, (u32 __user *) pc) != -EFAULT) { | 657 | if (get_user(insn, (u32 __user *) pc) != -EFAULT) { |
diff --git a/arch/sparc/kernel/visemul.c b/arch/sparc/kernel/visemul.c index b956fd71c131..9dfd2ebcb157 100644 --- a/arch/sparc/kernel/visemul.c +++ b/arch/sparc/kernel/visemul.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/errno.h> | 6 | #include <linux/errno.h> |
7 | #include <linux/thread_info.h> | 7 | #include <linux/thread_info.h> |
8 | #include <linux/perf_event.h> | ||
8 | 9 | ||
9 | #include <asm/ptrace.h> | 10 | #include <asm/ptrace.h> |
10 | #include <asm/pstate.h> | 11 | #include <asm/pstate.h> |
@@ -617,7 +618,7 @@ static void pmul(struct pt_regs *regs, unsigned int insn, unsigned int opf) | |||
617 | rs2 = fps_regval(f, RS2(insn)); | 618 | rs2 = fps_regval(f, RS2(insn)); |
618 | 619 | ||
619 | rd_val = 0; | 620 | rd_val = 0; |
620 | src2 = (rs2 >> (opf == FMUL8x16AU_OPF) ? 16 : 0); | 621 | src2 = rs2 >> (opf == FMUL8x16AU_OPF ? 16 : 0); |
621 | for (byte = 0; byte < 4; byte++) { | 622 | for (byte = 0; byte < 4; byte++) { |
622 | u16 src1 = (rs1 >> (byte * 8)) & 0x00ff; | 623 | u16 src1 = (rs1 >> (byte * 8)) & 0x00ff; |
623 | u32 prod = src1 * src2; | 624 | u32 prod = src1 * src2; |
@@ -801,6 +802,8 @@ int vis_emul(struct pt_regs *regs, unsigned int insn) | |||
801 | 802 | ||
802 | BUG_ON(regs->tstate & TSTATE_PRIV); | 803 | BUG_ON(regs->tstate & TSTATE_PRIV); |
803 | 804 | ||
805 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0); | ||
806 | |||
804 | if (test_thread_flag(TIF_32BIT)) | 807 | if (test_thread_flag(TIF_32BIT)) |
805 | pc = (u32)pc; | 808 | pc = (u32)pc; |
806 | 809 | ||
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile index e75faf0e59ae..c4b5e03af115 100644 --- a/arch/sparc/lib/Makefile +++ b/arch/sparc/lib/Makefile | |||
@@ -44,3 +44,4 @@ obj-y += iomap.o | |||
44 | obj-$(CONFIG_SPARC32) += atomic32.o | 44 | obj-$(CONFIG_SPARC32) += atomic32.o |
45 | obj-y += ksyms.o | 45 | obj-y += ksyms.o |
46 | obj-$(CONFIG_SPARC64) += PeeCeeI.o | 46 | obj-$(CONFIG_SPARC64) += PeeCeeI.o |
47 | obj-y += usercopy.o | ||
diff --git a/arch/sparc/lib/bzero.S b/arch/sparc/lib/bzero.S index b6557297440f..615f401edf69 100644 --- a/arch/sparc/lib/bzero.S +++ b/arch/sparc/lib/bzero.S | |||
@@ -6,10 +6,6 @@ | |||
6 | 6 | ||
7 | .text | 7 | .text |
8 | 8 | ||
9 | .globl __memset | ||
10 | .type __memset, #function | ||
11 | __memset: /* %o0=buf, %o1=pat, %o2=len */ | ||
12 | |||
13 | .globl memset | 9 | .globl memset |
14 | .type memset, #function | 10 | .type memset, #function |
15 | memset: /* %o0=buf, %o1=pat, %o2=len */ | 11 | memset: /* %o0=buf, %o1=pat, %o2=len */ |
@@ -83,7 +79,6 @@ __bzero_done: | |||
83 | retl | 79 | retl |
84 | mov %o3, %o0 | 80 | mov %o3, %o0 |
85 | .size __bzero, .-__bzero | 81 | .size __bzero, .-__bzero |
86 | .size __memset, .-__memset | ||
87 | .size memset, .-memset | 82 | .size memset, .-memset |
88 | 83 | ||
89 | #define EX_ST(x,y) \ | 84 | #define EX_ST(x,y) \ |
diff --git a/arch/sparc/lib/checksum_32.S b/arch/sparc/lib/checksum_32.S index 77f228533d47..3632cb34e914 100644 --- a/arch/sparc/lib/checksum_32.S +++ b/arch/sparc/lib/checksum_32.S | |||
@@ -560,7 +560,7 @@ __csum_partial_copy_end: | |||
560 | mov %i0, %o1 | 560 | mov %i0, %o1 |
561 | mov %i1, %o0 | 561 | mov %i1, %o0 |
562 | 5: | 562 | 5: |
563 | call __memcpy | 563 | call memcpy |
564 | mov %i2, %o2 | 564 | mov %i2, %o2 |
565 | tst %o0 | 565 | tst %o0 |
566 | bne,a 2f | 566 | bne,a 2f |
diff --git a/arch/sparc/lib/ksyms.c b/arch/sparc/lib/ksyms.c index 704b12668388..1b30bb3bfdb1 100644 --- a/arch/sparc/lib/ksyms.c +++ b/arch/sparc/lib/ksyms.c | |||
@@ -30,7 +30,6 @@ EXPORT_SYMBOL(__memscan_generic); | |||
30 | EXPORT_SYMBOL(memcmp); | 30 | EXPORT_SYMBOL(memcmp); |
31 | EXPORT_SYMBOL(memcpy); | 31 | EXPORT_SYMBOL(memcpy); |
32 | EXPORT_SYMBOL(memset); | 32 | EXPORT_SYMBOL(memset); |
33 | EXPORT_SYMBOL(__memset); | ||
34 | EXPORT_SYMBOL(memmove); | 33 | EXPORT_SYMBOL(memmove); |
35 | EXPORT_SYMBOL(__bzero); | 34 | EXPORT_SYMBOL(__bzero); |
36 | 35 | ||
@@ -81,7 +80,6 @@ EXPORT_SYMBOL(__csum_partial_copy_sparc_generic); | |||
81 | 80 | ||
82 | /* Special internal versions of library functions. */ | 81 | /* Special internal versions of library functions. */ |
83 | EXPORT_SYMBOL(__copy_1page); | 82 | EXPORT_SYMBOL(__copy_1page); |
84 | EXPORT_SYMBOL(__memcpy); | ||
85 | EXPORT_SYMBOL(__memmove); | 83 | EXPORT_SYMBOL(__memmove); |
86 | EXPORT_SYMBOL(bzero_1page); | 84 | EXPORT_SYMBOL(bzero_1page); |
87 | 85 | ||
diff --git a/arch/sparc/lib/mcount.S b/arch/sparc/lib/mcount.S index 7ce9c65f3592..24b8b12deed2 100644 --- a/arch/sparc/lib/mcount.S +++ b/arch/sparc/lib/mcount.S | |||
@@ -64,8 +64,9 @@ mcount: | |||
64 | 2: sethi %hi(softirq_stack), %g3 | 64 | 2: sethi %hi(softirq_stack), %g3 |
65 | or %g3, %lo(softirq_stack), %g3 | 65 | or %g3, %lo(softirq_stack), %g3 |
66 | ldx [%g3 + %g1], %g7 | 66 | ldx [%g3 + %g1], %g7 |
67 | sub %g7, STACK_BIAS, %g7 | ||
67 | cmp %sp, %g7 | 68 | cmp %sp, %g7 |
68 | bleu,pt %xcc, 2f | 69 | bleu,pt %xcc, 3f |
69 | sethi %hi(THREAD_SIZE), %g3 | 70 | sethi %hi(THREAD_SIZE), %g3 |
70 | add %g7, %g3, %g7 | 71 | add %g7, %g3, %g7 |
71 | cmp %sp, %g7 | 72 | cmp %sp, %g7 |
@@ -75,7 +76,7 @@ mcount: | |||
75 | * again, we are already trying to output the stack overflow | 76 | * again, we are already trying to output the stack overflow |
76 | * message. | 77 | * message. |
77 | */ | 78 | */ |
78 | sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough | 79 | 3: sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough |
79 | or %g7, %lo(ovstack), %g7 | 80 | or %g7, %lo(ovstack), %g7 |
80 | add %g7, OVSTACKSIZE, %g3 | 81 | add %g7, OVSTACKSIZE, %g3 |
81 | sub %g3, STACK_BIAS + 192, %g3 | 82 | sub %g3, STACK_BIAS + 192, %g3 |
diff --git a/arch/sparc/lib/memcpy.S b/arch/sparc/lib/memcpy.S index ce10bc869af9..34fe65751737 100644 --- a/arch/sparc/lib/memcpy.S +++ b/arch/sparc/lib/memcpy.S | |||
@@ -543,9 +543,6 @@ FUNC(memmove) | |||
543 | b 3f | 543 | b 3f |
544 | add %o0, 2, %o0 | 544 | add %o0, 2, %o0 |
545 | 545 | ||
546 | #ifdef __KERNEL__ | ||
547 | FUNC(__memcpy) | ||
548 | #endif | ||
549 | FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ | 546 | FUNC(memcpy) /* %o0=dst %o1=src %o2=len */ |
550 | 547 | ||
551 | sub %o0, %o1, %o4 | 548 | sub %o0, %o1, %o4 |
diff --git a/arch/sparc/lib/memset.S b/arch/sparc/lib/memset.S index 1c37ea892deb..99c017be8719 100644 --- a/arch/sparc/lib/memset.S +++ b/arch/sparc/lib/memset.S | |||
@@ -60,11 +60,10 @@ | |||
60 | .globl __bzero_begin | 60 | .globl __bzero_begin |
61 | __bzero_begin: | 61 | __bzero_begin: |
62 | 62 | ||
63 | .globl __bzero, __memset, | 63 | .globl __bzero |
64 | .globl memset | 64 | .globl memset |
65 | .globl __memset_start, __memset_end | 65 | .globl __memset_start, __memset_end |
66 | __memset_start: | 66 | __memset_start: |
67 | __memset: | ||
68 | memset: | 67 | memset: |
69 | and %o1, 0xff, %g3 | 68 | and %o1, 0xff, %g3 |
70 | sll %g3, 8, %g2 | 69 | sll %g3, 8, %g2 |
diff --git a/arch/sparc/lib/usercopy.c b/arch/sparc/lib/usercopy.c new file mode 100644 index 000000000000..14b363fec8a2 --- /dev/null +++ b/arch/sparc/lib/usercopy.c | |||
@@ -0,0 +1,8 @@ | |||
1 | #include <linux/module.h> | ||
2 | #include <linux/bug.h> | ||
3 | |||
4 | void copy_from_user_overflow(void) | ||
5 | { | ||
6 | WARN(1, "Buffer overflow detected!\n"); | ||
7 | } | ||
8 | EXPORT_SYMBOL(copy_from_user_overflow); | ||
diff --git a/arch/sparc/math-emu/math_32.c b/arch/sparc/math-emu/math_32.c index e13f65da17df..a3fccde894ec 100644 --- a/arch/sparc/math-emu/math_32.c +++ b/arch/sparc/math-emu/math_32.c | |||
@@ -67,6 +67,7 @@ | |||
67 | #include <linux/types.h> | 67 | #include <linux/types.h> |
68 | #include <linux/sched.h> | 68 | #include <linux/sched.h> |
69 | #include <linux/mm.h> | 69 | #include <linux/mm.h> |
70 | #include <linux/perf_event.h> | ||
70 | #include <asm/uaccess.h> | 71 | #include <asm/uaccess.h> |
71 | 72 | ||
72 | #include "sfp-util_32.h" | 73 | #include "sfp-util_32.h" |
@@ -163,6 +164,8 @@ int do_mathemu(struct pt_regs *regs, struct task_struct *fpt) | |||
163 | int retcode = 0; /* assume all succeed */ | 164 | int retcode = 0; /* assume all succeed */ |
164 | unsigned long insn; | 165 | unsigned long insn; |
165 | 166 | ||
167 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0); | ||
168 | |||
166 | #ifdef DEBUG_MATHEMU | 169 | #ifdef DEBUG_MATHEMU |
167 | printk("In do_mathemu()... pc is %08lx\n", regs->pc); | 170 | printk("In do_mathemu()... pc is %08lx\n", regs->pc); |
168 | printk("fpqdepth is %ld\n", fpt->thread.fpqdepth); | 171 | printk("fpqdepth is %ld\n", fpt->thread.fpqdepth); |
diff --git a/arch/sparc/math-emu/math_64.c b/arch/sparc/math-emu/math_64.c index 6863c9bde25c..56d2c44747b8 100644 --- a/arch/sparc/math-emu/math_64.c +++ b/arch/sparc/math-emu/math_64.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
14 | #include <linux/perf_event.h> | ||
14 | 15 | ||
15 | #include <asm/fpumacro.h> | 16 | #include <asm/fpumacro.h> |
16 | #include <asm/ptrace.h> | 17 | #include <asm/ptrace.h> |
@@ -183,6 +184,7 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f) | |||
183 | 184 | ||
184 | if (tstate & TSTATE_PRIV) | 185 | if (tstate & TSTATE_PRIV) |
185 | die_if_kernel("unfinished/unimplemented FPop from kernel", regs); | 186 | die_if_kernel("unfinished/unimplemented FPop from kernel", regs); |
187 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0); | ||
186 | if (test_thread_flag(TIF_32BIT)) | 188 | if (test_thread_flag(TIF_32BIT)) |
187 | pc = (u32)pc; | 189 | pc = (u32)pc; |
188 | if (get_user(insn, (u32 __user *) pc) != -EFAULT) { | 190 | if (get_user(insn, (u32 __user *) pc) != -EFAULT) { |
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c index 43b0da96a4fb..6081936bf03b 100644 --- a/arch/sparc/mm/fault_64.c +++ b/arch/sparc/mm/fault_64.c | |||
@@ -31,13 +31,12 @@ | |||
31 | #include <asm/sections.h> | 31 | #include <asm/sections.h> |
32 | #include <asm/mmu_context.h> | 32 | #include <asm/mmu_context.h> |
33 | 33 | ||
34 | #ifdef CONFIG_KPROBES | 34 | static inline __kprobes int notify_page_fault(struct pt_regs *regs) |
35 | static inline int notify_page_fault(struct pt_regs *regs) | ||
36 | { | 35 | { |
37 | int ret = 0; | 36 | int ret = 0; |
38 | 37 | ||
39 | /* kprobe_running() needs smp_processor_id() */ | 38 | /* kprobe_running() needs smp_processor_id() */ |
40 | if (!user_mode(regs)) { | 39 | if (kprobes_built_in() && !user_mode(regs)) { |
41 | preempt_disable(); | 40 | preempt_disable(); |
42 | if (kprobe_running() && kprobe_fault_handler(regs, 0)) | 41 | if (kprobe_running() && kprobe_fault_handler(regs, 0)) |
43 | ret = 1; | 42 | ret = 1; |
@@ -45,12 +44,6 @@ static inline int notify_page_fault(struct pt_regs *regs) | |||
45 | } | 44 | } |
46 | return ret; | 45 | return ret; |
47 | } | 46 | } |
48 | #else | ||
49 | static inline int notify_page_fault(struct pt_regs *regs) | ||
50 | { | ||
51 | return 0; | ||
52 | } | ||
53 | #endif | ||
54 | 47 | ||
55 | static void __kprobes unhandled_fault(unsigned long address, | 48 | static void __kprobes unhandled_fault(unsigned long address, |
56 | struct task_struct *tsk, | 49 | struct task_struct *tsk, |
@@ -73,7 +66,7 @@ static void __kprobes unhandled_fault(unsigned long address, | |||
73 | die_if_kernel("Oops", regs); | 66 | die_if_kernel("Oops", regs); |
74 | } | 67 | } |
75 | 68 | ||
76 | static void bad_kernel_pc(struct pt_regs *regs, unsigned long vaddr) | 69 | static void __kprobes bad_kernel_pc(struct pt_regs *regs, unsigned long vaddr) |
77 | { | 70 | { |
78 | printk(KERN_CRIT "OOPS: Bogus kernel PC [%016lx] in fault handler\n", | 71 | printk(KERN_CRIT "OOPS: Bogus kernel PC [%016lx] in fault handler\n", |
79 | regs->tpc); | 72 | regs->tpc); |
@@ -170,8 +163,9 @@ static unsigned int get_fault_insn(struct pt_regs *regs, unsigned int insn) | |||
170 | return insn; | 163 | return insn; |
171 | } | 164 | } |
172 | 165 | ||
173 | static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code, | 166 | static void __kprobes do_kernel_fault(struct pt_regs *regs, int si_code, |
174 | unsigned int insn, unsigned long address) | 167 | int fault_code, unsigned int insn, |
168 | unsigned long address) | ||
175 | { | 169 | { |
176 | unsigned char asi = ASI_P; | 170 | unsigned char asi = ASI_P; |
177 | 171 | ||
@@ -225,7 +219,7 @@ cannot_handle: | |||
225 | unhandled_fault (address, current, regs); | 219 | unhandled_fault (address, current, regs); |
226 | } | 220 | } |
227 | 221 | ||
228 | static void noinline bogus_32bit_fault_tpc(struct pt_regs *regs) | 222 | static void noinline __kprobes bogus_32bit_fault_tpc(struct pt_regs *regs) |
229 | { | 223 | { |
230 | static int times; | 224 | static int times; |
231 | 225 | ||
@@ -237,8 +231,8 @@ static void noinline bogus_32bit_fault_tpc(struct pt_regs *regs) | |||
237 | show_regs(regs); | 231 | show_regs(regs); |
238 | } | 232 | } |
239 | 233 | ||
240 | static void noinline bogus_32bit_fault_address(struct pt_regs *regs, | 234 | static void noinline __kprobes bogus_32bit_fault_address(struct pt_regs *regs, |
241 | unsigned long addr) | 235 | unsigned long addr) |
242 | { | 236 | { |
243 | static int times; | 237 | static int times; |
244 | 238 | ||
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index a70a5e1904d9..1886d37d411b 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -265,7 +265,7 @@ static void flush_dcache(unsigned long pfn) | |||
265 | struct page *page; | 265 | struct page *page; |
266 | 266 | ||
267 | page = pfn_to_page(pfn); | 267 | page = pfn_to_page(pfn); |
268 | if (page && page_mapping(page)) { | 268 | if (page) { |
269 | unsigned long pg_flags; | 269 | unsigned long pg_flags; |
270 | 270 | ||
271 | pg_flags = page->flags; | 271 | pg_flags = page->flags; |
diff --git a/arch/sparc/mm/init_64.h b/arch/sparc/mm/init_64.h index c2f772dbd556..77d1b313e344 100644 --- a/arch/sparc/mm/init_64.h +++ b/arch/sparc/mm/init_64.h | |||
@@ -45,7 +45,7 @@ extern void free_initmem(void); | |||
45 | #define VMEMMAP_ALIGN(x) (((x)+VMEMMAP_CHUNK-1UL)&VMEMMAP_CHUNK_MASK) | 45 | #define VMEMMAP_ALIGN(x) (((x)+VMEMMAP_CHUNK-1UL)&VMEMMAP_CHUNK_MASK) |
46 | 46 | ||
47 | #define VMEMMAP_SIZE ((((1UL << MAX_PHYSADDR_BITS) >> PAGE_SHIFT) * \ | 47 | #define VMEMMAP_SIZE ((((1UL << MAX_PHYSADDR_BITS) >> PAGE_SHIFT) * \ |
48 | sizeof(struct page *)) >> VMEMMAP_CHUNK_SHIFT) | 48 | sizeof(struct page)) >> VMEMMAP_CHUNK_SHIFT) |
49 | extern unsigned long vmemmap_table[VMEMMAP_SIZE]; | 49 | extern unsigned long vmemmap_table[VMEMMAP_SIZE]; |
50 | #endif | 50 | #endif |
51 | 51 | ||
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 509b1ffeba66..367321a030dd 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c | |||
@@ -1990,7 +1990,7 @@ void __init poke_leonsparc(void) | |||
1990 | void __init init_leon(void) | 1990 | void __init init_leon(void) |
1991 | { | 1991 | { |
1992 | 1992 | ||
1993 | srmmu_name = "Leon"; | 1993 | srmmu_name = "LEON"; |
1994 | 1994 | ||
1995 | BTFIXUPSET_CALL(flush_cache_all, leon_flush_cache_all, | 1995 | BTFIXUPSET_CALL(flush_cache_all, leon_flush_cache_all, |
1996 | BTFIXUPCALL_NORM); | 1996 | BTFIXUPCALL_NORM); |
@@ -2037,8 +2037,6 @@ static void __init get_srmmu_type(void) | |||
2037 | 2037 | ||
2038 | /* First, check for sparc-leon. */ | 2038 | /* First, check for sparc-leon. */ |
2039 | if (sparc_cpu_model == sparc_leon) { | 2039 | if (sparc_cpu_model == sparc_leon) { |
2040 | psr_typ = 0xf; /* hardcoded ids for older models/simulators */ | ||
2041 | psr_vers = 2; | ||
2042 | init_leon(); | 2040 | init_leon(); |
2043 | return; | 2041 | return; |
2044 | } | 2042 | } |
@@ -2301,7 +2299,8 @@ void __init ld_mmu_srmmu(void) | |||
2301 | BTFIXUPSET_CALL(flush_cache_mm, smp_flush_cache_mm, BTFIXUPCALL_NORM); | 2299 | BTFIXUPSET_CALL(flush_cache_mm, smp_flush_cache_mm, BTFIXUPCALL_NORM); |
2302 | BTFIXUPSET_CALL(flush_cache_range, smp_flush_cache_range, BTFIXUPCALL_NORM); | 2300 | BTFIXUPSET_CALL(flush_cache_range, smp_flush_cache_range, BTFIXUPCALL_NORM); |
2303 | BTFIXUPSET_CALL(flush_cache_page, smp_flush_cache_page, BTFIXUPCALL_NORM); | 2301 | BTFIXUPSET_CALL(flush_cache_page, smp_flush_cache_page, BTFIXUPCALL_NORM); |
2304 | if (sparc_cpu_model != sun4d) { | 2302 | if (sparc_cpu_model != sun4d && |
2303 | sparc_cpu_model != sparc_leon) { | ||
2305 | BTFIXUPSET_CALL(flush_tlb_all, smp_flush_tlb_all, BTFIXUPCALL_NORM); | 2304 | BTFIXUPSET_CALL(flush_tlb_all, smp_flush_tlb_all, BTFIXUPCALL_NORM); |
2306 | BTFIXUPSET_CALL(flush_tlb_mm, smp_flush_tlb_mm, BTFIXUPCALL_NORM); | 2305 | BTFIXUPSET_CALL(flush_tlb_mm, smp_flush_tlb_mm, BTFIXUPCALL_NORM); |
2307 | BTFIXUPSET_CALL(flush_tlb_range, smp_flush_tlb_range, BTFIXUPCALL_NORM); | 2306 | BTFIXUPSET_CALL(flush_tlb_range, smp_flush_tlb_range, BTFIXUPCALL_NORM); |
@@ -2330,6 +2329,8 @@ void __init ld_mmu_srmmu(void) | |||
2330 | #ifdef CONFIG_SMP | 2329 | #ifdef CONFIG_SMP |
2331 | if (sparc_cpu_model == sun4d) | 2330 | if (sparc_cpu_model == sun4d) |
2332 | sun4d_init_smp(); | 2331 | sun4d_init_smp(); |
2332 | else if (sparc_cpu_model == sparc_leon) | ||
2333 | leon_init_smp(); | ||
2333 | else | 2334 | else |
2334 | sun4m_init_smp(); | 2335 | sun4m_init_smp(); |
2335 | #endif | 2336 | #endif |
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 2ffacd67c424..a89baf0d875a 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/seq_file.h> | 18 | #include <linux/seq_file.h> |
19 | #include <linux/scatterlist.h> | 19 | #include <linux/scatterlist.h> |
20 | #include <linux/bitmap.h> | ||
20 | 21 | ||
21 | #include <asm/sections.h> | 22 | #include <asm/sections.h> |
22 | #include <asm/page.h> | 23 | #include <asm/page.h> |
@@ -1021,20 +1022,12 @@ static char *sun4c_lockarea(char *vaddr, unsigned long size) | |||
1021 | npages = (((unsigned long)vaddr & ~PAGE_MASK) + | 1022 | npages = (((unsigned long)vaddr & ~PAGE_MASK) + |
1022 | size + (PAGE_SIZE-1)) >> PAGE_SHIFT; | 1023 | size + (PAGE_SIZE-1)) >> PAGE_SHIFT; |
1023 | 1024 | ||
1024 | scan = 0; | ||
1025 | local_irq_save(flags); | 1025 | local_irq_save(flags); |
1026 | for (;;) { | 1026 | base = bitmap_find_next_zero_area(sun4c_iobuffer_map, iobuffer_map_size, |
1027 | scan = find_next_zero_bit(sun4c_iobuffer_map, | 1027 | 0, npages, 0); |
1028 | iobuffer_map_size, scan); | 1028 | if (base >= iobuffer_map_size) |
1029 | if ((base = scan) + npages > iobuffer_map_size) goto abend; | 1029 | goto abend; |
1030 | for (;;) { | ||
1031 | if (scan >= base + npages) goto found; | ||
1032 | if (test_bit(scan, sun4c_iobuffer_map)) break; | ||
1033 | scan++; | ||
1034 | } | ||
1035 | } | ||
1036 | 1030 | ||
1037 | found: | ||
1038 | high = ((base + npages) << PAGE_SHIFT) + sun4c_iobuffer_start; | 1031 | high = ((base + npages) << PAGE_SHIFT) + sun4c_iobuffer_start; |
1039 | high = SUN4C_REAL_PGDIR_ALIGN(high); | 1032 | high = SUN4C_REAL_PGDIR_ALIGN(high); |
1040 | while (high > sun4c_iobuffer_high) { | 1033 | while (high > sun4c_iobuffer_high) { |
diff --git a/arch/sparc/oprofile/init.c b/arch/sparc/oprofile/init.c index f97cb8b6ee5f..f9024bccff16 100644 --- a/arch/sparc/oprofile/init.c +++ b/arch/sparc/oprofile/init.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/oprofile.h> | 11 | #include <linux/oprofile.h> |
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/param.h> /* for HZ */ | ||
14 | 15 | ||
15 | #ifdef CONFIG_SPARC64 | 16 | #ifdef CONFIG_SPARC64 |
16 | #include <linux/notifier.h> | 17 | #include <linux/notifier.h> |