summaryrefslogtreecommitdiffstats
path: root/hwpf
diff options
context:
space:
mode:
authorSantosh Puranik <santosh.puranik@in.ibm.com>2015-11-26 01:46:26 -0600
committerGregory S. Still <stillgs@us.ibm.com>2015-12-14 08:04:11 -0600
commit1b30508467a64e4d89312fd6da3ab7bd825eb7d3 (patch)
treedfd54df8036e5c1ec12839c2b6a8f0607bb3270b /hwpf
parentdfcfe34062a28a90dff21a4af21616a00fcb1354 (diff)
downloadtalos-sbe-1b30508467a64e4d89312fd6da3ab7bd825eb7d3.tar.gz
talos-sbe-1b30508467a64e4d89312fd6da3ab7bd825eb7d3.zip
Plat API to apply EQ/EC gards
Change-Id: Ifd019f0dbad3f817e681669a31def5f41c03ed41 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/22345 Tested-by: Jenkins Server Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Diffstat (limited to 'hwpf')
-rw-r--r--hwpf/include/fapi2_target.H6
-rw-r--r--hwpf/include/plat/plat_target_utils.H8
-rw-r--r--hwpf/include/plat/target.H7
-rw-r--r--hwpf/src/plat/target.C51
4 files changed, 66 insertions, 6 deletions
diff --git a/hwpf/include/fapi2_target.H b/hwpf/include/fapi2_target.H
index d2eabf37..f8c458b2 100644
--- a/hwpf/include/fapi2_target.H
+++ b/hwpf/include/fapi2_target.H
@@ -278,9 +278,9 @@ namespace fapi2
/// @brief Set the target functional setting
/// @return Bool whether functional
///
- inline void setFunctional(void)
+ inline void setFunctional(const bool &i_state)
{
- this->iv_handle.fields.functional = 1;
+ this->iv_handle.fields.functional = (i_state) ? 1 : 0;
return;
}
@@ -355,7 +355,7 @@ namespace fapi2
#endif
} fields;
// Union Constructor
-// iv_handle(V i_value = 0):value(i_value) {}
+ iv_handle(V i_value = 0):value(i_value) {}
} iv_handle;
};
diff --git a/hwpf/include/plat/plat_target_utils.H b/hwpf/include/plat/plat_target_utils.H
index e1e360c0..49f1af40 100644
--- a/hwpf/include/plat/plat_target_utils.H
+++ b/hwpf/include/plat/plat_target_utils.H
@@ -39,10 +39,14 @@ namespace fapi2
/// @brief Function to initialize the G_targets vector based on partial good
/// attributes
ReturnCode plat_TargetsInit();
-
+
+ /// @brief Function to apply any gard records set (via
+ // ATTR_EQ_GARD/ATTR_EC_GARD) to mark corresponding targets non functional
+ ReturnCode plat_ApplyGards();
+
/// @brief Function to initialize the G_targets vector based on partial good
/// attributes
Target<TARGET_TYPE_PROC_CHIP> plat_getChipTarget();
-}
+}
#endif
diff --git a/hwpf/include/plat/target.H b/hwpf/include/plat/target.H
index 2f1ec73d..db38d912 100644
--- a/hwpf/include/plat/target.H
+++ b/hwpf/include/plat/target.H
@@ -59,6 +59,13 @@ namespace fapi2
(K == TARGET_TYPE_EQ) ) != true,
"TARGET_TYPE_CORE and TARGET_TYPE_EQ cannot be specified at the same time");
+ // Already formed target handle?
+ if(static_cast<union iv_handle>(Value).fields.type != 0)
+ {
+ this->iv_handle.value = Value;
+ return;
+ }
+
this->iv_handle.value = 0;
if(K & TARGET_TYPE_PROC_CHIP)
{
diff --git a/hwpf/src/plat/target.C b/hwpf/src/plat/target.C
index 846fab64..41d48aaf 100644
--- a/hwpf/src/plat/target.C
+++ b/hwpf/src/plat/target.C
@@ -272,7 +272,7 @@ namespace fapi2
if (b_present)
{
i_chiplet_target.setPresent();
- i_chiplet_target.setFunctional();
+ i_chiplet_target.setFunctional(true);
}
else
{
@@ -425,5 +425,54 @@ fapi_try_exit:
return ((fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>)G_vec_targets.at(0));
}
+ /// @brief Function to apply any gard records set (via
+ // ATTR_EQ_GARD/ATTR_EC_GARD) to mark corresponding targets non functional
+ ReturnCode plat_ApplyGards()
+ {
+ uint8_t l_eqGards = 0;
+ uint32_t l_ecGards = 0;
+ static const uint32_t l_mask = 0x80000000;
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> l_chip = plat_getChipTarget();
+
+ // Read the EQ and EC gard attributes from the chip target
+ FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_EQ_GARD, l_chip, l_eqGards));
+ FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_EC_GARD, l_chip, l_ecGards));
+
+ FAPI_DBG("ATTR_EQ_GARD:: 0x%08x", l_eqGards);
+ FAPI_DBG("ATTR_EC_GARD:: 0x%08x", l_ecGards);
+
+ // Normalize the values read from the attributes (they are right aligned)
+ l_eqGards <<= ((sizeof(l_eqGards) * 8) - EQ_TARGET_COUNT);
+ l_ecGards <<= ((sizeof(l_ecGards) * 8) - CORE_TARGET_COUNT);
+
+ // Iterate over the bits in EQ and EC gards, if set, mark the
+ // corresponding target non-functional
+ // TODO: Need to mark corresponding EX targets non-functional when we
+ // start supporting EX targets in the global target vector
+ for(uint32_t l_idx = 0; l_idx < EQ_TARGET_COUNT; ++l_idx)
+ {
+ if((l_mask >> l_idx) & (((uint32_t)(l_eqGards)) << 24))
+ {
+ FAPI_DBG("Making %d'th EQ non-functional", l_idx);
+ // EQ chiplet l_idx is to be marked non-functional
+ fapi2::Target<fapi2::TARGET_TYPE_EQ> l_target = G_vec_targets.at(l_idx + EQ_TARGET_OFFSET);
+ l_target.setFunctional(false);
+ G_vec_targets.at(l_idx + EQ_TARGET_OFFSET) = l_target.get();
+ }
+ }
+
+ for(uint32_t l_idx = 0; l_idx < CORE_TARGET_COUNT; ++l_idx)
+ {
+ if((l_mask >> l_idx) & (l_ecGards))
+ {
+ // EC chiplet l_idx is to be marked non-functional
+ fapi2::Target<fapi2::TARGET_TYPE_CORE> l_target = G_vec_targets.at(l_idx + CORE_TARGET_OFFSET);
+ l_target.setFunctional(false);
+ G_vec_targets.at(l_idx + CORE_TARGET_OFFSET) = l_target.get();
+ }
+ }
+fapi_try_exit:
+ return fapi2::current_err;
+ }
} // fapi2
OpenPOWER on IntegriCloud