aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/parisc/mm/init.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 059187a3ded7..d0b166256f1a 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -79,36 +79,6 @@ static struct resource sysram_resources[MAX_PHYSMEM_RANGES] __read_mostly;
79physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly; 79physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly;
80int npmem_ranges __read_mostly; 80int npmem_ranges __read_mostly;
81 81
82/*
83 * get_memblock() allocates pages via memblock.
84 * We can't use memblock_find_in_range(0, KERNEL_INITIAL_SIZE) here since it
85 * doesn't allocate from bottom to top which is needed because we only created
86 * the initial mapping up to KERNEL_INITIAL_SIZE in the assembly bootup code.
87 */
88static void * __init get_memblock(unsigned long size)
89{
90 static phys_addr_t search_addr __initdata;
91 phys_addr_t phys;
92
93 if (!search_addr)
94 search_addr = PAGE_ALIGN(__pa((unsigned long) &_end));
95 search_addr = ALIGN(search_addr, size);
96 while (!memblock_is_region_memory(search_addr, size) ||
97 memblock_is_region_reserved(search_addr, size)) {
98 search_addr += size;
99 }
100 phys = search_addr;
101
102 if (phys)
103 memblock_reserve(phys, size);
104 else
105 panic("get_memblock() failed.\n");
106
107 memset(__va(phys), 0, size);
108
109 return __va(phys);
110}
111
112#ifdef CONFIG_64BIT 82#ifdef CONFIG_64BIT
113#define MAX_MEM (~0UL) 83#define MAX_MEM (~0UL)
114#else /* !CONFIG_64BIT */ 84#else /* !CONFIG_64BIT */
@@ -321,6 +291,13 @@ static void __init setup_bootmem(void)
321 max_pfn = start_pfn + npages; 291 max_pfn = start_pfn + npages;
322 } 292 }
323 293
294 /*
295 * We can't use memblock top-down allocations because we only
296 * created the initial mapping up to KERNEL_INITIAL_SIZE in
297 * the assembly bootup code.
298 */
299 memblock_set_bottom_up(true);
300
324 /* IOMMU is always used to access "high mem" on those boxes 301 /* IOMMU is always used to access "high mem" on those boxes
325 * that can support enough mem that a PCI device couldn't 302 * that can support enough mem that a PCI device couldn't
326 * directly DMA to any physical addresses. 303 * directly DMA to any physical addresses.
@@ -442,7 +419,10 @@ static void __init map_pages(unsigned long start_vaddr,
442 */ 419 */
443 420
444 if (!pmd) { 421 if (!pmd) {
445 pmd = (pmd_t *) get_memblock(PAGE_SIZE << PMD_ORDER); 422 pmd = memblock_alloc(PAGE_SIZE << PMD_ORDER,
423 PAGE_SIZE << PMD_ORDER);
424 if (!pmd)
425 panic("pmd allocation failed.\n");
446 pmd = (pmd_t *) __pa(pmd); 426 pmd = (pmd_t *) __pa(pmd);
447 } 427 }
448 428
@@ -461,7 +441,10 @@ static void __init map_pages(unsigned long start_vaddr,
461 441
462 pg_table = (pte_t *)pmd_address(*pmd); 442 pg_table = (pte_t *)pmd_address(*pmd);
463 if (!pg_table) { 443 if (!pg_table) {
464 pg_table = (pte_t *) get_memblock(PAGE_SIZE); 444 pg_table = memblock_alloc(PAGE_SIZE,
445 PAGE_SIZE);
446 if (!pg_table)
447 panic("page table allocation failed\n");
465 pg_table = (pte_t *) __pa(pg_table); 448 pg_table = (pte_t *) __pa(pg_table);
466 } 449 }
467 450
@@ -700,7 +683,10 @@ static void __init pagetable_init(void)
700 } 683 }
701#endif 684#endif
702 685
703 empty_zero_page = get_memblock(PAGE_SIZE); 686 empty_zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
687 if (!empty_zero_page)
688 panic("zero page allocation failed.\n");
689
704} 690}
705 691
706static void __init gateway_init(void) 692static void __init gateway_init(void)