最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

Recovery启动流程(1)---应用层到开机进入recovery详解

IT圈 admin 23浏览 0评论

2024年10月3日发(作者:昝元亮)

/* Needed to bypass debug image on some chips */

if (!is_scm_armv8())

ret = scm_call_atomic2(SCM_SVC_BOOT,

SCM_WDOG_DEBUG_BOOT_PART, 1, 0);

else

ret = scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_BOOT,

SCM_WDOG_DEBUG_BOOT_PART), &desc);

if (ret)

pr_err("Failed to disable secure wdog debug: %dn", ret);

halt_spmi_pmic_arbiter();

deassert_ps_hold();

mdelay(10000);

}

msm_restart_prepare(cmd); 参数为("recovery")

kernel/drivers/power/reset/msm-poweroff.c

static void msm_restart_prepare(const char *cmd)

{

#ifdef CONFIG_MSM_SUBSYSTEM_RESTART

extern char panic_subsystem[];

#endif /* CONFIG_MSM_SUBSYSTEM_RESTART */

bool need_warm_reset = false;

#ifdef CONFIG_MSM_DLOAD_MODE

/* Write download mode flags if we're panic'ing

* Write download mode flags if restart_mode says so

* Kill download mode if master-kill switch is set

*/

set_dload_mode(download_mode &&

(in_panic || restart_mode == RESTART_DLOAD));

#endif

if (qpnp_pon_check_hard_reset_stored()) {

/* Set warm reset as true when device is in dload mode

* or device doesn't boot up into recovery, bootloader or rtc.

*/

if (get_dload_mode() ||

((cmd != NULL && cmd[0] != '0') &&

strcmp(cmd, "recovery") &&

strcmp(cmd, "bootloader") &&

strcmp(cmd, "rtc")))

need_warm_reset = true;

} else {

need_warm_reset = (get_dload_mode() ||

(cmd != NULL && cmd[0] != '0'));

}

/* Hard reset the PMIC unless memory contents must be maintained. */

if (need_warm_reset || restart_mode == RESTART_DLOAD) {// MODIFIED by , 2016-03-21, BUG-1761259

qpnp_pon_system_pwr_off(PON_POWER_OFF_WARM_RESET);

} else {

qpnp_pon_system_pwr_off(PON_POWER_OFF_HARD_RESET);

}

if (cmd != NULL) {

if (!strncmp(cmd, "bootloader", 10)) {

qpnp_pon_set_restart_reason(

PON_RESTART_REASON_BOOTLOADER);

__raw_writel(0x77665500, restart_reason);

} else if (!strncmp(cmd, "recovery", 8)) {

qpnp_pon_set_restart_reason(

PON_RESTART_REASON_RECOVERY);

__raw_writel(0x77665502, restart_reason); //********************

  else if (!strcmp(cmd, "rtc")) {

qpnp_pon_set_restart_reason(

PON_RESTART_REASON_RTC);

__raw_writel(0x77665503, restart_reason);

} else if (!strncmp(cmd, "oem-", 4)) {

unsigned long code;

int ret;

ret = kstrtoul(cmd + 4, 16, &code);

if (!ret)

__raw_writel(0x6f656d00 | (code & 0xff),

restart_reason);

if (download_mode && (code & 0xff) == 0x3a)

set_dload_mode(1);

} else if (!strncmp(cmd, "edl", 3)) {

enable_emergency_dload_mode();

} else {

__raw_writel(0x77665501, restart_reason);

}

}

#ifdef CONFIG_MSM_SUBSYSTEM_RESTART

if (in_panic) {

printk(KERN_ERR "subsystem %s crashn", panic_subsystem);

if (!memcmp(panic_subsystem, "modem", 5)) {

__raw_writel(0x6f656dc1, restart_reason);

} else if (!memcmp(panic_subsystem, "wcnss", 5)) {

__raw_writel(0x6f656dc2, restart_reason);

} else if (!memcmp(panic_subsystem, "adsp", 4) || !memcmp(panic_subsystem, "ADSP", 4)) {

__raw_writel(0x6f656dc3, restart_reason);

} else if (!memcmp(panic_subsystem, "venus", 5)) {

__raw_writel(0x6f656dc4, restart_reason);

} else {

__raw_writel(0x6f656dc0, restart_reason);

}

if (download_mode)

set_dload_mode(1);

}

#endif /* CONFIG_MSM_SUBSYSTEM_RESTART */

//add begin by ,Powering on mode switch to 9008 mode,task:665748

if (restart_mode == RESTART_DLOAD) {

enable_emergency_dload_mode();

}

//add end by

2024年10月3日发(作者:昝元亮)

/* Needed to bypass debug image on some chips */

if (!is_scm_armv8())

ret = scm_call_atomic2(SCM_SVC_BOOT,

SCM_WDOG_DEBUG_BOOT_PART, 1, 0);

else

ret = scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_BOOT,

SCM_WDOG_DEBUG_BOOT_PART), &desc);

if (ret)

pr_err("Failed to disable secure wdog debug: %dn", ret);

halt_spmi_pmic_arbiter();

deassert_ps_hold();

mdelay(10000);

}

msm_restart_prepare(cmd); 参数为("recovery")

kernel/drivers/power/reset/msm-poweroff.c

static void msm_restart_prepare(const char *cmd)

{

#ifdef CONFIG_MSM_SUBSYSTEM_RESTART

extern char panic_subsystem[];

#endif /* CONFIG_MSM_SUBSYSTEM_RESTART */

bool need_warm_reset = false;

#ifdef CONFIG_MSM_DLOAD_MODE

/* Write download mode flags if we're panic'ing

* Write download mode flags if restart_mode says so

* Kill download mode if master-kill switch is set

*/

set_dload_mode(download_mode &&

(in_panic || restart_mode == RESTART_DLOAD));

#endif

if (qpnp_pon_check_hard_reset_stored()) {

/* Set warm reset as true when device is in dload mode

* or device doesn't boot up into recovery, bootloader or rtc.

*/

if (get_dload_mode() ||

((cmd != NULL && cmd[0] != '0') &&

strcmp(cmd, "recovery") &&

strcmp(cmd, "bootloader") &&

strcmp(cmd, "rtc")))

need_warm_reset = true;

} else {

need_warm_reset = (get_dload_mode() ||

(cmd != NULL && cmd[0] != '0'));

}

/* Hard reset the PMIC unless memory contents must be maintained. */

if (need_warm_reset || restart_mode == RESTART_DLOAD) {// MODIFIED by , 2016-03-21, BUG-1761259

qpnp_pon_system_pwr_off(PON_POWER_OFF_WARM_RESET);

} else {

qpnp_pon_system_pwr_off(PON_POWER_OFF_HARD_RESET);

}

if (cmd != NULL) {

if (!strncmp(cmd, "bootloader", 10)) {

qpnp_pon_set_restart_reason(

PON_RESTART_REASON_BOOTLOADER);

__raw_writel(0x77665500, restart_reason);

} else if (!strncmp(cmd, "recovery", 8)) {

qpnp_pon_set_restart_reason(

PON_RESTART_REASON_RECOVERY);

__raw_writel(0x77665502, restart_reason); //********************

  else if (!strcmp(cmd, "rtc")) {

qpnp_pon_set_restart_reason(

PON_RESTART_REASON_RTC);

__raw_writel(0x77665503, restart_reason);

} else if (!strncmp(cmd, "oem-", 4)) {

unsigned long code;

int ret;

ret = kstrtoul(cmd + 4, 16, &code);

if (!ret)

__raw_writel(0x6f656d00 | (code & 0xff),

restart_reason);

if (download_mode && (code & 0xff) == 0x3a)

set_dload_mode(1);

} else if (!strncmp(cmd, "edl", 3)) {

enable_emergency_dload_mode();

} else {

__raw_writel(0x77665501, restart_reason);

}

}

#ifdef CONFIG_MSM_SUBSYSTEM_RESTART

if (in_panic) {

printk(KERN_ERR "subsystem %s crashn", panic_subsystem);

if (!memcmp(panic_subsystem, "modem", 5)) {

__raw_writel(0x6f656dc1, restart_reason);

} else if (!memcmp(panic_subsystem, "wcnss", 5)) {

__raw_writel(0x6f656dc2, restart_reason);

} else if (!memcmp(panic_subsystem, "adsp", 4) || !memcmp(panic_subsystem, "ADSP", 4)) {

__raw_writel(0x6f656dc3, restart_reason);

} else if (!memcmp(panic_subsystem, "venus", 5)) {

__raw_writel(0x6f656dc4, restart_reason);

} else {

__raw_writel(0x6f656dc0, restart_reason);

}

if (download_mode)

set_dload_mode(1);

}

#endif /* CONFIG_MSM_SUBSYSTEM_RESTART */

//add begin by ,Powering on mode switch to 9008 mode,task:665748

if (restart_mode == RESTART_DLOAD) {

enable_emergency_dload_mode();

}

//add end by

发布评论

评论列表 (0)

  1. 暂无评论