summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorcrgeddes <crgeddes@us.ibm.com>2016-02-26 10:17:51 -0600
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2016-03-07 12:51:50 -0500
commit3649bde4de6125d79a5fa92a117d242128892340 (patch)
tree8d8535f1aedce48b45a96fef238b352f750ec54a /src/usr
parent792f58f0bf50e45688198237b7edae5757bbc95c (diff)
downloadtalos-hostboot-3649bde4de6125d79a5fa92a117d242128892340.tar.gz
talos-hostboot-3649bde4de6125d79a5fa92a117d242128892340.zip
Update getChildren fapi2::Target
Added the missing targets types to getChildren function. RTC:129517 Change-Id: I1ce0ef4d25beee3dea3653f359461304032597b7 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/21360 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Brian R. Silver <bsilver@us.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/fapi2/test/fapi2GetChildrenTest.C299
-rw-r--r--src/usr/fapi2/test/fapi2Test.H10
-rw-r--r--src/usr/fapi2/test/fapi2TestUtils.H4
-rw-r--r--src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml2
4 files changed, 312 insertions, 3 deletions
diff --git a/src/usr/fapi2/test/fapi2GetChildrenTest.C b/src/usr/fapi2/test/fapi2GetChildrenTest.C
new file mode 100644
index 000000000..b7923081c
--- /dev/null
+++ b/src/usr/fapi2/test/fapi2GetChildrenTest.C
@@ -0,0 +1,299 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/fapi2GetChildrenTest.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include <errl/errlmanager.H>
+#include <errl/errlentry.H>
+#include <fapi2.H>
+#include <hwpf_fapi2_reasoncodes.H>
+#include <fapi2TestUtils.H>
+#include <cxxtest/TestSuite.H>
+
+using namespace fapi2;
+
+namespace fapi2
+{
+
+
+//******************************************************************************
+// fapi2GetParentTest
+//******************************************************************************
+errlHndl_t fapi2GetChildrenTest()
+{
+ int numTests = 0;
+ int numFails = 0;
+ uint32_t l_targetHuid = 0xFFFFFFFF;
+ uint32_t l_actualSize = 0;
+ uint32_t l_expectedSize = 0;
+ errlHndl_t l_err = NULL;
+ TARGETING::Target * l_nimbusProc = NULL;
+ do
+ {
+ // Create a vector of TARGETING::Target pointers
+ TARGETING::TargetHandleList l_chipList;
+
+ // Get a list of all of the proc chips
+ TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC, false);
+
+ //Take the first NIMBUS proc and use it
+ for(uint32_t i = 0; i < l_chipList.size(); i++)
+ {
+ if(TARGETING::MODEL_NIMBUS ==
+ l_chipList[i]->getAttr<TARGETING::ATTR_MODEL>())
+ {
+ l_nimbusProc = l_chipList[i];
+ break;
+ }
+ }
+ numTests++;
+ if(l_nimbusProc == NULL)
+ {
+ // Send an errorlog because we cannot find any NIMBUS procs.
+ FAPI_ERR("FAPI2_GETPARENT:: could not find Nimbus proc, skipping tests");
+ numFails++;
+ /*@
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST
+ * @reasoncode fapi2::RC_NO_PROCS_FOUND
+ * @userdata1 Model Type we looked for
+ * @userdata2 Unused
+ * @devdesc Could not find NIMBUS procs in system model
+ */
+ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST,
+ fapi2::RC_NO_PROCS_FOUND,
+ TARGETING::MODEL_NIMBUS,
+ NULL,
+ true/*SW Error*/);
+ errlCommit(l_err,HWPF_COMP_ID);
+ break;
+ }
+
+ TARGETING::Target* targeting_targets[NUM_TARGETS];
+ generateTargets(l_nimbusProc, targeting_targets);
+
+ for( uint64_t x = 0; x < NUM_TARGETS; x++ )
+ {
+ if(targeting_targets[x] == NULL)
+ {
+ FAPI_ERR("Unable to find target for item %d in targeting_targets", x);
+ /*@
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST
+ * @reasoncode fapi2::RC_NO_PATH_TO_TARGET_FOUND
+ * @userdata1 Index of target in array of objects
+ * @userdata2 Unused
+ * @devdesc Could not find a path to the target of that type
+ */
+ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST,
+ fapi2::RC_NO_PATH_TO_TARGET_FOUND,
+ x,
+ NULL,
+ true/*SW Error*/);
+ errlCommit(l_err,HWPF_COMP_ID);
+ }
+ }
+
+
+ Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget(
+ l_nimbusProc);
+ Target<fapi2::TARGET_TYPE_EQ> fapi2_eqTarget(
+ targeting_targets[MY_EQ]);
+ Target<fapi2::TARGET_TYPE_EX> fapi2_exTarget(
+ targeting_targets[MY_EX]);
+ Target<fapi2::TARGET_TYPE_MCS> fapi2_mcsTarget(
+ targeting_targets[MY_MCS]);;
+ Target<fapi2::TARGET_TYPE_PERV> fapi2_pervTarget(
+ targeting_targets[MY_PERV]);
+ Target<fapi2::TARGET_TYPE_MCBIST> fapi2_mcbistTarget(
+ targeting_targets[MY_MCBIST]);
+
+
+
+ std::vector<Target<fapi2::TARGET_TYPE_CORE> > l_childCores;
+ std::vector<Target<fapi2::TARGET_TYPE_MCA> > l_childMCAs;
+ std::vector<Target<fapi2::TARGET_TYPE_EQ> > l_childEQs;
+ std::vector<Target<fapi2::TARGET_TYPE_XBUS> > l_childXBUSs;
+// @TODO RTC:148761
+// Need to figure out how we are going to set up this relationship
+// l_childMCAs = fapi2_mcbistTarget.getChildren<fapi2::TARGET_TYPE_MCA>(TARGET_STATE_PRESENT);
+// l_targetHuid = TARGETING::get_huid(targeting_targets[MY_MCBIST]) ;
+// l_actualSize = l_childMCAs.size();
+//
+// //Set expected size to be the number of MCAs per MCBIST
+// l_expectedSize = 2;
+// numTests++;
+// if(l_actualSize != l_expectedSize)
+// {
+// numFails++;
+// break;
+// }
+
+ l_childCores = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(l_nimbusProc) ;
+ l_actualSize = l_childCores.size();
+
+ //Set expected size to be the number of cores per proc
+ l_expectedSize = EQ_PER_PROC * EX_PER_EQ * CORE_PER_EX;
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ l_childCores = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_FUNCTIONAL);
+ l_targetHuid = TARGETING::get_huid(l_nimbusProc) ;
+ l_actualSize = l_childCores.size();
+
+ //Set expected size to be the number of cores per proc
+ l_expectedSize = 1;
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ l_childMCAs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_MCA>(TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(l_nimbusProc) ;
+ l_actualSize = l_childMCAs.size();
+
+ //Set expected size to be the number of cores per proc
+ l_expectedSize = 8;
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ l_childCores = fapi2_exTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(targeting_targets[MY_EX]) ;
+ l_actualSize = l_childCores.size();
+
+ //Set expected size to be the number of cores per ex
+ l_expectedSize = CORE_PER_EX;
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ l_childCores = fapi2_eqTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(targeting_targets[MY_EQ]) ;
+ l_actualSize = l_childCores.size();
+
+ //Set expected size to be the number of cores per eq
+ l_expectedSize = CORE_PER_EX * EX_PER_EQ;
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ //Currently PERV targets do not have CORE children, but its valid to look for PERV's children
+ //TODO 148577 Implement Parent/Child Relationships for PERV Targets
+ // valid children for PERV
+ // PERV -> EQ // PERV -> CORE // PERV -> XBUS // PERV -> OBUS
+ // PERV -> CAPP // PERV -> NV // PERV -> MCBIST // PERV -> MCS
+ // PERV -> MCA // PERV -> PEC // PERV -> PHB // PERV -> MI
+ // PERV -> DMI
+ l_childCores = fapi2_pervTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(targeting_targets[MY_PERV]) ;
+ l_actualSize = l_childCores.size();
+ l_expectedSize = 0;
+
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ l_childEQs = fapi2_pervTarget.getChildren<fapi2::TARGET_TYPE_EQ>(TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(targeting_targets[MY_PERV]) ;
+ l_actualSize = l_childEQs.size();
+ l_expectedSize = 0;
+
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ l_childXBUSs = fapi2_pervTarget.getChildren<fapi2::TARGET_TYPE_XBUS>(TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(targeting_targets[MY_PERV]) ;
+ l_actualSize = l_childXBUSs.size();
+ l_expectedSize = 0;
+
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+ //Uncomment to test compile fails
+// std::vector<Target<fapi2::TARGET_TYPE_PROC_CHIP> > l_childProcs;
+// l_childProcs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PROC_CHIP>(TARGET_STATE_PRESENT);
+// l_childCores = fapi2_mcsTarget.getChildren<fapi2::TARGET_TYPE_CORE>(TARGET_STATE_PRESENT);
+ }while(0);
+
+ if(l_actualSize != l_expectedSize)
+ {
+ /*@
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST
+ * @reasoncode fapi2::RC_INVALID_CHILD_COUNT
+ * @userdata1[0:31] Expected Child Count
+ * @userdata1[32:63] Actual Child Count
+ * @userdata2 Parent HUID
+ * @devdesc Invalid amount of child cores found
+ * on a proc
+ */
+ l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_TEST,
+ fapi2::RC_INVALID_CHILD_COUNT,
+ TWO_UINT32_TO_UINT64(
+ TO_UINT32(
+ l_expectedSize),
+ TO_UINT32(
+ l_actualSize)),
+ l_targetHuid,
+ true/*SW Error*/);
+ errlCommit(l_err,HWPF_COMP_ID);
+ TS_FAIL("fapi2TargetTest Fail, for HUID: %d , expected %d children , found %d ", l_targetHuid,l_expectedSize,l_actualSize );
+ }
+ FAPI_INF("fapi2TargetTest:: Test Complete. %d/%d fails", numFails , numTests);
+ return l_err;
+}
+
+
+
+
+} \ No newline at end of file
diff --git a/src/usr/fapi2/test/fapi2Test.H b/src/usr/fapi2/test/fapi2Test.H
index f992bb47c..1111ec9c9 100644
--- a/src/usr/fapi2/test/fapi2Test.H
+++ b/src/usr/fapi2/test/fapi2Test.H
@@ -45,6 +45,7 @@
#include <hwpf_fapi2_reasoncodes.H>
#include "fapi2HwpTest.C"
+#include "fapi2GetChildrenTest.C"
using namespace fapi2;
@@ -57,12 +58,17 @@ public:
* that runs through the FAPI2 macros
*
*/
-void test_fapi2HwpTest(void)
+void test_fapi2Test(void)
{
FAPI_INF(">>test_fapi2HwpTest starting...");
fapi2HwpTest();
- FAPI_INF(">>test_fapi2HwpTest exiting...");
+ FAPI_INF("<<test_fapi2HwpTest exiting...");
+
+ FAPI_INF(">>test_fapi2GetChildrenTest starting...");
+ fapi2GetChildrenTest();
+ FAPI_INF("<<test_fapi2ChildTest exiting...");
}
+
};
#endif \ No newline at end of file
diff --git a/src/usr/fapi2/test/fapi2TestUtils.H b/src/usr/fapi2/test/fapi2TestUtils.H
index f4e9f5dc8..fa1ad1353 100644
--- a/src/usr/fapi2/test/fapi2TestUtils.H
+++ b/src/usr/fapi2/test/fapi2TestUtils.H
@@ -33,6 +33,10 @@
#ifndef FAPI2TESTUTILS_H_
#define FAPI2TESTUTILS_H_
+#define EQ_PER_PROC 6
+#define EX_PER_EQ 2
+#define CORE_PER_EX 2
+
#include <fapi2.H>
namespace fapi2
diff --git a/src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml b/src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml
index d0836e1dd..f21c64893 100644
--- a/src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml
+++ b/src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml
@@ -1143,7 +1143,7 @@
</targetInstance>
<targetInstance>
- <id>sys0node0proc0mcs1mca3</id>
+ <id>sys0node0proc0mcs1mca1</id>
<type>unit-mca-nimbus</type>
<attribute><id>HUID</id><default>0x000D0103</default></attribute>
<attribute>
OpenPOWER on IntegriCloud