From 872b09dc527e6e75e4d08e819e74e28157b1283a Mon Sep 17 00:00:00 2001 From: Brian Horton Date: Fri, 14 Jun 2013 12:08:56 -0500 Subject: CDM policy flags doGard and createGardRecord will check for system-wide CDM policy, as well as policy in the GARD record and callout. Change-Id: I2abf572e5ed289ed8ac28edee022b23acca50274 RTC: 64693 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5034 Tested-by: Jenkins Server Reviewed-by: MIKE J. JONES Reviewed-by: SHELDON R. BAILEY Reviewed-by: A. Patrick Williams III --- src/usr/hwas/common/deconfigGard.C | 68 ++++ src/usr/hwas/test/hwasGardTest.H | 377 +++++++++++++++++++++ .../targeting/common/xmltohb/attribute_types.xml | 105 +++--- 3 files changed, 499 insertions(+), 51 deletions(-) (limited to 'src/usr') diff --git a/src/usr/hwas/common/deconfigGard.C b/src/usr/hwas/common/deconfigGard.C index 01e736129..1f237efa0 100644 --- a/src/usr/hwas/common/deconfigGard.C +++ b/src/usr/hwas/common/deconfigGard.C @@ -198,6 +198,22 @@ errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl( HWAS_MUTEX_LOCK(iv_mutex); do { + TARGETING::Target* pSys; + TARGETING::targetService().getTopLevelTarget(pSys); + HWAS_ASSERT(pSys, + "HWAS _createGardRecord: no system TopLevelTarget found"); + + // check for system CDM Policy + const TARGETING::ATTR_CDM_POLICIES_type l_sys_policy = + pSys->getAttr(); + if (l_sys_policy & TARGETING::CDM_POLICIES_MANUFACTURING_DISABLED) + { + // manufacturing records are disabled + // - don't process + HWAS_INF("Manufacturing policy: disabled - skipping GARD Records"); + break; + } + // Get all GARD Records l_pErr = _getGardRecords(GET_ALL_GARD_RECORDS, l_gardRecords); if (l_pErr) @@ -218,6 +234,24 @@ errlHndl_t DeconfigGard::deconfigureTargetsFromGardRecordsForIpl( l_itr != l_gardRecords.end(); ++l_itr) { + if ((l_sys_policy & TARGETING::CDM_POLICIES_PREDICTIVE_DISABLED) && + ((*l_itr).iv_errorType == GARD_Predictive)) + { + // predictive records are disabled AND gard record is predictive + // - don't process + HWAS_INF("Predictive policy: disabled - skipping GARD Record"); + continue; + } + + if ((l_sys_policy & TARGETING::CDM_POLICIES_FUNCTIONAL_DISABLED) && + ((*l_itr).iv_errorType == GARD_Func)) + { + // functional records are disabled AND gard record is Functional + // - don't process + HWAS_INF("Functional policy: disabled - skipping GARD Record"); + continue; + } + // Find the associated Target TARGETING::Target * l_pTarget = TARGETING::targetService().toTarget((*l_itr).iv_targetId); @@ -679,6 +713,40 @@ errlHndl_t DeconfigGard::_createGardRecord(const TARGETING::Target & i_target, break; } + TARGETING::Target* pSys; + TARGETING::targetService().getTopLevelTarget(pSys); + HWAS_ASSERT(pSys, + "HWAS _createGardRecord: no system TopLevelTarget found"); + + // check for system CDM Policy + const TARGETING::ATTR_CDM_POLICIES_type l_sys_policy = + pSys->getAttr(); + if (l_sys_policy & TARGETING::CDM_POLICIES_MANUFACTURING_DISABLED) + { + // manufacturing records are disabled + // - don't process + HWAS_INF("Manufacturing policy: disabled - skipping GARD Record"); + break; + } + + if ((l_sys_policy & TARGETING::CDM_POLICIES_PREDICTIVE_DISABLED) && + (i_errorType == GARD_Predictive)) + { + // predictive records are disabled AND gard record is predictive + // - don't process + HWAS_INF("Predictive policy: disabled - skipping GARD Record"); + break; + } + + if ((l_sys_policy & TARGETING::CDM_POLICIES_FUNCTIONAL_DISABLED) && + (i_errorType == GARD_Func)) + { + // functional records are disabled AND gard record is Functional + // - don't process + HWAS_INF("Functional policy: disabled - skipping GARD Record"); + break; + } + GardAddress l_GardAddress(l_pErr); if (l_pErr) { diff --git a/src/usr/hwas/test/hwasGardTest.H b/src/usr/hwas/test/hwasGardTest.H index 9c4d80001..cbb8d1f88 100644 --- a/src/usr/hwas/test/hwasGardTest.H +++ b/src/usr/hwas/test/hwasGardTest.H @@ -1228,6 +1228,383 @@ public: } #endif } + + /** + * @brief Test CDM modes to restrict createing GARD records + */ + void testGard9() + { + TS_TRACE(INFO_MRK "testGard9: Started"); +#if 1 + // these tests deconfigure and gard targets. and even tho they + // restore their state after the tests, since the cxxtests are + // all run in parallel, during the time that a target is non- + // functional due to this test, another test may be running that + // might be adversly affected. + // tests are left in the code so that a developer can enable them + // to test these specific functions - just keep in mind that there + // could be side effects in other cxxtests. + TS_TRACE( " - SKIPPING -- other tests could be adversly affected"); +#else + + errlHndl_t l_pErr = NULL; + DeconfigGard::GardRecords_t l_records; + + do + { + // find a core that we can play with + Target * pSys; + targetService().getTopLevelTarget(pSys); + + PredicateCTM predCore(CLASS_UNIT, TYPE_CORE); + PredicateHwas predFunctional; + predFunctional.poweredOn(true).present(true).functional(true); + PredicatePostfixExpr checkExpr; + checkExpr.push(&predCore).push(&predFunctional).And(); + TargetHandleList pCoreList; + targetService().getAssociated( pCoreList, pSys, + TargetService::CHILD, TargetService::ALL, &checkExpr ); + + if (pCoreList.empty()) + { + TS_FAIL("testGard9: empty pCoreList"); + break; + } + TargetHandle_t l_pTarget = *pCoreList.begin(); + + EntityPath l_id = l_pTarget->getAttr(); + + // Get any existing GARD Records for the target + l_pErr = theDeconfigGard().getGardRecords(l_id, l_records); + + if (l_pErr) + { + TS_FAIL("testGard9: Error from getGardRecords"); + break; + } + + if (l_records.size() != 0) + { + TS_TRACE(INFO_MRK "testGard9: target has %d existing Gard Records, skipping test", + l_records.size()); + break; + } + + // set Manufacturing policy to disabled, + // test that gard record is not created + ATTR_CDM_POLICIES_type l_policies = + pSys->getAttr(); + l_policies = CDM_POLICIES_MANUFACTURING_DISABLED; + pSys->setAttr(l_policies); + + // (try to) Create a GARD Record for the target. + l_pErr = theDeconfigGard(). + createGardRecord(*l_pTarget, 0x12, GARD_Fatal); + + if (l_pErr) + { + TS_FAIL("testGard9: Error from createGardRecord"); + break; + } + + // Get the GARD Records for the target - shouldn't be any + l_pErr = theDeconfigGard().getGardRecords(l_id, l_records); + + if (l_pErr) + { + TS_FAIL("testGard9: Error from getGardRecords (2)"); + break; + } + + if (l_records.size() != 0) + { + TS_FAIL("testGard9: %d records for target, expected 0", + l_records.size()); + break; + } + + // set Predictive policy to disabled + // test that gard record isn't created + l_policies = CDM_POLICIES_PREDICTIVE_DISABLED; + pSys->setAttr(l_policies); + + // (try to) Create a GARD Record for the target. + l_pErr = theDeconfigGard(). + createGardRecord(*l_pTarget, 0x12, GARD_Predictive); + + if (l_pErr) + { + TS_FAIL("testGard9: Error from createGardRecord"); + break; + } + + // Get the GARD Records for the target - shouldn't be any + l_pErr = theDeconfigGard().getGardRecords(l_id, l_records); + + if (l_pErr) + { + TS_FAIL("testGard9: Error from getGardRecords (2)"); + break; + } + + if (l_records.size() != 0) + { + TS_FAIL("testGard9: %d records for target, expected 0", + l_records.size()); + break; + } + + // set Functional policy to disabled + // test that gard record isn't created + l_policies = CDM_POLICIES_FUNCTIONAL_DISABLED; + pSys->setAttr(l_policies); + + // (try to) Create a GARD Record for the target. + l_pErr = theDeconfigGard(). + createGardRecord(*l_pTarget, 0x12, GARD_Func); + + if (l_pErr) + { + TS_FAIL("testGard9: Error from createGardRecord"); + break; + } + + // Get the GARD Records for the target - shouldn't be any + l_pErr = theDeconfigGard().getGardRecords(l_id, l_records); + + if (l_pErr) + { + TS_FAIL("testGard9: Error from getGardRecords (2)"); + break; + } + + if (l_records.size() != 0) + { + TS_FAIL("testGard9: %d records for target, expected 0", + l_records.size()); + break; + } + + // restore + l_policies = 0; + pSys->setAttr(l_policies); + TS_TRACE(INFO_MRK "testGard9: Success"); + } + while (0); + + if (l_pErr) + { + errlCommit(l_pErr,HWAS_COMP_ID); + } +#endif + } + + /** + * @brief Test CDM modes to restrict processing GARD records + */ + void testGard10() + { + TS_TRACE(INFO_MRK "testGard10: Started"); +#if 1 + // these tests deconfigure and gard targets. and even tho they + // restore their state after the tests, since the cxxtests are + // all run in parallel, during the time that a target is non- + // functional due to this test, another test may be running that + // might be adversly affected. + // tests are left in the code so that a developer can enable them + // to test these specific functions - just keep in mind that there + // could be side effects in other cxxtests. + TS_TRACE( " - SKIPPING -- other tests could be adversly affected"); +#else + errlHndl_t l_pErr = NULL; + DeconfigGard::GardRecords_t l_records; + + do + { + l_pErr = theDeconfigGard().getGardRecords( + DeconfigGard::GET_ALL_GARD_RECORDS, l_records); + if (l_pErr) + { + errlCommit(l_pErr,HWAS_COMP_ID); + TS_FAIL("testGard10: Error from getGardRecords"); + break; + } + + if (l_records.size() > 0) + { + TS_FAIL("testGard10: already GARD records here. %d records", + l_records.size()); + break; + } + + // find a core that we can play with + Target * pSys; + targetService().getTopLevelTarget(pSys); + + PredicateCTM predCore(CLASS_UNIT, TYPE_CORE); + PredicateHwas predFunctional; + predFunctional.poweredOn(true).present(true).functional(true); + PredicatePostfixExpr checkExpr; + checkExpr.push(&predCore).push(&predFunctional).And(); + + TargetHandleList pCoreList; + targetService().getAssociated( pCoreList, pSys, + TargetService::CHILD, TargetService::ALL, &checkExpr ); + + if (pCoreList.empty()) + { + TS_FAIL("testGard10: empty pCoreList"); + break; + } + + TargetHandle_t l_target = *pCoreList.begin(); + + // create GARD record, set Policy, call 'doGard' step and confirm + // target is NOT deconfigured + l_pErr = theDeconfigGard(). + createGardRecord( *l_target, 0x12, GARD_Predictive); + if (l_pErr) + { + TS_FAIL("testGard10: Error from createGardRecord"); + break; + } + + l_pErr = theDeconfigGard().getGardRecords( + DeconfigGard::GET_ALL_GARD_RECORDS, l_records); + if (l_pErr) + { + errlCommit(l_pErr,HWAS_COMP_ID); + TS_FAIL("testGard10: Error from getGardRecords"); + break; + } + if (l_records.size() != 1) + { + TS_FAIL("testGard10: should be 1 record; instead %d records", + l_records.size()); + break; + } + + // set Manufacturing policy to disabled, + // test that gard record is not created + ATTR_CDM_POLICIES_type l_policies = + pSys->getAttr(); + l_policies = CDM_POLICIES_MANUFACTURING_DISABLED; + pSys->setAttr(l_policies); + + l_pErr = collectGard(); + if (l_pErr) + { + TS_FAIL("testGard10: Error from collectGard"); + break; + } + + HwasState l_state = l_target->getAttr(); + if (!l_state.functional) + { + TS_FAIL("testGard10: target NOT functional"); + break; + } + + // set Predictive policy to disabled, + // test that gard record is not created + l_policies = CDM_POLICIES_PREDICTIVE_DISABLED; + pSys->setAttr(l_policies); + + l_pErr = collectGard(); + if (l_pErr) + { + TS_FAIL("testGard10: Error from collectGard"); + break; + } + + l_state = l_target->getAttr(); + if (!l_state.functional) + { + TS_FAIL("testGard10: target NOT functional"); + break; + } + + // Clear all GARD Records + l_pErr = theDeconfigGard(). + clearGardRecords(DeconfigGard::CLEAR_ALL_GARD_RECORDS); + + l_pErr = theDeconfigGard().getGardRecords( + DeconfigGard::GET_ALL_GARD_RECORDS, l_records); + if (l_pErr) + { + errlCommit(l_pErr,HWAS_COMP_ID); + TS_FAIL("testGard10: Error from getGardRecords"); + break; + } + if (l_records.size() != 0) + { + TS_FAIL("testGard10: should be 0 records; instead %d records", + l_records.size()); + break; + } + + // create GARD record, set Policy, call 'doGard' step and confirm + // target is NOT deconfigured + l_pErr = theDeconfigGard(). + createGardRecord( *l_target, 0x12, GARD_Func); + if (l_pErr) + { + TS_FAIL("testGard10: Error from createGardRecord"); + break; + } + + l_pErr = theDeconfigGard().getGardRecords( + DeconfigGard::GET_ALL_GARD_RECORDS, l_records); + if (l_pErr) + { + errlCommit(l_pErr,HWAS_COMP_ID); + TS_FAIL("testGard10: Error from getGardRecords"); + break; + } + if (l_records.size() != 1) + { + TS_FAIL("testGard10: should be 1 records; instead %d records", + l_records.size()); + break; + } + + // set Functional policy to disabled, + // test that gard record is not created + l_policies = CDM_POLICIES_FUNCTIONAL_DISABLED; + pSys->setAttr(l_policies); + + l_pErr = collectGard(); + if (l_pErr) + { + TS_FAIL("testGard10: Error from collectGard"); + break; + } + + l_state = l_target->getAttr(); + if (!l_state.functional) + { + TS_FAIL("testGard10: target NOT functional"); + break; + } + + // Clear all GARD Records + l_pErr = theDeconfigGard(). + clearGardRecords(DeconfigGard::CLEAR_ALL_GARD_RECORDS); + + // restore + l_policies = 0; + pSys->setAttr(l_policies); + TS_TRACE(INFO_MRK "testGard10: Success"); + } + while (0); + + if (l_pErr) + { + errlCommit(l_pErr,HWAS_COMP_ID); + } +#endif + } + }; #endif diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml index 5a4a9bd25..6631d7f8c 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types.xml @@ -12427,64 +12427,67 @@ firmware notes: Platforms should initialize this attribute to AUTO (0) + + CDM_POLICIES + + Cec Degraded Mode Policy flags + Use the CDM_POLICIES enum to decode. + If the appropriate bit is 1 then the policy mode is enabled, + and those type of Guard records are disabled. + + + + 0x00 + + + non-volatile + + + + CDM_POLICIES - Cec Degraded Mode Policies + Enumeration of CDM_POLICIES flags - FUNCTIONAL - 0x00000001 + + Functional_Guard policy: + Used in Field or development to prevent and disable the following: + . Storing or creation of new Guard records from diagnostics or other + faults through error logs with the error_type of Functional. + . Using an already stored System Guard record with error_type of + Functional from deconfiguring resources. + + FUNCTIONAL_DISABLED + 0x01 - MANUFACTORING - 0x00000002 + + MFG_Guard policy: + Used in MFG only to prevent and disable the following: + . Storing or creation of new Guard records from Diagnostic or other + faults through error logs. This is all domains, CEC + processor/memory, VPD, FSP, etc. + . Storing or creation of Manual Guard record from user. + NOTE: this does not stop FCO. + . Using an already stored System or Manual Guard record from + deconfiguring resources. This is all domains, CEC + processor/memory, VPD, FSP, etc. + + MANUFACTURING_DISABLED + 0x02 - PREDICTIVE - 0x00000004 + + Predictive_Guard policy: + Used in Field or development to prevent and disable the following: + . Storing or creation of new Guard records from diagnostics or other + faults through error logs with the error_type of Predictive. + . Using an already stored System Guard record with error_type of + Predictive from deconfiguring resources. + + PREDICTIVE_DISABLED + 0x04 - NONE - - - - CDM_POLICIES - Cec Degraded Mode Policies - - Three boolean values - - functional - - 0b0: Functional policy is disabled - 0b1: Functional policy is enabled - - uint8_t - 1 - 0 - - - manufacturing - - 0b0: Manufacturing policy enabled - 0b1: Manufacturing policy disabled - - uint8_t - 1 - 0 - - - predictive - - 0b0: predictive policy is enabled; - 0b1: predictive policy is disabled - - uint8_t - 1 - 0 - - - non-volatile - - - - + -- cgit v1.2.1