Skip to content

Commit

Permalink
MDIA: command cleanup support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cnpalmer authored and zane131 committed Mar 20, 2018
1 parent 53635ae commit 4bc416f
Showing 1 changed file with 24 additions and 31 deletions.
55 changes: 24 additions & 31 deletions src/usr/diag/mdia/mdiasm.C
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand All @@ -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;
}

Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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
Expand Down

0 comments on commit 4bc416f

Please sign in to comment.