forked from pool/kexec-tools
52 lines
1.4 KiB
Diff
52 lines
1.4 KiB
Diff
---
|
|
kexec/arch/ppc64/kexec-ppc64.c | 20 +++++++++++++++++++-
|
|
1 file changed, 19 insertions(+), 1 deletion(-)
|
|
|
|
Index: kexec/arch/ppc64/kexec-ppc64.c
|
|
===================================================================
|
|
--- kexec/arch/ppc64/kexec-ppc64.c.orig
|
|
+++ kexec/arch/ppc64/kexec-ppc64.c
|
|
@@ -28,6 +28,7 @@
|
|
#include <sys/types.h>
|
|
#include <dirent.h>
|
|
#include <getopt.h>
|
|
+#include <fcntl.h>
|
|
#include <sys/utsname.h>
|
|
#include "../../kexec.h"
|
|
#include "../../kexec-syscall.h"
|
|
@@ -260,6 +261,20 @@ static int get_devtree_details(unsigned
|
|
FILE *file;
|
|
struct dirent *dentry;
|
|
int n, i = 0;
|
|
+ int PS3 = 0;
|
|
+
|
|
+ snprintf(fname, sizeof(fname), "%s/model", device_tree);
|
|
+ i = open(fname, O_RDONLY);
|
|
+ if (i >= 0) {
|
|
+ n = read(i, fname, sizeof(fname) - 1);
|
|
+ if (n > 0) {
|
|
+ fname[n] = '\0';
|
|
+ fprintf(stderr, "model '%s'\n", fname);
|
|
+ PS3 = strcmp("PLAYSTATION 3", fname) == 0;
|
|
+ }
|
|
+ close(i);
|
|
+ }
|
|
+ i = 0;
|
|
|
|
if ((dir = opendir(device_tree)) == NULL) {
|
|
perror(device_tree);
|
|
@@ -454,9 +469,12 @@ static int get_devtree_details(unsigned
|
|
}
|
|
rmo_base = ((unsigned long long *)buf)[0];
|
|
rmo_top = rmo_base + ((unsigned long long *)buf)[1];
|
|
+ fprintf(stderr, "rmo_top 0x%08x\n", rmo_top);
|
|
+ if (rmo_top > 0x07C00000UL && PS3)
|
|
+ rmo_top = 0x07C00000UL;
|
|
if (rmo_top > 0x30000000UL)
|
|
rmo_top = 0x30000000UL;
|
|
-
|
|
+ fprintf(stderr, "rmo_top 0x%08x\n", rmo_top);
|
|
fclose(file);
|
|
closedir(cdir);
|
|
} /* memory */
|