diff options
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 98 |
1 files changed, 12 insertions, 86 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index abe405dab34..89e850af3dd 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -52,9 +52,9 @@ | |||
52 | #include <asm/machdep.h> | 52 | #include <asm/machdep.h> |
53 | #include <asm/pSeries_reconfig.h> | 53 | #include <asm/pSeries_reconfig.h> |
54 | #include <asm/pci-bridge.h> | 54 | #include <asm/pci-bridge.h> |
55 | #include <asm/phyp_dump.h> | ||
56 | #include <asm/kexec.h> | 55 | #include <asm/kexec.h> |
57 | #include <asm/opal.h> | 56 | #include <asm/opal.h> |
57 | #include <asm/fadump.h> | ||
58 | 58 | ||
59 | #include <mm/mmu_decl.h> | 59 | #include <mm/mmu_decl.h> |
60 | 60 | ||
@@ -615,86 +615,6 @@ static void __init early_reserve_mem(void) | |||
615 | } | 615 | } |
616 | } | 616 | } |
617 | 617 | ||
618 | #ifdef CONFIG_PHYP_DUMP | ||
619 | /** | ||
620 | * phyp_dump_calculate_reserve_size() - reserve variable boot area 5% or arg | ||
621 | * | ||
622 | * Function to find the largest size we need to reserve | ||
623 | * during early boot process. | ||
624 | * | ||
625 | * It either looks for boot param and returns that OR | ||
626 | * returns larger of 256 or 5% rounded down to multiples of 256MB. | ||
627 | * | ||
628 | */ | ||
629 | static inline unsigned long phyp_dump_calculate_reserve_size(void) | ||
630 | { | ||
631 | unsigned long tmp; | ||
632 | |||
633 | if (phyp_dump_info->reserve_bootvar) | ||
634 | return phyp_dump_info->reserve_bootvar; | ||
635 | |||
636 | /* divide by 20 to get 5% of value */ | ||
637 | tmp = memblock_end_of_DRAM(); | ||
638 | do_div(tmp, 20); | ||
639 | |||
640 | /* round it down in multiples of 256 */ | ||
641 | tmp = tmp & ~0x0FFFFFFFUL; | ||
642 | |||
643 | return (tmp > PHYP_DUMP_RMR_END ? tmp : PHYP_DUMP_RMR_END); | ||
644 | } | ||
645 | |||
646 | /** | ||
647 | * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory | ||
648 | * | ||
649 | * This routine may reserve memory regions in the kernel only | ||
650 | * if the system is supported and a dump was taken in last | ||
651 | * boot instance or if the hardware is supported and the | ||
652 | * scratch area needs to be setup. In other instances it returns | ||
653 | * without reserving anything. The memory in case of dump being | ||
654 | * active is freed when the dump is collected (by userland tools). | ||
655 | */ | ||
656 | static void __init phyp_dump_reserve_mem(void) | ||
657 | { | ||
658 | unsigned long base, size; | ||
659 | unsigned long variable_reserve_size; | ||
660 | |||
661 | if (!phyp_dump_info->phyp_dump_configured) { | ||
662 | printk(KERN_ERR "Phyp-dump not supported on this hardware\n"); | ||
663 | return; | ||
664 | } | ||
665 | |||
666 | if (!phyp_dump_info->phyp_dump_at_boot) { | ||
667 | printk(KERN_INFO "Phyp-dump disabled at boot time\n"); | ||
668 | return; | ||
669 | } | ||
670 | |||
671 | variable_reserve_size = phyp_dump_calculate_reserve_size(); | ||
672 | |||
673 | if (phyp_dump_info->phyp_dump_is_active) { | ||
674 | /* Reserve *everything* above RMR.Area freed by userland tools*/ | ||
675 | base = variable_reserve_size; | ||
676 | size = memblock_end_of_DRAM() - base; | ||
677 | |||
678 | /* XXX crashed_ram_end is wrong, since it may be beyond | ||
679 | * the memory_limit, it will need to be adjusted. */ | ||
680 | memblock_reserve(base, size); | ||
681 | |||
682 | phyp_dump_info->init_reserve_start = base; | ||
683 | phyp_dump_info->init_reserve_size = size; | ||
684 | } else { | ||
685 | size = phyp_dump_info->cpu_state_size + | ||
686 | phyp_dump_info->hpte_region_size + | ||
687 | variable_reserve_size; | ||
688 | base = memblock_end_of_DRAM() - size; | ||
689 | memblock_reserve(base, size); | ||
690 | phyp_dump_info->init_reserve_start = base; | ||
691 | phyp_dump_info->init_reserve_size = size; | ||
692 | } | ||
693 | } | ||
694 | #else | ||
695 | static inline void __init phyp_dump_reserve_mem(void) {} | ||
696 | #endif /* CONFIG_PHYP_DUMP && CONFIG_PPC_RTAS */ | ||
697 | |||
698 | void __init early_init_devtree(void *params) | 618 | void __init early_init_devtree(void *params) |
699 | { | 619 | { |
700 | phys_addr_t limit; | 620 | phys_addr_t limit; |
@@ -714,9 +634,9 @@ void __init early_init_devtree(void *params) | |||
714 | of_scan_flat_dt(early_init_dt_scan_opal, NULL); | 634 | of_scan_flat_dt(early_init_dt_scan_opal, NULL); |
715 | #endif | 635 | #endif |
716 | 636 | ||
717 | #ifdef CONFIG_PHYP_DUMP | 637 | #ifdef CONFIG_FA_DUMP |
718 | /* scan tree to see if dump occurred during last boot */ | 638 | /* scan tree to see if dump is active during last boot */ |
719 | of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL); | 639 | of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL); |
720 | #endif | 640 | #endif |
721 | 641 | ||
722 | /* Pre-initialize the cmd_line with the content of boot_commmand_line, | 642 | /* Pre-initialize the cmd_line with the content of boot_commmand_line, |
@@ -750,9 +670,15 @@ void __init early_init_devtree(void *params) | |||
750 | if (PHYSICAL_START > MEMORY_START) | 670 | if (PHYSICAL_START > MEMORY_START) |
751 | memblock_reserve(MEMORY_START, 0x8000); | 671 | memblock_reserve(MEMORY_START, 0x8000); |
752 | reserve_kdump_trampoline(); | 672 | reserve_kdump_trampoline(); |
753 | reserve_crashkernel(); | 673 | #ifdef CONFIG_FA_DUMP |
674 | /* | ||
675 | * If we fail to reserve memory for firmware-assisted dump then | ||
676 | * fallback to kexec based kdump. | ||
677 | */ | ||
678 | if (fadump_reserve_mem() == 0) | ||
679 | #endif | ||
680 | reserve_crashkernel(); | ||
754 | early_reserve_mem(); | 681 | early_reserve_mem(); |
755 | phyp_dump_reserve_mem(); | ||
756 | 682 | ||
757 | /* | 683 | /* |
758 | * Ensure that total memory size is page-aligned, because otherwise | 684 | * Ensure that total memory size is page-aligned, because otherwise |