blob: df67777f83e4f97b9341753de5768cb3f27a6714 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/targeting/namedtarget.C $ */
/* */
/* IBM CONFIDENTIAL */
/* */
/* COPYRIGHT International Business Machines Corp. 2012,2013 */
/* */
/* p1 */
/* */
/* Object Code Only (OCO) source materials */
/* Licensed Internal Code Source Materials */
/* IBM HostBoot Licensed Internal Code */
/* */
/* The source code for this program is not published or otherwise */
/* divested of its trade secrets, irrespective of what has been */
/* deposited with the U.S. Copyright Office. */
/* */
/* Origin: 30 */
/* */
/* 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 <targeting/common/commontargeting.H>
#include <targeting/common/entitypath.H>
#include <targeting/common/trace.H>
#include <attributeenums.H>
#include <targeting/common/iterators/rangefilter.H>
#include <targeting/common/predicates/predicateisfunctional.H>
#include <targeting/common/predicates/predicatepostfixexpr.H>
#include <targeting/common/utilFilter.H>
#include <targeting/namedtarget.H>
#include <sys/task.h> // task_getcpuid()
/**
* Miscellaneous Filter Utility Functions
*/
namespace TARGETING
{
const TARGETING::Target * getMasterCore( )
{
uint64_t l_masterCoreID = task_getcpuid() & ~7;
const TARGETING::Target * l_masterCore = NULL;
TARGETING::Target * l_processor = NULL;
(void)TARGETING::targetService().masterProcChipTargetHandle( l_processor );
FABRIC_NODE_ID_ATTR l_logicalNodeId =
l_processor->getAttr<TARGETING::ATTR_FABRIC_NODE_ID>();
FABRIC_CHIP_ID_ATTR l_chipId =
l_processor->getAttr<TARGETING::ATTR_FABRIC_CHIP_ID>();
TargetHandleList l_cores;
getChildChiplets( l_cores,
l_processor,
TYPE_CORE,
true );
TRACDCOMP( g_trac_targeting,
"getMasterCore: found %d cores on master proc",
l_cores.size() );
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<TARGETING::ATTR_CHIP_UNIT>();
uint64_t pir = l_coreId << 3;
pir |= l_chipId << 7;
pir |= l_logicalNodeId << 10;
if (pir == l_masterCoreID){
TRACDCOMP( g_trac_targeting,
"found master core: 0x%x, PIR=0x%x :",
l_coreId,
pir );
EntityPath l_path;
l_path = l_core->getAttr<ATTR_PHYS_PATH>();
l_path.dump();
l_masterCore = l_core ;
break;
}
} // endfor
return l_masterCore;
}
}; // end namespace
|