# HG changeset patch # User Mychaela Falconia # Date 1475712792 0 # Node ID 49254db81128acbc4b3b689f43d31add0e45fba7 # Parent 45ceec9433472ae7fee267a5e295160f3e9e7511 implemented fix for the L1/ETM boot time race condition bug diff -r 45ceec943347 -r 49254db81128 src/cs/services/etm/etm_env.c --- a/src/cs/services/etm/etm_env.c Wed Oct 05 23:44:54 2016 +0000 +++ b/src/cs/services/etm/etm_env.c Thu Oct 06 00:13:12 2016 +0000 @@ -38,6 +38,9 @@ */ T_ETM_ENV_CTRL_BLK *etm_env_ctrl_blk = NULL; +/* FreeCalypso addition */ +int etm_is_running; + /****************************************************************************** * Function : etm_get_info @@ -166,6 +169,7 @@ T_RVM_RETURN etm_init(void) { + etm_is_running = 1; /* FreeCalypso addition */ return RVM_OK; } @@ -207,6 +211,7 @@ T_RVM_RETURN etm_stop(void) { + etm_is_running = 0; /* FreeCalypso addition */ return RVM_OK; } diff -r 45ceec943347 -r 49254db81128 src/g23m-gsm/l1/l1_pei.c --- a/src/g23m-gsm/l1/l1_pei.c Wed Oct 05 23:44:54 2016 +0000 +++ b/src/g23m-gsm/l1/l1_pei.c Thu Oct 06 00:13:12 2016 +0000 @@ -183,6 +183,8 @@ T_PEI_RETURN pei_init (void) #endif { + extern int etm_is_running; /* FreeCalypso addition */ + #if defined (NEW_FRAME) L1_Handle = Handle; #endif @@ -266,6 +268,22 @@ #endif /* + * FreeCalypso addition: TI's original code contains a boot time + * race condition: if the L1A task starts running before ETM over + * in RiViera land has initialized itself, the etm_register() call + * at the beginning of l1a_task() that registers L1TM causes a + * boot time crash. It appears that this race condition has always + * been there, but it has been unmasked when we made a port of R2D + * to the Motorola C139 LCD. + * + * Our solution: we hold off on L1 GPF task startup until ETM + * has been initialized, just like we hold off until the message + * queues L1 needs to send to have been created. + */ + if (!etm_is_running) + return PEI_ERROR; + + /* * Register VSI_CALLER as generic caller entity. */ _osx_open (VSI_CALLER 0, 0);