From: Dave Kleikamp Date: Fri, 23 May 2014 22:56:41 +0000 (-0500) Subject: sparc64: capture obp information during boot X-Git-Tag: v4.1.12-92~147^2~3^2~8 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=71cf6e3ba1b915a0acbbbc6bd3cabc5008d71446;p=users%2Fjedix%2Flinux-maple.git sparc64: capture obp information during boot original patch by Bob Picco Signed-off-by: Dave Kleikamp Cc: Bob Picco --- diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index cab7cbdfb67e5..4d19df252a72c 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 b2340f008ae06..b8127e7b5d822 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 */