From 05c9e64889edbedd858b5db4af45d67cafd60e44 Mon Sep 17 00:00:00 2001 From: Chris Cain Date: Fri, 29 Apr 2016 07:59:12 -0500 Subject: Add way to clear reset count and exit safe mode Change-Id: I88de38fe700770abadb90b442f47198eb3532c87 Original-Change-Id: I82c56f8684f5ca3cee14a3e7bcdee968b65513fb RTC: 149231 ForwardPort: yes Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/23998 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24108 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- src/usr/htmgt/htmgt_occ.C | 124 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 108 insertions(+), 16 deletions(-) (limited to 'src/usr/htmgt/htmgt_occ.C') diff --git a/src/usr/htmgt/htmgt_occ.C b/src/usr/htmgt/htmgt_occ.C index d76b9e800..e0aa26c55 100644 --- a/src/usr/htmgt/htmgt_occ.C +++ b/src/usr/htmgt/htmgt_occ.C @@ -505,6 +505,26 @@ namespace HTMGT } // end OccManager::_addOcc() + // Get pointer to specified OCC + Occ * OccManager::_getOcc(const uint8_t i_instance) + { + Occ *targetOcc = NULL; + for (std::vector::iterator pOcc = iv_occArray.begin(); + pOcc < iv_occArray.end(); + pOcc++) + { + if ((*pOcc)->getInstance() == i_instance) + { + targetOcc = (*pOcc); + break; + } + } + + return targetOcc; + + } // eng OccManager::_getOcc() + + // Set the OCC state errlHndl_t OccManager::_setOccState(const occStateId i_state) { @@ -666,7 +686,8 @@ namespace HTMGT errlHndl_t OccManager::_resetOccs(TARGETING::Target * i_failedOccTarget, - bool i_skipCountIncrement) + bool i_skipCountIncrement, + bool i_skipComm) { errlHndl_t err = NULL; bool atThreshold = false; @@ -682,13 +703,16 @@ namespace HTMGT ERRORLOG::errlCommit(err, HTMGT_COMP_ID); } - // Send poll cmd to all OCCs to establish comm - err = _sendOccPoll(false,NULL); - if (err) + if (false == i_skipComm) { - TMGT_ERR("_resetOccs: Poll OCCs failed."); - // Proceed with reset even if failed - ERRORLOG::errlCommit(err, HTMGT_COMP_ID); + // Send poll cmd to all OCCs to establish comm + err = _sendOccPoll(false,NULL); + if (err) + { + TMGT_ERR("_resetOccs: Poll OCCs failed."); + // Proceed with reset even if failed + ERRORLOG::errlCommit(err, HTMGT_COMP_ID); + } } for(occList_t::const_iterator occ = iv_occArray.begin(); @@ -700,15 +724,20 @@ namespace HTMGT (*occ)->failed(true); } - if((*occ)->resetPrep()) + + if (false == i_skipComm) { - atThreshold = true; + // Send reset prep cmd to all OCCs + if((*occ)->resetPrep()) + { + atThreshold = true; + } } } if ((false == i_skipCountIncrement) && (false == _occFailed())) { - // No OCC has been marked failed, increment system reset count + // No OCC has been marked failed, increment sys reset count ++iv_resetCount; TMGT_INF("_resetOCCs: Incrementing system OCC reset count" @@ -719,7 +748,15 @@ namespace HTMGT atThreshold = true; } } - // else the failed OCC reset count will be incremented automatically + // else failed OCC reset count will be incremented automatically + + // Update OCC states to RESET + for(occList_t::const_iterator occ = iv_occArray.begin(); + occ != iv_occArray.end(); + ++occ) + { + (*occ)->iv_state = OCC_STATE_RESET; + } uint64_t retryCount = OCC_RESET_COUNT_THRESHOLD; while(retryCount) @@ -813,11 +850,12 @@ namespace HTMGT TARGETING::targetService().getTopLevelTarget(sys); const uint8_t safeMode = 1; - // Put into safemode + // Mark system as being in safe mode if(sys) { sys->setAttr(safeMode); } + iv_state = OCC_STATE_SAFE; _updateSafeModeReason(io_err->reasonCode(), 0); @@ -908,9 +946,11 @@ namespace HTMGT void OccManager::_updateSafeModeReason(uint32_t i_src, uint32_t i_instance) { - if (cv_safeReturnCode == 0) + if ((cv_safeReturnCode == 0) || + ((i_src == 0) && (i_instance == 0))) { - // Only update safe mode reason for the first failure + // Only update safe mode reason for the first failure, + // or if trying to clear safe mode cv_safeReturnCode = i_src; cv_safeOccInstance = i_instance; } @@ -1088,6 +1128,42 @@ namespace HTMGT } + // Clear all OCC reset counts + void OccManager::_clearResetCounts() + { + TARGETING::Target* sys = NULL; + TARGETING::targetService().getTopLevelTarget(sys); + uint8_t safeMode = 0; + if (sys) + { + sys->tryGetAttr(safeMode); + } + for (std::vector::iterator pOcc = iv_occArray.begin(); + pOcc < iv_occArray.end(); + pOcc++) + { + if ((*pOcc)->iv_resetCount != 0) + { + TMGT_INF("_clearResetCounts: Clearing OCC%d reset count " + "(was %d)", + (*pOcc)->getInstance(), (*pOcc)->iv_resetCount); + (*pOcc)->iv_resetCount = 0; + if (safeMode) + { + // Clear OCC flags (failed, commEstablished, etc) + (*pOcc)->postResetClear(); + } + } + } + if (iv_resetCount != 0) + { + TMGT_INF("_clearResetCounts: Clearing system reset count " + "(was %d)", iv_resetCount); + iv_resetCount = 0; + } + } + + uint8_t OccManager::getNumOccs() { return Singleton::instance()._getNumOccs(); @@ -1112,15 +1188,26 @@ namespace HTMGT } + Occ * OccManager::getOcc(const uint8_t i_instance) + { + return Singleton::instance()._getOcc(i_instance); + } + + errlHndl_t OccManager::setOccState(const occStateId i_state) { return Singleton::instance()._setOccState(i_state); } - errlHndl_t OccManager::resetOccs(TARGETING::Target * i_failedOccTarget) + + errlHndl_t OccManager::resetOccs(TARGETING::Target * i_failedOccTarget, + bool i_skipCountIncrement, + bool i_skipComm) { return - Singleton::instance()._resetOccs(i_failedOccTarget); + Singleton::instance()._resetOccs(i_failedOccTarget, + i_skipCountIncrement, + i_skipComm); } @@ -1178,6 +1265,11 @@ namespace HTMGT Singleton::instance()._setPstateTable(i_useNormal); } + void OccManager::clearResetCounts() + { + Singleton::instance()._clearResetCounts(); + } + void OccManager::syncOccStates() { Singleton::instance()._syncOccStates(); -- cgit v1.2.1