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/usr/fapi2 | |
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/usr/fapi2')
-rw-r--r-- | src/usr/fapi2/attribute_service.C | 36 |
1 files changed, 36 insertions, 0 deletions
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 |