diff options
| author | Yoshinori Sato <ysato@users.sourceforge.jp> | 2006-09-27 04:25:07 -0400 |
|---|---|---|
| committer | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 04:25:07 -0400 |
| commit | a2d1a5fae6296c2a3ac1aaa982c95464c46c0585 (patch) | |
| tree | fa704906d368f6ab0f03b164d5071992a4029a9a | |
| parent | 0b8929354cdeddb17e81bfda903812c9adfd0b67 (diff) | |
sh: __addr_ok() and other misc nommu fixups.
A few more outstanding nommu fixups..
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
| -rw-r--r-- | arch/sh/boot/compressed/Makefile | 6 | ||||
| -rw-r--r-- | arch/sh/kernel/process.c | 13 | ||||
| -rw-r--r-- | arch/sh/kernel/sh_ksyms.c | 10 | ||||
| -rw-r--r-- | arch/sh/kernel/sys_sh.c | 2 | ||||
| -rw-r--r-- | arch/sh/mm/Kconfig | 2 | ||||
| -rw-r--r-- | arch/sh/mm/Makefile | 4 | ||||
| -rw-r--r-- | include/asm-sh/addrspace.h | 4 | ||||
| -rw-r--r-- | include/asm-sh/io.h | 5 | ||||
| -rw-r--r-- | include/asm-sh/uaccess.h | 9 |
9 files changed, 33 insertions, 22 deletions
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile index 903470429cb4..e5f443790079 100644 --- a/arch/sh/boot/compressed/Makefile +++ b/arch/sh/boot/compressed/Makefile | |||
| @@ -22,9 +22,9 @@ CONFIG_PAGE_OFFSET ?= 0x80000000 | |||
| 22 | CONFIG_MEMORY_START ?= 0x0c000000 | 22 | CONFIG_MEMORY_START ?= 0x0c000000 |
| 23 | CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 | 23 | CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 |
| 24 | 24 | ||
| 25 | IMAGE_OFFSET := $(shell printf "0x%8x" $$[$(CONFIG_PAGE_OFFSET) + \ | 25 | IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_PAGE_OFFSET) + \ |
| 26 | $(CONFIG_MEMORY_START) + \ | 26 | $(CONFIG_MEMORY_START) + \ |
| 27 | $(CONFIG_BOOT_LINK_OFFSET)]) | 27 | $(CONFIG_BOOT_LINK_OFFSET)]) |
| 28 | 28 | ||
| 29 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) | 29 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) |
| 30 | 30 | ||
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 4a32550fd7c6..c4aa687ba26a 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c | |||
| @@ -302,9 +302,11 @@ ubc_set_tracing(int asid, unsigned long pc) | |||
| 302 | { | 302 | { |
| 303 | ctrl_outl(pc, UBC_BARA); | 303 | ctrl_outl(pc, UBC_BARA); |
| 304 | 304 | ||
| 305 | #ifdef CONFIG_MMU | ||
| 305 | /* We don't have any ASID settings for the SH-2! */ | 306 | /* We don't have any ASID settings for the SH-2! */ |
| 306 | if (cpu_data->type != CPU_SH7604) | 307 | if (cpu_data->type != CPU_SH7604) |
| 307 | ctrl_outb(asid, UBC_BASRA); | 308 | ctrl_outb(asid, UBC_BASRA); |
| 309 | #endif | ||
| 308 | 310 | ||
| 309 | ctrl_outl(0, UBC_BAMRA); | 311 | ctrl_outl(0, UBC_BAMRA); |
| 310 | 312 | ||
| @@ -347,6 +349,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne | |||
| 347 | } | 349 | } |
| 348 | #endif | 350 | #endif |
| 349 | 351 | ||
| 352 | #ifdef CONFIG_MMU | ||
| 350 | /* | 353 | /* |
| 351 | * Restore the kernel mode register | 354 | * Restore the kernel mode register |
| 352 | * k7 (r7_bank1) | 355 | * k7 (r7_bank1) |
| @@ -354,19 +357,21 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne | |||
| 354 | asm volatile("ldc %0, r7_bank" | 357 | asm volatile("ldc %0, r7_bank" |
| 355 | : /* no output */ | 358 | : /* no output */ |
| 356 | : "r" (task_thread_info(next))); | 359 | : "r" (task_thread_info(next))); |
| 360 | #endif | ||
| 357 | 361 | ||
| 358 | #ifdef CONFIG_MMU | ||
| 359 | /* If no tasks are using the UBC, we're done */ | 362 | /* If no tasks are using the UBC, we're done */ |
| 360 | if (ubc_usercnt == 0) | 363 | if (ubc_usercnt == 0) |
| 361 | /* If no tasks are using the UBC, we're done */; | 364 | /* If no tasks are using the UBC, we're done */; |
| 362 | else if (next->thread.ubc_pc && next->mm) { | 365 | else if (next->thread.ubc_pc && next->mm) { |
| 363 | ubc_set_tracing(next->mm->context & MMU_CONTEXT_ASID_MASK, | 366 | int asid = 0; |
| 364 | next->thread.ubc_pc); | 367 | #ifdef CONFIG_MMU |
| 368 | asid |= next->mm->context & MMU_CONTEXT_ASID_MASK; | ||
| 369 | #endif | ||
| 370 | ubc_set_tracing(asid, next->thread.ubc_pc); | ||
| 365 | } else { | 371 | } else { |
| 366 | ctrl_outw(0, UBC_BBRA); | 372 | ctrl_outw(0, UBC_BBRA); |
| 367 | ctrl_outw(0, UBC_BBRB); | 373 | ctrl_outw(0, UBC_BBRB); |
| 368 | } | 374 | } |
| 369 | #endif | ||
| 370 | 375 | ||
| 371 | return prev; | 376 | return prev; |
| 372 | } | 377 | } |
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c index 7f3a42244cab..bf59d73415d7 100644 --- a/arch/sh/kernel/sh_ksyms.c +++ b/arch/sh/kernel/sh_ksyms.c | |||
| @@ -79,20 +79,18 @@ EXPORT_SYMBOL(strcpy); | |||
| 79 | DECLARE_EXPORT(__movstr_i4_even); | 79 | DECLARE_EXPORT(__movstr_i4_even); |
| 80 | DECLARE_EXPORT(__movstr_i4_odd); | 80 | DECLARE_EXPORT(__movstr_i4_odd); |
| 81 | DECLARE_EXPORT(__movstrSI12_i4); | 81 | DECLARE_EXPORT(__movstrSI12_i4); |
| 82 | #endif | ||
| 82 | 83 | ||
| 84 | #if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB) | ||
| 83 | /* needed by some modules */ | 85 | /* needed by some modules */ |
| 84 | EXPORT_SYMBOL(flush_cache_all); | 86 | EXPORT_SYMBOL(flush_cache_all); |
| 85 | EXPORT_SYMBOL(flush_cache_range); | 87 | EXPORT_SYMBOL(flush_cache_range); |
| 86 | EXPORT_SYMBOL(flush_dcache_page); | 88 | EXPORT_SYMBOL(flush_dcache_page); |
| 87 | EXPORT_SYMBOL(__flush_purge_region); | 89 | EXPORT_SYMBOL(__flush_purge_region); |
| 88 | EXPORT_SYMBOL(clear_user_page); | ||
| 89 | #endif | 90 | #endif |
| 90 | 91 | ||
| 91 | #if defined(CONFIG_SH7705_CACHE_32KB) | 92 | #ifdef CONFIG_MMU |
| 92 | EXPORT_SYMBOL(flush_cache_all); | 93 | EXPORT_SYMBOL(clear_user_page); |
| 93 | EXPORT_SYMBOL(flush_cache_range); | ||
| 94 | EXPORT_SYMBOL(flush_dcache_page); | ||
| 95 | EXPORT_SYMBOL(__flush_purge_region); | ||
| 96 | #endif | 94 | #endif |
| 97 | 95 | ||
| 98 | EXPORT_SYMBOL(flush_tlb_page); | 96 | EXPORT_SYMBOL(flush_tlb_page); |
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c index d8bcd8a22327..0ee7bf4cb238 100644 --- a/arch/sh/kernel/sys_sh.c +++ b/arch/sh/kernel/sys_sh.c | |||
| @@ -44,7 +44,7 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, | |||
| 44 | return error; | 44 | return error; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | #if defined(HAVE_ARCH_UNMAPPED_AREA) | 47 | #if defined(HAVE_ARCH_UNMAPPED_AREA) && defined(CONFIG_MMU) |
| 48 | /* | 48 | /* |
| 49 | * To avoid cache alias, we map the shard page with same color. | 49 | * To avoid cache alias, we map the shard page with same color. |
| 50 | */ | 50 | */ |
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig index f25903aa607b..bed697c0dc19 100644 --- a/arch/sh/mm/Kconfig +++ b/arch/sh/mm/Kconfig | |||
| @@ -194,7 +194,7 @@ config MEMORY_SIZE | |||
| 194 | 194 | ||
| 195 | config 32BIT | 195 | config 32BIT |
| 196 | bool "Support 32-bit physical addressing through PMB" | 196 | bool "Support 32-bit physical addressing through PMB" |
| 197 | depends on CPU_SH4A | 197 | depends on CPU_SH4A && MMU |
| 198 | default y | 198 | default y |
| 199 | help | 199 | help |
| 200 | If you say Y here, physical addressing will be extended to | 200 | If you say Y here, physical addressing will be extended to |
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile index 87a7c07265c0..da37d86e65eb 100644 --- a/arch/sh/mm/Makefile +++ b/arch/sh/mm/Makefile | |||
| @@ -6,7 +6,7 @@ obj-y := init.o extable.o consistent.o | |||
| 6 | 6 | ||
| 7 | obj-$(CONFIG_CPU_SH2) += cache-sh2.o | 7 | obj-$(CONFIG_CPU_SH2) += cache-sh2.o |
| 8 | obj-$(CONFIG_CPU_SH3) += cache-sh3.o | 8 | obj-$(CONFIG_CPU_SH3) += cache-sh3.o |
| 9 | obj-$(CONFIG_CPU_SH4) += cache-sh4.o pg-sh4.o | 9 | obj-$(CONFIG_CPU_SH4) += cache-sh4.o |
| 10 | 10 | ||
| 11 | obj-$(CONFIG_DMA_PAGE_OPS) += pg-dma.o | 11 | obj-$(CONFIG_DMA_PAGE_OPS) += pg-dma.o |
| 12 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o | 12 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o |
| @@ -19,7 +19,7 @@ obj-y += $(mmu-y) | |||
| 19 | 19 | ||
| 20 | ifdef CONFIG_MMU | 20 | ifdef CONFIG_MMU |
| 21 | obj-$(CONFIG_CPU_SH3) += tlb-sh3.o | 21 | obj-$(CONFIG_CPU_SH3) += tlb-sh3.o |
| 22 | obj-$(CONFIG_CPU_SH4) += tlb-sh4.o | 22 | obj-$(CONFIG_CPU_SH4) += tlb-sh4.o pg-sh4.o |
| 23 | obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o | 23 | obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o |
| 24 | endif | 24 | endif |
| 25 | 25 | ||
diff --git a/include/asm-sh/addrspace.h b/include/asm-sh/addrspace.h index 4207368267b1..b860218e402e 100644 --- a/include/asm-sh/addrspace.h +++ b/include/asm-sh/addrspace.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include <asm/cpu/addrspace.h> | 14 | #include <asm/cpu/addrspace.h> |
| 15 | 15 | ||
| 16 | /* Memory segments (32bit Privileged mode addresses) */ | 16 | /* Memory segments (32bit Privileged mode addresses) */ |
| 17 | #ifdef CONFIG_MMU | 17 | #ifndef CONFIG_CPU_SH2A |
| 18 | #define P0SEG 0x00000000 | 18 | #define P0SEG 0x00000000 |
| 19 | #define P1SEG 0x80000000 | 19 | #define P1SEG 0x80000000 |
| 20 | #define P2SEG 0xa0000000 | 20 | #define P2SEG 0xa0000000 |
| @@ -24,7 +24,7 @@ | |||
| 24 | #define P0SEG 0x00000000 | 24 | #define P0SEG 0x00000000 |
| 25 | #define P1SEG 0x00000000 | 25 | #define P1SEG 0x00000000 |
| 26 | #define P2SEG 0x20000000 | 26 | #define P2SEG 0x20000000 |
| 27 | #define P3SEG 0x40000000 | 27 | #define P3SEG 0x00000000 |
| 28 | #define P4SEG 0x80000000 | 28 | #define P4SEG 0x80000000 |
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h index 27dba653cbe7..377160b86295 100644 --- a/include/asm-sh/io.h +++ b/include/asm-sh/io.h | |||
| @@ -216,6 +216,7 @@ static inline void ctrl_delay(void) | |||
| 216 | 216 | ||
| 217 | #define IO_SPACE_LIMIT 0xffffffff | 217 | #define IO_SPACE_LIMIT 0xffffffff |
| 218 | 218 | ||
| 219 | #ifdef CONFIG_MMU | ||
| 219 | /* | 220 | /* |
| 220 | * Change virtual addresses to physical addresses and vv. | 221 | * Change virtual addresses to physical addresses and vv. |
| 221 | * These are trivial on the 1:1 Linux/SuperH mapping | 222 | * These are trivial on the 1:1 Linux/SuperH mapping |
| @@ -229,6 +230,10 @@ static inline void *phys_to_virt(unsigned long address) | |||
| 229 | { | 230 | { |
| 230 | return (void *)P1SEGADDR(address); | 231 | return (void *)P1SEGADDR(address); |
| 231 | } | 232 | } |
| 233 | #else | ||
| 234 | #define phys_to_virt(address) ((void *)(address)) | ||
| 235 | #define virt_to_phys(address) ((unsigned long)(address)) | ||
| 236 | #endif | ||
| 232 | 237 | ||
| 233 | #define virt_to_bus virt_to_phys | 238 | #define virt_to_bus virt_to_phys |
| 234 | #define bus_to_virt phys_to_virt | 239 | #define bus_to_virt phys_to_virt |
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h index 5c3b00c2f107..5c49ed6715f2 100644 --- a/include/asm-sh/uaccess.h +++ b/include/asm-sh/uaccess.h | |||
| @@ -34,12 +34,12 @@ | |||
| 34 | 34 | ||
| 35 | #define segment_eq(a,b) ((a).seg == (b).seg) | 35 | #define segment_eq(a,b) ((a).seg == (b).seg) |
| 36 | 36 | ||
| 37 | #define __addr_ok(addr) \ | ||
| 38 | ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) | ||
| 39 | |||
| 40 | #define get_ds() (KERNEL_DS) | 37 | #define get_ds() (KERNEL_DS) |
| 41 | 38 | ||
| 42 | #if !defined(CONFIG_MMU) | 39 | #if !defined(CONFIG_MMU) |
| 40 | /* NOMMU is always true */ | ||
| 41 | #define __addr_ok(addr) (1) | ||
| 42 | |||
| 43 | static inline mm_segment_t get_fs(void) | 43 | static inline mm_segment_t get_fs(void) |
| 44 | { | 44 | { |
| 45 | return USER_DS; | 45 | return USER_DS; |
| @@ -66,6 +66,9 @@ static inline int __access_ok(unsigned long addr, unsigned long size) | |||
| 66 | return ((addr >= memory_start) && ((addr + size) < memory_end)); | 66 | return ((addr >= memory_start) && ((addr + size) < memory_end)); |
| 67 | } | 67 | } |
| 68 | #else /* CONFIG_MMU */ | 68 | #else /* CONFIG_MMU */ |
| 69 | #define __addr_ok(addr) \ | ||
| 70 | ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) | ||
| 71 | |||
| 69 | #define get_fs() (current_thread_info()->addr_limit) | 72 | #define get_fs() (current_thread_info()->addr_limit) |
| 70 | #define set_fs(x) (current_thread_info()->addr_limit = (x)) | 73 | #define set_fs(x) (current_thread_info()->addr_limit = (x)) |
| 71 | 74 | ||
