diff options
author | Caleb Palmer <cnpalmer@us.ibm.com> | 2018-03-13 10:17:11 -0500 |
---|---|---|
committer | Zane C. Shelley <zshelle@us.ibm.com> | 2018-03-20 16:41:33 -0400 |
commit | 4bc416f75e08ddfb2a7091f834b5c6d8e38e352e (patch) | |
tree | a9faf3698269f3445a921a950f5bcd9b1ba1193e | |
parent | 53635aee49253b8e2a87fb21d347a84e7c9a8448 (diff) | |
download | talos-hostboot-4bc416f75e08ddfb2a7091f834b5c6d8e38e352e.tar.gz talos-hostboot-4bc416f75e08ddfb2a7091f834b5c6d8e38e352e.zip |
MDIA: command cleanup support
Change-Id: I1d89de799548bf1b26caa3b2e9571a8e6f6076a7
RTC: 157895
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/55779
CI-Ready: Zane C. Shelley <zshelle@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com>
Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com>
Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com>
-rw-r--r-- | src/usr/diag/mdia/mdiasm.C | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/src/usr/diag/mdia/mdiasm.C b/src/usr/diag/mdia/mdiasm.C index 000aeb9e8..743d40deb 100644 --- a/src/usr/diag/mdia/mdiasm.C +++ b/src/usr/diag/mdia/mdiasm.C @@ -601,20 +601,16 @@ void StateMachine::processCommandTimeout(const MonitorIDs & i_monitorIDs) // target type is MBA if ( TYPE_MBA == trgtType ) { - fapi2::ReturnCode fapirc = - static_cast<mss_MaintCmd *>((*wit)->data)->stopCmd(); - err = fapi2::rcToErrl(fapirc); - + FAPI_INVOKE_HWP( err, + static_cast<mss_MaintCmd *>((*wit)->data)->stopCmd ); if( nullptr != err ) { MDIA_ERR("sm: mss_MaintCmd::stopCmd failed"); errlCommit(err, MDIA_COMP_ID); } - fapirc = - static_cast<mss_MaintCmd *>((*wit)->data)->cleanupCmd(); - err = fapi2::rcToErrl(fapirc); - + FAPI_INVOKE_HWP( err, + static_cast<mss_MaintCmd *>((*wit)->data)->cleanupCmd ); if( nullptr != err ) { MDIA_ERR("sm: mss_MaintCmd::cleanupCmd failed"); @@ -1109,13 +1105,8 @@ errlHndl_t StateMachine::doMaintCommand(WorkFlowProperties & i_wfp) break; } - fapi2::ReturnCode fapirc = mss_get_address_range( - fapiMba, - MSS_ALL_RANKS, - startAddr, - endAddr); - err = fapi2::rcToErrl(fapirc); - + FAPI_INVOKE_HWP( err, mss_get_address_range, fapiMba, MSS_ALL_RANKS, + startAddr, endAddr ); if(err) { MDIA_FAST("sm: get_address_range failed"); @@ -1203,9 +1194,7 @@ errlHndl_t StateMachine::doMaintCommand(WorkFlowProperties & i_wfp) // Command and address configured. // Invoke the command. - fapirc = cmd->setupAndExecuteCmd(); - - err = fapi2::rcToErrl(fapirc); + FAPI_INVOKE_HWP( err, cmd->setupAndExecuteCmd ); if( nullptr != err ) { MDIA_FAST("sm: setupAndExecuteCmd %p failed", target); @@ -1411,8 +1400,6 @@ bool StateMachine::processMaintCommandEvent(const MaintCommandEvent & i_event) // done with this maint command flags = DELETE_CMD | START_NEXT_CMD; - wfp.data = NULL; - break; case STOP_TESTING: @@ -1423,19 +1410,16 @@ bool StateMachine::processMaintCommandEvent(const MaintCommandEvent & i_event) // done with this command flags = DELETE_CMD | STOP_CMD | START_NEXT_CMD; - wfp.data = NULL; break; case RESET_TIMER: - flags = CLEANUP_CMD; + flags = CLEANUP_CMD | DELETE_CMD; break; default: - // this shouldn't happen, but if it does - // free up the memory - flags = DELETE_CMD; - wfp.data = NULL; + assert( false, "processMaintCommandEvent: unsupported event " + "type" ); break; } @@ -1444,13 +1428,22 @@ bool StateMachine::processMaintCommandEvent(const MaintCommandEvent & i_event) { mss_MaintCmd * cmd = static_cast<mss_MaintCmd *>(wfp.data); - if(cmd && (flags & STOP_CMD)) + // It's possible PRD sent RESET_TIMER and started a command on this + // target so we need to use a dummy command here since cmd might be + // null. It is safe to create a dummy command object because the + // stopCmd() function is generic for all command types. Also, since + // we are only stopping the command, all of the parameters for the + // command object are junk except for the target. + if( flags & STOP_CMD ) { MDIA_FAST("sm: stopping command: %p", target); - fapi2::ReturnCode fapirc = cmd->stopCmd(); - err = fapi2::rcToErrl(fapirc); + fapi2::buffer<uint64_t> i_startAddr, i_endAddr; + fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiMba(target); + mss_SuperFastRead dummyCmd{ fapiMba, i_startAddr, i_endAddr, 0, + false }; + FAPI_INVOKE_HWP( err, dummyCmd.stopCmd ); if (nullptr != err) { MDIA_ERR("sm: mss_MaintCmd::stopCmd failed"); @@ -1463,8 +1456,7 @@ bool StateMachine::processMaintCommandEvent(const MaintCommandEvent & i_event) // restore any init settings that // may have been changed by the command - fapi2::ReturnCode fapirc = cmd->cleanupCmd(); - err = fapi2::rcToErrl(fapirc); + FAPI_INVOKE_HWP( err, cmd->cleanupCmd ); if(nullptr != err) { MDIA_ERR("sm: mss_MaintCmd::cleanupCmd failed"); @@ -1475,6 +1467,7 @@ bool StateMachine::processMaintCommandEvent(const MaintCommandEvent & i_event) if(cmd && (flags & DELETE_CMD)) { delete cmd; + wfp.data = NULL; } } //target type is MCBIST |