summaryrefslogtreecommitdiffstats
path: root/src/usr/fapi2
diff options
context:
space:
mode:
authorDonald Washburn <dwashbur@us.ibm.com>2017-09-11 13:58:25 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-11-01 17:07:12 -0400
commit621ab58f2f538157abc992f1f490ae0a927ed0cc (patch)
tree27c8fcc3e968dd52fa9f1ae7d0ca51836bb07cee /src/usr/fapi2
parent5e731ccc76d458e752e465471e27a40dd6011e5b (diff)
downloadtalos-hostboot-621ab58f2f538157abc992f1f490ae0a927ed0cc.tar.gz
talos-hostboot-621ab58f2f538157abc992f1f490ae0a927ed0cc.zip
Integration of hardware vpd accessor functions into Hostboot.
*Created macros and platform functions to invoke vpd accessor functions for reading attributes from Hostboot. *Create a unit test for calling each attribute accessor macro. RTC: 178950 Change-Id: Ia74406eabcdff238f6bbc4bd8dc43715ebfcd643 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48185 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> Reviewed-by: Prachi Gupta <pragupta@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2')
-rw-r--r--src/usr/fapi2/attribute_service.C496
-rwxr-xr-xsrc/usr/fapi2/fapi2.mk18
-rw-r--r--src/usr/fapi2/plat_mbvpd_access.C2
-rw-r--r--src/usr/fapi2/test/fapi2Test.mk3
-rw-r--r--src/usr/fapi2/test/fapiGetMBVpdTest.H628
-rw-r--r--src/usr/fapi2/test/makefile5
6 files changed, 1150 insertions, 2 deletions
diff --git a/src/usr/fapi2/attribute_service.C b/src/usr/fapi2/attribute_service.C
index 4de34efc1..5b4aa93b0 100644
--- a/src/usr/fapi2/attribute_service.C
+++ b/src/usr/fapi2/attribute_service.C
@@ -64,6 +64,20 @@
#include <secureboot/service.H>
+#include<vpd_accessors/accessMBvpdL4BankDelete.H>
+#include<vpd_accessors/getControlCapableData.H>
+#include<vpd_accessors/getDQAttrISDIMM.H>
+#include<vpd_accessors/getDQSAttrISDIMM.H>
+#include<vpd_accessors/getISDIMMTOC4DAttrs.H>
+#include<vpd_accessors/getMBvpdDram2NModeEnabled.H>
+#include<vpd_accessors/getMBvpdMemoryDataVersion.H>
+#include<vpd_accessors/getMBvpdSPDXRecordVersion.H>
+#include<vpd_accessors/getMBvpdSensorMap.H>
+#include<vpd_accessors/getMBvpdSpareDramData.H>
+#include<vpd_accessors/getMBvpdVersion.H>
+#include<vpd_accessors/getMBvpdVoltageSettingData.H>
+#include<vpd_accessors/getMBvpdAttr.H>
+
//******************************************************************************
// Implementation
//******************************************************************************
@@ -1309,6 +1323,488 @@ ReturnCode platSetSecurityMode()
return fapi2::ReturnCode();
}
+//-----------------------------------------------------------------------------
+ReturnCode platGetControlCapableData(
+ const Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ ATTR_CEN_VPD_POWER_CONTROL_CAPABLE_Type& o_vpdPowerControlCapableVal
+ )
+{
+ ReturnCode rc;
+
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must use
+ // the generic TARGET_TYPE_ALL -- so convert back to the correct type
+ // manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetControlCapableData: Error from getTargetingTarget");
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> l_fapiTarget(l_pTarget);
+ rc = getControlCapableData(l_fapiTarget, o_vpdPowerControlCapableVal);
+ }
+
+ return rc;
+}
+
+//-----------------------------------------------------------------------------
+ReturnCode platGetDQAttrISDIMM(
+ const Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ ATTR_CEN_VPD_ISDIMMTOC4DQ_Type &o_vpdIsDimmTOC4DQVal
+ )
+{
+ ReturnCode rc;
+
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must use
+ // the generic TARGET_TYPE_ALL -- so convert back to the correct type
+ // manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetDQAttrISDIMM: Error from getTargetingTarget");
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> l_fapiTarget(l_pTarget);
+ rc = getDQAttrISDIMM(l_fapiTarget, o_vpdIsDimmTOC4DQVal);
+ }
+
+ return rc;
+}
+
+//-----------------------------------------------------------------------------
+ReturnCode platGetDQSAttrISDIMM(
+ const Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ ATTR_CEN_VPD_ISDIMMTOC4DQS_Type& o_vpdIsDimmTOC4DQSVal
+ )
+{
+ ReturnCode rc;
+
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must use
+ // the generic TARGET_TYPE_ALL -- so convert back to the correct type
+ // manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetDQSAttrISDIMM: Error from getTargetingTarget");
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> l_fapiTarget(l_pTarget);
+ rc = getDQSAttrISDIMM(l_fapiTarget,o_vpdIsDimmTOC4DQSVal);
+ }
+
+ return rc;
+}
+
+//-----------------------------------------------------------------------------
+ReturnCode platGetMBvpdDram2NModeEnabled(
+ const Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ ATTR_CEN_VPD_DRAM_2N_MODE_ENABLED_Type& o_dram2NModeEnabled
+ )
+{
+ ReturnCode rc;
+
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must use
+ // the generic TARGET_TYPE_ALL -- so convert back to the correct type
+ // manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetMBvpdDram2NModeEnabled: "
+ "Error from getTargetingTarget");
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_MBA> l_fapiTarget(l_pTarget);
+ rc = getMBvpdDram2NModeEnabled(l_fapiTarget, o_dram2NModeEnabled);
+ }
+
+ return rc;
+}
+
+//-----------------------------------------------------------------------------
+ReturnCode platGetMBvpdMemoryDataVersion(
+ const Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ ATTR_CEN_VPD_VM_KEYWORD_Type& o_vpdVMKeywordVal
+ )
+{
+ ReturnCode rc;
+
+ do
+ {
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must
+ // use the generic TARGET_TYPE_ALL -- so convert back to the correct
+ // type manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetMBvpdMemoryDataVersion: "
+ "Error from getTargetingTarget");
+
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ break;
+ }
+ else
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>
+ l_fapiTarget(l_pTarget);
+
+ rc = getMBvpdMemoryDataVersion(l_fapiTarget, o_vpdVMKeywordVal);
+ }
+ }
+ while(0);
+
+ return rc;
+}
+
+//-----------------------------------------------------------------------------
+ReturnCode platGetMBvpdSPDXRecordVersion(
+ const Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ ATTR_CEN_VPD_VD_KEYWORD_Type& o_vpdVDKeywordVal
+ )
+{
+ ReturnCode rc;
+
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must use
+ // the generic TARGET_TYPE_ALL -- so convert back to the correct type
+ // manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetMBvpdSPDXRecordVersion: "
+ "Error from getTargetingTarget");
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> l_fapiTarget(l_pTarget);
+ rc = getMBvpdSPDXRecordVersion(l_fapiTarget, o_vpdVDKeywordVal);
+ }
+
+ return rc;
+}
+
+//-----------------------------------------------------------------------------
+ReturnCode platGetMBvpdSpareDramData(
+ const Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ ATTR_CEN_VPD_DIMM_SPARE_Type& o_vpdDimmSpare
+ )
+{
+ ReturnCode rc;
+
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must use
+ // the generic TARGET_TYPE_ALL -- so convert back to the correct type
+ // manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetMBvpdSpareDramData: Error from getTargetingTarget");
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_MBA> l_fapiTarget(l_pTarget);
+ rc = getMBvpdSpareDramData(l_fapiTarget, o_vpdDimmSpare);
+ }
+
+ return rc;
+}
+
+//-----------------------------------------------------------------------------
+ReturnCode platGetMBvpdVersion(
+ const Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ ATTR_CEN_VPD_VERSION_Type& o_vpdVersion
+ )
+{
+ ReturnCode rc;
+
+ do
+ {
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must use
+ // the generic TARGET_TYPE_ALL -- so convert back to the correct type
+ // manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetMBvpdVersion: Error from getTargetingTarget");
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ TARGETING::TargetHandleList l_mbaList;
+
+ // Find MBA target from DIMM target
+ getParentAffinityTargets(l_mbaList,
+ l_pTarget,
+ TARGETING::CLASS_UNIT,
+ TARGETING::TYPE_MBA,
+ false);
+
+ const bool hbSwError = true;
+
+ if(l_mbaList.empty())
+ {
+ /*@
+ * @errortype
+ * @moduleid fapi2::MOD_FAPI2_GET_ATTR_CEN_VPD_VERSION
+ * @reasoncode fapi2::RC_NO_PARENT_MBA
+ * @userdata1 DIMM HUID
+ * @userdata2 0
+ * @devdesc platGetMBvpdMemoryDataVersion could not find
+ * an mba parent target from the passed in
+ * dimm target.
+ */
+ l_errl = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi2::MOD_FAPI2_GET_ATTR_CEN_VPD_VERSION,
+ fapi2::RC_NO_SINGLE_MBA,
+ TARGETING::get_huid(l_pTarget),
+ 0,
+ hbSwError);
+
+ FAPI_ERR("platGetMBvpdVersion: "
+ "Error could not find an MBA parent for DIMM");
+
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ break;
+ }
+ else if(l_mbaList.size() != 1)
+ {
+ /*@
+ * @errortype
+ * @moduleid fapi2::MOD_FAPI2_GET_ATTR_CEN_VPD_VERSION
+ * @reasoncode fapi2::RC_NO_SINGLE_MBA
+ * @userdata1 Number of MBAs
+ * @userdata2 DIMM HUID
+ * @devdesc platGetMBvpdMemoryDataVersion could not find
+ * the expected 1 mba from the passed dimm target
+ */
+ l_errl = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi2::MOD_FAPI2_GET_ATTR_CEN_VPD_VERSION,
+ fapi2::RC_NO_SINGLE_MBA,
+ l_mbaList.size(),
+ TARGETING::get_huid(l_pTarget),
+ hbSwError);
+
+ FAPI_ERR("platGetMBvpdVersion: "
+ "Found multiple MBA chips while "
+ "seeking parent for DIMM");
+
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ break;
+ }
+
+ fapi2::Target<fapi2::TARGET_TYPE_MBA>
+ l_fapiTarget(l_mbaList.front());
+
+ rc = getMBvpdVersion(l_fapiTarget, o_vpdVersion);
+ }
+
+ }
+ while(0);
+
+ return rc;
+}
+
+//-----------------------------------------------------------------------------
+ReturnCode platGetMBvpdVoltageSettingData(
+ const Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ ATTR_CEN_VPD_DW_KEYWORD_Type& o_vpdDWKeyword
+ )
+{
+ ReturnCode rc;
+
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must use
+ // the generic TARGET_TYPE_ALL -- so convert back to the correct type
+ // manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetMBvpdVoltageSettingData: "
+ "Error from getTargetingTarget");
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> l_fapiTarget(l_pTarget);
+ rc = getMBvpdVoltageSettingData(l_fapiTarget, o_vpdDWKeyword);
+ }
+
+ return rc;
+}
+
+//----------------------------------------------------------------------------
+ReturnCode platGetMBvpdAttr(
+ const fapi2::Target<TARGET_TYPE_ALL>& i_fapiTarget,
+ const fapi2::AttributeId i_attr,
+ void* o_pVal,
+ const size_t i_valSize
+ )
+{
+ FAPI_INF("platGetMBvpdAttr: Enter");
+ FAPI_INF("platGetMBvpdAttr: Attr: 0x%08X", i_attr);
+
+ ReturnCode rc;
+ constexpr bool hbSwError{true};
+
+ do
+ {
+ // Don't need to check the type here, the FAPI_ATTR_GET macro clause
+ // "fapi2::Target<ID##_TargetType>(TARGET)" does it for us. However,
+ // to enable a streamlined dump of the attributes, all plat code must
+ // use the generic TARGET_TYPE_ALL -- so convert back to the correct
+ // type manually
+ TARGETING::Target * l_pTarget = NULL;
+ errlHndl_t l_errl = getTargetingTarget(i_fapiTarget, l_pTarget);
+
+ if (l_errl)
+ {
+ FAPI_ERR("platGetMBvpdAttr: Error from getTargetingTarget");
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ }
+ else
+ {
+ TARGETING::TYPE l_type =
+ l_pTarget->getAttr<TARGETING::ATTR_TYPE>();
+
+ if(TARGETING::TYPE_MBA != l_type)
+ {
+ if(TARGETING::TYPE_MEMBUF != l_type)
+ {
+ /*@
+ * @errortype
+ * @moduleid fapi2::MOD_FAPI2_GET_MB_VPD_ATTR
+ * @reasoncode fapi2::RC_INVALID_TARGET_TYPE
+ * @userdata1 Target Type
+ * @userdata2 Target HUID
+ * @devdesc platGetMBvpdMemoryDataVersion requires
+ * a target of type TYPE_MBA or TYPE_MEMBUF
+ */
+ l_errl = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi2::MOD_FAPI2_GET_ATTR_CEN_VPD_VERSION,
+ fapi2::RC_INVALID_TARGET_TYPE,
+ l_type,
+ TARGETING::get_huid(l_pTarget),
+ hbSwError);
+
+ rc = ReturnCode(fapi2::RC_INVALID_TARGET_TYPE);
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ FAPI_ERR("platGetMBvpdAttr: Invalid Target Type.");
+ break;
+ }
+
+ TARGETING::TargetHandleList l_mbaList;
+ TARGETING::getChildAffinityTargets(l_mbaList,
+ l_pTarget,
+ TARGETING::CLASS_UNIT,
+ TARGETING::TYPE_MBA,
+ false);
+
+ if(l_mbaList.empty())
+ {
+ /*@
+ * @errortype
+ * @moduleid fapi2::MOD_FAPI2_GET_MB_VPD_ATTR
+ * @reasoncode fapi2::RC_NO_CHILD_MBA
+ * @userdata1 Target Type
+ * @userdata2 Target HUID
+ * @devdesc platGetMBvpdMemoryDataVersion could not
+ * find any child mba's from the passed in
+ * target of type TYPE_MEMBUF
+ */
+ l_errl = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi2::MOD_FAPI2_GET_ATTR_CEN_VPD_VERSION,
+ fapi2::RC_NO_CHILD_MBA,
+ l_type,
+ TARGETING::get_huid(l_pTarget),
+ hbSwError);
+
+ rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
+ FAPI_ERR("platGetMBvpdAttr: Could not find a child mba "
+ "for the passed in membuf target."
+ );
+ break;
+ }
+
+ //since we have to get the value from a child mba, try all
+ //child mba's until successful.
+ for(auto l_currentMba: l_mbaList)
+ {
+ fapi2::Target<fapi2::TARGET_TYPE_MBA>
+ l_fapiTarget(l_currentMba);
+
+ rc = getMBvpdAttr(l_fapiTarget,
+ i_attr,
+ o_pVal,
+ i_valSize);
+
+ if(rc == fapi2::FAPI2_RC_SUCCESS)
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+
+ fapi2::Target<fapi2::TARGET_TYPE_MBA> l_fapiTarget(l_pTarget);
+ rc = getMBvpdAttr(l_fapiTarget,
+ i_attr,
+ o_pVal,
+ i_valSize);
+ }
+ }
+ }
+ while(0);
+
+ return rc;
+}
+
} // End platAttrSvc namespace
} // End fapi2 namespace
diff --git a/src/usr/fapi2/fapi2.mk b/src/usr/fapi2/fapi2.mk
index a338ffe1d..2b110c829 100755
--- a/src/usr/fapi2/fapi2.mk
+++ b/src/usr/fapi2/fapi2.mk
@@ -52,6 +52,7 @@ EXTRAINCDIR += ${HWP_PATH_2}/hwp/memory
EXTRAINCDIR += ${HWP_PATH_2}/hwp/memory/lib/
EXTRAINCDIR += ${HWP_PATH_2}/hwp/memory/lib/shared/
EXTRAINCDIR += ${HWP_PATH_2}/hwp/memory/lib/utils/
+EXTRAINCDIR += ${HWP_PATH_2}/vpd_accessors/
include ${ROOTPATH}/src/build/mkrules/verbose.rules.mk
define __CLEAN_TARGET
@@ -159,10 +160,27 @@ include $(ROOTPATH)/src/import/chips/p9/procedures/hwp/pm/p9_pm_get_poundw_bucke
# provider is shutdown
include $(ROOTPATH)/src/import/chips/p9/procedures/hwp/initfiles/p9_int_scom.mk
+CENTAUR_VPD_PATH=${HWP_PATH_2}/vpd_accessors
+include ${CENTAUR_VPD_PATH}/getControlCapableData.mk
+include ${CENTAUR_VPD_PATH}/getDecompressedISDIMMAttrs.mk
+include ${CENTAUR_VPD_PATH}/getISDIMMTOC4DAttrs.mk
+include ${CENTAUR_VPD_PATH}/getDQAttrISDIMM.mk
+include ${CENTAUR_VPD_PATH}/getDQSAttrISDIMM.mk
+include ${CENTAUR_VPD_PATH}/getMBvpdAddrMirrorData.mk
+include ${CENTAUR_VPD_PATH}/getMBvpdAttr.mk
+include ${CENTAUR_VPD_PATH}/getMBvpdDram2NModeEnabled.mk
+include ${CENTAUR_VPD_PATH}/getMBvpdMemoryDataVersion.mk
+include ${CENTAUR_VPD_PATH}/getMBvpdSlopeInterceptData.mk
+include ${CENTAUR_VPD_PATH}/getMBvpdSpareDramData.mk
+include ${CENTAUR_VPD_PATH}/getMBvpdSPDXRecordVersion.mk
+include ${CENTAUR_VPD_PATH}/getMBvpdVersion.mk
+include ${CENTAUR_VPD_PATH}/getMBvpdVoltageSettingData.mk
+
VPATH += ${HWP_PATH_1}/hwp/accessors
VPATH += ${ROOTPATH}/src/import/hwpf/fapi2/src/
VPATH += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/pm/
VPATH += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/
VPATH += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/lib/
VPATH += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/initfiles/
+VPATH += ${CENTAUR_VPD_PATH}/
VPATH += ${GENPATH}
diff --git a/src/usr/fapi2/plat_mbvpd_access.C b/src/usr/fapi2/plat_mbvpd_access.C
index cd76207ef..c13b6b082 100644
--- a/src/usr/fapi2/plat_mbvpd_access.C
+++ b/src/usr/fapi2/plat_mbvpd_access.C
@@ -350,7 +350,7 @@ fapi2::ReturnCode setMBvpdField
const fapi2::MBvpdKeyword i_keyword,
const fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP> &i_target,
const uint8_t * const i_pBuffer,
- const uint32_t i_fieldSize)
+ const size_t i_fieldSize)
{
fapi2::ReturnCode l_rc;
uint8_t l_recIndex = MBVPD_INVALID_CHIP_UNIT;
diff --git a/src/usr/fapi2/test/fapi2Test.mk b/src/usr/fapi2/test/fapi2Test.mk
index f818ed778..ebead350d 100644
--- a/src/usr/fapi2/test/fapi2Test.mk
+++ b/src/usr/fapi2/test/fapi2Test.mk
@@ -41,6 +41,9 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/targeting/common/
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/
EXTRAINCDIR += ${ROOTPATH}/obj/genfiles/
+CENTAUR_PROC_PATH=${ROOTPATH}/src/import/chips/centaur/procedures
+EXTRAINCDIR += ${CENTAUR_PROC_PATH}/hwp/memory/lib/shared/
+
# Procedures
OBJS += p9_sample_procedure.o
OBJS += p9_hwtests.o
diff --git a/src/usr/fapi2/test/fapiGetMBVpdTest.H b/src/usr/fapi2/test/fapiGetMBVpdTest.H
new file mode 100644
index 000000000..87a7d89e9
--- /dev/null
+++ b/src/usr/fapi2/test/fapiGetMBVpdTest.H
@@ -0,0 +1,628 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/fapiGetMBVpdTest.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] 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 __FAPI2_FAPI_GET_MB_VPD_TEST_H
+#define __FAPI2_FAPI_GET_MB_VPD_TEST_H
+
+#include <cxxtest/TestSuite.H>
+#include <attribute_service.H>
+
+#include <targeting/common/attributes.H>
+#include <fapi2/target.H>
+#include <target_types.H>
+
+#include <fapi2.H>
+
+// use TRACE_MB_VPD_ATTR_UNIT_TEST=1 make -j32
+// to enable tracing of unit test
+#ifdef TRACE_MB_VPD_ATTR_UNIT_TEST
+#define PRINT_VPD_INFO(str) \
+ FAPI_INF("%s", str)
+#define __TRACE_USE_ONLY__
+#define FAPI_TEST_TRACE(fmt, args...)\
+ FAPI_INF("Fapi2GetMBVpdTest::" fmt, ##args)
+#else
+#define __TRACE_USE_ONLY__ __attribute__((unused))
+#define PRINT_VPD_INFO(str)
+#define FAPI_TEST_TRACE(fmt, args...)
+#endif
+
+#define TEST_GET_ATTR(ID, TARGET) \
+if(rc)\
+{\
+ break;\
+}\
+do{\
+ FAPI_TEST_TRACE("TEST_GET_ATTR: Start Get Test For %s", #ID);\
+ ID##_Type buffer; \
+ clear_buffer(buffer); \
+ rc = FAPI_ATTR_GET(ID, TARGET, buffer);\
+ if(rc) \
+ {\
+ FAPI_TEST_TRACE("TEST_GET_ATTR: Failed to read %s", #ID);\
+ TS_FAIL("Fapi2GetMBVpdTest: Get Test Failed For Attribute %s", #ID); \
+ }\
+ else \
+ {\
+ dump_buffer(buffer, strbuffer, #ID); \
+ PRINT_VPD_INFO(strbuffer); \
+ }\
+}while(0)
+
+
+//----------------------------------------------------------------------
+class Fapi2GetMBVpdTest:public CxxTest::TestSuite
+{
+public:
+
+ //------------------------------------------------------------------
+ fapi2::ReturnCode hw_proc_for_test()
+ {
+ fapi2::ReturnCode rc{0};
+
+ do
+ {
+ char strbuffer[2048] = {0};
+
+ //getMBAttr attribute function.
+ TEST_GET_ATTR(ATTR_CEN_VPD_TSYS_ADR, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_TSYS_DP18, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRAM_RON, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRAM_RTT_NOM, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRAM_RTT_WR, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_ODT_RD, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_ODT_WR, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DIMM_RCD_IBT, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DIMM_RCD_OUTPUT_TIMING, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_RD_VREF, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRAM_WR_VREF, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRAM_WRDDR4_VREF, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_RCV_IMP_DQ_DQS, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRV_IMP_DQ_DQS, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRV_IMP_CNTL, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRV_IMP_ADDR, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRV_IMP_CLK, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRV_IMP_SPCKE, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_SLEW_RATE_DQ_DQS, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_SLEW_RATE_CNTL, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_SLEW_RATE_ADDR, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_SLEW_RATE_CLK, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_SLEW_RATE_SPCKE, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_CKE_PRI_MAP, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_CKE_PWR_MAP, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_RLO, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_WLO, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_GPO, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CLK_P0, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CLK_P1, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M1_CLK_P0, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M1_CLK_P1, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A0, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A1, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A2, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A3, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A4, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A5, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A6, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A7, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A8, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A9, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A10, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A11, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A12, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A13, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A14, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_A15, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_BA0, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_BA1, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_BA2, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_CASN, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_RASN, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_CMD_WEN, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_PAR, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M_ACTN, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_CKE0, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_CKE1, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_CKE2, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_CKE3, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_CSN0, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_CSN1, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_CSN2, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_CSN3, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_ODT0, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_PHASE_ROT_M0_CNTL_ODT1, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRAM_RTT_PARK, iv_targ_mba);
+ TEST_GET_ATTR(ATTR_CEN_VPD_RD_CTR_WINDAGE_OFFSET, iv_targ_mba);
+
+ TEST_GET_ATTR(ATTR_CEN_VPD_MR_VERSION_BYTE, iv_targ_membuf);
+ TEST_GET_ATTR(ATTR_CEN_VPD_MR_DATA_CONTROL_BYTE, iv_targ_membuf);
+ TEST_GET_ATTR(ATTR_CEN_VPD_MT_VERSION_BYTE, iv_targ_membuf);
+ TEST_GET_ATTR(ATTR_CEN_VPD_MT_DATA_CONTROL_BYTE, iv_targ_membuf);
+
+ //getControlCapableData attribute function
+ TEST_GET_ATTR(ATTR_CEN_VPD_POWER_CONTROL_CAPABLE,
+ iv_targ_membuf);
+
+ //getDQAttrISDIMM attribute function
+ TEST_GET_ATTR(ATTR_CEN_VPD_ISDIMMTOC4DQ, iv_targ_membuf);
+
+ //getDQSAttrISDIMM attribute function
+ TEST_GET_ATTR(ATTR_CEN_VPD_ISDIMMTOC4DQS, iv_targ_membuf);
+
+ //getMBvpdMemoryDataVersion attribute function
+ TEST_GET_ATTR(ATTR_CEN_VPD_VM_KEYWORD, iv_targ_membuf);
+
+ //getMBvpdSPDXRecordVersion attribute function
+ TEST_GET_ATTR(ATTR_CEN_VPD_VD_KEYWORD, iv_targ_membuf);
+
+ //getMBvpdVoltageSettingData attribute function
+ TEST_GET_ATTR(ATTR_CEN_VPD_DW_KEYWORD, iv_targ_membuf);
+
+ //getMBvpdDram2NModeEnabled attribute function
+ TEST_GET_ATTR(ATTR_CEN_VPD_DRAM_2N_MODE_ENABLED, iv_targ_mba);
+
+ //getMBvpdSpareDramData attribute function
+ TEST_GET_ATTR(ATTR_CEN_VPD_DIMM_SPARE, iv_targ_mba);
+
+ //getMBvpdVersion attribute function
+ TEST_GET_ATTR(ATTR_CEN_VPD_VERSION, iv_targ_dimm);
+ }
+ while(0);
+
+ return rc;
+ }
+
+ //-----------------------------------------------------------------
+ void test_mb_vpd_attr()
+ {
+ errlHndl_t l_errl{};
+
+ do
+ {
+ if(not getTargets())
+ {
+ FAPI_INF("test_mb_vpd_attr: Skipping test, unable to populate "
+ "targets. Assuming no memory buffers present.");
+ break;
+ }
+
+ //Tests placed in hardware proccedure for synchronization
+ FAPI_INVOKE_HWP(l_errl, hw_proc_for_test);
+ }
+ while(0);
+
+ if(not l_errl)
+ {
+ FAPI_INF("test_mb_vpd_attr: Exit Test Passed!");
+ }
+ else
+ {
+ delete l_errl;
+ FAPI_INF("test_mb_vpd_attr: Exit Test Failed!");
+ }
+ }
+
+private:
+
+ fapi2::Target<TARGET_TYPE_DIMM> iv_targ_dimm;
+ fapi2::Target<TARGET_TYPE_MBA> iv_targ_mba;
+ fapi2::Target<TARGET_TYPE_MEMBUF_CHIP> iv_targ_membuf;
+
+ //----------------------------------------------------
+ bool getTargets()
+ {
+ bool l_retval{false};
+
+ do
+ {
+ TARGETING::TargetHandleList l_membufTargetList;
+ TARGETING::getAllChips(l_membufTargetList,
+ TARGETING::TYPE_MEMBUF);
+
+ if(l_membufTargetList.empty())
+ {
+ FAPI_TEST_TRACE("getTargets: did not find any "
+ "membuf targets.");
+ return l_retval;
+ }
+
+ for(TARGETING::Target* l_membufTarget: l_membufTargetList)
+ {
+ TARGETING::TargetHandleList l_mbaTargetList;
+ TARGETING::getChildChiplets(l_mbaTargetList,
+ l_membufTarget,
+ TARGETING::TYPE_MBA
+ );
+
+ for(TARGETING::Target* l_mbaTarget: l_mbaTargetList)
+ {
+ TARGETING::Target* l_dimmTarget{};
+ TARGETING::TargetHandleList l_dimmList;
+
+ TARGETING::getChildAffinityTargets(
+ l_dimmList,
+ l_mbaTarget,
+ TARGETING::CLASS_LOGICAL_CARD,
+ TARGETING::TYPE_DIMM,
+ false
+ );
+
+ for(TARGETING::Target* l_currentDimm: l_dimmList)
+ {
+ if(nullptr != l_currentDimm)
+ {
+ FAPI_TEST_TRACE("getTargets: Found a DIMM target "
+ "for the parent mba target.");
+
+ l_dimmTarget = l_currentDimm;
+ break;
+ }
+ }
+
+ if(nullptr == l_dimmTarget)
+ {
+ FAPI_TEST_TRACE("getTargets: Failed to find a "
+ "DIMM child target from an MBA target"
+ );
+ continue;
+ }
+
+ iv_targ_mba =
+ fapi2::Target<fapi2::TARGET_TYPE_MBA>(l_mbaTarget);
+
+ iv_targ_membuf =
+ fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>
+ (l_membufTarget);
+
+ iv_targ_dimm =
+ fapi2::Target<fapi2::TARGET_TYPE_DIMM>(l_dimmTarget);
+
+ __TRACE_USE_ONLY__ TARGETING::ATTR_HUID_type l_huid = 0;
+
+ l_huid = l_membufTarget->getAttr<TARGETING::ATTR_HUID>();
+ FAPI_TEST_TRACE("getTargets: membuf huid: 0x%0X", l_huid);
+
+ l_huid = l_mbaTarget->getAttr<TARGETING::ATTR_HUID>();
+ FAPI_TEST_TRACE("getTargets: mba huid: 0x%0X", l_huid);
+
+ l_huid = l_dimmTarget->getAttr<TARGETING::ATTR_HUID>();
+ FAPI_TEST_TRACE("getTargets: dimm huid: 0x%0X", l_huid);
+
+ l_retval = true;
+
+ break;
+ }
+
+ if(l_retval)
+ {
+ break;
+ }
+ }
+ }
+ while(0);
+
+ return l_retval;
+ }
+
+ //-------------------------------------------------------------------------
+ template<typename T>
+ bool dump_buffer_element(const T& i_arr,
+ char*& io_ptr,
+ size_t& io_remaining,
+ size_t i_element_1)
+ {
+ bool l_retval{false};
+
+ do
+ {
+ int l_result = snprintf(io_ptr, io_remaining,
+ "\t[%llu]=0x%llX (%llu)\n",
+ i_element_1,
+ i_arr[i_element_1],
+ i_arr[i_element_1]
+ );
+
+ if(l_result >= 0 && static_cast<size_t>(l_result) <= io_remaining)
+ {
+ io_remaining -= static_cast<size_t>(l_result);
+ io_ptr += static_cast<size_t>(l_result);
+ l_retval = true;
+ }
+ }
+ while(0);
+
+ return l_retval;
+ }
+
+ //------------------------------------------------------------------------
+ template<typename T>
+ bool dump_buffer_element(const T& i_arr,
+ char*& io_ptr,
+ size_t& io_remaining,
+ size_t i_element_1,
+ size_t i_element_2)
+ {
+ bool l_retval{false};
+
+ do
+ {
+ int l_result = snprintf(io_ptr, io_remaining,
+ "\t[%llu][%llu]=0x%llX (%llu)\n",
+ i_element_1,
+ i_element_2,
+ i_arr[i_element_1][i_element_2],
+ i_arr[i_element_1][i_element_2]
+ );
+
+ if(l_result >= 0 && static_cast<size_t>(l_result) <= io_remaining)
+ {
+ io_remaining -= static_cast<size_t>(l_result);
+ io_ptr += static_cast<size_t>(l_result);
+ l_retval = true;
+ }
+ }
+ while(0);
+
+ return l_retval;
+ }
+
+ //-------------------------------------------------------------------------
+ template<typename T>
+ bool dump_buffer_element(const T& i_arr,
+ char*& io_ptr,
+ size_t& io_remaining,
+ size_t i_element_1,
+ size_t i_element_2,
+ size_t i_element_3)
+ {
+ bool l_retval{false};
+
+ do
+ {
+ if(nullptr == io_ptr)
+ {
+ break;
+ }
+
+ int l_result = snprintf(io_ptr, io_remaining,
+ "\t[%llu][%llu][%llu]=0x%llX (%llu)\n",
+ i_element_1,
+ i_element_2,
+ i_element_3,
+ i_arr[i_element_1][i_element_2][i_element_3],
+ i_arr[i_element_1][i_element_2][i_element_3]);
+
+ if(l_result >= 0 && static_cast<size_t>(l_result) <= io_remaining)
+ {
+ io_remaining -= static_cast<size_t>(l_result);
+ io_ptr += static_cast<size_t>(l_result);
+ l_retval = true;
+ }
+ }
+ while(0);
+
+ return l_retval;
+ }
+
+ //-------------------------------------------------------------------------
+ bool dump_prefix(const char* i_prefix,
+ char*& io_ptr,
+ size_t& io_remaining)
+ {
+ bool l_retval{false};
+
+ do
+ {
+ int l_result = snprintf(io_ptr, io_remaining, "%s\n", i_prefix);
+ if(l_result >= 0 && static_cast<size_t>(l_result) <= io_remaining)
+ {
+ io_remaining -= static_cast<size_t>(l_result);
+ io_ptr += static_cast<size_t>(l_result);
+ l_retval = true;
+ }
+ }
+ while(0);
+
+ return l_retval;
+ }
+
+ //-------------------------------------------------------------------------
+ template<typename T, size_t N>
+ void dump_buffer(const T& i_arr,
+ char (&i_strbuffer)[N],
+ const char* i_prefix)
+ {
+ memset(i_strbuffer, 0, N);
+ char* l_ptr = i_strbuffer;
+ bool l_bResult{false};
+
+ do
+ {
+ size_t l_remaining{(N - 1)};
+
+ if(i_prefix)
+ {
+ l_bResult = dump_prefix(i_prefix ,l_ptr, l_remaining);
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+
+ snprintf(l_ptr, l_remaining, "\tval=0x%llX\n", i_arr);
+ }
+ while(0);
+ }
+
+ //-------------------------------------------------------------------------
+ template<typename T>
+ void clear_buffer(T& i_arr)
+ {
+ memset(&i_arr, 0, sizeof(T));
+ }
+
+ //-------------------------------------------------------------------------
+ template<typename T, size_t I, size_t N>
+ void dump_buffer(const T (&i_arr)[I],
+ char (&i_strbuffer)[N],
+ const char* i_prefix)
+ {
+ memset(i_strbuffer, 0, N);
+ char* l_ptr = i_strbuffer;
+ bool l_bResult{false};
+
+ do
+ {
+ size_t l_remaining{(N - 1)};
+
+ if(i_prefix)
+ {
+ l_bResult = dump_prefix(i_prefix , l_ptr, l_remaining);
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+
+ for(size_t i=0; i<I; ++i)
+ {
+ l_bResult = dump_buffer_element(i_arr, l_ptr, l_remaining, i);
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+ }
+ while(0);
+ }
+
+ //----------------------------------------------------------------------
+ template<typename T, size_t I, size_t J, size_t N>
+ void dump_buffer(const T (&i_arr)[I][J],
+ char (&i_strbuffer)[N],
+ const char* i_prefix)
+ {
+ memset(i_strbuffer, 0, N);
+ char* l_ptr = i_strbuffer;
+
+ bool l_bResult{true};
+
+ do
+ {
+ size_t l_remaining{(N - 1)};
+
+ if(i_prefix)
+ {
+ l_bResult = dump_prefix(i_prefix , l_ptr, l_remaining);
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+
+ for(size_t i=0; i<I; ++i)
+ {
+ for(size_t j=0; j<J; ++j)
+ {
+ l_bResult = dump_buffer_element(i_arr,
+ l_ptr,
+ l_remaining,
+ i,
+ j);
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+
+ }
+ while(0);
+ }
+
+ //-------------------------------------------------------------------------
+ template<typename T, size_t I, size_t J, size_t K, size_t N>
+ void dump_buffer(const T (&i_arr)[I][J][K],
+ char (&i_strbuffer)[N],
+ const char* i_prefix)
+ {
+ memset(i_strbuffer, 0, N);
+ char* l_ptr = i_strbuffer;
+
+ bool l_bResult{true};
+
+ do
+ {
+ size_t l_remaining{(N - 1)};
+
+ if(i_prefix)
+ {
+ l_bResult = dump_prefix(i_prefix, l_ptr, l_remaining);
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+
+ for(size_t i=0; i<I; ++i)
+ {
+ for(size_t j=0; j<J; ++j)
+ {
+ for(size_t k=0; k<K; ++k)
+ {
+ l_bResult = dump_buffer_element(i_arr,
+ l_ptr,
+ l_remaining,
+ i,
+ j,
+ k);
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+
+ if(not l_bResult)
+ {
+ break;
+ }
+ }
+ }
+ while(0);
+ }
+
+};
+
+#endif
diff --git a/src/usr/fapi2/test/makefile b/src/usr/fapi2/test/makefile
index 909ee7ac2..407e2eb5c 100644
--- a/src/usr/fapi2/test/makefile
+++ b/src/usr/fapi2/test/makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2015,2016
+# Contributors Listed Below - COPYRIGHT 2015,2017
# [+] International Business Machines Corp.
#
#
@@ -31,6 +31,9 @@ MODULE = testfapi2
include fapi2Test.mk
+ifdef TRACE_MB_VPD_ATTR_UNIT_TEST
+CXXFLAGS+=-DTRACE_MB_VPD_ATTR_UNIT_TEST
+endif
include ${ROOTPATH}/config.mk
OpenPOWER on IntegriCloud