aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/mmu.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-07-01 13:33:29 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-27 03:47:59 -0400
commit4bb2e27db10abc555dfabd73661485fb75e4e97d (patch)
tree4d2bf627268e82162583ed35c20ff047ca4d5e2f /arch/arm/mm/mmu.c
parent3abe9d33b382cb9eee7bfee8d90b10078f4baa4d (diff)
ARM: early_pte_alloc()
Provide a common function for allocating early PTE tables. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/mmu.c')
-rw-r--r--arch/arm/mm/mmu.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 3079d0fd9cea..05dbb956175b 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -492,18 +492,21 @@ static void __init *early_alloc(unsigned long sz)
492 return alloc_bootmem_low_pages(sz); 492 return alloc_bootmem_low_pages(sz);
493} 493}
494 494
495static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr, 495static pte_t * __init early_pte_alloc(pmd_t *pmd, unsigned long addr, unsigned long prot)
496 unsigned long end, unsigned long pfn,
497 const struct mem_type *type)
498{ 496{
499 pte_t *pte;
500
501 if (pmd_none(*pmd)) { 497 if (pmd_none(*pmd)) {
502 pte = early_alloc(2 * PTRS_PER_PTE * sizeof(pte_t)); 498 pte_t *pte = early_alloc(2 * PTRS_PER_PTE * sizeof(pte_t));
503 __pmd_populate(pmd, __pa(pte) | type->prot_l1); 499 __pmd_populate(pmd, __pa(pte) | prot);
504 } 500 }
501 BUG_ON(pmd_bad(*pmd));
502 return pte_offset_kernel(pmd, addr);
503}
505 504
506 pte = pte_offset_kernel(pmd, addr); 505static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
506 unsigned long end, unsigned long pfn,
507 const struct mem_type *type)
508{
509 pte_t *pte = early_pte_alloc(pmd, addr, type->prot_l1);
507 do { 510 do {
508 set_pte_ext(pte, pfn_pte(pfn, __pgprot(type->prot_pte)), 0); 511 set_pte_ext(pte, pfn_pte(pfn, __pgprot(type->prot_pte)), 0);
509 pfn++; 512 pfn++;
@@ -949,11 +952,8 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
949static void __init kmap_init(void) 952static void __init kmap_init(void)
950{ 953{
951#ifdef CONFIG_HIGHMEM 954#ifdef CONFIG_HIGHMEM
952 pmd_t *pmd = pmd_off_k(PKMAP_BASE); 955 pkmap_page_table = early_pte_alloc(pmd_off_k(PKMAP_BASE),
953 pte_t *pte = early_alloc(2 * PTRS_PER_PTE * sizeof(pte_t)); 956 PKMAP_BASE, _PAGE_KERNEL_TABLE);
954 BUG_ON(!pmd_none(*pmd) || !pte);
955 __pmd_populate(pmd, __pa(pte) | _PAGE_KERNEL_TABLE);
956 pkmap_page_table = pte + PTRS_PER_PTE;
957#endif 957#endif
958} 958}
959 959