KEXEC: add support for (and enable) KEXEC with RAM CONSOLE
/arch/arm/mach-msm/board-m2_spr.c
blob:ed26af6d6498c4c8b238ea9b47f585db5de5df11 -> blob:4694508bbb84406798888c3a87713b61aa025a32
--- arch/arm/mach-msm/board-m2_spr.c
+++ arch/arm/mach-msm/board-m2_spr.c
@@ -172,6 +172,9 @@
#include <linux/sec_jack.h>
#endif
+#ifdef CONFIG_KEXEC_HARDBOOT
+#include <asm/kexec.h>
+#endif
#ifdef CONFIG_TOUCHSCREEN_MMS144
struct tsp_callbacks *charger_callbacks;
struct tsp_callbacks {
@@ -1029,6 +1032,25 @@ static int __init ext_display_setup(char
}
early_param("ext_display", ext_display_setup);
+/* Exclude the last 4 kB to preserve the kexec hardboot page. */
+#ifdef CONFIG_ANDROID_RAM_CONSOLE
+#define RAM_CONSOLE_START 0xfff00000
+#define RAM_CONSOLE_SIZE (SZ_1M-SZ_4K)
+
+static struct resource ram_console_resource[] = {
+ {
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device ram_console_device = {
+ .name = "ram_console",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(ram_console_resource),
+ .resource = ram_console_resource,
+};
+#endif
+
unsigned int address = 0xea000000;
unsigned int size = 0x100000;
@@ -1054,6 +1076,17 @@ static void __init msm8960_reserve(void)
ret = memblock_remove(address, size);
BUG_ON(ret);
}
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE
+ if (memblock_remove(RAM_CONSOLE_START, RAM_CONSOLE_SIZE) == 0) {
+ ram_console_resource[0].start = RAM_CONSOLE_START;
+ ram_console_resource[0].end = RAM_CONSOLE_START+RAM_CONSOLE_SIZE-1;
+ }
+#endif
+
+#ifdef CONFIG_KEXEC_HARDBOOT
+ memblock_remove(KEXEC_HB_PAGE_ADDR, SZ_4K);
+#endif
}
static int msm8960_change_memory_power(u64 start, u64 size,
@@ -4416,6 +4449,9 @@ static struct platform_device *m2_spr_de
#ifdef CONFIG_VIBETONZ
&vibetonz_device,
#endif /* CONFIG_VIBETONZ */
+#ifdef CONFIG_ANDROID_RAM_CONSOLE
+ &ram_console_device,
+#endif
};
static void __init msm8960_i2c_init(void)
@@ -5279,7 +5315,7 @@ static void __init samsung_m2_spr_init(v
}
-MACHINE_START(M2_SPR, "SAMSUNG M2_SPR")
+MACHINE_START(M2_SPR, "AnThRaXed SAMSUNG M2_SPR")
.map_io = msm8960_map_io,
.reserve = msm8960_reserve,
.init_irq = msm8960_init_irq,