summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYou-Cheng Syu <youcheng@chromium.org>2019-04-09 13:04:34 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-08-26 07:49:42 -0700
commit555a4470c7e6373cb6d5397ea5e9278317bcb008 (patch)
tree092deb6e16531e651311625d61accc51708eafb6
parentb3470c02db3b03781cc4d7b0a4c7894a342cba1a (diff)
downloadchrome-ec-555a4470c7e6373cb6d5397ea5e9278317bcb008.tar.gz
include: Move RESET_FLAG_* into ec_commands.h as EC_RESET_FLAG_*
RESET_FLAGS_* are used when setting/reading the field ec_reset_flags of struct ec_response_uptime_info, which is defined in ec_commands.h. So it might be better to put those macros there. To be consistent with the other macros in the file, add "EC_" prefixes to them. BUG=b:109900671,b:118654976 BRANCH=none TEST=make buildall -j Cq-Depend: chrome-internal:1054910, chrome-internal:1054911, chrome-internal:1045539 Change-Id: If72ec25f1b34d8d46b74479fb4cd09252102aafa Signed-off-by: You-Cheng Syu <youcheng@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1520574 Tested-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Ready: Yu-Ping Wu <yupingso@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--board/chell/board.c6
-rw-r--r--board/cr50/ap_state.c3
-rw-r--r--board/cr50/board.c6
-rw-r--r--board/cr50/factory_mode.c3
-rw-r--r--board/cr50/wp.c3
-rw-r--r--board/glados/board.c6
-rw-r--r--board/jacuzzi/board.c2
-rw-r--r--board/kodama/board.c2
-rw-r--r--board/kukui/board.c2
-rw-r--r--board/mchpevb1/board.c6
-rw-r--r--board/plankton/board.c2
-rw-r--r--chip/g/rbox.c5
-rw-r--r--chip/g/system.c24
-rw-r--r--chip/g/upgrade_fw.c2
-rw-r--r--chip/g/usb.c2
-rw-r--r--chip/g/watchdog.c3
-rw-r--r--chip/host/system.c11
-rw-r--r--chip/ish/ish_persistent_data.c3
-rw-r--r--chip/ish/system.c4
-rw-r--r--chip/ish/watchdog.c3
-rw-r--r--chip/it83xx/flash.c4
-rw-r--r--chip/it83xx/system.c26
-rw-r--r--chip/lm4/flash.c4
-rw-r--r--chip/lm4/system.c24
-rw-r--r--chip/mchp/flash.c2
-rw-r--r--chip/mchp/system.c30
-rw-r--r--chip/mec1322/flash.c2
-rw-r--r--chip/mec1322/system.c32
-rw-r--r--chip/mt_scp/system.c26
-rw-r--r--chip/npcx/gpio.c2
-rw-r--r--chip/npcx/system-npcx7.c3
-rw-r--r--chip/npcx/system.c46
-rw-r--r--chip/nrf51/system.c11
-rw-r--r--chip/stm32/flash-f.c2
-rw-r--r--chip/stm32/flash-stm32f3.c2
-rw-r--r--chip/stm32/flash-stm32h7.c4
-rw-r--r--chip/stm32/flash-stm32l.c2
-rw-r--r--chip/stm32/flash-stm32l4.c2
-rw-r--r--chip/stm32/system.c26
-rw-r--r--common/button.c4
-rw-r--r--common/keyboard_scan.c2
-rw-r--r--common/main.c6
-rw-r--r--common/power_button_x86.c2
-rw-r--r--common/system.c17
-rw-r--r--common/usb_pd_protocol.c2
-rw-r--r--include/ec_commands.h31
-rw-r--r--include/reset_flag_desc.inc2
-rw-r--r--include/system.h26
-rw-r--r--power/mt817x.c14
-rw-r--r--power/mt8183.c2
-rw-r--r--power/rk3288.c12
-rw-r--r--power/rk3399.c2
-rw-r--r--power/sdm845.c14
-rw-r--r--power/skylake.c7
-rw-r--r--test/kb_scan.c4
55 files changed, 254 insertions, 241 deletions
diff --git a/board/chell/board.c b/board/chell/board.c
index 48e71a6366..2dcd5328b3 100644
--- a/board/chell/board.c
+++ b/board/chell/board.c
@@ -411,7 +411,7 @@ void board_hibernate(void)
/* Make the pmic re-sequence the power rails under these conditions. */
#define PMIC_RESET_FLAGS \
- (RESET_FLAG_WATCHDOG | RESET_FLAG_SOFT | RESET_FLAG_HARD)
+ (EC_RESET_FLAG_WATCHDOG | EC_RESET_FLAG_SOFT | EC_RESET_FLAG_HARD)
static void board_handle_reboot(void)
{
int flags;
@@ -426,8 +426,8 @@ static void board_handle_reboot(void)
return;
/* Preserve AP off request. */
- if (flags & RESET_FLAG_AP_OFF)
- chip_save_reset_flags(RESET_FLAG_AP_OFF);
+ if (flags & EC_RESET_FLAG_AP_OFF)
+ chip_save_reset_flags(EC_RESET_FLAG_AP_OFF);
ccprintf("Restarting system with PMIC.\n");
/* Flush console */
diff --git a/board/cr50/ap_state.c b/board/cr50/ap_state.c
index cf30e4a85c..1224818f5b 100644
--- a/board/cr50/ap_state.c
+++ b/board/cr50/ap_state.c
@@ -4,6 +4,7 @@
*
* AP state machine
*/
+#include "ec_commands.h"
#include "gpio.h"
#include "hooks.h"
#include "registers.h"
@@ -173,7 +174,7 @@ static void init_ap_detect(void)
* complete.
*/
if (board_uses_closed_loop_reset() &&
- !(system_get_reset_flags() & RESET_FLAG_HIBERNATE)) {
+ !(system_get_reset_flags() & EC_RESET_FLAG_HIBERNATE)) {
board_closed_loop_reset();
} else {
/*
diff --git a/board/cr50/board.c b/board/cr50/board.c
index eb7e2cb3d6..9ec4edcbd6 100644
--- a/board/cr50/board.c
+++ b/board/cr50/board.c
@@ -712,7 +712,7 @@ static void board_init(void)
* Deep sleep resets should be considered valid and should not impact
* the rolling reboot count.
*/
- if (system_get_reset_flags() & RESET_FLAG_HIBERNATE)
+ if (system_get_reset_flags() & EC_RESET_FLAG_HIBERNATE)
system_decrement_retry_counter();
configure_board_specific_gpios();
init_pmu();
@@ -728,7 +728,7 @@ static void board_init(void)
* If this was a low power wake and not a rollback, restore the ccd
* state from the long-life register.
*/
- if ((system_get_reset_flags() & RESET_FLAG_HIBERNATE) &&
+ if ((system_get_reset_flags() & EC_RESET_FLAG_HIBERNATE) &&
!system_rollback_detected()) {
ccd_init_state = (GREG32(PMU, LONG_LIFE_SCRATCH1) &
BOARD_CCD_STATE) >> BOARD_CCD_SHIFT;
@@ -1412,7 +1412,7 @@ static void init_board_properties(void)
* update from a version not setting the register.
*/
if (!(properties & BOARD_ALL_PROPERTIES) || (system_get_reset_flags() &
- RESET_FLAG_HARD)) {
+ EC_RESET_FLAG_HARD)) {
/*
* Mask board properties because following hard reset, they
* won't be cleared.
diff --git a/board/cr50/factory_mode.c b/board/cr50/factory_mode.c
index a645fd5aed..520105c241 100644
--- a/board/cr50/factory_mode.c
+++ b/board/cr50/factory_mode.c
@@ -6,6 +6,7 @@
#include "board_id.h"
#include "console.h"
#include "ccd_config.h"
+#include "ec_commands.h"
#include "extension.h"
#include "system.h"
@@ -73,7 +74,7 @@ static int inactive_image_is_guc_image(void)
*/
int board_is_first_factory_boot(void)
{
- return (!(system_get_reset_flags() & RESET_FLAG_HIBERNATE) &&
+ return (!(system_get_reset_flags() & EC_RESET_FLAG_HIBERNATE) &&
inactive_image_is_guc_image() && board_id_is_erased());
}
diff --git a/board/cr50/wp.c b/board/cr50/wp.c
index c90615b349..f14608faa3 100644
--- a/board/cr50/wp.c
+++ b/board/cr50/wp.c
@@ -6,6 +6,7 @@
#include "ccd_config.h"
#include "console.h"
#include "crc8.h"
+#include "ec_commands.h"
#include "extension.h"
#include "flash_log.h"
#include "gpio.h"
@@ -281,7 +282,7 @@ void init_wp_state(void)
set_bp_follow_ccd_config();
/* Check system reset flags after CCD config is initially loaded */
- if ((system_get_reset_flags() & RESET_FLAG_HIBERNATE) &&
+ if ((system_get_reset_flags() & EC_RESET_FLAG_HIBERNATE) &&
!system_rollback_detected()) {
/*
* Deep sleep resume without rollback, so reload the WP state
diff --git a/board/glados/board.c b/board/glados/board.c
index 1b1ac7ebcc..5dabd57c7e 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -401,7 +401,7 @@ void board_hibernate_late(void)
#define BOARD_MIN_ID_LOD_EN 2
/* Make the pmic re-sequence the power rails under these conditions. */
#define PMIC_RESET_FLAGS \
- (RESET_FLAG_WATCHDOG | RESET_FLAG_SOFT | RESET_FLAG_HARD)
+ (EC_RESET_FLAG_WATCHDOG | EC_RESET_FLAG_SOFT | EC_RESET_FLAG_HARD)
static void board_handle_reboot(void)
{
int flags;
@@ -419,8 +419,8 @@ static void board_handle_reboot(void)
return;
/* Preserve AP off request. */
- if (flags & RESET_FLAG_AP_OFF)
- chip_save_reset_flags(RESET_FLAG_AP_OFF);
+ if (flags & EC_RESET_FLAG_AP_OFF)
+ chip_save_reset_flags(EC_RESET_FLAG_AP_OFF);
ccprintf("Restarting system with PMIC.\n");
/* Flush console */
diff --git a/board/jacuzzi/board.c b/board/jacuzzi/board.c
index 0e8200754e..6d6f722168 100644
--- a/board/jacuzzi/board.c
+++ b/board/jacuzzi/board.c
@@ -219,7 +219,7 @@ int pd_snk_is_vbus_provided(int port)
static void board_init(void)
{
/* If the reset cause is external, pulse PMIC force reset. */
- if (system_get_reset_flags() == RESET_FLAG_RESET_PIN) {
+ if (system_get_reset_flags() == EC_RESET_FLAG_RESET_PIN) {
gpio_set_level(GPIO_PMIC_FORCE_RESET_ODL, 0);
msleep(100);
gpio_set_level(GPIO_PMIC_FORCE_RESET_ODL, 1);
diff --git a/board/kodama/board.c b/board/kodama/board.c
index 54a2ffd9a9..1e778410cb 100644
--- a/board/kodama/board.c
+++ b/board/kodama/board.c
@@ -196,7 +196,7 @@ int pd_snk_is_vbus_provided(int port)
static void board_init(void)
{
/* If the reset cause is external, pulse PMIC force reset. */
- if (system_get_reset_flags() == RESET_FLAG_RESET_PIN) {
+ if (system_get_reset_flags() == EC_RESET_FLAG_RESET_PIN) {
gpio_set_level(GPIO_PMIC_FORCE_RESET_ODL, 0);
msleep(100);
gpio_set_level(GPIO_PMIC_FORCE_RESET_ODL, 1);
diff --git a/board/kukui/board.c b/board/kukui/board.c
index 8f54d78f3b..3eb28bb4c7 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -226,7 +226,7 @@ void pogo_adc_interrupt(enum gpio_signal signal)
static void board_init(void)
{
/* If the reset cause is external, pulse PMIC force reset. */
- if (system_get_reset_flags() == RESET_FLAG_RESET_PIN) {
+ if (system_get_reset_flags() == EC_RESET_FLAG_RESET_PIN) {
gpio_set_level(GPIO_PMIC_FORCE_RESET_ODL, 0);
msleep(100);
gpio_set_level(GPIO_PMIC_FORCE_RESET_ODL, 1);
diff --git a/board/mchpevb1/board.c b/board/mchpevb1/board.c
index 9056f904dd..169a059a15 100644
--- a/board/mchpevb1/board.c
+++ b/board/mchpevb1/board.c
@@ -769,7 +769,7 @@ void board_hibernate_late(void)
#define BOARD_MIN_ID_LOD_EN 2
/* Make the pmic re-sequence the power rails under these conditions. */
#define PMIC_RESET_FLAGS \
- (RESET_FLAG_WATCHDOG | RESET_FLAG_SOFT | RESET_FLAG_HARD)
+ (EC_RESET_FLAG_WATCHDOG | EC_RESET_FLAG_SOFT | EC_RESET_FLAG_HARD)
static void board_handle_reboot(void)
{
#if 0 /* MEC17xx EVB + SKL-RVP3 does not use chromebook PMIC design */
@@ -792,8 +792,8 @@ static void board_handle_reboot(void)
return;
/* Preserve AP off request. */
- if (flags & RESET_FLAG_AP_OFF)
- chip_save_reset_flags(RESET_FLAG_AP_OFF);
+ if (flags & EC_RESET_FLAG_AP_OFF)
+ chip_save_reset_flags(EC_RESET_FLAG_AP_OFF);
ccprintf("Restarting system with PMIC.\n");
/* Flush console */
diff --git a/board/plankton/board.c b/board/plankton/board.c
index dbb3ff62b2..3f8e718f0e 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -741,7 +741,7 @@ static void board_init(void)
sn75dp130_redriver_init();
/* Initialize USB hub */
- if (system_get_reset_flags() & RESET_FLAG_POWER_ON)
+ if (system_get_reset_flags() & EC_RESET_FLAG_POWER_ON)
hook_call_deferred(&board_usb_hub_reset_no_return_data,
500 * MSEC);
diff --git a/chip/g/rbox.c b/chip/g/rbox.c
index 6399f0b612..6aaa0206eb 100644
--- a/chip/g/rbox.c
+++ b/chip/g/rbox.c
@@ -4,6 +4,7 @@
*/
#include "clock.h"
+#include "ec_commands.h"
#include "hooks.h"
#include "rdd.h"
#include "registers.h"
@@ -68,7 +69,7 @@ static void rbox_release_ec_reset(void)
*
* Release PINMUX HOLD, so the board can detect changes on TPM_RST_L.
*/
- if (!(system_get_reset_flags() & RESET_FLAG_HIBERNATE) &&
+ if (!(system_get_reset_flags() & EC_RESET_FLAG_HIBERNATE) &&
board_uses_closed_loop_reset()) {
return;
}
@@ -77,7 +78,7 @@ static void rbox_release_ec_reset(void)
* After a POR, if the power button is held, then delay releasing
* EC_RST_L.
*/
- if ((system_get_reset_flags() & RESET_FLAG_POWER_ON) &&
+ if ((system_get_reset_flags() & EC_RESET_FLAG_POWER_ON) &&
rbox_powerbtn_is_pressed()) {
hook_call_deferred(&rbox_check_rdd_data, RDD_WAIT_TIME);
return;
diff --git a/chip/g/system.c b/chip/g/system.c
index d15ec42ebe..c2ee5bdabb 100644
--- a/chip/g/system.c
+++ b/chip/g/system.c
@@ -40,7 +40,7 @@ static void check_reset_cause(void)
if (g_rstsrc & GC_PMU_RSTSRC_POR_MASK) {
/* If power-on reset is true, that's the only thing */
- system_set_reset_flags(RESET_FLAG_POWER_ON);
+ system_set_reset_flags(EC_RESET_FLAG_POWER_ON);
return;
}
@@ -49,39 +49,39 @@ static void check_reset_cause(void)
/* This register is cleared by reading it */
uint32_t g_exitpd = GR_PMU_EXITPD_SRC;
- flags |= RESET_FLAG_HIBERNATE;
+ flags |= EC_RESET_FLAG_HIBERNATE;
if (g_exitpd & GC_PMU_EXITPD_SRC_PIN_PD_EXIT_MASK)
- flags |= RESET_FLAG_WAKE_PIN;
+ flags |= EC_RESET_FLAG_WAKE_PIN;
if (g_exitpd & GC_PMU_EXITPD_SRC_UTMI_SUSPEND_N_MASK)
- flags |= RESET_FLAG_USB_RESUME;
+ flags |= EC_RESET_FLAG_USB_RESUME;
if (g_exitpd & (GC_PMU_EXITPD_SRC_TIMELS0_PD_EXIT_TIMER0_MASK |
GC_PMU_EXITPD_SRC_TIMELS0_PD_EXIT_TIMER1_MASK))
- flags |= RESET_FLAG_RTC_ALARM;
+ flags |= EC_RESET_FLAG_RTC_ALARM;
if (g_exitpd & GC_PMU_EXITPD_SRC_RDD0_PD_EXIT_TIMER_MASK)
- flags |= RESET_FLAG_RDD;
+ flags |= EC_RESET_FLAG_RDD;
if (g_exitpd & GC_PMU_EXITPD_SRC_RBOX_WAKEUP_MASK)
- flags |= RESET_FLAG_RBOX;
+ flags |= EC_RESET_FLAG_RBOX;
}
if (g_rstsrc & GC_PMU_RSTSRC_SOFTWARE_MASK)
- flags |= RESET_FLAG_HARD;
+ flags |= EC_RESET_FLAG_HARD;
if (g_rstsrc & GC_PMU_RSTSRC_SYSRESET_MASK)
- flags |= RESET_FLAG_SOFT;
+ flags |= EC_RESET_FLAG_SOFT;
if (g_rstsrc & GC_PMU_RSTSRC_FST_BRNOUT_MASK)
- flags |= RESET_FLAG_BROWNOUT;
+ flags |= EC_RESET_FLAG_BROWNOUT;
/*
* GC_PMU_RSTSRC_WDOG and GC_PMU_RSTSRC_LOCKUP are considered security
* threats. They won't show up as a direct reset cause.
*/
if (g_rstsrc & GC_PMU_RSTSRC_SEC_THREAT_MASK)
- flags |= RESET_FLAG_SECURITY;
+ flags |= EC_RESET_FLAG_SECURITY;
if (g_rstsrc && !flags)
- flags |= RESET_FLAG_OTHER;
+ flags |= EC_RESET_FLAG_OTHER;
system_set_reset_flags(flags);
}
diff --git a/chip/g/upgrade_fw.c b/chip/g/upgrade_fw.c
index 71a9d36403..276eac8f92 100644
--- a/chip/g/upgrade_fw.c
+++ b/chip/g/upgrade_fw.c
@@ -330,7 +330,7 @@ static int chunk_came_too_soon(uint32_t block_offset)
}
if (!prev_timestamp) {
- int hard_reset = system_get_reset_flags() & RESET_FLAG_HARD;
+ int hard_reset = system_get_reset_flags() & EC_RESET_FLAG_HARD;
/*
* If we just recovered from a hard reset, we have to wait until
diff --git a/chip/g/usb.c b/chip/g/usb.c
index 72fbe75ea8..9a605b65dc 100644
--- a/chip/g/usb.c
+++ b/chip/g/usb.c
@@ -1296,7 +1296,7 @@ void usb_init(void)
* for some other reason, we just do a normal USB reset. The host
* doesn't mind.
*/
- resume = ((system_get_reset_flags() & RESET_FLAG_USB_RESUME) &&
+ resume = ((system_get_reset_flags() & EC_RESET_FLAG_USB_RESUME) &&
(GR_USB_GINTSTS & GC_USB_GINTSTS_WKUPINT_MASK));
/* TODO(crosbug.com/p/46813): Clean this up. Do only what's needed, and
diff --git a/chip/g/watchdog.c b/chip/g/watchdog.c
index 1ffd203843..c5560fc0d7 100644
--- a/chip/g/watchdog.c
+++ b/chip/g/watchdog.c
@@ -6,6 +6,7 @@
/* Watchdog driver */
#include "common.h"
+#include "ec_commands.h"
#include "hooks.h"
#include "registers.h"
#include "task.h"
@@ -22,7 +23,7 @@
void __attribute__((used)) trace_and_reset(uint32_t excep_lr, uint32_t excep_sp)
{
watchdog_trace(excep_lr, excep_sp);
- system_reset(RESET_FLAG_WATCHDOG);
+ system_reset(EC_RESET_FLAG_WATCHDOG);
}
/* Warning interrupt at the middle of the watchdog period */
diff --git a/chip/host/system.c b/chip/host/system.c
index 86e6625964..b1654911ab 100644
--- a/chip/host/system.c
+++ b/chip/host/system.c
@@ -6,6 +6,7 @@
/* System module for emulator */
#include "common.h"
+#include "ec_commands.h"
#include "host_test.h"
#include "panic.h"
#include "persistence.h"
@@ -100,7 +101,7 @@ static uint32_t load_reset_flags(void)
uint32_t ret;
if (f == NULL)
- return RESET_FLAG_POWER_ON;
+ return EC_RESET_FLAG_POWER_ON;
fread(&ret, sizeof(ret), 1, f);
release_persistent_storage(f);
remove_persistent_storage("reset_flags");
@@ -141,11 +142,11 @@ test_mockable void system_reset(int flags)
{
uint32_t save_flags = 0;
if (flags & SYSTEM_RESET_PRESERVE_FLAGS)
- save_flags = system_get_reset_flags() | RESET_FLAG_PRESERVED;
+ save_flags = system_get_reset_flags() | EC_RESET_FLAG_PRESERVED;
if (flags & SYSTEM_RESET_LEAVE_AP_OFF)
- save_flags |= RESET_FLAG_AP_OFF;
+ save_flags |= EC_RESET_FLAG_AP_OFF;
if (flags & SYSTEM_RESET_HARD)
- save_flags |= RESET_FLAG_HARD;
+ save_flags |= EC_RESET_FLAG_HARD;
if (save_flags)
save_reset_flags(save_flags);
emulator_reboot();
@@ -158,7 +159,7 @@ test_mockable void system_hibernate(uint32_t seconds, uint32_t microseconds)
if (board_hibernate)
board_hibernate();
- save_reset_flags(RESET_FLAG_HIBERNATE);
+ save_reset_flags(EC_RESET_FLAG_HIBERNATE);
if (!seconds && !microseconds)
exit(EXIT_CODE_HIBERNATE);
diff --git a/chip/ish/ish_persistent_data.c b/chip/ish/ish_persistent_data.c
index c5168475d5..003f781d5f 100644
--- a/chip/ish/ish_persistent_data.c
+++ b/chip/ish/ish_persistent_data.c
@@ -4,6 +4,7 @@
*/
#include "common.h"
+#include "ec_commands.h"
#include "config.h"
#include "hooks.h"
#include "system.h"
@@ -13,7 +14,7 @@
struct ish_persistent_data ish_persistent_data = {
.magic = PERSISTENT_DATA_MAGIC,
- .reset_flags = RESET_FLAG_POWER_ON,
+ .reset_flags = EC_RESET_FLAG_POWER_ON,
.watchdog_counter = 0,
.panic_data = {0},
};
diff --git a/chip/ish/system.c b/chip/ish/system.c
index c18261e0da..2d4a55bd3b 100644
--- a/chip/ish/system.c
+++ b/chip/ish/system.c
@@ -29,7 +29,7 @@
int system_is_reboot_warm(void)
{
return !(system_get_reset_flags() &
- (RESET_FLAG_POWER_ON | RESET_FLAG_HARD));
+ (EC_RESET_FLAG_POWER_ON | EC_RESET_FLAG_HARD));
}
void system_pre_init(void)
@@ -87,7 +87,7 @@ void system_reset(int flags)
system_encode_save_flags(flags, &save_flags);
if (flags & SYSTEM_RESET_AP_WATCHDOG) {
- save_flags |= RESET_FLAG_WATCHDOG;
+ save_flags |= EC_RESET_FLAG_WATCHDOG;
ish_persistent_data.watchdog_counter += 1;
if (ish_persistent_data.watchdog_counter
>= CONFIG_WATCHDOG_MAX_RETRIES) {
diff --git a/chip/ish/watchdog.c b/chip/ish/watchdog.c
index 2e83b57f25..bf78f49312 100644
--- a/chip/ish/watchdog.c
+++ b/chip/ish/watchdog.c
@@ -20,6 +20,7 @@
*/
#include "common.h"
+#include "ec_commands.h"
#include "hooks.h"
#include "ish_persistent_data.h"
#include "task.h"
@@ -37,7 +38,7 @@ int watchdog_init(void)
* Put reset counter back at zero if last reset was not caused
* by watchdog
*/
- if ((system_get_reset_flags() & RESET_FLAG_WATCHDOG) == 0)
+ if ((system_get_reset_flags() & EC_RESET_FLAG_WATCHDOG) == 0)
ish_persistent_data.watchdog_counter = 0;
/* Initialize WDT clock divider */
diff --git a/chip/it83xx/flash.c b/chip/it83xx/flash.c
index cae6eced7c..ec416ee41a 100644
--- a/chip/it83xx/flash.c
+++ b/chip/it83xx/flash.c
@@ -621,7 +621,7 @@ int flash_pre_init(void)
* If we have already jumped between images, an earlier image could
* have applied write protection. Nothing additional needs to be done.
*/
- if (reset_flags & RESET_FLAG_SYSJUMP)
+ if (reset_flags & EC_RESET_FLAG_SYSJUMP)
return EC_SUCCESS;
if (prot_flags & EC_FLASH_PROTECT_GPIO_ASSERTED) {
@@ -661,7 +661,7 @@ int flash_pre_init(void)
* write-protect. If it didn't, then the flash write protect registers
* have been permanently committed and we can't fix that.
*/
- if (reset_flags & RESET_FLAG_POWER_ON) {
+ if (reset_flags & EC_RESET_FLAG_POWER_ON) {
stuck_locked = 1;
return EC_ERROR_ACCESS_DENIED;
} else {
diff --git a/chip/it83xx/system.c b/chip/it83xx/system.c
index c5affcff59..667b8130cd 100644
--- a/chip/it83xx/system.c
+++ b/chip/it83xx/system.c
@@ -56,20 +56,20 @@ static void check_reset_cause(void)
/* Determine if watchdog reset or power on reset. */
if (raw_reset_cause & 0x02) {
- flags |= RESET_FLAG_WATCHDOG;
+ flags |= EC_RESET_FLAG_WATCHDOG;
} else if (raw_reset_cause & 0x01) {
- flags |= RESET_FLAG_POWER_ON;
+ flags |= EC_RESET_FLAG_POWER_ON;
} else {
if ((IT83XX_GCTRL_RSTS & 0xC0) == 0x80)
- flags |= RESET_FLAG_POWER_ON;
+ flags |= EC_RESET_FLAG_POWER_ON;
}
if (raw_reset_cause2 & 0x04)
- flags |= RESET_FLAG_RESET_PIN;
+ flags |= EC_RESET_FLAG_RESET_PIN;
/* watchdog module triggers these reset */
- if (flags & (RESET_FLAG_HARD | RESET_FLAG_SOFT))
- flags &= ~RESET_FLAG_WATCHDOG;
+ if (flags & (EC_RESET_FLAG_HARD | EC_RESET_FLAG_SOFT))
+ flags &= ~EC_RESET_FLAG_WATCHDOG;
/* Clear saved reset flags. */
BRAM_RESET_FLAGS0 = 0;
@@ -104,12 +104,12 @@ int system_is_reboot_warm(void)
check_reset_cause();
reset_flags = system_get_reset_flags();
- if ((reset_flags & RESET_FLAG_RESET_PIN) ||
- (reset_flags & RESET_FLAG_POWER_ON) ||
- (reset_flags & RESET_FLAG_WATCHDOG) ||
- (reset_flags & RESET_FLAG_HARD) ||
- (reset_flags & RESET_FLAG_SOFT) ||
- (reset_flags & RESET_FLAG_HIBERNATE))
+ if ((reset_flags & EC_RESET_FLAG_RESET_PIN) ||
+ (reset_flags & EC_RESET_FLAG_POWER_ON) ||
+ (reset_flags & EC_RESET_FLAG_WATCHDOG) ||
+ (reset_flags & EC_RESET_FLAG_HARD) ||
+ (reset_flags & EC_RESET_FLAG_SOFT) ||
+ (reset_flags & EC_RESET_FLAG_HIBERNATE))
return 0;
else
return 1;
@@ -165,7 +165,7 @@ void system_reset(int flags)
system_encode_save_flags(flags, &save_flags);
if (clock_ec_wake_from_sleep())
- save_flags |= RESET_FLAG_HIBERNATE;
+ save_flags |= EC_RESET_FLAG_HIBERNATE;
/* Store flags to battery backed RAM. */
BRAM_RESET_FLAGS0 = save_flags >> 24;
diff --git a/chip/lm4/flash.c b/chip/lm4/flash.c
index 2a7996aee9..4f7e905e21 100644
--- a/chip/lm4/flash.c
+++ b/chip/lm4/flash.c
@@ -243,7 +243,7 @@ int flash_pre_init(void)
* If we have already jumped between images, an earlier image could
* have applied write protection. Nothing additional needs to be done.
*/
- if (reset_flags & RESET_FLAG_SYSJUMP)
+ if (reset_flags & EC_RESET_FLAG_SYSJUMP)
return EC_SUCCESS;
if (prot_flags & EC_FLASH_PROTECT_GPIO_ASSERTED) {
@@ -280,7 +280,7 @@ int flash_pre_init(void)
* write-protect. If it didn't, then the flash write protect registers
* have been permanently committed and we can't fix that.
*/
- if (reset_flags & RESET_FLAG_POWER_ON) {
+ if (reset_flags & EC_RESET_FLAG_POWER_ON) {
stuck_locked = 1;
return EC_ERROR_ACCESS_DENIED;
}
diff --git a/chip/lm4/system.c b/chip/lm4/system.c
index 5797e91da4..cf7705ff06 100644
--- a/chip/lm4/system.c
+++ b/chip/lm4/system.c
@@ -123,7 +123,7 @@ static void check_reset_cause(void)
* Note that this is also triggered by hibernation, because
* that de-powers the chip.
*/
- flags |= RESET_FLAG_POWER_ON;
+ flags |= EC_RESET_FLAG_POWER_ON;
} else if (!flags && (raw_reset_cause & 0x01)) {
/*
* LM4 signals the reset pin in RESC for all power-on resets,
@@ -131,42 +131,42 @@ static void check_reset_cause(void)
* this flag mutually-exclusive with power on flag, so we can
* use it to indicate a keyboard-triggered reset.
*/
- flags |= RESET_FLAG_RESET_PIN;
+ flags |= EC_RESET_FLAG_RESET_PIN;
}
if (raw_reset_cause & 0x04)
- flags |= RESET_FLAG_BROWNOUT;
+ flags |= EC_RESET_FLAG_BROWNOUT;
if (raw_reset_cause & 0x10)
- flags |= RESET_FLAG_SOFT;
+ flags |= EC_RESET_FLAG_SOFT;
if (raw_reset_cause & 0x28) {
/* Watchdog timer 0 or 1 */
- flags |= RESET_FLAG_WATCHDOG;
+ flags |= EC_RESET_FLAG_WATCHDOG;
}
/* Handle other raw reset causes */
if (raw_reset_cause && !flags)
- flags |= RESET_FLAG_OTHER;
+ flags |= EC_RESET_FLAG_OTHER;
if ((hib_status & 0x09) &&
(hib_wake_flags & HIBDATA_WAKE_HARD_RESET)) {
/* Hibernation caused by software-triggered hard reset */
- flags |= RESET_FLAG_HARD;
+ flags |= EC_RESET_FLAG_HARD;
/* Consume the hibernate reasons so we don't see them below */
hib_status &= ~0x09;
}
if ((hib_status & 0x01) && (hib_wake_flags & HIBDATA_WAKE_RTC))
- flags |= RESET_FLAG_RTC_ALARM;
+ flags |= EC_RESET_FLAG_RTC_ALARM;
if ((hib_status & 0x08) && (hib_wake_flags & HIBDATA_WAKE_PIN))
- flags |= RESET_FLAG_WAKE_PIN;
+ flags |= EC_RESET_FLAG_WAKE_PIN;
if (hib_status & 0x04)
- flags |= RESET_FLAG_LOW_BATTERY;
+ flags |= EC_RESET_FLAG_LOW_BATTERY;
/* Restore then clear saved reset flags */
flags |= hibdata_read(HIBDATA_INDEX_SAVED_RESET_FLAGS);
@@ -524,10 +524,10 @@ void system_reset(int flags)
/* Save current reset reasons if necessary */
if (flags & SYSTEM_RESET_PRESERVE_FLAGS)
- save_flags = system_get_reset_flags() | RESET_FLAG_PRESERVED;
+ save_flags = system_get_reset_flags() | EC_RESET_FLAG_PRESERVED;
if (flags & SYSTEM_RESET_LEAVE_AP_OFF)
- save_flags |= RESET_FLAG_AP_OFF;
+ save_flags |= EC_RESET_FLAG_AP_OFF;
hibdata_write(HIBDATA_INDEX_SAVED_RESET_FLAGS, save_flags);
diff --git a/chip/mchp/flash.c b/chip/mchp/flash.c
index ca198476b8..043e2b268f 100644
--- a/chip/mchp/flash.c
+++ b/chip/mchp/flash.c
@@ -251,7 +251,7 @@ int flash_physical_restore_state(void)
* could have applied write protection. Nothing additional needs
* to be done.
*/
- if (reset_flags & RESET_FLAG_SYSJUMP) {
+ if (reset_flags & EC_RESET_FLAG_SYSJUMP) {
prev = (const struct flash_wp_state *)system_get_jump_tag(
FLASH_SYSJUMP_TAG, &version, &size);
if (prev && version == FLASH_HOOK_VERSION &&
diff --git a/chip/mchp/system.c b/chip/mchp/system.c
index 3117638bd5..b481f2ba26 100644
--- a/chip/mchp/system.c
+++ b/chip/mchp/system.c
@@ -60,16 +60,16 @@ static void check_reset_cause(void)
* BIT[6] determine VTR reset
*/
if (rst_sts & MCHP_PWR_RST_STS_VTR)
- flags |= RESET_FLAG_RESET_PIN;
+ flags |= EC_RESET_FLAG_RESET_PIN;
flags |= MCHP_VBAT_RAM(HIBDATA_INDEX_SAVED_RESET_FLAGS);
MCHP_VBAT_RAM(HIBDATA_INDEX_SAVED_RESET_FLAGS) = 0;
- if ((status & MCHP_VBAT_STS_WDT) && !(flags & (RESET_FLAG_SOFT |
- RESET_FLAG_HARD |
- RESET_FLAG_HIBERNATE)))
- flags |= RESET_FLAG_WATCHDOG;
+ if ((status & MCHP_VBAT_STS_WDT) && !(flags & (EC_RESET_FLAG_SOFT |
+ EC_RESET_FLAG_HARD |
+ EC_RESET_FLAG_HIBERNATE)))
+ flags |= EC_RESET_FLAG_WATCHDOG;
trace11(0, MEC, 0, "check_reset_cause: EC reset flags = 0x%08x", flags);
@@ -86,11 +86,11 @@ int system_is_reboot_warm(void)
check_reset_cause();
reset_flags = system_get_reset_flags();
- if ((reset_flags & RESET_FLAG_RESET_PIN) ||
- (reset_flags & RESET_FLAG_POWER_ON) ||
- (reset_flags & RESET_FLAG_WATCHDOG) ||
- (reset_flags & RESET_FLAG_HARD) ||
- (reset_flags & RESET_FLAG_SOFT))
+ if ((reset_flags & EC_RESET_FLAG_RESET_PIN) ||
+ (reset_flags & EC_RESET_FLAG_POWER_ON) ||
+ (reset_flags & EC_RESET_FLAG_WATCHDOG) ||
+ (reset_flags & EC_RESET_FLAG_HARD) ||
+ (reset_flags & EC_RESET_FLAG_SOFT))
return 0;
else
return 1;
@@ -218,17 +218,17 @@ void __attribute__((noreturn)) _system_reset(int flags,
/* Save current reset reasons if necessary */
if (flags & SYSTEM_RESET_PRESERVE_FLAGS)
- save_flags = system_get_reset_flags() | RESET_FLAG_PRESERVED;
+ save_flags = system_get_reset_flags() | EC_RESET_FLAG_PRESERVED;
if (flags & SYSTEM_RESET_LEAVE_AP_OFF)
- save_flags |= RESET_FLAG_AP_OFF;
+ save_flags |= EC_RESET_FLAG_AP_OFF;
if (wake_from_hibernate)
- save_flags |= RESET_FLAG_HIBERNATE;
+ save_flags |= EC_RESET_FLAG_HIBERNATE;
else if (flags & SYSTEM_RESET_HARD)
- save_flags |= RESET_FLAG_HARD;
+ save_flags |= EC_RESET_FLAG_HARD;
else
- save_flags |= RESET_FLAG_SOFT;
+ save_flags |= EC_RESET_FLAG_SOFT;
chip_save_reset_flags(save_flags);
diff --git a/chip/mec1322/flash.c b/chip/mec1322/flash.c
index 2cd8dd156d..b6ab76113b 100644
--- a/chip/mec1322/flash.c
+++ b/chip/mec1322/flash.c
@@ -241,7 +241,7 @@ int flash_physical_restore_state(void)
* If we have already jumped between images, an earlier image could
* have applied write protection. Nothing additional needs to be done.
*/
- if (reset_flags & RESET_FLAG_SYSJUMP) {
+ if (reset_flags & EC_RESET_FLAG_SYSJUMP) {
prev = (const struct flash_wp_state *)system_get_jump_tag(
FLASH_SYSJUMP_TAG, &version, &size);
if (prev && version == FLASH_HOOK_VERSION &&
diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c
index 13bb83920b..e50d97bc6d 100644
--- a/chip/mec1322/system.c
+++ b/chip/mec1322/system.c
@@ -44,16 +44,16 @@ static void check_reset_cause(void)
* BIT[6] determine VCC1 reset
*/
if (rst_sts & MEC1322_PWR_RST_STS_VCC1)
- flags |= RESET_FLAG_RESET_PIN;
+ flags |= EC_RESET_FLAG_RESET_PIN;
flags |= MEC1322_VBAT_RAM(HIBDATA_INDEX_SAVED_RESET_FLAGS);
MEC1322_VBAT_RAM(HIBDATA_INDEX_SAVED_RESET_FLAGS) = 0;
- if ((status & MEC1322_VBAT_STS_WDT) && !(flags & (RESET_FLAG_SOFT |
- RESET_FLAG_HARD |
- RESET_FLAG_HIBERNATE)))
- flags |= RESET_FLAG_WATCHDOG;
+ if ((status & MEC1322_VBAT_STS_WDT) && !(flags & (EC_RESET_FLAG_SOFT |
+ EC_RESET_FLAG_HARD |
+ EC_RESET_FLAG_HIBERNATE)))
+ flags |= EC_RESET_FLAG_WATCHDOG;
system_set_reset_flags(flags);
}
@@ -68,12 +68,12 @@ int system_is_reboot_warm(void)
check_reset_cause();
reset_flags = system_get_reset_flags();
- if ((reset_flags & RESET_FLAG_RESET_PIN) ||
- (reset_flags & RESET_FLAG_POWER_ON) ||
- (reset_flags & RESET_FLAG_WATCHDOG) ||
- (reset_flags & RESET_FLAG_HARD) ||
- (reset_flags & RESET_FLAG_SOFT) ||
- (reset_flags & RESET_FLAG_HIBERNATE))
+ if ((reset_flags & EC_RESET_FLAG_RESET_PIN) ||
+ (reset_flags & EC_RESET_FLAG_POWER_ON) ||
+ (reset_flags & EC_RESET_FLAG_WATCHDOG) ||
+ (reset_flags & EC_RESET_FLAG_HARD) ||
+ (reset_flags & EC_RESET_FLAG_SOFT) ||
+ (reset_flags & EC_RESET_FLAG_HIBERNATE))
return 0;
else
return 1;
@@ -113,17 +113,17 @@ void _system_reset(int flags, int wake_from_hibernate)
/* Save current reset reasons if necessary */
if (flags & SYSTEM_RESET_PRESERVE_FLAGS)
- save_flags = system_get_reset_flags() | RESET_FLAG_PRESERVED;
+ save_flags = system_get_reset_flags() | EC_RESET_FLAG_PRESERVED;
if (flags & SYSTEM_RESET_LEAVE_AP_OFF)
- save_flags |= RESET_FLAG_AP_OFF;
+ save_flags |= EC_RESET_FLAG_AP_OFF;
if (wake_from_hibernate)
- save_flags |= RESET_FLAG_HIBERNATE;
+ save_flags |= EC_RESET_FLAG_HIBERNATE;
else if (flags & SYSTEM_RESET_HARD)
- save_flags |= RESET_FLAG_HARD;
+ save_flags |= EC_RESET_FLAG_HARD;
else
- save_flags |= RESET_FLAG_SOFT;
+ save_flags |= EC_RESET_FLAG_SOFT;
chip_save_reset_flags(save_flags);
diff --git a/chip/mt_scp/system.c b/chip/mt_scp/system.c
index eaf37e5626..6bd2e76644 100644
--- a/chip/mt_scp/system.c
+++ b/chip/mt_scp/system.c
@@ -96,14 +96,14 @@ void system_reset(int flags)
/* Save current reset reasons if necessary */
if (flags & SYSTEM_RESET_PRESERVE_FLAGS)
- save_flags = system_get_reset_flags() | RESET_FLAG_PRESERVED;
+ save_flags = system_get_reset_flags() | EC_RESET_FLAG_PRESERVED;
if (flags & SYSTEM_RESET_LEAVE_AP_OFF)
- save_flags |= RESET_FLAG_AP_OFF;
+ save_flags |= EC_RESET_FLAG_AP_OFF;
/* Remember that the software asked us to hard reboot */
if (flags & SYSTEM_RESET_HARD)
- save_flags |= RESET_FLAG_HARD;
+ save_flags |= EC_RESET_FLAG_HARD;
/* Reset flags are 32-bits, but save only 16 bits. */
ASSERT(!(save_flags >> 16));
@@ -141,14 +141,14 @@ static void check_reset_cause(void)
if ((raw_reset_cause & 0xffff0000) == PWRON_DEFAULT) {
/* Reboot */
if (raw_reset_cause & PWRON_WATCHDOG)
- flags |= RESET_FLAG_WATCHDOG;
+ flags |= EC_RESET_FLAG_WATCHDOG;
else if (raw_reset_cause & PWRON_RESET)
- flags |= RESET_FLAG_POWER_ON;
+ flags |= EC_RESET_FLAG_POWER_ON;
else
- flags |= RESET_FLAG_OTHER;
+ flags |= EC_RESET_FLAG_OTHER;
} else {
/* Power lost restart */
- flags |= RESET_FLAG_POWER_ON;
+ flags |= EC_RESET_FLAG_POWER_ON;
}
system_set_reset_flags(SCP_GPR[0] >> 16);
SCP_GPR[0] &= 0xffff;
@@ -157,12 +157,12 @@ static void check_reset_cause(void)
int system_is_reboot_warm(void)
{
const uint32_t cold_flags =
- RESET_FLAG_RESET_PIN |
- RESET_FLAG_POWER_ON |
- RESET_FLAG_WATCHDOG |
- RESET_FLAG_HARD |
- RESET_FLAG_SOFT |
- RESET_FLAG_HIBERNATE;
+ EC_RESET_FLAG_RESET_PIN |
+ EC_RESET_FLAG_POWER_ON |
+ EC_RESET_FLAG_WATCHDOG |
+ EC_RESET_FLAG_HARD |
+ EC_RESET_FLAG_SOFT |
+ EC_RESET_FLAG_HIBERNATE;
check_reset_cause();
diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c
index 759d6fbbd8..397d87b501 100644
--- a/chip/npcx/gpio.c
+++ b/chip/npcx/gpio.c
@@ -511,7 +511,7 @@ void gpio_pre_init(void)
*
* Make sure to set up the timer before using udelay().
*/
- if (system_get_reset_flags() & RESET_FLAG_POWER_ON) {
+ if (system_get_reset_flags() & EC_RESET_FLAG_POWER_ON) {
__hw_early_init_hwtimer(0);
udelay(CONFIG_GPIO_INIT_POWER_ON_DELAY_MS * MSEC);
}
diff --git a/chip/npcx/system-npcx7.c b/chip/npcx/system-npcx7.c
index 6b0e5157ea..9e461c5a1b 100644
--- a/chip/npcx/system-npcx7.c
+++ b/chip/npcx/system-npcx7.c
@@ -7,6 +7,7 @@
#include "common.h"
#include "console.h"
#include "cpu.h"
+#include "ec_commands.h"
#include "hooks.h"
#include "registers.h"
#include "system.h"
@@ -165,7 +166,7 @@ void __hibernate_npcx_series(void)
#if defined(CONFIG_HIBERNATE_PSL)
static void report_psl_wake_source(void)
{
- if (!(system_get_reset_flags() & RESET_FLAG_HIBERNATE))
+ if (!(system_get_reset_flags() & EC_RESET_FLAG_HIBERNATE))
return;
CPRINTS("PSL_CTS: 0x%x", NPCX_GLUE_PSL_CTS & 0xf);
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index 5bf768dbc6..ff18334533 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -338,9 +338,9 @@ uint32_t chip_read_reset_flags(void)
static void board_chipset_startup(void)
{
uint32_t flags = bbram_data_read(BBRM_DATA_INDEX_SAVED_RESET_FLAGS);
- flags &= ~RESET_FLAG_AP_OFF;
+ flags &= ~EC_RESET_FLAG_AP_OFF;
chip_save_reset_flags(flags);
- system_clear_reset_flags(RESET_FLAG_AP_OFF);
+ system_clear_reset_flags(EC_RESET_FLAG_AP_OFF);
CPRINTS("Cleared AP_OFF flag");
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
@@ -348,9 +348,9 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
static void board_chipset_shutdown(void)
{
uint32_t flags = bbram_data_read(BBRM_DATA_INDEX_SAVED_RESET_FLAGS);
- flags |= RESET_FLAG_AP_OFF;
+ flags |= EC_RESET_FLAG_AP_OFF;
chip_save_reset_flags(flags);
- system_set_reset_flags(RESET_FLAG_AP_OFF);
+ system_set_reset_flags(EC_RESET_FLAG_AP_OFF);
CPRINTS("Set AP_OFF flag");
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown,
@@ -367,7 +367,7 @@ static void check_reset_cause(void)
/* Clear saved reset flags in bbram */
#ifdef CONFIG_POWER_BUTTON_INIT_IDLE
/* We'll clear AP_OFF on S5->S3 transition */
- chip_save_reset_flags(flags & RESET_FLAG_AP_OFF);
+ chip_save_reset_flags(flags & EC_RESET_FLAG_AP_OFF);
#else
chip_save_reset_flags(0);
#endif
@@ -378,13 +378,13 @@ static void check_reset_cause(void)
if (!IS_BIT_SET(NPCX_RSTCTL, NPCX_RSTCTL_VCC1_RST_SCRATCH)) {
#ifdef CONFIG_BOARD_FORCE_RESET_PIN
/* Treat all resets as RESET_PIN */
- flags |= RESET_FLAG_RESET_PIN;
+ flags |= EC_RESET_FLAG_RESET_PIN;
#else
/* Check for VCC1 reset */
if (IS_BIT_SET(NPCX_RSTCTL, NPCX_RSTCTL_VCC1_RST_STS))
- flags |= RESET_FLAG_RESET_PIN;
+ flags |= EC_RESET_FLAG_RESET_PIN;
else
- flags |= RESET_FLAG_POWER_ON;
+ flags |= EC_RESET_FLAG_POWER_ON;
#endif
}
@@ -397,27 +397,27 @@ static void check_reset_cause(void)
/* Software debugger reset */
if (IS_BIT_SET(NPCX_RSTCTL, NPCX_RSTCTL_DBGRST_STS)) {
- flags |= RESET_FLAG_SOFT;
+ flags |= EC_RESET_FLAG_SOFT;
/* Clear debugger reset status initially*/
SET_BIT(NPCX_RSTCTL, NPCX_RSTCTL_DBGRST_STS);
}
/* Reset by hibernate */
if (hib_wake_flags & HIBERNATE_WAKE_PIN)
- flags |= RESET_FLAG_WAKE_PIN | RESET_FLAG_HIBERNATE;
+ flags |= EC_RESET_FLAG_WAKE_PIN | EC_RESET_FLAG_HIBERNATE;
else if (hib_wake_flags & HIBERNATE_WAKE_MTC)
- flags |= RESET_FLAG_RTC_ALARM | RESET_FLAG_HIBERNATE;
+ flags |= EC_RESET_FLAG_RTC_ALARM | EC_RESET_FLAG_HIBERNATE;
/* Watchdog Reset */
if (IS_BIT_SET(NPCX_T0CSR, NPCX_T0CSR_WDRST_STS)) {
/*
- * Don't set RESET_FLAG_WATCHDOG flag if watchdog is issued by
- * system_reset or hibernate in order to distinguish reset cause
- * is panic reason or not.
+ * Don't set EC_RESET_FLAG_WATCHDOG flag if watchdog is issued
+ * by system_reset or hibernate in order to distinguish reset
+ * cause is panic reason or not.
*/
- if (!(flags & (RESET_FLAG_SOFT | RESET_FLAG_HARD |
- RESET_FLAG_HIBERNATE)))
- flags |= RESET_FLAG_WATCHDOG;
+ if (!(flags & (EC_RESET_FLAG_SOFT | EC_RESET_FLAG_HARD |
+ EC_RESET_FLAG_HIBERNATE)))
+ flags |= EC_RESET_FLAG_WATCHDOG;
/* Clear watchdog reset status initially*/
SET_BIT(NPCX_T0CSR, NPCX_T0CSR_WDRST_STS);
@@ -925,12 +925,12 @@ int system_is_reboot_warm(void)
check_reset_cause();
reset_flags = system_get_reset_flags();
- if ((reset_flags & RESET_FLAG_RESET_PIN) ||
- (reset_flags & RESET_FLAG_POWER_ON) ||
- (reset_flags & RESET_FLAG_WATCHDOG) ||
- (reset_flags & RESET_FLAG_HARD) ||
- (reset_flags & RESET_FLAG_SOFT) ||
- (reset_flags & RESET_FLAG_HIBERNATE))
+ if ((reset_flags & EC_RESET_FLAG_RESET_PIN) ||
+ (reset_flags & EC_RESET_FLAG_POWER_ON) ||
+ (reset_flags & EC_RESET_FLAG_WATCHDOG) ||
+ (reset_flags & EC_RESET_FLAG_HARD) ||
+ (reset_flags & EC_RESET_FLAG_SOFT) ||
+ (reset_flags & EC_RESET_FLAG_HIBERNATE))
return 0;
else
return 1;
diff --git a/chip/nrf51/system.c b/chip/nrf51/system.c
index 6a3b0888c5..dc7bff2059 100644
--- a/chip/nrf51/system.c
+++ b/chip/nrf51/system.c
@@ -7,6 +7,7 @@
#include "common.h"
#include "console.h"
+#include "ec_commands.h"
#include "registers.h"
#include "system.h"
#include "task.h"
@@ -50,22 +51,22 @@ static void check_reset_cause(void)
uint32_t raw_cause = NRF51_POWER_RESETREAS;
if (raw_cause & NRF51_POWER_RESETREAS_RESETPIN)
- flags |= RESET_FLAG_RESET_PIN;
+ flags |= EC_RESET_FLAG_RESET_PIN;
if (raw_cause & NRF51_POWER_RESETREAS_DOG)
- flags |= RESET_FLAG_WATCHDOG;
+ flags |= EC_RESET_FLAG_WATCHDOG;
/* Note that the programmer uses a soft reset in debug mode. */
if (raw_cause & NRF51_POWER_RESETREAS_SREQ)
- flags |= RESET_FLAG_SOFT;
+ flags |= EC_RESET_FLAG_SOFT;
if (raw_cause & (NRF51_POWER_RESETREAS_OFF |
NRF51_POWER_RESETREAS_LPCOMP))
- flags |= RESET_FLAG_WAKE_PIN;
+ flags |= EC_RESET_FLAG_WAKE_PIN;
if (raw_cause & (NRF51_POWER_RESETREAS_LOCKUP |
NRF51_POWER_RESETREAS_DIF))
- flags |= RESET_FLAG_OTHER;
+ flags |= EC_RESET_FLAG_OTHER;
system_set_reset_flags(flags);
diff --git a/chip/stm32/flash-f.c b/chip/stm32/flash-f.c
index 5bfec02a62..14182c54a4 100644
--- a/chip/stm32/flash-f.c
+++ b/chip/stm32/flash-f.c
@@ -689,7 +689,7 @@ int flash_pre_init(void)
* If we have already jumped between images, an earlier image could
* have applied write protection. Nothing additional needs to be done.
*/
- if (reset_flags & RESET_FLAG_SYSJUMP)
+ if (reset_flags & EC_RESET_FLAG_SYSJUMP)
return EC_SUCCESS;
if (prot_flags & EC_FLASH_PROTECT_GPIO_ASSERTED) {
diff --git a/chip/stm32/flash-stm32f3.c b/chip/stm32/flash-stm32f3.c
index efa74c90cd..a413d98d43 100644
--- a/chip/stm32/flash-stm32f3.c
+++ b/chip/stm32/flash-stm32f3.c
@@ -175,7 +175,7 @@ int flash_physical_restore_state(void)
* If we have already jumped between images, an earlier image could
* have applied write protection. Nothing additional needs to be done.
*/
- if (reset_flags & RESET_FLAG_SYSJUMP) {
+ if (reset_flags & EC_RESET_FLAG_SYSJUMP) {
prev = (const struct flash_wp_state *)system_get_jump_tag(
FLASH_SYSJUMP_TAG, &version, &size);
if (prev && version == FLASH_HOOK_VERSION &&
diff --git a/chip/stm32/flash-stm32h7.c b/chip/stm32/flash-stm32h7.c
index 960f478cd2..5f5d1ef528 100644
--- a/chip/stm32/flash-stm32h7.c
+++ b/chip/stm32/flash-stm32h7.c
@@ -465,7 +465,7 @@ int flash_pre_init(void)
* If we have already jumped between images, an earlier image could
* have applied write protection. Nothing additional needs to be done.
*/
- if (reset_flags & RESET_FLAG_SYSJUMP)
+ if (reset_flags & EC_RESET_FLAG_SYSJUMP)
return EC_SUCCESS;
if (prot_flags & EC_FLASH_PROTECT_GPIO_ASSERTED) {
@@ -499,7 +499,7 @@ int flash_pre_init(void)
* write-protect. If it didn't, then the flash write protect registers
* have been permanently committed and we can't fix that.
*/
- if (reset_flags & RESET_FLAG_POWER_ON) {
+ if (reset_flags & EC_RESET_FLAG_POWER_ON) {
stuck_locked = 1;
return EC_ERROR_ACCESS_DENIED;
}
diff --git a/chip/stm32/flash-stm32l.c b/chip/stm32/flash-stm32l.c
index ef4f19e09d..a151a26cf8 100644
--- a/chip/stm32/flash-stm32l.c
+++ b/chip/stm32/flash-stm32l.c
@@ -436,7 +436,7 @@ int flash_pre_init(void)
* If we have already jumped between images, an earlier image could
* have applied write protection. Nothing additional needs to be done.
*/
- if (reset_flags & RESET_FLAG_SYSJUMP)
+ if (reset_flags & EC_RESET_FLAG_SYSJUMP)
return EC_SUCCESS;
if (prot_flags & EC_FLASH_PROTECT_GPIO_ASSERTED) {
diff --git a/chip/stm32/flash-stm32l4.c b/chip/stm32/flash-stm32l4.c
index 97594733c0..c138780d34 100644
--- a/chip/stm32/flash-stm32l4.c
+++ b/chip/stm32/flash-stm32l4.c
@@ -450,7 +450,7 @@ int flash_pre_init(void)
* If we have already jumped between images, an earlier image could
* have applied write protection. Nothing additional needs to be done.
*/
- if (reset_flags & RESET_FLAG_SYSJUMP)
+ if (reset_flags & EC_RESET_FLAG_SYSJUMP)
return EC_SUCCESS;
if (prot_flags & EC_FLASH_PROTECT_GPIO_ASSERTED) {
diff --git a/chip/stm32/system.c b/chip/stm32/system.c
index d5884375c9..7cc0881dc2 100644
--- a/chip/stm32/system.c
+++ b/chip/stm32/system.c
@@ -188,25 +188,25 @@ static void check_reset_cause(void)
* IWDG or WWDG, if the watchdog was not used as an hard reset
* mechanism
*/
- if (!(flags & RESET_FLAG_HARD))
- flags |= RESET_FLAG_WATCHDOG;
+ if (!(flags & EC_RESET_FLAG_HARD))
+ flags |= EC_RESET_FLAG_WATCHDOG;
}
if (raw_cause & RESET_CAUSE_SFT)
- flags |= RESET_FLAG_SOFT;
+ flags |= EC_RESET_FLAG_SOFT;
if (raw_cause & RESET_CAUSE_POR)
- flags |= RESET_FLAG_POWER_ON;
+ flags |= EC_RESET_FLAG_POWER_ON;
if (raw_cause & RESET_CAUSE_PIN)
- flags |= RESET_FLAG_RESET_PIN;
+ flags |= EC_RESET_FLAG_RESET_PIN;
if (pwr_status & RESET_CAUSE_SBF)
/* Hibernated and subsequently awakened */
- flags |= RESET_FLAG_HIBERNATE;
+ flags |= EC_RESET_FLAG_HIBERNATE;
if (!flags && (raw_cause & RESET_CAUSE_OTHER))
- flags |= RESET_FLAG_OTHER;
+ flags |= EC_RESET_FLAG_OTHER;
/*
* WORKAROUND: as we cannot de-activate the watchdog during
@@ -215,8 +215,8 @@ static void check_reset_cause(void)
* watchdog initialized this time.
* The RTC deadline (if any) is already set.
*/
- if ((flags & (RESET_FLAG_HIBERNATE | RESET_FLAG_WATCHDOG)) ==
- (RESET_FLAG_HIBERNATE | RESET_FLAG_WATCHDOG)) {
+ if ((flags & EC_RESET_FLAG_HIBERNATE) &&
+ (flags & EC_RESET_FLAG_WATCHDOG)) {
__enter_hibernate(0, 0);
}
@@ -358,18 +358,18 @@ void system_reset(int flags)
/* Save current reset reasons if necessary */
if (flags & SYSTEM_RESET_PRESERVE_FLAGS)
- save_flags = system_get_reset_flags() | RESET_FLAG_PRESERVED;
+ save_flags = system_get_reset_flags() | EC_RESET_FLAG_PRESERVED;
if (flags & SYSTEM_RESET_LEAVE_AP_OFF)
- save_flags |= RESET_FLAG_AP_OFF;
+ save_flags |= EC_RESET_FLAG_AP_OFF;
/* Remember that the software asked us to hard reboot */
if (flags & SYSTEM_RESET_HARD)
- save_flags |= RESET_FLAG_HARD;
+ save_flags |= EC_RESET_FLAG_HARD;
#ifdef CONFIG_STM32_RESET_FLAGS_EXTENDED
if (flags & SYSTEM_RESET_AP_WATCHDOG)
- save_flags |= RESET_FLAG_AP_WATCHDOG;
+ save_flags |= EC_RESET_FLAG_AP_WATCHDOG;
bkpdata_write(BKPDATA_INDEX_SAVED_RESET_FLAGS, save_flags & 0xffff);
bkpdata_write(BKPDATA_INDEX_SAVED_RESET_FLAGS_2, save_flags >> 16);
diff --git a/common/button.c b/common/button.c
index 6a9ffa41c5..7eee2e41e1 100644
--- a/common/button.c
+++ b/common/button.c
@@ -178,7 +178,7 @@ static int is_recovery_boot(void)
if (system_jumped_to_this_image())
return 0;
if (!(system_get_reset_flags() &
- (RESET_FLAG_RESET_PIN | RESET_FLAG_POWER_ON)))
+ (EC_RESET_FLAG_RESET_PIN | EC_RESET_FLAG_POWER_ON)))
return 0;
if (!is_recovery_button_pressed())
return 0;
@@ -203,7 +203,7 @@ void button_init(void)
#ifdef CONFIG_BUTTON_TRIGGERED_RECOVERY
if (is_recovery_boot()) {
- system_clear_reset_flags(RESET_FLAG_AP_OFF);
+ system_clear_reset_flags(EC_RESET_FLAG_AP_OFF);
host_set_single_event(EC_HOST_EVENT_KEYBOARD_RECOVERY);
button_check_hw_reinit_required();
}
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c
index 954ff1319a..0f38692788 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -626,7 +626,7 @@ static uint32_t check_boot_key(const uint8_t *state)
return BOOT_KEY_NONE;
/* If reset was not caused by reset pin, refresh must be held down */
- if (!(system_get_reset_flags() & RESET_FLAG_RESET_PIN) &&
+ if (!(system_get_reset_flags() & EC_RESET_FLAG_RESET_PIN) &&
!(state[KEYBOARD_COL_REFRESH] & KEYBOARD_MASK_REFRESH))
return BOOT_KEY_NONE;
diff --git a/common/main.c b/common/main.c
index c5e63e7faa..90fa5df632 100644
--- a/common/main.c
+++ b/common/main.c
@@ -132,7 +132,7 @@ test_mockable __keep int main(void)
uart_init();
/* be less verbose if we boot for USB resume to meet spec timings */
- if (!(system_get_reset_flags() & RESET_FLAG_USB_RESUME)) {
+ if (!(system_get_reset_flags() & EC_RESET_FLAG_USB_RESUME)) {
if (system_jumped_to_this_image()) {
CPRINTS("UART initialized after sysjump");
} else {
@@ -211,9 +211,9 @@ test_mockable __keep int main(void)
* If system was reset by reset-pin, do not jump and wait for
* command from host
*/
- if (system_get_reset_flags() == RESET_FLAG_RESET_PIN) {
+ if (system_get_reset_flags() == EC_RESET_FLAG_RESET_PIN)
CPRINTS("Hard pin-reset detected, disable RW jump");
- } else
+ else
#endif
{
if (rwsig_check_signature())
diff --git a/common/power_button_x86.c b/common/power_button_x86.c
index e17800f1d8..6909815972 100644
--- a/common/power_button_x86.c
+++ b/common/power_button_x86.c
@@ -230,7 +230,7 @@ static void set_initial_pwrbtn_state(void)
CPRINTS("PB init-jumped");
}
return;
- } else if ((reset_flags & RESET_FLAG_AP_OFF) ||
+ } else if ((reset_flags & EC_RESET_FLAG_AP_OFF) ||
(keyboard_scan_get_boot_keys() == BOOT_KEY_DOWN_ARROW)) {
/*
* Reset triggered by keyboard-controlled reset, and down-arrow
diff --git a/common/system.c b/common/system.c
index db12aa5535..c7918b96f6 100644
--- a/common/system.c
+++ b/common/system.c
@@ -234,17 +234,18 @@ void system_encode_save_flags(int reset_flags, uint32_t *save_flags)
/* Save current reset reasons if necessary */
if (reset_flags & SYSTEM_RESET_PRESERVE_FLAGS)
- *save_flags = system_get_reset_flags() | RESET_FLAG_PRESERVED;
+ *save_flags = system_get_reset_flags() |
+ EC_RESET_FLAG_PRESERVED;
/* Add in AP off flag into saved flags. */
if (reset_flags & SYSTEM_RESET_LEAVE_AP_OFF)
- *save_flags |= RESET_FLAG_AP_OFF;
+ *save_flags |= EC_RESET_FLAG_AP_OFF;
/* Save reset flag */
if (reset_flags & (SYSTEM_RESET_HARD | SYSTEM_RESET_WAIT_EXT))
- *save_flags |= RESET_FLAG_HARD;
+ *save_flags |= EC_RESET_FLAG_HARD;
else
- *save_flags |= RESET_FLAG_SOFT;
+ *save_flags |= EC_RESET_FLAG_SOFT;
}
uint32_t system_get_reset_flags(void)
@@ -782,7 +783,7 @@ void system_common_pre_init(void)
* was not already logged. This must happen before calculating
* jump_data address because it might change panic pointer.
*/
- if (system_get_reset_flags() & RESET_FLAG_WATCHDOG) {
+ if (system_get_reset_flags() & EC_RESET_FLAG_WATCHDOG) {
uint32_t reason;
uint32_t info;
uint8_t exception;
@@ -818,7 +819,7 @@ void system_common_pre_init(void)
/* Yes, we jumped to this image */
jumped_to_image = 1;
/* Restore the reset flags */
- reset_flags = jdata->reset_flags | RESET_FLAG_SYSJUMP;
+ reset_flags = jdata->reset_flags | EC_RESET_FLAG_SYSJUMP;
/*
* If the jump data structure isn't the same size as the
@@ -904,8 +905,8 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd)
if (IS_ENABLED(CONFIG_POWER_BUTTON_INIT_IDLE)) {
CPRINTS("Clearing AP_OFF");
- chip_save_reset_flags(
- chip_read_reset_flags() & ~RESET_FLAG_AP_OFF);
+ chip_save_reset_flags(chip_read_reset_flags() &
+ ~EC_RESET_FLAG_AP_OFF);
}
/* Intentional fall-through */
case EC_REBOOT_HIBERNATE:
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index eab4a4d959..f7500ceb6a 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -2527,7 +2527,7 @@ static void pd_partner_port_reset(int port)
/* If we just lost power, don't apply Rp. */
if (system_get_reset_flags() &
- (RESET_FLAG_BROWNOUT | RESET_FLAG_POWER_ON))
+ (EC_RESET_FLAG_BROWNOUT | EC_RESET_FLAG_POWER_ON))
return;
/*
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 206d88f195..a43fea7f58 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -13,7 +13,7 @@
#endif
#ifdef __cplusplus
-extern "C"{
+extern "C" {
#endif
/*
@@ -440,7 +440,7 @@ extern "C"{
* parent structure that the alignment will still be true given the packing of
* the parent structure. This is particularly important if the sub-structure
* will be passed as a pointer to another function, since that function will
- * not know about the misaligment caused by the parent structure's packing.
+ * not know about the misalignment caused by the parent structure's packing.
*
* Also be very careful using __packed - particularly when nesting non-packed
* structures inside packed ones. In fact, DO NOT use __packed directly;
@@ -5379,6 +5379,29 @@ struct ec_params_set_cbi {
*/
#define EC_CMD_GET_UPTIME_INFO 0x0121
+/* Reset causes */
+#define EC_RESET_FLAG_OTHER BIT(0) /* Other known reason */
+#define EC_RESET_FLAG_RESET_PIN BIT(1) /* Reset pin asserted */
+#define EC_RESET_FLAG_BROWNOUT BIT(2) /* Brownout */
+#define EC_RESET_FLAG_POWER_ON BIT(3) /* Power-on reset */
+#define EC_RESET_FLAG_WATCHDOG BIT(4) /* Watchdog timer reset */
+#define EC_RESET_FLAG_SOFT BIT(5) /* Soft reset trigger by core */
+#define EC_RESET_FLAG_HIBERNATE BIT(6) /* Wake from hibernate */
+#define EC_RESET_FLAG_RTC_ALARM BIT(7) /* RTC alarm wake */
+#define EC_RESET_FLAG_WAKE_PIN BIT(8) /* Wake pin triggered wake */
+#define EC_RESET_FLAG_LOW_BATTERY BIT(9) /* Low battery triggered wake */
+#define EC_RESET_FLAG_SYSJUMP BIT(10) /* Jumped directly to this image */
+#define EC_RESET_FLAG_HARD BIT(11) /* Hard reset from software */
+#define EC_RESET_FLAG_AP_OFF BIT(12) /* Do not power on AP */
+#define EC_RESET_FLAG_PRESERVED BIT(13) /* Some reset flags preserved from
+ * previous boot
+ */
+#define EC_RESET_FLAG_USB_RESUME BIT(14) /* USB resume triggered wake */
+#define EC_RESET_FLAG_RDD BIT(15) /* USB Type-C debug cable */
+#define EC_RESET_FLAG_RBOX BIT(16) /* Fixed Reset Functionality */
+#define EC_RESET_FLAG_SECURITY BIT(17) /* Security threat */
+#define EC_RESET_FLAG_AP_WATCHDOG BIT(18) /* AP experienced a watchdog reset */
+
struct ec_response_uptime_info {
/*
* Number of milliseconds since the last EC boot. Sysjump resets
@@ -5399,8 +5422,8 @@ struct ec_response_uptime_info {
uint32_t ap_resets_since_ec_boot;
/*
- * The set of flags which describe the EC's most recent reset. See
- * include/system.h RESET_FLAG_* for details.
+ * The set of flags which describe the EC's most recent reset.
+ * See EC_RESET_FLAG_* for details.
*/
uint32_t ec_reset_flags;
diff --git a/include/reset_flag_desc.inc b/include/reset_flag_desc.inc
index 425332b31b..3d22b64633 100644
--- a/include/reset_flag_desc.inc
+++ b/include/reset_flag_desc.inc
@@ -4,7 +4,7 @@
*/
/*
- * Reset flag descriptions. Must be in same order as bits of RESET_FLAG_
+ * Reset flag descriptions. Must be in same order as bits of EC_RESET_FLAG_
* constants.
*/
"other",
diff --git a/include/system.h b/include/system.h
index d09d4121b3..b215dadbf4 100644
--- a/include/system.h
+++ b/include/system.h
@@ -14,29 +14,7 @@
#include "console.h"
#include "timer.h"
-/* Reset causes */
-#define RESET_FLAG_OTHER BIT(0) /* Other known reason */
-#define RESET_FLAG_RESET_PIN BIT(1) /* Reset pin asserted */
-#define RESET_FLAG_BROWNOUT BIT(2) /* Brownout */
-#define RESET_FLAG_POWER_ON BIT(3) /* Power-on reset */
-#define RESET_FLAG_WATCHDOG BIT(4) /* Watchdog timer reset */
-#define RESET_FLAG_SOFT BIT(5) /* Soft reset trigger by core */
-#define RESET_FLAG_HIBERNATE BIT(6) /* Wake from hibernate */
-#define RESET_FLAG_RTC_ALARM BIT(7) /* RTC alarm wake */
-#define RESET_FLAG_WAKE_PIN BIT(8) /* Wake pin triggered wake */
-#define RESET_FLAG_LOW_BATTERY BIT(9) /* Low battery triggered wake */
-#define RESET_FLAG_SYSJUMP BIT(10) /* Jumped directly to this image */
-#define RESET_FLAG_HARD BIT(11) /* Hard reset from software */
-#define RESET_FLAG_AP_OFF BIT(12) /* Do not power on AP */
-#define RESET_FLAG_PRESERVED BIT(13) /* Some reset flags preserved from
- * previous boot */
-#define RESET_FLAG_USB_RESUME BIT(14) /* USB resume triggered wake */
-#define RESET_FLAG_RDD BIT(15) /* USB Type-C debug cable */
-#define RESET_FLAG_RBOX BIT(16) /* Fixed Reset Functionality */
-#define RESET_FLAG_SECURITY BIT(17) /* Security threat */
-#define RESET_FLAG_AP_WATCHDOG BIT(18) /* AP experienced a watchdog reset */
-
-/* Per chip implementation to save/read raw RESET_FLAG_ flags. */
+/* Per chip implementation to save/read raw EC_RESET_FLAG_ flags. */
void chip_save_reset_flags(uint32_t flags);
uint32_t chip_read_reset_flags(void);
@@ -81,7 +59,7 @@ void system_encode_save_flags(int reset_flags, uint32_t *save_flags);
/**
* Get the reset flags.
*
- * @return Reset flags (RESET_FLAG_*), or 0 if the cause is unknown.
+ * @return Reset flags (EC_RESET_FLAG_*), or 0 if the cause is unknown.
*/
uint32_t system_get_reset_flags(void);
diff --git a/power/mt817x.c b/power/mt817x.c
index f13e04a1e3..368712965b 100644
--- a/power/mt817x.c
+++ b/power/mt817x.c
@@ -410,7 +410,7 @@ enum power_state power_chipset_init(void)
* Force the AP shutdown unless we are doing SYSJUMP. Otherwise,
* the AP could stay in strange state.
*/
- if (!(reset_flags & RESET_FLAG_SYSJUMP)) {
+ if (!(reset_flags & EC_RESET_FLAG_SYSJUMP)) {
CPRINTS("not sysjump; forcing AP shutdown");
chipset_turn_off_power_rails();
@@ -446,8 +446,8 @@ enum power_state power_chipset_init(void)
}
/* Leave power off only if requested by reset flags */
- if (!(reset_flags & RESET_FLAG_AP_OFF) &&
- !(reset_flags & RESET_FLAG_SYSJUMP)) {
+ if (!(reset_flags & EC_RESET_FLAG_AP_OFF) &&
+ !(reset_flags & EC_RESET_FLAG_SYSJUMP)) {
CPRINTS("reset_flag 0x%x", reset_flags);
auto_power_on = 1;
}
@@ -528,12 +528,12 @@ static int check_for_power_on_event(void)
{
int ap_off_flag;
- ap_off_flag = system_get_reset_flags() & RESET_FLAG_AP_OFF;
- system_clear_reset_flags(RESET_FLAG_AP_OFF);
+ ap_off_flag = system_get_reset_flags() & EC_RESET_FLAG_AP_OFF;
+ system_clear_reset_flags(EC_RESET_FLAG_AP_OFF);
/* check if system is already ON */
if (is_power_good_asserted()) {
if (ap_off_flag) {
- CPRINTS("system is on, but RESET_FLAG_AP_OFF is on");
+ CPRINTS("system is on, but EC_RESET_FLAG_AP_OFF is on");
return POWER_ON_CANCEL;
} else {
CPRINTS("system is on, thus clear " "auto_power_on");
@@ -543,7 +543,7 @@ static int check_for_power_on_event(void)
}
} else {
if (ap_off_flag) {
- CPRINTS("RESET_FLAG_AP_OFF is on");
+ CPRINTS("EC_RESET_FLAG_AP_OFF is on");
power_off();
return POWER_ON_CANCEL;
}
diff --git a/power/mt8183.c b/power/mt8183.c
index af560c04e4..683e6d274e 100644
--- a/power/mt8183.c
+++ b/power/mt8183.c
@@ -168,7 +168,7 @@ enum power_state power_chipset_init(void)
CPRINTS("already in S0");
return POWER_S0;
}
- } else if (system_get_reset_flags() & RESET_FLAG_AP_OFF) {
+ } else if (system_get_reset_flags() & EC_RESET_FLAG_AP_OFF) {
/* Force shutdown from S5 if the PMIC is already up. */
if (power_get_signals() & IN_PGOOD_PMIC) {
forcing_shutdown = 1;
diff --git a/power/rk3288.c b/power/rk3288.c
index 111f7c7fd9..a44df2ffbc 100644
--- a/power/rk3288.c
+++ b/power/rk3288.c
@@ -215,7 +215,7 @@ enum power_state power_chipset_init(void)
* Force the AP shutdown unless we are doing SYSJUMP. Otherwise,
* the AP could stay in strange state.
*/
- if (!(reset_flags & RESET_FLAG_SYSJUMP)) {
+ if (!(reset_flags & EC_RESET_FLAG_SYSJUMP)) {
CPRINTS("not sysjump; forcing AP shutdown");
chipset_turn_off_power_rails();
@@ -235,8 +235,8 @@ enum power_state power_chipset_init(void)
}
/* Leave power off only if requested by reset flags */
- if (!(reset_flags & RESET_FLAG_AP_OFF) &&
- !(reset_flags & RESET_FLAG_SYSJUMP)) {
+ if (!(reset_flags & EC_RESET_FLAG_AP_OFF) &&
+ !(reset_flags & EC_RESET_FLAG_SYSJUMP)) {
CPRINTS("auto_power_on set due to reset_flag 0x%x",
system_get_reset_flags());
auto_power_on = 1;
@@ -289,14 +289,14 @@ static int check_for_power_on_event(void)
{
int ap_off_flag;
- ap_off_flag = system_get_reset_flags() & RESET_FLAG_AP_OFF;
- system_clear_reset_flags(RESET_FLAG_AP_OFF);
+ ap_off_flag = system_get_reset_flags() & EC_RESET_FLAG_AP_OFF;
+ system_clear_reset_flags(EC_RESET_FLAG_AP_OFF);
/* check if system is already ON */
if (power_get_signals() & IN_POWER_GOOD) {
if (ap_off_flag) {
CPRINTS(
"system is on, but "
- "RESET_FLAG_AP_OFF is on");
+ "EC_RESET_FLAG_AP_OFF is on");
return 0;
} else {
CPRINTS(
diff --git a/power/rk3399.c b/power/rk3399.c
index f72c43d4d1..9f146fccf9 100644
--- a/power/rk3399.c
+++ b/power/rk3399.c
@@ -241,7 +241,7 @@ enum power_state power_chipset_init(void)
CPRINTS("already in S0");
return POWER_S0;
}
- } else if (!(system_get_reset_flags() & RESET_FLAG_AP_OFF))
+ } else if (!(system_get_reset_flags() & EC_RESET_FLAG_AP_OFF))
/* Auto-power on */
chipset_exit_hard_off();
diff --git a/power/sdm845.c b/power/sdm845.c
index c229ddd4b9..ac5b814ad3 100644
--- a/power/sdm845.c
+++ b/power/sdm845.c
@@ -407,7 +407,7 @@ enum power_state power_chipset_init(void)
* Force the AP shutdown unless we are doing SYSJUMP. Otherwise,
* the AP could stay in strange state.
*/
- if (!(reset_flags & RESET_FLAG_SYSJUMP)) {
+ if (!(reset_flags & EC_RESET_FLAG_SYSJUMP)) {
CPRINTS("not sysjump; forcing system shutdown");
set_system_power(0);
init_power_state = POWER_G3;
@@ -423,8 +423,8 @@ enum power_state power_chipset_init(void)
}
/* Leave power off only if requested by reset flags */
- if (!(reset_flags & RESET_FLAG_AP_OFF) &&
- !(reset_flags & RESET_FLAG_SYSJUMP)) {
+ if (!(reset_flags & EC_RESET_FLAG_AP_OFF) &&
+ !(reset_flags & EC_RESET_FLAG_SYSJUMP)) {
CPRINTS("auto_power_on set due to reset_flag 0x%x",
system_get_reset_flags());
auto_power_on = 1;
@@ -553,12 +553,12 @@ static uint8_t check_for_power_on_event(void)
{
int ap_off_flag;
- ap_off_flag = system_get_reset_flags() & RESET_FLAG_AP_OFF;
- system_clear_reset_flags(RESET_FLAG_AP_OFF);
+ ap_off_flag = system_get_reset_flags() & EC_RESET_FLAG_AP_OFF;
+ system_clear_reset_flags(EC_RESET_FLAG_AP_OFF);
/* check if system is already ON */
if (power_get_signals() & IN_POWER_GOOD) {
if (ap_off_flag) {
- CPRINTS("system is on, but RESET_FLAG_AP_OFF is on");
+ CPRINTS("system is on, but EC_RESET_FLAG_AP_OFF is on");
return POWER_ON_CANCEL;
}
CPRINTS("system is on, thus clear auto_power_on");
@@ -567,7 +567,7 @@ static uint8_t check_for_power_on_event(void)
return POWER_ON_BY_IN_POWER_GOOD;
}
if (ap_off_flag) {
- CPRINTS("RESET_FLAG_AP_OFF is on");
+ CPRINTS("EC_RESET_FLAG_AP_OFF is on");
power_off();
return POWER_ON_CANCEL;
}
diff --git a/power/skylake.c b/power/skylake.c
index ce6b823b5e..d51f6079ff 100644
--- a/power/skylake.c
+++ b/power/skylake.c
@@ -158,18 +158,19 @@ void chipset_handle_reboot(void)
* conditions are not met.
*/
if (!(flags &
- (RESET_FLAG_WATCHDOG | RESET_FLAG_SOFT | RESET_FLAG_HARD)))
+ (EC_RESET_FLAG_WATCHDOG | EC_RESET_FLAG_SOFT |
+ EC_RESET_FLAG_HARD)))
return;
/* Preserve AP off request. */
- if (flags & RESET_FLAG_AP_OFF) {
+ if (flags & EC_RESET_FLAG_AP_OFF) {
/* Do not issue PMIC reset if board cannot save reset flags */
if (!board_has_working_reset_flags()) {
ccprintf("Skip PMIC reset due to board issue.\n");
cflush();
return;
}
- chip_save_reset_flags(RESET_FLAG_AP_OFF);
+ chip_save_reset_flags(EC_RESET_FLAG_AP_OFF);
}
#ifdef CONFIG_CHIP_PANIC_BACKUP
diff --git a/test/kb_scan.c b/test/kb_scan.c
index 8d068f01ed..24015758b1 100644
--- a/test/kb_scan.c
+++ b/test/kb_scan.c
@@ -407,12 +407,12 @@ void test_init(void)
if (state & TEST_STATE_MASK(TEST_STATE_STEP_2)) {
/* Power-F3-ESC */
system_set_reset_flags(system_get_reset_flags() |
- RESET_FLAG_RESET_PIN);
+ EC_RESET_FLAG_RESET_PIN);
mock_key(1, 1, 1);
} else if (state & TEST_STATE_MASK(TEST_STATE_STEP_3)) {
/* Power-F3-Down */
system_set_reset_flags(system_get_reset_flags() |
- RESET_FLAG_RESET_PIN);
+ EC_RESET_FLAG_RESET_PIN);
mock_key(6, 11, 1);
}
}