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
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/common/runtime/prdfCenMbaTdCtlr_rt.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,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 */
#include <prdfCenMbaTdCtlr_rt.H>
// Framework includes
#include <iipconst.h>
#include <prdfGlobal.H>
#include <prdfTrace.H>
#include <prdfExtensibleChip.H>
#include <prdfPlatServices.H>
#include <UtilHash.H>
#ifndef __HOSTBOOT_RUNTIME
#include <prdfSdcFileControl.H>
#endif
// Pegasus includes
#include <prdfCenAddress.H>
#include <prdfCenDqBitmap.H>
#include <prdfCenMbaDataBundle.H>
#include <prdfCenMbaExtraSig.H>
#include <prdfCalloutUtil.H>
#include <prdfCenMemUtils.H>
#include <prdfCenMbaThresholds.H>
#include <prdfCenMbaDynMemDealloc_rt.H>
using namespace TARGETING;
namespace PRDF
{
using namespace CalloutUtil;
using namespace PlatServices;
using namespace MemUtils;
//------------------------------------------------------------------------------
// Class Variables
//------------------------------------------------------------------------------
CenMbaTdCtlr::FUNCS CenMbaTdCtlr::cv_cmdCompleteFuncs[] =
{
&CenMbaTdCtlr::analyzeCmdComplete, // NO_OP
&CenMbaTdCtlr::analyzeVcmPhase1, // VCM_PHASE_1
&CenMbaTdCtlr::analyzeVcmPhase2, // VCM_PHASE_2
&CenMbaTdCtlr::analyzeDsdPhase1, // DSD_PHASE_1
NULL, // DSD_PHASE_2
&CenMbaTdCtlr::analyzeTpsPhase1, // TPS_PHASE_1
NULL, // TPS_PHASE_2
};
//------------------------------------------------------------------------------
// Public Functions
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleCmdCompleteEvent( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleCmdCompleteEvent] "
int32_t o_rc = SUCCESS;
do
{
o_rc = initialize();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"initialize() failed" );
break;
}
collectStateCaptureDataStart( io_sc );
// Get address in which the command stopped and the end address.
// Some analysis is dependent on if the maintenance command has reached
// the end address or stopped in the middle.
CenAddr stopAddr;
o_rc = getCenMaintStartAddr( iv_mbaChip, stopAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getCenMaintStartAddr() failed" );
break;
}
CenAddr endAddr;
o_rc = getCenMaintEndAddr( iv_mbaChip, endAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getCenMaintEndAddr() failed" );
break;
}
// Call analysis function based on state.
if ( NULL == cv_cmdCompleteFuncs[iv_tdState] )
{
PRDF_ERR( PRDF_FUNC"Function for state %d not supported",
iv_tdState );
o_rc = FAIL; break;
}
o_rc = (this->*cv_cmdCompleteFuncs[iv_tdState])( io_sc, stopAddr,
endAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Failed to continue analysis" );
break;
}
} while(0);
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Failed." );
badPathErrorHandling( io_sc );
int32_t l_rc = cleanupPrevCmd( io_sc ); // Just in case.
if ( SUCCESS != l_rc )
PRDF_ERR( PRDF_FUNC"cleanupPrevCmd() failed" );
// Will not resume background scrubbing because that may be the root
// cause of the failure.
}
else
{
collectStateCaptureDataEnd( io_sc );
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleTdEvent( STEP_CODE_DATA_STRUCT & io_sc,
const CenRank & i_rank,
const TdType i_event,
bool i_banTps )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleTdEvent] "
int32_t o_rc = SUCCESS;
do
{
o_rc = initialize();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"initialize() failed" );
break;
}
collectStateCaptureDataStart( io_sc );
// Add a new entry to the queue.
if ( VCM_EVENT == i_event )
o_rc = addTdQueueEntryVCM( i_rank );
else if ( TPS_EVENT == i_event )
o_rc = addTdQueueEntryTPS( i_rank, io_sc, i_banTps );
else
o_rc = FAIL;
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Failed to add TD queue entry" );
break;
}
// Don't interrupt a TD procedure if one is already in progress.
if ( isInTdMode() ) break;
// If the fetch attentions are already masked, then this must have been
// a TPS request due to a memory UE, which will eventually be
// thresholded by the rule code. Therefore, there is no need to stop
// background scrubbing.
if ( (TPS_EVENT == i_event) && iv_fetchAttnsMasked ) break;
// Stop background scrubbing. Whether to start a new TD procedure or to
// temporarily mask TPS triggers while TPS is banned to prevent
// flooding.
if ( NULL == iv_mssCmd )
{
// This scenario will only exist if there was a resest/reload or
// failover. It should be safe to just make a dummy command so that
// we can stop the current command.
iv_mssCmd = createMssCmd( mss_MaintCmdWrapper::TIMEBASE_SCRUB,
iv_mbaTrgt, CenRank(0), 0 );
if ( NULL == iv_mssCmd )
{
PRDF_ERR( PRDF_FUNC"createMssCmd() failed" );
break;
}
o_rc = iv_mssCmd->stopCmd();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"stopCmd() failed" );
break;
}
// We don't want to chance calling cleanupCmd() on this command
// since we created a temporary command object just to stop
// background scrubbing. Therefore, delete the object.
delete iv_mssCmd; iv_mssCmd = NULL;
}
else
{
o_rc = iv_mssCmd->stopCmd();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"stopCmd() failed" );
break;
}
}
// If the queue is empty, there were no pending requests and the new
// TPS request was blocked. In this case, we need to temporarily mask
// TPS triggers (except memory UEs) while TPS is banned to prevent
// flooding.
if ( iv_queue.empty() )
{
o_rc = maskFetchAttns();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"maskFetchAttns() failed" );
break;
}
}
// Start the next diagnostics procedure. It is possible that background
// scrub could have found an ECC error before we had a chance to stop
// the command. Therefore, we need to call analyzeCmdComplete() instead
// of startNextTd() so that any ECC errors found can be handled. Also,
// analyzeCmdComplete() will initialize the interrupted rank so that we
// can calculate the 'next good rank'.
CenAddr stopAddr;
o_rc = getCenMaintStartAddr( iv_mbaChip, stopAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getCenMaintStartAddr() failed" );
break;
}
CenAddr endAddr;
o_rc = getCenMaintEndAddr( iv_mbaChip, endAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getCenMaintEndAddr() failed" );
break;
}
o_rc = analyzeCmdComplete( io_sc, stopAddr, endAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"analyzeCmdComplete() failed" );
break;
}
} while(0);
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Failed: i_event=%d i_rank=m%ds%d i_banTps=%c",
i_event, i_rank.getMaster(), i_rank.getSlave(),
i_banTps ? 'T' : 'F' );
badPathErrorHandling( io_sc );
int32_t l_rc = cleanupPrevCmd( io_sc ); // Just in case.
if ( SUCCESS != l_rc )
PRDF_ERR( PRDF_FUNC"cleanupPrevCmd() failed" );
}
else
{
collectStateCaptureDataEnd( io_sc );
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleRrFo()
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleRrFo] "
int32_t o_rc = SUCCESS;
do
{
o_rc = initialize();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"initialize() failed" );
break;
}
// Check for condition which may require to start a maintenance
// command during R/R or F/o.
// We will not start maintenance for any of following conditions
// 1. Maintenance command is already running.
// 2. Maintenance command complete bit is set.
// Check if maintenance command is running currently.
SCAN_COMM_REGISTER_CLASS * mbmsr =
iv_mbaChip->getRegister("MBMSR");
o_rc = mbmsr->Read();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Read() failed on MBMSR");
break;
}
if ( mbmsr->IsBitSet(0) )
break;
// Check if maintenance command complete attention is set.
SCAN_COMM_REGISTER_CLASS * mbaSpa =
iv_mbaChip->getRegister("MBASPA");
o_rc = mbaSpa->Read();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Read() failed on MBASPA");
break;
}
if ( mbaSpa->IsBitSet(0) || mbaSpa->IsBitSet(8) )
break;
// Create a temporary sdc as we do not want to write separate
// version for startBgScrub during R/R and FO
// Also we do not want to save this SDC. So set the "Don't save sdc"
// flag.
ServiceDataCollector serviceData;
STEP_CODE_DATA_STRUCT sdc;
sdc.service_data = &serviceData;
sdc.service_data->SetFlag( ServiceDataCollector::DONT_SAVE_SDC );
o_rc = startNextTd( sdc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"startBgScrub() failed" );
break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
// Private Functions
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::initialize()
{
#define PRDF_FUNC "[CenMbaTdCtlr::initialize] "
int32_t o_rc = SUCCESS;
do
{
if ( iv_initialized ) break; // nothing to do
// Initialize common instance variables
o_rc = CenMbaTdCtlrCommon::initialize();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"CenMbaTdCtlrCommon::initialize() failed" );
break;
}
// Initialize the list of master ranks.
o_rc = iv_masterRanks.initialize( iv_mbaTrgt );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"TdRankList::initialize() failed" );
break;
}
// Unmask the fetch attentions just in case there were masked during a
// TD procedure prior to a reset/reload.
o_rc = unmaskFetchAttns();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"unmaskFetchAttns() failed" );
break;
}
//----------------------------------------------------------------------
// Add any unverified chip marks to the TD queue
//----------------------------------------------------------------------
// Will want to clear the MPE attention for any unverified chip marks.
// This is so we don't get redundant attentions for chip marks that are
// already in the queue. This is reset/reload safe because initialize()
// will be called again and we can redetect the unverified chip marks.
const char * reg_str = (0 == iv_mbaPos) ? "MBA0_MBSECCFIR_AND"
: "MBA1_MBSECCFIR_AND";
SCAN_COMM_REGISTER_CLASS * firand = iv_membChip->getRegister( reg_str );
firand->setAllBits();
// Search all configured ranks for unverfied chip marks.
TdRankList::List rankList = iv_masterRanks.getList();
for ( TdRankList::ListItr it = rankList.begin();
it != rankList.end(); it++ )
{
CenMark markData;
CenRank rank ( it->rank );
// Get mark store from hardware.
o_rc = mssGetMarkStore( iv_mbaTrgt, rank, markData );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssGetMarkStore() failed." );
o_rc = FAIL; break;
}
// Move on to the next rank if there is no chip mark in hardware.
if ( !markData.getCM().isValid() ) continue;
// Check if chip mark also present in VPD.
CenDqBitmap bitmap;
o_rc = getBadDqBitmap( iv_mbaTrgt, rank, bitmap );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getBadDqBitmap() failed" );
break;
}
bool vpdCM;
o_rc = bitmap.isChipMark( markData.getCM(), vpdCM );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"isChipMark() failed" );
break;
}
if ( !vpdCM )
{
// Chip mark is not present in VPD. Add it to queue.
o_rc = addTdQueueEntryVCM( rank );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryVCM() failed" );
break;
}
// Clear MPE bits for this rank.
firand->ClearBit( 0 + rank.getMaster() ); // fetch
firand->ClearBit( 20 + rank.getMaster() ); // scrub
}
}
if ( SUCCESS != o_rc ) break;
if ( !iv_queue.empty() )
{
// Unverified chip marks found so clear the FIR bits.
o_rc = firand->Write();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Write() failed on %s", reg_str );
break;
}
}
//----------------------------------------------------------------------
// At this point, the TD controller is initialized.
//----------------------------------------------------------------------
iv_initialized = true;
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::analyzeCmdComplete( STEP_CODE_DATA_STRUCT & io_sc,
const CenAddr & i_stopAddr,
const CenAddr & i_endAddr )
{
#define PRDF_FUNC "[CenMbaTdCtlr::analyzeCmdComplete] "
int32_t o_rc = SUCCESS;
do
{
if ( NO_OP != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Initialize iv_rank. This must be done before calling other
// functions as they require iv_rank to be accurate.
iv_rank = i_stopAddr.getRank();
// Background scrubbing was interrupted, most likely because of an ECC
// error, so set the interrupted rank in the rank list.
o_rc = iv_masterRanks.setInterruptedRank( iv_rank );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setInterruptedRank() failed" );
break;
}
// Get all reported error conditions.
uint16_t eccErrorMask = NO_ERROR;
o_rc = checkEccErrors( eccErrorMask, io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"checkEccErrors() failed" );
break;
}
// The order of the following checks is important. Each call to handle
// an error will set the PRD signature and override the previous
// signature. We want the highest priority error signature (memory UEs)
// to be displayed so these checks should be ordered from lowest to
// highest priority.
if ( (eccErrorMask & SOFT_CTE) || (eccErrorMask & INTER_CTE) )
{
o_rc = handleSoftIntCeEte_NonTd( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleSoftIntCeEte_NonTd() failed" );
break;
}
}
if ( eccErrorMask & HARD_CTE )
{
o_rc = handleHardCeEte_NonTd( io_sc, i_stopAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleHardCeEte_NonTd() failed" );
break;
}
}
if ( eccErrorMask & RETRY_CTE )
{
o_rc = handleRceEte_NonTd( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleRceEte_NonTd() failed" );
break;
}
}
if ( eccErrorMask & MPE )
{
o_rc = handleMpe_NonTd( io_sc, i_stopAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleMpe_NonTd() failed" );
break;
}
}
if ( eccErrorMask & UE )
{
o_rc = handleUe_NonTd( io_sc, i_stopAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleUe_NonTd() failed" );
break;
}
}
if ( iv_queue.empty() )
{
// No TD requests so resume background. If the scrub reached the end
// address, start background scrubbing on the next good rank.
// Otherwise, resume the current scrub.
if ( i_endAddr == i_stopAddr )
{
if ( (NO_ERROR == eccErrorMask) || (MCE == eccErrorMask) )
{
// The scrub completed without an error (this function
// currently ignores MCEs). Don't commit the error log
// (reduces informational error logs).
io_sc.service_data->DontCommitErrorLog();
}
o_rc = startBgScrub( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"startBgScrub() failed" );
break;
}
}
else
{
// Restart the scrub on the next address.
o_rc = resumeScrub( io_sc, eccErrorMask );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"resumeScrub() failed" );
break;
}
}
}
else
{
// A TD request was added to the queue, start the next TD request.
o_rc = startNextTd( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"startNextTd() failed" );
break;
}
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::analyzeVcmPhase1( STEP_CODE_DATA_STRUCT & io_sc,
const CenAddr & i_stopAddr,
const CenAddr & i_endAddr )
{
#define PRDF_FUNC "[CenMbaTdCtlr::analyzeVcmPhase1] "
int32_t o_rc = SUCCESS;
do
{
if ( VCM_PHASE_1 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Add the mark to the callout list.
CalloutUtil::calloutMark( iv_mbaTrgt, iv_rank, iv_mark, io_sc );
// Check for any ECC errors that occurred during the procedure.
uint16_t eccErrorMask = NO_ERROR;
o_rc = checkEccErrors( eccErrorMask, io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"checkEccErrors() failed" );
break;
}
if ( eccErrorMask & UE )
{
o_rc = handleUe_Td( io_sc, i_stopAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleUe_Td() failed" );
break;
}
// Abort the procedure.
iv_tdState = NO_OP;
break;
}
if ( eccErrorMask & RETRY_CTE )
{
o_rc = handleRceEte_Td( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleRceEte_Td() failed" );
break;
}
}
// If the scrub stopped on the last address of the rank, start the next
// TD procedure. Otherwise, resume background scrubbing. This is needed
// for attentions like retry CTEs where, due to a hardware issue, must
// report the attention immediately and cannot wait for the scrub to get
// to the end of the rank.
if ( i_endAddr == i_stopAddr )
{
// Start VCM Phase 2
o_rc = startVcmPhase2( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"startVcmPhase2() failed" );
break;
}
}
else
{
// Restart the scrub on the next address.
o_rc = resumeScrub( io_sc, eccErrorMask );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"resumeScrub() failed" );
break;
}
}
} while(0);
// If this TD procedure was aborted, execute TD complete sequence.
if ( (iv_tdState == NO_OP) && (SUCCESS == o_rc) )
{
o_rc = handleTdComplete( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleTdComplete() failed" );
}
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::analyzeVcmPhase2( STEP_CODE_DATA_STRUCT & io_sc,
const CenAddr & i_stopAddr,
const CenAddr & i_endAddr )
{
#define PRDF_FUNC "[CenMbaTdCtlr::analyzeVcmPhase2] "
int32_t o_rc = SUCCESS;
do
{
if ( VCM_PHASE_2 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Add the mark to the callout list.
CalloutUtil::calloutMark( iv_mbaTrgt, iv_rank, iv_mark, io_sc );
// Check for any ECC errors that occurred during the procedure.
uint16_t eccErrorMask = NO_ERROR;
o_rc = checkEccErrors( eccErrorMask, io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"checkEccErrors() failed" );
break;
}
if ( eccErrorMask & UE )
{
o_rc = handleUe_Td( io_sc, i_stopAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleUe_Td() failed" );
break;
}
// Abort the procedure.
iv_tdState = NO_OP;
break;
}
if ( eccErrorMask & RETRY_CTE )
{
o_rc = handleRceEte_Td( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleRceEte_Td() failed" );
break;
}
}
if ( eccErrorMask & MCE )
{
// Chip mark is verified.
// Do callouts, VPD updates, and start DRAM sparing, if possible.
o_rc = handleMCE_VCM2( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleMCE_VCM2() failed" );
break;
}
}
else if ( i_endAddr == i_stopAddr )
{
// Chip mark verification failed.
setTdSignature( io_sc, PRDFSIG_VcmFalseAlarm );
// In manufacturing, this error log will be predictive.
if ( areDramRepairsDisabled() )
{
io_sc.service_data->SetServiceCall();
iv_tdState = NO_OP; // Move on to the next TD procedure.
break;
}
// Increment the false alarm count and threshold. if needed.
if ( iv_vcmRankData.incFalseAlarm(iv_rank, io_sc) )
{
io_sc.service_data->AddSignatureList( iv_mbaTrgt,
PRDFSIG_VcmFalseAlarmExceeded );
// Treat the chip mark as verified.
o_rc = handleMCE_VCM2( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleMCE_VCM2() failed" );
}
}
else
{
// Remove chip mark from hardware.
iv_mark.clearCM();
// There is small time window where hardware places a chip mark
// immediately after it is removed, but before the HWP procedure
// can query the FIR registers. In this case, we will simply
// allow the write to be 'blocked' and handle the new chip mark
// in a separate attention.
bool allowWriteBlocked = true;
bool blocked; // Currently ignored.
o_rc = mssSetMarkStore( iv_mbaTrgt, iv_rank, iv_mark, blocked,
allowWriteBlocked );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssSetMarkStore() failed" );
break;
}
iv_tdState = NO_OP; // Move on to the next TD procedure.
}
}
else
{
// Restart the scrub on the next address.
o_rc = resumeScrub( io_sc, eccErrorMask );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"resumeScrub() failed" );
break;
}
}
} while(0);
// If this TD procedure was aborted, execute TD complete sequence.
if ( (iv_tdState == NO_OP) && (SUCCESS == o_rc) )
{
o_rc = handleTdComplete( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleTdComplete() failed" );
}
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::analyzeDsdPhase1( STEP_CODE_DATA_STRUCT & io_sc,
const CenAddr & i_stopAddr,
const CenAddr & i_endAddr )
{
#define PRDF_FUNC "[CenMbaTdCtlr::analyzeDsdPhase1] "
int32_t o_rc = SUCCESS;
do
{
if ( DSD_PHASE_1 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Add the mark to the callout list.
CalloutUtil::calloutMark( iv_mbaTrgt, iv_rank, iv_mark, io_sc );
// Check for any ECC errors that occurred during the procedure.
uint16_t eccErrorMask = NO_ERROR;
o_rc = checkEccErrors( eccErrorMask, io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"checkEccErrors() failed" );
break;
}
if ( eccErrorMask & UE )
{
o_rc = handleUe_Td( io_sc, i_stopAddr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleUe_Td() failed" );
break;
}
// Abort the procedure.
iv_tdState = NO_OP;
break;
}
if ( eccErrorMask & RETRY_CTE )
{
o_rc = handleRceEte_Td( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleRceEte_Td() failed" );
break;
}
}
if ( i_endAddr == i_stopAddr )
{
// At this point, the procedure has not been aborted due to an error
// like a memory UE so consider the spare successful.
setTdSignature( io_sc, PRDFSIG_DsdDramSpared );
// Remove chip mark from hardware.
iv_mark.clearCM();
// There is small time window where hardware places a chip mark
// immediately after it is removed, but before the HWP procedure can
// query the FIR registers. In this case, we will simply allow the
// write to be 'blocked' and handle the new chip mark in a separate
// attention.
bool allowWriteBlocked = true;
bool blocked; // Currently ignored.
o_rc = mssSetMarkStore( iv_mbaTrgt, iv_rank, iv_mark, blocked,
allowWriteBlocked );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssSetMarkStore() failed" );
break;
}
// Always reset the state machine after DSD Phase 1 is complete.
iv_tdState = NO_OP;
}
else
{
// Restart the scrub on the next address.
o_rc = resumeScrub( io_sc, eccErrorMask );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"resumeScrub() failed" );
break;
}
}
} while(0);
// If this TD procedure was completed or aborted, execute TD complete
// sequence.
if ( (iv_tdState == NO_OP) && (SUCCESS == o_rc) )
{
o_rc = handleTdComplete( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleTdComplete() failed" );
}
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::analyzeTpsPhase1( STEP_CODE_DATA_STRUCT & io_sc,
const CenAddr & i_stopAddr,
const CenAddr & i_endAddr )
{
#define PRDF_FUNC "[CenMbaTdCtlr::analyzeTpsPhase1] "
int32_t o_rc = SUCCESS;
do
{
if ( TPS_PHASE_1 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Get the current marks in hardware (initialize iv_mark).
o_rc = mssGetMarkStore( iv_mbaTrgt, iv_rank, iv_mark );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssGetMarkStore() failed." );
break;
}
const bool reachedEndAddr = ( i_stopAddr == i_endAddr );
// Check for any ECC errors that occurred during the procedure.
uint16_t eccErrorMask = NO_ERROR;
o_rc = checkEccErrors( eccErrorMask, io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"checkEccErrors() failed" );
break;
}
// The order of the following checks is important. Each call to handle
// an error will set the PRD signature and override the previous
// signature. We want the highest priority error signature (memory UEs)
// to be displayed so these checks should be ordered from lowest to
// highest priority.
if ( eccErrorMask & MPE )
{
// Only error that will not potentially produce a predictive error,
// so lowest priority.
o_rc = handleMpe_Tps( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleMpe_Tps() failed" );
break;
}
// Abort this procedure and the do the VCM procedure.
iv_tdState = NO_OP;
break;
}
// The hardware thresholds are intentionally set to the max value for
// stop on error conditions in the middle of the scrub. Therefore, we
// must check the per symbol counters for threshold regardless of any
// CTE attentions if the scrub has reached the end of the rank.
// Otherwise, check the per symbol counters only of a CTE attention is
// raised somewhere in the middle of the scrub.
bool ceTypeTh = iv_tpsRankData.checkCeTypeTh(iv_rank);
if ( ( reachedEndAddr ) ||
( !ceTypeTh && (eccErrorMask & HARD_CTE ) ) ||
( ceTypeTh && ((eccErrorMask & SOFT_CTE ) ||
(eccErrorMask & INTER_CTE) ||
(eccErrorMask & HARD_CTE )) ) )
{
o_rc = handleCeEte_Tps( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleCeEte_Tps() failed" );
break;
}
}
if ( eccErrorMask & RETRY_CTE )
{
o_rc = handleRceEte_Td( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleRceEte_Td() failed" );
break;
}
}
if ( eccErrorMask & UE )
{
o_rc = handleUe_Td( io_sc, i_stopAddr, false ); // No TPS request.
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleUe_Td() failed" );
break;
}
}
// If the command had reached the end of the rank, handle any false
// alarm conditions, if needed, and continue on to the next TD
// procedure. Otherwise, resume the scrub starting on the next address.
if ( reachedEndAddr )
{
// Handle false alarm conditions, if needed.
if ( iv_tpsFalseAlarm )
{
o_rc = handleTpsFalseAlarm( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleTpsFalseAlarm() failed" );
break;
}
}
// This procedure is done. Reset the state machine and go onto the
// next TD procedure.
iv_tdState = NO_OP;
break;
}
// Restart the scrub on the next address.
o_rc = resumeScrub( io_sc, eccErrorMask );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"resumeScrub() failed" );
break;
}
} while(0);
// Callout the rank if no other callouts have been made.
if ( 0 == io_sc.service_data->getMruListSize() )
{
MemoryMru memmru( iv_mbaTrgt, iv_rank,
MemoryMruData::CALLOUT_RANK );
io_sc.service_data->SetCallout( memmru );
}
// If this TD procedure was aborted, execute TD complete sequence.
if ( (iv_tdState == NO_OP) && (SUCCESS == o_rc) )
{
o_rc = handleTdComplete( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"handleTdComplete() failed" );
}
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::startVcmPhase1( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::startVcmPhase1] "
int32_t o_rc = SUCCESS;
io_sc.service_data->AddSignatureList( iv_mbaTrgt, PRDFSIG_StartVcmPhase1 );
iv_tdState = VCM_PHASE_1;
do
{
// Starting a new phase of VCM procedure. Reset the scrub resume counter
iv_scrubResumeCounter.reset();
// Get the current marks in hardware (initialize iv_mark).
o_rc = mssGetMarkStore( iv_mbaTrgt, iv_rank, iv_mark );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssGetMarkStore() failed");
break;
}
o_rc = prepareNextCmd( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"prepareNextCmd() failed" );
break;
}
// Start phase 1.
o_rc = doTdScrubCmd( COND_RT_VCM_DSD );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"doTdScrubCmd() failed" );
break;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::startVcmPhase2( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::startVcmPhase2] "
int32_t o_rc = SUCCESS;
io_sc.service_data->AddSignatureList( iv_mbaTrgt, PRDFSIG_StartVcmPhase2 );
iv_tdState = VCM_PHASE_2;
do
{
// Starting a new phase of VCM procedure. Reset the scrub resume counter
iv_scrubResumeCounter.reset();
o_rc = prepareNextCmd( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"prepareNextCmd() failed" );
break;
}
// Start phase 2.
o_rc = doTdScrubCmd( COND_RT_VCM_DSD | mss_MaintCmd::STOP_ON_MCE );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"doTdScrubCmd() failed" );
break;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::startDsdPhase1( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::startDsdPhase1] "
int32_t o_rc = SUCCESS;
io_sc.service_data->AddSignatureList( iv_mbaTrgt, PRDFSIG_StartDsdPhase1 );
iv_tdState = DSD_PHASE_1;
do
{
// Starting a new DSD procedure. Reset the scrub resume counter.
iv_scrubResumeCounter.reset();
o_rc = prepareNextCmd( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"prepareNextCmd() failed" );
break;
}
// Set the steer mux
o_rc = mssSetSteerMux( iv_mbaTrgt, iv_rank, iv_mark.getCM(),
iv_isEccSteer );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssSetSteerMux() failed" );
break;
}
// Start phase 1.
o_rc = doTdScrubCmd( COND_RT_VCM_DSD );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"doTdScrubCmd() failed" );
break;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::startTpsPhase1( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::startTpsPhase1] "
int32_t o_rc = SUCCESS;
io_sc.service_data->AddSignatureList( iv_mbaTrgt, PRDFSIG_StartTpsPhase1 );
iv_tdState = TPS_PHASE_1;
do
{
// Initially true, until hardware error is found.
iv_tpsFalseAlarm = true;
// Starting a new TPS procedure. Reset the scrub resume counter.
iv_scrubResumeCounter.reset();
o_rc = prepareNextCmd( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"prepareNextCmd() failed" );
break;
}
// Set CE thresholds.
o_rc = setTpsThresholds();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setTpsThresholds() failed" );
break;
}
// Set stop conditions based on CE count type.
uint32_t stopCond = COND_RT_TPS_HARD_CE;
if ( iv_tpsRankData.checkCeTypeTh(iv_rank) )
{
stopCond = COND_RT_TPS_ALL_CE;
}
// Start TPS phase 1.
o_rc = doTdScrubCmd( stopCond, mss_MaintCmdWrapper::SLAVE_RANK_ONLY );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"doTdScrubCmd() failed" );
break;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::startBgScrub( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::startBgScrub] "
int32_t o_rc = SUCCESS;
iv_tdState = NO_OP;
do
{
// Starting a scrub on a new rank. Reset the scrub resume counter.
iv_scrubResumeCounter.reset();
// Cleanup hardware before starting the maintenance command. This will
// clear the ECC counters, which must be done before setting the ETE
// thresholds.
o_rc = prepareNextCmd( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"prepareNextCmd() failed" );
break;
}
// Set the default thresholds for all ETE attentions.
o_rc = setRtEteThresholds();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setRtEteThresholds() failed" );
break;
}
// Unmask the fetch attentions that were explicitly masked during the
// TD procedure.
o_rc = unmaskFetchAttns();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"unmaskFetchAttns() failed" );
break;
}
// Background scrubbing will need to start from the first address of the
// next good rank. The current design is to not stop on the end address
// and let background scrubbing run continuously. Technically, this
// means we do not need to specify the end address for the maintenance
// command, however, I think we should still input the last address of
// the last rank behind the MBA as the end address just in case we need
// to flip the switch and stop on the end address (for hardware
// workarounds and such). Also, assume since we are resuming background
// scrubbing all entries in iv_masterRanks are good, for now.
TdRankList::Entry entry = iv_masterRanks.findNextGoodRank();
if ( iv_rank == entry.rank )
{
// It is possible that the next good rank is the rank that was just
// targeted for diagnostics. If so, we want to try to start
// scrubbing on the rank after this just in case the this rank has
// a lot of errors. This is not a perfect system because it is
// possible that were two TD procedures recently done in a four rank
// system and it just so happens that the next good rank is one of
// the recently targeted ranks. However, scrub will eventually get
// to all of the rank so this is a limitation we can to live with
// because it isn't worth the extra code.
entry = iv_masterRanks.findNextGoodRank();
}
// It is important to initialize iv_rank here so that possible back to
// back maintenance command complete attentions do not accidentally
// cause a rank to get skipped due to the next good rank check above.
iv_rank = entry.rank;
// Start background scrub.
o_rc = doBgScrubCmd( COND_BG_SCRUB );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"doBgScrubCmd() failed" );
break;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::startNextTd( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::startNextTd] "
int32_t o_rc = SUCCESS;
do
{
if ( iv_queue.empty() )
{
// No pending requests, so start backgound scrubbing.
o_rc = startBgScrub( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"startBgScrub() failed" );
break;
}
}
else
{
// Start the next TD procedure.
TdQueueEntry entry = iv_queue.getNextEntry();
iv_rank = CenRank( entry.rank );
switch ( entry.type )
{
case VCM_EVENT: o_rc = startVcmPhase1( io_sc ); break;
case TPS_EVENT: o_rc = startTpsPhase1( io_sc ); break;
default: o_rc = FAIL;
}
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"failed to start procedure for event %d",
entry.type );
break;
}
// Mask fetch attentions during TD procedures. startNextTd is called
// from many places. Mask attention here rather in caller function.
// Though now maskFetchAttns will be called multiple times for back
// to back TD requests but its minor issue as TD procedure takes
// atleast 5 hours. Also it will save us from potential bugs
// if we miss at any place.
o_rc = maskFetchAttns();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"maskFetchAttns() failed" );
break;
}
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::resumeScrub( STEP_CODE_DATA_STRUCT & io_sc,
uint32_t i_eccErrorMask )
{
#define PRDF_FUNC "[CenMbaTdCtlr::resumeScrub] "
int32_t o_rc = SUCCESS;
do
{
if ( (NO_OP != iv_tdState) &&
(VCM_PHASE_1 != iv_tdState) && (VCM_PHASE_2 != iv_tdState) &&
(DSD_PHASE_1 != iv_tdState) && (TPS_PHASE_1 != iv_tdState) )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Manually clear the CE counters based on the error type.
o_rc = clearCeCounters( i_eccErrorMask );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"clearCeCounters() failed" );
break;
}
// Do not clear the CE counters. The target counters have been manually
// cleared based on error type.
o_rc = prepareNextCmd( io_sc, false );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"prepareNextCmd() failed" );
break;
}
// Increment the start address.
iv_mssCmd = createIncAddrMssCmd( iv_mbaTrgt );
if ( NULL == iv_mssCmd )
{
PRDF_ERR( PRDF_FUNC"createIncAddrMssCmd returned NULL" );
o_rc = FAIL; break;
}
o_rc = iv_mssCmd->setupAndExecuteCmd();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setupAndExecuteCmd() failed" );
break;
}
// Get the new start address.
CenAddr addr;
o_rc = getCenMaintStartAddr( iv_mbaChip, addr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getCenMaintStartAddr() failed" );
break;
}
// Again, do not clear the CE counters.
o_rc = prepareNextCmd( io_sc, false );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"prepareNextCmd() failed" );
break;
}
// Set the control flags and stop conditions based on the procedure
// type. The defaults will be for background scrubbing where we want to
// stop at the end of the rank.
uint32_t flags = mss_MaintCmdWrapper::NO_FLAGS;
uint32_t stopCond = COND_BG_SCRUB | mss_MaintCmd::STOP_ON_END_ADDRESS;
if ( TPS_PHASE_1 == iv_tdState )
{
flags = mss_MaintCmdWrapper::SLAVE_RANK_ONLY;
// Set stop conditions based on CE count type.
stopCond = COND_RT_TPS_HARD_CE;
if ( iv_tpsRankData.checkCeTypeTh(iv_rank) )
{
stopCond = COND_RT_TPS_ALL_CE;
}
}
else if ( (VCM_PHASE_1 == iv_tdState) || (DSD_PHASE_1 == iv_tdState) )
{
stopCond = COND_RT_VCM_DSD;
}
else if ( VCM_PHASE_2 == iv_tdState )
{
stopCond = COND_RT_VCM_DSD | mss_MaintCmd::STOP_ON_MCE;
}
// If the command had been resumed 16 times on this rank, clear the stop
// on error flags (everything except MPE) and continue on to the end of
// the rank. This is needed so that the scrub can complete without
// getting flooded with attentions.
if ( iv_scrubResumeCounter.isTh() )
{
stopCond &= ~mss_MaintCmd::STOP_ON_HARD_NCE_ETE;
stopCond &= ~mss_MaintCmd::STOP_ON_INT_NCE_ETE;
stopCond &= ~mss_MaintCmd::STOP_ON_SOFT_NCE_ETE;
stopCond &= ~mss_MaintCmd::STOP_ON_RETRY_CE_ETE;
stopCond &= ~mss_MaintCmd::STOP_ON_UE;
}
if ( NO_OP == iv_tdState )
{
// Resume background scrub.
o_rc = doBgScrubCmd( stopCond, flags, &addr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"doBgScrubCmd() failed" );
break;
}
}
else
{
// Resume the TD procedure.
o_rc = doTdScrubCmd( stopCond, flags, &addr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"doTdScrubCmd() failed" );
break;
}
}
// The resume was successful. Increment the resume counter.
iv_scrubResumeCounter.incCount();
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleTdComplete( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleTdComplete] "
int32_t o_rc = SUCCESS;
do
{
// A TD procedure has completed. Deactivate all entries in the CE table
// for the rank that was just targeted. This must be done before finding
// the next good rank so that iv_rank will contain the rank that was
// just targeted. Also remove the entry from RCE table.
CenMbaDataBundle * mbadb = getMbaDataBundle( iv_mbaChip );
mbadb->iv_ceTable.deactivateRank( iv_rank );
mbadb->iv_rceTable.flushEntry( iv_rank );
// Clear out the mark, just in case. This is so we don't accidentally
// callout this mark on another rank in an error path scenario.
iv_mark = CenMark();
// Remove TD request from the queue.
o_rc = removeTdQueueEntry();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"removeTdQueueEntry() failed" );
break;
}
// Move on to the next TD procedure or restart background scrubbing.
o_rc = startNextTd( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"startNextTd() failed" );
break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::addTdQueueEntryVCM( const CenRank & i_rank )
{
#define PRDF_FUNC "[CenMbaTdCtlr::addTdQueueEntryVCM] "
int32_t o_rc = SUCCESS;
do
{
// Verify a chip mark exists in hardware for this rank.
CenMark mark;
o_rc = mssGetMarkStore( iv_mbaTrgt, i_rank, mark );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssGetMarkStore() failed");
break;
}
if ( !mark.getCM().isValid() )
{
PRDF_ERR( PRDF_FUNC"VCM event but no valid chip mark" );
o_rc = FAIL; break;
}
// Push the TD request to the queue.
iv_queue.push( TdQueueEntry(VCM_EVENT, i_rank) );
// Mark this rank as bad.
o_rc = iv_masterRanks.setBad( i_rank );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setBad() failed" );
break;
}
} while(0);
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Failed: i_rank=m%ds%d",
i_rank.getMaster(), i_rank.getSlave() );
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::addTdQueueEntryTPS( const CenRank & i_rank,
STEP_CODE_DATA_STRUCT & io_sc,
bool i_banTps )
{
#define PRDF_FUNC "[CenMbaTdCtlr::addTdQueueEntryTPS] "
int32_t o_rc = SUCCESS;
do
{
if ( iv_tpsRankData.isBanned(i_rank, io_sc) )
{
// TPS is banned, do not add the request to the queue.
break;
}
// Check for any available repairs. There is no point doing TPS if we
// cannot apply a repair.
CenMark mark;
o_rc = mssGetMarkStore( iv_mbaTrgt, i_rank, mark );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssGetMarkStore() failed." );
break;
}
if ( mark.getCM().isValid() &&
(iv_x4Dimm || (!iv_x4Dimm && mark.getSM().isValid())) )
{
bool port0Available, port1Available;
o_rc = checkForAvailableSpares( 0, port0Available );
o_rc |= checkForAvailableSpares( 1, port1Available );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"checkForAvailableSpares() failed." );
break;
}
if ( !port0Available && !port1Available )
{
// Ban TPS to avoid rechecking with subsequent TPS requests.
iv_tpsRankData.ban( iv_rank );
// TPS is banned, do not add the request to the queue.
break;
}
}
if ( i_banTps )
{
// Ban all future TPS requests for this rank (not including
// this one).
iv_tpsRankData.ban( i_rank );
}
// Push the TD request to the queue.
iv_queue.push( TdQueueEntry(TPS_EVENT, i_rank) );
// Mark this rank as bad.
o_rc = iv_masterRanks.setBad( i_rank );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setBad() failed" );
break;
}
} while(0);
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Failed: i_rank=m%ds%d i_banTps=%c",
i_rank.getMaster(), i_rank.getSlave(),
i_banTps ? 'T' : 'F' );
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::removeTdQueueEntry()
{
#define PRDF_FUNC "[CenMbaTdCtlr::removeTdQueueEntry] "
int32_t o_rc = SUCCESS;
iv_queue.pop();
// If there are no more references to iv_rank in the TD queue, set the rank
// as 'good'.
if ( !iv_queue.exists(iv_rank) )
{
o_rc = iv_masterRanks.setGood( iv_rank );
if ( SUCCESS != o_rc )
PRDF_ERR( PRDF_FUNC"setGood() failed" );
}
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::cleanupPrevCmd( STEP_CODE_DATA_STRUCT & io_sc )
{
#ifndef __HOSTBOOT_RUNTIME
ForceSyncAnalysis(*io_sc.service_data);
#endif
return CenMbaTdCtlrCommon::cleanupPrevCmd();
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::prepareNextCmd( STEP_CODE_DATA_STRUCT & io_sc,
bool i_clearStats )
{
#ifndef __HOSTBOOT_RUNTIME
ForceSyncAnalysis(*io_sc.service_data);
#endif
return CenMbaTdCtlrCommon::prepareNextCmd( i_clearStats );
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleUe_Td( STEP_CODE_DATA_STRUCT & io_sc,
const CenAddr & i_stopAddr,
bool i_addTpsRequest )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleUe_Td] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_MaintUE );
// Clear TPS false alarm flag.
iv_tpsFalseAlarm = false;
// Callout the rank
MemoryMru memmru ( iv_mbaTrgt, iv_rank, MemoryMruData::CALLOUT_RANK );
io_sc.service_data->SetCallout( memmru );
// Make error log predictive
io_sc.service_data->SetServiceCall();
do
{
// Add entry to UE table. Note that it is possible that there was a
// resume threshold during TPS, which means that the stop-on-UE
// condition was cleared and the scrub was forced to go to the end of
// the rank. In this case, we cannot be certain which address the UE had
// occurred on, so do not add the address to the UE table.
if ( (TPS_PHASE_1 != iv_tdState) || !iv_scrubResumeCounter.isTh() )
{
CenMbaDataBundle * mbadb = getMbaDataBundle( iv_mbaChip );
mbadb->iv_ueTable.addEntry( UE_TABLE::SCRUB_UE, i_stopAddr );
// Send lmb gard message to PHYP.
o_rc = DEALLOC::lmbGard( iv_mbaChip, i_stopAddr, false );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"lmbGard() failed" );
break;
}
}
if ( i_addTpsRequest )
{
// Add a TPS request to the queue and ban any future TPS requests.
o_rc = addTdQueueEntryTPS( i_stopAddr.getRank(), io_sc, true );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryTPS() failed" );
break;
}
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleRceEte_Td( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleRceEte_Td] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_MaintRETRY_CTE );
// Clear TPS false alarm flag.
iv_tpsFalseAlarm = false;
// Callout the rank
MemoryMru memmru ( iv_mbaTrgt, iv_rank, MemoryMruData::CALLOUT_RANK );
io_sc.service_data->SetCallout( memmru );
// Make error log predictive
io_sc.service_data->SetServiceCall();
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleMpe_Tps( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleMpe_Tps] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_MaintMPE );
// Clear TPS false alarm flag.
iv_tpsFalseAlarm = false;
do
{
// Callout the mark.
CalloutUtil::calloutMark( iv_mbaTrgt, iv_rank, iv_mark, io_sc );
// Add a VCM request to the queue.
o_rc = addTdQueueEntryVCM( iv_rank );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryVCM() failed" );
break;
}
// Clear the scrub attention. This is needed later if we need to write
// markstore for a symbol mark.
const char * fir_str = (0 == iv_mbaPos) ? "MBA0_MBSECCFIR_AND"
: "MBA1_MBSECCFIR_AND";
SCAN_COMM_REGISTER_CLASS * fir = iv_membChip->getRegister( fir_str );
fir->ClearBit( 20 + iv_rank.getMaster() ); // scrub
o_rc = fir->Write();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Write() failed on %s", fir_str );
break;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleCeEte_Tps( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleCeEte_Tps] "
int32_t o_rc = SUCCESS;
do
{
if ( TPS_PHASE_1 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Get the current threshold.
uint16_t thr = 0;
o_rc = getTpsCeThr( thr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getTpsCeThr() failed." );
break;
}
// Get all symbols that have a count greater than or equal to the target
// threshold.
MaintSymbols symData; CenSymbol targetCM;
o_rc = collectCeStats( iv_mbaChip, iv_rank, symData, targetCM, thr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"collectCeStats() failed." );
break;
}
// Check for false alarms.
if ( symData.empty() ) break; // nothing else to do
// There is valid data so clear the false alarm flag.
iv_tpsFalseAlarm = false;
// Callout all DIMMS with symbol count that reached threshold.
CalloutUtil::calloutSymbolData( iv_mbaTrgt, iv_rank, symData, io_sc );
// Check if DRAM repairs are disabled.
if ( areDramRepairsDisabled() )
{
io_sc.service_data->SetServiceCall();
break; // nothing else to do
}
// Add all symbols to the VPD.
CenDqBitmap bitmap;
o_rc = getBadDqBitmap( iv_mbaTrgt, iv_rank, bitmap );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getBadDqBitmap() failed" );
break;
}
for ( MaintSymbols::iterator it = symData.begin();
it != symData.end(); it++ )
{
bitmap.setSymbol( it->symbol );
}
o_rc = setBadDqBitmap( iv_mbaTrgt, iv_rank, bitmap );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setBadDqBitmap() failed" );
break;
}
// Check if the chip mark is available.
bool cmPlaced = false;
if ( !iv_mark.getCM().isValid() )
{
if ( targetCM.isValid() )
{
// Use the DRAM with the highest total count.
iv_mark.setCM( targetCM );
o_rc = tpsChipMark( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"tpsChipMark() failed." );
break;
}
cmPlaced = true;
}
// If the symbol mark has been used then use the chip mark.
else if ( !iv_x4Dimm && iv_mark.getSM().isValid() )
{
for ( MaintSymbols::iterator it = symData.end();
it-- != symData.begin(); )
{
if ( !(it->symbol == iv_mark.getSM()) )
{
iv_mark.setCM( it->symbol );
o_rc = tpsChipMark( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"tpsChipMark() failed." );
break;
}
cmPlaced = true;
break;
}
}
if ( SUCCESS != o_rc ) break;
}
}
// Check if the symbol mark is available. Note that symbol marks are not
// available in x4 mode. Also, we only want to place a symbol mark if we
// did not just place a chip mark above. The reason for this is because
// having a chip mark and symbol mark at the same time increases the
// chance of UEs. We will want to wait until the chip mark we placed
// above is verified< and possibily steered, before placing the symbol
// mark.
if ( !cmPlaced && !iv_x4Dimm && !iv_mark.getSM().isValid() )
{
// Use the symbol with the highest count.
iv_mark.setSM( symData.back().symbol );
o_rc = tpsSymbolMark( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"tpsSymbolMark() failed." );
break;
}
}
// We know with a degree of confidence that any chip mark placed in this
// function will be verified. Therefore, we can do a early check here
// and make a predictive callout if the chip mark and all available
// spares have been used. This is useful because the targeted
// diagnostics procedure will take much longer to complete due to a
// hardware issue. By making the predictive callout now, we will send a
// Dynamic Memory Deallocation message to PHYP sooner so that they can
// attempt to get off the memory instead of waiting for the callout
// after the VCM procedure.
if ( iv_mark.getCM().isValid() )
{
bool available;
o_rc = checkForAvailableSpares( iv_mark.getCM().getPortSlct(),
available );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"checkForAvailableSpares() failed" );
break;
}
if ( !available )
{
// Spares have been used. Make the error log predictive.
setTdSignature( io_sc, PRDFSIG_TpsCmAndSpare );
io_sc.service_data->SetServiceCall();
}
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleUe_NonTd( STEP_CODE_DATA_STRUCT & io_sc,
const CenAddr & i_addr )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleUe_NonTd] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_MaintUE );
do
{
// Add entry to UE table.
CenMbaDataBundle * mbadb = getMbaDataBundle( iv_mbaChip );
mbadb->iv_ueTable.addEntry( UE_TABLE::SCRUB_UE, i_addr );
// Callout the rank.
MemoryMru memmru ( iv_mbaTrgt, iv_rank, MemoryMruData::CALLOUT_RANK );
io_sc.service_data->SetCallout( memmru );
io_sc.service_data->SetServiceCall();
// Add a TPS request to the queue and ban any future TPS requests.
o_rc = addTdQueueEntryTPS( iv_rank, io_sc, true );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryTPS() failed" );
break;
}
// Send lmb gard message to PHYP.
o_rc = DEALLOC::lmbGard( iv_mbaChip, i_addr, false );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"lmbGard() failed" );
break;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleMpe_NonTd( STEP_CODE_DATA_STRUCT & io_sc,
const CenAddr & i_addr )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleMpe_NonTd] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_MaintMPE );
do
{
// Add entry to UE table.
CenMbaDataBundle * mbadb = getMbaDataBundle( iv_mbaChip );
mbadb->iv_ueTable.addEntry( UE_TABLE::SCRUB_MPE, i_addr );
// Add a VCM request to the queue.
o_rc = addTdQueueEntryVCM( iv_rank );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryVCM() failed" );
break;
}
// Get the current mark in hardware.
CenMark mark;
o_rc = mssGetMarkStore( iv_mbaTrgt, iv_rank, mark );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssGetMarkStore() failed");
break;
}
// Callout the mark.
CalloutUtil::calloutMark( iv_mbaTrgt, iv_rank, mark, io_sc );
} while( 0 );
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleRceEte_NonTd( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleRceEte_NonTd] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_MaintRETRY_CTE );
do
{
MemoryMru memmru ( iv_mbaTrgt, iv_rank, MemoryMruData::CALLOUT_RANK );
io_sc.service_data->SetCallout( memmru );
bool doTps = true;
if ( mfgMode() )
{
// Get RCE count.
const char * reg_str = (0 == iv_mbaPos) ? "MBA0_MBSEC1"
: "MBA1_MBSEC1";
SCAN_COMM_REGISTER_CLASS * mbsec1
= iv_membChip->getRegister( reg_str );
o_rc = mbsec1->Read();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Read() failed on %s", reg_str );
break;
}
uint16_t count = mbsec1->GetBitFieldJustified( 0, 12 );
// Add count to RCE table
CenMbaDataBundle * mbadb = getMbaDataBundle( iv_mbaChip );
doTps = mbadb->iv_rceTable.addEntry( iv_rank, io_sc, count );
}
else
io_sc.service_data->SetServiceCall();
if ( doTps )
{
o_rc = addTdQueueEntryTPS( iv_rank, io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryTPS() failed" );
break;
}
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleHardCeEte_NonTd( STEP_CODE_DATA_STRUCT & io_sc,
const CenAddr & i_addr )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleHardCeEte_NonTd] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_MaintHARD_CTE );
do
{
// Send page deallocation message to PHYP
o_rc = DEALLOC::pageGard( iv_mbaChip, i_addr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"pageGard() failed" );
break;
}
// Get the failing symbol. Note that the hard CE threshold is 1 so there
// should only be one symbol with a non-zero per symbol count.
MaintSymbols symData; CenSymbol junk;
o_rc = collectCeStats( iv_mbaChip, iv_rank, symData, junk );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"collectCeStats() failed." );
break;
}
if ( 1 != symData.size() )
{
PRDF_ERR( PRDF_FUNC"collectCeStats() return size %d, but was "
"expecting size 1", symData.size() );
o_rc = FAIL;
break;
}
CenSymbol symbol = symData[0].symbol;
// Callout the symbol.
MemoryMru memmru ( iv_mbaTrgt, iv_rank, symbol );
io_sc.service_data->SetCallout( memmru );
// Add entry to CE table and add a TPS request to the queue, if needed.
CenMbaDataBundle * mbadb = getMbaDataBundle( iv_mbaChip );
if ( mbadb->iv_ceTable.addEntry(i_addr, symbol, true) )
{
o_rc = addTdQueueEntryTPS( iv_rank, io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryTPS() failed" );
break;
}
}
// Any hard CEs in MNFG should be immediately reported.
if ( mfgMode() )
io_sc.service_data->SetServiceCall();
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleSoftIntCeEte_NonTd( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleSoftIntCeEte_NonTd] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_MaintNCE_CTE );
do
{
// Callout the rank. Note that the per CE counters only capture hard CEs
// so it is not possible to isolate any further than a rank.
MemoryMru memmru ( iv_mbaTrgt, iv_rank, MemoryMruData::CALLOUT_RANK );
io_sc.service_data->SetCallout( memmru );
// Add a TPS request to the queue.
o_rc = addTdQueueEntryTPS( iv_rank, io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryTPS() failed" );
break;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::handleTpsFalseAlarm( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::handleTpsFalseAlarm] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_TpsFalseAlarm );
do
{
if ( TPS_PHASE_1 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Callout all DIMMs with any non-zero counts.
MaintSymbols symData; CenSymbol junk;
o_rc = collectCeStats( iv_mbaChip, iv_rank, symData, junk );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"collectCeStats() failed." );
break;
}
if ( symData.empty() )
{
// There is no data so callout the rank.
MemoryMru memmru (iv_mbaTrgt, iv_rank, MemoryMruData::CALLOUT_RANK);
io_sc.service_data->SetCallout( memmru );
}
else
{
CalloutUtil::calloutSymbolData(iv_mbaTrgt, iv_rank, symData, io_sc);
}
// In manufacturing, this error log will be predictive.
if ( areDramRepairsDisabled() )
{
io_sc.service_data->SetServiceCall();
break; // nothing else to do
}
// Increase the false alarm counter. Continue only if false alarm
// threshold is exceeded.
if ( !iv_tpsRankData.incFalseAlarm(iv_rank, io_sc) ) break;
setTdSignature( io_sc, PRDFSIG_TpsFalseAlarmExceeded );
// If there are no symbols in the list, exit quietly.
if ( symData.empty() ) break;
// Use the symbol with the highest count to place a symbol or chip mark,
// if possible. Note that we only want to use one repair for this false
// alarm to avoid using up all the repairs for 'weak' errors.
CenSymbol highestSymbol = symData.back().symbol;
// Check if the symbol mark is available. Note that symbol marks are not
// available in x4 mode.
if ( !iv_x4Dimm && !iv_mark.getSM().isValid() )
{
iv_mark.setSM( highestSymbol );
o_rc = tpsSymbolMark( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"tpsSymbolMark() failed." );
break;
}
// Add this symbol to the VPD.
CenDqBitmap bitmap;
o_rc = getBadDqBitmap( iv_mbaTrgt, iv_rank, bitmap );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getBadDqBitmap() failed" );
break;
}
bitmap.setSymbol( highestSymbol );
o_rc = setBadDqBitmap( iv_mbaTrgt, iv_rank, bitmap );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setBadDqBitmap() failed" );
break;
}
}
// Check if the chip mark is available.
else if ( !iv_mark.getCM().isValid() )
{
iv_mark.setCM( highestSymbol );
o_rc = tpsChipMark( io_sc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"tpsChipMark() failed" );
break;
}
}
else
{
// The spares have been used. Make the error log predictive.
setTdSignature( io_sc, PRDFSIG_TpsMarksUnavail );
io_sc.service_data->SetServiceCall();
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::getTpsCeThr( uint16_t & o_thr )
{
#define PRDF_FUNC "[CenMbaTdCtlr::getTpsCeThr] "
int32_t o_rc = SUCCESS;
do
{
if ( TPS_PHASE_1 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL;
break;
}
if ( !iv_tpsRankData.checkCeTypeTh(iv_rank) )
{
o_thr = mfgMode() ? 1 : 48;
}
else
{
o_rc = getScrubCeThreshold( iv_mbaChip, iv_rank, o_thr );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getScrubCeThreshold() failed." );
break;
}
}
} while( 0 );
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::setTpsThresholds()
{
#define PRDF_FUNC "[CenMbaTdCtlr::setTpsThresholds] "
int32_t o_rc = SUCCESS;
do
{
if ( TPS_PHASE_1 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL;
break;
}
const char * reg_str = (0 == iv_mbaPos) ? "MBA0_MBSTR" : "MBA1_MBSTR";
SCAN_COMM_REGISTER_CLASS * mbstr = iv_membChip->getRegister( reg_str );
// MBSTR's content could be modified by cleanupCmd() so refresh cache.
o_rc = mbstr->ForceRead();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"ForceRead() failed on %s", reg_str );
break;
}
// Set all CE thresholds to the maximum value. The reason for this is if
// there are a lot of CEs we can stop the TPS scrub and place any marks,
// if needed. This will save time since the TPS scrub could take several
// hours. The threshold is set to the max value so that we can get
// enough data to place a mark.
mbstr->SetBitFieldJustified( 4, 12, 0xfff );
mbstr->SetBitFieldJustified( 16, 12, 0xfff );
mbstr->SetBitFieldJustified( 28, 12, 0xfff );
if ( !iv_tpsRankData.checkCeTypeTh(iv_rank) )
{
// Set the per symbol counters to count only hard CEs.
mbstr->SetBitFieldJustified( 55, 3, 0x1 );
}
else
{
// Set the per symbol counters to count all CE typs.
mbstr->SetBitFieldJustified( 55, 3, 0x7 );
}
o_rc = mbstr->Write();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Write() failed on %s", reg_str );
break;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::tpsChipMark( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::tpsChipMark] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_TpsChipMark );
do
{
if ( TPS_PHASE_1 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Write the chip mark to markstore.
bool allowWriteBlocked = true;
bool blocked;
o_rc = mssSetMarkStore( iv_mbaTrgt, iv_rank, iv_mark, blocked,
allowWriteBlocked );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssSetMarkStore() failed" );
break;
}
if ( blocked )
{
// Continue on with the rest of the TPS procedure as if nothing
// failed. We will find the new chip mark on a subsequent attention.
// The chances are that hardware had placed a chip mark on the same
// DRAM that we tried to write, so for now, ignore these failing
// symbols.
}
else
{
// Add a VCM request to the queue.
o_rc = addTdQueueEntryVCM( iv_rank );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryVCM() failed" );
break;
}
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::tpsSymbolMark( STEP_CODE_DATA_STRUCT & io_sc )
{
#define PRDF_FUNC "[CenMbaTdCtlr::tpsSymbolMark] "
int32_t o_rc = SUCCESS;
setTdSignature( io_sc, PRDFSIG_TpsSymbolMark );
do
{
if ( TPS_PHASE_1 != iv_tdState )
{
PRDF_ERR( PRDF_FUNC"Invalid state machine configuration" );
o_rc = FAIL; break;
}
// Write the symbol mark to markstore.
bool allowWriteBlocked = true;
bool blocked = false;
o_rc = mssSetMarkStore( iv_mbaTrgt, iv_rank, iv_mark, blocked,
allowWriteBlocked );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssSetMarkStore() failed." );
o_rc = FAIL; break;
}
if ( !blocked ) break; // Write was successful, no need to continue.
// Hardware placed a new chip mark. Add a VCM request to the queue.
o_rc = addTdQueueEntryVCM( iv_rank );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"addTdQueueEntryVCM() failed" );
break;
}
// Clear the fetch attention before attempting the rewrite.
const char * reg_str = (0 == iv_mbaPos) ? "MBA0_MBSECCFIR_AND"
: "MBA1_MBSECCFIR_AND";
SCAN_COMM_REGISTER_CLASS * firand = iv_membChip->getRegister( reg_str );
firand->setAllBits();
firand->ClearBit( 0 + iv_rank.getMaster() ); // fetch
o_rc = firand->Write();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Write() failed on %s", reg_str );
break;
}
// Rewrite markstore. Do not allow this write to be blocked. If it is
// blocked there is a code bug. Note that iv_mark was updated with the
// hardware placed chip mark in the previous call to mssSetMarkStore().
o_rc = mssSetMarkStore( iv_mbaTrgt, iv_rank, iv_mark, blocked );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssSetMarkStore() failed on retry." );
break;
}
} while( 0 );
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::maskFetchAttns()
{
#define PRDF_FUNC "[CenMbaTdCtlr::maskFetchAttns] "
int32_t o_rc = SUCCESS;
do
{
// Don't want to handle memory CEs during any TD procedures, so
// mask them.
const char * reg_str = (0 == iv_mbaPos) ? "MBA0_MBSECCFIR_MASK_OR"
: "MBA1_MBSECCFIR_MASK_OR";
SCAN_COMM_REGISTER_CLASS * reg = iv_membChip->getRegister(reg_str);
reg->clearAllBits();
reg->SetBit(16); // fetch NCE
reg->SetBit(17); // fetch RCE
reg->SetBit(43); // prefetch UE
o_rc = reg->Write();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Write() failed on %s", reg_str );
break;
}
iv_fetchAttnsMasked = true;
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::unmaskFetchAttns()
{
#define PRDF_FUNC "[CenMbaTdCtlr::unmaskFetchAttns] "
int32_t o_rc = SUCCESS;
do
{
// Memory CEs where masked at the beginning of the TD procedure, so
// clear and unmask them. Also, it is possible that memory UEs have
// thresholded so clear and unmask them as well.
const char * fir_str = (0 == iv_mbaPos) ? "MBA0_MBSECCFIR_AND"
: "MBA1_MBSECCFIR_AND";
const char * msk_str = (0 == iv_mbaPos) ? "MBA0_MBSECCFIR_MASK_AND"
: "MBA1_MBSECCFIR_MASK_AND";
SCAN_COMM_REGISTER_CLASS * fir = iv_membChip->getRegister( fir_str );
SCAN_COMM_REGISTER_CLASS * msk = iv_membChip->getRegister( msk_str );
fir->setAllBits(); msk->setAllBits();
fir->ClearBit(16); msk->ClearBit(16); // fetch NCE
fir->ClearBit(17); msk->ClearBit(17); // fetch RCE
fir->ClearBit(19); msk->ClearBit(19); // fetch UE
fir->ClearBit(43); msk->ClearBit(43); // prefetch UE
o_rc = fir->Write();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Write() failed on %s", fir_str );
break;
}
o_rc = msk->Write();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Write() failed on %s", msk_str );
break;
}
iv_fetchAttnsMasked = false;
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::clearCeCounters( uint32_t i_eccErrorMask )
{
#define PRDF_FUNC "[CenMbaTdCtlr::clearCeCounters] "
int32_t o_rc = SUCCESS;
do
{
const char * ec0Reg_str =
(0 == iv_mbaPos) ? "MBA0_MBSEC0" : "MBA1_MBSEC0";
SCAN_COMM_REGISTER_CLASS * ec0Reg =
iv_membChip->getRegister( ec0Reg_str );
bool updateEc0 = false;
o_rc = ec0Reg->Read();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Read() failed on %s", ec0Reg_str );
break;
}
if ( i_eccErrorMask & SOFT_CTE )
{
// Clear Soft CE total count.
ec0Reg->SetBitFieldJustified( 0, 12, 0 );
updateEc0 = true;
}
if ( i_eccErrorMask & INTER_CTE )
{
// Clear Intermittent CE total count.
ec0Reg->SetBitFieldJustified( 12, 12, 0 );
updateEc0 = true;
}
if ( i_eccErrorMask & HARD_CTE )
{
// Clear the hard CE total count.
ec0Reg->SetBitFieldJustified( 24, 12, 0 );
updateEc0 = true;
// Clear all of the per symbol counters. The assumption is that only
// hard CEs are captured in the per symbol counters.
o_rc = clearPerSymbolCounters( iv_membChip, iv_mbaPos );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"clearCeStats() failed " );
break;
}
}
if ( i_eccErrorMask & RETRY_CTE )
{
// Clear only the RCE total count.
const char * ec1Reg_str =
(0 == iv_mbaPos) ? "MBA0_MBSEC1" : "MBA1_MBSEC1";
SCAN_COMM_REGISTER_CLASS * ec1Reg =
iv_membChip->getRegister( ec1Reg_str );
o_rc = ec1Reg->Read();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Read() failed on %s", ec1Reg_str );
break;
}
ec1Reg->SetBitFieldJustified( 0, 12, 0 );
o_rc = ec1Reg->Write();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Write() failed on %s", ec1Reg_str );
break;
}
}
if( true == updateEc0 )
{
o_rc = ec0Reg->Write();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"Write() failed on %s", ec0Reg_str );
break;
}
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::doBgScrubCmd( uint32_t i_stopCond, uint32_t i_flags,
const CenAddr * i_sAddrOverride )
{
#define PRDF_FUNC "[CenMbaTdCtlr::doBgScrubCmd] "
int32_t o_rc = SUCCESS;
do
{
mss_MaintCmd::TimeBaseSpeed cmdSpeed = enableFastBgScrub()
? mss_MaintCmd::FAST_MED_BW_IMPACT
: mss_MaintCmd::BG_SCRUB;
iv_mssCmd = createMssCmd( mss_MaintCmdWrapper::TIMEBASE_SCRUB,
iv_mbaTrgt, iv_rank, i_stopCond,
cmdSpeed, i_flags, i_sAddrOverride );
if ( NULL == iv_mssCmd )
{
PRDF_ERR( PRDF_FUNC"createMssCmd() failed");
o_rc = FAIL; break;
}
o_rc = iv_mssCmd->setupAndExecuteCmd();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setupAndExecuteCmd() failed" );
break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::doTdScrubCmd( uint32_t i_stopCond, uint32_t i_flags,
const CenAddr * i_sAddrOverride )
{
#define PRDF_FUNC "[CenMbaTdCtlr::doTdScrubCmd] "
int32_t o_rc = SUCCESS;
do
{
mss_MaintCmd::TimeBaseSpeed cmdSpeed = enableFastBgScrub()
? mss_MaintCmd::FAST_MAX_BW_IMPACT
: mss_MaintCmd::FAST_MIN_BW_IMPACT;
iv_mssCmd = createMssCmd( mss_MaintCmdWrapper::TIMEBASE_SCRUB,
iv_mbaTrgt, iv_rank, i_stopCond,
cmdSpeed, i_flags, i_sAddrOverride );
if ( NULL == iv_mssCmd )
{
PRDF_ERR( PRDF_FUNC"createMssCmd() failed");
o_rc = FAIL; break;
}
o_rc = iv_mssCmd->setupAndExecuteCmd();
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"setupAndExecuteCmd() failed" );
break;
}
} while (0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
int32_t CenMbaTdCtlr::checkForAvailableSpares( uint8_t i_ps, bool & o_avail )
{
#define PRDF_FUNC "[CenMbaTdCtlr::checkForAvailableSpares] "
int32_t o_rc = SUCCESS;
o_avail = false;
do
{
// First, make sure the spares are supported and have not been
// intentially made unavailable by the manufacturer via the VPD.
CenDqBitmap bitmap;
o_rc = getBadDqBitmap( iv_mbaTrgt, iv_rank, bitmap );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"getBadDqBitmap() failed" );
break;
}
bool dramSparePossible = false;
o_rc = bitmap.isDramSpareAvailable( i_ps, dramSparePossible );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"isDramSpareAvailable() failed" );
break;
}
if ( !dramSparePossible ) break;
// Second, query hardware for the any available spares.
CenSymbol sp0, sp1, ecc;
o_rc = mssGetSteerMux( iv_mbaTrgt, iv_rank, sp0, sp1, ecc );
if ( SUCCESS != o_rc )
{
PRDF_ERR( PRDF_FUNC"mssGetSteerMux() failed" );
break;
}
if ( (0 == i_ps ? !sp0.isValid() : !sp1.isValid()) ||
(iv_x4Dimm && !ecc.isValid()) )
{
o_avail = true;
}
} while(0);
return o_rc;
#undef PRDF_FUNC
}
//------------------------------------------------------------------------------
void CenMbaTdCtlr::collectStateCaptureData( STEP_CODE_DATA_STRUCT & io_sc,
const char * i_descTag )
{
static const size_t sz_maxData = 256;
// Initialize to 0.
uint8_t data[sz_maxData];
memset( data, 0x00, sz_maxData );
size_t sz_actData = 0;
//##########################################################################
// Header data (4 bytes)
//##########################################################################
uint8_t mrnk = iv_rank.getMaster(); // 3-bit
uint8_t srnk = iv_rank.getSlave(); // 3-bit
uint8_t fetchMsk = iv_fetchAttnsMasked ? 1 : 0; // 1-bit
uint8_t state = iv_tdState & 0x0f; // 4-bit
uint8_t rescount = iv_scrubResumeCounter.getCount(); // 8-bit
uint8_t badRankMask = 0x00; // 8-bit
TdRankList::List list = iv_masterRanks.getList();
for ( TdRankList::ListItr it = list.begin(); it != list.end(); it++ )
{
if ( !it->isGood )
{
badRankMask |= 0x80 >> it->rank.getMaster();
}
}
// This is a hack to ensure the data is non-zero. Otherwise, the section may
// not be added to the capture data.
uint8_t hack = 1; // 1-bit
data[0] = rescount;
data[1] = badRankMask;
data[2] = state << 4 | mrnk << 1 | fetchMsk;
data[3] = srnk << 5 | hack << 4; // 4 extra bits
sz_actData += 4;
//##########################################################################
// TD Request Queue (min 1 byte, max 33 bytes)
//##########################################################################
// To ensure we have enough space we are only going to add the first 16
// entries of the queue.
TdQueue::Queue queue = iv_queue.getQueue();
uint8_t queueCount = queue.size();
if ( 16 < queueCount ) queueCount = 16;
data[sz_actData] = queueCount;
sz_actData += 1;
for ( TdQueue::QueueItr it = queue.begin(); it != queue.end(); it++ )
{
data[sz_actData ] = it->type;
data[sz_actData+1] = it->rank.getMaster() << 5 |
it->rank.getSlave() << 2; // 2 extra bits
sz_actData += 2;
}
//##########################################################################
// VCM Rank Data (min 1 byte, max 17 bytes)
//##########################################################################
uint8_t vcmDataCount = 0;
uint8_t vcmDataCountIdx = sz_actData; // keep track, will update later
sz_actData += 1; // Make room for VCM data count byte
for ( TdRankList::ListItr it = list.begin(); it != list.end(); it++ )
{
CenRank master = it->rank;
uint8_t mr = master.getMaster();
uint8_t faCount = iv_vcmRankData.getFalseAlarmCount(master); // 8-bit
if ( 0 != faCount )
{
vcmDataCount++;
data[sz_actData ] = faCount;
data[sz_actData+1] = mr << 5; // 3 extra bits
sz_actData += 2;
}
}
data[vcmDataCountIdx] = vcmDataCount; // update count
//##########################################################################
// TPS Rank Data (min 1 byte, max 129 bytes)
//##########################################################################
uint8_t tpsDataCount = 0;
uint8_t tpsDataCountIdx = sz_actData; // keep track, will update later
sz_actData += 1; // Make room for TPS data count byte
for ( TdRankList::ListItr it = list.begin(); it != list.end(); it++ )
{
CenRank master = it->rank;
uint8_t mr = master.getMaster();
for ( uint8_t sr = 0; sr < SLAVE_RANKS_PER_MASTER_RANK; sr++ )
{
CenRank slave = CenRank( mr, sr );
uint8_t faCount = iv_tpsRankData.getFalseAlarmCount(slave);
uint8_t isBan = iv_tpsRankData.isBanned(slave, io_sc) ? 1 : 0;
if ( (0 != faCount) || (0 != isBan) )
{
tpsDataCount++;
data[sz_actData ] = faCount;
data[sz_actData+1] = mr << 5 | sr << 2 | isBan << 1; // 1 extra
sz_actData += 2;
}
}
}
data[tpsDataCountIdx] = tpsDataCount; // update count
//##########################################################################
// Add the capture data
//##########################################################################
// Adjust the size to be word aligned.
static const size_t sz_word = sizeof(CPU_WORD);
sz_actData = ((sz_actData+sz_word-1) / sz_word) * sz_word;
// Fix endianness issues with non PPC machines.
for ( uint32_t i = 0; i < (sz_actData/sz_word); i++ )
((CPU_WORD*)data)[i] = htonl(((CPU_WORD*)data)[i]);
// Add the capture data.
CaptureData & cd = io_sc.service_data->GetCaptureData();
BIT_STRING_ADDRESS_CLASS bs ( 0, sz_actData*8, (CPU_WORD *) &data );
cd.Add( iv_mbaTrgt, Util::hashString(i_descTag), bs );
}
//------------------------------------------------------------------------------
void CenMbaTdCtlr::collectStateCaptureDataStart( STEP_CODE_DATA_STRUCT & io_sc )
{
collectStateCaptureData( io_sc, "TDCTLR_STATE_DATA_START" );
}
//------------------------------------------------------------------------------
void CenMbaTdCtlr::collectStateCaptureDataEnd( STEP_CODE_DATA_STRUCT & io_sc )
{
collectStateCaptureData( io_sc, "TDCTLR_STATE_DATA_END" );
}
} // end namespace PRDF
|