diff options
-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> |