summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCaleb Palmer <cnpalmer@us.ibm.com>2018-01-23 10:47:09 -0600
committerZane C. Shelley <zshelle@us.ibm.com>2018-03-27 15:46:14 -0400
commit08b8dd518da9c48a2e0cf64106210902a34a8008 (patch)
tree19ce8ee415a1fbd4640ec9047b9158e7cfdcceda /src
parent92069bbfeb10b93364a9a984564594be3bc251f5 (diff)
downloadtalos-hostboot-08b8dd518da9c48a2e0cf64106210902a34a8008.tar.gz
talos-hostboot-08b8dd518da9c48a2e0cf64106210902a34a8008.zip
Add accessor functions for row repair attr
Change-Id: I2344a947a46c0e04d53e95b6fbd3af7f02f5ed03 RTC: 174670 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/52556 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> CI-Ready: Zane C. Shelley <zshelle@us.ibm.com> Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com> Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com> Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/fapi2/rowRepairsFuncs.H81
-rwxr-xr-xsrc/usr/fapi2/fapi2.mk2
-rw-r--r--src/usr/fapi2/rowRepairsFuncs.C222
3 files changed, 304 insertions, 1 deletions
diff --git a/src/include/usr/fapi2/rowRepairsFuncs.H b/src/include/usr/fapi2/rowRepairsFuncs.H
new file mode 100644
index 000000000..8ad0113ea
--- /dev/null
+++ b/src/include/usr/fapi2/rowRepairsFuncs.H
@@ -0,0 +1,81 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/fapi2/rowRepairsFuncs.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2018 */
+/* [+] 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 */
+
+#ifndef ROWREPAIRS_H_
+#define ROWREPAIRS_H_
+
+#include <fapi2.H>
+#include <../memory/lib/shared/mss_const.H>
+
+extern "C"
+{
+
+/**
+ * @brief FW Team Utility function that gets the Row Repair Data.
+ *
+ * This function finds the corresponding DIMM Target, calls
+ * Row Repair Data getter procedure to get the DQ bitmap and returns the data
+ * for the specified rank.
+ *
+ * @param[in] i_fapiTrgt Reference to MCA/MBA Target
+ * @param[in] i_dimm MCA/MBA port DIMM number
+ * @param[in] i_rank DIMM rank number
+ * @param[out] o_data Reference to data where Row Repair Data is copied to
+ * @param[in] i_port Optional port for MBA targets. Default is port 0.
+ *
+ * @return ReturnCode
+ */
+fapi2::ReturnCode getRowRepair( const fapi2::Target
+ <fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
+ const uint8_t i_dimm,
+ const uint8_t i_rank,
+ uint8_t (&o_data)[mss::ROW_REPAIR_BYTE_COUNT],
+ const uint8_t i_port = 0 );
+
+/**
+ * @brief FW Team Utility function that sets the Row Repair Data.
+ *
+ * This function finds the corresponding DIMM Target, calls
+ * Row Repair Data setter procedure to set the data
+ * for the specified rank.
+ *
+ * @param[in] i_fapiTrgt Reference to MCA/MBA Target
+ * @param[in] i_dimm MCA/MBA port DIMM number
+ * @param[in] i_rank DIMM rank number
+ * @param[out] i_data Reference to data where Row Repair Data is
+ * @param[in] i_port Optional port for MBA targets. Default is port 0.
+ *
+ * @return ReturnCode
+ */
+fapi2::ReturnCode setRowRepair( const fapi2::Target
+ <fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
+ const uint8_t i_dimm,
+ const uint8_t i_rank,
+ uint8_t (&i_data)[mss::ROW_REPAIR_BYTE_COUNT],
+ const uint8_t i_port = 0 );
+
+}
+
+#endif
diff --git a/src/usr/fapi2/fapi2.mk b/src/usr/fapi2/fapi2.mk
index 3447c5d12..9417f9603 100755
--- a/src/usr/fapi2/fapi2.mk
+++ b/src/usr/fapi2/fapi2.mk
@@ -78,7 +78,7 @@ OBJS += plat_mbvpd_access.o
OBJS += plat_vpd_access.o
OBJS += plat_wof_access.o
OBJS += dimmBadDqBitmapFuncs.o
-
+OBJS += rowRepairsFuncs.o
#Required include before all the procedure.mk are included
include ${ROOTPATH}/procedure.rules.mk
diff --git a/src/usr/fapi2/rowRepairsFuncs.C b/src/usr/fapi2/rowRepairsFuncs.C
new file mode 100644
index 000000000..0af82ce33
--- /dev/null
+++ b/src/usr/fapi2/rowRepairsFuncs.C
@@ -0,0 +1,222 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/rowRepairsFuncs.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017,2018 */
+/* [+] 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 <rowRepairsFuncs.H>
+#include <string.h>
+#include <attribute_service.H>
+#include <target.H>
+#include <errl/errlmanager.H>
+
+using namespace TARGETING;
+
+extern "C"
+{
+
+fapi2::ReturnCode __getDimmRepairData( const fapi2::Target
+ <fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
+ const uint8_t i_dimm,
+ const uint8_t i_rank,
+ TARGETING::TargetHandle_t & o_dimmTrgt,
+ uint8_t (&o_data)[mss::MAX_RANK_PER_DIMM][mss::ROW_REPAIR_BYTE_COUNT],
+ const uint8_t i_port )
+{
+ fapi2::ReturnCode l_rc;
+
+ do
+ {
+ // Check parameters.
+ if ( (i_dimm >= mss::MAX_DIMM_PER_PORT) ||
+ (i_rank >= mss::MAX_RANK_PER_DIMM) )
+ {
+ FAPI_ERR( "__getDimmRepairData: Bad parameter. "
+ "i_dimm:%d i_rank:%d", i_dimm, i_rank );
+ l_rc = fapi2::FAPI2_RC_INVALID_ATTR_GET;
+ break;
+ }
+
+ errlHndl_t l_errl = nullptr;
+ TARGETING::TargetHandle_t l_trgt = nullptr;
+
+ l_errl = fapi2::platAttrSvc::getTargetingTarget(i_fapiTrgt, l_trgt);
+ if ( l_errl )
+ {
+ FAPI_ERR( "__getDimmRepairData: Error from getTargetingTarget" );
+ errlCommit( l_errl, FAPI2_COMP_ID );
+ l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ break;
+ }
+
+ // Get the proc model
+ TARGETING::Target * l_masterProc = nullptr;
+ TARGETING::targetService().masterProcChipTargetHandle( l_masterProc );
+ TARGETING::ATTR_MODEL_type l_procModel =
+ l_masterProc->getAttr<TARGETING::ATTR_MODEL>();
+
+ // Get all functional DIMMs
+ TargetHandleList l_dimmList;
+ getChildAffinityTargets( l_dimmList, l_trgt, CLASS_NA, TYPE_DIMM );
+
+ // If Cumulus, assume MBA
+ if ( TARGETING::MODEL_CUMULUS == l_procModel )
+ {
+ // Find the DIMM with the correct MBA port/dimm
+ uint8_t l_port = 0;
+ uint8_t l_dimm = 0;
+
+ for ( auto &dimmTrgt : l_dimmList )
+ {
+ // Get and compare the port
+ l_port = dimmTrgt->getAttr<ATTR_MBA_PORT>();
+
+ if ( l_port == i_port )
+ {
+ // Get and compare the dimm
+ l_dimm = dimmTrgt->getAttr<ATTR_MBA_DIMM>();
+
+ if ( l_dimm == i_dimm )
+ {
+ o_dimmTrgt = dimmTrgt;
+ // Port and dimm are correct, get the Row Repair Data
+ l_rc = FAPI_ATTR_GET( fapi2::ATTR_ROW_REPAIR_DATA,
+ dimmTrgt, o_data );
+ break;
+ }
+ }
+ }
+ }
+ // If Nimbus, assume MCA
+ else if ( TARGETING::MODEL_NIMBUS == l_procModel )
+ {
+ for ( auto &dimmTrgt : l_dimmList )
+ {
+ uint32_t l_pos = dimmTrgt->getAttr<ATTR_FAPI_POS>() %
+ mss::MAX_DIMM_PER_PORT;
+ if ( l_pos == i_dimm )
+ {
+ o_dimmTrgt = dimmTrgt;
+ // Get the Row Repair Data by querying ATTR_ROW_REPAIR_DATA.
+ l_rc = FAPI_ATTR_GET( fapi2::ATTR_ROW_REPAIR_DATA,
+ o_dimmTrgt, o_data );
+ break;
+ }
+ }
+
+ }
+ else
+ {
+ // Invalid target.
+ FAPI_ERR( "__getDimmRepairData: Invalid proc model" );
+ l_rc = fapi2::FAPI2_RC_INVALID_ATTR_GET;
+ break;
+ }
+
+ }while(0);
+
+ if ( l_rc )
+ {
+ FAPI_ERR( "__getDimmRepairData: Error getting ATTR_ROW_REPAIR_DATA." );
+ }
+
+ return l_rc;
+}
+
+//------------------------------------------------------------------------------
+fapi2::ReturnCode getRowRepair( const fapi2::Target
+ <fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
+ const uint8_t i_dimm,
+ const uint8_t i_rank,
+ uint8_t (&o_data)[mss::ROW_REPAIR_BYTE_COUNT],
+ const uint8_t i_port )
+{
+ FAPI_INF( ">>getRowRepair. %d:%d", i_dimm, i_rank );
+
+ fapi2::ReturnCode l_rc;
+
+ do
+ {
+
+ uint8_t l_data[mss::MAX_RANK_PER_DIMM][mss::ROW_REPAIR_BYTE_COUNT];
+ TARGETING::TargetHandle_t l_dimmTrgt = nullptr;
+
+ // Check parameters and get Row Repair Data
+ l_rc = __getDimmRepairData( i_fapiTrgt, i_dimm, i_rank,
+ l_dimmTrgt, l_data, i_port );
+ if ( l_rc )
+ {
+ FAPI_ERR( "getRowRepair: Error from __getDimmRepairData." );
+ break;
+ }
+
+ // Write contents of DQ bitmap for specific rank to o_data.
+ memcpy( o_data, l_data[i_rank], mss::ROW_REPAIR_BYTE_COUNT );
+
+ }while(0);
+
+ FAPI_INF( "<<getRowRepair" );
+
+ return l_rc;
+}
+
+//------------------------------------------------------------------------------
+fapi2::ReturnCode setRowRepair( const fapi2::Target
+ <fapi2::TARGET_TYPE_MCA|fapi2::TARGET_TYPE_MBA> & i_fapiTrgt,
+ const uint8_t i_dimm,
+ const uint8_t i_rank,
+ uint8_t (&i_data)[mss::ROW_REPAIR_BYTE_COUNT],
+ const uint8_t i_port )
+{
+ FAPI_INF( ">>setRowRepair. %d:%d", i_dimm, i_rank );
+
+ fapi2::ReturnCode l_rc;
+
+ do
+ {
+ uint8_t l_data[mss::MAX_RANK_PER_DIMM][mss::ROW_REPAIR_BYTE_COUNT];
+ TARGETING::TargetHandle_t l_dimmTrgt = nullptr;
+
+ // Check parameters and get row repair data.
+ l_rc = __getDimmRepairData( i_fapiTrgt, i_dimm, i_rank,
+ l_dimmTrgt, l_data, i_port );
+ if ( l_rc )
+ {
+ FAPI_ERR( "setRowRepair: Error from __getDimmRepairData." );
+ break;
+ }
+
+ // Update the row repair data.
+ memcpy( l_data[i_rank], i_data, mss::ROW_REPAIR_BYTE_COUNT );
+
+ l_rc = FAPI_ATTR_SET( fapi2::ATTR_ROW_REPAIR_DATA, l_dimmTrgt, l_data );
+ if ( l_rc )
+ {
+ FAPI_ERR("setRowRepair: Error setting ATTR_ROW_REPAIR_DATA.");
+ }
+ }while(0);
+
+ FAPI_INF( "<<setRowRepair" );
+
+ return l_rc;
+}
+
+} // extern "C"
OpenPOWER on IntegriCloud