diff options
Diffstat (limited to 'arch/sh/mm')
-rw-r--r-- | arch/sh/mm/Makefile_32 | 2 | ||||
-rw-r--r-- | arch/sh/mm/Makefile_64 | 2 | ||||
-rw-r--r-- | arch/sh/mm/init.c | 12 | ||||
-rw-r--r-- | arch/sh/mm/mmap.c | 31 | ||||
-rw-r--r-- | arch/sh/mm/pg-sh4.c | 17 |
5 files changed, 59 insertions, 5 deletions
diff --git a/arch/sh/mm/Makefile_32 b/arch/sh/mm/Makefile_32 index 70e0906023cc..f066e76da204 100644 --- a/arch/sh/mm/Makefile_32 +++ b/arch/sh/mm/Makefile_32 | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Linux SuperH-specific parts of the memory manager. | 2 | # Makefile for the Linux SuperH-specific parts of the memory manager. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := init.o extable_32.o consistent.o | 5 | obj-y := init.o extable_32.o consistent.o mmap.o |
6 | 6 | ||
7 | ifndef CONFIG_CACHE_OFF | 7 | ifndef CONFIG_CACHE_OFF |
8 | cache-$(CONFIG_CPU_SH2) := cache-sh2.o | 8 | cache-$(CONFIG_CPU_SH2) := cache-sh2.o |
diff --git a/arch/sh/mm/Makefile_64 b/arch/sh/mm/Makefile_64 index 0d92a8a3ac9a..9481d0f54efd 100644 --- a/arch/sh/mm/Makefile_64 +++ b/arch/sh/mm/Makefile_64 | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Linux SuperH-specific parts of the memory manager. | 2 | # Makefile for the Linux SuperH-specific parts of the memory manager. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := init.o consistent.o | 5 | obj-y := init.o consistent.o mmap.o |
6 | 6 | ||
7 | mmu-y := tlb-nommu.o pg-nommu.o extable_32.o | 7 | mmu-y := tlb-nommu.o pg-nommu.o extable_32.o |
8 | mmu-$(CONFIG_MMU) := fault_64.o ioremap_64.o tlbflush_64.o tlb-sh5.o \ | 8 | mmu-$(CONFIG_MMU) := fault_64.o ioremap_64.o tlbflush_64.o tlb-sh5.o \ |
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 4abf00031dae..6cbef8caeb56 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -137,6 +137,7 @@ void __init page_table_range_init(unsigned long start, unsigned long end, | |||
137 | void __init paging_init(void) | 137 | void __init paging_init(void) |
138 | { | 138 | { |
139 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | 139 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
140 | unsigned long vaddr; | ||
140 | int nid; | 141 | int nid; |
141 | 142 | ||
142 | /* We don't need to map the kernel through the TLB, as | 143 | /* We don't need to map the kernel through the TLB, as |
@@ -148,10 +149,15 @@ void __init paging_init(void) | |||
148 | * check for a null value. */ | 149 | * check for a null value. */ |
149 | set_TTB(swapper_pg_dir); | 150 | set_TTB(swapper_pg_dir); |
150 | 151 | ||
151 | /* Populate the relevant portions of swapper_pg_dir so that | 152 | /* |
153 | * Populate the relevant portions of swapper_pg_dir so that | ||
152 | * we can use the fixmap entries without calling kmalloc. | 154 | * we can use the fixmap entries without calling kmalloc. |
153 | * pte's will be filled in by __set_fixmap(). */ | 155 | * pte's will be filled in by __set_fixmap(). |
154 | page_table_range_init(FIXADDR_START, FIXADDR_TOP, swapper_pg_dir); | 156 | */ |
157 | vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; | ||
158 | page_table_range_init(vaddr, 0, swapper_pg_dir); | ||
159 | |||
160 | kmap_coherent_init(); | ||
155 | 161 | ||
156 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | 162 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
157 | 163 | ||
diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c new file mode 100644 index 000000000000..8837d511710a --- /dev/null +++ b/arch/sh/mm/mmap.c | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * arch/sh/mm/mmap.c | ||
3 | * | ||
4 | * Copyright (C) 2008 Paul Mundt | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #include <linux/io.h> | ||
11 | #include <linux/mm.h> | ||
12 | #include <asm/page.h> | ||
13 | |||
14 | /* | ||
15 | * You really shouldn't be using read() or write() on /dev/mem. This | ||
16 | * might go away in the future. | ||
17 | */ | ||
18 | int valid_phys_addr_range(unsigned long addr, size_t count) | ||
19 | { | ||
20 | if (addr < __MEMORY_START) | ||
21 | return 0; | ||
22 | if (addr + count > __pa(high_memory)) | ||
23 | return 0; | ||
24 | |||
25 | return 1; | ||
26 | } | ||
27 | |||
28 | int valid_mmap_phys_addr_range(unsigned long pfn, size_t size) | ||
29 | { | ||
30 | return 1; | ||
31 | } | ||
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c index 38870e0fc182..2fe14da1f839 100644 --- a/arch/sh/mm/pg-sh4.c +++ b/arch/sh/mm/pg-sh4.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * Released under the terms of the GNU GPL v2.0. | 7 | * Released under the terms of the GNU GPL v2.0. |
8 | */ | 8 | */ |
9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
10 | #include <linux/init.h> | ||
10 | #include <linux/mutex.h> | 11 | #include <linux/mutex.h> |
11 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
12 | #include <linux/highmem.h> | 13 | #include <linux/highmem.h> |
@@ -16,6 +17,20 @@ | |||
16 | 17 | ||
17 | #define CACHE_ALIAS (current_cpu_data.dcache.alias_mask) | 18 | #define CACHE_ALIAS (current_cpu_data.dcache.alias_mask) |
18 | 19 | ||
20 | #define kmap_get_fixmap_pte(vaddr) \ | ||
21 | pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr)) | ||
22 | |||
23 | static pte_t *kmap_coherent_pte; | ||
24 | |||
25 | void __init kmap_coherent_init(void) | ||
26 | { | ||
27 | unsigned long vaddr; | ||
28 | |||
29 | /* cache the first coherent kmap pte */ | ||
30 | vaddr = __fix_to_virt(FIX_CMAP_BEGIN); | ||
31 | kmap_coherent_pte = kmap_get_fixmap_pte(vaddr); | ||
32 | } | ||
33 | |||
19 | static inline void *kmap_coherent(struct page *page, unsigned long addr) | 34 | static inline void *kmap_coherent(struct page *page, unsigned long addr) |
20 | { | 35 | { |
21 | enum fixed_addresses idx; | 36 | enum fixed_addresses idx; |
@@ -34,6 +49,8 @@ static inline void *kmap_coherent(struct page *page, unsigned long addr) | |||
34 | 49 | ||
35 | update_mmu_cache(NULL, vaddr, pte); | 50 | update_mmu_cache(NULL, vaddr, pte); |
36 | 51 | ||
52 | set_pte(kmap_coherent_pte - (FIX_CMAP_END - idx), pte); | ||
53 | |||
37 | return (void *)vaddr; | 54 | return (void *)vaddr; |
38 | } | 55 | } |
39 | 56 | ||