From 71cf6e3ba1b915a0acbbbc6bd3cabc5008d71446 Mon Sep 17 00:00:00 2001 From: Dave Kleikamp Date: Fri, 23 May 2014 17:56:41 -0500 Subject: [PATCH] sparc64: capture obp information during boot original patch by Bob Picco Signed-off-by: Dave Kleikamp Cc: Bob Picco --- arch/sparc/mm/init_64.c | 25 +++++++++++++++++++++++++ arch/sparc/prom/p1275.c | 13 +++++++++++++ 2 files changed, 38 insertions(+) diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index cab7cbdfb67e..4d19df252a72 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -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 diff --git a/arch/sparc/prom/p1275.c b/arch/sparc/prom/p1275.c index b2340f008ae0..b8127e7b5d82 100644 --- a/arch/sparc/prom/p1275.c +++ b/arch/sparc/prom/p1275.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -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 */ -- 2.50.1