]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] powerpc: Export htab start/end via device tree
authorMichael Ellerman <michael@ellerman.id.au>
Fri, 11 Nov 2005 13:06:06 +0000 (00:06 +1100)
committerPaul Mackerras <paulus@samba.org>
Mon, 14 Nov 2005 05:34:06 +0000 (16:34 +1100)
The userspace kexec-tools need to know the location of the htab on non-lpar
machines, as well as the end of the kernel. Export via the device tree.

NB. This patch has been updated to use "linux,x" property names. You may
need to update your kexec-tools to match.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/setup_64.c
arch/ppc64/kernel/machine_kexec.c
include/asm-powerpc/kexec.h

index fdbd9f9122f2a69e5212aa30857e6330826cb5e5..608fee7c7e20621dcf829507e893cbaee4ea05da 100644 (file)
@@ -59,6 +59,7 @@
 #include <asm/firmware.h>
 #include <asm/xmon.h>
 #include <asm/udbg.h>
+#include <asm/kexec.h>
 
 #include "setup.h"
 
@@ -415,6 +416,10 @@ void __init setup_system(void)
         */
        unflatten_device_tree();
 
+#ifdef CONFIG_KEXEC
+       kexec_setup();  /* requires unflattened device tree. */
+#endif
+
        /*
         * Fill the ppc64_caches & systemcfg structures with informations
         * retreived from the device-tree. Need to be called before
index 203f1d5e6f10914c28588c46e8d7f19012a8ad9c..97c51e452be74c16fb8cfca957c8ca5b7bf00f75 100644 (file)
@@ -305,3 +305,54 @@ void machine_kexec(struct kimage *image)
                        ppc_md.hpte_clear_all);
        /* NOTREACHED */
 }
+
+/* Values we need to export to the second kernel via the device tree. */
+static unsigned long htab_base, htab_size, kernel_end;
+
+static struct property htab_base_prop = {
+       .name = "linux,htab-base",
+       .length = sizeof(unsigned long),
+       .value = (unsigned char *)&htab_base,
+};
+
+static struct property htab_size_prop = {
+       .name = "linux,htab-size",
+       .length = sizeof(unsigned long),
+       .value = (unsigned char *)&htab_size,
+};
+
+static struct property kernel_end_prop = {
+       .name = "linux,kernel-end",
+       .length = sizeof(unsigned long),
+       .value = (unsigned char *)&kernel_end,
+};
+
+static void __init export_htab_values(void)
+{
+       struct device_node *node;
+
+       node = of_find_node_by_path("/chosen");
+       if (!node)
+               return;
+
+       kernel_end = __pa(_end);
+       prom_add_property(node, &kernel_end_prop);
+
+       /* On machines with no htab htab_address is NULL */
+       if (NULL == htab_address)
+               goto out;
+
+       htab_base = __pa(htab_address);
+       prom_add_property(node, &htab_base_prop);
+
+       htab_size = 1UL << ppc64_pft_size;
+       prom_add_property(node, &htab_size_prop);
+
+ out:
+       of_node_put(node);
+}
+
+void __init kexec_setup(void)
+{
+       export_htab_values();
+}
index 062ab9ba68eb31d0f6fcc711b4259202a467e6f2..c72ffc709ea8ac0143ab13270895263c05394789 100644 (file)
@@ -40,6 +40,7 @@ extern note_buf_t crash_notes[];
 #ifdef __powerpc64__
 extern void kexec_smp_wait(void);      /* get and clear naca physid, wait for
                                          master to copy new code to 0 */
+extern void __init kexec_setup(void);
 #else
 struct kimage;
 extern void machine_kexec_simple(struct kimage *image);