aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/mm/init.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-09-24 16:22:33 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-09-24 16:22:33 -0400
commitbaea7b946f00a291b166ccae7fcfed6c01530cc6 (patch)
tree4aa275fbdbec9c7b9b4629e8bee2bbecd3c6a6af /arch/sh/mm/init.c
parentae19ffbadc1b2100285a5b5b3d0a4e0a11390904 (diff)
parent94e0fb086fc5663c38bbc0fe86d698be8314f82f (diff)
Merge branch 'origin' into for-linus
Conflicts: MAINTAINERS
Diffstat (limited to 'arch/sh/mm/init.c')
-rw-r--r--arch/sh/mm/init.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index fe532aeaa16d..8173e38afd38 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,
137void __init paging_init(void) 141void __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
@@ -181,8 +186,6 @@ void __init paging_init(void)
181 set_fixmap_nocache(FIX_UNCACHED, __pa(&__uncached_start)); 186 set_fixmap_nocache(FIX_UNCACHED, __pa(&__uncached_start));
182} 187}
183 188
184static struct kcore_list kcore_mem, kcore_vmalloc;
185
186void __init mem_init(void) 189void __init mem_init(void)
187{ 190{
188 int codesize, datasize, initsize; 191 int codesize, datasize, initsize;
@@ -210,6 +213,9 @@ void __init mem_init(void)
210 high_memory = node_high_memory; 213 high_memory = node_high_memory;
211 } 214 }
212 215
216 /* Set this up early, so we can take care of the zero page */
217 cpu_cache_init();
218
213 /* clear the zero-page */ 219 /* clear the zero-page */
214 memset(empty_zero_page, 0, PAGE_SIZE); 220 memset(empty_zero_page, 0, PAGE_SIZE);
215 __flush_wback_region(empty_zero_page, PAGE_SIZE); 221 __flush_wback_region(empty_zero_page, PAGE_SIZE);
@@ -218,20 +224,14 @@ void __init mem_init(void)
218 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 224 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
219 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 225 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
220 226
221 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
222 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
223 VMALLOC_END - VMALLOC_START);
224
225 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " 227 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
226 "%dk data, %dk init)\n", 228 "%dk data, %dk init)\n",
227 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 229 nr_free_pages() << (PAGE_SHIFT-10),
228 num_physpages << (PAGE_SHIFT-10), 230 num_physpages << (PAGE_SHIFT-10),
229 codesize >> 10, 231 codesize >> 10,
230 datasize >> 10, 232 datasize >> 10,
231 initsize >> 10); 233 initsize >> 10);
232 234
233 p3_cache_init();
234
235 /* Initialize the vDSO */ 235 /* Initialize the vDSO */
236 vsyscall_init(); 236 vsyscall_init();
237} 237}