diff options
author | Chen Du <duchen@us.ibm.com> | 2019-10-15 17:42:01 -0500 |
---|---|---|
committer | Daniel M Crowell <dcrowell@us.ibm.com> | 2019-10-16 08:28:42 -0500 |
commit | e783d1e865556868147bdec5c36274d72003d3fc (patch) | |
tree | c5f8e39f6038114a03be022c6c562b81b78ad3e4 /src | |
parent | ed40af7bc74e8790871691591660d65787a816ec (diff) | |
download | talos-hostboot-e783d1e865556868147bdec5c36274d72003d3fc.tar.gz talos-hostboot-e783d1e865556868147bdec5c36274d72003d3fc.zip |
Dynamically generate ocmb cmd/rsp seq id
The current procedure code is using the sequence id portion
of the FW message to indicate the type of the command rather
than the command number. This makes error handling very
difficult because we can't detect which ocmb we are accessing
when we detect a failure. Create a function backed ekb attribute
to hold the sequence id so that every time we retrieve this attribute,
we increment the valuwe on the next get.
Change-Id: I93e0e7062d01ddf7ba6a69f89411a5b6bcf01471
RTC: 210371
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/78767
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: Daniel M Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/fapi2/attribute_service.H | 24 | ||||
-rw-r--r-- | src/usr/fapi2/attribute_service.C | 36 | ||||
-rwxr-xr-x | src/usr/targeting/common/xmltohb/attribute_types_hb.xml | 14 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/target_types_hb.xml | 3 |
4 files changed, 76 insertions, 1 deletions
diff --git a/src/include/usr/fapi2/attribute_service.H b/src/include/usr/fapi2/attribute_service.H index 58a01a064..17a7ad39a 100644 --- a/src/include/usr/fapi2/attribute_service.H +++ b/src/include/usr/fapi2/attribute_service.H @@ -514,7 +514,7 @@ ReturnCode getPllBucket(const Target<TARGET_TYPE_ALL>& i_fapiTarget, // // @param[in] i_fapiTarget The target for the attribute operation. // @param[in] i_attr Which ATTR extracting from VPD -// @param[out] o_val The retrieved attribute value. +// @param[out] o_val The retrieved attribute value // @return ReturnCode Zero on success, else platform specified error. ReturnCode platGetMBvpdSlopeInterceptData( const Target<TARGET_TYPE_ALL>& i_fapiTarget, @@ -555,6 +555,14 @@ ReturnCode platSetFreqMcaMhz(const Target<TARGET_TYPE_ALL>& i_fapiTarget, ReturnCode platGetMcPllBucket(const Target<TARGET_TYPE_ALL>& i_fapiTarget, uint8_t& o_val); +/// @brief This function is called by the FAPI_ATTR_SET macro when getting +// ATTR_OCMB_COUNTER +// @param[in] i_fapiTarget FAPI2 Target pointer +// @param[out] o_val The retrieved attribute value +// @return ReturnCode Zero on success, else platform specified error. +ReturnCode platIncrementOcmbCounter(const Target<TARGET_TYPE_ALL>& i_fapiTarget, + uint32_t& o_val); + // ----------------------------------------------------------------------------- // End TODO: End to be supported functions // ----------------------------------------------------------------------------- @@ -1731,4 +1739,18 @@ fapiToTargeting::ID, sizeof(VAL), &(VAL)) #endif //CONFIG_AXONE +//---------------------------------------------------------------------------- +// MACRO to route ATTR_OCMB_COUNTER access to the correct HB function +//---------------------------------------------------------------------------- +#undef ATTR_OCMB_COUNTER_GETMACRO +#define ATTR_OCMB_COUNTER_GETMACRO(ID, TARGET, VAL) \ + AttrOverrideSync::getAttrOverrideFunc(ID, TARGET, &VAL)\ + ? fapi2::ReturnCode() : \ + fapi2::platAttrSvc::\ + platIncrementOcmbCounter(TARGET, VAL) +#undef ATTR_OCMB_COUNTER_SETMACRO +#define ATTR_OCMB_COUNTER_SETMACRO(ID, TARGET, VAL) \ + AttrOverrideSync::getAttrOverrideFunc(ID, TARGET, &VAL)\ + ? fapi2::ReturnCode() : \ + fapi2::platAttrSvc::platErrorOnSet(TARGET, VAL) #endif // ATTRIBUTESERVICE_H_ diff --git a/src/usr/fapi2/attribute_service.C b/src/usr/fapi2/attribute_service.C index d1a301169..3cc11d60b 100644 --- a/src/usr/fapi2/attribute_service.C +++ b/src/usr/fapi2/attribute_service.C @@ -3065,7 +3065,43 @@ ReturnCode platGetFreqMcaMhz(const Target<TARGET_TYPE_ALL>& i_fapiTarget, #endif +//****************************************************************************** +// fapi::platAttrSvc::platIncrementCounter function +//****************************************************************************** +ReturnCode platIncrementOcmbCounter(const Target<TARGET_TYPE_ALL>& i_fapiTarget, + uint32_t & o_val) +{ + fapi2::ReturnCode rc; + errlHndl_t l_errl = nullptr; + TARGETING::Target * l_chipTarget = nullptr; + static mutex_t l_counter_mutex = MUTEX_INITIALIZER; + l_errl = getTargetingTarget(i_fapiTarget, l_chipTarget); + if (l_errl) + { + FAPI_ERR("platIncrementOcmbCounter: Error from getTargetingTarget"); + rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl)); + } + else + { + mutex_lock(&l_counter_mutex); + o_val = l_chipTarget->getAttr<TARGETING::ATTR_OCMB_COUNTER_HB>(); + if( o_val == 0 ) + { + // seed each target with a unique number to make messages more + // distinct across operations + o_val = (l_chipTarget->getAttr<TARGETING::ATTR_HUID>() + && 0x0000FFFF) << 16; + } + else + { + ++o_val; + } + l_chipTarget->setAttr<TARGETING::ATTR_OCMB_COUNTER_HB>(o_val); + mutex_unlock(&l_counter_mutex); + } + return rc; +} } // End platAttrSvc namespace } // End fapi2 namespace diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml index 730d251f6..4910ca681 100755 --- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml @@ -1048,6 +1048,20 @@ </attribute> <attribute> + <id>OCMB_COUNTER_HB</id> + <description> + Tracks the sequence id for OCMB command transactions. + The platform is expected to guarantee a unique value on each read. + </description> + <simpleType> + <uint32_t/> + </simpleType> + <persistency>volatile-zeroed</persistency> + <readable/> + <writeable/> + </attribute> + + <attribute> <description> While in Secureboot, this value is set to 1 the first time attribute override is attempted and error logged. diff --git a/src/usr/targeting/common/xmltohb/target_types_hb.xml b/src/usr/targeting/common/xmltohb/target_types_hb.xml index abc2bef2b..03ae7a01d 100644 --- a/src/usr/targeting/common/xmltohb/target_types_hb.xml +++ b/src/usr/targeting/common/xmltohb/target_types_hb.xml @@ -97,6 +97,9 @@ <id>MMIO_VM_ADDR</id> </attribute> <attribute> + <id>OCMB_COUNTER_HB</id> + </attribute> + <attribute> <id>VPD_SWITCHES</id> </attribute> </targetTypeExtension> |