# HG changeset patch # User Mychaela Falconia # Date 1619504692 0 # Node ID 740a8e8fc9d7ca31730d35c82bb780ff37a66e2e # Parent c336ed5691a50b4494c5576b2250f600d0bbfa67 startup sync logic rework for the new PWON button boot scheme Previously we added logic to the MMI task to hold off PEI init until R2D is running, and then extended that condition to wait for FCHG init too. However, the dependencies of MMI upon R2D and FCHG don't start until mmiInit(), and that call is driven by Switch_ON() code, hence the wait for R2D and FCHG init can be made in that code path instead of the MMI task. Furthermore, with our new way of signaling PWON button boot to MMI, we need a new wait to ensure that the MMI task is up - previously this assurance was provided by the wait for Kp pointers to be set. Solution: revert our previous PEI init hold-off additions to MMI, add a new flag indicating MMI task init done, and put the combined wait for all needed conditions into our new PWON button boot code in power.c. diff -r c336ed5691a5 -r 740a8e8fc9d7 src/cs/drivers/drv_app/power/board/power.c --- a/src/cs/drivers/drv_app/power/board/power.c Mon Apr 26 22:04:10 2021 +0000 +++ b/src/cs/drivers/drv_app/power/board/power.c Tue Apr 27 06:24:52 2021 +0000 @@ -53,6 +53,10 @@ { #if (MMI != 0) extern void fchs_pwon_button_boot(void); + extern int fchg_is_running, r2d_is_running, mmi_task_init_done; + + while (!fchg_is_running || !r2d_is_running || !mmi_task_init_done) + rvf_delay(8); fchs_pwon_button_boot(); #endif diff -r c336ed5691a5 -r 740a8e8fc9d7 src/g23m-aci/aci/aci_pei.c --- a/src/g23m-aci/aci/aci_pei.c Mon Apr 26 22:04:10 2021 +0000 +++ b/src/g23m-aci/aci/aci_pei.c Tue Apr 27 06:24:52 2021 +0000 @@ -154,9 +154,7 @@ extern const char firmware_version_str[]; -#if (MMI != 0) -extern int fchg_is_running, r2d_is_running; -#endif +int mmi_task_init_done; /*==== DEFINE =====================================================*/ @@ -1388,13 +1386,6 @@ #endif /* TI_PS_HCOMM_CHANGE */ -/* FreeCalypso addition to fix R2D start race condition */ -/* wait for FCHG too now that MFW depends on it */ -#if (MMI != 0) - if (!fchg_is_running || !r2d_is_running) - return PEI_ERROR; -#endif - #ifdef DTI #ifdef _SIMULATION_ /* @@ -1595,6 +1586,8 @@ acia_init(); #endif + mmi_task_init_done = 1; + return PEI_OK; }