summaryrefslogtreecommitdiffstats
path: root/src/usr/fapi2/test
diff options
context:
space:
mode:
authorLateef Quraishi <lateef@us.ibm.com>2016-09-13 09:18:54 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-09-21 16:59:38 -0400
commitfe3a5bea6fcadd8ef33dbd155ffc90add0c71aba (patch)
tree0e21d62300e1a04c63653f1fbcccd27e26f77b36 /src/usr/fapi2/test
parent142582dcca86c52698662aec925495bac8dc7059 (diff)
downloadtalos-hostboot-fe3a5bea6fcadd8ef33dbd155ffc90add0c71aba.tar.gz
talos-hostboot-fe3a5bea6fcadd8ef33dbd155ffc90add0c71aba.zip
getChipletNumber support for more target types
- Types added: CAPP, PEC, PHB, and NV Change-Id: I10effd492331b0439ca27df8c6ea80f6581b5899 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/29587 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@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/fapi2GetChipletNumTest.H505
-rw-r--r--src/usr/fapi2/test/fapi2TestUtils.H13
2 files changed, 364 insertions, 154 deletions
diff --git a/src/usr/fapi2/test/fapi2GetChipletNumTest.H b/src/usr/fapi2/test/fapi2GetChipletNumTest.H
index 970b5bcf0..01c65c0bc 100644
--- a/src/usr/fapi2/test/fapi2GetChipletNumTest.H
+++ b/src/usr/fapi2/test/fapi2GetChipletNumTest.H
@@ -35,51 +35,276 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
{
public:
+ void testVerifyiPhbChipletNum()
+ {
+ uint8_t l_chiplet_id = 0;
+ uint8_t l_exp_chiplet_id = 0;
+ uint8_t l_chip_unit = 0;
+
+ FAPI_INF ("Start testVerifyiPhbChipletNum");
+ do
+ {
+ // find all PHB units
+ TARGETING::Target * pSys;
+ TARGETING::targetService().getTopLevelTarget(pSys);
+ TARGETING::PredicateCTM predPhb(TARGETING::CLASS_UNIT,
+ TARGETING::TYPE_PHB);
+
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
+ TARGETING::TargetService::CHILD,
+ TARGETING::TargetService::ALL,
+ &predPhb);
+
+ if (l_TargetList.empty())
+ {
+ TS_FAIL("testVerifyiPhbChipletNum: empty l_TargetList");
+ break;
+ }
+
+ // Iterate through all PHB chiplets
+ for (auto & l_Target : l_TargetList)
+ {
+ // map Targeting Type to fapi2 Type
+ Target<fapi2::TARGET_TYPE_PHB> fapi2_Target( l_Target);
+ l_chiplet_id = fapi2_Target.getChipletNumber();
+
+ FAPI_DBG("testVerifyiPhbChipletNum HUID: %.8X, ChipletId: %.8X",
+ TARGETING::get_huid(l_Target), l_chiplet_id);
+
+ l_chip_unit = l_Target->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+
+ // PEC-0 PBH-0 maps to pervasive id 0x0D
+ if (l_chip_unit == 0)
+ {
+ l_exp_chiplet_id = START_PEC_0_CHIPLET_NUM;
+ }
+ // PEC-1 PBH-0 maps to pervasive id 0x0E
+ // PEC-1 PBH-1 maps to pervasive id 0x0E
+ else if ((l_chip_unit >= 1) && (l_chip_unit <= 2))
+ {
+ l_exp_chiplet_id = START_PEC_1_CHIPLET_NUM;
+ }
+ // PEC-2 PBH-0 maps to pervasive id 0x0F
+ // PEC-2 PBH-1 maps to pervasive id 0x0F
+ // PEC-2 PBH-2 maps to pervasive id 0x0F
+ else if ((l_chip_unit >= 3) && (l_chip_unit <= 5))
+ {
+ l_exp_chiplet_id = START_PEC_2_CHIPLET_NUM;
+ }
+
+ if (l_chiplet_id != l_exp_chiplet_id)
+ {
+ TS_FAIL("testVerifyiPhbChipletNum: Mismatch - Expected: %.8X:, Found: %.8X",
+ l_exp_chiplet_id, l_chiplet_id);
+ break;
+ }
+ }
+ } while(0);
+ FAPI_INF("Complete testVerifyiPhbChipletNum");
+ }
+
+ void testVerifyNvChipletNum()
+ {
+ uint8_t l_chiplet_id = 0;
+ uint8_t l_exp_chiplet_id = 0;
+
+ FAPI_INF ("Start testVerifyNvChipletNum");
+ do
+ {
+ // find the all NV units
+ TARGETING::Target * pSys;
+ TARGETING::targetService().getTopLevelTarget(pSys);
+ TARGETING::PredicateCTM predNv(TARGETING::CLASS_UNIT,
+ TARGETING::TYPE_NV);
+
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
+ TARGETING::TargetService::CHILD,
+ TARGETING::TargetService::ALL,
+ &predNv);
+
+ if (l_TargetList.empty())
+ {
+ TS_FAIL("testVerifyNvChipletNum: empty l_TargetList");
+ break;
+ }
+
+ // Iterate through all NV chiplets
+ for (auto & l_Target : l_TargetList)
+ {
+ // map Targeting Type to fapi2 Type
+ Target<fapi2::TARGET_TYPE_NV> fapi2_Target( l_Target);
+ l_chiplet_id = fapi2_Target.getChipletNumber();
+
+ FAPI_DBG("testVerifyNvChipletNum HUID: %.8X, ChipletId: %.8X",
+ TARGETING::get_huid(l_Target), l_chiplet_id);
+
+ // NV 0,1 maps to pervasive id 0x05
+ l_exp_chiplet_id = START_NV_CHIPLET_NUM;
+
+ if (l_chiplet_id != l_exp_chiplet_id)
+ {
+ TS_FAIL("testVerifyNvChipletNum: Mismatch - Expected: %.8X:, Found: %.8X",
+ l_exp_chiplet_id, l_chiplet_id);
+ break;
+ }
+ }
+ } while(0);
+ FAPI_INF("Complete testVerifyNvChipletNum");
+ }
+
+ void testVerifyPecChipletNum()
+ {
+ uint8_t l_chiplet_id = 0;
+ uint8_t l_exp_chiplet_id = 0;
+ uint8_t l_chip_unit = 0;
+
+ FAPI_INF ("Start testVerifyPecChipletNum");
+ do
+ {
+ // find all PEC units
+ TARGETING::Target * pSys;
+ TARGETING::targetService().getTopLevelTarget(pSys);
+ TARGETING::PredicateCTM predPec(TARGETING::CLASS_UNIT,
+ TARGETING::TYPE_PEC);
+
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
+ TARGETING::TargetService::CHILD,
+ TARGETING::TargetService::ALL,
+ &predPec);
+
+ if (l_TargetList.empty())
+ {
+ TS_FAIL("testVerifyPecChipletNum: empty l_TargetList");
+ break;
+ }
+
+ // Iterate through all PEC chiplets
+ for (auto & l_Target : l_TargetList)
+ {
+ // map Targeting Type to fapi2 Type
+ Target<fapi2::TARGET_TYPE_PEC> fapi2_Target( l_Target);
+ l_chiplet_id = fapi2_Target.getChipletNumber();
+
+ FAPI_DBG("testVerifyPecChipletNum HUID: %.8X, ChipletId: %.8X",
+ TARGETING::get_huid(l_Target), l_chiplet_id);
+
+ // PEC 0,1,2 maps to pervasive ids 0x0D, 0x0E, 0x0F
+ l_chip_unit = l_Target->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+ l_exp_chiplet_id = l_chip_unit + START_PEC_0_CHIPLET_NUM;
+
+ if (l_chiplet_id != l_exp_chiplet_id)
+ {
+ TS_FAIL("testVerifyPecChipletNum: Mismatch - Expected: %.8X:, Found: %.8X",
+ l_exp_chiplet_id, l_chiplet_id);
+ break;
+ }
+ }
+ } while(0);
+ FAPI_INF("Complete testVerifyPecChipletNum");
+ }
+
+ void testVerifyCappChipletNum()
+ {
+ uint8_t l_chiplet_id = 0;
+ uint8_t l_exp_chiplet_id = 0;
+ uint8_t l_chip_unit = 0;
+
+ FAPI_INF ("Start testVerifyCappChipletNum");
+ do
+ {
+ // find all CAPP units
+ TARGETING::Target * pSys;
+ TARGETING::targetService().getTopLevelTarget(pSys);
+ TARGETING::PredicateCTM predCapp(TARGETING::CLASS_UNIT,
+ TARGETING::TYPE_CAPP);
+
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
+ TARGETING::TargetService::CHILD,
+ TARGETING::TargetService::ALL,
+ &predCapp);
+
+ if (l_TargetList.empty())
+ {
+ TS_FAIL("testVerifyCappChipletNum: empty l_TargetList");
+ break;
+ }
+
+ // Iterate through all CAPP chiplets
+ for (auto & l_Target : l_TargetList)
+ {
+ // map Targeting Type to fapi2 Type
+ Target<fapi2::TARGET_TYPE_CAPP> fapi2_Target( l_Target);
+ l_chiplet_id = fapi2_Target.getChipletNumber();
+
+ FAPI_DBG("testVerifyCappChipletNum HUID: %.8X, ChipletId: %.8X",
+ TARGETING::get_huid(l_Target), l_chiplet_id);
+
+ // CAPP 0,1 maps to pervasive ids 0x02, 0x04
+ l_chip_unit = l_Target->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+ if (l_chip_unit == 0 )
+ {
+ l_exp_chiplet_id = START_CAPP_CHIPLET_NUM;
+ }
+ else
+ {
+ l_exp_chiplet_id = START_CAPP_CHIPLET_NUM + 2;
+ }
+
+ if (l_chiplet_id != l_exp_chiplet_id)
+ {
+ TS_FAIL("testVerifyCappChipletNum: Mismatch - Expected: %.8X:, Found: %.8X",
+ l_exp_chiplet_id, l_chiplet_id);
+ break;
+ }
+ }
+ } while(0);
+ FAPI_INF("Complete testVerifyCappChipletNum");
+ }
+
void testVerifyMcbistChipletNum()
{
uint8_t l_chiplet_id = 0;
uint8_t l_exp_chiplet_id = 0;
- uint8_t chipUnit = 0;
+ uint8_t l_chip_unit = 0;
FAPI_INF ("Start testVerifyMcbistChipletNum");
do
{
- // find the unit
+ // find all MCBIST units
TARGETING::Target * pSys;
TARGETING::targetService().getTopLevelTarget(pSys);
TARGETING::PredicateCTM predMcbist(TARGETING::CLASS_UNIT,
TARGETING::TYPE_MCBIST);
- TARGETING::TargetHandleList pMcbistList;
- TARGETING::targetService().getAssociated( pMcbistList, pSys,
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&predMcbist);
- if (pMcbistList.empty())
+ if (l_TargetList.empty())
{
- TS_FAIL("testVerifyMcbistChipletNum: empty pMcbistList");
+ TS_FAIL("testVerifyMcbistChipletNum: empty l_TargetList");
break;
}
- // Iterate through present procs
- for (TARGETING::TargetHandleList::const_iterator
- l_mcbistIter = pMcbistList.begin();
- l_mcbistIter != pMcbistList.end();
- ++l_mcbistIter)
+ // Iterate through all MCBIST chiplets
+ for (auto & l_Target : l_TargetList)
{
-
- TARGETING::Target * pTarTarget = *l_mcbistIter;
-
// map Targeting Type to fapi2 Type
- Target<fapi2::TARGET_TYPE_MCBIST> fapi2_Target( pTarTarget);
+ Target<fapi2::TARGET_TYPE_MCBIST> fapi2_Target( l_Target);
l_chiplet_id = fapi2_Target.getChipletNumber();
FAPI_DBG("testVerifyMcbistChipletNum HUID: %.8X, ChipletId: %.8X",
- TARGETING::get_huid(pTarTarget), l_chiplet_id);
+ TARGETING::get_huid(l_Target), l_chiplet_id);
- chipUnit = pTarTarget->getAttr<TARGETING::ATTR_CHIP_UNIT>();
- l_exp_chiplet_id = chipUnit + START_MCBIST_CHIPLET_NUM;
+ // MCBIST 0,1 maps to pervasive ids 0x07, 0x08
+ l_chip_unit = l_Target->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+ l_exp_chiplet_id = l_chip_unit + START_MCBIST_CHIPLET_NUM;
if (l_chiplet_id != l_exp_chiplet_id)
{
@@ -100,51 +325,47 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
FAPI_INF("Start testVerifyMcsChipletNum");
do
{
- // find the unit
+ // find all MCS units
TARGETING::Target * pSys;
TARGETING::targetService().getTopLevelTarget(pSys);
TARGETING::PredicateCTM predMcs(TARGETING::CLASS_UNIT,
TARGETING::TYPE_MCS);
- TARGETING::TargetHandleList pMcsList;
- TARGETING::targetService().getAssociated( pMcsList, pSys,
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&predMcs);
- if (pMcsList.empty())
+ if (l_TargetList.empty())
{
- TS_FAIL("testVerifyMcsChipletNum: empty pMcsList");
+ TS_FAIL("testVerifyMcsChipletNum: empty l_TargetList");
break;
}
- // Iterate through present procs
- for (TARGETING::TargetHandleList::const_iterator
- l_mcsIter = pMcsList.begin();
- l_mcsIter != pMcsList.end();
- ++l_mcsIter)
+ // Iterate through all MCS chiplets
+ for (auto & l_Target : l_TargetList)
{
- TARGETING::Target * pTarTarget = *l_mcsIter;
-
// map Targeting Type to fapi2 Type
- Target<fapi2::TARGET_TYPE_MCS> fapi2_Target(pTarTarget);
+ Target<fapi2::TARGET_TYPE_MCS> fapi2_Target(l_Target);
l_chiplet_id = fapi2_Target.getChipletNumber();
FAPI_DBG("testVerifyMcsChipletNum HUID: %.8X, ChipletId: %.8X",
- TARGETING::get_huid(pTarTarget),
+ TARGETING::get_huid(l_Target),
l_chiplet_id);
ReturnCode l_rc;
- fapi2::ATTR_CHIP_UNIT_POS_Type chipPos = 0;
+ fapi2::ATTR_CHIP_UNIT_POS_Type l_chipPos = 0;
l_rc = FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS,
- pTarTarget,chipPos);
+ l_Target, l_chipPos);
if( l_rc )
{
TS_FAIL("testVerifyMcsChipletNum: Error getting fapi::ATTR_CHIP_UNIT_POS");
break;
}
- l_exp_chiplet_id = (chipPos/2) + START_MCBIST_CHIPLET_NUM;
+ // MCS 0..1, 2..3 maps to pervasive ids 0x07, 0x08
+ l_exp_chiplet_id = (l_chipPos/2) + START_MCBIST_CHIPLET_NUM;
if (l_chiplet_id != l_exp_chiplet_id)
{
@@ -161,47 +382,42 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
{
uint8_t l_chiplet_id = 0;
uint8_t l_exp_chiplet_id = 0;
- uint8_t chipUnit = 0;
+ uint8_t l_chip_unit = 0;
FAPI_INF("Start testVerifyMcaChipletNum");
do
{
- // find the unit
+ // find all MCA units
TARGETING::Target * pSys;
TARGETING::targetService().getTopLevelTarget(pSys);
TARGETING::PredicateCTM predMca(TARGETING::CLASS_UNIT,
TARGETING::TYPE_MCA);
- TARGETING::TargetHandleList pMcaistList;
- TARGETING::targetService().getAssociated( pMcaistList, pSys,
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&predMca);
- if (pMcaistList.empty())
+ if (l_TargetList.empty())
{
TS_FAIL("testVerifyMcaChipletNum: empty pMcbistList");
break;
}
- // Iterate through present procs
- for (TARGETING::TargetHandleList::const_iterator
- l_mcaistIter = pMcaistList.begin();
- l_mcaistIter != pMcaistList.end();
- ++l_mcaistIter)
+ // Iterate through all MCA chiplets
+ for (auto & l_Target : l_TargetList)
{
-
- TARGETING::Target * pTarTarget = *l_mcaistIter;
-
// map Targeting Type to fapi2 Type
- Target<fapi2::TARGET_TYPE_MCBIST> fapi2_Target( pTarTarget);
+ Target<fapi2::TARGET_TYPE_MCBIST> fapi2_Target( l_Target);
l_chiplet_id = fapi2_Target.getChipletNumber();
FAPI_DBG("testVerifyMcaChipletNum HUID: %.8X, ChipletId: %.8X",
- TARGETING::get_huid(pTarTarget), l_chiplet_id);
+ TARGETING::get_huid(l_Target), l_chiplet_id);
- chipUnit = pTarTarget->getAttr<TARGETING::ATTR_CHIP_UNIT>();
- l_exp_chiplet_id = chipUnit / 4 + START_MCBIST_CHIPLET_NUM;
+ // MCA 0..3, 4..7 maps to pervasive ids 0x07, 0x08
+ l_chip_unit = l_Target->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+ l_exp_chiplet_id = l_chip_unit / 4 + START_MCBIST_CHIPLET_NUM;
if (l_chiplet_id != l_exp_chiplet_id)
{
@@ -218,58 +434,53 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
{
uint8_t l_chiplet_id = 0;
uint8_t l_exp_chiplet_id = 0;
- uint8_t chipUnit = 0;
+ uint8_t l_chip_unit = 0;
FAPI_INF("Start testVerifyObusChipletNum");
do
{
- // find the unit
+ // find all OBUS units
TARGETING::Target * pSys;
TARGETING::targetService().getTopLevelTarget(pSys);
TARGETING::PredicateCTM predObus(TARGETING::CLASS_UNIT,
TARGETING::TYPE_OBUS);
- TARGETING::TargetHandleList pObusList;
- TARGETING::targetService().getAssociated( pObusList, pSys,
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&predObus);
- if (pObusList.empty())
+ if (l_TargetList.empty())
{
- TS_FAIL("testVerifyObusChipletNum: empty pObusList");
+ TS_FAIL("testVerifyObusChipletNum: empty l_TargetList");
break;
}
- // Iterate through present procs
- for (TARGETING::TargetHandleList::const_iterator
- l_obusIter = pObusList.begin();
- l_obusIter != pObusList.end();
- ++l_obusIter)
+ // Iterate through all OBUS chiplets
+ for (auto & l_Target : l_TargetList)
{
- TARGETING::Target * pTarTarget = *l_obusIter;
-
// map Targeting Type to fapi2 Type
- Target<fapi2::TARGET_TYPE_OBUS> fapi2_Target( pTarTarget);
+ Target<fapi2::TARGET_TYPE_OBUS> fapi2_Target( l_Target);
l_chiplet_id = fapi2_Target.getChipletNumber();
FAPI_DBG("testVerifyObusChipletNum HUID: %.8X, ChipletId: %.8X",
- TARGETING::get_huid(pTarTarget),
+ TARGETING::get_huid(l_Target),
l_chiplet_id);
ReturnCode l_rc;
- fapi2::ATTR_CHIP_UNIT_POS_Type chipPos = 0;
+ fapi2::ATTR_CHIP_UNIT_POS_Type l_chipPos = 0;
l_rc = FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS,
- pTarTarget,chipPos);
+ l_Target, l_chipPos);
if( l_rc )
{
TS_FAIL("testVerifyObusChipletNum: Error getting fapi::ATTR_CHIP_UNIT_POS");
break;
}
- // Nimbus has two obuses 0 & 3
- chipUnit = pTarTarget->getAttr<TARGETING::ATTR_CHIP_UNIT>();
- l_exp_chiplet_id = chipUnit + START_OBUS_CHIPLET_NUM;
+ // OBUS 0,3 maps to pervasive ids 0x09, 0x0C
+ l_chip_unit = l_Target->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+ l_exp_chiplet_id = l_chip_unit + START_OBUS_CHIPLET_NUM;
if (l_chiplet_id != l_exp_chiplet_id)
{
@@ -289,40 +500,36 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
FAPI_INF("Start testVerifyXbusChipletNum");
do
{
- // find the unit
+ // find all XBUS units
TARGETING::Target * pSys;
TARGETING::targetService().getTopLevelTarget(pSys);
TARGETING::PredicateCTM predXbus(TARGETING::CLASS_UNIT,
TARGETING::TYPE_XBUS);
- TARGETING::TargetHandleList pXbusList;
- TARGETING::targetService().getAssociated( pXbusList, pSys,
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&predXbus);
- if (pXbusList.empty())
+ if (l_TargetList.empty())
{
- TS_FAIL("testVerifyXbusChipletNum: empty pXbusList");
+ TS_FAIL("testVerifyXbusChipletNum: empty l_TargetList");
break;
}
- // Iterate through present procs
- for (TARGETING::TargetHandleList::const_iterator
- l_xbusIter = pXbusList.begin();
- l_xbusIter != pXbusList.end();
- ++l_xbusIter)
+ // Iterate through all XBUS chiplets
+ for (auto & l_Target : l_TargetList)
{
- TARGETING::Target * pTarTarget = *l_xbusIter;
-
// map Targeting Type to fapi2 Type
- Target<fapi2::TARGET_TYPE_XBUS> fapi2_Target( pTarTarget);
+ Target<fapi2::TARGET_TYPE_XBUS> fapi2_Target( l_Target);
l_chiplet_id = fapi2_Target.getChipletNumber();
FAPI_DBG("testVerifyXbusChipletNum HUID: %.8X, ChipletId: %.8X",
- TARGETING::get_huid(pTarTarget),
+ TARGETING::get_huid(l_Target),
l_chiplet_id);
+ // XBUS 0,1 maps to pervasive id 0x06
if (l_chiplet_id != START_XBUS_CHIPLET_NUM)
{
TS_FAIL("testVerifyXbusChipletNum: Mismatch - Expected: %.8X:, Found: %.8X",
@@ -336,51 +543,47 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
void testVerifyPervChipletNum()
{
uint8_t l_chiplet_id = 0;
- uint8_t chipUnit = 0;
+ uint8_t l_chip_unit = 0;
FAPI_INF("Start testVerifyPervChipletNum");
do
{
- // find the unit
+ // find all PERV units
TARGETING::Target * pSys;
TARGETING::targetService().getTopLevelTarget(pSys);
TARGETING::PredicateCTM predPerv(TARGETING::CLASS_UNIT,
TARGETING::TYPE_PERV);
- TARGETING::TargetHandleList pPervList;
- TARGETING::targetService().getAssociated( pPervList, pSys,
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&predPerv );
- if (pPervList.empty())
+ if (l_TargetList.empty())
{
- TS_FAIL("testVerifyPervChipletNum: empty pPervList");
+ TS_FAIL("testVerifyPervChipletNum: empty l_TargetList");
break;
}
- // Iterate through present procs
- for (TARGETING::TargetHandleList::const_iterator
- l_pervIter = pPervList.begin();
- l_pervIter != pPervList.end();
- ++l_pervIter)
+ // Iterate through all PERV chiplets
+ for (auto & l_Target : l_TargetList)
{
- TARGETING::Target * pTarTarget = *l_pervIter;
-
// map Targeting Type to fapi2 Type
- Target<fapi2::TARGET_TYPE_PERV> fapi2_Target( pTarTarget);
+ Target<fapi2::TARGET_TYPE_PERV> fapi2_Target( l_Target);
l_chiplet_id = fapi2_Target.getChipletNumber();
FAPI_DBG("testVerifyPervChipletNum HUID: %.8X, ChipletId: %.8X",
- TARGETING::get_huid(pTarTarget),
+ TARGETING::get_huid(l_Target),
l_chiplet_id);
- chipUnit = pTarTarget->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+ // PERV units and chiplet ids are same
+ l_chip_unit = l_Target->getAttr<TARGETING::ATTR_CHIP_UNIT>();
- if (l_chiplet_id != chipUnit)
+ if (l_chiplet_id != l_chip_unit)
{
TS_FAIL("testVerifyPervChipletNum: Mismatch - Expected: %.8X:, Found: %.8X",
- chipUnit, l_chiplet_id);
+ l_chip_unit, l_chiplet_id);
break;
}
}
@@ -392,47 +595,43 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
{
uint8_t l_chiplet_id = 0;
uint8_t l_exp_chiplet_id = 0;
- uint8_t chipUnit = 0;
+ uint8_t l_chip_unit = 0;
FAPI_INF("Start testVerifyEQChipletNum");
do
{
- // find the unit
+ // find all EQ units`
TARGETING::Target * pSys;
TARGETING::targetService().getTopLevelTarget(pSys);
TARGETING::PredicateCTM predEq(TARGETING::CLASS_UNIT,
TARGETING::TYPE_EQ);
- TARGETING::TargetHandleList pEqList;
- TARGETING::targetService().getAssociated( pEqList, pSys,
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&predEq );
- if (pEqList.empty())
+ if (l_TargetList.empty())
{
- TS_FAIL("testVerifyEQChipletNum: empty pEqList");
+ TS_FAIL("testVerifyEQChipletNum: empty l_TargetList");
break;
}
- // Iterate through present procs
- for (TARGETING::TargetHandleList::const_iterator
- l_eqIter = pEqList.begin();
- l_eqIter != pEqList.end();
- ++l_eqIter)
+ // Iterate through all EQ chiplets
+ for (auto & l_Target : l_TargetList)
{
- TARGETING::Target * pTarTarget = *l_eqIter;
-
// map Targeting Type to fapi2 Type
- Target<fapi2::TARGET_TYPE_EQ> fapi2_Target( pTarTarget);
+ Target<fapi2::TARGET_TYPE_EQ> fapi2_Target( l_Target);
l_chiplet_id = fapi2_Target.getChipletNumber();
FAPI_DBG("testVerifyEQChipletNum HUID: %.8X, ChipletId: %.8X",
- TARGETING::get_huid(pTarTarget),
+ TARGETING::get_huid(l_Target),
l_chiplet_id);
- chipUnit = pTarTarget->getAttr<TARGETING::ATTR_CHIP_UNIT>();
- l_exp_chiplet_id = chipUnit + START_EQ_CHIPLET_NUM;
+ // EQ 0..5 maps to pervasive ids 0x10..0x15
+ l_chip_unit = l_Target->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+ l_exp_chiplet_id = l_chip_unit + START_EQ_CHIPLET_NUM;
if (l_chiplet_id != l_exp_chiplet_id)
{
@@ -453,50 +652,46 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
FAPI_INF("Start testVerifyEXChipletNum");
do
{
- // find the unit
+ // find all EX units
TARGETING::Target * pSys;
TARGETING::targetService().getTopLevelTarget(pSys);
TARGETING::PredicateCTM predEx(TARGETING::CLASS_UNIT,
TARGETING::TYPE_EX);
- TARGETING::TargetHandleList pExList;
- TARGETING::targetService().getAssociated( pExList, pSys,
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&predEx );
- if (pExList.empty())
+ if (l_TargetList.empty())
{
- TS_FAIL("testVerifyEXChipletNum: empty pExList");
+ TS_FAIL("testVerifyEXChipletNum: empty l_TargetList");
break;
}
- // Iterate through present procs
- for (TARGETING::TargetHandleList::const_iterator
- l_exIter = pExList.begin();
- l_exIter != pExList.end();
- ++l_exIter)
+ // Iterate through all EXs
+ for (auto & l_Target : l_TargetList)
{
- TARGETING::Target * pTarTarget = *l_exIter;
-
// map Targeting Type to fapi2 Type
- Target<fapi2::TARGET_TYPE_EX> fapi2_Target( pTarTarget);
+ Target<fapi2::TARGET_TYPE_EX> fapi2_Target( l_Target);
l_chiplet_id = fapi2_Target.getChipletNumber();
FAPI_DBG("testVerifyEXChipletNum HUID: %.8X, ChipletId: %.8X",
- TARGETING::get_huid(pTarTarget),
+ TARGETING::get_huid(l_Target),
l_chiplet_id);
ReturnCode l_rc;
fapi2::ATTR_CHIP_UNIT_POS_Type chipPos = 0;
l_rc = FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS,
- pTarTarget,chipPos);
+ l_Target,chipPos);
if( l_rc )
{
TS_FAIL("testVerifyEXChipletNum: Error getting fapi::ATTR_CHIP_UNIT_POS");
break;
}
+ // EXs maps to pervasive id of their parents 0x10..0x15
l_exp_chiplet_id = (chipPos/2) + START_EQ_CHIPLET_NUM;
if (l_chiplet_id != l_exp_chiplet_id)
@@ -516,46 +711,42 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
uint8_t l_chiplet_id = 0;
uint8_t l_exp_chiplet_id = 0;
- uint8_t chipUnit = 0;
+ uint8_t l_chip_unit = 0;
do
{
- // find the unit
+ // find all cpu COREs
TARGETING::Target * pSys;
TARGETING::targetService().getTopLevelTarget(pSys);
TARGETING::PredicateCTM predCore(TARGETING::CLASS_UNIT,
TARGETING::TYPE_CORE);
- TARGETING::TargetHandleList pCoreList;
- TARGETING::targetService().getAssociated( pCoreList, pSys,
+ TARGETING::TargetHandleList l_TargetList;
+ TARGETING::targetService().getAssociated( l_TargetList, pSys,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&predCore );
- if (pCoreList.empty())
+ if (l_TargetList.empty())
{
- TS_FAIL("testVerifyCoreChipletNum: empty pCoreList");
+ TS_FAIL("testVerifyCoreChipletNum: empty l_TargetList");
break;
}
- // Iterate through present cores
- for (TARGETING::TargetHandleList::const_iterator
- l_coreIter = pCoreList.begin();
- l_coreIter != pCoreList.end();
- ++l_coreIter)
+ // Iterate through all cores
+ for (auto & l_Target : l_TargetList)
{
- TARGETING::Target * pTarTarget = *l_coreIter;
-
// map Targeting Type to fapi2 Type
- Target<fapi2::TARGET_TYPE_CORE> fapi2_Target( pTarTarget);
+ Target<fapi2::TARGET_TYPE_CORE> fapi2_Target( l_Target);
l_chiplet_id = fapi2_Target.getChipletNumber();
FAPI_DBG("testVerifyCoreChipletNum HUID: %.8X, ChipletId: %.8X",
- TARGETING::get_huid(pTarTarget),
+ TARGETING::get_huid(l_Target),
l_chiplet_id);
- chipUnit = pTarTarget->getAttr<TARGETING::ATTR_CHIP_UNIT>();
- l_exp_chiplet_id = chipUnit + START_CORE_CHIPLET_NUM;
+ // Processor Core 0..23 maps to pervasive ids 0x20..0x37
+ l_chip_unit = l_Target->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+ l_exp_chiplet_id = l_chip_unit + START_CORE_CHIPLET_NUM;
if (l_chiplet_id != l_exp_chiplet_id)
{
@@ -596,6 +787,14 @@ class Fapi2GetChipletNum : public CxxTest::TestSuite
testVerifyMcaChipletNum();
+ testVerifyCappChipletNum();
+
+ testVerifyNvChipletNum();
+
+ testVerifyPecChipletNum();
+
+ testVerifyiPhbChipletNum();
+
} while(0);
FAPI_DBG("test_fapi2ChipletNum Test Complete.");
} // end test_fapi2ChipletNum()
diff --git a/src/usr/fapi2/test/fapi2TestUtils.H b/src/usr/fapi2/test/fapi2TestUtils.H
index ccc90146d..937af56f3 100644
--- a/src/usr/fapi2/test/fapi2TestUtils.H
+++ b/src/usr/fapi2/test/fapi2TestUtils.H
@@ -48,9 +48,20 @@
// non-core and non-cache chiplet ids
#define START_PERV_CHIPLET_NUM 0x01
+// CAPI Unit(0,1 => 0x02, 0x04)
+#define START_CAPP_CHIPLET_NUM 0x02
+// NV (0, 1 => 0x05)
+#define START_NV_CHIPLET_NUM 0x05
+// XBUS (0, 1 => 0x6)
#define START_XBUS_CHIPLET_NUM 0x06
+// MCBIST (0, 1 => 0x07, 0x08)
#define START_MCBIST_CHIPLET_NUM 0x07
+// OBUS (0, 3 => 0x09, 0x0C)
#define START_OBUS_CHIPLET_NUM 0x09
+// PEC (0, 1, 2 => 0x0D, 0x0E, 0x0F)
+#define START_PEC_0_CHIPLET_NUM 0x0D
+#define START_PEC_1_CHIPLET_NUM 0x0E
+#define START_PEC_2_CHIPLET_NUM 0x0F
// All Cache Chiplets
#define START_EQ_CHIPLET_NUM 0x10
@@ -93,7 +104,7 @@ enum PERVASIVE_CHILDREN {
PERV_XBUS_CHILDREN = 2,
PERV_OBUS_CHILDREN = 1,
PERV_CAPP_CHILDREN = 1,
- PERV_NV_CHILDREN = 1,
+ PERV_NV_CHILDREN = 2,
PERV_MCBIST_CHILDREN = 1,
PERV_MCS_CHILDREN = 2,
PERV_MCA_CHILDREN = 4,
OpenPOWER on IntegriCloud