diff options
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 8b6f7a99cce2..eb23ac92abb9 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -559,6 +559,35 @@ void __init early_init_dt_setup_initrd_arch(unsigned long start, | |||
559 | } | 559 | } |
560 | #endif | 560 | #endif |
561 | 561 | ||
562 | static void __init early_reserve_mem_dt(void) | ||
563 | { | ||
564 | unsigned long i, len, dt_root; | ||
565 | const __be32 *prop; | ||
566 | |||
567 | dt_root = of_get_flat_dt_root(); | ||
568 | |||
569 | prop = of_get_flat_dt_prop(dt_root, "reserved-ranges", &len); | ||
570 | |||
571 | if (!prop) | ||
572 | return; | ||
573 | |||
574 | DBG("Found new-style reserved-ranges\n"); | ||
575 | |||
576 | /* Each reserved range is an (address,size) pair, 2 cells each, | ||
577 | * totalling 4 cells per range. */ | ||
578 | for (i = 0; i < len / (sizeof(*prop) * 4); i++) { | ||
579 | u64 base, size; | ||
580 | |||
581 | base = of_read_number(prop + (i * 4) + 0, 2); | ||
582 | size = of_read_number(prop + (i * 4) + 2, 2); | ||
583 | |||
584 | if (size) { | ||
585 | DBG("reserving: %llx -> %llx\n", base, size); | ||
586 | memblock_reserve(base, size); | ||
587 | } | ||
588 | } | ||
589 | } | ||
590 | |||
562 | static void __init early_reserve_mem(void) | 591 | static void __init early_reserve_mem(void) |
563 | { | 592 | { |
564 | u64 base, size; | 593 | u64 base, size; |
@@ -574,12 +603,16 @@ static void __init early_reserve_mem(void) | |||
574 | self_size = initial_boot_params->totalsize; | 603 | self_size = initial_boot_params->totalsize; |
575 | memblock_reserve(self_base, self_size); | 604 | memblock_reserve(self_base, self_size); |
576 | 605 | ||
606 | /* Look for the new "reserved-regions" property in the DT */ | ||
607 | early_reserve_mem_dt(); | ||
608 | |||
577 | #ifdef CONFIG_BLK_DEV_INITRD | 609 | #ifdef CONFIG_BLK_DEV_INITRD |
578 | /* then reserve the initrd, if any */ | 610 | /* Then reserve the initrd, if any */ |
579 | if (initrd_start && (initrd_end > initrd_start)) | 611 | if (initrd_start && (initrd_end > initrd_start)) { |
580 | memblock_reserve(_ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE), | 612 | memblock_reserve(_ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE), |
581 | _ALIGN_UP(initrd_end, PAGE_SIZE) - | 613 | _ALIGN_UP(initrd_end, PAGE_SIZE) - |
582 | _ALIGN_DOWN(initrd_start, PAGE_SIZE)); | 614 | _ALIGN_DOWN(initrd_start, PAGE_SIZE)); |
615 | } | ||
583 | #endif /* CONFIG_BLK_DEV_INITRD */ | 616 | #endif /* CONFIG_BLK_DEV_INITRD */ |
584 | 617 | ||
585 | #ifdef CONFIG_PPC32 | 618 | #ifdef CONFIG_PPC32 |
@@ -591,6 +624,8 @@ static void __init early_reserve_mem(void) | |||
591 | u32 base_32, size_32; | 624 | u32 base_32, size_32; |
592 | u32 *reserve_map_32 = (u32 *)reserve_map; | 625 | u32 *reserve_map_32 = (u32 *)reserve_map; |
593 | 626 | ||
627 | DBG("Found old 32-bit reserve map\n"); | ||
628 | |||
594 | while (1) { | 629 | while (1) { |
595 | base_32 = *(reserve_map_32++); | 630 | base_32 = *(reserve_map_32++); |
596 | size_32 = *(reserve_map_32++); | 631 | size_32 = *(reserve_map_32++); |
@@ -605,6 +640,9 @@ static void __init early_reserve_mem(void) | |||
605 | return; | 640 | return; |
606 | } | 641 | } |
607 | #endif | 642 | #endif |
643 | DBG("Processing reserve map\n"); | ||
644 | |||
645 | /* Handle the reserve map in the fdt blob if it exists */ | ||
608 | while (1) { | 646 | while (1) { |
609 | base = *(reserve_map++); | 647 | base = *(reserve_map++); |
610 | size = *(reserve_map++); | 648 | size = *(reserve_map++); |