diff options
author | Bill Hoffa <wghoffa@us.ibm.com> | 2018-02-19 16:13:38 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-03-29 12:04:12 -0400 |
commit | a17b84a6678febef7ced9f0908cf39d5f16671df (patch) | |
tree | 1b04a814892935ad9f005d165e41564c4ffff57a /src/usr/fapi2/test | |
parent | 90eaed6f430c88eb0127ce47671bd80b21f35433 (diff) | |
download | talos-hostboot-a17b84a6678febef7ced9f0908cf39d5f16671df.tar.gz talos-hostboot-a17b84a6678febef7ced9f0908cf39d5f16671df.zip |
Enable FAPI Cumulus test cases
- Only run MCBIST/MCS/MCA testcases on Nimbus procs
- Add MC/MI/DMI testcases on Cumulus procs
Change-Id: Ica5783c2694ef549e81ad8eb484cc62bdc499de0
RTC: 178802
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/54396
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@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: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2/test')
-rw-r--r-- | src/usr/fapi2/test/fapi2GetChildrenTest.H | 391 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2GetParentTest.H | 435 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2HwAccessTest.H | 40 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2HwpTest.H | 184 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2IsFunctionalTest.H | 24 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2TestUtils.C | 164 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2TestUtils.H | 30 | ||||
-rw-r--r-- | src/usr/fapi2/test/p9_sample_procedure.C | 73 | ||||
-rw-r--r-- | src/usr/fapi2/test/p9_sample_procedure.H | 18 |
9 files changed, 943 insertions, 416 deletions
diff --git a/src/usr/fapi2/test/fapi2GetChildrenTest.H b/src/usr/fapi2/test/fapi2GetChildrenTest.H index 0f382b357..819e61feb 100644 --- a/src/usr/fapi2/test/fapi2GetChildrenTest.H +++ b/src/usr/fapi2/test/fapi2GetChildrenTest.H @@ -41,6 +41,24 @@ namespace fapi2 class Fapi2GetChildrenTest : public CxxTest::TestSuite { public: + + + struct pervasiveChildTestRec { + + // Expected number of children + uint32_t expectedSize; + + // Lambda function specifying which pervasive chip units map to + // children of the type implied by the body of the lambda function + // below + bool (*unitMapsToRightTargetType)(TARGETING::ATTR_CHIP_UNIT_type); + + // Lambda function taking a pervasive target and returning the + // number of children it has for a given FAPI type + size_t (*actualSize)(Target<fapi2::TARGET_TYPE_PERV>&); + + }; + //****************************************************************************** // test_fapi2GetChildren //****************************************************************************** @@ -51,9 +69,10 @@ void test_fapi2GetChildren() uint32_t l_targetHuid = 0xFFFFFFFF; uint32_t l_actualSize = 0; uint32_t l_expectedSize = 0; - errlHndl_t l_err = NULL; - TARGETING::Target * l_nimbusProc = NULL; - TARGETING::Target * l_cumulusProc = NULL; + errlHndl_t l_err = nullptr; + TARGETING::Target * l_nimbusProc = nullptr; + TARGETING::Target * l_cumulusProc = nullptr; + TARGETING::Target * l_proc = nullptr; do { // Create a vector of TARGETING::Target pointers @@ -79,41 +98,48 @@ void test_fapi2GetChildren() } } numTests++; - if(l_cumulusProc) + if (l_nimbusProc != nullptr) { - // @todo RTC 178802 Enable test cases turned off during bring up - // This test needs to be updated for Cumulus - break; + l_proc = l_nimbusProc; + } + else if (l_cumulusProc != nullptr) + { + l_proc = l_cumulusProc; } - if(l_nimbusProc == NULL) + else //both are nullptr { // Send an errorlog because we cannot find any NIMBUS procs. - FAPI_ERR("FAPI2_GETPARENT:: could not find Nimbus proc, skipping tests"); + FAPI_ERR("FAPI2_GETCHILDREN:: could not find any procs, skipping tests"); numFails++; /*@ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE * @moduleid fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST * @reasoncode fapi2::RC_NO_PROCS_FOUND * @userdata1 Model Type we looked for - * @userdata2 Unused - * @devdesc Could not find NIMBUS procs in system model + * @userdata2 Other Model Type we looked for + * @devdesc Could not find any procs in system model */ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST, fapi2::RC_NO_PROCS_FOUND, TARGETING::MODEL_NIMBUS, - NULL, + TARGETING::MODEL_CUMULUS, true/*SW Error*/); errlCommit(l_err,HWPF_COMP_ID); break; } TARGETING::Target* targeting_targets[fapi2::NUM_TARGETS]; - generateTargets(l_nimbusProc, targeting_targets); + generateTargets(l_proc, targeting_targets); for( uint64_t x = 0; x < fapi2::NUM_TARGETS; x++ ) { - if(targeting_targets[x] == NULL) + //Skip tests where the HW unit to test isn't valid for the proc type + if (!isHwValid(l_proc, x)) + { + continue; + } + else if(targeting_targets[x] == nullptr) { FAPI_ERR("Unable to find target for item %d in targeting_targets", x); /*@ @@ -134,8 +160,9 @@ void test_fapi2GetChildren() } } + Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget( - l_nimbusProc); + l_proc); Target<fapi2::TARGET_TYPE_EQ> fapi2_eqTarget( targeting_targets[MY_EQ]); Target<fapi2::TARGET_TYPE_EX> fapi2_exTarget( @@ -144,31 +171,59 @@ void test_fapi2GetChildren() targeting_targets[MY_MCS]);; Target<fapi2::TARGET_TYPE_MCBIST> fapi2_mcbistTarget( targeting_targets[MY_MCBIST]); - - + Target<fapi2::TARGET_TYPE_MC> fapi2_mcTarget( + targeting_targets[MY_MC]); + Target<fapi2::TARGET_TYPE_MI> fapi2_miTarget( + targeting_targets[MY_MI]); std::vector<Target<fapi2::TARGET_TYPE_CORE> > l_childCores; std::vector<Target<fapi2::TARGET_TYPE_MCA> > l_childMCAs; std::vector<Target<fapi2::TARGET_TYPE_EQ> > l_childEQs; std::vector<Target<fapi2::TARGET_TYPE_EX> > l_childEXs; std::vector<Target<fapi2::TARGET_TYPE_XBUS> > l_childXBUSs; + std::vector<Target<fapi2::TARGET_TYPE_DMI> > l_childDMIs; - l_childMCAs = fapi2_mcbistTarget.getChildren<fapi2::TARGET_TYPE_MCA>(TARGET_STATE_PRESENT); - l_targetHuid = TARGETING::get_huid(targeting_targets[MY_MCBIST]) ; - l_actualSize = l_childMCAs.size(); - //Set expected size to be the number of MCAs per MCBIST - l_expectedSize = MCA_PER_MCS * MCS_PER_PROC / MCBIST_PER_PROC; - numTests++; - if(l_actualSize != l_expectedSize) + if (isHwValid(l_proc, MY_MCA) + && isHwValid(l_proc, MY_MCBIST) + && isHwValid(l_proc, MY_MCS)) { - FAPI_INF("fapi2TargetTest:: MCAs per MCBIST mismatch"); - numFails++; - break; + l_childMCAs = fapi2_mcbistTarget.getChildren<fapi2::TARGET_TYPE_MCA>(TARGET_STATE_PRESENT); + l_targetHuid = TARGETING::get_huid(targeting_targets[MY_MCBIST]); + l_actualSize = l_childMCAs.size(); + + //Set expected size to be the number of MCAs per MCBIST + l_expectedSize = MCA_PER_MCS * MCS_PER_PROC / MCBIST_PER_PROC; + numTests++; + if(l_actualSize != l_expectedSize) + { + FAPI_INF("fapi2TargetTest:: MCAs per MCBIST mismatch"); + numFails++; + break; + } + } + + if (isHwValid(l_proc, MY_MC) + && isHwValid(l_proc, MY_MI) + && isHwValid(l_proc, MY_DMI)) + { + l_childDMIs = fapi2_mcTarget.getChildren<fapi2::TARGET_TYPE_DMI>(TARGET_STATE_PRESENT); + l_targetHuid = TARGETING::get_huid(targeting_targets[MY_MC]); + l_actualSize = l_childDMIs.size(); + + //Set expected size to be the number of DMIs per MC + l_expectedSize = DMI_PER_MI * MI_PER_PROC / MC_PER_PROC; + numTests++; + if(l_actualSize != l_expectedSize) + { + FAPI_INF("fapi2TargetTest:: DMIs per MC mismatch"); + numFails++; + break; + } } l_childCores = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT); - l_targetHuid = TARGETING::get_huid(l_nimbusProc) ; + l_targetHuid = TARGETING::get_huid(l_proc) ; l_actualSize = l_childCores.size(); //Set expected size to be the number of cores per proc @@ -182,7 +237,7 @@ void test_fapi2GetChildren() } l_childCores = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_FUNCTIONAL); - l_targetHuid = TARGETING::get_huid(l_nimbusProc) ; + l_targetHuid = TARGETING::get_huid(l_proc) ; l_actualSize = l_childCores.size(); //Set expected size to be the number of cores per proc @@ -196,20 +251,45 @@ void test_fapi2GetChildren() break; } - l_childMCAs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_MCA>(TARGET_STATE_PRESENT); - l_targetHuid = TARGETING::get_huid(l_nimbusProc) ; - l_actualSize = l_childMCAs.size(); + if (isHwValid(l_proc, MY_MCA) + && isHwValid(l_proc, MY_MCBIST) + && isHwValid(l_proc, MY_MCS)) + { + l_childMCAs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_MCA>(TARGET_STATE_PRESENT); + l_targetHuid = TARGETING::get_huid(l_proc) ; + l_actualSize = l_childMCAs.size(); - //Set expected size to be the number of MCAs per proc - l_expectedSize = MCA_PER_MCS * MCS_PER_PROC; - numTests++; - if(l_actualSize != l_expectedSize) + //Set expected size to be the number of MCAs per proc + l_expectedSize = MCA_PER_MCS * MCS_PER_PROC; + numTests++; + if(l_actualSize != l_expectedSize) + { + FAPI_INF("fapi2TargetTest:: MCAs per proc mismatch"); + numFails++; + break; + } + } + + if (isHwValid(l_proc, MY_MC) + && isHwValid(l_proc, MY_MI) + && isHwValid(l_proc, MY_DMI)) { - FAPI_INF("fapi2TargetTest:: MCAs per proc mismatch"); - numFails++; - break; + l_childDMIs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_DMI>(TARGET_STATE_PRESENT); + l_targetHuid = TARGETING::get_huid(l_proc); + l_actualSize = l_childDMIs.size(); + + //Set expected size to be the number of DMIs per proc + l_expectedSize = DMI_PER_MI * MI_PER_PROC; + numTests++; + if(l_actualSize != l_expectedSize) + { + FAPI_INF("fapi2TargetTest:: DMIs per proc mismatch"); + numFails++; + break; + } } + l_childCores = fapi2_exTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT); l_targetHuid = TARGETING::get_huid(targeting_targets[MY_EX]) ; l_actualSize = l_childCores.size(); @@ -224,6 +304,7 @@ void test_fapi2GetChildren() break; } + l_childCores = fapi2_eqTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT); l_targetHuid = TARGETING::get_huid(targeting_targets[MY_EQ]) ; l_actualSize = l_childCores.size(); @@ -238,9 +319,10 @@ void test_fapi2GetChildren() break; } + //Explicitly make sure getChildren for EX targets works l_childEXs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_EX>(TARGET_STATE_PRESENT); - l_targetHuid = TARGETING::get_huid(l_nimbusProc) ; + l_targetHuid = TARGETING::get_huid(l_proc) ; l_actualSize = l_childEXs.size(); //Set expected size to be the number of Exs per proc @@ -253,6 +335,7 @@ void test_fapi2GetChildren() break; } + // Test pervasive children // Valid children for PERV: @@ -261,21 +344,7 @@ void test_fapi2GetChildren() // PERV -> MCA // PERV -> PEC // PERV -> PHB // PERV -> MI // PERV -> DMI - static struct pervasiveChildTestRec { - - // Expected number of children - uint32_t expectedSize; - - // Lambda function specifying which pervasive chip units map to - // children of the type implied by the body of the lambda function - // below - bool (*unitMapsToRightTargetType)(TARGETING::ATTR_CHIP_UNIT_type); - - // Lambda function taking a pervasive target and returning the - // number of children it has for a given FAPI type - size_t (*actualSize)(Target<fapi2::TARGET_TYPE_PERV>&); - - } pervasiveChildTests [] = { + static pervasiveChildTestRec nimbusPervasiveChildTests [] = { // EQ pervasive has 1 EQ child {PERV_EQ_CHILDREN, @@ -294,7 +363,7 @@ void test_fapi2GetChildren() TARGET_STATE_PRESENT).size(); } }, // XBUS pervasive has 2 XBUS children - {PERV_XBUS_CHILDREN, + {PERV_XBUS_NIMBUS_CHILDREN, [](TARGETING::ATTR_CHIP_UNIT_type i_unit) { return (i_unit == XBUS_RANGE); }, [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) @@ -310,7 +379,7 @@ void test_fapi2GetChildren() TARGET_STATE_PRESENT).size(); } }, // CAPP pervasive has 1 CAPP child - {PERV_CAPP_CHILDREN, + {PERV_CAPP_NIMBUS_CHILDREN, [](TARGETING::ATTR_CHIP_UNIT_type i_unit) { return ((i_unit == CAPP0_RANGE) || (i_unit == CAPP1_RANGE));}, [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) @@ -322,7 +391,7 @@ void test_fapi2GetChildren() [](TARGETING::ATTR_CHIP_UNIT_type i_unit) { return ((i_unit >= OBUS_LOW) && (i_unit <= OBUS_HIGH)); }, [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) - { return i_perv.getChildren<fapi2::TARGET_TYPE_OBUS_BRICK>( + { return i_perv.getChildren<fapi2::TARGET_TYPE_OBUS_BRICK>( TARGET_STATE_PRESENT).size(); } }, // MCBIST/MCS/MCA pervasive has 1 MCBIST child @@ -331,7 +400,7 @@ void test_fapi2GetChildren() { return ( (i_unit >= MC_LOW) && (i_unit <= MC_HIGH)); }, [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) - { return i_perv.getChildren<fapi2::TARGET_TYPE_MCBIST>( + { return i_perv.getChildren<fapi2::TARGET_TYPE_MCBIST>( TARGET_STATE_PRESENT).size(); } }, // MCBIST/MCS/MCA pervasive has 2 MCS children @@ -339,21 +408,21 @@ void test_fapi2GetChildren() [](TARGETING::ATTR_CHIP_UNIT_type i_unit) { return ((i_unit >= MC_LOW) && (i_unit <= MC_HIGH)); }, [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) - { return i_perv.getChildren<fapi2::TARGET_TYPE_MCS>( - TARGET_STATE_PRESENT).size(); } }, + { return i_perv.getChildren<fapi2::TARGET_TYPE_MCS>( + TARGET_STATE_PRESENT).size(); } }, // MCBIST/MCS/MCA pervasive has 4 MCA children {PERV_MCA_CHILDREN, [](TARGETING::ATTR_CHIP_UNIT_type i_unit) { return ((i_unit >= MC_LOW) && (i_unit <= MC_HIGH)); }, [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) - { return i_perv.getChildren<fapi2::TARGET_TYPE_MCA>( - TARGET_STATE_PRESENT).size(); } }, + { return i_perv.getChildren<fapi2::TARGET_TYPE_MCA>( + TARGET_STATE_PRESENT).size(); } }, // PEC/PHB pervasive has 1 PEC child {PERV_PEC_CHILDREN, [](TARGETING::ATTR_CHIP_UNIT_type i_unit) - { return ((i_unit >= PEC_LOW) && (i_unit <= PEC_HIGH)); }, + { return ((i_unit >= PEC_LOW) && (i_unit <= PEC_HIGH)); }, [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) { return i_perv.getChildren<fapi2::TARGET_TYPE_PEC>( TARGET_STATE_PRESENT).size(); } }, @@ -385,6 +454,127 @@ void test_fapi2GetChildren() // No MI or DMI units for Nimbus }; + static pervasiveChildTestRec cumulusPervasiveChildTests [] = { + + // EQ pervasive has 1 EQ child + {PERV_EQ_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ((i_unit >= EQ_LOW) && (i_unit <= EQ_HIGH)); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_EQ>( + TARGET_STATE_PRESENT).size(); } }, + + // CORE pervasive has 1 CORE child + {PERV_CORE_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ((i_unit >= CORE_LOW) && (i_unit <= CORE_HIGH)); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_CORE>( + TARGET_STATE_PRESENT).size(); } }, + + // XBUS pervasive has # XBUS children + {PERV_XBUS_CUMULUS_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return (i_unit == XBUS_RANGE); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_XBUS>( + TARGET_STATE_PRESENT).size(); } }, + + // OBUS pervasive has 1 OBUS child + {PERV_OBUS_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ((i_unit >= OBUS_LOW) && (i_unit <= OBUS_HIGH)); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_OBUS>( + TARGET_STATE_PRESENT).size(); } }, + + // CAPP pervasive has 1 CAPP child + {PERV_CAPP_CUMULUS_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ((i_unit == CAPP0_RANGE) || (i_unit == CAPP1_RANGE));}, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_CAPP>( + TARGET_STATE_PRESENT).size(); } }, + + // OBUS pervasive has 3 OBUS BRICK children + {PERV_OBUS_BRICK_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ((i_unit >= OBUS_LOW) && (i_unit <= OBUS_HIGH)); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_OBUS_BRICK>( + TARGET_STATE_PRESENT).size(); } }, + + // PEC/PHB pervasive has 1 PEC child + {PERV_PEC_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ((i_unit >= PEC_LOW) && (i_unit <= PEC_HIGH)); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_PEC>( + TARGET_STATE_PRESENT).size(); } }, + + // PEC/PHB pervasive with 1 PHB child + {PERV_PEC0_PHB_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return (i_unit == PEC_LOW); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_PHB>( + TARGET_STATE_PRESENT).size(); } }, + + // PEC/PHB pervasive with 2 PHB children + {PERV_PEC1_PHB_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return (i_unit == PEC_MID); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_PHB>( + TARGET_STATE_PRESENT).size(); } }, + + // PEC/PHB pervasive with 3 PHB children + {PERV_PEC2_PHB_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return (i_unit == PEC_HIGH); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_PHB>( + TARGET_STATE_PRESENT).size(); } }, + + // MC / MI / DMI pervasive has 2 MC Children + {PERV_MC_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ( (i_unit >= MC_LOW) + && (i_unit <= MC_HIGH)); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_MC>( + TARGET_STATE_PRESENT).size(); } }, + + // MC / MI / DMI pervasive has 2 MI Children + {PERV_MI_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ((i_unit >= MC_LOW) && (i_unit <= MC_HIGH)); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_MI>( + TARGET_STATE_PRESENT).size(); } }, + + // MC / MI / DMI pervasive has 4 DMI children + {PERV_DMI_CHILDREN, + [](TARGETING::ATTR_CHIP_UNIT_type i_unit) + { return ((i_unit >= MC_LOW) && (i_unit <= MC_HIGH)); }, + [](Target<fapi2::TARGET_TYPE_PERV>& i_perv) + { return i_perv.getChildren<fapi2::TARGET_TYPE_DMI>( + TARGET_STATE_PRESENT).size(); } }, + }; + + pervasiveChildTestRec* ptr; + int numPervTests = 0; + if (l_nimbusProc != nullptr) + { + numPervTests = sizeof(nimbusPervasiveChildTests) / sizeof(pervasiveChildTestRec); + ptr = nimbusPervasiveChildTests; + } + else + { + numPervTests = sizeof(cumulusPervasiveChildTests) / sizeof(pervasiveChildTestRec); + ptr = cumulusPervasiveChildTests; + } + // Build list of all pervasive targets in the blueprint TARGETING::TargetHandleList pervasiveTargets; TARGETING::getAllChiplets( @@ -393,15 +583,15 @@ void test_fapi2GetChildren() false); // Test each type of target that can be a child of a pervasive - for(const pervasiveChildTestRec& pervasiveChildTest - : pervasiveChildTests) + for (int i = 0; i < numPervTests; ++i) { + const pervasiveChildTestRec& pervasiveChildTest = ptr[i]; l_expectedSize = pervasiveChildTest.expectedSize; l_actualSize = 0; l_targetHuid = 0; numTests++; - TARGETING::TargetHandle_t candidateTarget = NULL; + TARGETING::TargetHandle_t candidateTarget = nullptr; for(TARGETING::TargetHandleList::const_iterator pIt = pervasiveTargets.begin(); pIt != pervasiveTargets.end(); @@ -415,7 +605,7 @@ void test_fapi2GetChildren() } } - if(candidateTarget == NULL) + if(candidateTarget == nullptr) { FAPI_INF("fapi2TargetTest:: candidateTarget not found"); numFails++; @@ -486,9 +676,10 @@ void test_fapi2GetChildrenFilter() uint32_t l_targetHuid = 0xFFFFFFFF; uint32_t l_actualSize = 0; uint32_t l_expectedSize = 0; - errlHndl_t l_err = NULL; - TARGETING::Target * l_nimbusProc = NULL; - TARGETING::Target * l_cumulusProc = NULL; + errlHndl_t l_err = nullptr; + TARGETING::Target * l_nimbusProc = nullptr; + TARGETING::Target * l_cumulusProc = nullptr; + TARGETING::Target * l_proc = nullptr; do { FAPI_DBG("start of test_fapi2GetChildrenFilter()"); @@ -517,28 +708,35 @@ void test_fapi2GetChildrenFilter() } numTests++; - if(l_cumulusProc) + if (l_nimbusProc != nullptr) { - // @todo RTC 178802 Enable test cases turned off during bring up - // This test needs to be updated for Cumulus - break; + l_proc = l_nimbusProc; } - if(l_nimbusProc == NULL) + else if (l_cumulusProc != nullptr) { - // Send an errorlog because we cannot find any NIMBUS procs. - FAPI_ERR("FAPI2_GETCHILDREN:: could not find Nimbus proc, skipping tests"); + l_proc = l_cumulusProc; + } + else //both are nullptr + { + // Send an errorlog because we cannot find any procs. + FAPI_ERR("FAPI2_GETCHILDREN:: could not find any proc, skipping tests"); numFails++; - TS_FAIL("test_fapi2GetChildrenFilter Fail: could not find Nimbus proc, skipping tests"); + TS_FAIL("test_fapi2GetChildrenFilter Fail: could not find any proc, skipping tests"); break; } TARGETING::Target* targeting_targets[NUM_TARGETS]; - generateTargets(l_nimbusProc, targeting_targets); + generateTargets(l_proc, targeting_targets); numTests++; for( uint64_t x = 0; x < NUM_TARGETS; x++ ) { - if(targeting_targets[x] == NULL) + //Skip tests where the HW unit to test isn't valid for the proc type + if (!isHwValid(l_proc, x)) + { + continue; + } + else if(targeting_targets[x] == nullptr) { FAPI_ERR("Unable to find target for item %d in targeting_targets", x); numFails++; @@ -548,7 +746,7 @@ void test_fapi2GetChildrenFilter() } Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget( - l_nimbusProc); + l_proc); std::vector<Target<fapi2::TARGET_TYPE_PERV> > l_childPERVs; @@ -559,7 +757,7 @@ void test_fapi2GetChildrenFilter() l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>( TARGET_FILTER_ALL_CORES, TARGET_STATE_PRESENT); - l_targetHuid = TARGETING::get_huid(l_nimbusProc) ; + l_targetHuid = TARGETING::get_huid(l_proc) ; l_actualSize = l_childPERVs.size(); numTests++; if(l_actualSize != l_expectedSize) @@ -573,7 +771,7 @@ void test_fapi2GetChildrenFilter() l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>( TARGET_FILTER_CORE1, TARGET_STATE_PRESENT); - l_targetHuid = TARGETING::get_huid(l_nimbusProc) ; + l_targetHuid = TARGETING::get_huid(l_proc) ; l_actualSize = l_childPERVs.size(); numTests++; if(l_actualSize != l_expectedSize) @@ -582,18 +780,21 @@ void test_fapi2GetChildrenFilter() break; } - // PERV - TARGET_FILTER_ALL_MC - l_expectedSize = 2; - l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>( + if (isHwValid(l_proc, MY_MCS)) + { + // PERV - TARGET_FILTER_ALL_MC + l_expectedSize = 2; + l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>( TARGET_FILTER_ALL_MC, TARGET_STATE_PRESENT); - l_targetHuid = TARGETING::get_huid(l_nimbusProc) ; - l_actualSize = l_childPERVs.size(); - numTests++; - if(l_actualSize != l_expectedSize) - { - numFails++; - break; + l_targetHuid = TARGETING::get_huid(l_proc) ; + l_actualSize = l_childPERVs.size(); + numTests++; + if(l_actualSize != l_expectedSize) + { + numFails++; + break; + } } // PERV - SYNC_MODE_ALL_IO_EXCEPT_NEST @@ -602,7 +803,7 @@ void test_fapi2GetChildrenFilter() l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>( TARGET_FILTER_SYNC_MODE_ALL_IO_EXCEPT_NEST, TARGET_STATE_PRESENT); - l_targetHuid = TARGETING::get_huid(l_nimbusProc) ; + l_targetHuid = TARGETING::get_huid(l_proc) ; l_actualSize = l_childPERVs.size(); numTests++; if(l_actualSize != l_expectedSize) diff --git a/src/usr/fapi2/test/fapi2GetParentTest.H b/src/usr/fapi2/test/fapi2GetParentTest.H index 6c178c79e..47492fd78 100644 --- a/src/usr/fapi2/test/fapi2GetParentTest.H +++ b/src/usr/fapi2/test/fapi2GetParentTest.H @@ -36,6 +36,20 @@ class Fapi2GetParentTest : public CxxTest::TestSuite { public: +// Check units which have a pervasive parent +struct pervasiveParentTestRec { + // Source unit from which to find parent pervasive + TARGETING::Target* pTarget; + // Lambda function taking a unit target and returning its + // parent pervasive target (if any) + TARGETING::Target* (*getParent)(TARGETING::Target* i_pTarget); +}; + +void test_fapi2GetParentPervasive(int& numTests, int& numFails, + const pervasiveParentTestRec[], + TARGETING::Target *); + + //****************************************************************************** // fapi2GetParentTest //****************************************************************************** @@ -43,7 +57,7 @@ void test_fapi2GetParent() { int numTests = 0; int numFails = 0; - errlHndl_t l_err = NULL; + errlHndl_t l_err = nullptr; do { // Create a vector of TARGETING::Target pointers @@ -52,8 +66,9 @@ void test_fapi2GetParent() // Get a list of all of the proc chips TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false); - TARGETING::Target * l_nimbusProc = NULL; - TARGETING::Target * l_cumulusProc = NULL; + TARGETING::Target * l_nimbusProc = nullptr; + TARGETING::Target * l_cumulusProc = nullptr; + TARGETING::Target * l_proc = nullptr; //Take the first NIMBUS proc and use it for(uint32_t i = 0; i < l_chipList.size(); i++) @@ -72,41 +87,48 @@ void test_fapi2GetParent() } } - if(l_cumulusProc) + if (l_nimbusProc != nullptr) { - // @todo RTC 178802 Enable test cases turned off during bring up - // This test needs to be updated for Cumulus - break; + l_proc = l_nimbusProc; } - if(l_nimbusProc == NULL) + else if (l_cumulusProc != nullptr) { - // Send an errorlog because we cannot find any NIMBUS procs. - FAPI_ERR("FAPI2_GETPARENT:: could not find Nimbus proc, skipping tests"); + l_proc = l_cumulusProc; + } + else //both are nullptr + { + // Send errorlog because we cannot find any NIMBUS or CUMULUS procs. + FAPI_ERR("FAPI2_GETPARENT:: could not find Nimbus or Cumulus procs, skipping tests"); numFails++; /*@ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST * @reasoncode fapi2::RC_NO_PROCS_FOUND - * @userdata1 Model Type we looked for - * @userdata2 Unused - * @devdesc Could not find NIMBUS procs in system model + * @userdata1 Model Type we looked for (Nimbus) + * @userdata2 Other Model Type we looked for (Cumulus) + * @devdesc Couldn't find nimbus or cumulus procs in sys model */ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST, fapi2::RC_NO_PROCS_FOUND, TARGETING::MODEL_NIMBUS, - NULL, + TARGETING::MODEL_CUMULUS, true/*SW Error*/); errlCommit(l_err,HWPF_COMP_ID); break; } TARGETING::Target* targeting_targets[NUM_TARGETS]; - generateTargets(l_nimbusProc, targeting_targets); + generateTargets(l_proc, targeting_targets); for( uint64_t x = 0; x < NUM_TARGETS; x++ ) { - if(targeting_targets[x] == NULL) + //Skip tests where the HW unit to test isn't valid for the proc type + if (!isHwValid(l_proc, x)) + { + continue; + } + else if(targeting_targets[x] == nullptr) { FAPI_ERR("Unable to find target for item %d in targeting_targets", x); @@ -128,9 +150,8 @@ void test_fapi2GetParent() } } - Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget( - l_nimbusProc); + l_proc); Target<fapi2::TARGET_TYPE_EQ> fapi2_eqTarget( targeting_targets[MY_EQ]); Target<fapi2::TARGET_TYPE_EX> fapi2_exTarget( @@ -161,6 +182,12 @@ void test_fapi2GetParent() targeting_targets[MY_SBE]); Target<fapi2::TARGET_TYPE_CAPP> fapi2_cappTarget( targeting_targets[MY_CAPP]); + Target<fapi2::TARGET_TYPE_MC> fapi2_mcTarget( // MC (Cumulus) + targeting_targets[MY_MC]); + Target<fapi2::TARGET_TYPE_MI> fapi2_miTarget( // MI (Cumulus) + targeting_targets[MY_MI]); + Target<fapi2::TARGET_TYPE_DMI> fapi2_dmiTarget( // DMI (Cumulus) + targeting_targets[MY_DMI]); TARGETING::Target * l_tempTargetingParent = static_cast<TARGETING::Target*>( @@ -205,7 +232,6 @@ void test_fapi2GetParent() numFails++; } - l_tempTargetingParent = static_cast<TARGETING::Target*>( fapi2_coreTarget.getParent<TARGET_TYPE_EQ>()); @@ -247,13 +273,12 @@ void test_fapi2GetParent() numFails++; } - l_tempTargetingParent = static_cast<TARGETING::Target*>( fapi2_coreTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -277,7 +302,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -290,7 +315,6 @@ void test_fapi2GetParent() numFails++; } - l_tempTargetingParent = static_cast<TARGETING::Target*>( fapi2_exTarget.getParent<TARGET_TYPE_EQ>()); @@ -340,7 +364,7 @@ void test_fapi2GetParent() //Check EX's parents numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -363,7 +387,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -382,7 +406,7 @@ void test_fapi2GetParent() //Check EQ's parents numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -405,7 +429,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -418,30 +442,34 @@ void test_fapi2GetParent() numFails++; } - l_tempTargetingParent = - static_cast<TARGETING::Target*>( - fapi2_mcaTarget.getParent<TARGET_TYPE_MCS>()); - - //Check MCA's parents - numTests++; - if(TARGETING::get_huid(targeting_targets[MY_MCS]) != - TARGETING::get_huid(l_tempTargetingParent)) + if (isHwValid(l_proc, MY_MCA) + && isHwValid(l_proc, MY_MCBIST) + && isHwValid(l_proc, MY_MCS)) { - uint8_t l_instance = 0; - targeting_targets[MY_MCA]-> - tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_instance); - /*@ - * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST - * @reasoncode fapi2::RC_MCA_NO_MCS_FOUND - * @userdata1[0:31] Expected Parent HUID - * @userdata1[32:63] Actual Parent HUID - * @userdata2[0:31] Instance of MCA - * @userdata2[32:63] fapi2 Type of expected parent - * @devdesc Could not find the parent MSC of this - * MCA target - */ - l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + l_tempTargetingParent = + static_cast<TARGETING::Target*>( + fapi2_mcaTarget.getParent<TARGET_TYPE_MCS>()); + + //Check MCA's parents + numTests++; + if(TARGETING::get_huid(targeting_targets[MY_MCS]) != + TARGETING::get_huid(l_tempTargetingParent)) + { + uint8_t l_instance = 0; + targeting_targets[MY_MCA]-> + tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_instance); + /*@ + * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST + * @reasoncode fapi2::RC_MCA_NO_MCS_FOUND + * @userdata1[0:31] Expected Parent HUID + * @userdata1[32:63] Actual Parent HUID + * @userdata2[0:31] Instance of MCA + * @userdata2[32:63] fapi2 Type of expected parent + * @devdesc Could not find the parent MSC of this + * MCA target + */ + l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST, fapi2::RC_MCA_NO_MCS_FOUND, TWO_UINT32_TO_UINT64( @@ -455,42 +483,42 @@ void test_fapi2GetParent() TO_UINT32(l_instance), TO_UINT32(TARGET_TYPE_MCS)), true/*SW Error*/); - errlCommit(l_err,HWPF_COMP_ID); - TS_FAIL( "fapi2TargetTest::Unable to find MCA's MCS parent!"); - numFails++; - } + errlCommit(l_err,HWPF_COMP_ID); + TS_FAIL( "fapi2TargetTest::Unable to find MCA's MCS parent!"); + numFails++; + } - l_tempTargetingParent = - static_cast<TARGETING::Target*>( - fapi2_mcaTarget.getParent<TARGET_TYPE_PROC_CHIP>()); + l_tempTargetingParent = + static_cast<TARGETING::Target*>( + fapi2_mcaTarget.getParent<TARGET_TYPE_PROC_CHIP>()); - numTests++; + numTests++; - if(TARGETING::get_huid(l_nimbusProc) != - TARGETING::get_huid(l_tempTargetingParent)) - { - uint8_t l_instance = 0; - targeting_targets[MY_MCA]-> - tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_instance); - /*@ - * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST - * @reasoncode fapi2::RC_MCA_NO_PROC_FOUND - * @userdata1[0:31] Expected Parent HUID - * @userdata1[32:63] Actual Parent HUID - * @userdata2[0:31] Instance of MCA - * @userdata2[32:63] fapi2 Type of expected parent - * @devdesc Could not find the parent PROC of this - * MCA target - */ - l_err = new ERRORLOG::ErrlEntry( + if(TARGETING::get_huid(l_proc) != + TARGETING::get_huid(l_tempTargetingParent)) + { + uint8_t l_instance = 0; + targeting_targets[MY_MCA]-> + tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_instance); + /*@ + * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST + * @reasoncode fapi2::RC_MCA_NO_PROC_FOUND + * @userdata1[0:31] Expected Parent HUID + * @userdata1[32:63] Actual Parent HUID + * @userdata2[0:31] Instance of MCA + * @userdata2[32:63] fapi2 Type of expected parent + * @devdesc Could not find the parent PROC of this + * MCA target + */ + l_err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE, fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST, fapi2::RC_MCA_NO_PROC_FOUND, TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -498,42 +526,46 @@ void test_fapi2GetParent() TO_UINT32(l_instance), TO_UINT32(TARGET_TYPE_PROC_CHIP)), true/*SW Error*/); - errlCommit(l_err,HWPF_COMP_ID); - TS_FAIL( "fapi2TargetTest::Unable to find MCA's PROC parent!"); - numFails++; + errlCommit(l_err,HWPF_COMP_ID); + TS_FAIL( "fapi2TargetTest::Unable to find MCA's PROC parent!"); + numFails++; + } } - //Check MCS's parents - - l_tempTargetingParent = - static_cast<TARGETING::Target*>( - fapi2_mcsTarget.getParent<TARGET_TYPE_PROC_CHIP>()); - - numTests++; - if(TARGETING::get_huid(l_nimbusProc) != - TARGETING::get_huid(l_tempTargetingParent)) + //Check MCS's parents -- Only for Nimbus + if (isHwValid(l_proc, MY_MCA) + && isHwValid(l_proc, MY_MCBIST) + && isHwValid(l_proc, MY_MCS)) { - uint8_t l_instance = 0; - targeting_targets[MY_MCS]-> - tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_instance); - /*@ - * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST - * @reasoncode fapi2::RC_MCS_NO_PROC_FOUND - * @userdata1[0:31] Expected Parent HUID - * @userdata1[32:63] Actual Parent HUID - * @userdata2[0:31] Instance of MCS - * @userdata2[32:63] fapi2 Type of expected parent - * @devdesc Could not find the parent PROC of this - * MCS target - */ - l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + l_tempTargetingParent = + static_cast<TARGETING::Target*>( + fapi2_mcsTarget.getParent<TARGET_TYPE_PROC_CHIP>()); + + numTests++; + if(TARGETING::get_huid(l_proc) != + TARGETING::get_huid(l_tempTargetingParent)) + { + uint8_t l_instance = 0; + targeting_targets[MY_MCS]-> + tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_instance); + /*@ + * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST + * @reasoncode fapi2::RC_MCS_NO_PROC_FOUND + * @userdata1[0:31] Expected Parent HUID + * @userdata1[32:63] Actual Parent HUID + * @userdata2[0:31] Instance of MCS + * @userdata2[32:63] fapi2 Type of expected parent + * @devdesc Could not find the parent PROC of this + * MCS target + */ + l_err= new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST, fapi2::RC_MCS_NO_PROC_FOUND, TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -541,41 +573,41 @@ void test_fapi2GetParent() TO_UINT32(l_instance), TO_UINT32(TARGET_TYPE_PROC_CHIP)), true/*SW Error*/); - errlCommit(l_err,HWPF_COMP_ID); - TS_FAIL( "fapi2TargetTest::Unable to find MCS's PROC parent!"); - numFails++; - } + errlCommit(l_err,HWPF_COMP_ID); + TS_FAIL( "fapi2TargetTest::Unable to find MCS's PROC parent!"); + numFails++; + } - //Check MCBIST's parents - l_tempTargetingParent = - static_cast<TARGETING::Target*>( - fapi2_mcbistTarget.getParent<TARGET_TYPE_PROC_CHIP>()); + //Check MCBIST's parents + l_tempTargetingParent = + static_cast<TARGETING::Target*>( + fapi2_mcbistTarget.getParent<TARGET_TYPE_PROC_CHIP>()); - numTests++; - if(TARGETING::get_huid(l_nimbusProc) != - TARGETING::get_huid(l_tempTargetingParent)) - { - uint8_t l_instance = 0; - targeting_targets[MY_MCBIST]-> - tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_instance); - /*@ - * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST - * @reasoncode fapi2::RC_MCBIST_NO_PROC_FOUND - * @userdata1[0:31] Expected Parent HUID - * @userdata1[32:63] Actual Parent HUID - * @userdata2[0:31] Instance of MCS - * @userdata2[32:63] fapi2 Type of expected parent - * @devdesc Could not find the parent PROC of this - * MCBIST target - */ - l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + numTests++; + if(TARGETING::get_huid(l_proc) != + TARGETING::get_huid(l_tempTargetingParent)) + { + uint8_t l_instance = 0; + targeting_targets[MY_MCBIST]-> + tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_instance); + /*@ + * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST + * @reasoncode fapi2::RC_MCBIST_NO_PROC_FOUND + * @userdata1[0:31] Expected Parent HUID + * @userdata1[32:63] Actual Parent HUID + * @userdata2[0:31] Instance of MCS + * @userdata2[32:63] fapi2 Type of expected parent + * @devdesc Could not find the parent PROC of this + * MCBIST target + */ + l_err =new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, fapi2::MOD_FAPI2_PLAT_GET_PARENT_TEST, fapi2::RC_MCBIST_NO_PROC_FOUND, TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -583,9 +615,10 @@ void test_fapi2GetParent() TO_UINT32(l_instance), TO_UINT32(TARGET_TYPE_PROC_CHIP)), true/*SW Error*/); - errlCommit(l_err,HWPF_COMP_ID); - TS_FAIL( "fapi2TargetTest::Unable to find MCBIST's PROC parent!"); - numFails++; + errlCommit(l_err,HWPF_COMP_ID); + TS_FAIL( "fapi2TargetTest::Unable to find MCBIST's PROC parent!"); + numFails++; + } } //Check PHB's parents @@ -594,7 +627,7 @@ void test_fapi2GetParent() fapi2_phbTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -618,7 +651,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -632,12 +665,11 @@ void test_fapi2GetParent() } //Check PEC's parents - l_tempTargetingParent = static_cast<TARGETING::Target*>( fapi2_pecTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -660,7 +692,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -678,7 +710,7 @@ void test_fapi2GetParent() static_cast<TARGETING::Target*>( fapi2_xbusTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -701,7 +733,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -719,7 +751,7 @@ void test_fapi2GetParent() static_cast<TARGETING::Target*>( fapi2_obusTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -742,7 +774,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -760,7 +792,7 @@ void test_fapi2GetParent() static_cast<TARGETING::Target*>( fapi2_oBrickTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -783,7 +815,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -801,7 +833,7 @@ void test_fapi2GetParent() static_cast<TARGETING::Target*>( fapi2_ppeTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -824,7 +856,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -842,7 +874,7 @@ void test_fapi2GetParent() static_cast<TARGETING::Target*>( fapi2_pervTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -865,7 +897,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -883,7 +915,7 @@ void test_fapi2GetParent() static_cast<TARGETING::Target*>( fapi2_cappTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -906,7 +938,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -924,7 +956,7 @@ void test_fapi2GetParent() static_cast<TARGETING::Target*>( fapi2_sbeTarget.getParent<TARGET_TYPE_PROC_CHIP>()); numTests++; - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(l_tempTargetingParent)) { uint8_t l_instance = 0; @@ -947,7 +979,7 @@ void test_fapi2GetParent() TWO_UINT32_TO_UINT64( TO_UINT32( TARGETING::get_huid( - l_nimbusProc)), + l_proc)), TO_UINT32( TARGETING::get_huid( l_tempTargetingParent))), @@ -960,20 +992,8 @@ void test_fapi2GetParent() numFails++; } - // Check units which have a pervasive parent - - static struct pervasiveParentTestRec { - - // Source unit from which to find parent pervasive - TARGETING::Target* pTarget; - - // Lambda function taking a unit target and returning its - // parent pervasive target (if any) - TARGETING::Target* (*getParent)(TARGETING::Target* i_pTarget); - - } pervasiveParentTests [] = { - - {targeting_targets[MY_EQ], + static pervasiveParentTestRec nimbusPervasiveParentTests [] = { + {targeting_targets[MY_EQ], [](TARGETING::Target* i_pTarget) {return getPervasiveParent<TARGET_TYPE_EQ>(i_pTarget); }}, {targeting_targets[MY_CORE], @@ -1002,24 +1022,77 @@ void test_fapi2GetParent() {return getPervasiveParent<TARGET_TYPE_OBUS>(i_pTarget); }}, {targeting_targets[MY_OBUS_BRICK], [](TARGETING::Target* i_pTarget) - {return - getPervasiveParent<TARGET_TYPE_OBUS_BRICK>(i_pTarget);}}, + {return getPervasiveParent<TARGET_TYPE_OBUS_BRICK>(i_pTarget);}}, + {targeting_targets[MY_CAPP], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_CAPP>(i_pTarget); }}, + }; + + static pervasiveParentTestRec cumulusPervasiveParentTests [] = { + {targeting_targets[MY_EQ], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_EQ>(i_pTarget); }}, + {targeting_targets[MY_CORE], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_CORE>(i_pTarget); }}, + {targeting_targets[MY_PEC], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_PEC>(i_pTarget); }}, + {targeting_targets[MY_PHB], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_PHB>(i_pTarget); }}, + {targeting_targets[MY_XBUS], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_XBUS>(i_pTarget); }}, + {targeting_targets[MY_OBUS], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_OBUS>(i_pTarget); }}, + {targeting_targets[MY_OBUS_BRICK], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_OBUS_BRICK>(i_pTarget);}}, {targeting_targets[MY_CAPP], [](TARGETING::Target* i_pTarget) {return getPervasiveParent<TARGET_TYPE_CAPP>(i_pTarget); }}, - }; + {targeting_targets[MY_MC], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_MC>(i_pTarget); }}, + {targeting_targets[MY_MI], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_MI>(i_pTarget); }}, + {targeting_targets[MY_DMI], + [](TARGETING::Target* i_pTarget) + {return getPervasiveParent<TARGET_TYPE_DMI>(i_pTarget); }}, + }; + + pervasiveParentTestRec* ptr; + int numPervTests = 0; + if (l_nimbusProc != nullptr) + { + numPervTests = sizeof(nimbusPervasiveParentTests) / sizeof(pervasiveParentTestRec); + ptr = nimbusPervasiveParentTests; + } + else + { + numPervTests = sizeof(cumulusPervasiveParentTests) / sizeof(pervasiveParentTestRec); + ptr = cumulusPervasiveParentTests; + } // Test each type of target that can have exactly one pervasive parent - for(const pervasiveParentTestRec& pervasiveParentTest - : pervasiveParentTests) + for (int i = 0; i < numPervTests; ++i) { + const pervasiveParentTestRec& pervasiveParentTest = ptr[i]; numTests++; + if (pervasiveParentTest.pTarget == nullptr) + { + FAPI_ERR("Found pervasive parent to be null pervasiveParentTestRec for test: %d", + i); + } l_tempTargetingParent = pervasiveParentTest.getParent( pervasiveParentTest.pTarget); - // Result must be a non-NULL target of pervasive type, and its + // Result must be a non-nullptr target of pervasive type, and its // parent must be the same proc as the other tests above - TARGETING::Target* pPervasiveParent = NULL; + TARGETING::Target* pPervasiveParent = nullptr; if( l_tempTargetingParent && ( l_tempTargetingParent->getAttr<TARGETING::ATTR_TYPE>() == TARGETING::TYPE_PERV)) @@ -1029,10 +1102,10 @@ void test_fapi2GetParent() fapi2_pervTarg.getParent<TARGET_TYPE_PROC_CHIP>()); } - // If the parent of the target under test was NULL, or it was - // not a pervasive, or if the parent of the pervasive was NULL + // If the parent of the target under test was nullptr, or it was + // not a pervasive, or if the parent of the pervasive was nullptr // or was not the processor, fail the test - if(TARGETING::get_huid(l_nimbusProc) != + if(TARGETING::get_huid(l_proc) != TARGETING::get_huid(pPervasiveParent)) { TARGETING::ATTR_CHIP_UNIT_type instance = 0; @@ -1073,12 +1146,10 @@ void test_fapi2GetParent() numFails++; } } + } while(0); - }while(0); FAPI_INF("fapi2GetParentTest:: Test Complete. %d/%d fails", numFails, numTests); } - - }; diff --git a/src/usr/fapi2/test/fapi2HwAccessTest.H b/src/usr/fapi2/test/fapi2HwAccessTest.H index eef487916..61bd1ced5 100644 --- a/src/usr/fapi2/test/fapi2HwAccessTest.H +++ b/src/usr/fapi2/test/fapi2HwAccessTest.H @@ -66,7 +66,7 @@ void test_fapi2HwAccess() { int numTests = 0; int numFails = 0; - errlHndl_t l_errl = NULL; + errlHndl_t l_errl = nullptr; do { // Create a vector of TARGETING::Target pointers @@ -75,8 +75,9 @@ void test_fapi2HwAccess() // Get a list of all of the proc chips TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false); - TARGETING::Target * l_nimbusProc = NULL; - TARGETING::Target * l_cumulusProc = NULL; + TARGETING::Target * l_nimbusProc = nullptr; + TARGETING::Target * l_cumulusProc = nullptr; + TARGETING::Target * l_proc = nullptr; //Take the first NIMBUS proc and use it for(uint32_t i = 0; i < l_chipList.size(); i++) @@ -96,26 +97,27 @@ void test_fapi2HwAccess() } numTests++; - if(l_cumulusProc) + if (l_nimbusProc != nullptr) { - // @todo RTC 178802 Enable test cases turned off during bring up - // This test needs to be updated for Cumulus - break; + l_proc = l_nimbusProc; + } + else if (l_cumulusProc != nullptr) + { + l_proc = l_cumulusProc; } - if(l_nimbusProc == NULL) + else //both are nullptr { - // Send an errorlog because we cannot find any NIMBUS procs. - TS_FAIL("FAPI2_GETPARENT:: could not find Nimbus proc, skipping tests"); + TS_FAIL("FAPI2_fapi2HwAccess:: could not find any procs, skipping tests"); numFails++; break; } Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget( - l_nimbusProc); + l_proc); numTests++; FAPI_INVOKE_HWP(l_errl, p9_scomtest_getscom_fail, fapi2_procTarget); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; // delete expected error log } @@ -126,7 +128,7 @@ void test_fapi2HwAccess() } numTests++; FAPI_INVOKE_HWP(l_errl, p9_scomtest_putscom_fail, fapi2_procTarget); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; // delete expected error log } @@ -137,7 +139,7 @@ void test_fapi2HwAccess() } numTests++; FAPI_INVOKE_HWP(l_errl, p9_cfamtest_putcfam_fail, fapi2_procTarget); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; // delete expected error log } @@ -148,7 +150,7 @@ void test_fapi2HwAccess() } numTests++; FAPI_INVOKE_HWP(l_errl, p9_cfamtest_getcfam_fail, fapi2_procTarget); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; // delete expected error log } @@ -202,7 +204,7 @@ void test_fapi2HwAccess() numTests++; FAPI_INVOKE_HWP(l_errl, p9_ringtest_getring_fail, fapi2_procTarget); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; // delete expected error log } @@ -241,7 +243,7 @@ void test_fapi2HwAccess() #if 0 // TODO-RTC:151428 - need simics support for these to pass numTests++; FAPI_INVOKE_HWP(l_errl, p9_ringtest_modring_fail, fapi2_procTarget); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; // delete expected error log } @@ -283,7 +285,7 @@ void test_piberrmask() FAPI_INF("Entering test_piberrmask..."); FAPI_INF("Ensure that getPIBErrorMask return 0 initially"); - errlHndl_t l_errl = NULL; + errlHndl_t l_errl = nullptr; do { @@ -352,7 +354,7 @@ void test_getsetopmode() } //Call FAPI_INVOKE on an empty function to test if it resets the opMode - errlHndl_t l_errl = NULL; + errlHndl_t l_errl = nullptr; FAPI_INVOKE_HWP(l_errl,empty_function); if( l_errl ) { diff --git a/src/usr/fapi2/test/fapi2HwpTest.H b/src/usr/fapi2/test/fapi2HwpTest.H index 428ecf38b..167e4f313 100644 --- a/src/usr/fapi2/test/fapi2HwpTest.H +++ b/src/usr/fapi2/test/fapi2HwpTest.H @@ -46,7 +46,7 @@ void test_fapi2Hwp() { int numTests = 0; int numFails = 0; - errlHndl_t l_errl = NULL; + errlHndl_t l_errl = nullptr; do { @@ -56,8 +56,9 @@ void test_fapi2Hwp() // Get a list of all of the proc chips TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false); - TARGETING::Target * l_nimbusProc = NULL; - TARGETING::Target * l_cumulusProc = NULL; + TARGETING::Target * l_nimbusProc = nullptr; + TARGETING::Target * l_cumulusProc = nullptr; + TARGETING::Target * l_proc = nullptr; //Take the first NIMBUS proc and use it for(uint32_t i = 0; i < l_chipList.size(); i++) @@ -76,41 +77,49 @@ void test_fapi2Hwp() } } numTests++; - if(l_cumulusProc) + + if (l_nimbusProc != nullptr) { - // @todo RTC 178802 Enable test cases turned off during bring up - // This test needs to be updated for Cumulus - break; + l_proc = l_nimbusProc; } - if(l_nimbusProc == NULL) + else if (l_cumulusProc != nullptr) + { + l_proc = l_cumulusProc; + } + else //both are nullptr { // Send an errorlog because we cannot find any NIMBUS procs. - FAPI_ERR("FAPI2_GETPARENT:: could not find Nimbus proc, skipping tests"); + FAPI_ERR("FAPI2_GETPARENT:: could not find a proc, skipping tests"); numFails++; /*@ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE * @moduleid fapi2::MOD_FAPI2_PLAT_HWP_TEST * @reasoncode fapi2::RC_NO_PROCS_FOUND * @userdata1 Model Type we looked for - * @userdata2 Unused - * @devdesc Could not find NIMBUS procs in system model + * @userdata2 Other Model Type we looked for + * @devdesc Could not find procs in system model */ l_errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, fapi2::MOD_FAPI2_PLAT_HWP_TEST, fapi2::RC_NO_PROCS_FOUND, TARGETING::MODEL_NIMBUS, - NULL, + TARGETING::MODEL_CUMULUS, true/*SW Error*/); errlCommit(l_errl,HWPF_COMP_ID); break; } TARGETING::Target* targeting_targets[NUM_TARGETS]; - generateTargets(l_nimbusProc, targeting_targets); + generateTargets(l_proc, targeting_targets); for( uint64_t x = 0; x < NUM_TARGETS; x++ ) { - if(targeting_targets[x] == NULL) + //Skip tests where the HW unit to test isn't valid for the proc type + if (!isHwValid(l_proc, x)) + { + continue; + } + else if(targeting_targets[x] == nullptr) { FAPI_ERR("Unable to find target for item %d in targeting_targets", x); @@ -132,7 +141,7 @@ void test_fapi2Hwp() } } - fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget(l_nimbusProc); + fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget(l_proc); fapi2::Target<fapi2::TARGET_TYPE_EQ> fapi2_eqTarget(targeting_targets[MY_EQ]); fapi2::Target<fapi2::TARGET_TYPE_EX> fapi2_exTarget(targeting_targets[MY_EX]); fapi2::Target<fapi2::TARGET_TYPE_CORE> fapi2_coreTarget( @@ -155,155 +164,204 @@ void test_fapi2Hwp() fapi2::Target<fapi2::TARGET_TYPE_SBE> fapi2_sbeTarget(targeting_targets[MY_SBE]); fapi2::Target<fapi2::TARGET_TYPE_CAPP> fapi2_cappTarget( targeting_targets[MY_CAPP]); - + fapi2::Target<fapi2::TARGET_TYPE_MC> fapi2_mcTarget(targeting_targets[MY_MC]); + fapi2::Target<fapi2::TARGET_TYPE_MI> fapi2_miTarget(targeting_targets[MY_MI]); + fapi2::Target<fapi2::TARGET_TYPE_DMI> fapi2_dmiTarget(targeting_targets[MY_DMI]); int scratchWriteValue = 5; //Get/Set Attr for all of the targets numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_proc, fapi2_procTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_proc !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_eq, fapi2_eqTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_eq !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_ex, fapi2_exTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_ex !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_core, fapi2_coreTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_core !!"); } - numTests++; - FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mcs, fapi2_mcsTarget, scratchWriteValue); - if(l_errl != NULL) + if (isHwValid(l_proc, MY_MCS)) { - delete l_errl; - l_errl = NULL; - numFails++; - TS_FAIL("Error occured in p9_sample_procedure_mcs !!"); + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mcs, fapi2_mcsTarget, scratchWriteValue); + if(l_errl != nullptr) + { + delete l_errl; + l_errl = nullptr; + numFails++; + TS_FAIL("Error occured in p9_sample_procedure_mcs !!"); + } } - numTests++; - FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mca, fapi2_mcaTarget, scratchWriteValue); - if(l_errl != NULL) + if (isHwValid(l_proc, MY_MCA)) { - delete l_errl; - l_errl = NULL; - numFails++; - TS_FAIL("Error occured in p9_sample_procedure_mca !!"); + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mca, fapi2_mcaTarget, scratchWriteValue); + if(l_errl != nullptr) + { + delete l_errl; + l_errl = nullptr; + numFails++; + TS_FAIL("Error occured in p9_sample_procedure_mca !!"); + } } - numTests++; - FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mcbist, fapi2_mcbistTarget, scratchWriteValue); - if(l_errl != NULL) + if (isHwValid(l_proc, MY_MCBIST)) { - delete l_errl; - l_errl = NULL; - numFails++; - TS_FAIL("Error occured in p9_sample_procedure_mcbist !!"); + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mcbist, fapi2_mcbistTarget, scratchWriteValue); + if(l_errl != nullptr) + { + delete l_errl; + l_errl = nullptr; + numFails++; + TS_FAIL("Error occured in p9_sample_procedure_mcbist !!"); + } } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_pec, fapi2_pecTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_pec !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_phb, fapi2_phbTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_phb !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_xbus, fapi2_xbusTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_xbus !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_obus, fapi2_obusTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_obus !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_obrick, fapi2_oBrickTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_obrick !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_ppe, fapi2_ppeTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_ppe !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_perv, fapi2_pervTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_perv !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_sbe, fapi2_sbeTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_sbe !!"); } numTests++; FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_capp, fapi2_cappTarget, scratchWriteValue); - if(l_errl != NULL) + if(l_errl != nullptr) { delete l_errl; - l_errl = NULL; + l_errl = nullptr; numFails++; TS_FAIL("Error occured in p9_sample_procedure_capp !!"); } + + if (isHwValid(l_proc, MY_MC)) + { + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mc, fapi2_mcTarget, scratchWriteValue); + if(l_errl != nullptr) + { + delete l_errl; + l_errl = nullptr; + numFails++; + TS_FAIL("Error occured in p9_sample_procedure_mc !!"); + } + } + if (isHwValid(l_proc, MY_MI)) + { + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_mi, fapi2_miTarget, scratchWriteValue); + if(l_errl != nullptr) + { + delete l_errl; + l_errl = nullptr; + numFails++; + TS_FAIL("Error occured in p9_sample_procedure_mi !!"); + } + } + if (isHwValid(l_proc, MY_DMI)) + { + numTests++; + FAPI_INVOKE_HWP(l_errl, p9_sample_procedure_dmi, fapi2_dmiTarget, scratchWriteValue); + if(l_errl != nullptr) + { + delete l_errl; + l_errl = nullptr; + numFails++; + TS_FAIL("Error occured in p9_sample_procedure_dmi !!"); + } + } + }while(0); FAPI_INF("test_fapiHWP:: Test Complete. %d/%d fails", numFails,numTests); } diff --git a/src/usr/fapi2/test/fapi2IsFunctionalTest.H b/src/usr/fapi2/test/fapi2IsFunctionalTest.H index e9b1ff8e0..35e938eb0 100644 --- a/src/usr/fapi2/test/fapi2IsFunctionalTest.H +++ b/src/usr/fapi2/test/fapi2IsFunctionalTest.H @@ -71,7 +71,12 @@ class Fapi2IsFunctional : public CxxTest::TestSuite // Verify we generated valid targets for( uint64_t x = 0; x <= NUM_TARGETS; x++ ) { - if(targetList[x] == NULL) + //Skip tests where the HW unit to test isn't valid for the proc type + if (!isHwValid(proc, x)) + { + continue; + } + else if(targetList[x] == nullptr) { FAPI_INF("fapi2IsFunctionalTest: Unable to find target at index [%d]", x); @@ -154,13 +159,26 @@ class Fapi2IsFunctional : public CxxTest::TestSuite targetList[MY_CAPP]); fapiTargetList[MY_CAPP] = fapi2_cappTarget; + // MC (Cumulus) + Target<fapi2::TARGET_TYPE_MC> fapi2_mcTarget( + targetList[MY_MC]); + fapiTargetList[MY_MC] = fapi2_mcTarget; + + // MI (Cumulus) + Target<fapi2::TARGET_TYPE_MI> fapi2_miTarget( + targetList[MY_MI]); + fapiTargetList[MY_MI] = fapi2_miTarget; + + // DMI (Cumulus) + Target<fapi2::TARGET_TYPE_DMI> fapi2_dmiTarget( + targetList[MY_DMI]); + fapiTargetList[MY_DMI] = fapi2_dmiTarget; + // PROC_CHIP Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget( targetList[NUM_TARGETS]); fapiTargetList[NUM_TARGETS] = fapi2_procTarget; - - // Iterate through both arrays comparing ATTR_HWAS_STATE // against the return of fapi2::Target<K> isFunctional() for( int i = 0; i <= NUM_TARGETS; i++ ) diff --git a/src/usr/fapi2/test/fapi2TestUtils.C b/src/usr/fapi2/test/fapi2TestUtils.C index 406b3a0d4..2e1f98623 100644 --- a/src/usr/fapi2/test/fapi2TestUtils.C +++ b/src/usr/fapi2/test/fapi2TestUtils.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2017 */ +/* Contributors Listed Below - COPYRIGHT 2015,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -50,6 +50,9 @@ #define NUM_PERVS 55 #define NUM_CAPPS 2 #define NUM_SBES 1 +#define NUM_MC 2 +#define NUM_MI 2 +#define NUM_DMI 2 namespace fapi2 { @@ -59,7 +62,7 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, { for( uint64_t x = 0; x < NUM_TARGETS; x++ ) { - o_targetList[x] = NULL; + o_targetList[x] = nullptr; } // Set up entity path for NIMBUS proc @@ -70,21 +73,21 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, for(int i = 0; i < NUM_EQS; i++) { l_epath.addLast(TARGETING::TYPE_EQ,i); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_EQ] = TARGETING::targetService().toTarget(l_epath); for(int j = 0; j < NUM_EXS; j++) { l_epath.addLast(TARGETING::TYPE_EX,i); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_EX] = TARGETING::targetService().toTarget(l_epath); for(int k = 0; k < NUM_CORES; k++) { l_epath.addLast(TARGETING::TYPE_CORE,k); - if(TARGETING::targetService().toTarget(l_epath)!=NULL) + if(TARGETING::targetService().toTarget(l_epath)!=nullptr) { o_targetList[MY_CORE] = TARGETING::targetService().toTarget(l_epath); @@ -110,48 +113,100 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, } } - //Setup MCBISTs, MCSs, and MCAs - i_pMasterProcChip->tryGetAttr<TARGETING::ATTR_PHYS_PATH>(l_epath); - for(int i = 0; i < NUM_MCBISTS; i++) + if (TARGETING::MODEL_NIMBUS == + i_pMasterProcChip->getAttr<TARGETING::ATTR_MODEL>()) { - l_epath.addLast(TARGETING::TYPE_MCBIST, i); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + //Setup MCBISTs, MCSs, and MCAs + i_pMasterProcChip->tryGetAttr<TARGETING::ATTR_PHYS_PATH>(l_epath); + for(int i = 0; i < NUM_MCBISTS; i++) { - o_targetList[MY_MCBIST] = - TARGETING::targetService().toTarget(l_epath); - for(int j = 0; j < NUM_MCS; j++) + l_epath.addLast(TARGETING::TYPE_MCBIST, i); + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { - l_epath.addLast(TARGETING::TYPE_MCS, j); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + o_targetList[MY_MCBIST] = + TARGETING::targetService().toTarget(l_epath); + for(int j = 0; j < NUM_MCS; j++) { - o_targetList[MY_MCS] = - TARGETING::targetService().toTarget(l_epath); - for(int k = 0; k < NUM_MCAS; k++) + l_epath.addLast(TARGETING::TYPE_MCS, j); + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { - l_epath.addLast(TARGETING::TYPE_MCA,k); - if(TARGETING::targetService().toTarget(l_epath)!=NULL) - { - o_targetList[MY_MCA] = - TARGETING::targetService().toTarget(l_epath); - break; - } - else + o_targetList[MY_MCS] = + TARGETING::targetService().toTarget(l_epath); + for(int k = 0; k < NUM_MCAS; k++) { - l_epath.removeLast(); + l_epath.addLast(TARGETING::TYPE_MCA,k); + if(TARGETING::targetService().toTarget(l_epath)!=nullptr) + { + o_targetList[MY_MCA] = + TARGETING::targetService().toTarget(l_epath); + break; + } + else + { + l_epath.removeLast(); + } } + break; + } + else + { + l_epath.removeLast(); } - break; - } - else - { - l_epath.removeLast(); } + break; + } + else + { + l_epath.removeLast(); } - break; } - else + } + else if (TARGETING::MODEL_CUMULUS == + i_pMasterProcChip->getAttr<TARGETING::ATTR_MODEL>()) + { + //Setup MC, MI, DMI + i_pMasterProcChip->tryGetAttr<TARGETING::ATTR_PHYS_PATH>(l_epath); + for(int i = 0; i < NUM_MC; i++) { - l_epath.removeLast(); + l_epath.addLast(TARGETING::TYPE_MC, i); + if(TARGETING::targetService().toTarget(l_epath) != nullptr) + { + o_targetList[MY_MC] = + TARGETING::targetService().toTarget(l_epath); + for(int j = 0; j < NUM_MI; j++) + { + l_epath.addLast(TARGETING::TYPE_MI, j); + if(TARGETING::targetService().toTarget(l_epath) != nullptr) + { + o_targetList[MY_MI] = + TARGETING::targetService().toTarget(l_epath); + for(int k = 0; k < NUM_DMI; k++) + { + l_epath.addLast(TARGETING::TYPE_DMI,k); + if(TARGETING::targetService().toTarget(l_epath)!=nullptr) + { + o_targetList[MY_DMI] = + TARGETING::targetService().toTarget(l_epath); + break; + } + else + { + l_epath.removeLast(); + } + } + break; + } + else + { + l_epath.removeLast(); + } + } + break; + } + else + { + l_epath.removeLast(); + } } } @@ -160,14 +215,14 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, for(int i = 0; i < NUM_PECS; i++) { l_epath.addLast(TARGETING::TYPE_PEC, i); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_PEC] = TARGETING::targetService().toTarget(l_epath); for(int j = 0; j < NUM_PHBS; j++) { l_epath.addLast(TARGETING::TYPE_PHB,j); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_PHB] = TARGETING::targetService().toTarget(l_epath); @@ -192,7 +247,7 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, { // Nimbus doesn't have the 0th xbus, so index from 1 for now l_epath.addLast(TARGETING::TYPE_XBUS, i+1); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_XBUS] = TARGETING::targetService().toTarget(l_epath); @@ -210,7 +265,7 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, for(int i = 0; i < NUM_OBUS; i+=3) { l_epath.addLast(TARGETING::TYPE_OBUS, i); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_OBUS] = TARGETING::targetService().toTarget(l_epath); @@ -218,7 +273,7 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, for (int j = 0; j < NUM_OBUS_BRICK; j++) { l_epath.addLast(TARGETING::TYPE_OBUS_BRICK, j); - if (TARGETING::targetService().toTarget(l_epath) != NULL) + if (TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_OBUS_BRICK] = TARGETING::targetService().toTarget(l_epath); @@ -237,13 +292,12 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, } } - //Setup PPEs i_pMasterProcChip->tryGetAttr<TARGETING::ATTR_PHYS_PATH>(l_epath); for(int i = 0; i < NUM_PPES; i++) { l_epath.addLast(TARGETING::TYPE_PPE, i); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_PPE] = TARGETING::targetService().toTarget(l_epath); @@ -260,7 +314,7 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, for(int i = 0; i < NUM_CAPPS; i++) { l_epath.addLast(TARGETING::TYPE_CAPP, i); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_CAPP] = TARGETING::targetService().toTarget(l_epath); @@ -277,7 +331,7 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, for(int i = 0; i < NUM_SBES; i++) { l_epath.addLast(TARGETING::TYPE_SBE, i); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_SBE] = TARGETING::targetService().toTarget(l_epath); @@ -294,7 +348,7 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, for(int i = 0; i < NUM_PERVS; i++) { l_epath.addLast(TARGETING::TYPE_PERV, i); - if(TARGETING::targetService().toTarget(l_epath) != NULL) + if(TARGETING::targetService().toTarget(l_epath) != nullptr) { o_targetList[MY_PERV] = TARGETING::targetService().toTarget(l_epath); @@ -307,4 +361,24 @@ void generateTargets(TARGETING::Target* i_pMasterProcChip, } } +bool isHwValid(TARGETING::Target* i_procChip, uint8_t i_hwType) +{ + bool isValid = true; + if (i_procChip->getAttr<TARGETING::ATTR_MODEL>() == TARGETING::MODEL_CUMULUS) + { + if (i_hwType == MY_MCS || i_hwType == MY_MCA || i_hwType == MY_MCBIST) + { + isValid = false; + } + } + else if (i_procChip->getAttr<TARGETING::ATTR_MODEL>() == TARGETING::MODEL_NIMBUS) + { + if (i_hwType == MY_MC || i_hwType == MY_MI || i_hwType == MY_DMI) + { + isValid = false; + } + } + return isValid; +} + } // End namespace fapi2 diff --git a/src/usr/fapi2/test/fapi2TestUtils.H b/src/usr/fapi2/test/fapi2TestUtils.H index d435c277a..7b9a37ee3 100644 --- a/src/usr/fapi2/test/fapi2TestUtils.H +++ b/src/usr/fapi2/test/fapi2TestUtils.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2017 */ +/* Contributors Listed Below - COPYRIGHT 2015,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -37,9 +37,13 @@ #define EX_PER_EQ 2 #define CORE_PER_EX 2 #define MCS_PER_PROC 4 +#define MI_PER_PROC 4 #define MCA_PER_MCS 2 +#define DMI_PER_MI 2 #define MCBIST_PER_PROC 2 +#define MC_PER_PROC 2 #define MCS_PER_MCBIST 2 +#define MI_PER_MC 2 #define PERV_PER_PROC 43 #define XBUS_PER_PROC 1 #define OBUS_PER_PROC 2 @@ -92,6 +96,9 @@ enum{ MY_PERV, MY_CAPP, MY_SBE, + MY_MC, + MY_MI, + MY_DMI, NUM_TARGETS }; @@ -101,9 +108,11 @@ enum{ enum PERVASIVE_CHILDREN { PERV_EQ_CHILDREN = 1, PERV_CORE_CHILDREN = 1, - PERV_XBUS_CHILDREN = 2, + PERV_XBUS_NIMBUS_CHILDREN = 2, + PERV_XBUS_CUMULUS_CHILDREN = 3, PERV_OBUS_CHILDREN = 1, - PERV_CAPP_CHILDREN = 1, + PERV_CAPP_NIMBUS_CHILDREN = 1, + PERV_CAPP_CUMULUS_CHILDREN = 2, PERV_OBUS_BRICK_CHILDREN = 3, PERV_MCBIST_CHILDREN = 1, PERV_MCS_CHILDREN = 2, @@ -112,6 +121,9 @@ enum PERVASIVE_CHILDREN { PERV_PEC0_PHB_CHILDREN = 1, PERV_PEC1_PHB_CHILDREN = 2, PERV_PEC2_PHB_CHILDREN = 3, + PERV_MC_CHILDREN = 1, + PERV_MI_CHILDREN = 2, + PERV_DMI_CHILDREN = 4, }; /** @@ -169,6 +181,16 @@ inline V getPervasiveParent(V i_pTarget) fapi2_target.template getParent<TARGET_TYPE_PERV>()); } -} // End namespace fapi2 +/** + * @brief Helper to determine if hw unit is valid for given + * proc type + * + * @param[in] i_procChip Proc chip to check type of + * @param[in] i_hwType Hw unit type to compare with proc + * + * @return True if hw unit is valid for proc type, false otherwise + */ +bool isHwValid(TARGETING::Target* i_procChip, uint8_t i_hwType); +} // End namespace fapi2 #endif diff --git a/src/usr/fapi2/test/p9_sample_procedure.C b/src/usr/fapi2/test/p9_sample_procedure.C index 57ef2309e..469fa534a 100644 --- a/src/usr/fapi2/test/p9_sample_procedure.C +++ b/src/usr/fapi2/test/p9_sample_procedure.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2017 */ +/* Contributors Listed Below - COPYRIGHT 2015,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -384,3 +384,74 @@ fapi_try_exit: } +fapi2::ReturnCode p9_sample_procedure_mc( + fapi2::Target<fapi2::TARGET_TYPE_MC>& i_target, + uint8_t expectedValue) +{ + uint8_t l_attr_scratch = 0; + FAPI_INF("Entering ..."); + FAPI_INF("Set Scratch Attr on MC Target"); + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_SCRATCH_UINT8_1, i_target, + expectedValue)); + + FAPI_INF("Get Scratch Attr on MC Target"); + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_SCRATCH_UINT8_1, i_target, + l_attr_scratch)); + FAPI_ASSERT( (l_attr_scratch == expectedValue), + fapi2::FAPI2_SAMPLE(), + "p9_sample_procedure_mc read scratch value: %d , expected it to be: %d", l_attr_scratch, expectedValue); + FAPI_INF("Read scratch value : %d , expected it to be %d", l_attr_scratch, expectedValue); + +fapi_try_exit: + FAPI_INF("Exiting ..."); + return fapi2::current_err; + +} + +fapi2::ReturnCode p9_sample_procedure_mi( + fapi2::Target<fapi2::TARGET_TYPE_MI>& i_target, + uint8_t expectedValue) +{ + uint8_t l_attr_scratch = 0; + FAPI_INF("Entering ..."); + FAPI_INF("Set Scratch Attr on MI Target"); + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_SCRATCH_UINT8_1, i_target, + expectedValue)); + + FAPI_INF("Get Scratch Attr on MI Target"); + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_SCRATCH_UINT8_1, i_target, + l_attr_scratch)); + FAPI_ASSERT( (l_attr_scratch == expectedValue), + fapi2::FAPI2_SAMPLE(), + "p9_sample_procedure_mi read scratch value: %d , expected it to be: %d", l_attr_scratch, expectedValue); + FAPI_INF("Read scratch value : %d , expected it to be %d", l_attr_scratch, expectedValue); + +fapi_try_exit: + FAPI_INF("Exiting ..."); + return fapi2::current_err; + +} + +fapi2::ReturnCode p9_sample_procedure_dmi( + fapi2::Target<fapi2::TARGET_TYPE_DMI>& i_target, + uint8_t expectedValue) +{ + uint8_t l_attr_scratch = 0; + FAPI_INF("Entering ..."); + FAPI_INF("Set Scratch Attr on DMI Target"); + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_SCRATCH_UINT8_1, i_target, + expectedValue)); + + FAPI_INF("Get Scratch Attr on DMI Target"); + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_SCRATCH_UINT8_1, i_target, + l_attr_scratch)); + FAPI_ASSERT( (l_attr_scratch == expectedValue), + fapi2::FAPI2_SAMPLE(), + "p9_sample_procedure_dmi read scratch value: %d , expected it to be: %d", l_attr_scratch, expectedValue); + FAPI_INF("Read scratch value : %d , expected it to be %d", l_attr_scratch, expectedValue); + +fapi_try_exit: + FAPI_INF("Exiting ..."); + return fapi2::current_err; + +} diff --git a/src/usr/fapi2/test/p9_sample_procedure.H b/src/usr/fapi2/test/p9_sample_procedure.H index 2903e285f..04e3d692f 100644 --- a/src/usr/fapi2/test/p9_sample_procedure.H +++ b/src/usr/fapi2/test/p9_sample_procedure.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2017 */ +/* Contributors Listed Below - COPYRIGHT 2015,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -50,12 +50,10 @@ fapi2::ReturnCode p9_sample_procedure_proc( fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, uint8_t expectedValue); - fapi2::ReturnCode p9_sample_procedure_ex( fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target, uint8_t expectedValue); - fapi2::ReturnCode p9_sample_procedure_eq( fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target, uint8_t expectedValue); @@ -64,7 +62,6 @@ fapi2::ReturnCode p9_sample_procedure_core( fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_target, uint8_t expectedValue); - fapi2::ReturnCode p9_sample_procedure_mcs( fapi2::Target<fapi2::TARGET_TYPE_MCS>& i_target, uint8_t expectedValue); @@ -112,6 +109,19 @@ fapi2::ReturnCode p9_sample_procedure_phb( fapi2::ReturnCode p9_sample_procedure_pec( fapi2::Target<fapi2::TARGET_TYPE_PEC>& i_target, uint8_t expectedValue); + +fapi2::ReturnCode p9_sample_procedure_mc( + fapi2::Target<fapi2::TARGET_TYPE_MC>& i_target, + uint8_t expectedValue); + +fapi2::ReturnCode p9_sample_procedure_mi( + fapi2::Target<fapi2::TARGET_TYPE_MI>& i_target, + uint8_t expectedValue); + +fapi2::ReturnCode p9_sample_procedure_dmi( + fapi2::Target<fapi2::TARGET_TYPE_DMI>& i_target, + uint8_t expectedValue); + } #endif // _P9_SAMPLE_PROCEDURE_H_ |