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
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/hwpf/hwp/slave_sbe/slave_sbe.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2015 */
/* [+] 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 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 <initservice/initsvcreasoncodes.H>
#include <sys/time.h>
#include <devicefw/userif.H>
#include <i2c/i2cif.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>
#include <freqVoltageSvc.H>
const uint64_t MS_TO_WAIT_FIRST = 2500; //(2.5 s)
const uint64_t MS_TO_WAIT_OTHERS= 100; //(100 ms)
using namespace ISTEP;
using namespace ISTEP_ERROR;
using namespace ERRORLOG;
using namespace TARGETING;
namespace SLAVE_SBE
{
uint8_t getMembufsAttachedBitMask( TARGETING::Target * i_procChipHandle );
void fenceAttachedMembufs( 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)
{
errlHndl_t l_errl = NULL;
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
#ifdef CONFIG_HTMGT
// Set system frequency attributes
l_errl = FREQVOLTSVC::setSysFreq();
if (l_errl )
{
// Create IStep error log and cross reference error that occurred
l_stepError.addErrorDetails( l_errl );
// Commit Error
errlCommit( l_errl, HWPF_COMP_ID );
}
#endif // CONFIG_HTMGT
// If there is no FSP, set ATTR_PROC_BOOT_VOLTAGE_VID
if (!INITSERVICE::spBaseServicesEnabled())
{
l_errl = set_proc_boot_voltage_vid();
if( l_errl )
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Error setting PROC_BOOT_VOLTAGE_VID: "
"slave_sbe.C::call_host_slave_sbe_config()");
// Create IStep error log
l_stepError.addErrorDetails( l_errl );
// Commit Error
errlCommit( l_errl, HWPF_COMP_ID );
}
}
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_host_slave_sbe_config exit" );
// end task, returning any errorlogs to IStepDisp
return l_stepError.getErrorHandle();
}
//******************************************************************************
// set_proc_boot_voltage_vid
//******************************************************************************
errlHndl_t set_proc_boot_voltage_vid()
{
errlHndl_t l_errl = NULL;
IStepError l_stepError;
TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ENTER set_proc_boot_voltage_vid()");
do
{
// Get the top level target/system target
Target* l_pTopLevelTarget = NULL;
targetService().getTopLevelTarget(l_pTopLevelTarget);
// If there is no top level target, terminate
assert(l_pTopLevelTarget, "ERROR: Top level "
"target not found - slave_sbe.C::set_proc_boot_voltage_vid");
// Get all Procs
PredicateCTM l_proc(CLASS_CHIP, TYPE_PROC);
PredicateIsFunctional l_functional;
PredicatePostfixExpr l_procs;
l_procs.push(&l_proc).push(&l_functional).And();
TargetRangeFilter l_filter( targetService().begin(),
targetService().end(),
&l_procs);
ATTR_BOOT_FREQ_MHZ_type l_boot_freq_mhz =
l_pTopLevelTarget->getAttr<ATTR_BOOT_FREQ_MHZ>();
for(; l_filter; ++l_filter)
{
l_errl = FREQVOLTSVC::runProcGetVoltage(*l_filter,
l_boot_freq_mhz);
if( l_errl )
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR: calling runProcGetVoltage for Proc "
"Target HUID[0x%08X]",
l_filter->getAttr<ATTR_HUID>());
// Deconfig the processor
l_errl->addHwCallout(*l_filter,
HWAS::SRCI_PRIORITY_LOW,
HWAS::DECONFIG,
HWAS::GARD_NULL);
// Commit error log
errlCommit( l_errl, HWPF_COMP_ID );
}
}
}while( 0 );
return l_errl;
}
//******************************************************************************
// call_host_sbe_start function
//******************************************************************************
void* call_host_sbe_start( void *io_pArgs )
{
errlHndl_t l_errl = NULL;
IStepError l_stepError;
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);
}
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
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;
size_t l_wait_time = MS_TO_WAIT_OTHERS;
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"call_proc_check_slave_sbe_seeprom_complete entry" );
//If in FSPless environment -- give time for SBE to complete on first chip
if (!INITSERVICE::spBaseServicesEnabled())
{
l_wait_time = MS_TO_WAIT_FIRST;
}
//
// 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::ReturnCode rc_fapi = fapi::FAPI_RC_SUCCESS;
FAPI_EXEC_HWP(rc_fapi,
proc_check_slave_sbe_seeprom_complete,
l_fapiProcTarget,
sbeImgPtr,
l_wait_time);
// check for re ipl request
if(static_cast<uint32_t>(rc_fapi) ==
fapi::RC_PROC_EXTRACT_SBE_RC_ENGINE_RETRY)
{
l_errl = fapi::fapiRcToErrl(rc_fapi);
// capture the target data in the elog
ErrlUserDetailsTarget(l_pProcTarget).addToLog( l_errl );
l_errl->setSev(ERRL_SEV_INFORMATIONAL);
errlCommit( l_errl, HWPF_COMP_ID );
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"ERROR : proc_extract_sbe_rc requesting reIPL:"
" Calling INITSERVICE::doShutdown() with "
"SBE_EXTRACT_RC_REQUEST_REIPL = 0x%x",
INITSERVICE::SBE_EXTRACT_RC_REQUEST_REIPL);
INITSERVICE::doShutdown
( INITSERVICE::SBE_EXTRACT_RC_REQUEST_REIPL);
// doShutdown does not return
}
else
{
l_errl = fapi::fapiRcToErrl(rc_fapi);
}
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");
}
//after first one default to quick check time
l_wait_time = MS_TO_WAIT_OTHERS;
} // 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
// Slave processors should now use Host I2C Access Method
I2C::i2cSetAccessMode( I2C::I2C_SET_ACCESS_MODE_PROC_HOST );
// Reset the Processor's I2C Masters
l_errl = I2C::i2cResetActiveMasters(I2C::I2C_PROC_ALL);
if (l_errl)
{
// Commit error
errlCommit( l_errl, HWPF_COMP_ID );
}
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 );
//Perform a workaround for GA1 to raise fences on centaurs
//to prevent FSP from analyzing if HB TIs for recoverable
//errors
//RTC 106276
fenceAttachedMembufs( *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;
}
//******************************************************************************
// fenceAttachedMembufs - helper function for hwp proc_cen_ref_clk_enable
//******************************************************************************
void fenceAttachedMembufs( TARGETING::Target * i_procTarget )
{
errlHndl_t l_errl = NULL;
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Fencing attached (present) membuf chips downstream from "
"proc chip with HUID of 0x%08X",
i_procTarget->getAttr<TARGETING::ATTR_HUID>());
// Get list of membuf chips downstream from the given proc chip
TARGETING::TargetHandleList MembufChipList;
getChildAffinityTargetsByState( MembufChipList,
const_cast<TARGETING::Target*>(i_procTarget ),
TARGETING::CLASS_CHIP,
TARGETING::TYPE_MEMBUF,
TARGETING::UTIL_FILTER_PRESENT);
// loop through the membufs
for(TARGETING::TargetHandleList::const_iterator pTargetItr
= MembufChipList.begin();
pTargetItr != MembufChipList.end();
pTargetItr++)
{
//Get CFAM "1012" -- FSI GP3 and set bits 23-27 (various fence bits)
//Note 1012 is ecmd addressing, real address is 0x1048 (byte)
uint64_t l_addr = 0x1048;
const uint32_t l_fence_bits= 0x000001F0;
uint32_t l_data = 0;
size_t l_size = sizeof(uint32_t);
l_errl = deviceRead(*pTargetItr,
&l_data,
l_size,
DEVICE_FSI_ADDRESS(l_addr));
if (l_errl)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Failed getcfam 1012 to HUID 0x%08X, ignoring, skipping",
(*pTargetItr)->getAttr<TARGETING::ATTR_HUID>());
delete l_errl;
l_errl = NULL;
continue;
}
l_data |= l_fence_bits;
l_errl = deviceWrite(*pTargetItr,
&l_data,
l_size,
DEVICE_FSI_ADDRESS(l_addr));
if (l_errl)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
"Failed putcfam 1012 to HUID 0x%08X, ignoring, skipping",
(*pTargetItr)->getAttr<TARGETING::ATTR_HUID>());
delete l_errl;
l_errl = NULL;
continue;
}
}
}
}
|