diff options
-rw-r--r-- | src/include/usr/hwas/deconfigGard.H | 42 | ||||
-rw-r--r-- | src/include/usr/hwas/hwas_reasoncodes.H | 7 | ||||
-rw-r--r-- | src/usr/hwas/deconfigGard.C | 99 | ||||
-rw-r--r-- | src/usr/hwas/hwas.C | 23 | ||||
-rw-r--r-- | src/usr/hwas/test/hwasGardTest.H | 99 |
5 files changed, 141 insertions, 129 deletions
diff --git a/src/include/usr/hwas/deconfigGard.H b/src/include/usr/hwas/deconfigGard.H index 25de080fc..c3254f50a 100644 --- a/src/include/usr/hwas/deconfigGard.H +++ b/src/include/usr/hwas/deconfigGard.H @@ -165,14 +165,13 @@ public: * Targets by association. Any errors deconfiguring targets are committed * and the function continues. The only errors returned are usage errors. * - * @param[in] i_target Reference to Target to deconfigure. - * @param[in] i_pErr Pointer to error log that will shortly be committed - * by the caller. + * @param[in] i_target Reference to Target to deconfigure. + * @param[in] i_errlPlid Error log PLID to store in Deconfigure Record. * * @return errlHndl_t. Error log handle. */ errlHndl_t deconfigureTarget(TARGETING::Target & i_target, - errlHndl_t i_pErr); + const uint32_t i_errlPlid); /** * @brief Creates a GARD Record for a Target. @@ -185,14 +184,13 @@ public: * Any error creating the GARD Record will be returned to the user. * * @param[in] i_target Reference to Target to create GARD Record for. - * @param[in] i_pErr Pointer to error log that will shortly be committed - * by the caller. + * @param[in] i_errlPlid Error log PLID to store in GARD Record. * @param[in] i_severity Severity of the GARD Record. * * @return errlHndl_t. Error log handle. */ errlHndl_t createGardRecord(const TARGETING::Target & i_target, - errlHndl_t i_pErr, + const uint32_t i_errlPlid, const GardSeverity i_severity); /** @@ -302,12 +300,11 @@ private: /** * @brief Deconfigures Targets by association. * - * @param[in] i_target Reference to base Target. - * @param[in] i_pErr Pointer to error log that will shortly be committed - * by the caller. + * @param[in] i_target Reference to base Target. + * @param[in] i_errlPlid Error log PLID to store in Deconfigure Record. */ void _deconfigureByAssoc(TARGETING::Target & i_target, - errlHndl_t i_pErr); + const uint32_t i_errlPlid); /** * @brief Deconfigures a Target. @@ -315,13 +312,12 @@ private: * This will Deconfigure the Target (set state to non-functional, do any * Deconfigure actions and create a Deconfigure Record). * - * @param[in] i_target Reference to Target to deconfigure. - * @param[in] i_pErr Pointer to error log that will shortly be committed - * by the caller. - * @param[in] i_cause Deconfigure cause. + * @param[in] i_target Reference to Target to deconfigure. + * @param[in] i_errlPlid Error log PLID to store in Deconfigure Record. + * @param[in] i_cause Deconfigure cause. */ void _deconfigureTarget(TARGETING::Target & i_target, - errlHndl_t i_pErr, + const uint32_t i_errlPlid, const DeconfigCause i_cause); /** @@ -334,13 +330,12 @@ private: /** * @brief Creates a Deconfigure Record * - * @param[in] i_target Reference to Target to create record for. - * @param[in] i_pErr Pointer to error log that will shortly be committed - * by the caller. - * @param[in] i_cause Deconfigure cause. + * @param[in] i_target Reference to Target to create record for. + * @param[in] i_errlPlid Error log PLID to store in Deconfigure Record. + * @param[in] i_cause Deconfigure cause. */ void _createDeconfigureRecord(const TARGETING::Target & i_target, - errlHndl_t i_pErr, + const uint32_t i_errlPlid, const DeconfigCause i_cause); public: @@ -374,14 +369,13 @@ private: * @brief Creates a GARD Record for a Target. * * @param[in] i_target Reference to Target to create GARD Record for. - * @param[in] i_pErr Pointer to error log that will shortly be committed - * by the caller. + * @param[in] i_errlPlid Error log PLID to store in GARD Record. * @param[in] i_severity Severity of the GARD Record. * * @return errlHndl_t. Error log handle. */ errlHndl_t _createGardRecord(const TARGETING::Target & i_target, - errlHndl_t i_pErr, + const uint32_t i_errlPlid, const GardSeverity i_severity); /** diff --git a/src/include/usr/hwas/hwas_reasoncodes.H b/src/include/usr/hwas/hwas_reasoncodes.H index 6e2b34858..a7ad56aae 100644 --- a/src/include/usr/hwas/hwas_reasoncodes.H +++ b/src/include/usr/hwas/hwas_reasoncodes.H @@ -34,9 +34,10 @@ namespace HWAS enum HwasReasonCode { - RC_TARGET_NOT_DECONFIGURABLE = HWAS_COMP_ID | 0x01, - RC_TARGET_NOT_GARDABLE = HWAS_COMP_ID | 0x02, - RC_GARD_REPOSITORY_FULL = HWAS_COMP_ID | 0x03, + RC_TARGET_NOT_DECONFIGURABLE = HWAS_COMP_ID | 0x01, + RC_TARGET_NOT_GARDABLE = HWAS_COMP_ID | 0x02, + RC_GARD_REPOSITORY_FULL = HWAS_COMP_ID | 0x03, + RC_TARGET_NOT_FOUND_FOR_GARD_RECORD = HWAS_COMP_ID | 0x04, }; }; diff --git a/src/usr/hwas/deconfigGard.C b/src/usr/hwas/deconfigGard.C index 84f6fc5a2..0e2390051 100644 --- a/src/usr/hwas/deconfigGard.C +++ b/src/usr/hwas/deconfigGard.C @@ -37,14 +37,20 @@ trace_desc_t* g_trac_deconf = NULL; #define __COMP_TD__ g_trac_deconf -// The DeconfigGard code needs to trace a target. The current recommended way is -// to get the Target's PHYS_PATH attribute and do a binary trace. However, the -// size of a TARGETING::EntityPath is 17 bytes. This code will trace only the -// first 16 bytes to avoid a multi-line binary trace. This all seems a little -// convoluted. Is there a better way to trace a Target +// TODO The DeconfigGard code needs to trace a target. The current recommended +// way is to get the Target's PHYS_PATH attribute and do a binary trace. +// However, the size of a TARGETING::EntityPath is more than 16 bytes. This code +// will trace only the first 16 bytes (which in most cases is enough) to avoid a +// multi-line binary trace. This all seems a little convoluted. Is there a +// better way to trace a Target #define DG_TRAC_TARGET(string, pPath) \ TRACFBIN(g_trac_deconf, string, pPath, sizeof(TARGETING::EntityPath) - 1) +// TODO There are a number of error logs created in this file. Most of them +// should include the target identifier (PHYS_PATH). There is a plan in RTC +// story 4110 to provide a way to easily add a target to an error log. When that +// is done need to update the error logs + namespace HWAS { @@ -88,11 +94,63 @@ errlHndl_t DeconfigGard::clearGardRecordsForReplacedTargets() //****************************************************************************** errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl() { - TRAC_INF("****TBD****Usr Request: Deconfigure Targets from GARD Records for IPL"); + TRAC_INF("Usr Request: Deconfigure Targets from GARD Records for IPL"); mutex_lock(&iv_mutex); errlHndl_t l_pErr = NULL; + GardRecords_t l_gardRecords; - // TODO + // TODO If deconfiguring all Targets with a GARD Record will result in a + // configuration that cannot IPL then need to figure out which + // subset of Targets to deconfigure to give the best chance of IPL + // This is known as Resource Recovery + + // Get all GARD Records + l_pErr = _getGardRecords(0, l_gardRecords); + + if (l_pErr) + { + TRAC_ERR("Error from _getGardRecords"); + } + else + { + TRAC_INF("%d GARD Records found", l_gardRecords.size()); + + // For each GARD Record + for (GardRecordsCItr_t l_itr = l_gardRecords.begin(); + l_itr != l_gardRecords.end(); ++l_itr) + { + // Find the associated Target + TARGETING::Target * l_pTarget = + TARGETING::targetService().toTarget((*l_itr).iv_targetId); + + if (l_pTarget == NULL) + { + DG_TRAC_TARGET(ERR_MRK "Could not find Target for", + &((*l_itr).iv_targetId)); + + /*@ + * @errortype + * @moduleid MOD_DECONFIG_GARD + * @reasoncode RC_TARGET_NOT_FOUND_FOR_GARD_RECORD + * @devdesc GARD Record could not be mapped to a Target + */ + l_pErr = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + MOD_DECONFIG_GARD, + RC_TARGET_NOT_FOUND_FOR_GARD_RECORD); + errlCommit(l_pErr, HWAS_COMP_ID); + } + else + { + // Deconfigure the Target + _deconfigureTarget(*l_pTarget, (*l_itr).iv_errlogPlid, + DECONFIG_CAUSE_GARD_RECORD); + + // Deconfigure other Targets by association + _deconfigureByAssoc(*l_pTarget, (*l_itr).iv_errlogPlid); + } + } + } mutex_unlock(&iv_mutex); return l_pErr; @@ -100,19 +158,16 @@ errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl() //****************************************************************************** errlHndl_t DeconfigGard::deconfigureTarget(TARGETING::Target & i_target, - errlHndl_t i_pErr) + const uint32_t i_errlPlid) { TRAC_ERR("Usr Request: Deconfigure Target"); mutex_lock(&iv_mutex); - - // Caller must pass a valid errlHndl_t - assert(i_pErr != NULL); // Deconfigure the Target - _deconfigureTarget(i_target, i_pErr, DECONFIG_CAUSE_FIRMWARE_REQ); + _deconfigureTarget(i_target, i_errlPlid, DECONFIG_CAUSE_FIRMWARE_REQ); // Deconfigure other Targets by association - _deconfigureByAssoc(i_target, i_pErr); + _deconfigureByAssoc(i_target, i_errlPlid); mutex_unlock(&iv_mutex); return NULL; @@ -120,12 +175,12 @@ errlHndl_t DeconfigGard::deconfigureTarget(TARGETING::Target & i_target, //****************************************************************************** errlHndl_t DeconfigGard::createGardRecord(const TARGETING::Target & i_target, - errlHndl_t i_pErr, + const uint32_t i_errlPlid, const GardSeverity i_severity) { TRAC_ERR("Usr Request: Create GARD Record"); mutex_lock(&iv_mutex); - errlHndl_t l_pErr = _createGardRecord(i_target, i_pErr, i_severity); + errlHndl_t l_pErr = _createGardRecord(i_target, i_errlPlid, i_severity); mutex_unlock(&iv_mutex); return l_pErr; } @@ -190,7 +245,7 @@ errlHndl_t DeconfigGard::getGardRecords( //****************************************************************************** void DeconfigGard::_deconfigureByAssoc(TARGETING::Target & i_target, - errlHndl_t i_pErr) + const uint32_t i_errlPlid) { TARGETING::EntityPath l_id = i_target.getAttr<TARGETING::ATTR_PHYS_PATH>(); DG_TRAC_TARGET(ERR_MRK "****TBD****: Deconfiguring by Association for: ", @@ -201,7 +256,7 @@ void DeconfigGard::_deconfigureByAssoc(TARGETING::Target & i_target, //****************************************************************************** void DeconfigGard::_deconfigureTarget(TARGETING::Target & i_target, - errlHndl_t i_pErr, + const uint32_t i_errlPlid, const DeconfigCause i_cause) { TARGETING::EntityPath l_id = i_target.getAttr<TARGETING::ATTR_PHYS_PATH>(); @@ -248,7 +303,7 @@ void DeconfigGard::_deconfigureTarget(TARGETING::Target & i_target, _doDeconfigureActions(i_target); // Create a Deconfigure Record - _createDeconfigureRecord(i_target, i_pErr, i_cause); + _createDeconfigureRecord(i_target, i_errlPlid, i_cause); } } @@ -261,7 +316,7 @@ void DeconfigGard::_doDeconfigureActions(TARGETING::Target & i_target) //****************************************************************************** void DeconfigGard::_createDeconfigureRecord( const TARGETING::Target & i_target, - errlHndl_t i_pErr, + const uint32_t i_errlPlid, const DeconfigCause i_cause) { // Get the Target's ID @@ -289,7 +344,7 @@ void DeconfigGard::_createDeconfigureRecord( DeconfigureRecord l_record; l_record.iv_targetId = l_id; - l_record.iv_errlogPlid = 0; // TODO Get PLID from ErrorLog + l_record.iv_errlogPlid = i_errlPlid; l_record.iv_cause = i_cause; l_record.iv_padding[0] = 0; l_record.iv_padding[1] = 0; @@ -380,7 +435,7 @@ void DeconfigGard::_getDeconfigureRecords( //****************************************************************************** errlHndl_t DeconfigGard::_createGardRecord(const TARGETING::Target & i_target, - errlHndl_t i_pErr, + const uint32_t i_errlPlid, const GardSeverity i_severity) { errlHndl_t l_pErr = NULL; @@ -447,7 +502,7 @@ errlHndl_t DeconfigGard::_createGardRecord(const TARGETING::Target & i_target, l_pRecord->iv_recordId = iv_nextGardRecordId++; l_pRecord->iv_targetId = l_id; // TODO Setup iv_cardMruSn or iv_chipMruEcid - l_pRecord->iv_errlogPlid = 0; // TODO Get PLID from ErrorLog + l_pRecord->iv_errlogPlid = i_errlPlid; l_pRecord->iv_severity = i_severity; l_pRecord->iv_padding[0] = 0; l_pRecord->iv_padding[1] = 0; diff --git a/src/usr/hwas/hwas.C b/src/usr/hwas/hwas.C index 0d0883ed7..b9e816d92 100644 --- a/src/usr/hwas/hwas.C +++ b/src/usr/hwas/hwas.C @@ -42,7 +42,7 @@ #include <targeting/targetservice.H> #include <fsi/fsiif.H> #include <hwas/hwas.H> - +#include <hwas/deconfigGard.H> namespace HWAS { @@ -162,6 +162,27 @@ void apply_gard( void *io_pArgs ) TRACDCOMP( g_trac_hwas, "apply_gard entry" ); + errlHndl_t l_errl = theDeconfigGard().clearGardRecordsForReplacedTargets(); + + if (l_errl) + { + TRACFCOMP(g_trac_hwas, "ERROR: apply_gard failed to clear GARD Records for replaced Targets"); + pTaskArgs->postErrorLog(l_errl); + } + else + { + l_errl = theDeconfigGard().deconfigureTargetsFromGardRecordsForIpl(); + + if (l_errl) + { + TRACFCOMP(g_trac_hwas, "ERROR: apply_gard failed to deconfigure Targets from GARD Records for IPL"); + pTaskArgs->postErrorLog(l_errl); + } + else + { + TRACFCOMP(g_trac_hwas, "apply_gard completed successfully"); + } + } // wait here on the barrier, then end the task. pTaskArgs->waitChildSync(); diff --git a/src/usr/hwas/test/hwasGardTest.H b/src/usr/hwas/test/hwasGardTest.H index d863072b3..4a73dc7ec 100644 --- a/src/usr/hwas/test/hwasGardTest.H +++ b/src/usr/hwas/test/hwasGardTest.H @@ -126,13 +126,6 @@ public: TARGETING::EntityPath l_id = l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>(); - // Create an error log to pass to the deconfigureTarget function, this - // will never be committed. - errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - HWAS::MOD_DECONFIG_GARD, - HWAS::RC_TARGET_NOT_DECONFIGURABLE); - do { // Get any existing Deconfigure Record for the chip @@ -155,9 +148,8 @@ public: TARGETING::HwasState l_origState = l_pTarget->getAttr<TARGETING::ATTR_HWAS_STATE>(); - // Deconfigure the chip - l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget, - l_pNewErr); + // Deconfigure the chip. Production code will pass a valid PLID + l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget, 0); if (l_pErr) { @@ -221,9 +213,6 @@ public: } while (0); - delete l_pNewErr; - l_pNewErr = NULL; - if (l_pErr) { errlCommit(l_pErr,HWAS_COMP_ID); @@ -246,13 +235,6 @@ public: TARGETING::EntityPath l_id = l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>(); - // Create an error log to pass to the deconfigureTarget function, this - // will never be committed. - errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - HWAS::MOD_DECONFIG_GARD, - HWAS::RC_TARGET_NOT_DECONFIGURABLE); - do { // Get any existing Deconfigure Record for the chip @@ -275,9 +257,8 @@ public: TARGETING::HwasState l_origState = l_pTarget->getAttr<TARGETING::ATTR_HWAS_STATE>(); - // Deconfigure the chip - l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget, - l_pNewErr); + // Deconfigure the chip. Production code will pass a valid PLID + l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget, 0); if (l_pErr) { @@ -286,8 +267,7 @@ public: } // Deconfigure the chip again - l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget, - l_pNewErr); + l_pErr = HWAS::theDeconfigGard().deconfigureTarget(*l_pTarget, 0); if (l_pErr) { @@ -333,9 +313,6 @@ public: } while (0); - delete l_pNewErr; - l_pNewErr = NULL; - if (l_pErr) { errlCommit(l_pErr,HWAS_COMP_ID); @@ -446,13 +423,6 @@ public: TARGETING::EntityPath l_id = l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>(); - // Create an error log to pass to the createGardRecord function, this - // will never be committed. - errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - HWAS::MOD_DECONFIG_GARD, - HWAS::RC_TARGET_NOT_DECONFIGURABLE); - do { // Get any existing GARD Records for the chip @@ -471,9 +441,10 @@ public: break; } - // Create a GARD Record for the chip + // Create a GARD Record for the chip. Production code will pass a + // valid PLID l_pErr = HWAS::theDeconfigGard(). - createGardRecord(*l_pTarget, l_pNewErr, + createGardRecord(*l_pTarget, 0, HWAS::DeconfigGard::GARD_SEVERITY_PREDICTIVE); if (l_pErr) @@ -537,9 +508,6 @@ public: } while (0); - delete l_pNewErr; - l_pNewErr = NULL; - if (l_pErr) { errlCommit(l_pErr,HWAS_COMP_ID); @@ -562,13 +530,6 @@ public: TARGETING::EntityPath l_id = l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>(); - // Create an error log to pass to the createGardRecord function, this - // will never be committed. - errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - HWAS::MOD_DECONFIG_GARD, - HWAS::RC_TARGET_NOT_DECONFIGURABLE); - do { // Get any existing GARD Records for the chip @@ -587,9 +548,10 @@ public: break; } - // Create a GARD Record for the chip + // Create a GARD Record for the chip. Production code will pass a + // valid PLID l_pErr = HWAS::theDeconfigGard(). - createGardRecord(*l_pTarget, l_pNewErr, + createGardRecord(*l_pTarget, 0, HWAS::DeconfigGard::GARD_SEVERITY_PREDICTIVE); if (l_pErr) @@ -600,7 +562,7 @@ public: // Create another GARD Record for the chip l_pErr = HWAS::theDeconfigGard(). - createGardRecord(*l_pTarget, l_pNewErr, + createGardRecord(*l_pTarget, 0, HWAS::DeconfigGard::GARD_SEVERITY_FATAL); if (l_pErr) @@ -656,9 +618,6 @@ public: } while (0); - delete l_pNewErr; - l_pNewErr = NULL; - if (l_pErr) { errlCommit(l_pErr,HWAS_COMP_ID); @@ -680,13 +639,6 @@ public: TARGETING::targetService().masterProcChipTargetHandle(l_pTarget); TARGETING::EntityPath l_id = l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>(); - - // Create an error log to pass to the createGardRecord function, this - // will never be committed. - errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - HWAS::MOD_DECONFIG_GARD, - HWAS::RC_TARGET_NOT_DECONFIGURABLE); do { @@ -706,9 +658,10 @@ public: break; } - // Create a GARD Record for the chip + // Create a GARD Record for the chip. Production code will pass a + // valid PLID l_pErr = HWAS::theDeconfigGard(). - createGardRecord(*l_pTarget, l_pNewErr, + createGardRecord(*l_pTarget, 0, HWAS::DeconfigGard::GARD_SEVERITY_PREDICTIVE); if (l_pErr) @@ -719,7 +672,7 @@ public: // Create another GARD Record for the chip l_pErr = HWAS::theDeconfigGard(). - createGardRecord(*l_pTarget, l_pNewErr, + createGardRecord(*l_pTarget, 0, HWAS::DeconfigGard::GARD_SEVERITY_FATAL); if (l_pErr) @@ -804,9 +757,6 @@ public: } while (0); - delete l_pNewErr; - l_pNewErr = NULL; - if (l_pErr) { errlCommit(l_pErr,HWAS_COMP_ID); @@ -829,13 +779,6 @@ public: TARGETING::EntityPath l_id = l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>(); - // Create an error log to pass to the createGardRecord function, this - // will never be committed. - errlHndl_t l_pNewErr = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - HWAS::MOD_DECONFIG_GARD, - HWAS::RC_TARGET_NOT_DECONFIGURABLE); - do { // Get all existing GARD Records @@ -854,9 +797,10 @@ public: break; } - // Create a GARD Record for the chip + // Create a GARD Record for the chip. Production code will pass a + // valid PLID l_pErr = HWAS::theDeconfigGard(). - createGardRecord(*l_pTarget, l_pNewErr, + createGardRecord(*l_pTarget, 0, HWAS::DeconfigGard::GARD_SEVERITY_PREDICTIVE); if (l_pErr) @@ -867,7 +811,7 @@ public: // Create another GARD Record for the chip l_pErr = HWAS::theDeconfigGard(). - createGardRecord(*l_pTarget, l_pNewErr, + createGardRecord(*l_pTarget, 0, HWAS::DeconfigGard::GARD_SEVERITY_FATAL); if (l_pErr) @@ -907,9 +851,6 @@ public: } while (0); - delete l_pNewErr; - l_pNewErr = NULL; - if (l_pErr) { errlCommit(l_pErr,HWAS_COMP_ID); |