/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* $Source: src/usr/targeting/namedtarget.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] 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 */ /** * @file namedtarget.C * * hostBoot - specific filters. This was removed from ../common because * that source is also compiled into the fsp. * */ //****************************************************************************** // Includes //****************************************************************************** #include #include #include #include #include #include #include #include #include #include #include // task_getcpuid() /** * Miscellaneous Filter Utility Functions */ namespace TARGETING { const TARGETING::Target * getMasterCore( ) { task_affinity_pin(); task_affinity_migrate_to_master(); //This gets us master core, thread 0 PIR_t l_masterPIR = PIR_t(task_getcpuid()); task_affinity_unpin(); const TARGETING::Target * l_masterCore = NULL; TARGETING::Target * l_processor = NULL; (void)TARGETING::targetService().masterProcChipTargetHandle( l_processor ); FABRIC_GROUP_ID_ATTR l_logicalGroupId = l_processor->getAttr(); FABRIC_CHIP_ID_ATTR l_chipId = l_processor->getAttr(); TargetHandleList l_cores; getChildChiplets( l_cores, l_processor, TYPE_CORE, true ); TRACFCOMP( g_trac_targeting, "getMasterCore: found %d cores on master proc," "l_masterCore PIR:0x%X", l_cores.size(),l_masterPIR.word ); for (TARGETING::TargetHandleList::const_iterator coreIter = l_cores.begin(); coreIter != l_cores.end(); ++coreIter) { TARGETING::Target * l_core = *coreIter; CHIP_UNIT_ATTR l_coreId = l_core->getAttr(); PIR_t l_corePIR = PIR_t(l_logicalGroupId, l_chipId, l_coreId); if (l_corePIR == l_masterPIR){ TRACFCOMP( g_trac_targeting, "found master core: 0x%x, PIR=0x%x :", l_coreId, l_corePIR.word ); EntityPath l_path; l_path = l_core->getAttr(); l_path.dump(); l_masterCore = l_core ; break; } } // endfor return l_masterCore; } }; // end namespace