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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
// IBM_PROLOG_BEGIN_TAG
// This is an automatically generated prolog.
//
// $Source: src/usr/hwpf/plat/fapiPlatSystemConfig.C $
//
// IBM CONFIDENTIAL
//
// COPYRIGHT International Business Machines Corp. 2011
//
// 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 other-
// wise divested of its trade secrets, irrespective of what has
// been deposited with the U.S. Copyright Office.
//
// Origin: 30
//
// IBM_PROLOG_END
/**
* @file fapiPlatSystemConfig.C
*
* @brief Implements the fapiSystemConfig.H functions.
*
* Note that platform code must provide the implementation.
*/
#include <fapiPlatTrace.H>
#include <fapiSystemConfig.H>
#include <fapiPlatReasonCodes.H>
#include <errl/errlentry.H>
#include <targeting/targetservice.H>
#include <targeting/predicates/predicatectm.H>
extern "C"
{
//******************************************************************************
// fapiGetChildChiplets function
//******************************************************************************
fapi::ReturnCode fapiGetChildChiplets(
const fapi::Target & i_chip,
const fapi::TargetType i_chipletType,
std::vector<fapi::Target> & o_chiplets,
const fapi::TargetState i_state)
{
// TODO. Need to support i_state
FAPI_INF(ENTER_MRK "fapiGetChildChiplets. Chiplet Type: 0x%x. State: 0x%x",
i_chipletType, i_state);
fapi::ReturnCode l_rc;
o_chiplets.clear();
// Create a Class/Type/Model predicate to look for units
TARGETING::PredicateCTM l_predicate(TARGETING::CLASS_UNIT);
// Check that the input target is a chip
if (!i_chip.isChip())
{
FAPI_ERR("fapiGetChildChiplets. Input target type 0x%x is not a chip",
i_chip.getType());
/*@
* @errortype
* @moduleid MOD_FAPI_GET_CHILD_CHIPLETS
* @reasoncode RC_INVALID_REQUEST
* @userdata1 Type of input target
* @devdesc fapiGetChildChiplets request for non-chip
*/
errlHndl_t l_pError = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
fapi::MOD_FAPI_GET_CHILD_CHIPLETS,
fapi::RC_INVALID_REQUEST,
i_chip.getType());
// Attach the error log to the fapi::ReturnCode
l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
else
{
// Update the predicate to look for the specified type
if (i_chipletType == fapi::TARGET_TYPE_EX_CHIPLET)
{
l_predicate.setType(TARGETING::TYPE_EX);
}
else if (i_chipletType == fapi::TARGET_TYPE_MBA_CHIPLET)
{
l_predicate.setType(TARGETING::TYPE_MBA);
}
else if (i_chipletType == fapi::TARGET_TYPE_MBS_CHIPLET)
{
l_predicate.setType(TARGETING::TYPE_MBS);
}
else if (i_chipletType == fapi::TARGET_TYPE_MCS_CHIPLET)
{
l_predicate.setType(TARGETING::TYPE_MCS);
}
else
{
FAPI_ERR("fapiGetChildChiplets. Chiplet type 0x%x not supported",
i_chipletType);
/*@
* @errortype
* @moduleid MOD_FAPI_GET_CHILD_CHIPLETS
* @reasoncode RC_UNSUPPORTED_REQUEST
* @userdata1 Type of requested chiplet
* @devdesc fapiGetChildChiplets request for unsupported
* or invalid chiplet type
*/
errlHndl_t l_pError = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
fapi::MOD_FAPI_GET_CHILD_CHIPLETS,
fapi::RC_UNSUPPORTED_REQUEST,
i_chipletType);
// Attach the error log to the fapi::ReturnCode
l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
}
if (!l_rc)
{
// Extract the HostBoot Target pointer for the input chip
TARGETING::Target * l_pChip =
reinterpret_cast<TARGETING::Target*>(i_chip.get());
// Create a vector of TARGETING::Target pointers
TARGETING::TargetHandleList l_chipletList;
// Get children chiplets
TARGETING::targetService().
getAssociated(l_chipletList, l_pChip,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::IMMEDIATE, &l_predicate);
// Return fapi::Targets to the caller
for (uint32_t i = 0; i < l_chipletList.size(); i++)
{
fapi::Target l_chiplet(i_chipletType,
reinterpret_cast<void *>(l_chipletList[i]));
o_chiplets.push_back(l_chiplet);
}
}
FAPI_INF(EXIT_MRK "fapiGetChildChiplets. %d results", o_chiplets.size());
return l_rc;
}
//******************************************************************************
// fapiGetAssociatedDimms function
//******************************************************************************
fapi::ReturnCode fapiGetAssociatedDimms(
const fapi::Target& i_target,
std::vector<fapi::Target> & o_dimms,
const fapi::TargetState i_state)
{
// TODO. Need to support i_state
FAPI_INF(ENTER_MRK "fapiGetAssociatedDimms. State: 0x%x", i_state);
fapi::ReturnCode l_rc;
o_dimms.clear();
// Create a Class/Type/Model predicate to look for dimm cards
TARGETING::PredicateCTM l_predicate(TARGETING::CLASS_CARD,
TARGETING::TYPE_DIMM);
// Extract the HostBoot Target pointer for the input target
TARGETING::Target * l_pTarget =
reinterpret_cast<TARGETING::Target*>(i_target.get());
// Create a vector of TARGETING::Target pointers
TARGETING::TargetHandleList l_dimmList;
// Get associated dimms
TARGETING::targetService().
getAssociated(l_dimmList, l_pTarget,
TARGETING::TargetService::CHILD_BY_AFFINITY,
TARGETING::TargetService::ALL, &l_predicate);
// Return fapi::Targets to the caller
for (uint32_t i = 0; i < l_dimmList.size(); i++)
{
fapi::Target l_dimm(fapi::TARGET_TYPE_DIMM,
reinterpret_cast<void *>(l_dimmList[i]));
o_dimms.push_back(l_dimm);
}
FAPI_INF(EXIT_MRK "fapiGetAssociatedDimms. %d results", o_dimms.size());
return l_rc;
}
//******************************************************************************
// fapiGetParentChip function
//******************************************************************************
fapi::ReturnCode fapiGetParentChip(
const fapi::Target& i_chiplet,
fapi::Target & o_chip)
{
FAPI_INF(ENTER_MRK "fapiGetParentChip");
fapi::ReturnCode l_rc;
// Check that the input target is a chiplet
if (!i_chiplet.isChiplet())
{
FAPI_ERR("fapiGetParentChip. Input target type 0x%x is not a chiplet",
i_chiplet.getType());
/*@
* @errortype
* @moduleid MOD_FAPI_GET_PARENT_CHIP
* @reasoncode RC_INVALID_REQUEST
* @userdata1 Type of input target
* @devdesc fapiGetParentChip request for non-chiplet
*/
errlHndl_t l_pError = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
fapi::MOD_FAPI_GET_PARENT_CHIP,
fapi::RC_INVALID_REQUEST,
i_chiplet.getType());
// Attach the error log to the fapi::ReturnCode
l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
else
{
// Create a Class/Type/Model predicate to look for chips
TARGETING::PredicateCTM l_predicate(TARGETING::CLASS_CHIP);
// Extract the HostBoot Target pointer for the input chiplet
TARGETING::Target * l_pChiplet =
reinterpret_cast<TARGETING::Target*>(i_chiplet.get());
// Create a vector of TARGETING::Target pointers
TARGETING::TargetHandleList l_chipList;
// Get parent
TARGETING::targetService().
getAssociated(l_chipList, l_pChiplet,
TARGETING::TargetService::PARENT,
TARGETING::TargetService::IMMEDIATE, &l_predicate);
if (l_chipList.size() != 1)
{
// One parent chip was not found
FAPI_ERR("fapiGetParentChip. Number of parents found is %d",
l_chipList.size());
/*@
* @errortype
* @moduleid MOD_FAPI_GET_PARENT_CHIP
* @reasoncode RC_NO_SINGLE_PARENT
* @userdata1 Number of parents found
* @devdesc fapiGetParentChip request did not find one parent
*/
errlHndl_t l_pError = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
fapi::MOD_FAPI_GET_PARENT_CHIP,
fapi::RC_NO_SINGLE_PARENT,
l_chipList.size());
// Attach the error log to the fapi::ReturnCode
l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
}
else
{
// Set the output chip type
if (l_chipList[0]->getAttr<TARGETING::ATTR_TYPE>() ==
TARGETING::TYPE_PROC)
{
o_chip.setType(fapi::TARGET_TYPE_PROC_CHIP);
}
else
{
o_chip.setType(fapi::TARGET_TYPE_MEMBUF_CHIP);
}
// Set the output chip (platform specific) handle
o_chip.set(reinterpret_cast<void *>(l_chipList[0]));
}
}
FAPI_INF(EXIT_MRK "fapiGetParentChip");
return l_rc;
}
} // extern "C"
|