aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/prom.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 31d5b22c59a2..8a9359ae4718 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1043,6 +1043,33 @@ static void __init early_reserve_mem(void)
1043 1043
1044#ifdef CONFIG_PHYP_DUMP 1044#ifdef CONFIG_PHYP_DUMP
1045/** 1045/**
1046 * phyp_dump_calculate_reserve_size() - reserve variable boot area 5% or arg
1047 *
1048 * Function to find the largest size we need to reserve
1049 * during early boot process.
1050 *
1051 * It either looks for boot param and returns that OR
1052 * returns larger of 256 or 5% rounded down to multiples of 256MB.
1053 *
1054 */
1055static inline unsigned long phyp_dump_calculate_reserve_size(void)
1056{
1057 unsigned long tmp;
1058
1059 if (phyp_dump_info->reserve_bootvar)
1060 return phyp_dump_info->reserve_bootvar;
1061
1062 /* divide by 20 to get 5% of value */
1063 tmp = lmb_end_of_DRAM();
1064 do_div(tmp, 20);
1065
1066 /* round it down in multiples of 256 */
1067 tmp = tmp & ~0x0FFFFFFFUL;
1068
1069 return (tmp > PHYP_DUMP_RMR_END ? tmp : PHYP_DUMP_RMR_END);
1070}
1071
1072/**
1046 * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory 1073 * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory
1047 * 1074 *
1048 * This routine may reserve memory regions in the kernel only 1075 * This routine may reserve memory regions in the kernel only
@@ -1055,6 +1082,8 @@ static void __init early_reserve_mem(void)
1055static void __init phyp_dump_reserve_mem(void) 1082static void __init phyp_dump_reserve_mem(void)
1056{ 1083{
1057 unsigned long base, size; 1084 unsigned long base, size;
1085 unsigned long variable_reserve_size;
1086
1058 if (!phyp_dump_info->phyp_dump_configured) { 1087 if (!phyp_dump_info->phyp_dump_configured) {
1059 printk(KERN_ERR "Phyp-dump not supported on this hardware\n"); 1088 printk(KERN_ERR "Phyp-dump not supported on this hardware\n");
1060 return; 1089 return;
@@ -1065,9 +1094,11 @@ static void __init phyp_dump_reserve_mem(void)
1065 return; 1094 return;
1066 } 1095 }
1067 1096
1097 variable_reserve_size = phyp_dump_calculate_reserve_size();
1098
1068 if (phyp_dump_info->phyp_dump_is_active) { 1099 if (phyp_dump_info->phyp_dump_is_active) {
1069 /* Reserve *everything* above RMR.Area freed by userland tools*/ 1100 /* Reserve *everything* above RMR.Area freed by userland tools*/
1070 base = PHYP_DUMP_RMR_END; 1101 base = variable_reserve_size;
1071 size = lmb_end_of_DRAM() - base; 1102 size = lmb_end_of_DRAM() - base;
1072 1103
1073 /* XXX crashed_ram_end is wrong, since it may be beyond 1104 /* XXX crashed_ram_end is wrong, since it may be beyond
@@ -1079,7 +1110,7 @@ static void __init phyp_dump_reserve_mem(void)
1079 } else { 1110 } else {
1080 size = phyp_dump_info->cpu_state_size + 1111 size = phyp_dump_info->cpu_state_size +
1081 phyp_dump_info->hpte_region_size + 1112 phyp_dump_info->hpte_region_size +
1082 PHYP_DUMP_RMR_END; 1113 variable_reserve_size;
1083 base = lmb_end_of_DRAM() - size; 1114 base = lmb_end_of_DRAM() - size;
1084 lmb_reserve(base, size); 1115 lmb_reserve(base, size);
1085 phyp_dump_info->init_reserve_start = base; 1116 phyp_dump_info->init_reserve_start = base;