[patch v2] kexec fix ppc64 device-tree mem node

Geoff Levand geoffrey.levand at am.sony.com
Tue May 8 22:39:46 EDT 2007


Change the ppc64 device-tree memory node name spec to match 'memory'
or 'memory@', as specified in the booting-without-of document.

Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
---
Version 2, changed to look for 'memory' or 'memory@' nodes.

 kexec/arch/ppc64/crashdump-ppc64.c |    3 ++-
 kexec/arch/ppc64/kexec-ppc64.c     |   16 ++++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

--- ps3-kexec-tools.orig/kexec/arch/ppc64/crashdump-ppc64.c
+++ ps3-kexec-tools/kexec/arch/ppc64/crashdump-ppc64.c
@@ -129,7 +129,8 @@ static int get_crash_memory_ranges(struc
 		goto err;
 	}
 	while ((dentry = readdir(dir)) != NULL) {
-		if (strncmp(dentry->d_name, "memory@", 7))
+		if (strncmp(dentry->d_name, "memory@", 7) &&
+			strcmp(dentry->d_name, "memory"))
 			continue;
 		strcpy(fname, device_tree);
 		strcat(fname, dentry->d_name);
--- ps3-kexec-tools.orig/kexec/arch/ppc64/kexec-ppc64.c
+++ ps3-kexec-tools/kexec/arch/ppc64/kexec-ppc64.c
@@ -98,7 +98,7 @@ err1:
 }
 
 /*
- * Count the memory@ nodes under /proc/device-tree and populate the
+ * Count the memory nodes under /proc/device-tree and populate the
  * max_memory_ranges variable. This variable replaces MAX_MEMORY_RANGES
  * macro used earlier.
  */
@@ -114,8 +114,9 @@ static int count_memory_ranges(void)
 	}
 
 	while ((dentry = readdir(dir)) != NULL) {
-		if (strncmp(dentry->d_name, "memory@", 7) &&
-		    strncmp(dentry->d_name, "pci@", 4))
+			strncmp(dentry->d_name, "memory@", 7) &&
+			strcmp(dentry->d_name, "memory") &&
+			strncmp(dentry->d_name, "pci@", 4))
 			continue;
 		max_memory_ranges++;
 	}
@@ -170,7 +171,8 @@ static int get_base_ranges(void)
 		return -1;
 	}
 	while ((dentry = readdir(dir)) != NULL) {
-		if (strncmp(dentry->d_name, "memory@", 7))
+		if (strncmp(dentry->d_name, "memory@", 7) &&
+			strcmp(dentry->d_name, "memory"))
 			continue;
 		strcpy(fname, device_tree);
 		strcat(fname, dentry->d_name);
@@ -272,7 +274,8 @@ static int get_devtree_details(unsigned 
 
 	while ((dentry = readdir(dir)) != NULL) {
 		if (strncmp(dentry->d_name, "chosen", 6) &&
-			strncmp(dentry->d_name, "memory at 0", 8) &&
+			strncmp(dentry->d_name, "memory@", 7) &&
+			strcmp(dentry->d_name, "memory") &&
 			strncmp(dentry->d_name, "pci@", 4) &&
 			strncmp(dentry->d_name, "rtas", 4))
 			continue;
@@ -452,7 +455,8 @@ static int get_devtree_details(unsigned 
 				add_usable_mem_rgns(rtas_base, rtas_size);
 		} /* rtas */
 
-		if (strncmp(dentry->d_name, "memory at 0", 8) == 0) {
+		if (!strncmp(dentry->d_name, "memory@", 7) ||
+			!strcmp(dentry->d_name, "memory")) {
 			strcat(fname, "/reg");
 			if ((file = fopen(fname, "r")) == NULL) {
 				perror(fname);




More information about the kexec mailing list