summaryrefslogtreecommitdiff
path: root/arch/powerpc/kernel/prom.c
diff options
context:
space:
mode:
authorKumar Gala <galak@gate.crashing.org>2006-01-11 17:57:13 -0600
committerPaul Mackerras <paulus@samba.org>2006-01-12 20:09:29 +1100
commitcbbcf3401173f11f7e4c03c7ec8955ea29cd83b5 (patch)
tree3728682606776f026ac120fee00db7d8ddbaa108 /arch/powerpc/kernel/prom.c
parentea183a957abea8e05530a4536a9c2db16e9fdd85 (diff)
downloadlwn-cbbcf3401173f11f7e4c03c7ec8955ea29cd83b5.tar.gz
lwn-cbbcf3401173f11f7e4c03c7ec8955ea29cd83b5.zip
[PATCH] powerpc: Fixed memory reserve map layout
powerpc: Fixed memory reserve map layout The memory reserve map is suppose to be a pair of 64-bit integers to represent each region. On ppc32 the code was treating the pair as two 32-bit integers. Additional the prom_init code was producing the wrong layout on ppc32. Added a simple check to try to provide backwards compatibility. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r--arch/powerpc/kernel/prom.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 34ab0daec3a7..02e2115323e4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1100,17 +1100,37 @@ static int __init early_init_dt_scan_memory(unsigned long node,
static void __init early_reserve_mem(void)
{
- unsigned long base, size;
- unsigned long *reserve_map;
+ u64 base, size;
+ u64 *reserve_map;
- reserve_map = (unsigned long *)(((unsigned long)initial_boot_params) +
+ reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
initial_boot_params->off_mem_rsvmap);
+#ifdef CONFIG_PPC32
+ /*
+ * Handle the case where we might be booting from an old kexec
+ * image that setup the mem_rsvmap as pairs of 32-bit values
+ */
+ if (*reserve_map > 0xffffffffull) {
+ u32 base_32, size_32;
+ u32 *reserve_map_32 = (u32 *)reserve_map;
+
+ while (1) {
+ base_32 = *(reserve_map_32++);
+ size_32 = *(reserve_map_32++);
+ if (size_32 == 0)
+ break;
+ DBG("reserving: %lx -> %lx\n", base_32, size_32);
+ lmb_reserve(base_32, size_32);
+ }
+ return;
+ }
+#endif
while (1) {
base = *(reserve_map++);
size = *(reserve_map++);
if (size == 0)
break;
- DBG("reserving: %lx -> %lx\n", base, size);
+ DBG("reserving: %llx -> %llx\n", base, size);
lmb_reserve(base, size);
}