summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2013-06-24 11:27:03 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-07-08 10:16:00 -0500
commit0e8072c8c3aa49ce9e75c468f4e14e80893d56f0 (patch)
treebf64388902a9fc35d016560720e1eaaa69e9ea79 /src
parent47e1255f110771d5042e322d207111abcd430bc3 (diff)
downloadtalos-hostboot-0e8072c8c3aa49ce9e75c468f4e14e80893d56f0.tar.gz
talos-hostboot-0e8072c8c3aa49ce9e75c468f4e14e80893d56f0.zip
minor issue, add tests for bus callouts
correct minor issue, make code a little more clear, and add tests for bus callouts. Change-Id: I47d488cab60098ede3339e4c6a3820348c52acae RTC: 76254 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5169 Tested-by: Jenkins Server Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/usr/errl/errlentry.C28
-rw-r--r--src/usr/errl/test/errltest.H57
-rw-r--r--src/usr/errl/test/errluserdetailtest.H54
-rw-r--r--src/usr/hwas/common/hwasCallout.C8
4 files changed, 102 insertions, 45 deletions
diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C
index d74175446..58f8b5c44 100644
--- a/src/usr/errl/errlentry.C
+++ b/src/usr/errl/errlentry.C
@@ -320,9 +320,10 @@ void ErrlEntry::addBusCallout(const TARGETING::Target *i_target_endp1,
{ // we got a non MASTER_SENTINEL target, therefore the targeting
// module is loaded, therefore we can make this call.
ep1 = i_target_endp1->getAttr<TARGETING::ATTR_PHYS_PATH>();
- size1 = TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep1.size();
- size1 *= sizeof(TARGETING::EntityPath::PathElement);
- size1 = sizeof(ep1) - size1;
+ // size is total EntityPath size minus unused path elements
+ size1 = sizeof(ep1) -
+ (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep1.size()) *
+ sizeof(TARGETING::EntityPath::PathElement);
pData1 = &ep1;
}
@@ -335,9 +336,10 @@ void ErrlEntry::addBusCallout(const TARGETING::Target *i_target_endp1,
{ // we got a non MASTER_SENTINEL target, therefore the targeting
// module is loaded, therefore we can make this call.
ep2 = i_target_endp2->getAttr<TARGETING::ATTR_PHYS_PATH>();
- size2 = TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep2.size();
- size2 *= sizeof(TARGETING::EntityPath::PathElement);
- size2 = sizeof(ep2) - size2;
+ // size is total EntityPath size minus unused path elements
+ size2 = sizeof(ep2) -
+ (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep2.size()) *
+ sizeof(TARGETING::EntityPath::PathElement);
pData2 = &ep2;
}
@@ -370,10 +372,14 @@ void ErrlEntry::addHwCallout(const TARGETING::Target *i_target,
TRACFCOMP(g_trac_errl, ENTER_MRK"addHwCallout(0x%.8x 0x%x 0x%x 0x%x)",
get_huid(i_target), i_priority,
i_deconfigState, i_gardErrorType);
- TARGETING::EntityPath ep;
- ep = i_target->getAttr<TARGETING::ATTR_PHYS_PATH>();
-
- ErrlUserDetailsCallout(&ep, sizeof(ep),
+ TARGETING::EntityPath ep =
+ i_target->getAttr<TARGETING::ATTR_PHYS_PATH>();
+ // size is total EntityPath size minus unused path elements
+ uint32_t size1 = sizeof(ep) -
+ (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep.size()) *
+ sizeof(TARGETING::EntityPath::PathElement);
+
+ ErrlUserDetailsCallout(&ep, size1,
i_priority, i_deconfigState, i_gardErrorType).addToLog(this);
}
} // addHwCallout
@@ -384,7 +390,7 @@ void ErrlEntry::addHwCallout(const TARGETING::Target *i_target,
void ErrlEntry::addProcedureCallout(const HWAS::epubProcedureID i_procedure,
const HWAS::callOutPriority i_priority)
{
- TRACDCOMP( g_trac_errl, ENTER_MRK"addProcedureCallout(0x%x, 0x%x)",
+ TRACFCOMP( g_trac_errl, ENTER_MRK"addProcedureCallout(0x%x, 0x%x)",
i_procedure, i_priority);
ErrlUserDetailsCallout(i_procedure, i_priority).addToLog(this);
diff --git a/src/usr/errl/test/errltest.H b/src/usr/errl/test/errltest.H
index e0fac99ea..4fe8beffb 100644
--- a/src/usr/errl/test/errltest.H
+++ b/src/usr/errl/test/errltest.H
@@ -344,21 +344,27 @@ public:
#else
do
{
- // find a proc target
- TARGETING::PredicateCTM procChipFilter(
- TARGETING::CLASS_CHIP, TARGETING::TYPE_PROC);
- TARGETING::TargetRangeFilter pProc(
- TARGETING::targetService().begin(),
- TARGETING::targetService().end(),
- &procChipFilter);
-
- // find a membuf target
- TARGETING::PredicateCTM membufChipFilter(
- TARGETING::CLASS_CHIP,TARGETING::TYPE_MEMBUF);
- TARGETING::TargetRangeFilter pMembuf(
- TARGETING::targetService().begin(),
- TARGETING::targetService().end(),
- &membufChipFilter);
+ // find some cores that we can play with
+ TARGETING::Target * pSys;
+ TARGETING::targetService().getTopLevelTarget(pSys);
+
+ TARGETING::PredicateCTM predCore(TARGETING::CLASS_UNIT,
+ TARGETING::TYPE_CORE);
+ TARGETING::PredicateHwas predFunctional;
+ predFunctional.poweredOn(true).present(true).functional(true);
+ TARGETING::PredicatePostfixExpr checkExpr;
+ checkExpr.push(&predCore).push(&predFunctional).And();
+ TARGETING::TargetHandleList pCoreList;
+ TARGETING::targetService().getAssociated( pCoreList, pSys,
+ TARGETING::TargetService::CHILD, TARGETING::TargetService::ALL,
+ &checkExpr );
+
+ if (pCoreList.empty())
+ {
+ TS_FAIL("testErrl3: empty pCoreList");
+ break;
+ }
+ TARGETING::TargetHandle_t pTarget = *pCoreList.begin();
errlHndl_t gard_errl = NULL;
HWAS::DeconfigGard::DeconfigureRecords_t l_deconfigRecords;
@@ -404,21 +410,20 @@ public:
ERRL_TEST_REASON_CODE);
// test the different callout types
- TS_TRACE( "test callout pProc %p", *pProc);
- ERRORLOG::ErrlUserDetailsTarget(*pProc).addToLog(errl);
+ TS_TRACE("test callout target %.8X", TARGETING::get_huid(pTarget));
+ ERRORLOG::ErrlUserDetailsTarget(pTarget).addToLog(errl);
- errl->addHwCallout(*pProc,
+ errl->addHwCallout(pTarget,
HWAS::SRCI_PRIORITY_LOW,
HWAS::DELAYED_DECONFIG,
HWAS::GARD_Fatal);
deconfigCount++;
gardCount++;
- errl->addHwCallout(*pMembuf,
+ errl->addHwCallout(pTarget,
HWAS::SRCI_PRIORITY_MED,
HWAS::DELAYED_DECONFIG,
HWAS::GARD_NULL);
- deconfigCount++;
errl->addHwCallout(TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL,
HWAS::SRCI_PRIORITY_LOW,
@@ -430,13 +435,21 @@ public:
HWAS::SRCI_PRIORITY_MED,
HWAS::DELAYED_DECONFIG,
HWAS::GARD_NULL);
- // pProc is the same, so this doesn't get incremented.
- // deconfigCount++;
+ deconfigCount++;
errl->addProcedureCallout(
HWAS::EPUB_PRC_MEMORY_PLUGGING_ERROR,
HWAS::SRCI_PRIORITY_HIGH);
+ if (pCoreList.size() > 1)
+ {
+ errl->addBusCallout(
+ pCoreList[0],
+ pCoreList[1],
+ HWAS::A_BUS_TYPE,
+ HWAS::SRCI_PRIORITY_LOW);
+ }
+
errlCommit(errl, CXXTEST_COMP_ID);
// confirm there are the correct number of deconfig and gard records
diff --git a/src/usr/errl/test/errluserdetailtest.H b/src/usr/errl/test/errluserdetailtest.H
index 88ed24a87..8f7e3124f 100644
--- a/src/usr/errl/test/errluserdetailtest.H
+++ b/src/usr/errl/test/errluserdetailtest.H
@@ -539,19 +539,37 @@ public:
HWAS::SRCI_PRIORITY_MED,
HWAS::DELAYED_DECONFIG,
HWAS::GARD_NULL).addToLog(errl);
- deconfigCount++;
- // find a proc target
- PredicateCTM procChipFilter(CLASS_CHIP,TYPE_PROC);
- TargetRangeFilter pProc(
- targetService().begin(), targetService().end(),
- &procChipFilter);
+ // find some cores that we can play with
+ Target * pSys;
+ targetService().getTopLevelTarget(pSys);
+
+ PredicateCTM predCore(CLASS_UNIT, TYPE_CORE);
+ PredicateHwas predFunctional;
+ predFunctional.poweredOn(true).present(true).functional(true);
+ PredicatePostfixExpr checkExpr;
+ checkExpr.push(&predCore).push(&predFunctional).And();
+ TargetHandleList pCoreList;
+ targetService().getAssociated( pCoreList, pSys,
+ TargetService::CHILD, TargetService::ALL, &checkExpr );
+
+ if (pCoreList.empty())
+ {
+ TS_FAIL("testCallout: empty pCoreList");
+ break;
+ }
+ TargetHandle_t l_pTarget = *pCoreList.begin();
+
TARGETING::EntityPath ep;
- ep = pProc->getAttr<TARGETING::ATTR_PHYS_PATH>();
+ ep = l_pTarget->getAttr<TARGETING::ATTR_PHYS_PATH>();
+ // size is total EntityPath size minus unused path elements
+ uint32_t ep_size = sizeof(ep) -
+ (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep.size()) *
+ sizeof(TARGETING::EntityPath::PathElement);
ErrlUserDetailsCallout(
&ep,
- sizeof(ep),
+ ep_size,
HWAS::SRCI_PRIORITY_LOW,
HWAS::DELAYED_DECONFIG,
HWAS::GARD_Fatal).addToLog(errl);
@@ -562,9 +580,28 @@ public:
HWAS::EPUB_PRC_FSI_PATH,
HWAS::SRCI_PRIORITY_HIGH).addToLog(errl);
+ if (pCoreList.size() > 1)
+ {
+ TARGETING::EntityPath ep2;
+ ep2 = pCoreList[1]->getAttr<TARGETING::ATTR_PHYS_PATH>();
+ // size is total EntityPath size minus unused path elements
+ uint32_t ep2_size = sizeof(ep2) -
+ (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep2.size()) *
+ sizeof(TARGETING::EntityPath::PathElement);
+
+ ErrlUserDetailsCallout(
+ &ep,
+ ep_size,
+ &ep2,
+ ep2_size,
+ HWAS::A_BUS_TYPE,
+ HWAS::SRCI_PRIORITY_LOW).addToLog(errl);
+ }
+
// commit the errorlog
errlCommit(errl, CXXTEST_COMP_ID);
+#if 0 // GARD records are created asynchronously, so can't really test this
// confirm there are the correct number of deconfig and gard records
gard_errl = HWAS::theDeconfigGard().getGardRecords(
HWAS::DeconfigGard::GET_ALL_GARD_RECORDS, l_gardRecords);
@@ -578,6 +615,7 @@ public:
TS_FAIL("testCallout: %d GARD Records, expected %d",
l_gardRecords.size(), gardCount);
}
+#endif
gard_errl = HWAS::theDeconfigGard()._getDeconfigureRecords(NULL,
l_deconfigRecords);
diff --git a/src/usr/hwas/common/hwasCallout.C b/src/usr/hwas/common/hwasCallout.C
index fd766bc5a..78153fb00 100644
--- a/src/usr/hwas/common/hwasCallout.C
+++ b/src/usr/hwas/common/hwasCallout.C
@@ -57,11 +57,11 @@ bool retrieveTarget(uint8_t * & io_uData,
{
// convert the EntityPath to a Target pointer
TARGETING::EntityPath ep, *ep_ptr;
- uint32_t size;
ep_ptr = (TARGETING::EntityPath *)io_uData;
- size = TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep_ptr->size();
- size *= sizeof(TARGETING::EntityPath::PathElement);
- size = sizeof(ep) - size;
+ // size is total EntityPath size minus unused path elements
+ uint32_t size = sizeof(*ep_ptr) -
+ (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep_ptr->size()) *
+ sizeof(TARGETING::EntityPath::PathElement);
memcpy(&ep, io_uData, size);
o_pTarget = TARGETING::targetService().toTarget(ep);
io_uData += size;
OpenPOWER on IntegriCloud