diff options
author | Marty Gloff <mgloff@us.ibm.com> | 2017-10-17 08:23:52 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-01-08 13:23:52 -0500 |
commit | 0a1b60c34e55018e233c64b292e16c3479d2145c (patch) | |
tree | 0595baf0046a2f7391fbf772b0e231b76b3a5f2c /src/usr/targeting/common/targetservice.C | |
parent | 1d862697f0b1256e7f7d1d620bf124eb2504d169 (diff) | |
download | talos-hostboot-0a1b60c34e55018e233c64b292e16c3479d2145c.tar.gz talos-hostboot-0a1b60c34e55018e233c64b292e16c3479d2145c.zip |
Concurrent code update of HBRT - Update Structure
Update Hostboot targeting data in the new targeting structure from the
current targeting data. It will have the logic to save and restore values
as appropriate.
Change-Id: I7ae4a0c2e58548f6f1a6229f40b9fda833670e86
RTC: 180908
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48504
Reviewed-by: Roland Veloz <rveloz@us.ibm.com>
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: Brian E. Bakke <bbakke@us.ibm.com>
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/targeting/common/targetservice.C')
-rw-r--r-- | src/usr/targeting/common/targetservice.C | 125 |
1 files changed, 119 insertions, 6 deletions
diff --git a/src/usr/targeting/common/targetservice.C b/src/usr/targeting/common/targetservice.C index b47b4a6b7..917bd5258 100644 --- a/src/usr/targeting/common/targetservice.C +++ b/src/usr/targeting/common/targetservice.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -1085,12 +1085,16 @@ void TargetService::readSectionData( //****************************************************************************** void TargetService::_configureTargetPool( - NodeSpecificInfo& i_nodeInfoContainer) + NodeSpecificInfo& i_nodeInfoContainer, + AttrRP *i_attrRP) { #define TARG_FN "_configureTargetPool(...)" TARG_ENTER(); + AttrRP *l_attrRP = (i_attrRP == NULL) + ? &TARG_GET_SINGLETON(TARGETING::theAttrRP) : i_attrRP; + _maxTargets(i_nodeInfoContainer); // iv_pPnor--> points to uint32_t* --> points to --> uint32_t, targets[] @@ -1114,7 +1118,7 @@ void TargetService::_configureTargetPool( if(TARG_ADDR_TRANSLATION_REQUIRED) { i_nodeInfoContainer.targets = static_cast<Target(*)[]>( - TARG_GET_SINGLETON(TARGETING::theAttrRP).translateAddr( + l_attrRP->translateAddr( i_nodeInfoContainer.targets, i_nodeInfoContainer.nodeId)); TARG_ASSERT(i_nodeInfoContainer.targets, TARG_ERR_LOC "FATAL: Could not determine location of targets after " @@ -1132,10 +1136,14 @@ void TargetService::_configureTargetPool( // TargetService::_maxTargets //****************************************************************************** -void TargetService::_maxTargets(NodeSpecificInfo& io_nodeInfoContainer) +void TargetService::_maxTargets(NodeSpecificInfo& io_nodeInfoContainer, + AttrRP *i_attrRP) { #define TARG_FN "_maxTargets(...)" + AttrRP *l_attrRP = (i_attrRP == NULL) + ? &TARG_GET_SINGLETON(TARGETING::theAttrRP) : i_attrRP; + // Target count found by following the pointer pointed to by the iv_pPnor // pointer. const AbstractPointer<uint32_t>* pNumTargetsPtr @@ -1149,8 +1157,8 @@ void TargetService::_maxTargets(NodeSpecificInfo& io_nodeInfoContainer) // can be statically computed at compile time. if(TARG_ADDR_TRANSLATION_REQUIRED) { - pNumTargets = static_cast<uint32_t*>( - TARG_GET_SINGLETON(TARGETING::theAttrRP).translateAddr( + pNumTargets = + static_cast<uint32_t*>(l_attrRP->translateAddr( pNumTargets, io_nodeInfoContainer.nodeId)); } @@ -1393,6 +1401,111 @@ void TargetService::getMasterNodeTarget( #undef TARG_FN } +//****************************************************************************** +// TargetService::getTargetRangeFilter +//****************************************************************************** + +TargetRangeFilter TargetService::getTargetRangeFilter(void *i_attrData, + AttrRP *i_attrRP, + uint32_t &o_maxTargets, + NODE_ID i_nodeId) +{ + #define TARG_FN "getTargetRangeFilter(...)" + TARG_ENTER(); + + // Get pointer to TargetingHeader for attribute data + TargetingHeader* l_header = + reinterpret_cast<TargetingHeader*>(i_attrData); + + // Verify TargetingHeader + TARG_ASSERT(l_header != NULL, TARG_ERR_LOC + "TargetingHeader for attribute data is NULL"); + TARG_ASSERT(l_header->eyeCatcher == PNOR_TARG_EYE_CATCHER, TARG_ERR_LOC + "TargetingHeader eyecatcher 0x%16llX is incorrect", + l_header->eyeCatcher) + + // Create node info + TargetService::NodeSpecificInfo l_nodeSpecificInfo; + l_nodeSpecificInfo.nodeId = i_nodeId; + + // Save away the address of the targeting data in pPnor field + l_nodeSpecificInfo.pPnor = + reinterpret_cast<uint32_t*>(reinterpret_cast<char*>(l_header) + + l_header->headerSize); + + (void)TargetService::_configureTargetPool(l_nodeSpecificInfo, + i_attrRP); + + l_nodeSpecificInfo.initialized = true; + + // Create pointer to first target in new attribute data + // First target is after header and number of targets count + Target* l_pFirstTarget = &(*(l_nodeSpecificInfo.targets))[0]; + TARG_INF("getTargetRangeFilter: First target pointer %p, huid 0x%.8x", + l_pFirstTarget, + get_huid(l_pFirstTarget)); + + // Create TargetRangeFilter for attribute data + TargetRangeFilter l_rangeFilter(TargetIterator(l_pFirstTarget), + TargetIterator(NULL), + NULL); + + // Set maximum target value to be returned + o_maxTargets = l_nodeSpecificInfo.maxTargets; + + TARG_EXIT(); + #undef TARG_FN + + return l_rangeFilter; +} + +//****************************************************************************** +// TargetService::getTargetAttributes +//****************************************************************************** + +uint32_t TargetService::getTargetAttributes(Target*i_target, + AttrRP *i_attrRP, + ATTRIBUTE_ID* &o_pAttrId, + AbstractPointer<void>* + &o_ppAttrAddr) +{ + #define TARG_FN "getTargetAttributes(...)" + // TARG_ENTER(); + + // Transform platform neutral pointers into platform specific pointers, and + // optimize processing by not having to do the conversion in the loop below + // (it's guaranteed that attribute metadata will be in the same contiguous + // VMM region) + o_pAttrId = TARG_TO_PLAT_PTR(i_target->iv_pAttrNames); + o_ppAttrAddr = TARG_TO_PLAT_PTR(i_target->iv_pAttrValues); + TARG_DBG("o_pAttrId before translation = %p, " + "o_ppAttrAddr before translation = %p", + o_pAttrId, + o_ppAttrAddr); + + // Only translate addresses on platforms where addresses are 4 bytes wide + // (FSP). The compiler should perform dead code elimination of this path on + // platforms with 8 byte wide addresses (Hostboot), since the "if" check can + // be statically computed at compile time. + if(TARG_ADDR_TRANSLATION_REQUIRED) + { + o_pAttrId = static_cast<ATTRIBUTE_ID*>( + i_attrRP->translateAddr(o_pAttrId, i_target)); + o_ppAttrAddr = static_cast<AbstractPointer<void>*>( + i_attrRP->translateAddr(o_ppAttrAddr, i_target)); + TARG_DBG("o_pAttrId after translation = %p, " + "o_ppAttrAddr after translation = %p", + o_pAttrId, + o_ppAttrAddr); + } + + // TARG_EXIT(); + #undef TARG_FN + + // Return the number of attributes for this target + return i_target->iv_attrs; +} + #undef TARG_CLASS #undef TARG_NAMESPACE |