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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/hwpf/hwp/slave_sbe/slave_sbe.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 slave_sbe.C
*
* Support file for IStep: slave_sbe
* Slave SBE
*
* HWP_IGNORE_VERSION_CHECK
*/
/******************************************************************************/
// Includes
/******************************************************************************/
#include <stdint.h>
#include <trace/interface.H>
#include <initservice/taskargs.H>
#include <errl/errlentry.H>
#include <initservice/isteps_trace.H>
#include <initservice/initserviceif.H>
#include <sys/time.h>
// targeting support
#include <targeting/common/commontargeting.H>
#include <targeting/common/utilFilter.H>
#include <targeting/namedtarget.H>
#include <targeting/attrsync.H>
#include <hwpisteperror.H>
#include <errl/errludtarget.H>
// fapi support
#include <fapi.H>
#include <fapiPlatHwpInvoker.H>
#include "proc_cen_ref_clk_enable.H"
#include "slave_sbe.H"
#include "proc_revert_sbe_mcs_setup.H"
#include "proc_check_slave_sbe_seeprom_complete.H"
#include "proc_getecid.H"
#include "proc_spless_sbe_startWA.H"
#include <sbe/sbeif.H>
using namespace ISTEP;
using namespace ISTEP_ERROR;
using namespace ERRORLOG;
using namespace TARGETING;
namespace SLAVE_SBE
{
uint8_t getMembufsAttachedBitMask( TARGETING::Target * i_procChipHandle );
//******************************************************************************
// call_proc_revert_sbe_mcs_setup function
//******************************************************************************
void* call_proc_revert_sbe_mcs_setup(void *io_pArgs)
{
errlHndl_t l_errl = NULL;
IStepError l_stepError;
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_proc_revert_sbe_mcs_setup entry" );
// Note: Even though Cronus trace shows this HWP runs on all proc,
// this should be done only for Master chip per Dean.
TARGETING::Target* l_pProcTarget = NULL;
TARGETING::targetService().masterProcChipTargetHandle(l_pProcTarget);
fapi::Target l_fapiProcTarget(fapi::TARGET_TYPE_PROC_CHIP, l_pProcTarget);
// Invoke the HWP
FAPI_INVOKE_HWP(l_errl, proc_revert_sbe_mcs_setup, l_fapiProcTarget);
if (l_errl)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR : failed executing proc_revert_sbe_mcs_setup "
"returning error");
// capture the target data in the elog
ErrlUserDetailsTarget(l_pProcTarget).addToLog( l_errl );
// Create IStep error log and cross reference error that occurred
l_stepError.addErrorDetails( l_errl );
errlCommit( l_errl, HWPF_COMP_ID );
}
else
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"SUCCESS : proc_revert_sbe_mcs_setup completed ok");
}
TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"call_proc_revert_sbe_mcs_setup exit");
// end task, returning any errorlogs to IStepDisp
return l_stepError.getErrorHandle();
}
//******************************************************************************
// call_host_slave_sbe function
//******************************************************************************
void* call_host_slave_sbe_config(void *io_pArgs)
{
IStepError l_stepError;
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_host_slave_sbe_config entry" );
// execute proc_read_nest_freq.C
// execute proc_setup_sbe_config.C
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_host_slave_sbe_config exit" );
// end task, returning any errorlogs to IStepDisp
return l_stepError.getErrorHandle();
}
//******************************************************************************
// call_host_sbe_start function
//******************************************************************************
void* call_host_sbe_start( void *io_pArgs )
{
errlHndl_t l_errl = NULL;
IStepError l_stepError;
bool l_needDelay = false;
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_sbe_start entry" );
//
// get the master Proc target, we want to IGNORE this one.
//
TARGETING::Target* l_pMasterProcTarget = NULL;
TARGETING::targetService().masterProcChipTargetHandle(l_pMasterProcTarget);
//
// get a list of all the procs in the system
//
TARGETING::TargetHandleList l_procTargetList;
getAllChips(l_procTargetList, TYPE_PROC);
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"host_sbe_start: %d procs in the system.",
l_procTargetList.size() );
// loop thru all the cpu's
for (TargetHandleList::const_iterator
l_proc_iter = l_procTargetList.begin();
l_proc_iter != l_procTargetList.end();
++l_proc_iter)
{
// make a local copy of the Processor target
TARGETING::Target* l_pProcTarget = *l_proc_iter;
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"target HUID %.8X",
TARGETING::get_huid(l_pProcTarget));
fapi::Target l_fapiProcTarget( fapi::TARGET_TYPE_PROC_CHIP,
l_pProcTarget );
if (l_pProcTarget == l_pMasterProcTarget )
{
// we are just checking the Slave SBE's, skip the master
continue;
}
else if (!INITSERVICE::spBaseServicesEnabled())
{
//Need to issue SBE start workaround on all slave chips
// Invoke the HWP
FAPI_INVOKE_HWP(l_errl,
proc_spless_sbe_startWA,
l_fapiProcTarget);
l_needDelay = true;
}
else
{
//Eventually for secureboot will need to kick off
//SBE here (different HWP), but for now not needed
//so do nothing
}
if (l_errl)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR : sbe_start",
"failed, returning errorlog" );
// capture the target data in the elog
ErrlUserDetailsTarget(l_pProcTarget).addToLog( l_errl );
// Create IStep error log and cross reference error that occurred
l_stepError.addErrorDetails( l_errl );
// Commit error log
errlCommit( l_errl, HWPF_COMP_ID );
}
else
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"SUCCESS : sbe_start",
"completed ok");
}
} // endfor
//TODO RTC 87845 Should really move this delay to
// check_slave_sbe_seeprom_complete to delay/poll instead
// of one big delay here. For now if we started the slaves
// delay ~2.5 sec for them to complete
if(l_needDelay)
{
nanosleep( 2, 500000000 ); //sleep for 2.5 seconds
}
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_sbe_start exit" );
// end task, returning any errorlogs to IStepDisp
return l_stepError.getErrorHandle();
}
//******************************************************************************
// call_proc_check_slave_sbe_seeprom_complete function
//******************************************************************************
void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs )
{
errlHndl_t l_errl = NULL;
IStepError l_stepError;
void* sbeImgPtr = NULL;
size_t sbeImgSize = 0;
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_proc_check_slave_sbe_seeprom_complete entry" );
//
// get the master Proc target, we want to IGNORE this one.
//
TARGETING::Target* l_pMasterProcTarget = NULL;
TARGETING::targetService().masterProcChipTargetHandle(l_pMasterProcTarget);
//
// get a list of all the procs in the system
//
TARGETING::TargetHandleList l_procTargetList;
getAllChips(l_procTargetList, TYPE_PROC);
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"proc_check_slave_sbe_seeprom_complete: %d procs in the system.",
l_procTargetList.size() );
// loop thru all the cpu's
for (TargetHandleList::const_iterator
l_proc_iter = l_procTargetList.begin();
l_proc_iter != l_procTargetList.end();
++l_proc_iter)
{
// make a local copy of the Processor target
TARGETING::Target* l_pProcTarget = *l_proc_iter;
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"target HUID %.8X",
TARGETING::get_huid(l_pProcTarget));
if ( l_pProcTarget == l_pMasterProcTarget )
{
// we are just checking the Slave SBE's, skip the master
continue;
}
l_errl = SBE::findSBEInPnor(l_pProcTarget,sbeImgPtr,sbeImgSize);
if (l_errl)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR : proc_check_slave_sbe_seeprom_complete "
"Can't find SBE image in pnor");
}
fapi::Target l_fapiProcTarget( fapi::TARGET_TYPE_PROC_CHIP,
l_pProcTarget );
// Invoke the HWP
FAPI_INVOKE_HWP(l_errl,
proc_check_slave_sbe_seeprom_complete,
l_fapiProcTarget, sbeImgPtr);
if (l_errl)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR : proc_check_slave_sbe_seeprom_complete",
"failed, returning errorlog" );
// capture the target data in the elog
ErrlUserDetailsTarget(l_pProcTarget).addToLog( l_errl );
// Create IStep error log and cross reference to error that occurred
l_stepError.addErrorDetails( l_errl );
// Commit error log
errlCommit( l_errl, HWPF_COMP_ID );
}
else
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"SUCCESS : proc_check_slave_sbe_seeprom_complete",
"completed ok");
}
} // endfor
// Once the sbe's are up correctly, fetch all the proc ECIDs and
// store them in an attribute.
for (TargetHandleList::const_iterator
l_proc_iter = l_procTargetList.begin();
l_proc_iter != l_procTargetList.end();
++l_proc_iter)
{
// make a local copy of the Processor target
TARGETING::Target* l_pProcTarget = *l_proc_iter;
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"target HUID %.8X",
TARGETING::get_huid(l_pProcTarget));
fapi::Target l_fapiProcTarget( fapi::TARGET_TYPE_PROC_CHIP,
l_pProcTarget );
// proc_getecid should set the fuse string to 112 bits long.
ecmdDataBufferBase l_fuseString;
// Invoke the HWP
FAPI_INVOKE_HWP(l_errl,
proc_getecid,
l_fapiProcTarget,
l_fuseString );
if (l_errl)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR : proc_getecid",
" failed, returning errorlog" );
// capture the target data in the elog
ErrlUserDetailsTarget(l_pProcTarget).addToLog( l_errl );
// Create IStep error log and cross reference error that occurred
l_stepError.addErrorDetails( l_errl );
// Commit error log
errlCommit( l_errl, HWPF_COMP_ID );
}
else
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"SUCCESS : proc_getecid",
" completed ok");
}
} // endfor
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"call_proc_check_slave_sbe_seeprom_complete exit");
// end task, returning any errorlogs to IStepDisp
return l_stepError.getErrorHandle();
}
//******************************************************************************
// call_proc_xmit_sbe
//******************************************************************************
void* call_proc_xmit_sbe(void *io_pArgs )
{
IStepError l_stepError;
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_proc_xmit_sbe entry" );
// call proc_xmit_sbe.C
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_proc_xmit_sbe exit" );
// end task, returning any errorlogs to IStepDisp
return l_stepError.getErrorHandle();
}
//******************************************************************************
// call_proc_cen_ref_clock_enable
//******************************************************************************
void* call_proc_cen_ref_clk_enable(void *io_pArgs )
{
errlHndl_t l_errl = NULL;
IStepError l_stepError;
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_proc_cen_ref_clock_enable enter" );
TARGETING::TargetHandleList functionalProcChipList;
getAllChips(functionalProcChipList, TYPE_PROC, true);
// loop thru the list of processors
for (TargetHandleList::const_iterator
l_proc_iter = functionalProcChipList.begin();
l_proc_iter != functionalProcChipList.end();
++l_proc_iter)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"target HUID %.8X",
TARGETING::get_huid( *l_proc_iter ));
uint8_t l_membufsAttached = 0;
// get a bit mask of present/functional dimms assocated with
// this processor
l_membufsAttached = getMembufsAttachedBitMask( *l_proc_iter );
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"passing target HUID %.8X and 0x%x mask",
TARGETING::get_huid( *l_proc_iter ), l_membufsAttached );
if( l_membufsAttached )
{
fapi::Target l_fapiProcTarget( fapi::TARGET_TYPE_PROC_CHIP,
*l_proc_iter );
// Invoke the HWP passing in the proc target and
// a bit mask indicating connected centaurs
FAPI_INVOKE_HWP(l_errl,
proc_cen_ref_clk_enable,
l_fapiProcTarget, l_membufsAttached );
if (l_errl)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR : proc_cen_ref_clk_enable",
"failed, returning errorlog" );
// capture the target data in the elog
ErrlUserDetailsTarget( *l_proc_iter ).addToLog( l_errl );
// Create IStep error log and cross ref error that occurred
l_stepError.addErrorDetails( l_errl );
// Commit error log
errlCommit( l_errl, HWPF_COMP_ID );
}
else
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"SUCCESS : proc_cen_ref_clk_enable",
"completed ok");
}
}
} // endfor
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_proc_cen_ref_clock_enable exit" );
// end task, returning any errorlogs to IStepDisp
return l_stepError.getErrorHandle();
}
//******************************************************************************
// getMembufsAttachedBitMask - helper function for hwp proc_cen_ref_clk_enable
//******************************************************************************
uint8_t getMembufsAttachedBitMask( TARGETING::Target * i_procTarget )
{
const uint8_t MCS_WITH_ATTACHED_CENTAUR_MASK = 0x80;
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Finding functional membuf chips downstream from "
"proc chip with HUID of 0x%08X",
i_procTarget->getAttr<TARGETING::ATTR_HUID>());
uint8_t l_attachedMembufs = 0;
// Get list of functional membuf chips downstream from the given
// proc chip
TARGETING::TargetHandleList functionalMembufChipList;
getChildAffinityTargets( functionalMembufChipList,
const_cast<TARGETING::Target*>(i_procTarget ),
TARGETING::CLASS_CHIP,
TARGETING::TYPE_MEMBUF,
true);
// loop through the functional membufs
for(TARGETING::TargetHandleList::const_iterator pTargetItr
= functionalMembufChipList.begin();
pTargetItr != functionalMembufChipList.end();
pTargetItr++)
{
// Find each functional membuf chip's upstream functional MCS
// unit, if any, and accumulate it into the attached membuf
// chips mask
TARGETING::TargetHandleList functionalMcsUnitList;
getParentAffinityTargets( functionalMcsUnitList, *pTargetItr,
TARGETING::CLASS_UNIT, TARGETING::TYPE_MCS,
true );
if(functionalMcsUnitList.empty())
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Functional membuf chip with HUID of 0x%08X "
"is not attached to an upstream functional MCS",
(*pTargetItr)->getAttr<
TARGETING::ATTR_HUID>());
continue;
}
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Found functional MCS unit with HUID of 0x%08X "
"upstream from functional membuf chip with HUID of 0x%08X",
((*functionalMcsUnitList.begin())->getAttr<
TARGETING::ATTR_CHIP_UNIT>()),
(*pTargetItr)->getAttr<
TARGETING::ATTR_HUID>());
l_attachedMembufs |=
((MCS_WITH_ATTACHED_CENTAUR_MASK) >>
((*functionalMcsUnitList.begin())->getAttr<
TARGETING::ATTR_CHIP_UNIT>()));
}
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Proc chip with HUID of 0x%08X has attached membuf "
"mask (l_attachedMembufs) of 0x%02X",
i_procTarget->getAttr<TARGETING::ATTR_HUID>(),
l_attachedMembufs);
// return the bitmask
return l_attachedMembufs;
}
}
|