diff options
author | Matthew McClintock <msm@freescale.com> | 2010-07-20 23:42:58 -0500 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2010-07-29 18:02:12 +0900 |
commit | 655703ffbcb7a3387994dce29b09b5f9fe79042c (patch) | |
tree | 38010b46808d1f80787d810feaf21ea6be9d88f4 | |
parent | 647f1b8496a2c6da9da2f1df7aa904bb575641e4 (diff) | |
download | kexec-tools-655703ffbcb7a3387994dce29b09b5f9fe79042c.tar.gz |
Restore kexec uImage-ppc to working state
Booting with uImage-ppc was broken by previous work, this
patch should restore it to working order
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | kexec/arch/ppc/kexec-ppc.c | 65 | ||||
-rw-r--r-- | kexec/arch/ppc/kexec-uImage-ppc.c | 5 | ||||
-rw-r--r-- | purgatory/arch/ppc/purgatory-ppc.c | 5 |
3 files changed, 46 insertions, 29 deletions
diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c index 55cadd6..ca33303 100644 --- a/kexec/arch/ppc/kexec-ppc.c +++ b/kexec/arch/ppc/kexec-ppc.c @@ -261,11 +261,25 @@ static int get_base_ranges(void) break; } } - base_memory_range[local_memory_ranges].start = - ((uint32_t *)buf)[0]; - base_memory_range[local_memory_ranges].end = - base_memory_range[local_memory_ranges].start + - ((uint32_t *)buf)[1]; + + if (n == 8) { + base_memory_range[local_memory_ranges].start = + ((uint32_t *)buf)[0]; + base_memory_range[local_memory_ranges].end = + base_memory_range[local_memory_ranges].start + + ((uint32_t *)buf)[1]; + } + else if (n == 16) { + base_memory_range[local_memory_ranges].start = + ((uint64_t *)buf)[0]; + base_memory_range[local_memory_ranges].end = + base_memory_range[local_memory_ranges].start + + ((uint64_t *)buf)[1]; + } + else { + fprintf(stderr, "Mem node has invalid size: %d\n", n); + return -1; + } base_memory_range[local_memory_ranges].type = RANGE_RAM; local_memory_ranges++; dbgprintf("%016llx-%016llx : %x\n", @@ -327,27 +341,28 @@ static int get_devtree_details(unsigned long kexec_flags) } if (strncmp(dentry->d_name, "chosen", 6) == 0) { - strcat(fname, "/linux,kernel-end"); - file = fopen(fname, "r"); - if (!file) { - perror(fname); - goto error_opencdir; - } - if (fread(&tmp_long, sizeof(unsigned long), 1, file) - != 1) { - perror(fname); - goto error_openfile; - } - kernel_end = tmp_long; - fclose(file); - - /* Add kernel memory to exclude_range */ - exclude_range[i].start = 0x0UL; - exclude_range[i].end = kernel_end; - i++; - if (i >= max_memory_ranges) - realloc_memory_ranges(); + /* only reserve kernel region if we are doing a crash kernel */ if (kexec_flags & KEXEC_ON_CRASH) { + strcat(fname, "/linux,kernel-end"); + file = fopen(fname, "r"); + if (!file) { + perror(fname); + goto error_opencdir; + } + if (fread(&tmp_long, sizeof(unsigned long), 1, file) + != 1) { + perror(fname); + goto error_openfile; + } + kernel_end = tmp_long; + fclose(file); + + /* Add kernel memory to exclude_range */ + exclude_range[i].start = 0x0UL; + exclude_range[i].end = kernel_end; + i++; + if (i >= max_memory_ranges) + realloc_memory_ranges(); memset(fname, 0, sizeof(fname)); strcpy(fname, device_tree); strcat(fname, dentry->d_name); diff --git a/kexec/arch/ppc/kexec-uImage-ppc.c b/kexec/arch/ppc/kexec-uImage-ppc.c index 45cde2f..4a8d28d 100644 --- a/kexec/arch/ppc/kexec-uImage-ppc.c +++ b/kexec/arch/ppc/kexec-uImage-ppc.c @@ -133,13 +133,10 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, addr = dtb_addr; elf_rel_set_symbol(&info->rhdr, "dt_offset", &addr, sizeof(addr)); - addr = rmo_top; - elf_rel_set_symbol(&info->rhdr, "mem_size", &addr, sizeof(addr)); - #define PUL_STACK_SIZE (16 * 1024) addr = locate_hole(info, PUL_STACK_SIZE, 0, 0, -1, 1); addr += PUL_STACK_SIZE; - elf_rel_set_symbol(&info->rhdr, "pul_stack", &addr, sizeof(addr)); + elf_rel_set_symbol(&info->rhdr, "stack", &addr, sizeof(addr)); /* No allocation past here in order not to overwrite the stack */ #undef PUL_STACK_SIZE diff --git a/purgatory/arch/ppc/purgatory-ppc.c b/purgatory/arch/ppc/purgatory-ppc.c index 3d7d484..349e750 100644 --- a/purgatory/arch/ppc/purgatory-ppc.c +++ b/purgatory/arch/ppc/purgatory-ppc.c @@ -39,3 +39,8 @@ void post_verification_setup_arch(void) if (panic_kernel) crashdump_backup_memory(); } + +void crashdump_backup_memory(void) +{ + return; +} |