diff options
| author | Makarand karvekar <mkarvekar@motorola.com> | 2014-05-09 14:30:35 -0500 |
|---|---|---|
| committer | Makarand Karvekar <mkarvekar@motorola.com> | 2014-05-12 19:12:55 +0000 |
| commit | aa8778e6f0005ad97c81e0b0e0817a8b2bdce961 (patch) | |
| tree | 679aecb549d1368eb4b976615ef377a7966d37fc | |
| parent | a34aac0f0ef2f4193fc5983bd2131e4b122a0554 (diff) | |
| download | olio-linux-3.10-aa8778e6f0005ad97c81e0b0e0817a8b2bdce961.tar.xz olio-linux-3.10-aa8778e6f0005ad97c81e0b0e0817a8b2bdce961.zip | |
IKXCLOCK-1108 arm: kernel: capture boot reason to pstore annotate
Change-Id: Ic9a3994d3d905bce907ecf1004f8a271baddc81d
Signed-off-by: Makarand karvekar <mkarvekar@motorola.com>
| -rw-r--r-- | arch/arm/kernel/bootinfo.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/arch/arm/kernel/bootinfo.c b/arch/arm/kernel/bootinfo.c index 1bc3c452cea..52a52a4f121 100644 --- a/arch/arm/kernel/bootinfo.c +++ b/arch/arm/kernel/bootinfo.c @@ -23,6 +23,14 @@ #include <linux/seq_file.h> #include <linux/of.h> #include <asm/bootinfo.h> +#include <linux/pstore.h> + +#define EMIT_BOOTINFO_LASTKMSG(buf, strname, fmt, name) \ + do { \ + snprintf(buf, sizeof(buf), strname ": " fmt "\n", \ + bi_##name()); \ + pstore_annotate(buf); \ + } while (0) /* * powerup_reason contains the powerup reason provided by the ATAGs when @@ -125,17 +133,40 @@ static u64 bi_serial(void) return ((u64)serial_high << 32) | (u64)serial_low; } +#define BOOTREASON_MAX_LEN 64 +static char bootreason[BOOTREASON_MAX_LEN + 1]; +int __init board_bootreason_init(char *s) +{ + strncpy(bootreason, s, BOOTREASON_MAX_LEN); + bootreason[BOOTREASON_MAX_LEN] = '\0'; + return 1; +} +__setup("androidboot.bootreason=", board_bootreason_init); + +const char *bi_bootreason(void) +{ + return bootreason; +} +EXPORT_SYMBOL(bi_bootreason); + +static void bootinfo_annotate_lastkmsg(void) +{ + char buf[BOOTREASON_MAX_LEN]; + pstore_annotate("Boot info:\n"); + EMIT_BOOTINFO_LASTKMSG(buf, "Last boot reason", "%s", bootreason); +} + /* get_bootinfo fills in the /proc/bootinfo information. * We currently only have the powerup reason, mbm_version, serial * and hwrevision. */ - static int get_bootinfo(struct seq_file *m, void *v) { seq_printf(m, "SERIAL : 0x%llx\n", bi_serial()); seq_printf(m, "HW_REV : 0x%04x\n", bi_hwrev()); seq_printf(m, "POWERUPREASON : 0x%08x\n", bi_powerup_reason()); seq_printf(m, "MBM_VERSION : 0x%08x\n", bi_mbm_version()); + seq_printf(m, "Last boot reason : %s \n", bootreason); return 0; } static int bootinfo_open(struct inode *inode, struct file *file) @@ -157,6 +188,7 @@ static int __init bootinfo_init_module(void) { proc_bootinfo = &proc_root; proc_create("bootinfo", 0, NULL, &bootinfo_fops); + bootinfo_annotate_lastkmsg(); return 0; } |