diff options
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/mm/init.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 094225e0d722..2918c6b14659 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -130,6 +130,37 @@ void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot) | |||
130 | 130 | ||
131 | set_pte_phys(address, phys, prot); | 131 | set_pte_phys(address, phys, prot); |
132 | } | 132 | } |
133 | |||
134 | void __init page_table_range_init(unsigned long start, unsigned long end, | ||
135 | pgd_t *pgd_base) | ||
136 | { | ||
137 | pgd_t *pgd; | ||
138 | pud_t *pud; | ||
139 | pmd_t *pmd; | ||
140 | int pgd_idx; | ||
141 | unsigned long vaddr; | ||
142 | |||
143 | vaddr = start & PMD_MASK; | ||
144 | end = (end + PMD_SIZE - 1) & PMD_MASK; | ||
145 | pgd_idx = pgd_index(vaddr); | ||
146 | pgd = pgd_base + pgd_idx; | ||
147 | |||
148 | for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd++, pgd_idx++) { | ||
149 | BUG_ON(pgd_none(*pgd)); | ||
150 | pud = pud_offset(pgd, 0); | ||
151 | BUG_ON(pud_none(*pud)); | ||
152 | pmd = pmd_offset(pud, 0); | ||
153 | |||
154 | if (!pmd_present(*pmd)) { | ||
155 | pte_t *pte_table; | ||
156 | pte_table = (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); | ||
157 | memset(pte_table, 0, PAGE_SIZE); | ||
158 | pmd_populate_kernel(&init_mm, pmd, pte_table); | ||
159 | } | ||
160 | |||
161 | vaddr += PMD_SIZE; | ||
162 | } | ||
163 | } | ||
133 | #endif /* CONFIG_MMU */ | 164 | #endif /* CONFIG_MMU */ |
134 | 165 | ||
135 | /* | 166 | /* |
@@ -149,6 +180,11 @@ void __init paging_init(void) | |||
149 | * check for a null value. */ | 180 | * check for a null value. */ |
150 | set_TTB(swapper_pg_dir); | 181 | set_TTB(swapper_pg_dir); |
151 | 182 | ||
183 | /* Populate the relevant portions of swapper_pg_dir so that | ||
184 | * we can use the fixmap entries without calling kmalloc. | ||
185 | * pte's will be filled in by __set_fixmap(). */ | ||
186 | page_table_range_init(FIXADDR_START, FIXADDR_TOP, swapper_pg_dir); | ||
187 | |||
152 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | 188 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
153 | 189 | ||
154 | for_each_online_node(nid) { | 190 | for_each_online_node(nid) { |