add system restart warm and panic mode

add two debug interfaces:
1.when set cmdline "sys_restart_mode=warm", the kernel will reset with
WARM way.
2.when set cmdline "sys_restart_mode=panic", the kernel will enter into
ramdump when it normal reset.

Change-Id: Id70063bac7d0951622c6e074c2ba2ec024374022
Signed-off-by: xizx <xizx@motorola.com>
Reviewed-on: https://gerrit.mot.com/1117501
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1345290
Reviewed-on: https://gerrit.mot.com/1406867
Reviewed-on: https://gerrit.mot.com/1463612
Reviewed-on: https://gerrit.mot.com/1778583
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
This commit is contained in:
xizx 2018-01-09 17:06:19 +08:00 • committed by Xiaojun Ji
commit 45f6f796b2

View file

@ -395,6 +395,20 @@ void msm_set_restart_mode(int mode)
}
EXPORT_SYMBOL(msm_set_restart_mode);
#define DEBUG_SYS_RESETART_WARM 1
#define DEBUG_SYS_RESETART_PANIC 2
static int debug_sys_restart_mode;
static int __init set_sys_restart_mode(char *str)
{
if (!strcmp(str, "warm"))
debug_sys_restart_mode = DEBUG_SYS_RESETART_WARM;
else if (!strcmp(str, "panic"))
debug_sys_restart_mode = DEBUG_SYS_RESETART_PANIC;
pr_info("sys_restart_mode is set to %d\n", debug_sys_restart_mode);
return 1;
}
__setup("sys_restart_mode=", set_sys_restart_mode);
static void msm_restart_prepare(const char *cmd)
{
@ -405,6 +419,11 @@ static void msm_restart_prepare(const char *cmd)
* Kill download mode if master-kill switch is set
*/
if (debug_sys_restart_mode == DEBUG_SYS_RESETART_PANIC) {
in_panic = 1;
pr_info("force system enter into ramdump for debug\n");
}
if (cmd != NULL && !strcmp(cmd, "qcom_dload"))
restart_mode = RESTART_DLOAD;
@ -503,6 +522,11 @@ static void msm_restart_prepare(const char *cmd)
__raw_writel(0x77665501, restart_reason);
}
if (debug_sys_restart_mode == DEBUG_SYS_RESETART_WARM) {
qpnp_pon_system_pwr_off(PON_POWER_OFF_WARM_RESET);
pr_info("set system warmreset mode for debug\n");
}
/*outer_flush_all is not supported by 64bit kernel*/
#ifndef CONFIG_ARM64
outer_flush_all();