summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Collins <collinsd@codeaurora.org>2014-01-10 14:11:24 -0800
committerRohit Vaswani <rvaswani@codeaurora.org>2016-03-01 12:22:13 -0800
commitd4b065ff4717f80fd33c092e855ff89cb58c9f36 (patch)
tree03c3ccce9c4f9827ddedac09c7e80baecfb7a2d6
parent8b04432318111ff1c65c51040a9d13350b940a21 (diff)
sysctl: add boot_reason and cold_boot sysctl entries for arm64
Define boot_reason and cold_boot variables in the arm64 version of setup.c so that arm64 targets can export the boot_reason and cold_boot sysctl entries. This feature is required by the qpnp-power-on driver. Change-Id: Id2d4ff5b8caa2e6a35d4ac61e338963d602c8b84 Signed-off-by: David Collins <collinsd@codeaurora.org> [osvaldob: resolved trival merge conflicts] Signed-off-by: Osvaldo Banuelos <osvaldob@codeaurora.org>
-rw-r--r--Documentation/sysctl/kernel.txt25
-rw-r--r--arch/arm64/include/asm/processor.h3
-rw-r--r--arch/arm64/kernel/setup.c6
-rw-r--r--kernel/sysctl.c21
4 files changed, 55 insertions, 0 deletions
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index af70d1541d3a..9c48b84660f5 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -23,8 +23,10 @@ show up in /proc/sys/kernel:
- auto_msgmni
- bootloader_type [ X86 only ]
- bootloader_version [ X86 only ]
+- boot_reason [ ARM and ARM64 only ]
- callhome [ S390 only ]
- cap_last_cap
+- cold_boot [ ARM and ARM64 only ]
- core_pattern
- core_pipe_limit
- core_uses_pid
@@ -158,6 +160,19 @@ Documentation/x86/boot.txt for additional information.
==============================================================
+boot_reason:
+
+ARM and ARM64 -- reason for device boot
+
+A single bit will be set in the unsigned integer value to identify the
+reason the device was booted / powered on. The value will be zero if this
+feature is not supported on the ARM device being booted.
+
+See the power-on-status field definitions in
+Documentation/arm/msm/boot.txt for Qualcomm's family of devices.
+
+==============================================================
+
callhome:
Controls the kernel's callhome behavior in case of a kernel panic.
@@ -178,6 +193,16 @@ cap_last_cap
Highest valid capability of the running kernel. Exports
CAP_LAST_CAP from the kernel.
+===============================================================
+
+cold_boot
+
+ARM and ARM64 -- 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:
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 4acb7ca94fcd..c8c7c4d38171 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -49,6 +49,9 @@ extern phys_addr_t arm64_dma_phys_limit;
#define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1)
#endif /* __KERNEL__ */
+extern unsigned int boot_reason;
+extern unsigned int cold_boot;
+
struct debug_info {
/* Have we suspended stepping by a debugger? */
int suspended_step;
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 3f993007e7d2..f4b69afa2efa 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -64,6 +64,12 @@
#include <asm/efi.h>
#include <asm/xen/hypervisor.h>
+unsigned int boot_reason;
+EXPORT_SYMBOL(boot_reason);
+
+unsigned int cold_boot;
+EXPORT_SYMBOL(cold_boot);
+
static const char *machine_name;
phys_addr_t __fdt_pointer __initdata;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 35bfe0c1360b..53fa75661ae4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1173,6 +1173,27 @@ static struct ctl_table kern_table[] = {
.extra2 = &one,
},
#endif
+#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
+ {
+ .procname = "boot_reason",
+ .data = &boot_reason,
+ .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
+/*
+ * NOTE: do not add new entries to this table unless you have read
+ * Documentation/sysctl/ctl_unnumbered.txt
+ */
{ }
};