Merge ../linux-2.6
[pandora-kernel.git] / arch / powerpc / kernel / machine_kexec_64.c
index d643144..be58985 100644 (file)
@@ -10,7 +10,6 @@
  */
 
 
-#include <linux/cpumask.h>
 #include <linux/kexec.h>
 #include <linux/smp.h>
 #include <linux/thread_info.h>
@@ -26,8 +25,6 @@
 #include <asm/prom.h>
 #include <asm/smp.h>
 
-#define HASH_GROUP_SIZE 0x80   /* size of each hash group, asm/mmu.h */
-
 int default_machine_kexec_prepare(struct kimage *image)
 {
        int i;
@@ -61,7 +58,7 @@ int default_machine_kexec_prepare(struct kimage *image)
         */
        if (htab_address) {
                low = __pa(htab_address);
-               high = low + (htab_hash_mask + 1) * HASH_GROUP_SIZE;
+               high = low + htab_size_bytes;
 
                for (i = 0; i < image->nr_segments; i++) {
                        begin = image->segment[i].mem;
@@ -294,7 +291,7 @@ void default_machine_kexec(struct kimage *image)
 }
 
 /* Values we need to export to the second kernel via the device tree. */
-static unsigned long htab_base, htab_size, kernel_end;
+static unsigned long htab_base, kernel_end;
 
 static struct property htab_base_prop = {
        .name = "linux,htab-base",
@@ -305,7 +302,7 @@ static struct property htab_base_prop = {
 static struct property htab_size_prop = {
        .name = "linux,htab-size",
        .length = sizeof(unsigned long),
-       .value = (unsigned char *)&htab_size,
+       .value = (unsigned char *)&htab_size_bytes,
 };
 
 static struct property kernel_end_prop = {
@@ -331,15 +328,58 @@ static void __init export_htab_values(void)
 
        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)
+static struct property crashk_base_prop = {
+       .name = "linux,crashkernel-base",
+       .length = sizeof(unsigned long),
+       .value = (unsigned char *)&crashk_res.start,
+};
+
+static unsigned long crashk_size;
+
+static struct property crashk_size_prop = {
+       .name = "linux,crashkernel-size",
+       .length = sizeof(unsigned long),
+       .value = (unsigned char *)&crashk_size,
+};
+
+static void __init export_crashk_values(void)
+{
+       struct device_node *node;
+       struct property *prop;
+
+       node = of_find_node_by_path("/chosen");
+       if (!node)
+               return;
+
+       /* There might be existing crash kernel properties, but we can't
+        * be sure what's in them, so remove them. */
+       prop = of_find_property(node, "linux,crashkernel-base", NULL);
+       if (prop)
+               prom_remove_property(node, prop);
+
+       prop = of_find_property(node, "linux,crashkernel-size", NULL);
+       if (prop)
+               prom_remove_property(node, prop);
+
+       if (crashk_res.start != 0) {
+               prom_add_property(node, &crashk_base_prop);
+               crashk_size = crashk_res.end - crashk_res.start + 1;
+               prom_add_property(node, &crashk_size_prop);
+       }
+
+       of_node_put(node);
+}
+
+static int __init kexec_setup(void)
 {
        export_htab_values();
+       export_crashk_values();
+       return 0;
 }
+__initcall(kexec_setup);