panic: Add board ID to panic output
authorNishanth Menon <nm@ti.com>
Wed, 17 Aug 2011 23:31:58 +0000 (18:31 -0500)
committerArve Hjønnevåg <arve@android.com>
Mon, 1 Jul 2013 20:34:57 +0000 (13:34 -0700)
At times, it is necessary for boards to provide some additional information
as part of panic logs. Provide information on the board hardware as part
of panic logs.

It is safer to print this information at the very end in case something
bad happens as part of the information retrieval itself.

To use this, set global mach_panic_string to an appropriate string in the
board file.

Change-Id: Id12cdda87b0cd2940dd01d52db97e6162f671b4d
Signed-off-by: Nishanth Menon <nm@ti.com>
include/linux/kernel.h
kernel/panic.c

index e9ef6d6b51d5b07f6471e96dc20efa5685416220..eabc56d0f8240519d061dbc5053f2f0379caedb0 100644 (file)
@@ -792,4 +792,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
 # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
 #endif
 
+/* To identify board information in panic logs, set this */
+extern char *mach_panic_string;
+
 #endif
index 1daccb2ffa03994e3c91fd765764a0c21032b051..126b2ef2eb618bcd39f827ab43a4162092f70284 100644 (file)
@@ -26,6 +26,9 @@
 #define PANIC_TIMER_STEP 100
 #define PANIC_BLINK_SPD 18
 
+/* Machine specific panic information string */
+char *mach_panic_string;
+
 int panic_on_oops = CONFIG_PANIC_ON_OOPS_VALUE;
 static unsigned long tainted_mask;
 static int pause_on_oops;
@@ -378,6 +381,11 @@ late_initcall(init_oops_id);
 void print_oops_end_marker(void)
 {
        init_oops_id();
+
+       if (mach_panic_string)
+               printk(KERN_WARNING "Board Information: %s\n",
+                      mach_panic_string);
+
        printk(KERN_WARNING "---[ end trace %016llx ]---\n",
                (unsigned long long)oops_id);
 }