|
@@ -51,6 +51,7 @@
|
|
#include <asm/machdep.h>
|
|
#include <asm/machdep.h>
|
|
#include <asm/pSeries_reconfig.h>
|
|
#include <asm/pSeries_reconfig.h>
|
|
#include <asm/pci-bridge.h>
|
|
#include <asm/pci-bridge.h>
|
|
|
|
+#include <asm/phyp_dump.h>
|
|
#include <asm/kexec.h>
|
|
#include <asm/kexec.h>
|
|
|
|
|
|
#ifdef DEBUG
|
|
#ifdef DEBUG
|
|
@@ -1040,6 +1041,51 @@ static void __init early_reserve_mem(void)
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PHYP_DUMP
|
|
|
|
+/**
|
|
|
|
+ * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory
|
|
|
|
+ *
|
|
|
|
+ * This routine may reserve memory regions in the kernel only
|
|
|
|
+ * if the system is supported and a dump was taken in last
|
|
|
|
+ * boot instance or if the hardware is supported and the
|
|
|
|
+ * scratch area needs to be setup. In other instances it returns
|
|
|
|
+ * without reserving anything. The memory in case of dump being
|
|
|
|
+ * active is freed when the dump is collected (by userland tools).
|
|
|
|
+ */
|
|
|
|
+static void __init phyp_dump_reserve_mem(void)
|
|
|
|
+{
|
|
|
|
+ unsigned long base, size;
|
|
|
|
+ if (!phyp_dump_info->phyp_dump_configured) {
|
|
|
|
+ printk(KERN_ERR "Phyp-dump not supported on this hardware\n");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (phyp_dump_info->phyp_dump_is_active) {
|
|
|
|
+ /* Reserve *everything* above RMR.Area freed by userland tools*/
|
|
|
|
+ base = PHYP_DUMP_RMR_END;
|
|
|
|
+ size = lmb_end_of_DRAM() - base;
|
|
|
|
+
|
|
|
|
+ /* XXX crashed_ram_end is wrong, since it may be beyond
|
|
|
|
+ * the memory_limit, it will need to be adjusted. */
|
|
|
|
+ lmb_reserve(base, size);
|
|
|
|
+
|
|
|
|
+ phyp_dump_info->init_reserve_start = base;
|
|
|
|
+ phyp_dump_info->init_reserve_size = size;
|
|
|
|
+ } else {
|
|
|
|
+ size = phyp_dump_info->cpu_state_size +
|
|
|
|
+ phyp_dump_info->hpte_region_size +
|
|
|
|
+ PHYP_DUMP_RMR_END;
|
|
|
|
+ base = lmb_end_of_DRAM() - size;
|
|
|
|
+ lmb_reserve(base, size);
|
|
|
|
+ phyp_dump_info->init_reserve_start = base;
|
|
|
|
+ phyp_dump_info->init_reserve_size = size;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+static inline void __init phyp_dump_reserve_mem(void) {}
|
|
|
|
+#endif /* CONFIG_PHYP_DUMP && CONFIG_PPC_RTAS */
|
|
|
|
+
|
|
|
|
+
|
|
void __init early_init_devtree(void *params)
|
|
void __init early_init_devtree(void *params)
|
|
{
|
|
{
|
|
DBG(" -> early_init_devtree(%p)\n", params);
|
|
DBG(" -> early_init_devtree(%p)\n", params);
|
|
@@ -1052,6 +1098,11 @@ void __init early_init_devtree(void *params)
|
|
of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
|
|
of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PHYP_DUMP
|
|
|
|
+ /* scan tree to see if dump occured during last boot */
|
|
|
|
+ of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
|
|
|
|
+#endif
|
|
|
|
+
|
|
/* Retrieve various informations from the /chosen node of the
|
|
/* Retrieve various informations from the /chosen node of the
|
|
* device-tree, including the platform type, initrd location and
|
|
* device-tree, including the platform type, initrd location and
|
|
* size, TCE reserve, and more ...
|
|
* size, TCE reserve, and more ...
|
|
@@ -1072,6 +1123,7 @@ void __init early_init_devtree(void *params)
|
|
reserve_kdump_trampoline();
|
|
reserve_kdump_trampoline();
|
|
reserve_crashkernel();
|
|
reserve_crashkernel();
|
|
early_reserve_mem();
|
|
early_reserve_mem();
|
|
|
|
+ phyp_dump_reserve_mem();
|
|
|
|
|
|
lmb_enforce_memory_limit(memory_limit);
|
|
lmb_enforce_memory_limit(memory_limit);
|
|
lmb_analyze();
|
|
lmb_analyze();
|