diff options
Diffstat (limited to 'arch/sh/mm/init.c')
-rw-r--r-- | arch/sh/mm/init.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index fe532aeaa16d..edc842ff61ed 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -106,27 +106,31 @@ void __init page_table_range_init(unsigned long start, unsigned long end, | |||
106 | pgd_t *pgd; | 106 | pgd_t *pgd; |
107 | pud_t *pud; | 107 | pud_t *pud; |
108 | pmd_t *pmd; | 108 | pmd_t *pmd; |
109 | int pgd_idx; | 109 | pte_t *pte; |
110 | int i, j, k; | ||
110 | unsigned long vaddr; | 111 | unsigned long vaddr; |
111 | 112 | ||
112 | vaddr = start & PMD_MASK; | 113 | vaddr = start; |
113 | end = (end + PMD_SIZE - 1) & PMD_MASK; | 114 | i = __pgd_offset(vaddr); |
114 | pgd_idx = pgd_index(vaddr); | 115 | j = __pud_offset(vaddr); |
115 | pgd = pgd_base + pgd_idx; | 116 | k = __pmd_offset(vaddr); |
116 | 117 | pgd = pgd_base + i; | |
117 | for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd++, pgd_idx++) { | 118 | |
118 | BUG_ON(pgd_none(*pgd)); | 119 | for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) { |
119 | pud = pud_offset(pgd, 0); | 120 | pud = (pud_t *)pgd; |
120 | BUG_ON(pud_none(*pud)); | 121 | for ( ; (j < PTRS_PER_PUD) && (vaddr != end); pud++, j++) { |
121 | pmd = pmd_offset(pud, 0); | 122 | pmd = (pmd_t *)pud; |
122 | 123 | for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) { | |
123 | if (!pmd_present(*pmd)) { | 124 | if (pmd_none(*pmd)) { |
124 | pte_t *pte_table; | 125 | pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); |
125 | pte_table = (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); | 126 | pmd_populate_kernel(&init_mm, pmd, pte); |
126 | pmd_populate_kernel(&init_mm, pmd, pte_table); | 127 | BUG_ON(pte != pte_offset_kernel(pmd, 0)); |
128 | } | ||
129 | vaddr += PMD_SIZE; | ||
130 | } | ||
131 | k = 0; | ||
127 | } | 132 | } |
128 | 133 | j = 0; | |
129 | vaddr += PMD_SIZE; | ||
130 | } | 134 | } |
131 | } | 135 | } |
132 | #endif /* CONFIG_MMU */ | 136 | #endif /* CONFIG_MMU */ |
@@ -137,7 +141,7 @@ void __init page_table_range_init(unsigned long start, unsigned long end, | |||
137 | void __init paging_init(void) | 141 | void __init paging_init(void) |
138 | { | 142 | { |
139 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | 143 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
140 | unsigned long vaddr; | 144 | unsigned long vaddr, end; |
141 | int nid; | 145 | int nid; |
142 | 146 | ||
143 | /* We don't need to map the kernel through the TLB, as | 147 | /* We don't need to map the kernel through the TLB, as |
@@ -155,7 +159,8 @@ void __init paging_init(void) | |||
155 | * pte's will be filled in by __set_fixmap(). | 159 | * pte's will be filled in by __set_fixmap(). |
156 | */ | 160 | */ |
157 | vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; | 161 | vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; |
158 | page_table_range_init(vaddr, 0, swapper_pg_dir); | 162 | end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK; |
163 | page_table_range_init(vaddr, end, swapper_pg_dir); | ||
159 | 164 | ||
160 | kmap_coherent_init(); | 165 | kmap_coherent_init(); |
161 | 166 | ||
@@ -210,6 +215,9 @@ void __init mem_init(void) | |||
210 | high_memory = node_high_memory; | 215 | high_memory = node_high_memory; |
211 | } | 216 | } |
212 | 217 | ||
218 | /* Set this up early, so we can take care of the zero page */ | ||
219 | cpu_cache_init(); | ||
220 | |||
213 | /* clear the zero-page */ | 221 | /* clear the zero-page */ |
214 | memset(empty_zero_page, 0, PAGE_SIZE); | 222 | memset(empty_zero_page, 0, PAGE_SIZE); |
215 | __flush_wback_region(empty_zero_page, PAGE_SIZE); | 223 | __flush_wback_region(empty_zero_page, PAGE_SIZE); |
@@ -230,8 +238,6 @@ void __init mem_init(void) | |||
230 | datasize >> 10, | 238 | datasize >> 10, |
231 | initsize >> 10); | 239 | initsize >> 10); |
232 | 240 | ||
233 | p3_cache_init(); | ||
234 | |||
235 | /* Initialize the vDSO */ | 241 | /* Initialize the vDSO */ |
236 | vsyscall_init(); | 242 | vsyscall_init(); |
237 | } | 243 | } |