diff src/g23m-gsm/l1/l1_pei.c @ 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 267cefdca4b6
children
line wrap: on
line diff
--- 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);