linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/7] Restore kexec uImage-ppc to working state
@ 2010-07-20 20:14 Matthew McClintock
  2010-07-20 20:14 ` [PATCH v2 2/7] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock
  0 siblings, 1 reply; 9+ messages in thread
From: Matthew McClintock @ 2010-07-20 20:14 UTC (permalink / raw)
  To: kexec; +Cc: Matthew McClintock, linuxppc-dev

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-07-29 16:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-20 20:14 [PATCH v2 1/7] Restore kexec uImage-ppc to working state Matthew McClintock
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

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).