From 9a44d77296981912a412d741f3198c6a761ac5c0 Mon Sep 17 00:00:00 2001 From: Brian Horton Date: Tue, 27 Jan 2015 16:24:36 -0600 Subject: 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 Reviewed-by: Daniel M. Crowell Reviewed-by: A. Patrick Williams III --- src/usr/hwas/test/hwasGardTest.H | 626 +++++++++++++++++++++++++++++++++------ 1 file changed, 529 insertions(+), 97 deletions(-) (limited to 'src/usr/hwas/test/hwasGardTest.H') 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