sysctl: add cold_boot sysctl entry

Add a cold_boot parameter which supplements the
boot_reason sysctl entry with information about
whether the system was booted from cold or warm state.

/proc/sys/kernel/cold_boot entry is updated with 1 or 0 when
system was booted from cold or warm boot state respecitively.

CRs-Fixed: 461256
Change-Id: I2bc5d80c8f26eb9e9dbb4b34960d991a51a224e4
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
This commit is contained in:
David Keitel 2013-03-26 18:50:03 -07:00 committed by David Collins
parent f699c92b61
commit ee67650037
6 changed files with 26 additions and 1 deletions
Documentation/sysctl
arch/arm
include/asm
kernel
include/uapi/linux
kernel

View file

@ -26,6 +26,7 @@ show up in /proc/sys/kernel:
- boot_reason [ ARM only ]
- callhome [ S390 only ]
- cap_last_cap
- cold_boot [ ARM only ]
- core_pattern
- core_pipe_limit
- core_uses_pid
@ -203,6 +204,16 @@ cap_last_cap
Highest valid capability of the running kernel. Exports
CAP_LAST_CAP from the kernel.
===============================================================
cold_boot
ARM -- indicator for system cold boot
A single bit will be set in the unsigned integer value to identify
whether the device was booted from a cold or warm state. Zero
indicating a warm boot and one indicating a cold boot.
==============================================================
core_pattern:

View file

@ -31,6 +31,7 @@
#endif
extern unsigned int boot_reason;
extern unsigned int cold_boot;
struct debug_info {
#ifdef CONFIG_HAVE_HW_BREAKPOINT

View file

@ -119,6 +119,9 @@ EXPORT_SYMBOL(arch_read_hardware_id);
unsigned int boot_reason;
EXPORT_SYMBOL(boot_reason);
unsigned int cold_boot;
EXPORT_SYMBOL(cold_boot);
#ifdef MULTI_CPU
struct processor processor __ro_after_init;
#endif

View file

@ -154,6 +154,7 @@ enum
KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
KERN_PANIC_ON_WARN=77, /* int: call panic() in WARN() functions */
KERN_BOOT_REASON=78, /* int: identify reason system was booted */
KERN_COLD_BOOT=79, /* int: identify if system cold booted */
};

View file

@ -1241,7 +1241,15 @@ static struct ctl_table kern_table[] = {
.maxlen = sizeof(int),
.mode = 0444,
.proc_handler = proc_dointvec,
},
},
{
.procname = "cold_boot",
.data = &cold_boot,
.maxlen = sizeof(int),
.mode = 0444,
.proc_handler = proc_dointvec,
},
#endif
{ }
};

View file

@ -141,6 +141,7 @@ static const struct bin_table bin_kern_table[] = {
{ CTL_INT, KERN_PANIC_ON_NMI, "panic_on_unrecovered_nmi" },
{ CTL_INT, KERN_PANIC_ON_WARN, "panic_on_warn" },
{ CTL_INT, KERN_BOOT_REASON, "boot_reason" },
{ CTL_INT, KERN_COLD_BOOT, "cold_boot" },
{}
};