From: Matthew McClintock <msm@freescale.com>
To: kexec@lists.infradead.org
Cc: Matthew McClintock <msm@freescale.com>, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v2 1/7] Restore kexec uImage-ppc to working state
Date: Tue, 20 Jul 2010 15:14:54 -0500 [thread overview]
Message-ID: <1279656900-27458-1-git-send-email-msm@freescale.com> (raw)
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>
---
kexec/arch/ppc/kexec-ppc.c | 68 ++++++++++++++++++++++-------------
kexec/arch/ppc/kexec-uImage-ppc.c | 5 +--
purgatory/arch/ppc/purgatory-ppc.c | 5 +++
3 files changed, 49 insertions(+), 29 deletions(-)
diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
index 55cadd6..c073f56 100644
--- a/kexec/arch/ppc/kexec-ppc.c
+++ b/kexec/arch/ppc/kexec-ppc.c
@@ -261,11 +261,28 @@ 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 +344,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;
+}
--
1.6.0.6
next reply other threads:[~2010-07-20 20:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-20 20:14 Matthew McClintock [this message]
2010-07-20 20:14 ` [PATCH v2 2/7] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock
2010-07-20 20:14 ` [PATCH v2 3/7] Update uImage to support crash kernel and misc fixes Matthew McClintock
2010-07-20 20:14 ` [PATCH v2 4/7] Update Elf-ppc " Matthew McClintock
2010-07-20 20:14 ` [PATCH v2 5/7] Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppc Matthew McClintock
2010-07-20 20:14 ` [PATCH v2 6/7] Add support for reworking flat device tree support Matthew McClintock
2010-07-20 20:15 ` [PATCH v2 7/7] Add documentation/howto for mpc85xx systems Matthew McClintock
2010-07-29 8:33 ` [PATCH v2 5/7] Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppc Simon Horman
2010-07-29 16:03 ` Matthew McClintock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1279656900-27458-1-git-send-email-msm@freescale.com \
--to=msm@freescale.com \
--cc=kexec@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).