From 0e8072c8c3aa49ce9e75c468f4e14e80893d56f0 Mon Sep 17 00:00:00 2001 From: Brian Horton Date: Mon, 24 Jun 2013 11:27:03 -0500 Subject: 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 Reviewed-by: A. Patrick Williams III --- src/usr/errl/errlentry.C | 28 ++++++++++------- src/usr/errl/test/errltest.H | 57 +++++++++++++++++++++------------- src/usr/errl/test/errluserdetailtest.H | 54 +++++++++++++++++++++++++++----- src/usr/hwas/common/hwasCallout.C | 8 ++--- 4 files changed, 102 insertions(+), 45 deletions(-) (limited to 'src') 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(); - 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(); - 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(); - - ErrlUserDetailsCallout(&ep, sizeof(ep), + TARGETING::EntityPath ep = + i_target->getAttr(); + // 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(); + ep = l_pTarget->getAttr(); + // 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(); + // 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; -- cgit v1.2.1