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
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/plat/prdfPlatServices_ipl.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,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 prdfPlatServices_ipl.C
* @brief Wrapper code for external interfaces used by PRD (IPL only).
*
* This file contains code that is strictly specific to Hostboot. All code that
* is common between FSP and Hostboot should be in the respective common file.
*/
#include <prdfPlatServices.H>
#include <prdfGlobal.H>
#include <prdfErrlUtil.H>
#include <prdfTrace.H>
#include <prdfCenMbaDataBundle.H>
#include <prdfMemDqBitmap.H>
#include <prdfMemScrubUtils.H>
#include <prdfMfgThresholdMgr.H>
#include <diag/mdia/mdia.H>
#include <config.h>
using namespace TARGETING;
namespace PRDF
{
namespace PlatServices
{
//##############################################################################
//## Memory specific functions
//##############################################################################
bool isInMdiaMode()
{
bool o_isInMdiaMode = false;
#ifndef CONFIG_VPO_COMPILE
MDIA::waitingForMaintCmdEvents(o_isInMdiaMode);
#endif
return o_isInMdiaMode;
}
//------------------------------------------------------------------------------
int32_t mdiaSendEventMsg( TargetHandle_t i_trgt,
MDIA::MaintCommandEventType i_eventType )
{
#define PRDF_FUNC "[PlatServices::mdiaSendEventMsg] "
int32_t o_rc = SUCCESS;
#ifndef CONFIG_VPO_COMPILE
PRDF_ASSERT( nullptr != i_trgt );
// Only MCBIST, MBA, and OCMB_CHIP supported.
TYPE trgtType = getTargetType( i_trgt );
PRDF_ASSERT( TYPE_MCBIST == trgtType ||
TYPE_MBA == trgtType ||
TYPE_OCMB_CHIP == trgtType );
// MDIA must be running.
PRDF_ASSERT( isInMdiaMode() );
// Send command complete to MDIA.
MDIA::MaintCommandEvent mdiaEvent;
mdiaEvent.target = i_trgt;
mdiaEvent.type = i_eventType;
errlHndl_t errl = MDIA::processEvent( mdiaEvent );
if ( NULL != errl )
{
PRDF_ERR( PRDF_FUNC "MDIA::processEvent() failed: i_target=0x%08x "
"i_eventType=%d", getHuid(i_trgt), i_eventType );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL;
}
#endif
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
bool rcdParityErrorReconfigLoop( TargetHandle_t i_trgt )
{
TargetHandle_t top = getSystemTarget();
// Get the current reconfig count and increment.
uint8_t count = i_trgt->getAttr<ATTR_RCD_PARITY_RECONFIG_LOOP_COUNT>() + 1;
// Get the reconfig threshold and check MNFG threshold, if needed.
uint8_t th = top->getAttr<ATTR_RCD_PARITY_RECONFIG_LOOPS_ALLOWED>() + 1;
if ( mfgMode() )
{
uint8_t mnfgTh = MfgThresholdMgr::getInstance()->
getThreshold(ATTR_MNFG_TH_RCD_PARITY_ERRORS);
if ( mnfgTh < th )
th = mnfgTh;
}
// If the count is under threshold, trigger a reconfig loop.
if ( count < th )
{
// Set the RCD parity error flag in the reconfig loop attribute. This
// will trigger a reconfig loop at the end of the current istep.
ATTR_RECONFIGURE_LOOP_type attr = top->getAttr<ATTR_RECONFIGURE_LOOP>();
if ( 0 == (attr & RECONFIGURE_LOOP_RCD_PARITY_ERROR) )
{
attr |= RECONFIGURE_LOOP_RCD_PARITY_ERROR;
top->setAttr<ATTR_RECONFIGURE_LOOP>(attr);
}
// Write the new count to the attribute.
i_trgt->setAttr<ATTR_RCD_PARITY_RECONFIG_LOOP_COUNT>(count);
return false;
}
return true;
}
//------------------------------------------------------------------------------
template<>
uint32_t mssRestoreDramRepairs<TYPE_MCA>( TargetHandle_t i_target,
uint8_t & o_repairedRankMask,
uint8_t & o_badDimmMask )
{
uint32_t o_rc = SUCCESS;
errlHndl_t errl = NULL;
fapi2::buffer<uint8_t> tmpRepairedRankMask, tmpBadDimmMask;
FAPI_INVOKE_HWP( errl, mss::restore_repairs,
fapi2::Target<fapi2::TARGET_TYPE_MCA>( i_target ),
tmpRepairedRankMask, tmpBadDimmMask );
if ( NULL != errl )
{
PRDF_ERR( "[PlatServices::mssRestoreDramRepairs] "
"restore_repairs() failed. HUID: 0x%08x",
getHuid(i_target) );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL;
}
o_repairedRankMask = (uint8_t)tmpRepairedRankMask;
o_badDimmMask = (uint8_t)tmpBadDimmMask;
return o_rc;
}
//------------------------------------------------------------------------------
template<>
uint32_t mssRestoreDramRepairs<TYPE_MBA>( TargetHandle_t i_target,
uint8_t & o_repairedRankMask,
uint8_t & o_badDimmMask )
{
uint32_t o_rc = SUCCESS;
errlHndl_t errl = NULL;
FAPI_INVOKE_HWP( errl, mss_restore_DRAM_repairs,
fapi2::Target<fapi2::TARGET_TYPE_MBA>( i_target ),
o_repairedRankMask, o_badDimmMask );
if ( NULL != errl )
{
PRDF_ERR( "[PlatServices::mssRestoreDramRepairs] "
"mss_restore_dram_repairs() failed. HUID: 0x%08x",
getHuid(i_target) );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL;
}
return o_rc;
}
//------------------------------------------------------------------------------
template<>
uint32_t mssRestoreDramRepairs<TYPE_OCMB_CHIP>( TargetHandle_t i_target,
uint8_t & o_repairedRankMask,
uint8_t & o_badDimmMask )
{
uint32_t o_rc = SUCCESS;
/* TODO RTC 207273 - no HWP support yet
errlHndl_t errl = NULL;
fapi2::buffer<uint8_t> tmpRepairedRankMask, tmpBadDimmMask;
FAPI_INVOKE_HWP( errl, mss::restore_repairs,
fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>( i_target ),
tmpRepairedRankMask, tmpBadDimmMask );
if ( NULL != errl )
{
PRDF_ERR( "[PlatServices::mssRestoreDramRepairs] "
"restore_repairs() failed. HUID: 0x%08x",
getHuid(i_target) );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL;
}
o_repairedRankMask = (uint8_t)tmpRepairedRankMask;
o_badDimmMask = (uint8_t)tmpBadDimmMask;
*/
return o_rc;
}
//------------------------------------------------------------------------------
uint32_t mssIplUeIsolation( TargetHandle_t i_mba, const MemRank & i_rank,
MemDqBitmap & o_bitmap )
{
#define PRDF_FUNC "[PlatServices::mssIplUeIsolation] "
uint32_t o_rc = SUCCESS;
uint8_t data[MAX_PORT_PER_MBA][DQ_BITMAP::BITMAP_SIZE];
errlHndl_t errl = NULL;
fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiMba( i_mba );
FAPI_INVOKE_HWP( errl, mss_IPL_UE_isolation, fapiMba, i_rank.getMaster(),
data );
if ( NULL != errl )
{
PRDF_ERR( PRDF_FUNC "mss_IPL_UE_isolation() failed: MBA=0x%08x "
"rank=%d", getHuid(i_mba), i_rank.getMaster() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL;
}
else
{
BitmapData bitmapData;
for ( uint8_t p = 0; p < MAX_PORT_PER_MBA; p++ )
{
memcpy( bitmapData[p].bitmap, data[p], sizeof(data[p]) );
}
o_bitmap = MemDqBitmap( i_mba, i_rank, bitmapData );
}
return o_rc;
#undef PRDF_FUNC
}
//##############################################################################
//## Nimbus Maintenance Command wrappers
//##############################################################################
template<>
bool isBroadcastModeCapable<TYPE_MCBIST>( ExtensibleChip * i_chip )
{
PRDF_ASSERT( nullptr != i_chip );
PRDF_ASSERT( TYPE_MCBIST == i_chip->getType() );
fapi2::Target<fapi2::TARGET_TYPE_MCBIST> fapiTrgt ( i_chip->getTrgt() );
mss::states l_ret = mss::states::NO;
FAPI_CALL_HWP( l_ret, mss::mcbist::is_broadcast_capable, fapiTrgt );
return ( mss::states::YES == l_ret );
}
//------------------------------------------------------------------------------
template<>
uint32_t startSfRead<TYPE_MCA>( ExtensibleChip * i_mcaChip,
const MemRank & i_rank )
{
#define PRDF_FUNC "[PlatServices::startSfRead<TYPE_MCA>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_mcaChip );
PRDF_ASSERT( TYPE_MCA == i_mcaChip->getType() );
uint32_t o_rc = SUCCESS;
// Get the MCBIST fapi target
ExtensibleChip * mcbChip = getConnectedParent( i_mcaChip, TYPE_MCBIST );
fapi2::Target<fapi2::TARGET_TYPE_MCBIST> fapiTrgt ( mcbChip->getTrgt() );
// Get the stop conditions.
mss::mcbist::stop_conditions<> stopCond;
stopCond.set_pause_on_mpe(mss::ON)
.set_pause_on_ue(mss::ON)
.set_pause_on_aue(mss::ON)
.set_nce_inter_symbol_count_enable(mss::ON)
.set_nce_soft_symbol_count_enable( mss::ON)
.set_nce_hard_symbol_count_enable( mss::ON);
// Stop on hard CEs if MNFG CE checking is enabled.
if ( isMfgCeCheckingEnabled() ) stopCond.set_pause_on_nce_hard(mss::ON);
do
{
// Get the first address of the given rank.
mss::mcbist::address saddr, eaddr;
o_rc = getMemAddrRange<TYPE_MCA>( i_mcaChip, i_rank, saddr, eaddr,
SLAVE_RANK );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x,0x%2x) failed",
i_mcaChip->getHuid(), i_rank.getKey() );
break;
}
// Clear all of the counters and maintenance ECC attentions.
o_rc = prepareNextCmd<TYPE_MCBIST>( mcbChip );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "prepareNextCmd(0x%08x) failed",
mcbChip->getHuid() );
break;
}
// Start the super fast read command.
errlHndl_t errl;
FAPI_INVOKE_HWP( errl, mss::memdiags::sf_read, fapiTrgt, stopCond,
saddr );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "mss::memdiags::sf_read(0x%08x,%d) failed",
mcbChip->getHuid(), i_rank.getMaster() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL; break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
// This specialization only exists to avoid a lot of extra code in some classes.
// The input chip must still be an MCA chip.
template<>
uint32_t startSfRead<TYPE_MCBIST>( ExtensibleChip * i_mcaChip,
const MemRank & i_rank )
{
return startSfRead<TYPE_MCA>( i_mcaChip, i_rank );
}
//------------------------------------------------------------------------------
template<>
uint32_t cleanupSfRead<TYPE_MCBIST>( ExtensibleChip * i_mcbChip )
{
return SUCCESS; // Not needed for MCBIST commands.
}
//##############################################################################
//## Centaur Maintenance Command wrappers
//##############################################################################
template<>
bool isBroadcastModeCapable<TYPE_MBA>( ExtensibleChip * i_chip )
{
return false; // Not supported on Centaur.
}
//------------------------------------------------------------------------------
template<>
uint32_t startSfRead<TYPE_MBA>( ExtensibleChip * i_mbaChip,
const MemRank & i_rank )
{
#define PRDF_FUNC "[PlatServices::startSfRead<TYPE_MBA>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_mbaChip );
PRDF_ASSERT( TYPE_MBA == i_mbaChip->getType() );
uint32_t o_rc = SUCCESS;
// Get the MBA fapi target
fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiTrgt ( i_mbaChip->getTrgt() );
// Get the stop conditions.
uint32_t stopCond = mss_MaintCmd::STOP_END_OF_RANK |
mss_MaintCmd::STOP_ON_MPE |
mss_MaintCmd::STOP_ON_UE |
mss_MaintCmd::STOP_ON_END_ADDRESS |
mss_MaintCmd::ENABLE_CMD_COMPLETE_ATTENTION;
// Stop on hard CEs if MNFG CE checking is enabled.
if ( isMfgCeCheckingEnabled() )
stopCond |= mss_MaintCmd::STOP_ON_HARD_NCE_ETE;
do
{
fapi2::buffer<uint64_t> saddr, eaddr, junk;
// Get the first address of the given rank.
o_rc = getMemAddrRange<TYPE_MBA>( i_mbaChip, i_rank, saddr, junk,
SLAVE_RANK );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x,0x%2x) failed",
i_mbaChip->getHuid(), i_rank.getKey() );
break;
}
// Get the last address of the chip.
o_rc = getMemAddrRange<TYPE_MBA>( i_mbaChip, junk, eaddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x) failed",
i_mbaChip->getHuid() );
break;
}
// Clear all of the counters and maintenance ECC attentions.
o_rc = prepareNextCmd<TYPE_MBA>( i_mbaChip );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "prepareNextCmd(0x%08x) failed",
i_mbaChip->getHuid() );
break;
}
// Create the new command. Store a pointer to the command in the MBA
// data bundle so that we can call the cleanup function after the
// command has completed.
MbaDataBundle * db = getMbaDataBundle( i_mbaChip );
PRDF_ASSERT( nullptr == db->iv_sfCmd ); // Code bug.
db->iv_sfCmd = new mss_SuperFastRead { fapiTrgt, saddr, eaddr,
stopCond, false };
// Start the super fast read command.
errlHndl_t errl;
FAPI_INVOKE_HWP( errl, db->iv_sfCmd->setupAndExecuteCmd );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "setupAndExecuteCmd() on 0x%08x,0x%02x failed",
i_mbaChip->getHuid(), i_rank.getKey() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL; break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
template<>
uint32_t cleanupSfRead<TYPE_MBA>( ExtensibleChip * i_mbaChip )
{
#define PRDF_FUNC "[PlatServices::cleanupSfRead<TYPE_MBA>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_mbaChip );
PRDF_ASSERT( TYPE_MBA == i_mbaChip->getType() );
uint32_t o_rc = SUCCESS;
// Cleanup the super fast read command, if it exists.
MbaDataBundle * db = getMbaDataBundle( i_mbaChip );
if ( nullptr != db->iv_sfCmd )
{
errlHndl_t errl;
FAPI_INVOKE_HWP( errl, db->iv_sfCmd->cleanupCmd );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "cleanupCmd() on 0x%08x failed",
i_mbaChip->getHuid() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL;
}
// Delete the command because we don't need it any more.
delete db->iv_sfCmd; db->iv_sfCmd = nullptr;
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
template<>
uint32_t startTdSfRead<TYPE_MBA>( ExtensibleChip * i_chip,
const MemRank & i_rank,
AddrRangeType i_rangeType,
uint32_t i_stopCond )
{
#define PRDF_FUNC "[PlatServices::startTdSfRead<TYPE_MBA>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_chip );
PRDF_ASSERT( TYPE_MBA == i_chip->getType() );
uint32_t o_rc = SUCCESS;
// Make sure there is a command complete attention when the command stops.
i_stopCond |= mss_MaintCmd::ENABLE_CMD_COMPLETE_ATTENTION;
// Make sure the command stops on the end address if there are no errors.
i_stopCond |= mss_MaintCmd::STOP_ON_END_ADDRESS;
do
{
// Get the address range of the given rank.
fapi2::buffer<uint64_t> saddr, eaddr;
o_rc = getMemAddrRange<TYPE_MBA>( i_chip, i_rank, saddr, eaddr,
i_rangeType );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x,0x%2x) failed",
i_chip->getHuid(), i_rank.getKey() );
break;
}
// Clear all of the counters and maintenance ECC attentions.
o_rc = prepareNextCmd<TYPE_MBA>( i_chip );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "prepareNextCmd(0x%08x) failed",
i_chip->getHuid() );
break;
}
// Get the MBA fapi target.
fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiTrgt ( i_chip->getTrgt() );
// Create the new command. Store a pointer to the command in the MBA
// data bundle so that we can call the cleanup function after the
// command has completed.
MbaDataBundle * db = getMbaDataBundle( i_chip );
PRDF_ASSERT( nullptr == db->iv_sfCmd ); // Code bug.
db->iv_sfCmd = new mss_SuperFastRead { fapiTrgt, saddr, eaddr,
i_stopCond, false };
// Start the super fast read command.
errlHndl_t errl = nullptr;
FAPI_INVOKE_HWP( errl, db->iv_sfCmd->setupAndExecuteCmd );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "setupAndExecuteCmd() on 0x%08x,0x%02x failed",
i_chip->getHuid(), i_rank.getKey() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL; break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
template<>
uint32_t resumeTdSfRead<TYPE_MBA>( ExtensibleChip * i_chip,
AddrRangeType i_rangeType,
uint32_t i_stopCond, bool i_incRow )
{
#define PRDF_FUNC "[PlatServices::startTdSfRead<TYPE_MBA>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_chip );
PRDF_ASSERT( TYPE_MBA == i_chip->getType() );
uint32_t o_rc = SUCCESS;
// Make sure there is a command complete attention when the command stops.
i_stopCond |= mss_MaintCmd::ENABLE_CMD_COMPLETE_ATTENTION;
// Make sure the command stops on the end address if there are no errors.
i_stopCond |= mss_MaintCmd::STOP_ON_END_ADDRESS;
fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiTrgt ( i_chip->getTrgt() );
errlHndl_t errl = nullptr;
do
{
// Increment the address that is currently in hardware. Note that the CE
// counters will be conditionally cleared. Also, all of the appropriate
// attentions will be cleared as well.
MemAddr memSaddr;
o_rc = incMaintAddr<TYPE_MBA>( i_chip, memSaddr, i_incRow );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "incMaintAddr(0x%08x) failed",
i_chip->getHuid() );
break;
}
fapi2::buffer<uint64_t> saddr = memSaddr.toMaintAddr<TYPE_MBA>();
// Get the address range of the given rank.
fapi2::buffer<uint64_t> junk, eaddr;
MemRank rank = memSaddr.getRank();
o_rc = getMemAddrRange<TYPE_MBA>( i_chip, rank, junk, eaddr,
i_rangeType );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x,0x%2x) failed",
i_chip->getHuid(), rank.getKey() );
break;
}
// Create the new command. Store a pointer to the command in the MBA
// data bundle so that we can call the cleanup function after the
// command has completed.
MbaDataBundle * db = getMbaDataBundle( i_chip );
PRDF_ASSERT( nullptr == db->iv_sfCmd ); // Code bug.
db->iv_sfCmd = new mss_SuperFastRead { fapiTrgt, saddr, eaddr,
i_stopCond, false };
// Start the super fast read command.
FAPI_INVOKE_HWP( errl, db->iv_sfCmd->setupAndExecuteCmd );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "setupAndExecuteCmd() on 0x%08x,0x%02x failed",
i_chip->getHuid(), rank.getKey() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL; break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
template<>
uint32_t startTdSteerCleanup<TYPE_MBA>( ExtensibleChip * i_chip,
const MemRank & i_rank,
AddrRangeType i_rangeType,
uint32_t i_stopCond )
{
#define PRDF_FUNC "[PlatServices::startTdSteerCleanup<TYPE_MBA>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_chip );
PRDF_ASSERT( TYPE_MBA == i_chip->getType() );
uint32_t o_rc = SUCCESS;
// Make sure there is a command complete attention when the command stops.
i_stopCond |= mss_MaintCmd::ENABLE_CMD_COMPLETE_ATTENTION;
// Make sure the command stops on the end address if there are no errors.
i_stopCond |= mss_MaintCmd::STOP_ON_END_ADDRESS;
// Default speed is to run as fast as possible.
mss_MaintCmd::TimeBaseSpeed cmdSpeed = mss_MaintCmd::FAST_MAX_BW_IMPACT;
// IUEs (reported via RCE ETE) are reported as UEs during read operations.
// Therefore, we will treat IUEs like UEs for scrub operations simply to
// maintain consistency during all of Memory Diagnostics. Note that since we
// set the stop on RCE ETE flag, this requires a threshold in the MBSTR.
// Fortunately, MDIA sets the threshold to 1 when it starts the first
// command on this MBA and that threshold should never change throughout all
// of Memory Diagnostics.
i_stopCond |= mss_MaintCmd::STOP_ON_RETRY_CE_ETE;
do
{
// Get the address range of the given rank.
fapi2::buffer<uint64_t> saddr, eaddr;
o_rc = getMemAddrRange<TYPE_MBA>( i_chip, i_rank, saddr, eaddr,
i_rangeType );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x,0x%2x) failed",
i_chip->getHuid(), i_rank.getKey() );
break;
}
// Clear all of the counters and maintenance ECC attentions.
o_rc = prepareNextCmd<TYPE_MBA>( i_chip );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "prepareNextCmd(0x%08x) failed",
i_chip->getHuid() );
break;
}
// Get the MBA fapi target.
fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiTrgt ( i_chip->getTrgt() );
// Start the steer cleanup command.
mss_TimeBaseSteerCleanup cmd { fapiTrgt, saddr, eaddr, cmdSpeed,
i_stopCond, false };
errlHndl_t errl = nullptr;
FAPI_INVOKE_HWP( errl, cmd.setupAndExecuteCmd );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "setupAndExecuteCmd() on 0x%08x,0x%02x failed",
i_chip->getHuid(), i_rank.getKey() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL; break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
template<>
uint32_t resumeTdSteerCleanup<TYPE_MBA>( ExtensibleChip * i_chip,
AddrRangeType i_rangeType,
uint32_t i_stopCond )
{
#define PRDF_FUNC "[PlatServices::startTdSteerCleanup<TYPE_MBA>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_chip );
PRDF_ASSERT( TYPE_MBA == i_chip->getType() );
uint32_t o_rc = SUCCESS;
// Make sure there is a command complete attention when the command stops.
i_stopCond |= mss_MaintCmd::ENABLE_CMD_COMPLETE_ATTENTION;
// Make sure the command stops on the end address if there are no errors.
i_stopCond |= mss_MaintCmd::STOP_ON_END_ADDRESS;
// Default speed is to run as fast as possible.
mss_MaintCmd::TimeBaseSpeed cmdSpeed = mss_MaintCmd::FAST_MAX_BW_IMPACT;
// IUEs (reported via RCE ETE) are reported as UEs during read operations.
// Therefore, we will treat IUEs like UEs for scrub operations simply to
// maintain consistency during all of Memory Diagnostics. Note that since we
// set the stop on RCE ETE flag, this requires a threshold in the MBSTR.
// Fortunately, MDIA sets the threshold to 1 when it starts the first
// command on this MBA and that threshold should never change throughout all
// of Memory Diagnostics.
i_stopCond |= mss_MaintCmd::STOP_ON_RETRY_CE_ETE;
fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiTrgt ( i_chip->getTrgt() );
errlHndl_t errl = nullptr;
do
{
// Increment the address that is currently in hardware. Note that the CE
// counters will be conditionally cleared. Also, all of the appropriate
// attentions will be cleared as well.
MemAddr newAddr;
o_rc = incMaintAddr<TYPE_MBA>( i_chip, newAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "incMaintAddr(0x%08x) failed",
i_chip->getHuid() );
break;
}
fapi2::buffer<uint64_t> saddr = newAddr.toMaintAddr<TYPE_MBA>();
// Get the address range of the given rank.
fapi2::buffer<uint64_t> junk, eaddr;
MemRank rank = newAddr.getRank();
o_rc = getMemAddrRange<TYPE_MBA>( i_chip, rank, junk, eaddr,
i_rangeType );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x,0x%2x) failed",
i_chip->getHuid(), rank.getKey() );
break;
}
// Start the steer cleanup command.
mss_TimeBaseSteerCleanup cmd { fapiTrgt, saddr, eaddr, cmdSpeed,
i_stopCond, false };
FAPI_INVOKE_HWP( errl, cmd.setupAndExecuteCmd );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "setupAndExecuteCmd() on 0x%08x,0x%02x failed",
i_chip->getHuid(), rank.getKey() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL; break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//##############################################################################
//## Explorer/Axone Maintenance Command wrappers
//##############################################################################
template<>
bool isBroadcastModeCapable<TYPE_OCMB_CHIP>( ExtensibleChip * i_chip )
{
/* TODO RTC 207273 - no HWP support yet
PRDF_ASSERT( nullptr != i_chip );
PRDF_ASSERT( TYPE_OCMB_CHIP == i_chip->getType() );
fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP> fapiTrgt ( i_chip->getTrgt() );
mss::states l_ret = mss::states::NO;
FAPI_CALL_HWP( l_ret, mss::mcbist::is_broadcast_capable, fapiTrgt );
return ( mss::states::YES == l_ret );
*/
return false;
}
//------------------------------------------------------------------------------
template<>
uint32_t startSfRead<TYPE_OCMB_CHIP>( ExtensibleChip * i_ocmb,
const MemRank & i_rank )
{
#define PRDF_FUNC "[PlatServices::startSfRead<TYPE_OCMB_CHIP>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_ocmb );
PRDF_ASSERT( TYPE_OCMB_CHIP == i_ocmb->getType() );
uint32_t o_rc = SUCCESS;
/* TODO RTC 207273 - no HWP support yet
// Get the OCMB_CHIP fapi target
fapi2::Target<fapi2::TYPE_OCMB_CHIP> fapiTrgt ( i_ocmb->getTrgt() );
// Get the stop conditions.
mss::mcbist::stop_conditions<> stopCond;
stopCond.set_pause_on_mpe(mss::ON)
.set_pause_on_ue(mss::ON)
.set_pause_on_aue(mss::ON)
.set_nce_inter_symbol_count_enable(mss::ON)
.set_nce_soft_symbol_count_enable( mss::ON)
.set_nce_hard_symbol_count_enable( mss::ON);
// Stop on hard CEs if MNFG CE checking is enabled.
if ( isMfgCeCheckingEnabled() ) stopCond.set_pause_on_nce_hard(mss::ON);
do
{
// Get the first address of the given rank.
mss::mcbist::address saddr, eaddr;
o_rc = getMemAddrRange<TYPE_OCMB_CHIP>( i_ocmb, i_rank, saddr, eaddr,
SLAVE_RANK );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x,0x%2x) failed",
i_ocmb->getHuid(), i_rank.getKey() );
break;
}
// Clear all of the counters and maintenance ECC attentions.
o_rc = prepareNextCmd<TYPE_OCMB_CHIP>( i_ocmb );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "prepareNextCmd(0x%08x) failed",
i_ocmb->getHuid() );
break;
}
// Start the super fast read command.
errlHndl_t errl;
FAPI_INVOKE_HWP( errl, mss::memdiags::sf_read, fapiTrgt, stopCond,
saddr );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "mss::memdiags::sf_read(0x%08x,%d) failed",
i_ocmb->getHuid(), i_rank.getMaster() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL; break;
}
} while (0);
*/
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
template<>
uint32_t cleanupSfRead<TYPE_OCMB_CHIP>( ExtensibleChip * i_ocmbChip )
{
return SUCCESS; // Not needed for MCBIST commands.
}
//------------------------------------------------------------------------------
template<>
uint32_t startTdSteerCleanup<TYPE_OCMB_CHIP>( ExtensibleChip * i_chip,
const MemRank & i_rank, AddrRangeType i_rangeType,
mss::mcbist::stop_conditions<> i_stopCond )
{
#define PRDF_FUNC "[PlatServices::startTdSteerCleanup<TYPE_OCMB_CHIP>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_chip );
PRDF_ASSERT( TYPE_OCMB_CHIP == i_chip->getType() );
uint32_t o_rc = SUCCESS;
// Default speed is to run as fast as possible.
//mss_MaintCmd::TimeBaseSpeed cmdSpeed = mss_MaintCmd::FAST_MAX_BW_IMPACT;
// Set stop-on-AUE for all target scrubs. See explanation in startBgScrub()
// for the reasons why.
i_stopCond.set_pause_on_aue(mss::ON);
do
{
// Get the address range of the given rank.
mss::mcbist::address saddr, eaddr;
o_rc = getMemAddrRange<TYPE_OCMB_CHIP>( i_chip, i_rank, saddr, eaddr,
i_rangeType );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x,0x%2x) failed",
i_chip->getHuid(), i_rank.getKey() );
break;
}
// Clear all of the counters and maintenance ECC attentions.
o_rc = prepareNextCmd<TYPE_OCMB_CHIP>( i_chip );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "prepareNextCmd(0x%08x) failed",
i_chip->getHuid() );
break;
}
/* TODO RTC 207273 - sparing support
// Get the MBA fapi target.
fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiTrgt ( i_chip->getTrgt() );
// Start the steer cleanup command.
mss_TimeBaseSteerCleanup cmd { fapiTrgt, saddr, eaddr, cmdSpeed,
i_stopCond, false };
errlHndl_t errl = nullptr;
FAPI_INVOKE_HWP( errl, cmd.setupAndExecuteCmd );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "setupAndExecuteCmd() on 0x%08x,0x%02x failed",
i_chip->getHuid(), i_rank.getKey() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL; break;
}
*/
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
template<>
uint32_t startTdSfRead<TYPE_OCMB_CHIP>(ExtensibleChip * i_chip,
const MemRank & i_rank,
AddrRangeType i_rangeType,
mss::mcbist::stop_conditions<> i_stopCond)
{
#define PRDF_FUNC "[PlatServices::startTdSfRead<TYPE_OCMB_CHIP>] "
PRDF_ASSERT( isInMdiaMode() ); // MDIA must be running.
PRDF_ASSERT( nullptr != i_chip );
PRDF_ASSERT( TYPE_OCMB_CHIP == i_chip->getType() );
uint32_t o_rc = SUCCESS;
// Set stop-on-AUE for all target scrubs. See explanation in startBgScrub()
// for the reasons why.
i_stopCond.set_pause_on_aue(mss::ON);
do
{
// Get the address range of the given rank.
mss::mcbist::address saddr, eaddr;
o_rc = getMemAddrRange<TYPE_OCMB_CHIP>( i_chip, i_rank, saddr, eaddr,
i_rangeType );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "getMemAddrRange(0x%08x,0x%2x) failed",
i_chip->getHuid(), i_rank.getKey() );
break;
}
// Clear all of the counters and maintenance ECC attentions.
o_rc = prepareNextCmd<TYPE_OCMB_CHIP>( i_chip );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC "prepareNextCmd(0x%08x) failed",
i_chip->getHuid() );
break;
}
/* TODO RTC 207273 - HWP support
// Get the MBA fapi target.
fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiTrgt ( i_chip->getTrgt() );
// Create the new command. Store a pointer to the command in the MBA
// data bundle so that we can call the cleanup function after the
// command has completed.
MbaDataBundle * db = getMbaDataBundle( i_chip );
PRDF_ASSERT( nullptr == db->iv_sfCmd ); // Code bug.
db->iv_sfCmd = new mss_SuperFastRead { fapiTrgt, saddr, eaddr,
i_stopCond, false };
// Start the super fast read command.
errlHndl_t errl = nullptr;
FAPI_INVOKE_HWP( errl, db->iv_sfCmd->setupAndExecuteCmd );
if ( nullptr != errl )
{
PRDF_ERR( PRDF_FUNC "setupAndExecuteCmd() on 0x%08x,0x%02x failed",
i_chip->getHuid(), i_rank.getKey() );
PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT );
o_rc = FAIL; break;
}
*/
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
} // end namespace PlatServices
} // end namespace PRDF
|