>From 65f3a829ceb76793e2fd067758878aa82985ecb7 Mon Sep 17 00:00:00 2001
From: Hari Kanigeri <[email protected]>
Date: Thu, 26 Mar 2009 16:50:04 -0500
Subject: [PATCH] DSPBRIDGE: Handle Node operations when DSP is in error state

Handle Node operations when DSP is in error state.

Signed-off-by: Hari Kanigeri <[email protected]>
---
 drivers/dsp/bridge/rmgr/node.c |   45 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/node.c b/drivers/dsp/bridge/rmgr/node.c
index 1fae5d9..5d58e68 100755
--- a/drivers/dsp/bridge/rmgr/node.c
+++ b/drivers/dsp/bridge/rmgr/node.c
@@ -429,6 +429,7 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJECT *hProcessor,
        struct CFG_HOSTRES hostRes;
        u32 pMappedAddr = 0;
        u32 mapAttrs = 0x0;
+       struct DSP_PROCESSORSTATE procStatus;
 #ifdef DSP_DMM_DEBUG
        struct DMM_OBJECT *hDmmMgr;
        struct PROC_OBJECT *pProcObject = (struct PROC_OBJECT *)hProcessor;
@@ -471,6 +472,20 @@ DSP_STATUS NODE_Allocate(struct PROC_OBJECT *hProcessor,
        if (DSP_FAILED(status))
                goto func_cont;
 
+       status = PROC_GetState(hProcessor, &procStatus,
+                       sizeof(struct DSP_PROCESSORSTATE));
+       if (DSP_FAILED(status))
+               goto func_end;
+       /* If processor is in error state then don't attempt
+           to send the message */
+       if (procStatus.iState == PROC_ERROR) {
+               GT_1trace(NODE_debugMask, GT_5CLASS,
+                       "NODE_Allocate: proc Status 0x%x\n",
+                       procStatus.iState);
+               status = DSP_EFAIL;
+               goto func_end;
+       }
+
        /* Assuming that 0 is not a valid function address */
        if (hNodeMgr->ulFxnAddrs[0] == 0) {
                /* No RMS on target - we currently can't handle this */
@@ -839,6 +854,7 @@ func_cont2:
        DBC_Ensure((DSP_FAILED(status) && (*phNode == NULL)) ||
                  (DSP_SUCCEEDED(status)
                    && MEM_IsValidHandle((*phNode), NODE_SIGNATURE)));
+func_end:
        return status;
 }
 
@@ -3374,21 +3390,42 @@ DSP_STATUS NODE_GetUUIDProps(DSP_HPROCESSOR hProcessor,
        struct DEV_OBJECT *hDevObject;
        DSP_STATUS status = DSP_SOK;
        struct DCD_NODEPROPS   dcdNodeProps;
+       struct DSP_PROCESSORSTATE procStatus;
 
        DBC_Require(cRefs > 0);
        DBC_Require(hProcessor != NULL);
        DBC_Require(pNodeId != NULL);
 
+       if (hProcessor == NULL || pNodeId == NULL) {
+               status = DSP_EHANDLE;
+               goto func_end;
+       }
+       status = PROC_GetState(hProcessor, &procStatus,
+                       sizeof(struct DSP_PROCESSORSTATE));
+       if (DSP_FAILED(status))
+               goto func_end;
+       /* If processor is in error state then don't attempt
+           to send the message */
+       if (procStatus.iState == PROC_ERROR) {
+               GT_1trace(NODE_debugMask, GT_5CLASS,
+                       "NODE_GetUUIDProps: proc Status 0x%x\n",
+                       procStatus.iState);
+               status = DSP_EFAIL;
+               goto func_end;
+       }
+
        GT_3trace(NODE_debugMask, GT_ENTER,
                 "NODE_GetUUIDProps: " "\thProcessor: "
                 "0x%x\tpNodeId: 0x%x" "\tpNodeProps: 0x%x\n", hProcessor,
                 pNodeId, pNodeProps);
 
        status = PROC_GetDevObject(hProcessor, &hDevObject);
-       if (DSP_SUCCEEDED(status)) {
+       if (DSP_SUCCEEDED(status) && hDevObject != NULL) {
                status = DEV_GetNodeManager(hDevObject, &hNodeMgr);
-               if (hNodeMgr == NULL)
-                       status = DSP_EFAIL;
+               if (hNodeMgr == NULL) {
+                       status = DSP_EHANDLE;
+                       goto func_end;
+               }
        }
 
        /*  Enter the critical section.  This is needed because
@@ -3425,7 +3462,7 @@ DSP_STATUS NODE_GetUUIDProps(DSP_HPROCESSOR hProcessor,
                (void)SYNC_LeaveCS(hNodeMgr->hSync);
 
        }
-
+func_end:
        return status;
 }
 
-- 
1.5.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to