@@ -29,6 +29,18 @@ static void boot_allow_sleep(struct k_timer *timer)
2929 pm_policy_state_lock_put (PM_STATE_SUSPEND_TO_IDLE , PM_ALL_SUBSTATES );
3030}
3131
32+ #if defined(CONFIG_CUSTOMIZED_DESIGN ) && defined(CONFIG_PLATFORM_EC_SYSTEM_JUMP_RW_SUPPORT )
33+ void check_rw_boot (void )
34+ {
35+ if (system_get_image_copy () == EC_IMAGE_RW )
36+ system_set_bbram (SYSTEM_BBRAM_IDX_SYSTEM_JUMP_RW_SUCCESS , 1 );
37+ else
38+ system_set_bbram (SYSTEM_BBRAM_IDX_SYSTEM_JUMP_RW_SUCCESS , 0 );
39+
40+ }
41+ DECLARE_DEFERRED (check_rw_boot );
42+ #endif
43+
3244/* For testing purposes this is not named main. See main_shim.c for the real
3345 * main() function.
3446 */
@@ -80,6 +92,22 @@ void ec_app_main(void)
8092 button_init ();
8193 }
8294
95+ #if defined(CONFIG_CUSTOMIZED_DESIGN ) && defined(CONFIG_PLATFORM_EC_SYSTEM_JUMP_RW_SUPPORT )
96+ uint8_t rw_flag , rw_success ;
97+
98+ system_get_bbram (SYSTEM_BBRAM_IDX_SYSTEM_JUMP_RW_FLAG , & rw_flag );
99+ system_get_bbram (SYSTEM_BBRAM_IDX_SYSTEM_JUMP_RW_SUCCESS , & rw_success );
100+ ccprints ("Get boot rw_flag:%d, rw_success:%d" , rw_flag , rw_success );
101+
102+ if (rw_flag && rw_success ) {
103+ /*Clear flag and boot to RW*/
104+ system_set_bbram (SYSTEM_BBRAM_IDX_SYSTEM_JUMP_RW_SUCCESS , 0 );
105+ system_run_image_copy (system_get_active_copy ());
106+ }
107+
108+ hook_call_deferred (& check_rw_boot_data , 5 * SECOND );
109+ #endif
110+
83111 if (IS_ENABLED (CONFIG_PLATFORM_EC_VBOOT_EFS2 )) {
84112 /*
85113 * For RO, it behaves as follows:
0 commit comments