]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: capture obp information during boot
authorDave Kleikamp <dave.kleikamp@oracle.com>
Fri, 23 May 2014 22:56:41 +0000 (17:56 -0500)
committerDave Kleikamp <dave.kleikamp@oracle.com>
Mon, 18 Apr 2016 16:42:49 +0000 (11:42 -0500)
original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
arch/sparc/mm/init_64.c
arch/sparc/prom/p1275.c

index cab7cbdfb67e570195c33aca27f1a4af2785fa35..4d19df252a72cfa500368a42656cd45169fc3486 100644 (file)
@@ -2907,6 +2907,31 @@ void hugetlb_setup(struct pt_regs *regs)
 }
 #endif
 
+#ifdef CONFIG_KEXEC
+static int __init kexec_grab_obp_tranlations(void)
+{
+       unsigned int count;
+       struct sparc64_kexec_shim *shimp = kexec_shim();
+
+       /* The last entry is the NULL terminator */
+       if (prom_trans_ents >= (KEXEC_OBP_TRANSLATION - 1)) {
+               pr_err("kexec_grab_obp_tranlations: EXCEEDS kexec limit\n");
+               goto out;
+       }
+
+       for (count = 0; count < prom_trans_ents; count++) {
+               shimp->obp_translations[count].va = prom_trans[count].virt;
+               shimp->obp_translations[count].size = prom_trans[count].size;
+               shimp->obp_translations[count].tte = prom_trans[count].data;
+       }
+
+       shimp->obp_translations[count].va = 0UL;
+out:
+       return 0;
+}
+device_initcall(kexec_grab_obp_tranlations);
+#endif /* CONFIG_KEXEC */
+
 static struct resource code_resource = {
        .name   = "Kernel code",
        .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
index b2340f008ae06a27614f2fc1c78e3b45b36946b0..b8127e7b5d8221a7e456eaac3d2bb6fe609fdf36 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/irqflags.h>
+#include <linux/kexec.h>
 
 #include <asm/openprom.h>
 #include <asm/oplib.h>
@@ -54,3 +55,15 @@ void prom_cif_init(void *cif_handler, void *cif_stack)
        p1275buf.prom_cif_handler = (void (*)(long *))cif_handler;
        p1275buf.prom_cif_stack = (unsigned long)cif_stack;
 }
+
+#ifdef CONFIG_KEXEC
+static int __init kexec_grab_obp_cif_stack(void)
+{
+       struct sparc64_kexec_shim *shimp = kexec_shim();
+
+       shimp->obp_cif = (unsigned long) p1275buf.prom_cif_handler;
+       shimp->obp_sp = (unsigned long) p1275buf.prom_cif_stack;
+       return 0;
+}
+device_initcall(kexec_grab_obp_cif_stack);
+#endif /* CONFIG_KEXEC */