summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2013-06-14 12:08:56 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-07-02 10:44:34 -0500
commit872b09dc527e6e75e4d08e819e74e28157b1283a (patch)
tree71cf7354fc561b6aab1155d632de812f9b936599 /src/usr
parent617a9c843538beea63962903b7ca82e106bee660 (diff)
downloadtalos-hostboot-872b09dc527e6e75e4d08e819e74e28157b1283a.tar.gz
talos-hostboot-872b09dc527e6e75e4d08e819e74e28157b1283a.zip
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 <mjjones@us.ibm.com> Reviewed-by: SHELDON R. BAILEY <baileysh@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/hwas/common/deconfigGard.C68
-rw-r--r--src/usr/hwas/test/hwasGardTest.H377
-rw-r--r--src/usr/targeting/common/xmltohb/attribute_types.xml105
3 files changed, 499 insertions, 51 deletions
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<TARGETING::ATTR_CDM_POLICIES>();
+ 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<TARGETING::ATTR_CDM_POLICIES>();
+ 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<ATTR_PHYS_PATH>();
+
+ // 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<ATTR_CDM_POLICIES>();
+ l_policies = CDM_POLICIES_MANUFACTURING_DISABLED;
+ pSys->setAttr<ATTR_CDM_POLICIES>(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<ATTR_CDM_POLICIES>(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<ATTR_CDM_POLICIES>(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<ATTR_CDM_POLICIES>(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<ATTR_CDM_POLICIES>();
+ l_policies = CDM_POLICIES_MANUFACTURING_DISABLED;
+ pSys->setAttr<ATTR_CDM_POLICIES>(l_policies);
+
+ l_pErr = collectGard();
+ if (l_pErr)
+ {
+ TS_FAIL("testGard10: Error from collectGard");
+ break;
+ }
+
+ HwasState l_state = l_target->getAttr<ATTR_HWAS_STATE>();
+ 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<ATTR_CDM_POLICIES>(l_policies);
+
+ l_pErr = collectGard();
+ if (l_pErr)
+ {
+ TS_FAIL("testGard10: Error from collectGard");
+ break;
+ }
+
+ l_state = l_target->getAttr<ATTR_HWAS_STATE>();
+ 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<ATTR_CDM_POLICIES>(l_policies);
+
+ l_pErr = collectGard();
+ if (l_pErr)
+ {
+ TS_FAIL("testGard10: Error from collectGard");
+ break;
+ }
+
+ l_state = l_target->getAttr<ATTR_HWAS_STATE>();
+ 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<ATTR_CDM_POLICIES>(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)</descript
</hwpfToHbAttrMap>
</attribute>
+<attribute>
+ <id>CDM_POLICIES</id>
+ <description>
+ 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.
+ </description>
+ <simpleType>
+ <uint8_t>
+ <default>0x00</default>
+ </uint8_t>
+ </simpleType>
+ <persistency>non-volatile</persistency>
+ <writeable/>
+ <readable/>
+</attribute>
+
<enumerationType>
<id>CDM_POLICIES</id>
- <description>Cec Degraded Mode Policies</description>
+ <description>Enumeration of CDM_POLICIES flags</description>
<enumerator>
- <name>FUNCTIONAL</name>
- <value>0x00000001</value>
+ <description>
+ 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.
+ </description>
+ <name>FUNCTIONAL_DISABLED</name>
+ <value>0x01</value>
</enumerator>
<enumerator>
- <name>MANUFACTORING</name>
- <value>0x00000002</value>
+ <description>
+ 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.
+ </description>
+ <name>MANUFACTURING_DISABLED</name>
+ <value>0x02</value>
</enumerator>
<enumerator>
- <name>PREDICTIVE</name>
- <value>0x00000004</value>
+ <description>
+ 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.
+ </description>
+ <name>PREDICTIVE_DISABLED</name>
+ <value>0x04</value>
</enumerator>
- <default>NONE</default>
- </enumerationType>
-
-<attribute>
- <id>CDM_POLICIES</id>
- <description>Cec Degraded Mode Policies</description>
- <complexType>
- <description>Three boolean values</description>
- <field>
- <name>functional</name>
- <description>
- 0b0: Functional policy is disabled
- 0b1: Functional policy is enabled
- </description>
- <type>uint8_t</type>
- <bits>1</bits>
- <default>0</default>
- </field>
- <field>
- <name>manufacturing</name>
- <description>
- 0b0: Manufacturing policy enabled
- 0b1: Manufacturing policy disabled
- </description>
- <type>uint8_t</type>
- <bits>1</bits>
- <default>0</default>
- </field>
- <field>
- <name>predictive</name>
- <description>
- 0b0: predictive policy is enabled;
- 0b1: predictive policy is disabled
- </description>
- <type>uint8_t</type>
- <bits>1</bits>
- <default>0</default>
- </field>
- </complexType>
- <persistency>non-volatile</persistency>
- <writeable/>
- <readable/>
- <hasStringConversion/>
-</attribute>
+</enumerationType>
</attributes>
OpenPOWER on IntegriCloud