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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/isteps/istep07/call_mss_volt.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] 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 call_mss_volt.C
* Contains the wrapper for istep 7.2
*/
/******************************************************************************/
// Includes
/******************************************************************************/
#include <stdint.h>
#include <map>
#include <trace/interface.H>
#include <initservice/taskargs.H>
#include <initservice/initserviceif.H>
#include <errl/errlentry.H>
#include <isteps/hwpisteperror.H>
#include <errl/errludtarget.H>
#include <initservice/isteps_trace.H>
// targeting support
#include <targeting/common/targetservice.H>
#include <targeting/common/commontargeting.H>
#include <targeting/common/utilFilter.H>
#include <attributetraits.H>
#include <config.h>
#include <util/align.H>
#include <util/algorithm.H>
//Fapi Support
#include <fapi2.H>
#include <target_types.H>
#include <plat_hwp_invoker.H>
#include <attributeenums.H>
#include <istepHelperFuncs.H>
// HWP
#include <p9_mss_volt.H>
#include <p9c_mss_volt.H>
#include <p9c_mss_volt_vddr_offset.H>
#include <p9c_mss_volt_dimm_count.H>
#ifdef CONFIG_AXONE
#include <p9a_mss_volt.H>
#endif
namespace ISTEP_07
{
using namespace ISTEP;
using namespace ISTEP_ERROR;
using namespace ERRORLOG;
using namespace TARGETING;
typedef std::map<ATTR_VDDR_ID_type, std::vector<fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>>> MembufTargetMap_t;
typedef std::vector<ATTR_VDDR_ID_type> VDDR_ID_vect_t;
/**
* @brief
* A macro that wraps call_mss_volt_hwps used to stringify the FAPI HWP call
*
* @see
* call_mss_volt_hwps below for parameter definitions
*/
#define FAPI_MSS_VOLT_CALL_MACRO(FUNC, MEMBUF_MAP, UNIQUE_VDDRS, STEP_ERROR) \
call_mss_volt_hwps(FUNC, #FUNC, MEMBUF_MAP, UNIQUE_VDDRS, STEP_ERROR)
void call_mss_volt_hwps (p9c_mss_volt_FP_t i_mss_volt_hwps,
const char* i_mss_volt_hwp_str,
MembufTargetMap_t & i_membufFapiTargetMap,
VDDR_ID_vect_t & i_unique_vddrs,
IStepError & io_err)
{
errlHndl_t l_err = NULL;
for (auto & l_vddr : i_unique_vddrs)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"Calling %s hwp with list of MEMBUF targets"
" with VDDR_ID=%d, list size=%d",
i_mss_volt_hwp_str, l_vddr,
i_membufFapiTargetMap[l_vddr].size());
// p9c_mss_volt.C (vector of centaurs with same VDDR_ID)
FAPI_INVOKE_HWP(l_err, i_mss_volt_hwps,
i_membufFapiTargetMap[l_vddr]);
// process return code
if ( l_err )
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR 0x%.8X: %s HWP() failed",
i_mss_volt_hwp_str,
l_err->reasonCode());
// Create IStep error log and cross reference to error
// that occurred
io_err.addErrorDetails(l_err);
// Commit Error
errlCommit( l_err, HWPF_COMP_ID );
}
else
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"SUCCESS : %s HWP", i_mss_volt_hwp_str);
}
}
}
void buildMembufLists(TargetHandleList & i_membufTargetList,
MembufTargetMap_t & o_membufFapiTargetMap,
VDDR_ID_vect_t & o_unique_vddr_ids)
{
for (auto & l_membuf : i_membufTargetList)
{
//get VDDR_ID attribute
auto l_vddr_id = l_membuf->getAttr<ATTR_VDDR_ID>();
//convert membuf to fapi target
fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>
l_fapi_membuf (l_membuf);
//Create a vector with the fapi target to insert in the map later.
std::vector<fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>> l_fapi_vect;
l_fapi_vect.push_back(std::move(l_fapi_membuf));
//insert {VDDR_ID, fapi2 membuf} in the map
//l_ret is of format std::pair<MembufTargetMap_t iterator, bool>
//where bool indicates whether the insertion was successful or not
auto l_ret = o_membufFapiTargetMap.insert({l_vddr_id, l_fapi_vect});
if (l_ret.second == false)
{
//This VDDR_ID already exists in the map, we need to push
//l_fapi_membuf to the exisiting vector
l_ret.first->second.push_back(std::move(l_fapi_membuf));
}
else
{
//insertion was successful meaning this is a new vddr id
//save it off in a vector for faster retrieval later
o_unique_vddr_ids.push_back(std::move(l_vddr_id));
}
}
}
void* call_mss_volt( void *io_pArgs )
{
IStepError l_StepError;
errlHndl_t l_err = NULL;
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_volt entry" );
// Check that VPP, DDR3 VDDR, and DDR4 VDDR _EFF_CONFIG attributes are set
bool unused = false;
set_eff_config_attrs_helper(DEFAULT, unused);
do
{
ATTR_MODEL_type l_procModel = targetService().getProcessorModel();
if(l_procModel == MODEL_CUMULUS)
{
TargetHandleList l_membufTargetList;
getAllChips(l_membufTargetList, TYPE_MEMBUF);
if (l_membufTargetList.size() == 0)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR: No MEMBUF targets found, skipping p9c_mss_volt HWP");
break;
}
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"Calling p9c_mss_volt HWPs on list of MEMBUF %d targets",
l_membufTargetList.size());
MembufTargetMap_t l_membufFapiTargetMap {};
VDDR_ID_vect_t l_unique_vddrs {};
buildMembufLists(l_membufTargetList, l_membufFapiTargetMap,
l_unique_vddrs);
FAPI_MSS_VOLT_CALL_MACRO(p9c_mss_volt,
l_membufFapiTargetMap,
l_unique_vddrs,
l_StepError);
if (l_StepError.getErrorHandle())
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR: p9c_mss_volt HWP failed");
break;
}
FAPI_MSS_VOLT_CALL_MACRO(p9c_mss_volt_vddr_offset,
l_membufFapiTargetMap,
l_unique_vddrs,
l_StepError);
if (l_StepError.getErrorHandle())
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR: p9c_mss_volt_vddr_offset HWP failed");
break;
}
FAPI_MSS_VOLT_CALL_MACRO(p9c_mss_volt_dimm_count,
l_membufFapiTargetMap,
l_unique_vddrs,
l_StepError);
if (l_StepError.getErrorHandle())
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR: p9c_mss_volt_vddr_offset HWP failed");
break;
}
}
else if(l_procModel == MODEL_NIMBUS)
{
TargetHandleList l_mcsTargetList;
getAllChiplets(l_mcsTargetList, TYPE_MCS);
if (l_mcsTargetList.size() == 0)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR: No MCS targets found, skipping p9_mss_volt HWP");
break;
}
std::vector< fapi2::Target<fapi2::TARGET_TYPE_MCS> >
l_mcsFapiTargetsList;
for(auto & l_mcs_target : l_mcsTargetList)
{
fapi2::Target <fapi2::TARGET_TYPE_MCS>
l_mcs_fapi_target (l_mcs_target);
l_mcsFapiTargetsList.push_back( l_mcs_fapi_target );
}
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"Calling p9_mss_volt on list of %d MCS targets",
l_mcsTargetList.size());
FAPI_INVOKE_HWP(l_err, p9_mss_volt, l_mcsFapiTargetsList);
// process return code
if ( l_err )
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR 0x%.8X: p9_mss_volt HWP() failed",
l_err->reasonCode());
// Create IStep error log and cross reference to error
// that occurred
l_StepError.addErrorDetails(l_err);
// Commit Error
errlCommit( l_err, HWPF_COMP_ID );
}
else
{
// No need to compute dynamic values if mss_volt failed
// Calculate Dynamic Offset voltages for each domain
Target* pSysTarget = NULL;
targetService().getTopLevelTarget(pSysTarget);
assert(
(pSysTarget != NULL),
"call_mss_volt: Code bug! System target was NULL.");
// only calculate if system supports dynamic voltage
if (pSysTarget->getAttr<ATTR_SUPPORTS_DYNAMIC_MEM_VOLT >() == 1)
{
l_err = computeDynamicMemoryVoltage<
ATTR_MSS_VDD_PROGRAM,
ATTR_VDD_ID>();
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR 0x%08X: computeDynamicMemoryVoltage for "
"VDD domain",
l_err->reasonCode());
l_StepError.addErrorDetails(l_err);
errlCommit(l_err,HWPF_COMP_ID);
}
l_err = computeDynamicMemoryVoltage<
ATTR_MSS_AVDD_PROGRAM,
ATTR_AVDD_ID>();
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR 0x%08X: computeDynamicMemoryVoltage for "
"AVDD domain",
l_err->reasonCode());
l_StepError.addErrorDetails(l_err);
errlCommit(l_err,HWPF_COMP_ID);
}
l_err = computeDynamicMemoryVoltage<
ATTR_MSS_VCS_PROGRAM,
ATTR_VCS_ID>();
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR 0x%08X: computeDynamicMemoryVoltage for "
"VCS domain",
l_err->reasonCode());
l_StepError.addErrorDetails(l_err);
errlCommit(l_err,HWPF_COMP_ID);
}
l_err = computeDynamicMemoryVoltage<
ATTR_MSS_VPP_PROGRAM,
ATTR_VPP_ID>();
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR 0x%08X: computeDynamicMemoryVoltage for "
"VPP domain",
l_err->reasonCode());
l_StepError.addErrorDetails(l_err);
errlCommit(l_err,HWPF_COMP_ID);
}
l_err = computeDynamicMemoryVoltage<
ATTR_MSS_VDDR_PROGRAM,
ATTR_VDDR_ID>();
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR 0x%08X: computeDynamicMemoryVoltage for "
"VDDR domain",
l_err->reasonCode());
l_StepError.addErrorDetails(l_err);
errlCommit(l_err,HWPF_COMP_ID);
}
}
}
}
#ifdef CONFIG_AXONE
else if( l_procModel == MODEL_AXONE)
{
TargetHandleList l_memportTargetList;
getAllChiplets(l_memportTargetList, TYPE_MEM_PORT);
if (l_memportTargetList.size() == 0)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR: No MEM_PORT targets found, skipping p9a_mss_volt HWP");
break;
}
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"Calling p9a_mss_volt HWPs on list %d of MEM_PORT targets",
l_memportTargetList.size());
std::vector< fapi2::Target<fapi2::TARGET_TYPE_MEM_PORT> >
l_memportFapiTargetsList;
for(auto & l_memport_target : l_memportTargetList)
{
fapi2::Target <fapi2::TARGET_TYPE_MEM_PORT>
l_memport_fapi_target (l_memport_target);
l_memportFapiTargetsList.push_back(l_memport_fapi_target);
FAPI_INVOKE_HWP(l_err, p9a_mss_volt, l_memportFapiTargetsList);
if ( l_err )
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR 0x%.8X: p9a_mss_volt HWP() failed on target 0x%.08X",
l_err->reasonCode(), get_huid(l_memport_target));
// Create IStep error log and cross reference to error
// that occurred
l_StepError.addErrorDetails(l_err);
// Commit Error
errlCommit( l_err, HWPF_COMP_ID );
}
l_memportFapiTargetsList.clear();
}
}
#endif
}while(0);
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_volt exit" );
return l_StepError.getErrorHandle();
}
};
|