aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-03-25 13:02:59 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-16 06:06:42 -0400
commit3abe9d33b382cb9eee7bfee8d90b10078f4baa4d (patch)
tree80c3307c1297405c64f1ab4efbba5195bba48b6d /arch/arm
parent71ee7dad9b69917079f24d42aff796bad7932914 (diff)
ARM: early_alloc()
Add a common early allocator function, in preparation for switching over to LMB. When we do, this function will need to do a little more than just allocating memory; we need it zero initialized too. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mm/mmu.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 1676d017a93a..3079d0fd9cea 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -487,6 +487,11 @@ static void __init build_mem_type_table(void)
487 487
488#define vectors_base() (vectors_high() ? 0xffff0000 : 0) 488#define vectors_base() (vectors_high() ? 0xffff0000 : 0)
489 489
490static void __init *early_alloc(unsigned long sz)
491{
492 return alloc_bootmem_low_pages(sz);
493}
494
490static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr, 495static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
491 unsigned long end, unsigned long pfn, 496 unsigned long end, unsigned long pfn,
492 const struct mem_type *type) 497 const struct mem_type *type)
@@ -494,7 +499,7 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
494 pte_t *pte; 499 pte_t *pte;
495 500
496 if (pmd_none(*pmd)) { 501 if (pmd_none(*pmd)) {
497 pte = alloc_bootmem_low_pages(2 * PTRS_PER_PTE * sizeof(pte_t)); 502 pte = early_alloc(2 * PTRS_PER_PTE * sizeof(pte_t));
498 __pmd_populate(pmd, __pa(pte) | type->prot_l1); 503 __pmd_populate(pmd, __pa(pte) | type->prot_l1);
499 } 504 }
500 505
@@ -873,7 +878,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
873 /* 878 /*
874 * Allocate the vector page early. 879 * Allocate the vector page early.
875 */ 880 */
876 vectors = alloc_bootmem_low_pages(PAGE_SIZE); 881 vectors = early_alloc(PAGE_SIZE);
877 882
878 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE) 883 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
879 pmd_clear(pmd_off_k(addr)); 884 pmd_clear(pmd_off_k(addr));
@@ -945,7 +950,7 @@ static void __init kmap_init(void)
945{ 950{
946#ifdef CONFIG_HIGHMEM 951#ifdef CONFIG_HIGHMEM
947 pmd_t *pmd = pmd_off_k(PKMAP_BASE); 952 pmd_t *pmd = pmd_off_k(PKMAP_BASE);
948 pte_t *pte = alloc_bootmem_low_pages(2 * PTRS_PER_PTE * sizeof(pte_t)); 953 pte_t *pte = early_alloc(2 * PTRS_PER_PTE * sizeof(pte_t));
949 BUG_ON(!pmd_none(*pmd) || !pte); 954 BUG_ON(!pmd_none(*pmd) || !pte);
950 __pmd_populate(pmd, __pa(pte) | _PAGE_KERNEL_TABLE); 955 __pmd_populate(pmd, __pa(pte) | _PAGE_KERNEL_TABLE);
951 pkmap_page_table = pte + PTRS_PER_PTE; 956 pkmap_page_table = pte + PTRS_PER_PTE;
@@ -1005,11 +1010,8 @@ void __init paging_init(struct machine_desc *mdesc)
1005 1010
1006 top_pmd = pmd_off_k(0xffff0000); 1011 top_pmd = pmd_off_k(0xffff0000);
1007 1012
1008 /* 1013 /* allocate the zero page. */
1009 * allocate the zero page. Note that this always succeeds and 1014 zero_page = early_alloc(PAGE_SIZE);
1010 * returns a zeroed result.
1011 */
1012 zero_page = alloc_bootmem_low_pages(PAGE_SIZE);
1013 empty_zero_page = virt_to_page(zero_page); 1015 empty_zero_page = virt_to_page(zero_page);
1014 __flush_dcache_page(NULL, empty_zero_page); 1016 __flush_dcache_page(NULL, empty_zero_page);
1015} 1017}