diff options
author | Brian Horton <brianh@linux.ibm.com> | 2015-01-27 16:24:36 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-01-30 13:01:34 -0600 |
commit | 9a44d77296981912a412d741f3198c6a761ac5c0 (patch) | |
tree | fb18272bdb90746bf3f586db77a2c3225d7bd6af | |
parent | 5d05de78f647d44c570429463c49c92a06abcd90 (diff) | |
download | talos-hostboot-9a44d77296981912a412d741f3198c6a761ac5c0.tar.gz talos-hostboot-9a44d77296981912a412d741f3198c6a761ac5c0.zip |
deconfigure MBA if no DIMMs are functional
update existing discoverTargets() code to also check for MBAs that
do not have functional DIMM children, and deconfigure them.
Change-Id: I4926195ba7b0fd829575a60cf5442ad22358a4a6
RTC: 79862
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15331
Tested-by: Jenkins Server
Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r-- | src/include/usr/hwas/common/deconfigGard.H | 16 | ||||
-rw-r--r-- | src/include/usr/hwas/common/hwas.H | 4 | ||||
-rw-r--r-- | src/usr/hwas/common/hwas.C | 253 | ||||
-rw-r--r-- | src/usr/hwas/test/hwasGardTest.H | 626 |
4 files changed, 702 insertions, 197 deletions
diff --git a/src/include/usr/hwas/common/deconfigGard.H b/src/include/usr/hwas/common/deconfigGard.H index 65ec27bf9..b9fd4a754 100644 --- a/src/include/usr/hwas/common/deconfigGard.H +++ b/src/include/usr/hwas/common/deconfigGard.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -116,8 +116,7 @@ public: // set by call_mss_getecid() in dmi_training.c DECONFIGURED_BY_MEMORY_CONFIG, // BASE | 0x03 - // set by discover_targets() when mcs is disabled b/c there - // is a non functional membuf + // set by presentByAssoc() when a MCS has no MEMBUFs DECONFIGURED_BY_NO_CHILD_MEMBUF, // BASE | 0x04 // set by deconfigureAssocProc() in hwas/common/deconfigGard.C @@ -132,16 +131,21 @@ public: // set for SPCN initiated deconfigure DECONFIGURED_BY_SPCN, // BASE | 0x08 - // set by discoverTargets() when functional children - // are found connected to a non-functional Centaur + // set by presentByAssoc() when a MBA has no MEMBUF DECONFIGURED_BY_NO_PARENT_MEMBUF, // BASE | 0x09 - // set by presentByAssoc() when a MEMBUF has no DIMMs + // set by presentByAssoc() when a MBA has no DIMMs DECONFIGURED_BY_NO_CHILD_DIMM, // BASE | 0x0A // set by presentByAssoc() when a MEMBUF has no MCS DECONFIGURED_BY_NO_PARENT_MCS, // BASE | 0x0B + // set by presentByAssoc() when a MEMBUF has no MBAs + DECONFIGURED_BY_NO_CHILD_MBA, // BASE | 0x0C + + // set by presentByAssoc() when a DIMM has no MBA + DECONFIGURED_BY_NO_PARENT_MBA, // BASE | 0x0D + // mask - these bits mean it's a PLID and not an enum DECONFIGURED_BY_PLID_MASK = 0xFFFF0000, }; diff --git a/src/include/usr/hwas/common/hwas.H b/src/include/usr/hwas/common/hwas.H index 3e51bc5c3..0a1236679 100644 --- a/src/include/usr/hwas/common/hwas.H +++ b/src/include/usr/hwas/common/hwas.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -136,10 +136,8 @@ struct TargetInfo { TARGETING::ATTR_AFFINITY_PATH_type affinityPath; TARGETING::Target * pThisTarget; - TARGETING::ATTR_HUID_type huid; TARGETING::ATTR_TYPE_type type; HWAS::DeconfigGard::DeconfiguredByReason reason; - bool functional; }; // Structure populated in invokePresentByAssoc() for use in presentByAssoc() diff --git a/src/usr/hwas/common/hwas.C b/src/usr/hwas/common/hwas.C index 7735e19b5..c96abaf13 100644 --- a/src/usr/hwas/common/hwas.C +++ b/src/usr/hwas/common/hwas.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2015 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -1058,7 +1058,7 @@ void deconfigPresentByAssoc(TargetInfo i_targInfo) TargetHandle_t l_childTarget = *pChild_it; enableHwasState(l_childTarget, true, false, i_targInfo.reason); HWAS_INF("deconfigPresentByAssoc: Target %.8X" - " marked present, not functional: non-functional parent Centaur, reason %.x", + " marked present, not functional: reason %.x", l_childTarget->getAttr<ATTR_HUID>(), i_targInfo.reason); } @@ -1074,15 +1074,15 @@ void deconfigPresentByAssoc(TargetInfo i_targInfo) TargetHandle_t l_affinityTarget = *pChild_it; enableHwasState(l_affinityTarget,true,false, i_targInfo.reason); HWAS_INF("deconfigPresentByAssoc: Target %.8X" - " marked present, not functional: non-functional parent Centaur, reason %.x", + " marked present, not functional: reason %.x", l_affinityTarget->getAttr<ATTR_HUID>(), i_targInfo.reason); } // deconfigure the target itself enableHwasState(i_targInfo.pThisTarget,true,false,i_targInfo.reason); HWAS_INF("deconfigPresentByAssoc: Target %.8X" - " marked present, not functional, reason .%.x", - i_targInfo.huid, i_targInfo.reason); + " marked present, not functional, reason %.x", + i_targInfo.pThisTarget->getAttr<ATTR_HUID>(), i_targInfo.reason); } // deconfigPresentByAssoc @@ -1093,7 +1093,7 @@ void invokePresentByAssoc() // make one list TargetHandleList l_funcTargetList; - // get the mcss + // get the functional mcss TargetHandleList l_funcMCSTargetList; getAllChiplets(l_funcMCSTargetList, TYPE_MCS, true ); l_funcTargetList.insert(l_funcTargetList.begin(), @@ -1103,16 +1103,16 @@ void invokePresentByAssoc() // If VPO, dump targets (MCS) for verification & debug purposes #ifdef CONFIG_VPO_COMPILE HWAS_INF("invokePresentByAssoc(): MCS targets:"); - for (TargetHandleList::const_iterator l_MCS_Itr = - l_funcMCSTargetList.begin(); - l_MCS_Itr != l_funcMCSTargetList.end(); - l_MCS_Itr++) + for (TargetHandleList::const_iterator + l_MCS_Itr = l_funcMCSTargetList.begin(); + l_MCS_Itr != l_funcMCSTargetList.end(); + l_MCS_Itr++) { HWAS_INF(" MCS: HUID %.8x", TARGETING::get_huid(*l_MCS_Itr)); } #endif - // get the membufs + // get the functional membufs TargetHandleList l_funcMembufTargetList; getAllChips(l_funcMembufTargetList, TYPE_MEMBUF, true ); l_funcTargetList.insert(l_funcTargetList.begin(), @@ -1121,16 +1121,36 @@ void invokePresentByAssoc() // If VPO, dump targets (MEMBUF) for verification & debug purposes #ifdef CONFIG_VPO_COMPILE - HWAS_INF("invokePresentByAssoc(): MEMBUF targets:"); - for (TargetHandleList::const_iterator l_MEMBUF_Itr = l_funcMembufTargetList.begin(); - l_MEMBUF_Itr != l_funcMembufTargetList.end(); - l_MEMBUF_Itr++) - { - HWAS_INF(" MEMBUF: HUID %.8x", TARGETING::get_huid(*l_MEMBUF_Itr)); - } + HWAS_INF("invokePresentByAssoc(): MEMBUF targets:"); + for (TargetHandleList::const_iterator + l_MEMBUF_Itr = l_funcMembufTargetList.begin(); + l_MEMBUF_Itr != l_funcMembufTargetList.end(); + l_MEMBUF_Itr++) + { + HWAS_INF(" MEMBUF: HUID %.8x", TARGETING::get_huid(*l_MEMBUF_Itr)); + } #endif - // get the dimms + // get the functional mbas + TargetHandleList l_funcMBATargetList; + getAllChiplets(l_funcMBATargetList, TYPE_MBA, true ); + l_funcTargetList.insert(l_funcTargetList.begin(), + l_funcMBATargetList.begin(), + l_funcMBATargetList.end()); + +// If VPO, dump targets (MBA) for verification & debug purposes +#ifdef CONFIG_VPO_COMPILE + HWAS_INF("invokePresentByAssoc(): MBA targets:"); + for (TargetHandleList::const_iterator + l_MBA_Itr = l_funcMBATargetList.begin(); + l_MBA_Itr != l_funcMBATargetList.end(); + l_MBA_Itr++) + { + HWAS_INF(" MBA: HUID %.8x", TARGETING::get_huid(*l_MBA_Itr)); + } +#endif + + // get the functional dimms TargetHandleList l_funcDIMMTargetList; getAllLogicalCards(l_funcDIMMTargetList, TYPE_DIMM, true ); l_funcTargetList.insert(l_funcTargetList.begin(), @@ -1140,53 +1160,46 @@ void invokePresentByAssoc() // If VPO, dump targets (DIMM) for verification & debug purposes #ifdef CONFIG_VPO_COMPILE - HWAS_INF("invokePresentByAssoc(): DIMM targets:"); - for (TargetHandleList::const_iterator l_DIMM_Itr = l_funcDIMMTargetList.begin(); - l_DIMM_Itr != l_funcDIMMTargetList.end(); - l_DIMM_Itr++) - { - HWAS_INF(" DIMM: HUID %.8x", TARGETING::get_huid(*l_DIMM_Itr)); - } + HWAS_INF("invokePresentByAssoc(): DIMM targets:"); + for (TargetHandleList::const_iterator + l_DIMM_Itr = l_funcDIMMTargetList.begin(); + l_DIMM_Itr != l_funcDIMMTargetList.end(); + l_DIMM_Itr++) + { + HWAS_INF(" DIMM: HUID %.8x", TARGETING::get_huid(*l_DIMM_Itr)); + } #endif // Define vectors of TargetInfo structs to be used in presentByAssoc TargetInfoVector l_targInfo; TargetInfoVector l_targToDeconfig; - do - { - // Iterate through targets and populate l_targInfo vector - for (TargetHandleList::const_iterator - l_targIter = l_funcTargetList.begin(); - l_targIter != l_funcTargetList.end(); - ++l_targIter) - { - TargetInfo l_TargetInfo; - l_TargetInfo.pThisTarget = - *l_targIter; - l_TargetInfo.affinityPath = - (*l_targIter)->getAttr<ATTR_AFFINITY_PATH>(); - l_TargetInfo.huid = - (*l_targIter)->getAttr<ATTR_HUID>(); - l_TargetInfo.type = - (*l_targIter)->getAttr<ATTR_TYPE>(); - l_TargetInfo.functional = true; - l_targInfo.push_back(l_TargetInfo); - } - // Call presentByAssoc to take the functional targets in l_targInfo - // and determine which ones need to be deconfigured - presentByAssoc(l_targInfo, l_targToDeconfig); + // Iterate through targets and populate l_targInfo vector + for (TargetHandleList::const_iterator + l_targIter = l_funcTargetList.begin(); + l_targIter != l_funcTargetList.end(); + ++l_targIter) + { + TargetHandle_t pTarg = *l_targIter; + TargetInfo l_TargetInfo; + l_TargetInfo.pThisTarget = pTarg; + l_TargetInfo.affinityPath = pTarg->getAttr<ATTR_AFFINITY_PATH>(); + l_TargetInfo.type = pTarg->getAttr<ATTR_TYPE>(); + l_targInfo.push_back(l_TargetInfo); + } - // Deconfigure targets in l_targToDeconfig - for (TargetInfoVector::const_iterator - l_targIter = l_targToDeconfig.begin(); - l_targIter != l_targToDeconfig.end(); - ++l_targIter) - { - deconfigPresentByAssoc(*l_targIter); - } + // Call presentByAssoc to take the functional targets in l_targInfo + // and determine which ones need to be deconfigured + presentByAssoc(l_targInfo, l_targToDeconfig); - } while(0); + // Deconfigure targets in l_targToDeconfig + for (TargetInfoVector::const_iterator + l_targIter = l_targToDeconfig.begin(); + l_targIter != l_targToDeconfig.end(); + ++l_targIter) + { + deconfigPresentByAssoc(*l_targIter); + } } // invokePresentByAssoc void presentByAssoc(TargetInfoVector& io_funcTargets, @@ -1195,37 +1208,33 @@ void presentByAssoc(TargetInfoVector& io_funcTargets, HWAS_DBG("presentByAssoc entry"); // Sort entire vector by affinity path. This provides the algorithm with - // an ordered vector of targets, making it easy to check if a MCS has a - // MEMBUF, a MEMBUF has a MCS and DIMM, and a DIMM has a MEMBUF. + // an ordered vector of targets, making it easy to check if: + // MCS has child MEMBUF + // MEMBUF has parent MCS and child MBA + // MBA has child DIMM and parnent MEMBUF + // DIMM has parent MBA. std::sort(io_funcTargets.begin(), io_funcTargets.end(), compareAffinity); - // Keep track of the most recently seen MCS and MEMBUF. This allows the + // Keep track of the most recently seen MCS MEMBUF and MBA. This allows the // algorithm to quickly check if targets share a MCS or MEMBUF and used // for backtracking after deleting a target from the vector size_t l_MCSIndex = __INT_MAX__; size_t l_MEMBUFIndex = __INT_MAX__; + size_t l_MBAIndex = __INT_MAX__; size_t i = 0; // Perform presentByAssoc algorithm while ( i < io_funcTargets.size() ) { // INIT STEPS: - // Reset iterator, check functional state, check if the next taget in + // Reset iterator, check if the next taget in // the vector is valid or even needed // Get iterator to erase elements from vector when needed std::vector<TargetInfo>::iterator it = io_funcTargets.begin(); std::advance(it,i); - - // If target is already marked non-functional, delete from vector and - // move on. TargetInfo& l_curTargetInfo = *it; - if (!l_curTargetInfo.functional) - { - io_funcTargets.erase(it); - continue; - } // Check if there is a next target and set it // Don't need to check next target with a DIMM @@ -1236,8 +1245,9 @@ void presentByAssoc(TargetInfoVector& io_funcTargets, l_nextTargetInfo = &(*(it + 1)); } - // CASE MCS - if ( l_curTargetInfo.type == TYPE_MCS ) + switch (l_curTargetInfo.type) + { + case TYPE_MCS: { // No Child MEMBUFs // If next is not a MEMBUF sharing the same MCS, deconfig MCS @@ -1247,7 +1257,7 @@ void presentByAssoc(TargetInfoVector& io_funcTargets, { // Disable MCS - NO_CHILD_MEMBUF l_curTargetInfo.reason = - HWAS::DeconfigGard::DECONFIGURED_BY_NO_CHILD_MEMBUF; + DeconfigGard::DECONFIGURED_BY_NO_CHILD_MEMBUF; // Add target to Deconfig vector to be deconfigured later o_targToDeconfig.push_back(l_curTargetInfo); @@ -1260,29 +1270,29 @@ void presentByAssoc(TargetInfoVector& io_funcTargets, l_MCSIndex = i; i++; } + break; } // MCS - // CASE MEMBUF - else if ( l_curTargetInfo.type == TYPE_MEMBUF ) + case TYPE_MEMBUF: { - // No Child DIMMs - // If next is not a DIMM sharing the same MEMBUF, deconfig MEMBUF + // No Child MBAs + // If next is not a MBA sharing the same MEMBUF, deconfig MEMBUF if ( (l_nextTargetInfo == NULL) || - (l_nextTargetInfo->type != TYPE_DIMM) || + (l_nextTargetInfo->type != TYPE_MBA) || !isSameSubPath(l_curTargetInfo, *l_nextTargetInfo) ) { - // Disable MEMBUF - NO_CHILD_DIMM + // Disable MEMBUF - NO_CHILD_MBA l_curTargetInfo.reason = - HWAS::DeconfigGard::DECONFIGURED_BY_NO_CHILD_DIMM; + DeconfigGard::DECONFIGURED_BY_NO_CHILD_MBA; } // No Parent MCS // If MEMBUF doesn't share the same MCS as MCSIndex, deconfig MEMBUF - else if ( l_MCSIndex == __INT_MAX__ || + else if ( (l_MCSIndex == __INT_MAX__) || !isSameSubPath(l_curTargetInfo, io_funcTargets[l_MCSIndex])) { // Disable MEMBUF - NO_PARENT_MCS l_curTargetInfo.reason = - HWAS::DeconfigGard::DECONFIGURED_BY_NO_PARENT_MCS; + DeconfigGard::DECONFIGURED_BY_NO_PARENT_MCS; } // Update MEMBUF Index else @@ -1307,28 +1317,85 @@ void presentByAssoc(TargetInfoVector& io_funcTargets, { i = 0; } + break; } // MEMBUF - // CASE DIMM - else if ( l_curTargetInfo.type == TYPE_DIMM ) + case TYPE_MBA: { + // No Child DIMMs + // If next is not a DIMM sharing the same MBA, deconfig MBA + if ( (l_nextTargetInfo == NULL) || + (l_nextTargetInfo->type != TYPE_DIMM) || + !isSameSubPath(l_curTargetInfo, *l_nextTargetInfo) ) + { + // Disable MBA - NO_CHILD_DIMM + l_curTargetInfo.reason = + DeconfigGard::DECONFIGURED_BY_NO_CHILD_DIMM; + } // No Parent MEMBUF - // If DIMM does not share the same MEMBUF as MEMBUFIndex, + // If MBA doesn't share the same MEMBUF as MEMBUFIndex, deconfig MBA + else if ( (l_MEMBUFIndex == __INT_MAX__) || + !isSameSubPath(l_curTargetInfo, io_funcTargets[l_MEMBUFIndex])) + { + // Disable MBA - NO_PARENT_MEMBUF + l_curTargetInfo.reason = + DeconfigGard::DECONFIGURED_BY_NO_PARENT_MEMBUF; + } + // Update MBA Index + else + { + l_MBAIndex = i; + i++; + continue; + } + + // Add target to deconfig vector to be deconfigured later + o_targToDeconfig.push_back(l_curTargetInfo); + // Remove target from funcTargets + io_funcTargets.erase(it); + + // Backtrack to last MEMBUF + if ( l_MEMBUFIndex != __INT_MAX__ ) + { + i = l_MEMBUFIndex; + } + // Backtrack to last MCS if no MEMBUF has been seen yet + else if ( l_MCSIndex != __INT_MAX__) + { + i = l_MCSIndex; + } + // Backtrack to beginning if no MCS has been seen yet + else + { + i = 0; + } + break; + } // MBA + + case TYPE_DIMM: + { + // No Parent MBA + // If DIMM does not share the same MBA as MBAIndex, // deconfig DIMM - if ( (l_MEMBUFIndex == __INT_MAX__) || - !isSameSubPath(l_curTargetInfo, io_funcTargets[l_MEMBUFIndex])) + if ( (l_MBAIndex == __INT_MAX__) || + !isSameSubPath(l_curTargetInfo, io_funcTargets[l_MBAIndex])) { // Disable DIMM l_curTargetInfo.reason = - HWAS::DeconfigGard::DECONFIGURED_BY_NO_PARENT_MEMBUF; + DeconfigGard::DECONFIGURED_BY_NO_PARENT_MBA; // Add target to deconfig vector to be deconfigured later o_targToDeconfig.push_back(l_curTargetInfo); // Remove target from funcTargets io_funcTargets.erase(it); - // Backtrack to last MEMBUF - if ( l_MEMBUFIndex != __INT_MAX__ ) + // Backtrack to last MBA + if ( l_MBAIndex != __INT_MAX__ ) + { + i = l_MBAIndex; + } + // Backtrack to last MEMBUF if no MBA has been seen yet + else if ( l_MEMBUFIndex != __INT_MAX__) { i = l_MEMBUFIndex; } @@ -1347,9 +1414,13 @@ void presentByAssoc(TargetInfoVector& io_funcTargets, { i++; } + break; } // DIMM + default: + // no action + break; + } // switch } // while } // presentByAssoc }; // end namespace - diff --git a/src/usr/hwas/test/hwasGardTest.H b/src/usr/hwas/test/hwasGardTest.H index 3de1b5fc8..8237c7f73 100644 --- a/src/usr/hwas/test/hwasGardTest.H +++ b/src/usr/hwas/test/hwasGardTest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -45,6 +45,11 @@ using namespace HWAS; using namespace TARGETING; +bool compareAffinity(const TargetInfo t1, const TargetInfo t2) +{ + return t1.affinityPath < t2.affinityPath; +} + class HwasGardTest: public CxxTest::TestSuite { public: @@ -3377,56 +3382,75 @@ public: void testdeconfigPresentByAssoc1() { TS_TRACE(INFO_MRK "testDeconfigureAssocProc1: Started"); - // This tests the scenario where there is one mcs, membuff, and dimm + // This tests the scenario where there is 1 mcs, membuff, mba and dimm // This is done to ensure that the algorithm works on each edge case - TargetInfoVector l_targInfo; + TargetInfoVector l_targets; TargetInfoVector l_targToDeconfig; TargetInfo l_TargetInfo; l_TargetInfo.pThisTarget = NULL; - EntityPath l_ep(TARGETING::EntityPath::PATH_AFFINITY); - l_TargetInfo.functional = 1; + EntityPath l_ep[4]; // MCS only - l_ep.addLast(TYPE_MCS, 0); - l_TargetInfo.affinityPath = l_ep; - l_TargetInfo.huid = 0; + l_ep[0].addLast(TYPE_MCS, 0); + l_TargetInfo.affinityPath = l_ep[0]; // SHOULD GET DECONFIGURED l_TargetInfo.type = TYPE_MCS; - l_targInfo.push_back(l_TargetInfo); + l_targets.push_back(l_TargetInfo); - presentByAssoc(l_targInfo, l_targToDeconfig); + presentByAssoc(l_targets, l_targToDeconfig); // MEMBUF only - l_ep.addLast(TYPE_MEMBUF, 0); - l_TargetInfo.affinityPath = l_ep; - l_TargetInfo.huid = 1; + l_ep[1].addLast(TYPE_MCS, 0); + l_ep[1].addLast(TYPE_MEMBUF, 0); + l_TargetInfo.affinityPath = l_ep[1]; // SHOULD GET DECONFIGURED l_TargetInfo.type = TYPE_MEMBUF; - l_targInfo.push_back(l_TargetInfo); + l_targets.push_back(l_TargetInfo); - presentByAssoc(l_targInfo, l_targToDeconfig); + presentByAssoc(l_targets, l_targToDeconfig); + + // MBA only + l_ep[2].addLast(TYPE_MCS, 0); + l_ep[2].addLast(TYPE_MEMBUF, 0); + l_ep[2].addLast(TYPE_MBA, 0); + l_TargetInfo.affinityPath = l_ep[2]; // SHOULD GET DECONFIGURED + l_TargetInfo.type = TYPE_MBA; + l_targets.push_back(l_TargetInfo); + + presentByAssoc(l_targets, l_targToDeconfig); // DIMM only - l_ep.addLast(TYPE_DIMM, 0); - l_TargetInfo.affinityPath = l_ep; - l_TargetInfo.huid = 2; + l_ep[3].addLast(TYPE_MCS, 0); + l_ep[3].addLast(TYPE_MEMBUF, 0); + l_ep[3].addLast(TYPE_MBA, 0); + l_ep[3].addLast(TYPE_DIMM, 0); + l_TargetInfo.affinityPath = l_ep[3]; // SHOULD GET DECONFIGURED l_TargetInfo.type = TYPE_DIMM; - l_targInfo.push_back(l_TargetInfo); + l_targets.push_back(l_TargetInfo); - presentByAssoc(l_targInfo, l_targToDeconfig); + presentByAssoc(l_targets, l_targToDeconfig); // Check result - if (l_targToDeconfig.size() == 3 && - l_targToDeconfig[0].huid == 0 && - l_targToDeconfig[1].huid == 1 && - l_targToDeconfig[2].huid == 2 ) + std::sort(l_targToDeconfig.begin(), l_targToDeconfig.end(), + compareAffinity); + if ((l_targToDeconfig.size() == 4) && + (l_targToDeconfig[0].affinityPath == l_ep[0]) && + (l_targToDeconfig[1].affinityPath == l_ep[1]) && + (l_targToDeconfig[2].affinityPath == l_ep[2]) && + (l_targToDeconfig[3].affinityPath == l_ep[3]) ) { TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc1: Success"); } else { TS_FAIL("testdeconfigPresentByAssoc1: incorrect configuration returned"); + for (uint8_t i=0;i<l_targToDeconfig.size();i++) + { + char *s = l_targToDeconfig[i].affinityPath.toString(); + TS_WARN("deconfig %s reason %x",s, l_targToDeconfig[i].reason); + free(s); + } } } @@ -3436,63 +3460,77 @@ public: void testdeconfigPresentByAssoc2() { TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc2: Started"); - // This test the scenario where MCS Group 0 does not have a membuf and - // is marked for deconfigure. + // This test the scenario where MCS Group 0 does not have a membuf + // MCS Group 1 is fully populated // User-defined number of targets - size_t NUM_TARGS = 4; + size_t NUM_TARGS = 5; // Input target vector TargetInfoVector l_targets; TargetInfo l_TargInfo; - EntityPath l_ep(TARGETING::EntityPath::PATH_AFFINITY); - l_TargInfo.affinityPath = l_ep; + EntityPath l_ep[NUM_TARGS]; + l_TargInfo.pThisTarget = NULL; + l_TargInfo.affinityPath = l_ep[0]; l_targets.insert(l_targets.begin(), NUM_TARGS, l_TargInfo); // Output target vector TargetInfoVector l_targToDeconfig; // Add MCS Group 0 - l_targets[0].pThisTarget = NULL; - l_targets[0].functional = 1; + //l_targets[0].pThisTarget = NULL; l_targets[0].affinityPath.addLast(TYPE_MCS, 0); - l_targets[0].huid = 0; + l_ep[0] = l_targets[0].affinityPath; // SHOULD GET DECONFIGURED l_targets[0].type = TYPE_MCS; // Add MEMBUF Group 1 - l_targets[1].pThisTarget = NULL; - l_targets[1].functional = 1; + //l_targets[1].pThisTarget = NULL; l_targets[1].affinityPath.addLast(TYPE_MCS, 1); l_targets[1].affinityPath.addLast(TYPE_MEMBUF, 0); - l_targets[1].huid = 1; + l_ep[1] = l_targets[1].affinityPath; l_targets[1].type = TYPE_MEMBUF; - // Add DIMM Group 1 - l_targets[2].pThisTarget = NULL; - l_targets[2].functional = 1; + // Add MBA Group 1 + //l_targets[2].pThisTarget = NULL; l_targets[2].affinityPath.addLast(TYPE_MCS, 1); l_targets[2].affinityPath.addLast(TYPE_MEMBUF, 0); - l_targets[2].affinityPath.addLast(TYPE_DIMM, 0); - l_targets[2].huid = 2; - l_targets[2].type = TYPE_DIMM; + l_targets[2].affinityPath.addLast(TYPE_MBA, 0); + l_ep[2] = l_targets[2].affinityPath; + l_targets[2].type = TYPE_MBA; - // Add MCS Group 1 - l_targets[3].pThisTarget = NULL; - l_targets[3].functional = 1; + // Add DIMM Group 1 + //l_targets[3].pThisTarget = NULL; l_targets[3].affinityPath.addLast(TYPE_MCS, 1); - l_targets[3].huid = 3; - l_targets[3].type = TYPE_MCS; + l_targets[3].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[3].affinityPath.addLast(TYPE_MBA, 0); + l_targets[3].affinityPath.addLast(TYPE_DIMM, 0); + l_ep[3] = l_targets[3].affinityPath; + l_targets[3].type = TYPE_DIMM; + + // Add MCS Group 1 + //l_targets[4].pThisTarget = NULL; + l_targets[4].affinityPath.addLast(TYPE_MCS, 1); + l_ep[4] = l_targets[4].affinityPath; + l_targets[4].type = TYPE_MCS; presentByAssoc(l_targets, l_targToDeconfig); // Check result - if (l_targToDeconfig.size() == 1 && - l_targToDeconfig[0].huid == 0 ) + std::sort(l_targToDeconfig.begin(), l_targToDeconfig.end(), + compareAffinity); + if ((l_targToDeconfig.size() == 1) && + (l_targToDeconfig[0].affinityPath == l_ep[0]) ) { TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc2: Success"); } else { TS_FAIL("testdeconfigPresentByAssoc2: incorrect configuration returned"); + for (uint8_t i=0;i<l_targToDeconfig.size();i++) + { + char *s = l_targToDeconfig[i].affinityPath.toString(); + TS_WARN("deconfig %s reason %x",s, l_targToDeconfig[i].reason); + free(s); + } } } @@ -3507,71 +3545,92 @@ public: // deconfigure // User-defined number of targets - size_t NUM_TARGS = 5; + size_t NUM_TARGS = 7; // Input target vector TargetInfoVector l_targets; TargetInfo l_TargInfo; - EntityPath l_ep(TARGETING::EntityPath::PATH_AFFINITY); - l_TargInfo.affinityPath = l_ep; + EntityPath l_ep[NUM_TARGS]; + l_TargInfo.affinityPath = l_ep[0]; l_targets.insert(l_targets.begin(), NUM_TARGS, l_TargInfo); // Output target vector TargetInfoVector l_targToDeconfig; // Add MCS Group 0 l_targets[0].pThisTarget = NULL; - l_targets[0].functional = 1; l_targets[0].affinityPath.addLast(TYPE_MCS, 0); - l_targets[0].huid = 0; + l_ep[0] = l_targets[0].affinityPath; l_targets[0].type = TYPE_MCS; // Add MEMBUF Group 0 l_targets[1].pThisTarget = NULL; - l_targets[1].functional = 1; l_targets[1].affinityPath.addLast(TYPE_MCS, 0); l_targets[1].affinityPath.addLast(TYPE_MEMBUF, 0); - l_targets[1].huid = 1; + l_ep[1] = l_targets[1].affinityPath; l_targets[1].type = TYPE_MEMBUF; - // Add MEMBUF Group 1 + // Add MBA Group 0 l_targets[2].pThisTarget = NULL; - l_targets[2].functional = 1; - l_targets[2].affinityPath.addLast(TYPE_MCS, 1); + l_targets[2].affinityPath.addLast(TYPE_MCS, 0); l_targets[2].affinityPath.addLast(TYPE_MEMBUF, 0); - l_targets[2].huid = 2; - l_targets[2].type = TYPE_MEMBUF; - + l_targets[2].affinityPath.addLast(TYPE_MBA, 0); + l_ep[2] = l_targets[2].affinityPath; + l_targets[2].type = TYPE_MBA; - // Add DIMM Group 0 + // Add MBA Group 1 l_targets[3].pThisTarget = NULL; - l_targets[3].functional = 1; - l_targets[3].affinityPath.addLast(TYPE_MCS, 0); + l_targets[3].affinityPath.addLast(TYPE_MCS, 1); l_targets[3].affinityPath.addLast(TYPE_MEMBUF, 0); - l_targets[3].affinityPath.addLast(TYPE_DIMM, 0); - l_targets[3].huid = 3; - l_targets[3].type = TYPE_DIMM; + l_targets[3].affinityPath.addLast(TYPE_MBA, 0); + l_ep[3] = l_targets[3].affinityPath; // SHOULD GET DECONFIGURED + l_targets[3].type = TYPE_MBA; - // Add DIMM Group 1 + // Add MEMBUF Group 1 l_targets[4].pThisTarget = NULL; - l_targets[4].functional = 1; l_targets[4].affinityPath.addLast(TYPE_MCS, 1); l_targets[4].affinityPath.addLast(TYPE_MEMBUF, 0); - l_targets[4].affinityPath.addLast(TYPE_DIMM, 0); - l_targets[4].huid = 4; - l_targets[4].type = TYPE_DIMM; + l_ep[4] = l_targets[4].affinityPath; // SHOULD GET DECONFIGURED + l_targets[4].type = TYPE_MEMBUF; + + // Add DIMM Group 0 + l_targets[5].pThisTarget = NULL; + l_targets[5].affinityPath.addLast(TYPE_MCS, 0); + l_targets[5].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[5].affinityPath.addLast(TYPE_MBA, 0); + l_targets[5].affinityPath.addLast(TYPE_DIMM, 0); + l_ep[5] = l_targets[5].affinityPath; + l_targets[5].type = TYPE_DIMM; + + // Add DIMM Group 1 + l_targets[6].pThisTarget = NULL; + l_targets[6].affinityPath.addLast(TYPE_MCS, 1); + l_targets[6].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[6].affinityPath.addLast(TYPE_MBA, 0); + l_targets[6].affinityPath.addLast(TYPE_DIMM, 0); + l_ep[6] = l_targets[6].affinityPath; // SHOULD GET DECONFIGURED + l_targets[6].type = TYPE_DIMM; presentByAssoc(l_targets, l_targToDeconfig); // Check result - if (l_targToDeconfig.size() == 2 && - l_targToDeconfig[0].huid == 2 && - l_targToDeconfig[1].huid == 4 ) + std::sort(l_targToDeconfig.begin(), l_targToDeconfig.end(), + compareAffinity); + if ((l_targToDeconfig.size() == 3) && + (l_targToDeconfig[0].affinityPath == l_ep[4]) && // 10 MEMBUF + (l_targToDeconfig[1].affinityPath == l_ep[3]) && // 100 MBA + (l_targToDeconfig[2].affinityPath == l_ep[6]) ) // 1000 DIMM { TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc3: Success"); } else { TS_FAIL("testdeconfigPresentByAssoc3: incorrect configuration returned"); + for (uint8_t i=0;i<l_targToDeconfig.size();i++) + { + char *s = l_targToDeconfig[i].affinityPath.toString(); + TS_WARN("deconfig %s reason %x",s, l_targToDeconfig[i].reason); + free(s); + } } } @@ -3581,7 +3640,7 @@ public: void testdeconfigPresentByAssoc4() { TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc4: Started"); - // This test the scenario where MEMBUF Group 0 has no DIMMs causing + // This test the scenario where MEMBUF Group 0 has no MBAs causing // MCS Group 0 to also be deconfigured. // User-defined number of targets @@ -3590,39 +3649,45 @@ public: // Input target vector TargetInfoVector l_targets; TargetInfo l_TargInfo; - EntityPath l_ep(TARGETING::EntityPath::PATH_AFFINITY); - l_TargInfo.affinityPath = l_ep; + EntityPath l_ep[NUM_TARGS]; + l_TargInfo.affinityPath = l_ep[0]; l_targets.insert(l_targets.begin(), NUM_TARGS, l_TargInfo); // Output target vector TargetInfoVector l_targToDeconfig; // Add MCS Group 0 l_targets[0].pThisTarget = NULL; - l_targets[0].functional = 1; l_targets[0].affinityPath.addLast(TYPE_MCS, 0); - l_targets[0].huid = 0; + l_ep[0] = l_targets[0].affinityPath; // SHOULD BE DECONFIGURED l_targets[0].type = TYPE_MCS; // Add MEMBUF Group 0 l_targets[1].pThisTarget = NULL; - l_targets[1].functional = 1; l_targets[1].affinityPath.addLast(TYPE_MCS, 0); l_targets[1].affinityPath.addLast(TYPE_MEMBUF, 0); - l_targets[1].huid = 1; + l_ep[1] = l_targets[1].affinityPath; // SHOULD BE DECONFIGURED l_targets[1].type = TYPE_MEMBUF; presentByAssoc(l_targets, l_targToDeconfig); // Check result - if (l_targToDeconfig.size() == 2 && - l_targToDeconfig[0].huid == 1 && - l_targToDeconfig[1].huid == 0 ) + std::sort(l_targToDeconfig.begin(), l_targToDeconfig.end(), + compareAffinity); + if ((l_targToDeconfig.size() == 2) && + (l_targToDeconfig[0].affinityPath == l_ep[0]) && // 0 MCS + (l_targToDeconfig[1].affinityPath == l_ep[1]) ) // 00 MEMBUF { TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc4: Success"); } else { TS_FAIL("testdeconfigPresentByAssoc4: incorrect configuration returned"); + for (uint8_t i=0;i<l_targToDeconfig.size();i++) + { + char *s = l_targToDeconfig[i].affinityPath.toString(); + TS_WARN("deconfig %s reason %x",s, l_targToDeconfig[i].reason); + free(s); + } } } @@ -3632,7 +3697,7 @@ public: void testdeconfigPresentByAssoc5() { TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc5: Started"); - // This test the scenario where MEMBUF Group 0 and DIMM Group 0 having + // This test the scenario where MEMBUF Group 0 and MBA Group 0 having // no MCS. This tests the MCSINDEX edge case because one never existed // User-defined number of targets @@ -3641,41 +3706,408 @@ public: // Input target vector TargetInfoVector l_targets; TargetInfo l_TargInfo; - EntityPath l_ep(TARGETING::EntityPath::PATH_AFFINITY); - l_TargInfo.affinityPath = l_ep; + EntityPath l_ep[NUM_TARGS]; + l_TargInfo.affinityPath = l_ep[0]; l_targets.insert(l_targets.begin(), NUM_TARGS, l_TargInfo); // Output target vector TargetInfoVector l_targToDeconfig; // Add MEMBUF Group 0 l_targets[0].pThisTarget = NULL; - l_targets[0].functional = 1; l_targets[0].affinityPath.addLast(TYPE_MCS, 0); l_targets[0].affinityPath.addLast(TYPE_MEMBUF, 0); - l_targets[0].huid = 0; + l_ep[0] = l_targets[0].affinityPath; // SHOULD BE DECONFIGURED l_targets[0].type = TYPE_MEMBUF; + // Add MBA Group 0 + l_targets[1].pThisTarget = NULL; + l_targets[1].affinityPath.addLast(TYPE_MCS, 0); + l_targets[1].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[1].affinityPath.addLast(TYPE_MBA, 0); + l_ep[1] = l_targets[1].affinityPath; // SHOULD BE DECONFIGURED + l_targets[1].type = TYPE_MBA; + + presentByAssoc(l_targets, l_targToDeconfig); + + // Check result + std::sort(l_targToDeconfig.begin(), l_targToDeconfig.end(), + compareAffinity); + if ((l_targToDeconfig.size() == 2) && + (l_targToDeconfig[0].affinityPath == l_ep[0]) && // 00 MEMBUF + (l_targToDeconfig[1].affinityPath == l_ep[1]) ) // 000 MBA + { + TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc5: Success"); + } + else + { + TS_FAIL("testdeconfigPresentByAssoc5: incorrect configuration returned"); + for (uint8_t i=0;i<l_targToDeconfig.size();i++) + { + char *s = l_targToDeconfig[i].affinityPath.toString(); + TS_WARN("deconfig %s reason %x",s, l_targToDeconfig[i].reason); + free(s); + } + } + } + + /** + * @brief Test Deconfig Present Association 6 + */ + void testdeconfigPresentByAssoc6() + { + TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc6: Started"); + // This test the scenario where MBA Group 0 and DIMM Group 0 having + // no MEMBUF. This tests the MEMBUFIndex edge case because one never existed + + // User-defined number of targets + size_t NUM_TARGS = 2; + + // Input target vector + TargetInfoVector l_targets; + TargetInfo l_TargInfo; + EntityPath l_ep[NUM_TARGS]; + l_TargInfo.affinityPath = l_ep[0]; + l_targets.insert(l_targets.begin(), NUM_TARGS, l_TargInfo); + // Output target vector + TargetInfoVector l_targToDeconfig; + + // Add MBA Group 0 + l_targets[0].pThisTarget = NULL; + l_targets[0].affinityPath.addLast(TYPE_MCS, 0); + l_targets[0].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[0].affinityPath.addLast(TYPE_MBA, 0); + l_ep[0] = l_targets[0].affinityPath; // SHOULD BE DECONFIGURED + l_targets[0].type = TYPE_MBA; + // Add DIMM Group 0 l_targets[1].pThisTarget = NULL; - l_targets[1].functional = 1; l_targets[1].affinityPath.addLast(TYPE_MCS, 0); l_targets[1].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[1].affinityPath.addLast(TYPE_MBA, 0); l_targets[1].affinityPath.addLast(TYPE_DIMM, 0); - l_targets[1].huid = 1; + l_ep[1] = l_targets[1].affinityPath; // SHOULD BE DECONFIGURED l_targets[1].type = TYPE_DIMM; presentByAssoc(l_targets, l_targToDeconfig); // Check result - if (l_targToDeconfig.size() == 2 && - l_targToDeconfig[0].huid == 0 && - l_targToDeconfig[1].huid == 1 ) + std::sort(l_targToDeconfig.begin(), l_targToDeconfig.end(), + compareAffinity); + if ((l_targToDeconfig.size() == 2) && + (l_targToDeconfig[0].affinityPath == l_ep[0]) && // 000 MBA + (l_targToDeconfig[1].affinityPath == l_ep[1]) ) // 0000 DIMM { - TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc5: Success"); + TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc6: Success"); } else { - TS_FAIL("testdeconfigPresentByAssoc5: incorrect configuration returned"); + TS_FAIL("testdeconfigPresentByAssoc6: incorrect configuration returned"); + for (uint8_t i=0;i<l_targToDeconfig.size();i++) + { + char *s = l_targToDeconfig[i].affinityPath.toString(); + TS_WARN("deconfig %s reason %x",s, l_targToDeconfig[i].reason); + free(s); + } + } + } + + /** + * @brief Test Deconfig Present Association 7 + */ + void testdeconfigPresentByAssoc7() + { + TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc7: Started"); + // This test the scenario where MBA Group 1 has no DIMMS + + // User-defined number of targets + size_t NUM_TARGS = 5; + + // Input target vector + TargetInfoVector l_targets; + TargetInfo l_TargInfo; + EntityPath l_ep[NUM_TARGS]; + l_TargInfo.affinityPath = l_ep[0]; + l_targets.insert(l_targets.begin(), NUM_TARGS, l_TargInfo); + // Output target vector + TargetInfoVector l_targToDeconfig; + + // Add MCS Group 0 + l_targets[0].pThisTarget = NULL; + l_targets[0].affinityPath.addLast(TYPE_MCS, 0); + l_ep[0] = l_targets[0].affinityPath; + l_targets[0].type = TYPE_MCS; + + // Add MEMBUF Group 0 + l_targets[1].pThisTarget = NULL; + l_targets[1].affinityPath.addLast(TYPE_MCS, 0); + l_targets[1].affinityPath.addLast(TYPE_MEMBUF, 0); + l_ep[1] = l_targets[1].affinityPath; + l_targets[1].type = TYPE_MEMBUF; + + // Add MBA Group 0 + l_targets[2].pThisTarget = NULL; + l_targets[2].affinityPath.addLast(TYPE_MCS, 0); + l_targets[2].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[2].affinityPath.addLast(TYPE_MBA, 0); + l_ep[2] = l_targets[2].affinityPath; + l_targets[2].type = TYPE_MBA; + + // Add DIMM Group 0 + l_targets[3].pThisTarget = NULL; + l_targets[3].affinityPath.addLast(TYPE_MCS, 0); + l_targets[3].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[3].affinityPath.addLast(TYPE_MBA, 0); + l_targets[3].affinityPath.addLast(TYPE_DIMM, 0); + l_ep[3] = l_targets[3].affinityPath; + l_targets[3].type = TYPE_DIMM; + + // Add MBA Group 1 + l_targets[4].pThisTarget = NULL; + l_targets[4].affinityPath.addLast(TYPE_MCS, 0); + l_targets[4].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[4].affinityPath.addLast(TYPE_MBA, 1); + l_ep[4] = l_targets[4].affinityPath; // SHOULD BE DECONFIGURED + l_targets[4].type = TYPE_MBA; + + presentByAssoc(l_targets, l_targToDeconfig); + + // Check result + std::sort(l_targToDeconfig.begin(), l_targToDeconfig.end(), + compareAffinity); + if ((l_targToDeconfig.size() == 1) && + (l_targToDeconfig[0].affinityPath == l_ep[4]) ) // 001 MBA + { + TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc7: Success"); + } + else + { + TS_FAIL("testdeconfigPresentByAssoc7: incorrect configuration returned"); + for (uint8_t i=0;i<l_targToDeconfig.size();i++) + { + char *s = l_targToDeconfig[i].affinityPath.toString(); + TS_WARN("deconfig %s reason %x",s, l_targToDeconfig[i].reason); + free(s); + } + } + } + + /** + * @brief Test Deconfig Present Association 8 + */ + void testdeconfigPresentByAssoc8() + { + TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc8: Started"); + // This test the scenario where each type is missing it's child + // and the cascade + + // User-defined number of targets + size_t NUM_TARGS = 10; + + // Input target vector + TargetInfoVector l_targets; + TargetInfo l_TargInfo; + EntityPath l_ep[NUM_TARGS]; + l_TargInfo.affinityPath = l_ep[0]; + l_targets.insert(l_targets.begin(), NUM_TARGS, l_TargInfo); + // Output target vector + TargetInfoVector l_targToDeconfig; + + // Add MCS Group 0 + l_targets[0].pThisTarget = NULL; + l_targets[0].affinityPath.addLast(TYPE_MCS, 0); + l_ep[0] = l_targets[0].affinityPath; + l_targets[0].type = TYPE_MCS; // SHOULD BE DECONFIGURED + + // Add MEMBUF Group 0 + l_targets[1].pThisTarget = NULL; + l_targets[1].affinityPath.addLast(TYPE_MCS, 0); + l_targets[1].affinityPath.addLast(TYPE_MEMBUF, 0); + l_ep[1] = l_targets[1].affinityPath; + l_targets[1].type = TYPE_MEMBUF; // SHOULD BE DECONFIGURED + + // Add MBA Group 0 + l_targets[2].pThisTarget = NULL; + l_targets[2].affinityPath.addLast(TYPE_MCS, 0); + l_targets[2].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[2].affinityPath.addLast(TYPE_MBA, 0); + l_ep[2] = l_targets[2].affinityPath; + l_targets[2].type = TYPE_MBA; // SHOULD BE DECONFIGURED + + + // Add MCS Group 1 + l_targets[3].pThisTarget = NULL; + l_targets[3].affinityPath.addLast(TYPE_MCS, 1); + l_ep[3] = l_targets[3].affinityPath; + l_targets[3].type = TYPE_MCS; // SHOULD BE DECONFIGURED + + + // Add MCS Group 2 + l_targets[4].pThisTarget = NULL; + l_targets[4].affinityPath.addLast(TYPE_MCS, 2); + l_ep[4] = l_targets[4].affinityPath; + l_targets[4].type = TYPE_MCS; + + // Add MEMBUF Group 0 + l_targets[5].pThisTarget = NULL; + l_targets[5].affinityPath.addLast(TYPE_MCS, 2); + l_targets[5].affinityPath.addLast(TYPE_MEMBUF, 0); + l_ep[5] = l_targets[5].affinityPath; + l_targets[5].type = TYPE_MEMBUF; // SHOULD BE DECONFIGURED + + // Add MEMBUF Group 1 + l_targets[6].pThisTarget = NULL; + l_targets[6].affinityPath.addLast(TYPE_MCS, 2); + l_targets[6].affinityPath.addLast(TYPE_MEMBUF, 1); + l_ep[6] = l_targets[6].affinityPath; + l_targets[6].type = TYPE_MEMBUF; + + // Add MBA Group 0 + l_targets[7].pThisTarget = NULL; + l_targets[7].affinityPath.addLast(TYPE_MCS, 2); + l_targets[7].affinityPath.addLast(TYPE_MEMBUF, 1); + l_targets[7].affinityPath.addLast(TYPE_MBA, 0); + l_ep[7] = l_targets[7].affinityPath; + l_targets[7].type = TYPE_MBA; // SHOULD BE DECONFIGURED + + // Add MBA Group 1 + l_targets[8].pThisTarget = NULL; + l_targets[8].affinityPath.addLast(TYPE_MCS, 2); + l_targets[8].affinityPath.addLast(TYPE_MEMBUF, 1); + l_targets[8].affinityPath.addLast(TYPE_MBA, 1); + l_ep[8] = l_targets[8].affinityPath; + l_targets[8].type = TYPE_MBA; + + // Add DIMM Group 1 + l_targets[9].pThisTarget = NULL; + l_targets[9].affinityPath.addLast(TYPE_MCS, 2); + l_targets[9].affinityPath.addLast(TYPE_MEMBUF, 1); + l_targets[9].affinityPath.addLast(TYPE_MBA, 1); + l_targets[9].affinityPath.addLast(TYPE_DIMM, 0); + l_ep[9] = l_targets[9].affinityPath; + l_targets[9].type = TYPE_DIMM; + + presentByAssoc(l_targets, l_targToDeconfig); + + // Check result + std::sort(l_targToDeconfig.begin(), l_targToDeconfig.end(), + compareAffinity); + if ((l_targToDeconfig.size() == 6) && + (l_targToDeconfig[0].affinityPath == l_ep[0]) && // 0 MCS + (l_targToDeconfig[1].affinityPath == l_ep[1]) && // 00 MEMBUF + (l_targToDeconfig[2].affinityPath == l_ep[2]) && // 000 MBA + (l_targToDeconfig[3].affinityPath == l_ep[3]) && // 1 MCS + (l_targToDeconfig[4].affinityPath == l_ep[5]) && // 20 MEMBUF + (l_targToDeconfig[5].affinityPath == l_ep[7]) ) // 210 MBA + { + TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc8: Success"); + } + else + { + TS_FAIL("testdeconfigPresentByAssoc8: incorrect configuration returned"); + for (uint8_t i=0;i<l_targToDeconfig.size();i++) + { + char *s = l_targToDeconfig[i].affinityPath.toString(); + TS_WARN("deconfig %s reason %x",s, l_targToDeconfig[i].reason); + free(s); + } + } + } + + /** + * @brief Test Deconfig Present Association 9 + */ + void testdeconfigPresentByAssoc9() + { + TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc9: Started"); + // This test the scenario where each type is missing it's parent + // and the cascade + + // User-defined number of targets + size_t NUM_TARGS = 6; + + // Input target vector + TargetInfoVector l_targets; + TargetInfo l_TargInfo; + EntityPath l_ep[NUM_TARGS]; + l_TargInfo.affinityPath = l_ep[0]; + l_targets.insert(l_targets.begin(), NUM_TARGS, l_TargInfo); + // Output target vector + TargetInfoVector l_targToDeconfig; + + // Add MEMBUF Group 0 + l_targets[0].pThisTarget = NULL; + l_targets[0].affinityPath.addLast(TYPE_MCS, 0); + l_targets[0].affinityPath.addLast(TYPE_MEMBUF, 0); + l_ep[0] = l_targets[0].affinityPath; + l_targets[0].type = TYPE_MEMBUF; // SHOULD BE DECONFIGURED + + // Add MBA Group 0 + l_targets[1].pThisTarget = NULL; + l_targets[1].affinityPath.addLast(TYPE_MCS, 0); + l_targets[1].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[1].affinityPath.addLast(TYPE_MBA, 0); + l_ep[1] = l_targets[1].affinityPath; + l_targets[1].type = TYPE_MBA; // SHOULD BE DECONFIGURED + + // Add DIMM Group 0 + l_targets[2].pThisTarget = NULL; + l_targets[2].affinityPath.addLast(TYPE_MCS, 0); + l_targets[2].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[2].affinityPath.addLast(TYPE_MBA, 0); + l_targets[2].affinityPath.addLast(TYPE_DIMM, 0); + l_ep[2] = l_targets[2].affinityPath; + l_targets[2].type = TYPE_DIMM; // SHOULD BE DECONFIGURED + + // Add MBA Group 1 + l_targets[3].pThisTarget = NULL; + l_targets[3].affinityPath.addLast(TYPE_MCS, 1); + l_targets[3].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[3].affinityPath.addLast(TYPE_MBA, 0); + l_ep[3] = l_targets[3].affinityPath; + l_targets[3].type = TYPE_MBA; // SHOULD BE DECONFIGURED + + // Add DIMM Group 1 + l_targets[4].pThisTarget = NULL; + l_targets[4].affinityPath.addLast(TYPE_MCS, 1); + l_targets[4].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[4].affinityPath.addLast(TYPE_MBA, 0); + l_targets[4].affinityPath.addLast(TYPE_DIMM, 0); + l_ep[4] = l_targets[4].affinityPath; + l_targets[4].type = TYPE_DIMM; // SHOULD BE DECONFIGURED + + // Add DIMM Group 2 + l_targets[5].pThisTarget = NULL; + l_targets[5].affinityPath.addLast(TYPE_MCS, 2); + l_targets[5].affinityPath.addLast(TYPE_MEMBUF, 0); + l_targets[5].affinityPath.addLast(TYPE_MBA, 0); + l_targets[5].affinityPath.addLast(TYPE_DIMM, 0); + l_ep[5] = l_targets[5].affinityPath; + l_targets[5].type = TYPE_DIMM; // SHOULD BE DECONFIGURED + + presentByAssoc(l_targets, l_targToDeconfig); + + // Check result + std::sort(l_targToDeconfig.begin(), l_targToDeconfig.end(), + compareAffinity); + if ((l_targToDeconfig.size() == 6) && + (l_targToDeconfig[0].affinityPath == l_ep[0]) && + (l_targToDeconfig[1].affinityPath == l_ep[1]) && + (l_targToDeconfig[2].affinityPath == l_ep[2]) && + (l_targToDeconfig[3].affinityPath == l_ep[3]) && + (l_targToDeconfig[4].affinityPath == l_ep[4]) && + (l_targToDeconfig[5].affinityPath == l_ep[5]) ) + { + TS_TRACE(INFO_MRK "testdeconfigPresentByAssoc9: Success"); + } + else + { + TS_FAIL("testdeconfigPresentByAssoc9: incorrect configuration returned"); + for (uint8_t i=0;i<l_targToDeconfig.size();i++) + { + char *s = l_targToDeconfig[i].affinityPath.toString(); + TS_WARN("deconfig %s reason %x",s, l_targToDeconfig[i].reason); + free(s); + } } } |