Commit b0f3ae03 authored by Paul Mundt's avatar Paul Mundt

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: default avatarPaul Mundt <lethal@linux-sh.org>
parent a4dad4c7
...@@ -102,13 +102,15 @@ struct pt_dspregs { ...@@ -102,13 +102,15 @@ struct pt_dspregs {
#define PTRACE_GETDSPREGS 55 /* DSP registers */ #define PTRACE_GETDSPREGS 55 /* DSP registers */
#define PTRACE_SETDSPREGS 56 #define PTRACE_SETDSPREGS 56
#define PT_TEXT_END_ADDR 240 #define PT_TEXT_END_ADDR 240
#define PT_TEXT_ADDR 244 /* &(struct user)->start_code */ #define PT_TEXT_ADDR 244 /* &(struct user)->start_code */
#define PT_DATA_ADDR 248 /* &(struct user)->start_data */ #define PT_DATA_ADDR 248 /* &(struct user)->start_data */
#define PT_TEXT_LEN 252 #define PT_TEXT_LEN 252
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <asm/addrspace.h> #include <asm/addrspace.h>
#include <asm/page.h>
#include <asm/system.h>
#define user_mode(regs) (((regs)->sr & 0x40000000)==0) #define user_mode(regs) (((regs)->sr & 0x40000000)==0)
#define instruction_pointer(regs) ((unsigned long)(regs)->pc) #define instruction_pointer(regs) ((unsigned long)(regs)->pc)
...@@ -137,9 +139,14 @@ static inline unsigned long profile_pc(struct pt_regs *regs) ...@@ -137,9 +139,14 @@ static inline unsigned long profile_pc(struct pt_regs *regs)
{ {
unsigned long pc = instruction_pointer(regs); unsigned long pc = instruction_pointer(regs);
#ifdef P2SEG #ifdef CONFIG_UNCACHED_MAPPING
if (pc >= P2SEG && pc < P3SEG) /*
pc -= 0x20000000; * If PC points in to the uncached mapping, fix it up and hand
* back the cached equivalent.
*/
if ((pc >= (memory_start + cached_to_uncached)) &&
(pc < (memory_start + cached_to_uncached + uncached_size)))
pc -= cached_to_uncached;
#endif #endif
return pc; return pc;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/ptrace.h>
#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */ #define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */
...@@ -114,6 +113,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old, ...@@ -114,6 +113,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
(unsigned long)_n_, sizeof(*(ptr))); \ (unsigned long)_n_, sizeof(*(ptr))); \
}) })
struct pt_regs;
extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn)); extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
void free_initmem(void); void free_initmem(void);
void free_initrd_mem(unsigned long start, unsigned long end); void free_initrd_mem(unsigned long start, unsigned long end);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
/* /*
* switch_to() should switch tasks to task nr n, first * switch_to() should switch tasks to task nr n, first
*/ */
struct thread_struct;
struct task_struct *sh64_switch_to(struct task_struct *prev, struct task_struct *sh64_switch_to(struct task_struct *prev,
struct thread_struct *prev_thread, struct thread_struct *prev_thread,
struct task_struct *next, struct task_struct *next,
......
...@@ -75,6 +75,7 @@ config MEMORY_SIZE ...@@ -75,6 +75,7 @@ config MEMORY_SIZE
config 29BIT config 29BIT
def_bool !32BIT def_bool !32BIT
depends on SUPERH32 depends on SUPERH32
select UNCACHED_MAPPING
config 32BIT config 32BIT
bool bool
...@@ -84,6 +85,7 @@ config PMB ...@@ -84,6 +85,7 @@ config PMB
bool "Support 32-bit physical addressing through PMB" bool "Support 32-bit physical addressing through PMB"
depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP depends on MMU && EXPERIMENTAL && CPU_SH4A && !CPU_SH4AL_DSP
select 32BIT select 32BIT
select UNCACHED_MAPPING
help help
If you say Y here, physical addressing will be extended to If you say Y here, physical addressing will be extended to
32-bits through the SH-4A PMB. If this is not set, legacy 32-bits through the SH-4A PMB. If this is not set, legacy
...@@ -173,6 +175,9 @@ config IOREMAP_FIXED ...@@ -173,6 +175,9 @@ config IOREMAP_FIXED
def_bool y def_bool y
depends on X2TLB || SUPERH64 depends on X2TLB || SUPERH64
config UNCACHED_MAPPING
bool
choice choice
prompt "Kernel page size" prompt "Kernel page size"
default PAGE_SIZE_4KB default PAGE_SIZE_4KB
......
...@@ -21,11 +21,12 @@ ...@@ -21,11 +21,12 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/cache.h> #include <asm/cache.h>
#include <asm/sizes.h>
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
pgd_t swapper_pg_dir[PTRS_PER_PGD]; pgd_t swapper_pg_dir[PTRS_PER_PGD];
#ifdef CONFIG_SUPERH32 #ifdef CONFIG_UNCACHED_MAPPING
/* /*
* This is the offset of the uncached section from its cached alias. * This is the offset of the uncached section from its cached alias.
* *
...@@ -36,8 +37,8 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD]; ...@@ -36,8 +37,8 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD];
* Default value only valid in 29 bit mode, in 32bit mode this will be * Default value only valid in 29 bit mode, in 32bit mode this will be
* updated by the early PMB initialization code. * updated by the early PMB initialization code.
*/ */
unsigned long cached_to_uncached = P2SEG - P1SEG; unsigned long cached_to_uncached = 0x20000000;
unsigned long uncached_size = 0x20000000; unsigned long uncached_size = SZ_512M;
#endif #endif
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
...@@ -281,7 +282,9 @@ void __init mem_init(void) ...@@ -281,7 +282,9 @@ void __init mem_init(void)
#endif #endif
" vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
" lowmem : 0x%08lx - 0x%08lx (%4ld MB) (cached)\n" " lowmem : 0x%08lx - 0x%08lx (%4ld MB) (cached)\n"
#ifdef CONFIG_UNCACHED_MAPPING
" : 0x%08lx - 0x%08lx (%4ld MB) (uncached)\n" " : 0x%08lx - 0x%08lx (%4ld MB) (uncached)\n"
#endif
" .init : 0x%08lx - 0x%08lx (%4ld kB)\n" " .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
" .data : 0x%08lx - 0x%08lx (%4ld kB)\n" " .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
" .text : 0x%08lx - 0x%08lx (%4ld kB)\n", " .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
...@@ -299,9 +302,11 @@ void __init mem_init(void) ...@@ -299,9 +302,11 @@ void __init mem_init(void)
(unsigned long)memory_start, (unsigned long)high_memory, (unsigned long)memory_start, (unsigned long)high_memory,
((unsigned long)high_memory - (unsigned long)memory_start) >> 20, ((unsigned long)high_memory - (unsigned long)memory_start) >> 20,
#ifdef CONFIG_UNCACHED_MAPPING
(unsigned long)memory_start + cached_to_uncached, (unsigned long)memory_start + cached_to_uncached,
(unsigned long)memory_start + cached_to_uncached + uncached_size, (unsigned long)memory_start + cached_to_uncached + uncached_size,
uncached_size >> 20, uncached_size >> 20,
#endif
(unsigned long)&__init_begin, (unsigned long)&__init_end, (unsigned long)&__init_begin, (unsigned long)&__init_end,
((unsigned long)&__init_end - ((unsigned long)&__init_end -
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment