summaryrefslogtreecommitdiffstats
path: root/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C
diff options
context:
space:
mode:
authorMark Pizzutillo <Mark.Pizzutillo@ibm.com>2019-02-21 11:08:00 -0500
committerChristian R. Geddes <crgeddes@us.ibm.com>2019-04-15 09:32:55 -0500
commit7c4068b510e172eb973b8e460ee432e7e8bc8275 (patch)
treed5200d9aace4e02d593b145333d34676e9b2b171 /src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C
parentecfbca46ab3fba9f66ce242e3c226c6c6e18ce26 (diff)
downloadtalos-hostboot-7c4068b510e172eb973b8e460ee432e7e8bc8275.tar.gz
talos-hostboot-7c4068b510e172eb973b8e460ee432e7e8bc8275.zip
Added code for exp_getecid and unit tests
Change-Id: Id0a8fcf7c28d67c1bcb4ba98ff7af6d94dfa6364 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/74784 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Louis Stermole <stermole@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75353 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C')
-rw-r--r--src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C
index 7ab4e58ba..ad20d2e0c 100644
--- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C
+++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C
@@ -22,3 +22,81 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+/// @file exp_getecid.C
+/// @brief Gets ECID from explorer fuse registers
+///
+/// *HWP HWP Owner: Mark Pizzutillo <Mark.Pizzutillo@ibm.com>
+/// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com>
+/// *HWP Team: Memory
+/// *HWP Level: 2
+/// *HWP Consumed by: HB
+
+#include <fapi2.H>
+#include <exp_getecid.H>
+#include <exp_getecid_utils.H>
+#include <lib/shared/exp_consts.H>
+#include <explorer_scom_addresses.H>
+#include <explorer_scom_addresses_fld.H>
+#include <mss_explorer_attribute_setters.H>
+
+extern "C"
+{
+ ///
+ /// @brief getecid procedure for explorer chip
+ /// @param[in] i_target Explorer OCMB chip
+ /// @return fapi2:ReturnCode FAPI2_RC_SUCCESS if success, else error code.
+ /// @note Sets ocmb_ecid, enterprise, half-dimm mode attributes. exp_omi_setup configures the chip with these attributes
+ ///
+ fapi2::ReturnCode exp_getecid(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target)
+ {
+ // Using FUSE enterprise_dis bit, determine whether enterprise is disabled, otherwise
+ // we will enable it. Override to disable it is done in omi_setup. Half_dimm_mode we
+ // will also disable by default, as it is not a feature of P systems
+ {
+ uint8_t l_enterprise_mode = fapi2::ENUM_ATTR_MSS_OCMB_ENTERPRISE_MODE_NON_ENTERPRISE; // 0
+ uint8_t l_half_dimm_mode = fapi2::ENUM_ATTR_MSS_OCMB_HALF_DIMM_MODE_FULL_DIMM; // 0
+
+ FAPI_TRY(mss::exp::ecid::get_enterprise_and_half_dimm_from_fuse(
+ i_target, l_enterprise_mode, l_half_dimm_mode),
+ "exp_getecid: getting enterprise and half_dimm from fuse failed on %s",
+ mss::c_str(i_target));
+
+ // Set attributes
+ FAPI_TRY(mss::attr::set_ocmb_enterprise_mode(i_target, l_enterprise_mode),
+ "exp_getecid: Could not set ATTR_MSS_OCMB_ENTERPRISE_MODE");
+
+ FAPI_TRY(mss::attr::set_ocmb_half_dimm_mode(i_target, l_half_dimm_mode),
+ "exp_getecid: Could not set ATTR_MSS_OCMB_HALF_DIMM_MODE");
+ }
+
+ //
+ // Populate OCMB_ECID attribute with:
+ // EFUSE_IMAGE_OUT[261:64] – Serial number (Wafer ID, number and XY coordinates)
+ // EFUSE_IMAGE_OUT[263:262] – PSRO
+ // Each register in the FUSE is 32 bits in size, but only the lower 16 bits are used, Here, we piece together
+ // each set of lower 16 bits and insert these into the ECID register
+ //
+ // TK - Once ATTR_ECID is made large enough, we probably will not need ATTR_OCMB_ECID
+ // We can remove the call to it below and remove the attribute itself.
+ //
+ {
+ // ECID obtained from register contents
+ uint16_t l_ecid[mss::exp::ecid_consts::FUSE_ARRAY_SIZE] = {0};
+
+ FAPI_TRY(mss::exp::ecid::read_from_fuse(i_target, l_ecid),
+ "exp_getecid: Could not read ecid from FUSE on %s", mss::c_str(i_target));
+
+ // TK - Remove once ATTR_ECID is made large enough
+ FAPI_TRY(mss::attr::set_ocmb_ecid(i_target, l_ecid),
+ "exp_getecid: Could not set ATTR_MSS_OCMB_ECID on %s", mss::c_str(i_target));
+
+ FAPI_TRY(mss::exp::ecid::set_attr(i_target, l_ecid),
+ "exp_getecid: Could not set ATTR_ECID on %s", mss::c_str(i_target));
+ }
+
+ fapi_try_exit:
+ return fapi2::current_err;
+ }
+
+} // extern "C"
OpenPOWER on IntegriCloud