changeset 110:49254db81128

implemented fix for the L1/ETM boot time race condition bug
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 06 Oct 2016 00:13:12 +0000
parents 45ceec943347
children 42f459b5187c
files src/cs/services/etm/etm_env.c src/g23m-gsm/l1/l1_pei.c
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }
 
--- 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);