aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-02-12 01:40:00 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-02-12 01:40:00 -0500
commitb0f3ae03aca0f331b851ae94bc066124e7f104df (patch)
tree510b641df1414800abcbe022986d5c9075017759 /arch/sh
parenta4dad4c75c4ae378c2a5d66938b8467802c2e98f (diff)
sh: Isolate uncached mapping support.
This splits out the uncached mapping support under its own config option, presently only used by 29-bit mode and 32-bit + PMB. This will make it possible to optionally add an uncached mapping on sh64 as well as booting without an uncached mapping for 32-bit. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/include/asm/ptrace.h19
-rw-r--r--arch/sh/include/asm/system.h3
-rw-r--r--arch/sh/include/asm/system_64.h1
-rw-r--r--arch/sh/mm/Kconfig5
-rw-r--r--arch/sh/mm/init.c11
5 files changed, 29 insertions, 10 deletions
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 201d11ef211f..e879dffa324b 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -102,13 +102,15 @@ struct pt_dspregs {
102#define PTRACE_GETDSPREGS 55 /* DSP registers */ 102#define PTRACE_GETDSPREGS 55 /* DSP registers */
103#define PTRACE_SETDSPREGS 56 103#define PTRACE_SETDSPREGS 56
104 104
105#define PT_TEXT_END_ADDR 240 105#define PT_TEXT_END_ADDR 240
106#define PT_TEXT_ADDR 244 /* &(struct user)->start_code */ 106#define PT_TEXT_ADDR 244 /* &(struct user)->start_code */
107#define PT_DATA_ADDR 248 /* &(struct user)->start_data */ 107#define PT_DATA_ADDR 248 /* &(struct user)->start_data */
108#define PT_TEXT_LEN 252 108#define PT_TEXT_LEN 252
109 109
110#ifdef __KERNEL__ 110#ifdef __KERNEL__
111#include <asm/addrspace.h> 111#include <asm/addrspace.h>
112#include <asm/page.h>
113#include <asm/system.h>
112 114
113#define user_mode(regs) (((regs)->sr & 0x40000000)==0) 115#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
114#define instruction_pointer(regs) ((unsigned long)(regs)->pc) 116#define instruction_pointer(regs) ((unsigned long)(regs)->pc)
@@ -137,9 +139,14 @@ static inline unsigned long profile_pc(struct pt_regs *regs)
137{ 139{
138 unsigned long pc = instruction_pointer(regs); 140 unsigned long pc = instruction_pointer(regs);
139 141
140#ifdef P2SEG 142#ifdef CONFIG_UNCACHED_MAPPING
141 if (pc >= P2SEG && pc < P3SEG) 143 /*
142 pc -= 0x20000000; 144 * If PC points in to the uncached mapping, fix it up and hand
145 * back the cached equivalent.
146 */
147 if ((pc >= (memory_start + cached_to_uncached)) &&
148 (pc < (memory_start + cached_to_uncached + uncached_size)))
149 pc -= cached_to_uncached;
143#endif 150#endif
144 151
145 return pc; 152 return pc;
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
index 6442f1783fe0..0bd7a17d5e1a 100644
--- a/arch/sh/include/asm/system.h
+++ b/arch/sh/include/asm/system.h
@@ -10,7 +10,6 @@
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <asm/types.h> 12#include <asm/types.h>
13#include <asm/ptrace.h>
14 13
15#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */ 14#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */
16 15
@@ -114,6 +113,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
114 (unsigned long)_n_, sizeof(*(ptr))); \ 113 (unsigned long)_n_, sizeof(*(ptr))); \
115 }) 114 })
116 115
116struct pt_regs;
117
117extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn)); 118extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
118void free_initmem(void); 119void free_initmem(void);
119void free_initrd_mem(unsigned long start, unsigned long end); 120void free_initrd_mem(unsigned long start, unsigned long end);
diff --git a/arch/sh/include/asm/system_64.h b/arch/sh/include/asm/system_64.h
index 3391bb6b21d8..36338646dfc8 100644
--- a/arch/sh/include/asm/system_64.h
+++ b/arch/sh/include/asm/system_64.h
@@ -18,6 +18,7 @@
18/* 18/*
19 * switch_to() should switch tasks to task nr n, first 19 * switch_to() should switch tasks to task nr n, first
20 */ 20 */
21struct thread_struct;
21struct task_struct *sh64_switch_to(struct task_struct *prev, 22struct task_struct *sh64_switch_to(struct task_struct *prev,
22 struct thread_struct *prev_thread, 23 struct thread_struct *prev_thread,
23 struct task_struct *next, 24 struct task_struct *next,
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index b89075256b70..65cb5b83e072 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -75,6 +75,7 @@ config MEMORY_SIZE
75config 29BIT 75config 29BIT
76 def_bool !32BIT 76 def_bool !32BIT
77 depends on SUPERH32 77 depends on SUPERH32
78 select UNCACHED_MAPPING
78 79
79config 32BIT 80config 32BIT
80 bool 81 bool
@@ -84,6 +85,7 @@ config PMB
84 bool "Support 32-bit physical addressing through PMB" 85 bool "Support 32-bit physical addressing through PMB"
85 depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP 86 depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP
86 select 32BIT 87 select 32BIT
88 select UNCACHED_MAPPING
87 help 89 help
88 If you say Y here, physical addressing will be extended to 90 If you say Y here, physical addressing will be extended to
89 32-bits through the SH-4A PMB. If this is not set, legacy 91 32-bits through the SH-4A PMB. If this is not set, legacy
@@ -173,6 +175,9 @@ config IOREMAP_FIXED
173 def_bool y 175 def_bool y
174 depends on X2TLB || SUPERH64 176 depends on X2TLB || SUPERH64
175 177
178config UNCACHED_MAPPING
179 bool
180
176choice 181choice
177 prompt "Kernel page size" 182 prompt "Kernel page size"
178 default PAGE_SIZE_4KB 183 default PAGE_SIZE_4KB
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index dffa6c749489..58012b6bbe76 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -21,11 +21,12 @@
21#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
22#include <asm/sections.h> 22#include <asm/sections.h>
23#include <asm/cache.h> 23#include <asm/cache.h>
24#include <asm/sizes.h>
24 25
25DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 26DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
26pgd_t swapper_pg_dir[PTRS_PER_PGD]; 27pgd_t swapper_pg_dir[PTRS_PER_PGD];
27 28
28#ifdef CONFIG_SUPERH32 29#ifdef CONFIG_UNCACHED_MAPPING
29/* 30/*
30 * This is the offset of the uncached section from its cached alias. 31 * This is the offset of the uncached section from its cached alias.
31 * 32 *
@@ -36,8 +37,8 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD];
36 * Default value only valid in 29 bit mode, in 32bit mode this will be 37 * Default value only valid in 29 bit mode, in 32bit mode this will be
37 * updated by the early PMB initialization code. 38 * updated by the early PMB initialization code.
38 */ 39 */
39unsigned long cached_to_uncached = P2SEG - P1SEG; 40unsigned long cached_to_uncached = 0x20000000;
40unsigned long uncached_size = 0x20000000; 41unsigned long uncached_size = SZ_512M;
41#endif 42#endif
42 43
43#ifdef CONFIG_MMU 44#ifdef CONFIG_MMU
@@ -281,7 +282,9 @@ void __init mem_init(void)
281#endif 282#endif
282 " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" 283 " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
283 " lowmem : 0x%08lx - 0x%08lx (%4ld MB) (cached)\n" 284 " lowmem : 0x%08lx - 0x%08lx (%4ld MB) (cached)\n"
285#ifdef CONFIG_UNCACHED_MAPPING
284 " : 0x%08lx - 0x%08lx (%4ld MB) (uncached)\n" 286 " : 0x%08lx - 0x%08lx (%4ld MB) (uncached)\n"
287#endif
285 " .init : 0x%08lx - 0x%08lx (%4ld kB)\n" 288 " .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
286 " .data : 0x%08lx - 0x%08lx (%4ld kB)\n" 289 " .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
287 " .text : 0x%08lx - 0x%08lx (%4ld kB)\n", 290 " .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
@@ -299,9 +302,11 @@ void __init mem_init(void)
299 (unsigned long)memory_start, (unsigned long)high_memory, 302 (unsigned long)memory_start, (unsigned long)high_memory,
300 ((unsigned long)high_memory - (unsigned long)memory_start) >> 20, 303 ((unsigned long)high_memory - (unsigned long)memory_start) >> 20,
301 304
305#ifdef CONFIG_UNCACHED_MAPPING
302 (unsigned long)memory_start + cached_to_uncached, 306 (unsigned long)memory_start + cached_to_uncached,
303 (unsigned long)memory_start + cached_to_uncached + uncached_size, 307 (unsigned long)memory_start + cached_to_uncached + uncached_size,
304 uncached_size >> 20, 308 uncached_size >> 20,
309#endif
305 310
306 (unsigned long)&__init_begin, (unsigned long)&__init_end, 311 (unsigned long)&__init_begin, (unsigned long)&__init_end,
307 ((unsigned long)&__init_end - 312 ((unsigned long)&__init_end -