summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Baiocchi <mbaiocch@us.ibm.com>2016-05-19 11:43:33 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-06-09 11:08:40 -0400
commit65f5c6f49eaae840c00cf78b6c16bcb664f51c36 (patch)
treee24bef299fdf86ddcbbb6d0f119c345e1c8a99d6
parentc4119b881e8a6e3746ac4553dee024351d97226f (diff)
downloadtalos-hostboot-65f5c6f49eaae840c00cf78b6c16bcb664f51c36.tar.gz
talos-hostboot-65f5c6f49eaae840c00cf78b6c16bcb664f51c36.zip
Add support for fapi2::getChildren with additional const TargetFilter
In addition to adding support for fapi2::getChildren with additional const TargetFilter input parameter, this commit also adds a test_fapi2GetChildrenFilter to the automatic simics testcases. Change-Id: I82e34c001ebb0af8eacb3c8f244391504ed424ae RTC:149115 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24813 Tested-by: Jenkins Server Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com> Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H1
-rw-r--r--src/include/usr/fapi2/target.H74
-rw-r--r--src/usr/fapi2/test/fapi2GetChildrenTest.H154
-rw-r--r--src/usr/isteps/istep08/call_proc_chiplet_enable_ridi.C10
-rw-r--r--src/usr/isteps/istep08/makefile35
-rw-r--r--src/usr/isteps/istep13/makefile5
6 files changed, 249 insertions, 30 deletions
diff --git a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
index 90bde96ed..ded48259c 100644
--- a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
+++ b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
@@ -51,6 +51,7 @@ namespace fapi2
MOD_FAPI2_PLAT_GET_OTHER_END_TEST = 0x08,
MOD_FAPI2_PLAT_GET_OTHER_END = 0x09,
MOD_FAPI2_MVPD_ACCESS = 0x0A,
+ MOD_FAPI2_PLAT_GET_CHILDREN_FILTER_TEST = 0x0B,
};
/**
diff --git a/src/include/usr/fapi2/target.H b/src/include/usr/fapi2/target.H
index 255f66dd5..756b1d85f 100644
--- a/src/include/usr/fapi2/target.H
+++ b/src/include/usr/fapi2/target.H
@@ -726,6 +726,80 @@ FAPI_DBG(ENTER_MRK "getChildren. Type 0x%08x State:0x%08x", T, i_state);
///
+/// @brief Get this target's children, filtered
+/// @tparam T The type of the parent
+/// @tparam K The type of target of which this is called
+/// @tparam V the type of the target's Value
+/// @param[in] i_filter The desired chiplet filter
+/// @param[in] i_state The desired TargetState of the children
+/// @return std::vector<Target<T> > a vector of present/functional
+/// children
+///
+template<TargetType K, typename V>
+template< TargetType T>
+inline std::vector<Target<T> >
+ Target<K, V>::getChildren(const TargetFilter i_filter,
+ const TargetState i_state) const
+{
+ std::vector<Target<T>> l_children;
+
+ l_children = this->getChildren<T>(i_state);
+
+ FAPI_DBG("getChildrenFilter: Tgt=0x%.8X, i_filter=0x%.16X,"
+ "K-Type=0x%.8X, T-Type=0x%.8X, sizeA=%d",
+ TARGETING::get_huid(this->get()), i_filter, K, T, l_children.size());
+
+ // Limit to getting Pervasive children from proc_chip parent for now
+ //@TODO RTC:155755 to track possible additional support
+ static_assert(((T == fapi2::TARGET_TYPE_PERV) &&
+ (K == fapi2::TARGET_TYPE_PROC_CHIP)),
+ "fapi2::getChildren-Filter only supports getting fapi2::TARGET_TYPE_PERV children on a fapi2::TARGET_TYPE_PROC_CHIP");
+
+ for ( auto childIter = l_children.begin();
+ childIter != l_children.end();
+ // ++childIter incremented below
+ )
+ {
+ const TARGETING::Target * l_platTarget =
+ static_cast<const TARGETING::Target*>(childIter->get());
+ uint8_t l_chiplet_num = 0;
+ uint32_t l_fapi2_type = childIter->getType();
+ uint64_t l_bitMask = 0x0;
+
+ // ATTR_CHIP_UNIT represents the Pervasive Chiplet numbering and is
+ // needed to create the l_bitMask to use against i_filter
+ if(!l_platTarget->tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_chiplet_num))
+ {
+ FAPI_ERR("ERROR: getChildrenFilter: Can not read CHIP_UNIT attribute"
+ "Keeping Target 0x%lx for 0x%x", l_platTarget, T);
+ l_bitMask = 0xFFFFFFFFFFFFFFFF;
+ }
+ else
+ {
+ l_bitMask = 0x8000000000000000 >> l_chiplet_num;
+ }
+
+ if (i_filter & l_bitMask) // keep child
+ {
+ FAPI_DBG("getChildrenFilter: keep child=0x%.8X, type=0x%.8X, l_bitMask=0x%.16X, num=0x%.2X",
+ TARGETING::get_huid(l_platTarget), l_fapi2_type, l_bitMask, l_chiplet_num );
+
+ ++childIter;
+ }
+ else // remove child
+ {
+ childIter = l_children.erase(childIter); // this increments childIter
+
+ FAPI_DBG("getChildrenFilter: removed child=0x%.8X, type=0x%.8X, l_bitMask=0x%.16X, num=0x%.2X",
+ TARGETING::get_huid(l_platTarget), l_fapi2_type, l_bitMask, l_chiplet_num );
+ }
+ }
+
+ // Return filtered fapi2::Targets to the caller
+ return l_children;
+}
+
+///
/// @brief Get the target at the other end of a bus
/// @tparam T The type of the target on the other end
/// @param[out] o_target A target representing the thing on the other end
diff --git a/src/usr/fapi2/test/fapi2GetChildrenTest.H b/src/usr/fapi2/test/fapi2GetChildrenTest.H
index ee745769e..f06c167d1 100644
--- a/src/usr/fapi2/test/fapi2GetChildrenTest.H
+++ b/src/usr/fapi2/test/fapi2GetChildrenTest.H
@@ -42,7 +42,7 @@ class Fapi2GetChildrenTest : public CxxTest::TestSuite
{
public:
//******************************************************************************
-// test_fapi2GetParent
+// test_fapi2GetChildren
//******************************************************************************
void test_fapi2GetChildren()
{
@@ -448,6 +448,158 @@ void test_fapi2GetChildren()
}
+//******************************************************************************
+// test_fapi2GetChildrenFilter
+//******************************************************************************
+void test_fapi2GetChildrenFilter()
+{
+ 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
+ {
+ FAPI_DBG("start of test_fapi2GetChildrenFilter()");
+
+ // 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_GETCHILDREN:: could not find Nimbus proc, skipping tests");
+ numFails++;
+ TS_FAIL("test_fapi2GetChildrenFilter Fail: could not find Nimbus proc, skipping tests");
+ break;
+ }
+
+ TARGETING::Target* targeting_targets[NUM_TARGETS];
+ generateTargets(l_nimbusProc, targeting_targets);
+
+ numTests++;
+ 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);
+ numFails++;
+ TS_FAIL("test_fapi2GetChildrenFilter Fail: Unable to find target for item %d in targeting_targets", x);
+ break;
+ }
+ }
+
+ Target<fapi2::TARGET_TYPE_PROC_CHIP> fapi2_procTarget(
+ l_nimbusProc);
+
+ std::vector<Target<fapi2::TARGET_TYPE_PERV> > l_childPERVs;
+
+ // Start of the Tests
+
+ // PERV - TARGET_FILTER_ALL_CORES
+ l_expectedSize = 24;
+ l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>(
+ TARGET_FILTER_ALL_CORES,
+ TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(l_nimbusProc) ;
+ l_actualSize = l_childPERVs.size();
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ // PERV - TARGET_FILTER_CORE1
+ l_expectedSize = 1;
+ l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>(
+ TARGET_FILTER_CORE1,
+ TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(l_nimbusProc) ;
+ l_actualSize = l_childPERVs.size();
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ // PERV - TARGET_FILTER_ALL_MC
+ l_expectedSize = 2;
+ l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>(
+ TARGET_FILTER_ALL_MC,
+ TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(l_nimbusProc) ;
+ l_actualSize = l_childPERVs.size();
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ // PERV - SYNC_MODE_ALL_IO_EXCEPT_NEST
+ // NOTE: 2 of 4 OBUS are Cumulus only, so expect 8 instead of 10 returned
+ l_expectedSize = 8;
+ l_childPERVs = fapi2_procTarget.getChildren<fapi2::TARGET_TYPE_PERV>(
+ TARGET_FILTER_SYNC_MODE_ALL_IO_EXCEPT_NEST,
+ TARGET_STATE_PRESENT);
+ l_targetHuid = TARGETING::get_huid(l_nimbusProc) ;
+ l_actualSize = l_childPERVs.size();
+ numTests++;
+ if(l_actualSize != l_expectedSize)
+ {
+ numFails++;
+ break;
+ }
+
+ }while(0);
+
+ if(l_actualSize != l_expectedSize)
+ {
+ /*@
+ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid fapi2::MOD_FAPI2_PLAT_GET_CHILDREN_FILTER_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_FILTER_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("test_fapi2GetChildrenFilter Fail, for HUID: 0x%X , expected %d children , found %d ", l_targetHuid,l_expectedSize,l_actualSize );
+ }
+
+ FAPI_INF("test_fapi2GetChildrenFilter: Test Complete. %d/%d fails", numFails , numTests);
+}
};
diff --git a/src/usr/isteps/istep08/call_proc_chiplet_enable_ridi.C b/src/usr/isteps/istep08/call_proc_chiplet_enable_ridi.C
index 2b8510a70..ed56be104 100644
--- a/src/usr/isteps/istep08/call_proc_chiplet_enable_ridi.C
+++ b/src/usr/isteps/istep08/call_proc_chiplet_enable_ridi.C
@@ -53,12 +53,7 @@
#include <fapi2/target.H>
#include <fapi2/plat_hwp_invoker.H>
-// MVPD
-#include <devicefw/userif.H>
-#include <vpd/mvpdenums.H>
-
-#include <config.h>
-
+#include <p9_chiplet_enable_ridi.H>
namespace ISTEP_08
@@ -95,8 +90,7 @@ void* call_proc_chiplet_enable_ridi( void *io_pArgs )
"Running p9_chiplet_enable_ridi HWP on processor target %.8X",
TARGETING::get_huid(l_cpu_target) );
- // @TODO RTC:149115
- //FAPI_INVOKE_HWP(l_err, p9_chiplet_enable_ridi, l_fapi2_proc_target);
+ FAPI_INVOKE_HWP(l_err, p9_chiplet_enable_ridi, l_fapi2_proc_target);
if(l_err)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
diff --git a/src/usr/isteps/istep08/makefile b/src/usr/isteps/istep08/makefile
index 6b147db97..d111bf8f4 100644
--- a/src/usr/isteps/istep08/makefile
+++ b/src/usr/isteps/istep08/makefile
@@ -62,62 +62,61 @@ VPATH += ${PROCEDURES_PATH}/hwp/sbe/
include ${ROOTPATH}/procedure.rules.mk
-# 8.1 host_slave_sbe_config
+# host_slave_sbe_config
include ${PROCEDURES_PATH}/hwp/perv/p9_setup_sbe_config.mk
-# 8.2 host_setup_sbe
+# host_setup_sbe
include ${PROCEDURES_PATH}/hwp/perv/p9_set_fsi_gp_shadow.mk
-# 8.3 host_cbs_start
+# host_cbs_start
include ${PROCEDURES_PATH}/hwp/perv/p9_start_cbs.mk
-# 8.4 proc_check_slave_sbe_seeprom_complete : Check Slave SBE Complete
+# proc_check_slave_sbe_seeprom_complete : Check Slave SBE Complete
include ${PROCEDURES_PATH}/hwp/perv/p9_check_slave_sbe_seeprom_complete.mk
include ${PROCEDURES_PATH}/hwp/perv/p9_extract_sbe_rc.mk
include ${PROCEDURES_PATH}/hwp/sbe/p9_get_sbe_msg_register.mk
-# 8.5 proc_cen_ref_clk_enable
+# proc_cen_ref_clk_enable
# Cummulus only -- p9_cen_ref_clk_enable.mk not defined yet
-# 8.6 proc_attr_update: Proc ATTR Update
+# proc_attr_update: Proc ATTR Update
include ${PROCEDURES_PATH}/hwp/nest/p9_attr_update.mk
-# 8.7 proc_enable_osclite
+# proc_enable_osclite
# Cummulus only -- p9_enable_osclite.mk not defined yet
-# 8.8 proc_chiplet_scominit : Scom inits to all chiplets (sans Quad)
+# proc_chiplet_scominit : Scom inits to all chiplets (sans Quad)
#TODO-RTC:149687 - HWP requires p9_fbc_scom.H
#include ${PROCEDURES_PATH}/hwp/nest/p9_chiplet_scominit.mk
include ${PROCEDURES_PATH}/hwp/nest/p9_psi_scominit.mk
#include ${PROCEDURES_PATH}/hwp/initfiles/p9_fbc_scom.mk
include ${PROCEDURES_PATH}/hwp/initfiles/p9_psi_scom.mk
-# 8.9 proc_xbus_scominit : Apply scom inits to Xbus
+# proc_xbus_scominit : Apply scom inits to Xbus
# TODO-RTC:149687
# Now missing p9_io_regs.H, p9_xbus_g0_scom.H and p9_xbus_g1_scom.H
#include ${PROCEDURES_PATH}/hwp/io/p9_io_xbus_scominit.mk
-# 8.10 proc_abus_scominit : Apply scom inits to Abus
+# proc_abus_scominit : Apply scom inits to Abus
# HWP not found - p9_abus_scominit.mk not defined
-# 8.11 proc_obus_scominit : Apply scom inits to Obus
+# proc_obus_scominit : Apply scom inits to Obus
# TODO-RTC:149687 - Missing p9_io_regs.H
#include ${PROCEDURES_PATH}/hwp/io/p9_io_obus_scominit.mk
-# 8.12 proc_npu_scominit : Apply scom inits to NPU bus
+# proc_npu_scominit : Apply scom inits to NPU bus
include ${PROCEDURES_PATH}/hwp/nest/p9_npu_scominit.mk
-# 8.13 proc_pcie_scominit : Apply scom inits to PCIe chiplets
+# proc_pcie_scominit : Apply scom inits to PCIe chiplets
include ${PROCEDURES_PATH}/hwp/nest/p9_pcie_scominit.mk
-# 8.14 proc_scomoverride_chiplets : Apply sequenced scom inits
+# proc_scomoverride_chiplets : Apply sequenced scom inits
include ${PROCEDURES_PATH}/hwp/nest/p9_scomoverride_chiplets.mk
-# 8.15 proc_chiplet_enable_ridi : Apply RI/DI chip wide
-# TODO-RTC:149115 - missing parameter in fapi2::getChildren()
-#include ${PROCEDURES_PATH}/hwp/perv/p9_chiplet_enable_ridi.mk
+# proc_chiplet_enable_ridi : Apply RI/DI chip wide
+include ${PROCEDURES_PATH}/hwp/perv/p9_chiplet_enable_ridi.mk
-# 8.16 host_rng_bist : Trigger Built In Self Test
+# host_rng_bist : Trigger Built In Self Test
# HWP not ready - p9_trigger_rng_bist.mk
include ${ROOTPATH}/config.mk
diff --git a/src/usr/isteps/istep13/makefile b/src/usr/isteps/istep13/makefile
index d32b64ea0..60ef1a68b 100644
--- a/src/usr/isteps/istep13/makefile
+++ b/src/usr/isteps/istep13/makefile
@@ -71,9 +71,8 @@ include ${PROCEDURES_PATH}/hwp/nest/p9_throttle_sync.mk
include ${PROCEDURES_PATH}/hwp/initfiles/p9_mcs_scom.mk
include ${PROCEDURES_PATH}/hwp/initfiles/p9_mcbist_scom.mk
-#TODO RTC:149115 New fapi2::Target::getChildren interface
-# include ${PROCEDURES_PATH}/hwp/perv/p9_mem_startclocks.mk
-# include ${PROCEDURES_PATH}/hwp/perv/p9_mem_pll_setup.mk
+include ${PROCEDURES_PATH}/hwp/perv/p9_mem_startclocks.mk
+include ${PROCEDURES_PATH}/hwp/perv/p9_mem_pll_setup.mk
#TODO RTC:152209 Implement std::enable_if in HB
# include ${PROCEDURES_PATH}/hwp/memory/p9_mss_draminit.mk
OpenPOWER on IntegriCloud