QNX IPC: DSP Fault Recovery Fix
authorAngela Stegmaier <angelabaker@ti.com>
Tue, 7 May 2013 09:39:31 +0000 (04:39 -0500)
committerChris Ring <cring@ti.com>
Thu, 9 May 2013 17:47:40 +0000 (10:47 -0700)
Fix an issue where the procId and procHandle are not
being properly set.  If it is not properly set, then
error recovery doesn't happen properly.

This patch fixes that so that error recovery can happen
correctly.

Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
qnx/src/ipc3x_dev/ti/syslink/family/common/vayu/vayudsp/VAYUDspHal.c
qnx/src/ipc3x_dev/ti/syslink/family/common/vayu/vayudsp/VAYUDspPhyShmem.c
qnx/src/ipc3x_dev/ti/syslink/family/common/vayu/vayudsp/VAYUDspProc.c
qnx/src/ipc3x_dev/ti/syslink/family/vayu/vayudsp/VAYUDspHalMmu.c
qnx/src/ipc3x_dev/ti/syslink/inc/knl/VAYUDspHal.h
qnx/src/ipc3x_dev/ti/syslink/inc/knl/VAYUDspPhyShmem.h

index c3689ee67b1069bd84f238dd227171db79a82495..664209cefcfcdbf8f438f7ba36345d29369c9670 100644 (file)
@@ -92,6 +92,7 @@ VAYUDSP_halInit (Ptr * halObj, Ptr params)
 {
     Int                  status    = PROCESSOR_SUCCESS;
     VAYUDSP_HalObject *  halObject = NULL;
+    VAYUDSP_HalParams *  halParams = NULL;
 
     GT_2trace(curTrace, GT_ENTER, "VAYUDSP_halInit", halObj, params);
 
@@ -99,7 +100,7 @@ VAYUDSP_halInit (Ptr * halObj, Ptr params)
 
     halObject = (VAYUDSP_HalObject *) halObj ;
 
-    (Void) params ; /* Not used. */
+    halParams = (VAYUDSP_HalParams *)params ;
 
     *halObj = Memory_calloc (NULL, sizeof (VAYUDSP_HalObject), 0, NULL);
     if (halObject == NULL) {
@@ -112,6 +113,9 @@ VAYUDSP_halInit (Ptr * halObj, Ptr params)
                              "Memory allocation failed for HAL object!");
     }
     else {
+        halObject = (VAYUDSP_HalObject *) *halObj ;
+        halObject->procId = halParams->procId;
+
         status = VAYUDSP_phyShmemInit (*halObj);
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
         if (status < 0) {
index 189fe4b7baf589d8ef3b0fdae83077444f0c1c89..d8eec303f8adfa23c808a8e2769da25efcb47e9c 100644 (file)
@@ -222,6 +222,22 @@ VAYUDSP_phyShmemInit (Ptr halObj)
         halObject->mmuSysBase = mapInfo.dst;
     }
 
+    mapInfo.src      = CTRL_MODULE_BASE;
+    mapInfo.size     = CTRL_MODULE_SIZE;
+    mapInfo.isCached = FALSE;
+    status = Memory_map (&mapInfo);
+    if (status < 0) {
+        GT_setFailureReason (curTrace,
+                             GT_4CLASS,
+                             "VAYUDSP_phyShmemInit",
+                             status,
+                             "Failure in Memory_map for Ctrl Module base registers");
+        halObject->ctrlModBase = 0;
+    }
+    else {
+        halObject->ctrlModBase = mapInfo.dst;
+    }
+
     GT_1trace(curTrace, GT_LEAVE, "<-- VAYUDSP_phyShmemInit: 0x%x", status);
 
     /*! @retval PROCESSOR_SUCCESS Operation successful */
@@ -250,6 +266,21 @@ VAYUDSP_phyShmemExit (Ptr halObj)
 
     halObject = (VAYUDSP_HalObject *) halObj;
 
+    unmapInfo.addr = halObject->ctrlModBase;
+    unmapInfo.size = CTRL_MODULE_SIZE;
+    unmapInfo.isCached = FALSE;
+    if (unmapInfo.addr != 0) {
+        status = Memory_unmap (&unmapInfo);
+        if (status < 0) {
+            GT_setFailureReason (curTrace,
+                              GT_4CLASS,
+                              "VAYUDSP_phyShmemExit",
+                              status,
+                              "Failure in Memory_Unmap for Ctrl Module base registers");
+        }
+        halObject->ctrlModBase = 0 ;
+    }
+
     unmapInfo.addr = halObject->mmuBase;
     unmapInfo.size = MMU_SIZE;
     unmapInfo.isCached = FALSE;
index bce688909706f67ed542cdd6c63063ed5cba974f..7bd73f730d6be196210698980bcd08d50fd94711 100644 (file)
@@ -493,13 +493,14 @@ VAYUDSPPROC_create (      UInt16                procId,
                     handle->procId = procId;
                     object = (VAYUDSPPROC_Object *) handle->object;
                     object->halObject = NULL;
+                    object->procHandle = (Processor_Handle)handle;
                     /* Copy params into instance object. */
                     Memory_copy (&(object->params),
                                  (Ptr) params,
                                  sizeof (VAYUDSPPROC_Params));
                     /* Set the handle in the state object. */
                     VAYUDSPPROC_state.procHandles [procId] =
-                                                     (VAYUDSPPROC_Handle) handle;
+                                                     (VAYUDSPPROC_Handle) object;
                     /* Initialize the list of listeners */
                     List_Params_init(&listParams);
                     handle->registeredNotifiers = List_create(&listParams);
@@ -832,6 +833,7 @@ VAYUDSPPROC_attach(
     Char                        configProp[PARAMS_MAX_NAMELENGTH];
     UInt32                      numCarveouts = 0;
     VAYUDSP_HalMmuCtrlArgs_Enable mmuEnableArgs;
+    VAYUDSP_HalParams           halParams;
 
     GT_2trace (curTrace, GT_ENTER, "VAYUDSPPROC_attach", handle, params);
     GT_assert (curTrace, (handle != NULL));
@@ -986,7 +988,8 @@ VAYUDSPPROC_attach(
             memcpy((Ptr)params->memEntries, (Ptr)object->params.memEntries,
                 sizeof(ProcMgr_AddrInfo) * params->numMemEntries);
 
-            status = VAYUDSP_halInit(&(object->halObject), NULL);
+            halParams.procId = procHandle->procId;
+            status = VAYUDSP_halInit(&(object->halObject), &halParams);
 
 #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
             if (status < 0) {
index 1da575a2bfb95a03a9705f3b22cf1a81f29e1487..e85d82c9125d9a8e30d8cdd6fb2d2b0bbfe5727c 100644 (file)
@@ -384,21 +384,21 @@ _VAYUDSP_halMmuCheckAndClearFunc (Ptr arg)
 
     /* Print the fault information */
     GT_0trace (curTrace, GT_4CLASS,
-               "\n****************** DSP-MMU Fault ******************\n");
+               "****************** DSP-MMU Fault ******************");
     GT_1trace (curTrace, GT_4CLASS,
-               "****    addr: 0x%x\n", mmuObj->mmuFaultAddr);
+               "****    addr: 0x%x", mmuObj->mmuFaultAddr);
     if (mmuObj->mmuIrqStatus & MMU_IRQ_TLBMISS)
-        GT_0trace (curTrace, GT_4CLASS, "****    TLBMISS\n");
+        GT_0trace (curTrace, GT_4CLASS, "****    TLBMISS");
     if (mmuObj->mmuIrqStatus & MMU_IRQ_TRANSLATIONFAULT)
-        GT_0trace (curTrace, GT_4CLASS, "****    TRANSLATIONFAULT\n");
+        GT_0trace (curTrace, GT_4CLASS, "****    TRANSLATIONFAULT");
     if (mmuObj->mmuIrqStatus & MMU_IRQ_EMUMISS)
-        GT_0trace (curTrace, GT_4CLASS, "****    EMUMISS\n");
+        GT_0trace (curTrace, GT_4CLASS, "****    EMUMISS");
     if (mmuObj->mmuIrqStatus & MMU_IRQ_TABLEWALKFAULT)
-        GT_0trace (curTrace, GT_4CLASS, "****    TABLEWALKFAULT\n");
+        GT_0trace (curTrace, GT_4CLASS, "****    TABLEWALKFAULT");
     if (mmuObj->mmuIrqStatus & MMU_IRQ_MULTIHITFAULT)
-        GT_0trace (curTrace, GT_4CLASS, "****    MULTIHITFAULT\n");
+        GT_0trace (curTrace, GT_4CLASS, "****    MULTIHITFAULT");
     GT_0trace (curTrace, GT_4CLASS,
-               "**************************************************\n");
+               "**************************************************");
 
     /* Clear the interrupt and disable further interrupts. */
     REG32(halObject->mmuBase + MMU_MMU_IRQENABLE_OFFSET) = 0x0;
@@ -422,11 +422,14 @@ _VAYUDSP_halMmuInt_isr (Ptr arg)
 {
     VAYUDSP_HalObject * halObject = (VAYUDSP_HalObject *)arg;
     VAYUDSPPROC_Object * procObject = NULL;
+    Int32 status;
 
     GT_1trace (curTrace, GT_ENTER, "_VAYUDSP_halMmuInt_isr", arg);
-    VAYUDSPPROC_open((VAYUDSPPROC_Handle *)&procObject, halObject->procId);
-    Processor_setState(procObject->procHandle, ProcMgr_State_Mmu_Fault);
-    VAYUDSPPROC_close((VAYUDSPPROC_Handle *)&procObject);
+    status = VAYUDSPPROC_open((VAYUDSPPROC_Handle *)&procObject, halObject->procId);
+    if (status >= 0) {
+        Processor_setState(procObject->procHandle, ProcMgr_State_Mmu_Fault);
+        VAYUDSPPROC_close((VAYUDSPPROC_Handle *)&procObject);
+    }
 
     GT_1trace (curTrace, GT_LEAVE, "_VAYUDSP_halMmuInt_isr", TRUE);
 
index a0d5f510267dbec7f87a648c42830f2ec86a1b06..2f971f5dc5d4ab372aa0da6cbbf10e6862891cc7 100644 (file)
@@ -90,12 +90,22 @@ typedef struct VAYUDSP_HalObject_tag {
     /*!< Base address of the MMU module. */
     UInt32                mmuSysBase;
     /*!< Base address of the MMU module. */
+    UInt32                    ctrlModBase;
+    /*!< Base address of the control module. */
     UInt32                procId;
     /*!< Processor ID. */
     VAYUDSP_HalMmuObject mmuObj;
     /*!< MMU abstraction. */
 } VAYUDSP_HalObject;
 
+/*!
+ *  @brief  Hardware Abstraction object.
+ */
+typedef struct VAYUDSP_HalParams_tag {
+    UInt16                    procId;
+    /*!< ProcId of the DSP being created. */
+} VAYUDSP_HalParams;
+
 
 /* =============================================================================
  *  APIs
index 824947091cb7114128d754a3c482c268e3fd296f..eb2bb6142d3dbc959d0a070526900dd572d3d522 100644 (file)
@@ -124,6 +124,17 @@ extern "C" {
  */
 #define MMU_SIZE                0x1000
 
+/*!
+ *  @def    CTRL_MODULE_BASE
+ *  @brief  configuration address.
+ */
+#define CTRL_MODULE_BASE           0x4A002000
+
+/*!
+ *  @def    CTRL_MODULE_SIZE
+ *  @brief  size to be ioremapped.
+ */
+#define CTRL_MODULE_SIZE           0x1000
 
 /* =============================================================================
  *  APIs