summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/service/prdf_ras_services.C
blob: 5085c50110c568f35709c4acc44a746d63745898 (plain)
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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/service/prdf_ras_services.C $ */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2002,2013              */
/*                                                                        */
/* p1                                                                     */
/*                                                                        */
/* Object Code Only (OCO) source materials                                */
/* Licensed Internal Code Source Materials                                */
/* IBM HostBoot Licensed Internal Code                                    */
/*                                                                        */
/* The source code for this program is not published or otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

/** @file  prdf_ras_services.C
 *  @brief Definition of external RAS services needed by PRD
 */

#define prdf_ras_services_C

#include <prdf_ras_services.H>
#include <prdfPfa5Data.h>
#include <time.h>
#include <iipServiceDataCollector.h>
#include <prdf_service_codes.H>
#include <prdfGlobal.H>
#include <prdfErrlUtil.H>
#include <prdfCallouts.H>
#include <prdfMemoryMru.H>
#include <prdfPlatServices.H>

// For compression routines
#define PRDF_COMPRESSBUFFER_COMPRESS_FUNCTIONS
#include <prdfCompressBuffer.H>

#include <utilmem.H> //For UtilMem stream class (outputting PfaData).
#include <utilfile.H>
#include <vector>
#include <algorithm>
#include <iipSystem.h>         //For RemoveStoppedChips

#ifdef __HOSTBOOT_MODULE
  #define htonl(foo) (foo) // no-op for HB
  #include <stdio.h>
#else
  #include <srcisrc.H>
  #include <GardExtInt.H> //for GARD_ErrorType
  #include <utilreg.H> //For registry functions
  #include <evenmgt.H>
  #include <rmgrBaseClientLib.H>  //for rmgrSyncFile
  #include <prdfSdcFileControl.H>
#endif

#undef prdf_ras_services_C

using namespace TARGETING;

namespace PRDF
{

using namespace PlatServices;

// ----------------------------------------------------------------------------
// Local macros and types
// ----------------------------------------------------------------------------
#ifndef BIN_TO_BCD
#define BIN_TO_BCD(val) ((val) = (((val)/1000)<<12) + (((val%1000)/100)<<8) + (((val%100)/10)<<4) + (val)%10)
#endif

// ----------------------------------------------------------------------------
// Local Globals
// ----------------------------------------------------------------------------
#ifndef __HOSTBOOT_MODULE

const char * ThermalFileKeys[]  = {"fstp/P1_Root","prdf/ThermalSdcPath"};
char  * ThermalFilename = NULL;

#endif

PfaData pfaData;
bool ErrDataService::terminateOnCheckstop = true;
bool previousWasRecovered = false;
Timer previousEventTime;
const double LATENT_MCK_WINDOW = 2;   // two seconds to determin latency
RasServices thisServiceGenerator;

// ----------------------------------------------------------------------------
// Member Functions
// ----------------------------------------------------------------------------

ServiceGeneratorClass & ServiceGeneratorClass::ThisServiceGenerator(void)
{
  return thisServiceGenerator;
}

// ----------------------------------------------------------------------------

RasServices::RasServices() :
    iv_ErrDataService(NULL)
{
    //PRDF_DTRAC("RasServices() initializing default iv_ErrDataService");
    iv_ErrDataService = new ErrDataService();
}

// ----------------------------------------------------------------------------
RasServices::~RasServices()
{
    if(NULL != iv_ErrDataService)
    {
        PRDF_DTRAC("~RasServices() deleting iv_ErrDataService");
        delete iv_ErrDataService;
        iv_ErrDataService = NULL;
    }
}

// ----------------------------------------------------------------------------

void ErrDataService::Initialize()
{
    savedLatentSdc = false;
    serviceActionCounter = 0;
}

void RasServices::Initialize()
{
    iv_ErrDataService->Initialize();
}

// ----------------------------------------------------------------------------

void RasServices::setErrDataService(ErrDataService & i_ErrDataService)
{
    PRDF_TRAC("RasServices::setErrDataService() setting new ErrDataService");

    if(NULL != iv_ErrDataService)
    {
        PRDF_DTRAC("RasServices::setErrDataService() deleting old iv_ErrDataService");
        delete iv_ErrDataService;
        iv_ErrDataService = NULL;
    }

    iv_ErrDataService = &i_ErrDataService;
}

// ----------------------------------------------------------------------------

void ErrDataService::SetErrorTod(ATTENTION_TYPE the_attention,
                                 bool *is_latent,
                                 ServiceDataCollector & sdc)
{
  *is_latent = false;
  latentMachineCheck = false;

  Timer l_curEventTime;
  PlatServices::getCurrentTime(l_curEventTime);

  if(previousWasRecovered && (MACHINE_CHECK == the_attention))
  {
    // check for latent machine check
    if ( LATENT_MCK_WINDOW > (l_curEventTime - previousEventTime))
    {
      *is_latent = true;
      latentMachineCheck = true;
    }
    previousWasRecovered = false; // in case of multiple calls for same cstop
  }
  else if (RECOVERABLE == the_attention)
  {
    previousWasRecovered = true;
  }
  else
  {
    previousWasRecovered = false;
  }

  previousEventTime = l_curEventTime;
  sdc.SetTOE(l_curEventTime);
}

void RasServices::SetErrorTod(ATTENTION_TYPE the_attention,
                              bool *is_latent,
                              ServiceDataCollector & sdc)
{
    iv_ErrDataService->SetErrorTod(the_attention,
                                   is_latent,
                                   sdc);
}

// ----------------------------------------------------------------------------

bool ErrDataService::QueryLoggingBufferFull(void) const
{
    return (loggingBufferFull);
}

bool RasServices::QueryLoggingBufferFull(void) const
{
    return iv_ErrDataService->QueryLoggingBufferFull();
}

// ----------------------------------------------------------------------------

void ErrDataService ::SaveRcForSrc(int32_t the_rc)
{
    savedPrdReturnCode = the_rc;
}

void RasServices::SaveRcForSrc(int32_t the_rc)
{
    iv_ErrDataService->SaveRcForSrc(the_rc);
}

// ----------------------------------------------------------------------------

errlHndl_t RasServices::GenerateSrcPfa(ATTENTION_TYPE attn_type,
                                             ServiceDataCollector & i_sdc)

{
    PRDF_DENTER("RasServices::GenerateSrcPfa()");

    errlHndl_t errLog = NULL;
    errLog = iv_ErrDataService->GenerateSrcPfa(attn_type, i_sdc);

    PRDF_DEXIT("RasServices::GenerateSrcPfa()");
    return errLog;

}

// ----------------------------------------------------------------------------

errlHndl_t ErrDataService::GenerateSrcPfa(ATTENTION_TYPE attn_type,
                                             ServiceDataCollector & i_sdc)
{
    #define PRDF_FUNC "GenerateSrcPfa() "
    PRDF_DENTER( PRDF_FUNC );
    errlHndl_t errLog = NULL;

#ifdef __HOSTBOOT_MODULE
    using namespace ERRORLOG;
    using namespace HWAS;
    errlSeverity_t severityParm = ERRL_SEV_RECOVERED;
#else
    bool writeVPD = false;    // Make the default to not Write VPD Capture data
    bool causeAttnPreviouslyReported = false;
    bool pldCheck = false;  // Default to not do the PLD check. Set it to true for  Machine Check
    uint8_t sdcSaveFlags = SDC_NO_SAVE_FLAGS;
    size_t  sz_uint8    = sizeof(uint8_t);
    HWSV::homTermEnum termFlag = HWSV::HOM_SYS_NO_TERMINATE;
    HWSV::hwsvDeconfigSchedule deconfigSched = HWSV::HWSV_DECONFIG_IMMEDIATE;
    uint8_t sdcBuffer[sdcBufferSize];  //buffer to use for sdc flatten
    errlSeverity severityParm = ERRL_SEV_RECOVERED;
#endif

    SDC_MRU_LIST fspmrulist;
    PRDcallout thiscallout;
    PRDpriority thispriority;
    epubProcedureID thisProcedureID;

    // Init Action Parm to most common usage, Service Action Required and
    // Report Externally. Note this is like the old Signal
    // Event: OS Viewable (Parable) or OS Hidden.
    // Also set the Call Home Flag. This should be set when IBM Service is required.
    // For PRD this is for UnRecoverable and Predictive errors. Setting it here will
    // take care of this. The Hidden and Informational cases will reassign the actionFlag.
    uint32_t actionFlag = (ERRL_ACTION_SA | ERRL_ACTION_REPORT | ERRL_ACTION_CALL_HOME);



    HWSV::hwsvHCDBUpdate hcdbUpdate = HWSV::HWSV_HCDB_DO_UPDATE;

    //Use this SDC unless determined in Check Stop processing to use a Latent, UE, or SUE saved SDC
    sdc = i_sdc;

    GardResolution::ErrorType prdGardErrType;
    HWSV::homGardEnum gardState;  // homGardEnum in src/hwsv/server/hwsvTypes.H
    GARD_ErrorType gardErrType = GARD_NULL;
    HWSV::homDeconfigEnum deconfigState = HWSV::HOM_NO_DECONFIG;

    bool ReturnELog = false;
    bool ForceTerminate = false;
    bool iplDiagMode = false;
    bool deferDeconfig = false;

    ++serviceActionCounter;

    uint16_t PRD_Reason_Code = 0;
    uint32_t dumpPlid = 0;

    //**************************************************************
    // Initial set up by Attention Type
    //**************************************************************

    ////////////////////////////////////////////////////////////////
    // Machine Check ATTN (CHECKSTOP)
    ////////////////////////////////////////////////////////////////
    if (attn_type == MACHINE_CHECK)
    {
#ifdef  __HOSTBOOT_MODULE

        // FIXME: do we want to commit any log here?
        PRDF_ERR( PRDF_FUNC"Hostboot should NOT have any system checkstop!" );

#else
        writeVPD = true;              // Change the default so as to Write Capture Data
        pldCheck = true;              // Do the PLD check

        if (terminateOnCheckstop)
        {
            //Also need to return error log for machine check condition
            termFlag = HWSV::HOM_SYS_TERMINATE_HW_CHECKSTOP;
        }

        ReturnELog = true;

        severityParm = ERRL_SEV_UNRECOVERABLE;

        if // No special UE-SUE flags.
            ((!sdc.IsUERE() ) &&
             (!sdc.IsSUE()  )   )
        {
            if //if LtntMck and last recoverable Stored use it.
                ((latentMachineCheck || sdc.IsForceLatentCS() ) &&
                 (savedLatentSdc      )   )
            {
                gardErrType = GARD_Func;
                sdc = latentSdc;
                causeAttnPreviouslyReported = true;
            }
            //else set no flags, use this sdc
        }
        else //This is a SUE-CS condition check flags.
            if ((!sdc.IsUERE() ) &&
                ( sdc.IsSUE()  )   )
            {
                //Read current sdc state flags from registry
                errlHndl_t errorLog = UtilReg::read ("prdf/RasServices", &sdcSaveFlags, sz_uint8);
                if (errorLog)
                {
                    PRDF_ERR( PRDF_FUNC"Failure in SDC flag Registry read" );
                    PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT);
                }
                else if (sdcSaveFlags & SDC_SAVE_UE_FLAG) //check if UE log stored then use it.
                {
                    bool l_rc = SdcRetrieve(SDC_SAVE_UE_FLAG, sdcBuffer);
                    if (l_rc)
                    {
                        PRDF_ERR( PRDF_FUNC"Failure in UE SDC Retrieve Function" );
                    }
                    else
                    {
                        //set the sdc to the Saved SDC for UE
                        sdc = sdcBuffer;
                        gardErrType = GARD_Func;
                        causeAttnPreviouslyReported = true;
                    }
                }
                else if (sdcSaveFlags & SDC_SAVE_SUE_FLAG ) //else check if SUE log stored then use it.
                {
                    bool l_rc = SdcRetrieve(SDC_SAVE_SUE_FLAG, sdcBuffer);
                    if (l_rc)
                    {
                        PRDF_ERR( PRDF_FUNC"Failure in SUE SDC Retrieve Function" );
                    }
                    else
                    {
                        //set the sdc to the Saved SDC for SUE
                        sdc = sdcBuffer;
                        gardErrType = GARD_Func;
                        causeAttnPreviouslyReported = true;
                    }
                }
                //else, set no flags, use this sdc
            }
        //else Normal Mck, set no flags, use this sdc
#endif  // if not __HOSTBOOT_MODULE
    }
    ////////////////////////////////////////////////////////////////
    // Recoverable ATTN or Unit CheckStop
    ////////////////////////////////////////////////////////////////
    else if (attn_type == RECOVERABLE  || attn_type == UNIT_CS )
    {
#ifndef  __HOSTBOOT_MODULE
        // FIXME: I don't think Hostboot needs latent SDC and UE/SUE support
        if (!sdc.IsUsingSavedSdc() )  // Don't save File if we are Re-Syncing an sdc
        {
            savedLatentSdc = true;  //Save this SDC as Latent SDC
            latentSdc = i_sdc;
        }

        if //Ue-Re RECOVERABLE condition.
            ((sdc.IsUERE()   ) &&
             (!sdc.IsSUE()   ) &&
             (!sdc.IsUsingSavedSdc() ) )  // Don't save File if we are Re-Syncing an sdc
        {
            bool l_rc = SdcSave(SDC_SAVE_UE_FLAG, i_sdc);
            if (l_rc)
            {
                PRDF_ERR( PRDF_FUNC"Failure in UE SDC Save Function" );
            }
        }
        else if //Sue-Re RECOVERABLE condition.
            ((!sdc.IsUERE()   ) &&
             (sdc.IsSUE()     ) &&
             (!sdc.IsUsingSavedSdc() ) )  // Don't save File if we are Re-Syncing an sdc

        {
            bool l_rc = SdcSave(SDC_SAVE_SUE_FLAG, i_sdc);
            if (l_rc)
            {
                PRDF_ERR( PRDF_FUNC"Failure in SUE SDC Save Function" );
            }
        }
#endif  // if not __HOSTBOOT_MODULE

        // For a Recoverable Attn with MPFatal and Cause_attn_type not
        // equal Special, make this a Predictive, Parable error.
        if (!sdc.IsLogging() )
        {
            // This is a Hidden Log
            severityParm = ERRL_SEV_INFORMATIONAL;
            actionFlag = (actionFlag | ERRL_ACTION_HIDDEN);
        }
        else if (sdc.IsServiceCall() || //At Thresold
            (sdc.IsMpFatal() && sdc.GetCauseAttentionType() != SPECIAL) )
        {
            severityParm = ERRL_SEV_PREDICTIVE;
        }
        else  //Recovered
        {
            severityParm = ERRL_SEV_RECOVERED;
            //  Recovered error should be Hidden, and No Service Action
            actionFlag = ERRL_ACTION_HIDDEN;
        }

        if (sdc.IsThermalEvent())
        {  //Make the Thermal Event Hidden
            severityParm = ERRL_SEV_RECOVERED;
            actionFlag = ERRL_ACTION_HIDDEN;
        }
    }
    ////////////////////////////////////////////////////////////////
    // Special ATTN
    ////////////////////////////////////////////////////////////////
    else if (attn_type == SPECIAL)
    {
        //SMA path on Special attn
        if (sdc.IsMpFatal() && (sdc.IsLogging() || sdc.IsServiceCall() ) )
        {
            severityParm = ERRL_SEV_UNRECOVERABLE;
            savedLatentSdc = true;  //Save this SDC as Latent SDC
            latentSdc = i_sdc;
        }
        else if (sdc.IsServiceCall())
        //Bit Steered already, or Bit Steer Not supported
        {
            severityParm = ERRL_SEV_PREDICTIVE;
        }
        else if ( (!sdc.IsServiceCall()) && (!sdc.IsLogging()) ) // Special Attn Clean Up
        {
            severityParm = ERRL_SEV_INFORMATIONAL;
            //Hidden, No Service Action for Infomational
            actionFlag = ERRL_ACTION_HIDDEN;
        }
        else if ( (!sdc.IsServiceCall()) && (sdc.IsLogging()) ) // Special Attn Bit Steer Normal Condition
        {
            severityParm = ERRL_SEV_RECOVERED;
            //Hidden, No Service Action for Recovered
            actionFlag = ERRL_ACTION_HIDDEN;
        }
    }

    //**************************************************************
    // Set Gard Error Type and state
    //**************************************************************

    gardState = HWSV::HOM_DECONFIG_GARD;

    // If gardErrType was determined during latent/UE/SUE processing for Check Stop,
    // use that and not determine gardErrType from the sdc values.
    if (gardErrType != GARD_Func)
    {
        prdGardErrType = sdc.QueryGard();
        switch (prdGardErrType)
        {
            case GardResolution::NoGard:
                gardState =  HWSV::HOM_NO_GARD;
                gardErrType = GARD_NULL;
                break;
            case GardResolution::Predictive:
                gardErrType = GARD_Predictive;
                break;
            case GardResolution::Uncorrectable:
                gardErrType = GARD_Unrecoverable;
                break;
            case GardResolution::Fatal:
                gardErrType = GARD_Func;
                break;
            case GardResolution::Pending:
                gardErrType = GARD_Pending;
                // Do not set Call Home for Array Gard (Pending)
                actionFlag &= ~ERRL_ACTION_CALL_HOME;
                break;
            case GardResolution::CheckStopOnlyGard:
                if  (MACHINE_CHECK == attn_type)
                {
                    gardErrType = GARD_Func;
                }
                else
                {
                    gardState =  HWSV::HOM_NO_GARD;
                    gardErrType = GARD_NULL;
                }
                break;
            case GardResolution::DeconfigNoGard:
                gardState =  HWSV::HOM_NO_GARD;
                gardErrType = GARD_NULL;
                break;
            default:
                gardState =  HWSV::HOM_NO_GARD;
                gardErrType = GARD_NULL;
                PRDF_DTRAC( PRDF_FUNC"Unknown prdGardErrType" );
                break;
        }
    }
    else
    {
        // gardErrType is GARD_Func, set in latent/UE/SUE processing for Check Stop.
        // If NoGard was specified in this switched sdc, then keep the NoGard
        if ( sdc.QueryGard() == GardResolution::NoGard )
        {
            gardState = HWSV::HOM_NO_GARD;
            gardErrType = GARD_NULL;
            prdGardErrType = GardResolution::NoGard;
        }
        else
        {
            prdGardErrType = GardResolution::Fatal;
        }
    }

    if (sdc.IsThermalEvent() && (MACHINE_CHECK != attn_type) )
    {  //Force No Gard
        gardState = HWSV::HOM_NO_GARD;
        gardErrType = GARD_NULL;
    }

    //**************************************************************
    // Callout loop to set up Reason code and SRC word 9
    //**************************************************************

    //FIXME  relevant PlatServices function defintions are not available yet
    //bool myCM_FUNCTIONAL = true;

    // Must go thru callout list to look for RIOPORT procedure callouts,
    // since they require the port info to be in SRC Word 9
    bool HW = false;
    bool SW = false;
    bool SW_High = false;
    bool SecondLevel = false;
    bool l_memBuffInCallouts = false;
    uint32_t SrcWord7 = 0;
    uint32_t SrcWord9 = 0;
    fspmrulist = sdc.GetMruList();
    int32_t calloutsPlusDimms = fspmrulist.size();
    for (SDC_MRU_LIST::iterator i = fspmrulist.begin(); i < fspmrulist.end(); ++i)
    {
        thiscallout = i->callout;
        if ( PRDcalloutData::TYPE_SYMFRU == thiscallout.getType() )
        {
            if ( (EPUB_PRC_SP_CODE   == thiscallout.flatten()) ||
                 (EPUB_PRC_PHYP_CODE == thiscallout.flatten()) )
            {
                SW = true;
                if ( MRU_MED == i->priority )
                {
                    SW_High = true;
                }
            }
            else if ( EPUB_PRC_LVL_SUPP == thiscallout.flatten())
            {
                SecondLevel = true;
            }
        }
        else if ( PRDcalloutData::TYPE_MEMMRU == thiscallout.getType() )
        {
            MemoryMru memMru (thiscallout.flatten());
            SrcWord9 = memMru.toUint32(); // Get MemMru value

            TargetHandleList partList = memMru.getCalloutList();
            uint32_t partCount = partList.size();

            calloutsPlusDimms = calloutsPlusDimms + partCount -1;
            HW = true; //hardware callout

            // If we are in Concurrent Maintenance Mode, we will need to disable
            // the Deferred Deconfig, if the callouts are not HOM_CM_FUNCTIONAL.

            /* FIXME: RTC 50063 PlatServices::inCMMode() not available yet
            if (PlatServices::inCMMode())
            {
                if (partCount < 1)
                {
                    // Something wrong with memmru
                    myCM_FUNCTIONAL = false;
                    PRDF_TRAC( "PRDTRACE: RasServices MemMru has no callouts" );
                }
                else
                {
                    for ( TargetHandleList::iterator it = partList.begin();
                          it != partList.end(); it++ )
                    {
                        if ( !PlatServices::isCM_FUNCTIONAL(*it) )
                        {
                            myCM_FUNCTIONAL = false;
                            PRDF_TRAC( PRDF_FUNC"isCM_FUNCTIONAL is false for ID: 0x%08x",
                                       PlatServices::getHuid(*it) );
                            break;
                        }
                    }
                }
            }
            */
        }
        else // PRDcalloutData::TYPE_TARGET
        {
            HW = true; // Hardware callout

            TargetHandle_t target = thiscallout.getTarget();
            if (( TYPE_MEMBUF == PlatServices::getTargetType(target) ) ||
                ( TYPE_MBA    == PlatServices::getTargetType(target) ))
                l_memBuffInCallouts = true;

            // If we are in Concurrent Maintenance Mode,
            // we will need to disable the
            // Deferred Deconfig, if the callouts are not HOM_CM_FUNCTIONAL.
            // FIXME PlatServices::inCMMode() not avaialble yet
            #if 0
            if (PlatServices::inCMMode())
            {
            // FIXME PlatServices::isCM_FUNCTIONAL  not avaialble yet
                if ( !PlatServices::isCM_FUNCTIONAL(l_thisChipHandle) )
                {
                    myCM_FUNCTIONAL = false;
                    PRDF_TRAC( "PRDTRACE: RasServices CM not functional for ID: %x",
                               PlatServices::getHuid(l_thisChipHandle) );
                }
            }
            #endif
        }

    }

    ////////////////////////////////////////////////////////////////
    //Set the PRD Reason Code based on the flags set in the above callout loop.
    ////////////////////////////////////////////////////////////////
    uint16_t SDC_Reason_Code = sdc.GetReasonCode();
    if (SDC_Reason_Code == 0) // If the analysis code has not set its own
                              // Reason Code.
    {
        if (HW == true && SW == true)
        {
            if (SW_High == true)
                PRD_Reason_Code = PRDF_DETECTED_FAIL_SOFTWARE_PROBABLE;
            else
                PRD_Reason_Code = PRDF_DETECTED_FAIL_HARDWARE_PROBABLE;
        }
        else if (HW == true && SW == false && SecondLevel == true)
            PRD_Reason_Code = PRDF_DETECTED_FAIL_HARDWARE_PROBABLE;
        else if (HW == true && SW == false && SecondLevel == false)
            PRD_Reason_Code = PRDF_DETECTED_FAIL_HARDWARE;
        else if (HW == false && SW == true)
            PRD_Reason_Code = PRDF_DETECTED_FAIL_SOFTWARE;
        else
        {
            // If we get here both HW and SW flags were false. Callout may be
            // Second Level Support only, or a procedure not checked in the SW
            // flag code.
            PRD_Reason_Code = PRDF_DETECTED_FAIL_HARDWARE_PROBABLE;
        }
    }
    else
    {   //Set to Reason Code in SDC, set by the chip analysis code.
        PRD_Reason_Code = SDC_Reason_Code;
    }

    SrcWord7 = i_sdc.GetAttentionType() << 8;
    SrcWord7 |= i_sdc.GetCauseAttentionType();

    //**************************************************************
    // Check for IPL Diag Mode and set up for Deferred Deconfig
    //**************************************************************

 //TODO TargetHandle conversion -defferredDeconfigMasterNot avaialable yet
#if 0
    hutlIplStepManager* stepManager = PlatServices::getDeferredDeconfigMaster();
    if ( NULL != stepManager )
    {
        iplDiagMode = true;
        if ( (MACHINE_CHECK != attn_type || !terminateOnCheckstop) &&
              myCM_FUNCTIONAL             &&
              (HOM_NO_GARD != gardState ||
               GardResolution::DeconfigNoGard == prdGardErrType )  ) //Allow Deferred Deconfig for IPL Diag when No Gard action is needed
        {
            deferDeconfig = true;
            deconfigState = HOM_DECONFIG;
            deconfigSched = HWSV::HWSV_DECONFIG_DEFER;
        }

    }

#endif


    //**************************************************************
    // Create Error Log with SRC
    //**************************************************************
    ErrorSignature * esig = sdc.GetErrorSignature();

    PRDF_HW_CREATE_ERRL(errLog,
                        ERRL_SEV_PREDICTIVE,
                        ERRL_ETYPE_NOT_APPLICABLE,
                        SRCI_MACH_CHECK,
                        SRCI_NO_ATTR,
                        PRDF_RAS_SERVICES,
                        FSP_DEFAULT_REFCODE,
                        PRD_Reason_Code,
                        esig->getChipId(), //SRC Word 6
                        SrcWord7,          //code location - SRC Word 7
                        esig->getSigId(),  //signature - SRC Word 8
                        SrcWord9,          //user data - SRC Word 9
                        termFlag,
                        pldCheck);         //pldCheck

    //**************************************************************
    //  Add SDC Capture data to Error Log User Data here only if
    //    there are 4 or more callouts,
    //    (including Dimm callouts in the MemoryMru).
    //**************************************************************
    bool capDataAdded = false;
    if (calloutsPlusDimms > 3)
    {
        AddCapData(sdc.GetCaptureData(),errLog);
        capDataAdded = true;
    }

    // make sure serviceAction doesn't override errl severity
    errLog->setSev(severityParm);

    if (ERRL_ACTION_HIDDEN == actionFlag)
    {  //Change HCDB Update to not do the update for non-visible logs
        hcdbUpdate = HWSV::HWSV_HCDB_OVERRIDE;
    }

    //**************************************************************
    // Add each mru/callout to the error log.
    //**************************************************************
    fspmrulist = sdc.GetMruList();
    uint32_t calloutcount = fspmrulist.size();
    for ( SDC_MRU_LIST::iterator i = fspmrulist.begin();
          i < fspmrulist.end(); ++i )
    {
        thispriority = (*i).priority;
        thiscallout = (*i).callout;
        if ( PRDcalloutData::TYPE_TARGET == thiscallout.getType() )
        {
            TargetHandle_t target = thiscallout.getTarget();
            // Don't deconfig a Memory Controller for Bus Errors (Mc and SuperNova
            // both in Callouts) for Mem Diag. Note still deconfg the SuperNova.
            HWSV::homDeconfigEnum thisDeconfigState = deconfigState;
            TYPE l_targetType = PlatServices::getTargetType(target);
            if ( HWSV::HOM_DECONFIG == deconfigState  &&
                 l_memBuffInCallouts            &&
                 (l_targetType  ==  TYPE_MCS)) //InP8 only 1:1 connection between Mem Buf and Mem ctrl
            {
                thisDeconfigState = HWSV::HOM_NO_DECONFIG;
            }

            #ifdef __HOSTBOOT_MODULE
            // FIXME: this will change once mdia mode support is in
            if(true == iplDiagMode)
            {
              thisDeconfigState = HWSV::HOM_DEFER_DECONFIG; // DELAYED_DECONFIG;
            }
            #endif

            PRDF_HW_ADD_CALLOUT(ForceTerminate,
                                target,
                                thispriority,
                                thisDeconfigState,
                                gardState,
                                errLog,
                                writeVPD,
                                gardErrType,
                                severityParm,
                                hcdbUpdate);

        }
        else if ( PRDcalloutData::TYPE_MEMMRU == thiscallout.getType() )
        {
            MemoryMru memMru (thiscallout.flatten());

            TargetHandleList partList = memMru.getCalloutList();
            for ( TargetHandleList::iterator it = partList.begin();
                  it != partList.end(); it++ )
            {
                PRDF_HW_ADD_CALLOUT( ForceTerminate,
                                     *it,
                                     thispriority,
                                     deconfigState,
                                     gardState,
                                     errLog,
                                     writeVPD,
                                     gardErrType,
                                     severityParm,
                                     hcdbUpdate );
            }
        }
        else if ( PRDcalloutData::TYPE_SYMFRU == thiscallout.getType() )
        {
            thisProcedureID = epubProcedureID(thiscallout.flatten());

            PRDF_DTRAC( PRDF_FUNC"thisProcedureID: %x, thispriority: %x, severityParm: %x",
                   thisProcedureID, thispriority,severityParm );

            PRDF_HW_ADD_PROC_CALLOUT(thisProcedureID,
                                     thispriority,
                                     errLog,
                                     severityParm);

            // Use the flags set earlier to determine if the callout is just Software (SP code or Phyp Code).
            // Add a Second Level Support procedure callout Low, for this case.
            if (HW == false && SW == true && SecondLevel == false)
            {
                PRDF_DTRAC( PRDF_FUNC"thisProcedureID= %x, thispriority=%x, severityParm=%x",
                   EPUB_PRC_LVL_SUPP, MRU_LOW, severityParm );

                PRDF_HW_ADD_PROC_CALLOUT(EPUB_PRC_LVL_SUPP,
                                         MRU_LOW,
                                         errLog,
                                         severityParm);

                SecondLevel = true;
            }

        }
    }

#ifndef  __HOSTBOOT_MODULE
    // FIXME: need to investigate whether or not to add HCDB to Hostboot

    //**************************************************************
    //  setChangeState for HomIds in the HCDB change list
    //**************************************************************
    HCDB_CHANGE_LIST hcdbList = sdc.GetHcdbList();
    for (HCDB_CHANGE_LIST::iterator i = hcdbList.begin(); i < hcdbList.end(); ++i)
    {
        //FIXME  comp_id_t, l_pchipHandle commented to avoid warning
        //TargetHandle_t l_pchipHandle = (*i).iv_phcdbtargetHandle;
       // comp_id_t thisCompId = (*i).iv_compType;
        hcdb::comp_subtype_t thisCompSubType = (*i).iv_compSubType;
        if (hcdb::SUBTYPE_ANY == thisCompSubType)
        {
            //PlatServices::setHcdbChangeState(l_pchipHandle);//FIXME functions commneted for now in wrapper
            // false means don't set the HOM objects derived from this ohject.
        }
        else
        {
            //PlatServices::setHcdbChangeState(l_pchipHandle , thisCompId, thisCompSubType);
            //TODO TargetHandle Conversion may shall change for P8
            // false means don't set the HOM objects derived from this ohject.
        }
    }

    //**************************************************************
    //  setChangeState for System if needed
    //**************************************************************
    // If Second Level callout with no hardware called out, setChangeState for System
    if ( (HW == false) && (SecondLevel == true))
    {
        //PlatServices::setHcdbChangeStateSystem();FIXME functions commneted for now in wrapper
        PRDF_INF( PRDF_FUNC"initiating a HCDB setChangeState for System." );
    }
#endif // if not __HOSTBOOT_MODULE

    //**************************************************************
    // Build Dump Flags and PFA5 data
    //**************************************************************
    //MP01 a Start
    pfaData.MsDumpLabel[0] = 0x4D532020;                //start of MS Dump flags
    pfaData.MsDumpLabel[1] = 0x44554D50;                // 'MS  DUMP'

    TargetHandle_t l_dumpHandle = NULL;
#ifdef  __HOSTBOOT_MODULE
    sdc.GetDumpRequest( l_dumpHandle );
#else
    hwTableContent l_dumpRequestContent; //not used but needed to call GetDumpRequest
    sdc.GetDumpRequest( l_dumpRequestContent, l_dumpHandle );
    pfaData.MsDumpInfo.DumpContent = l_dumpRequestContent;
#endif

    pfaData.MsDumpInfo.DumpId = PlatServices::getHuid(l_dumpHandle);
    TYPE l_targetType = PlatServices::getTargetType(l_dumpHandle);

    if (i_sdc.IsMpDumpReq())
    {
        pfaData.MP_DUMP_REQ = 1;
    }
    else
    {
        pfaData.MP_DUMP_REQ = 0;
    }
    if (i_sdc.IsMpResetReq())
    {
        pfaData.MP_RESET_REQ = 1;
    }
    else
    {
        pfaData.MP_RESET_REQ = 0;
    }
    //Pass Error Log Action Flag to attn handling, so it know what actions to commit

    pfaData.MP_FATAL = (i_sdc.IsMpFatal()==true)? 1:0;

    pfaData.PFA_errlActions = actionFlag;
    pfaData.PFA_errlSeverity = severityParm;

    pfaData.REBOOT_MSG = 0; //  Not supported??
    pfaData.DUMP = (sdc.IsDump()==true)? 1:0;
    pfaData.UERE = (sdc.IsUERE()==true)? 1:0;
    pfaData.SUE = (sdc.IsSUE()==true)? 1:0;
    pfaData.CRUMB = (sdc.MaybeCrumb()==true)? 1:0;
    pfaData.AT_THRESHOLD = (sdc.IsAtThreshold()==true)? 1:0;
    pfaData.DEGRADED = (sdc.IsDegraded()==true)? 1:0;
    pfaData.SERVICE_CALL = (sdc.IsServiceCall()==true)? 1:0;
    pfaData.TRACKIT = (sdc.IsMfgTracking()==true)? 1:0;
    pfaData.TERMINATE = (sdc.Terminate()==true)? 1:0;
    pfaData.LOGIT = (sdc.IsLogging()==true)? 1:0;
    pfaData.MEMORY_STEERED = (sdc.IsMemorySteered()==true)? 1:0;
    pfaData.FLOODING = (sdc.IsFlooding()==true)? 1:0;

    pfaData.ErrorCount = sdc.GetHits();
    pfaData.PRDServiceActionCounter = serviceActionCounter;
    pfaData.Threshold = sdc.GetThreshold();
    pfaData.ErrorType = prdGardErrType;
    pfaData.homGardState = gardState;
    pfaData.PRD_AttnTypes = attn_type;
    pfaData.PRD_SecondAttnTypes = i_sdc.GetCauseAttentionType();
    pfaData.THERMAL_EVENT = (sdc.IsThermalEvent()==true)? 1:0;
    pfaData.UNIT_CHECKSTOP = (sdc.IsUnitCS()==true)? 1:0;
    pfaData.USING_SAVED_SDC = (sdc.IsUsingSavedSdc()==true)? 1:0;
    pfaData.FORCE_LATENT_CS = (i_sdc.IsForceLatentCS()==true)? 1:0;
    pfaData.DEFER_DECONFIG_MASTER = (iplDiagMode==true)? 1:0;
    pfaData.DEFER_DECONFIG = (deferDeconfig==true)? 1:0;
    pfaData.CM_MODE = 0; //FIXME  Need to change this initialization
    pfaData.TERMINATE_ON_CS = (terminateOnCheckstop==true)? 1:0;
    pfaData.reasonCode = sdc.GetReasonCode();
    pfaData.PfaCalloutCount = calloutcount;

    // First clear out the PFA Callout list from previous SRC
    for (uint32_t j = 0; j < MruListLIMIT; ++j)
    {
        pfaData.PfaCalloutList[j].Callout = 0;
        pfaData.PfaCalloutList[j].MRUtype = 0;
        pfaData.PfaCalloutList[j].MRUpriority = 0;
    }

    // Build the mru list into PFA data Callout list
    uint32_t n = 0;
    fspmrulist = sdc.GetMruList();
    for ( SDC_MRU_LIST::iterator i = fspmrulist.begin();
          i < fspmrulist.end(); ++i )
    {
        if ( n < MruListLIMIT )
        {
            pfaData.PfaCalloutList[n].MRUpriority = (uint8_t)(*i).priority;
            pfaData.PfaCalloutList[n].Callout = i->callout.flatten();
            pfaData.PfaCalloutList[n].MRUtype = i->callout.getType();

            ++n;
        }
    }

#ifndef __HOSTBOOT_MODULE
    // FIXME: need to investigate whether or not we need to add HCDB support in Hostboot
    // First clear out the HCDB from previous SRC
    for (uint32_t j = 0; j < HcdbListLIMIT; ++j)
    {
        pfaData.PfaHcdbList[j].hcdbId = 0;//Resetting entity path
        pfaData.PfaHcdbList[j].compSubType = 0;
        pfaData.PfaHcdbList[j].compType = 0;
        pfaData.PfaHcdbList[j].hcdbReserved1 = 0;
        pfaData.PfaHcdbList[j].hcdbReserved2 = 0;
    }

    // Build the HCDB list into PFA data
    n = 0;
    hcdbList = sdc.GetHcdbList();
    pfaData.hcdbListCount = hcdbList.size();
    for (HCDB_CHANGE_LIST::iterator i = hcdbList.begin(); i < hcdbList.end(); ++i)
    {
        if (n < HcdbListLIMIT)
        {
            pfaData.PfaHcdbList[n].hcdbId = PlatServices::getHuid((*i).iv_phcdbtargetHandle);
            pfaData.PfaHcdbList[n].compSubType = (*i).iv_compSubType;
            pfaData.PfaHcdbList[n].compType = (*i).iv_compType;
            ++n;
        }
        else
            break;
    }
    // Set flag so we know to parse the hcdb data
    pfaData.HCDB_SUPPORT = 1;
#endif // if not __HOSTBOOT_MODULE

    PRDF_SIGNATURES signatureList = sdc.GetSignatureList();
    // First clear out the HCDB from previous SRC
    for (uint32_t j = 0; j < SignatureListLIMIT; ++j)
    {
        pfaData.PfaSignatureList[j].chipId = 0;//Resetting the chipPath
        pfaData.PfaSignatureList[j].signature = 0;
    }

    // Build the signature list into PFA data
    n = 0;
    signatureList = sdc.GetSignatureList();
    pfaData.signatureCount = signatureList.size();
    for (PRDF_SIGNATURES::iterator i = signatureList.begin(); i < signatureList.end(); ++i)
    {
        if (n < SignatureListLIMIT)
        {
            pfaData.PfaSignatureList[n].chipId = PlatServices::getHuid((*i).iv_pSignatureHandle);
            pfaData.PfaSignatureList[n].signature = (*i).iv_signature;
            ++n;
        }
        else
            break;
    }
    // Set flag so we know to parse the hcdb data
    pfaData.SIGNATURE_SUPPORT = 1;

    //**************************************************************
    // Check for Unit CheckStop.
    // Check for Last Functional Core.
    // PFA data updates for these item.
    //**************************************************************
    pfaData.LAST_CORE_TERMINATE = false;
    // Now the check is for Unit Check Stop and Dump ID for Processor
    // Skip the termination on Last Core if this is a Saved SDC
    if (sdc.IsUnitCS()  && (!sdc.IsUsingSavedSdc() ) )
    {
        PRDF_TRAC( PRDF_FUNC"Unit CS, Func HUID: %x, TargetType: %x",
                   pfaData.MsDumpInfo.DumpId, l_targetType );
        if (TYPE_CORE == l_targetType)
        {
            //Check if this is last functional core
            if ( PlatServices::checkLastFuncCore(l_dumpHandle) )
            {
                PRDF_TRAC( PRDF_FUNC"Last Func Core: %x was true.",
                           PlatServices::getHuid(l_dumpHandle)  );
                ForceTerminate = true;
                pfaData.LAST_CORE_TERMINATE = true;
                errLog->setSev(ERRL_SEV_UNRECOVERABLE);  //Update Errl Severity
                //Update PFA data
                pfaData.PFA_errlSeverity = ERRL_SEV_UNRECOVERABLE;
            }
        }
    }

    // Check the errl for the terminate state
    // Note: will also be true for CheckStop attn.
    bool l_termSRC = false;
    PRDF_GET_TERM_SRC(errLog, l_termSRC);
    if(l_termSRC)
    {
        ForceTerminate = true;
        uint32_t l_plid = 0;
        PRDF_GET_PLID(errLog, l_plid);
        PRDF_INF(PRDF_FUNC"check for isTerminateSRC is true. PLID=%.8X", l_plid);
    }

    //*************************************************************
    // Must check for Manufacturing Mode terminate here and then do
    // the needed overrides on ForceTerminate flag.
    //*************************************************************
    if ( PlatServices::mnfgTerminate() && !ForceTerminate )
    {
        ForceTerminate = true;
        if ( !((severityParm == ERRL_SEV_RECOVERED) ||
               (severityParm == ERRL_SEV_INFORMATIONAL)) &&
             iplDiagMode  &&
             !HW )
        {
            //Terminate in Manufacturing Mode, in IPL mode, for visible log, with no HW callouts.
            PRDF_SRC_WRITE_TERM_STATE_ON(errLog, SRCI_TERM_STATE_MNFG);
        }
        //Do not Terminate in Manufacturing Mode if not at threshold.
        //Allow Manufacturing Mode Terminate for Thermal Event. It's severityParm will be
        //ERRL_SEV_RECOVERED in the current error log.
        //MPB1 c Do not Terminate in Manufacturing Mode in Ipl Diag Mode  with Deferred Deconfig
        else if ( ( ((severityParm == ERRL_SEV_RECOVERED) || (severityParm == ERRL_SEV_INFORMATIONAL)) &&
                       !sdc.IsThermalEvent() ) ||
                     deferDeconfig )
        {
            ForceTerminate = false;
            actionFlag = (actionFlag | ERRL_ACTION_DONT_TERMINATE);
        }
        else
        {
            PRDF_SRC_WRITE_TERM_STATE_ON(errLog, SRCI_TERM_STATE_MNFG);
        }

        if (sdc.IsThermalEvent() )
        {  //For Manufacturing Mode terminate, change the action flags for Thermal Event.
            actionFlag = (ERRL_ACTION_SA | ERRL_ACTION_REPORT | ERRL_ACTION_CALL_HOME);
        }
        pfaData.PFA_errlActions = actionFlag;
    }


    // Needed to move the errl add user data sections here because of some updates
    // of the data required in the Aysnc section for the SMA dual reporting fix.

    //**************************************************************
    // Add the PFA data to Error Log User Data
    //**************************************************************
    UtilMem l_membuf;
    l_membuf << pfaData;
    PRDF_ADD_FFDC( errLog, (const char*)l_membuf.base(), l_membuf.size(),
                   ErrlVer1, ErrlSectPFA5_1 );

    //**************************************************************
    // Check for Manufacturing AVP mode
    // If needed: Add the AVP mode data to Error Log User Data
    //**************************************************************

   /* FIXME - The MDIA component is being removed from FSP code. This means this MDIA registry variable
will also be removed. Need to confirm if this code is required anymore.
    if ( PlatServices::avpMode() )
    {
        //Get the AVP Test Case Number from the AVP Test Case Data Registry. The Test Case Number is the first four bytes.
        uint32_t avpTCNumber = 0;
        size_t  sz_uint32    = sizeof(uint32_t);
        errlHndl_t errorLog = UtilReg::read ("mdia/AvpTestCaseData", &avpTCNumber, sz_uint32);
        // printf("AVP Test Case Number from registry: %.8x \n", avpTCNumber);
        if (errorLog)
        {
            errorLog->commit(PRDF_COMP_ID,ERRL_ACTION_REPORT);
            PRDF_ERR( "PRDTRACE: RasServices Failure in AVP Test Case Registry read" );
            delete errorLog;
            errorLog = NULL;
        }
        else
        {
            //Add Test Case Number to Error Log User Data
            UtilMem l_membuf;
            l_membuf << avpTCNumber;
            errLog->addUsrDtls(l_membuf.base(),l_membuf.size(),PRDF_COMP_ID,ErrlVer1,ErrlAVPData_1);
        }
    }
*/

#ifndef __HOSTBOOT_MODULE
    // FIXME: do we need support for AVP in Hostboot?  probably not
    if ( PlatServices::hdatAvpMode() )
    {
        //Get the AVP Test Case Data from the AVP Test Case Data Registry.
        uint8_t avpTCData[64];
        size_t  sz_avpTCData    = sizeof(avpTCData);
        errlHndl_t errorLog = UtilReg::read ("hdat/AvpTestCaseData", avpTCData, sz_avpTCData);

        if (errorLog)
        {
            PRDF_ERR( PRDF_FUNC"Failure in hdat AVP Test Case Registry read" );
            PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT);
        }
        else
        {
            //Add Test Case Data to Error Log User Data
            const size_t sz_usrDtlsTCData = 29;
            uint8_t usrDtlsTCData[sz_usrDtlsTCData];
            memcpy(usrDtlsTCData, avpTCData, 4);
            memcpy(&usrDtlsTCData[4], &avpTCData[40], 4);
            memcpy(&usrDtlsTCData[8], &avpTCData[37], 1);
            memcpy(&usrDtlsTCData[9], &avpTCData[44], 20);
            PRDF_ADD_FFDC( errLog, (const char*)usrDtlsTCData, sz_usrDtlsTCData,
                           ErrlVer1, ErrlAVPData_2 );
        }
    }
#endif // if not __HOSTBOOT_MODULE

    //**************************************************************
    // Add SDC Capture data to Error Log User Data
    //**************************************************************
    // Pulled some code out to incorporate into AddCapData
    // Check to make sure Capture Data wasn't added earlier.
    if (!capDataAdded)
    {
        AddCapData(sdc.GetCaptureData() ,errLog);
    }

    // Note moved the code from here, that was associated with checking for the last
    // functional core to be before the PFA data is placed in error log.

    // Collect PRD trace
    // NOTE: Each line of trace is on average 36 bytes so 768 bytes should get
    //       us around 21 lines of trace output.
    PRDF_COLLECT_TRACE(errLog, 768);

    //**************************************************************
    // Commit the eror log.
    // This will also perform Gard and Deconfig actions.
    // Do the Unit Dumps if needed.
    //**************************************************************
    if (sdc.IsDontCommitErrl() && !sdc.IsUnitCS() && (MACHINE_CHECK != attn_type) )
    {
        delete errLog;
        errLog = NULL;
    }
    else if ( !ReturnELog        && !ForceTerminate &&
              !i_sdc.IsMpFatal() && !i_sdc.Terminate() )
    {
        // Check to see if we need to do a Proc Core dump
        if ( sdc.IsUnitCS() && !sdc.IsUsingSavedSdc() )
        {
            if ( l_targetType == TYPE_PROC )
            {
                // NX Unit Checktop - runtime deconfig each accelerator
                int32_t l_rc = SUCCESS;
                SDC_MRU_LIST mrulist = sdc.GetMruList();
                for ( SDC_MRU_LIST::iterator i = mrulist.begin();
                      i < mrulist.end(); ++i )
                {
                    /* FIXME: need to add accelerators runtime deconfig
                    TargetHandle_t accelTarget = i->callout.getMruValues();
                    if ( TYPE_CORE == PlatServices::getTargetType(accelTarget) )
                    {
                        l_rc = PRDF_RUNTIME_DECONFIG( accelTarget );
                        if ( SUCCESS != l_rc )
                            break;
                    }
                    */
                }

                if ( SUCCESS == l_rc )
                {
                    l_rc = PRDF_HWUDUMP( errLog, CONTENT_HWNXLCL,
                                         pfaData.MsDumpInfo.DumpId );
                }
            }
            else if (l_targetType == TYPE_MEMBUF ||
                     l_targetType == TYPE_MBA    ||
                     l_targetType == TYPE_MCS)
            {
                // Centaur Checkstop
                TargetHandle_t centaurHandle = l_dumpHandle;
                if ( TYPE_MCS == l_targetType )
                {
                    centaurHandle = getConnectedChild( l_dumpHandle,
                                                       TYPE_MEMBUF, 0 );
                }
                else if ( TYPE_MBA == l_targetType )
                {
                    centaurHandle = getConnectedParent( l_dumpHandle,
                                                        TYPE_MEMBUF );
                }

                if (centaurHandle)
                {
                    int32_t l_rc = PRDF_RUNTIME_DECONFIG(centaurHandle);
                    if ( SUCCESS != l_rc )
                    {
                        PRDF_ERR( PRDF_FUNC"runtime deconfig failed 0x%08x",
                                  pfaData.MsDumpInfo.DumpId );
                    }
                    // No unit dump for Centaur checkstop
                }
            }
            else
            {
                int32_t l_rc = PRDF_RUNTIME_DECONFIG( l_dumpHandle );
                if ( SUCCESS == l_rc )
                {
                    // Call Dump for Proc Core CS
                    if ( TYPE_CORE == l_targetType )
                    {
                        l_rc = PRDF_HWUDUMP( errLog,
                                             CONTENT_SINGLE_CORE_CHECKSTOP,
                                             pfaData.MsDumpInfo.DumpId );
                    }
                    // FIXME: Will need to add Centaur DMI channel checkstop
                    //        support later.
                    else
                    {
                        PRDF_ERR( PRDF_FUNC"Unsupported dump for target 0x%08x",
                                  pfaData.MsDumpInfo.DumpId );
                    }
                }
            }
        }

        // Commit the Error log
        // Need to move below here since we'll need
        // to pass errLog to PRDF_HWUDUMP
        // for FSP specific SRC handling in the future
#ifndef __HOSTBOOT_MODULE
        MnfgTrace(esig);
#endif

        PRDF_GET_PLID(errLog, dumpPlid);

        bool l_sysTerm = false;
        PRDF_HW_COMMIT_ERRL(l_sysTerm,
                            errLog,
                            deconfigSched,
                            actionFlag,
                            HWSV::HWSV_CONTINUE);
        if(true == l_sysTerm) // if sysTerm then we have to commit and delete the log
        {
            //Just commit the log
            uint32_t l_rc = 0;
            PRDF_GET_RC(errLog, l_rc);

            uint16_t l_reasonCode = 0;
            PRDF_GET_REASONCODE(errLog, l_reasonCode);

            PRDF_INF( PRDF_FUNC"committing error log: PLID=%.8X, ReasonCode=%.8X, RC=%.8X, actions=%.4X",
                      dumpPlid,
                      l_reasonCode,
                      l_rc, actionFlag );
            PRDF_COMMIT_ERRL(errLog, actionFlag);
        }
        else
        {
            // Error log has been committed, return NULL Error Log to PrdMain
            errLog = NULL;
        }

    }
    // If the Error Log is not committed (as due to a Terminate condtion),
    // the Error Log will be returned to PRDMain
    else
    {

#ifndef __HOSTBOOT_MODULE
        MnfgTrace(esig);
#endif

        PRDF_DTRAC( PRDF_FUNC"generating a terminating, or MP Fatal SRC" );
        if (ForceTerminate && sdc.IsThermalEvent() ) //MP42 a  Start
        {  //For Manufacturing Mode terminate, change the severity in
           //the error log to be Predictive for Thermal Event.
            errLog->setSev(ERRL_SEV_PREDICTIVE);
        }
    }

#ifndef __HOSTBOOT_MODULE
    errlHndl_t reg_errl = UtilReg::read ("prdf/RasServices", &sdcSaveFlags, sz_uint8);
    if (reg_errl)
    {
        PRDF_ERR( PRDF_FUNC"Failure in SDC Sync flag Registry read" );
        PRDF_COMMIT_ERRL(reg_errl, ERRL_ACTION_REPORT);
    }
    else
    {
        //Turn off indicator that there is saved Sdc Analysis info
        sdcSaveFlags &= ( ~SDC_ANALYSIS_SAVE_FLAG );
        reg_errl = UtilReg::write ("prdf/RasServices", &sdcSaveFlags, sz_uint8);
        if (reg_errl)
        {
            PRDF_ERR( PRDF_FUNC"Failure in SDC Sync flag Registry write" );
            PRDF_COMMIT_ERRL(reg_errl, ERRL_ACTION_REPORT);
        }
    }
#endif

    PRDF_INF( PRDF_FUNC"PRD called to analyze an error: 0x%08x 0x%08x",
              esig->getChipId(), esig->getSigId() );

    //##########################################################################
    // Start debug trace output
    //##########################################################################

    switch ( sdc.GetAttentionType() )
    {
        case MACHINE_CHECK:
            PRDF_DTRAC( "PRDTRACE: Attention Type = CHECKSTOP" );   break;
        case RECOVERABLE:
            PRDF_DTRAC( "PRDTRACE: Attention Type = RECOVERABLE" ); break;
        case SPECIAL:
            PRDF_DTRAC( "PRDTRACE: Attention Type = SPECIAL" );     break;
        default:
            PRDF_DTRAC( "PRDTRACE: Attention Type = Unknown" );
    }

    if ( RECOVERABLE == sdc.GetAttentionType() )
    {
        PRDF_DTRAC( "PRDTRACE: Hit Count: 0x%x", sdc.GetHits() );
        PRDF_DTRAC( "PRDTRACE: Threshold at: 0x%x", sdc.GetThreshold() );
        PRDF_DTRAC( "PRDTRACE: Mask id: 0x%x", sdc.GetThresholdMaskId() );
    }

    fspmrulist = sdc.GetMruList();
    for ( SDC_MRU_LIST::iterator i = fspmrulist.begin();
          i < fspmrulist.end(); ++i )
    {
        PRDF_DTRAC( "PRDTRACE: Callout: %x", i->callout.flatten() );

        switch ( i->priority )
        {
            case MRU_LOW:  PRDF_DTRAC( "PRDTRACE:   LOW" );   break;
            case MRU_MEDC: PRDF_DTRAC( "PRDTRACE:   MED_C" ); break;
            case MRU_MEDB: PRDF_DTRAC( "PRDTRACE:   MED_B" ); break;
            case MRU_MEDA: PRDF_DTRAC( "PRDTRACE:   MED_A" ); break;
            case MRU_MED:  PRDF_DTRAC( "PRDTRACE:   MED" );  break;
            case MRU_HIGH: PRDF_DTRAC( "PRDTRACE:   HIGH" );  break;
            default:
                PRDF_DTRAC( "PRDTRACE:   Unknown Priority Value" );
        }

        GardResolution::ErrorType et = sdc.QueryGard();
        switch ( et )
        {
            case GardResolution::NoGard:
                PRDF_DTRAC( "PRDTRACE:   NoGard" );            break;
            case GardResolution::Predictive:
                PRDF_DTRAC( "PRDTRACE:   Predictive" );        break;
            case GardResolution::Uncorrectable:
                PRDF_DTRAC( "PRDTRACE:   Uncorrectable" );     break;
            case GardResolution::Fatal:
                PRDF_DTRAC( "PRDTRACE:   Fatal" );             break;
            case GardResolution::Pending:
                PRDF_DTRAC( "PRDTRACE:   Pending" );           break;
            case GardResolution::CheckStopOnlyGard:
                PRDF_DTRAC( "PRDTRACE:   CheckStopOnlyGard" ); break;
            case GardResolution::DeconfigNoGard:
                PRDF_DTRAC( "PRDTRACE:   DeconfigNoGard" );
        }
    }

    PRDF_DTRAC( "PRDTRACE: Flag Values" );
    if ( sdc.IsSUE() )         PRDF_DTRAC( "PRDTRACE: SUE Flag Set" );
    if ( sdc.IsUERE() )        PRDF_DTRAC( "PRDTRACE: UERE Flag Set" );
    if ( sdc.MaybeCrumb() )    PRDF_DTRAC( "PRDTRACE: Check for PCI Crumb" );
    if ( sdc.IsAtThreshold() ) PRDF_DTRAC( "PRDTRACE: AT_THRESHOLD" );
    if ( sdc.IsDegraded() )    PRDF_DTRAC( "PRDTRACE: Performance is degraded" );

    if ( sdc.IsServiceCall() )
        PRDF_DTRAC( "PRDTRACE: SERVICE REQUIRED" );
    else
        PRDF_DTRAC( "PRDTRACE: SERVICE NOT REQUIRED" );

    if ( sdc.IsMfgTracking() )   PRDF_DTRAC( "PRDTRACE: Track this error" );
    if ( sdc.Terminate() )       PRDF_DTRAC( "PRDTRACE: BRING DOWN MACHINE" );
    if ( sdc.IsLogging() )       PRDF_DTRAC( "PRDTRACE: Create history log entry" );
    if ( sdc.IsFlooding() )      PRDF_DTRAC( "PRDTRACE: Flooding detected" );
    if ( sdc.IsMemorySteered() ) PRDF_DTRAC( "PRDTRACE: Memory steered" );

    PRDF_DEXIT( PRDF_FUNC );

    return errLog;

    #undef PRDF_FUNC
}

// ----------------------------------------------------------------------------

#ifndef __HOSTBOOT_MODULE
void ErrDataService::MnfgTrace(ErrorSignature * l_esig )
{
    char  * MnfgFilename = NULL;
    uint32_t l_size = 0;
    const char * MnfgKey[] = {"fstp/P0_Root"};

    if ( PlatServices::mfgMode() )
    {
        errlHndl_t errorLog = UtilReg::path(MnfgKey, 1, "prdfMfgErrors",
                                            MnfgFilename, l_size);
        if (errorLog == NULL)
        {
            UtilFile l_mfgFile;
            l_mfgFile.Open(MnfgFilename,"a+");

            char l_string[100];
            uint32_t signature = l_esig->getSigId();
            HUID sigChip = l_esig->getChipId();

            // Get Entity Path String
            TargetHandle_t l_ptempHandle = PlatServices::getTarget(sigChip);
            TARGETING::EntityPath path;
            PlatServices::getEntityPath(l_ptempHandle, path,
                                        EntityPath::PATH_PHYSICAL);
            char *epStr = path.toString();
            if (epStr)
            {
                snprintf(l_string, 100, "%s, ", path.toString());
                free(epStr);
            }

            l_mfgFile.write(l_string, strlen(l_string));

            // Write Signature
            snprintf(l_string, 100, "0x%08x, 0x%08x, ", sigChip, signature);
            l_mfgFile.write(l_string, strlen(l_string));

            // Write chip ECID data
            PlatServices::getECIDString(l_ptempHandle, l_string);
            l_mfgFile.write(l_string, strlen(l_string));

            // Write MRU list
            uint32_t n = 0;
            while ( (n < MruListLIMIT )  && (n < pfaData.PfaCalloutCount) )
            {
                snprintf(l_string, 100, " , %08x", pfaData.PfaCalloutList[n].Callout);
                l_mfgFile.write(l_string, strlen(l_string));
                ++n;
            }
            snprintf(l_string, 100, "\n");
            l_mfgFile.write(l_string, 1);

            l_mfgFile.Close();
        }
        else
        {
            PRDF_ERR( "PRDTRACE: MnfgTrace Failure in getting file path" );
            PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT);
        }
    }

    if (MnfgFilename != NULL)
    {  //need to free the pathname
        free(MnfgFilename);
        MnfgFilename = NULL;
    }

    return;

}
#endif // if not __HOSTBOOT_MODULE

// ----------------------------------------------------------------------------

void ErrDataService::AddCapData( CaptureData & i_cd, errlHndl_t i_errHdl)
{
    // As CaptureDataClass has large array inside, allocate it on heap
    CaptureDataClass  *l_CapDataBuf = new CaptureDataClass() ;

    for(uint32_t ii = 0; ii < CaptureDataSize; ++ii)
    {
        l_CapDataBuf->CaptureData[ii] = 0xFF;
    }

    uint32_t thisCapDataSize =  i_cd.Copy( l_CapDataBuf->CaptureData,
                                           CaptureDataSize );

    do
    {
        if( 0 == thisCapDataSize )
        {
            // Nothing to add
            break;
        }

        l_CapDataBuf->PfaCaptureDataSize = htonl( thisCapDataSize );

        thisCapDataSize = thisCapDataSize +
                          sizeof(l_CapDataBuf->PfaCaptureDataSize);

        //Compress the Capture data
        size_t l_compressBufSize =
                PrdfCompressBuffer::compressedBufferMax( thisCapDataSize );

        uint8_t * l_compressCapBuf = new uint8_t[l_compressBufSize];

        PrdfCompressBuffer::compressBuffer( ( ( uint8_t * ) l_CapDataBuf ),
                                            (size_t) thisCapDataSize ,
                                            l_compressCapBuf,
                                            l_compressBufSize);

        //Actual size of compressed data is returned in l_compressBufSize
        //Add the Compressed Capture data to Error Log User Data
        PRDF_ADD_FFDC( i_errHdl, (const char*)l_compressCapBuf,
                       (size_t) l_compressBufSize, ErrlVer2, ErrlCapData_1 );

        delete [] l_compressCapBuf;
        delete l_CapDataBuf;
    }while (0);
}

// ----------------------------------------------------------------------------
#ifndef __HOSTBOOT_MODULE

bool ErrDataService::SdcSave(sdcSaveFlagsEnum i_saveFlag, ServiceDataCollector & i_saveSdc)
{
    #define PRDF_FUNC "SdcRetrieve() "
    errlHndl_t errorLog = NULL;
    bool rc = false;
    uint8_t sdcSaveFlags = SDC_NO_SAVE_FLAGS;
    size_t  sz_uint8    = sizeof(uint8_t);
    const char * UeSdcKeys[]  = {"fstp/P1_Root","prdf/UeSdcDataPath"};
    const char * SueSdcKeys[] = {"fstp/P1_Root","prdf/SueSdcDataPath"};
    char  * SdcFilename = NULL;
    uint32_t l_size = 0;

    do
    {
        //Need path to the File
        if (i_saveFlag == SDC_SAVE_UE_FLAG)
            errorLog = UtilReg::path(UeSdcKeys,2,NULL,SdcFilename,l_size);
        else if (i_saveFlag == SDC_SAVE_SUE_FLAG)
            errorLog = UtilReg::path(SueSdcKeys,2,NULL,SdcFilename,l_size);
        else
        {
            //Should not get here - code error
            PRDF_ERR( PRDF_FUNC"Failure - incorrect SDC save flag" );
            rc = true;
            break;
        }
        if (errorLog)
        {
            PRDF_ERR( PRDF_FUNC"Failure in getting SDC file path" );
            PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT);
            rc = true;
            break;
        }

        rc = SdcWrite(SdcFilename, i_saveSdc);
        if (rc)
        {
            break;
        }

          //Read current sdc state flags from registry
        errorLog = UtilReg::read ("prdf/RasServices", &sdcSaveFlags, sz_uint8);
        if (errorLog)
        {
            PRDF_ERR( PRDF_FUNC"Failure in SDC flag Registry read" );
            PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT);
            rc = true;
            break;
        }

        //Update Sdc registry flag
        sdcSaveFlags = (sdcSaveFlags | i_saveFlag);
        errorLog = UtilReg::write ("prdf/RasServices", &sdcSaveFlags, sz_uint8);
        if (errorLog)
        {
            PRDF_ERR( PRDF_FUNC"Failure in SDC flag Registry write" );
            PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT);
            rc = true;
            break;
        }


    }
    while(0);

    if (SdcFilename != NULL)
    {  //need to free the pathname
        free(SdcFilename);
        SdcFilename = NULL;
    }

    return rc;

    #undef PRDF_FUNC
}

bool ErrDataService::SdcRetrieve(sdcSaveFlagsEnum i_saveFlag, void * o_buffer)
{
    #define PRDF_FUNC "SdcRetrieve() "
    errlHndl_t errorLog = NULL;
    bool rc = false;
    const char * UeSdcKeys[]  = {"fstp/P1_Root","prdf/UeSdcDataPath"};
    const char * SueSdcKeys[] = {"fstp/P1_Root","prdf/SueSdcDataPath"};
    char  * SdcFilename = NULL;
    uint32_t l_size = 0;

    do
    {
        //Need path to the File
        if (i_saveFlag == SDC_SAVE_UE_FLAG)
            errorLog = UtilReg::path(UeSdcKeys,2,NULL,SdcFilename,l_size);
        else if (i_saveFlag == SDC_SAVE_SUE_FLAG)
            errorLog = UtilReg::path(SueSdcKeys,2,NULL,SdcFilename,l_size);
        else
        {
            //Should not get here - code error
            PRDF_ERR(PRDF_FUNC"Failure - incorrect SDC save flag" );
            rc = true;
            break;
        }
        if (errorLog)
        {
            PRDF_ERR( PRDF_FUNC"Failure in getting SDC file path" );
            PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT);
            rc = true;
            break;
        }

        rc = SdcRead (SdcFilename, o_buffer);


    }
    while(0);

    if (SdcFilename != NULL)
    {  //need to free the pathname
        free(SdcFilename);
        SdcFilename = NULL;
    }

    return rc;

    #undef PRDF_FUNC
}

#endif // if not __HOSTBOOT_MODULE

} // End namespace PRDF

/******************************************************************************/
// Servicability tags for PRDF Ras Services.
// They are located here because their position in the code is not relevant.
/******************************************************************************/

    /*@
      * @errortype
      * @reasoncode PRDF_DETECTED_FAIL_HARDWARE
      * @subsys EPUB_PROCESSOR_SUBSYS
      * @subsys EPUB_PROCESSOR_FRU
      * @subsys EPUB_PROCESSOR_CHIP_CACHE
      * @subsys EPUB_PROCESSOR_UNIT
      * @subsys EPUB_PROCESSOR_BUS_CTL
      * @subsys EPUB_MEMORY_SUBSYS
      * @subsys EPUB_MEMORY_CONTROLLER
      * @subsys EPUB_MEMORY_DIMM
      * @subsys EPUB_MEMORY_FRU
      * @subsys EPUB_EXTERNAL_CACHE
      * @subsys EPUB_CEC_HDW_SUBSYS
      * @subsys EPUB_CEC_HDW_CLK_CTL
      * @subsys EPUB_CEC_HDW_TOD_HDW
      * @subsys EPUB_CEC_HDW_SP_PHYP_INTF
      * @subsys EPUB_MISC_SUBSYS
      * @subsys EPUB_MISC_UNKNOWN
      * @subsys EPUB_MISC_INFORMATIONAL
      * @subsys EPUB_FIRMWARE_SUBSYS
      * @subsys EPUB_FIRMWARE_SP
      * @subsys EPUB_FIRMWARE_PHYP
      * @subsys EPUB_FIRMWARE_HMC
      * @subsys EPUB_EXT_ENVIRO_USER
      * @moduleid PRDF_MAIN
      * @userdata1  PRD Chip Signature
      * @userdata2  PRD Attention Type and Cause Attention Type
      * @userdata3  PRD Signature
      * @devdesc CEC hardware failure detected.
      * @procedure  EPUB_PRC_ALL_PROCS
      * @procedure  EPUB_PRC_REBOOT
      */

    /*@
      * @errortype
      * @reasoncode PRDF_DETECTED_FAIL_HARDWARE_PROBABLE
      * @subsys EPUB_PROCESSOR_SUBSYS
      * @subsys EPUB_PROCESSOR_FRU
      * @subsys EPUB_PROCESSOR_CHIP_CACHE
      * @subsys EPUB_PROCESSOR_UNIT
      * @subsys EPUB_PROCESSOR_BUS_CTL
      * @subsys EPUB_MEMORY_SUBSYS
      * @subsys EPUB_MEMORY_CONTROLLER
      * @subsys EPUB_MEMORY_DIMM
      * @subsys EPUB_MEMORY_FRU
      * @subsys EPUB_EXTERNAL_CACHE
      * @subsys EPUB_CEC_HDW_SUBSYS
      * @subsys EPUB_CEC_HDW_CLK_CTL
      * @subsys EPUB_CEC_HDW_TOD_HDW
      * @subsys EPUB_CEC_HDW_SP_PHYP_INTF
      * @subsys EPUB_MISC_SUBSYS
      * @subsys EPUB_MISC_UNKNOWN
      * @subsys EPUB_MISC_INFORMATIONAL
      * @subsys EPUB_FIRMWARE_SUBSYS
      * @subsys EPUB_FIRMWARE_SP
      * @subsys EPUB_FIRMWARE_PHYP
      * @subsys EPUB_FIRMWARE_HMC
      * @subsys EPUB_EXT_ENVIRO_USER
      * @moduleid PRDF_MAIN
      * @userdata1  PRD Chip Signature
      * @userdata2  PRD Attention Type and Cause Attention Type
      * @userdata3  PRD Signature
      * @devdesc CEC hardware failure detected. Cause is most likely hardware,
      *          but there are other callouts including Software or Next Level
      *          Support.
      * @procedure EPUB_PRC_SP_CODE
      * @procedure  EPUB_PRC_PHYP_CODE
      * @procedure  EPUB_PRC_LVL_SUPP
      * @procedure  EPUB_PRC_ALL_PROCS
      * @procedure  EPUB_PRC_REBOOT
      */

    /*@
      * @errortype
      * @reasoncode PRDF_DETECTED_FAIL_SOFTWARE_PROBABLE
      * @subsys EPUB_PROCESSOR_SUBSYS
      * @subsys EPUB_PROCESSOR_FRU
      * @subsys EPUB_PROCESSOR_CHIP_CACHE
      * @subsys EPUB_PROCESSOR_UNIT
      * @subsys EPUB_PROCESSOR_BUS_CTL
      * @subsys EPUB_MEMORY_SUBSYS
      * @subsys EPUB_MEMORY_CONTROLLER
      * @subsys EPUB_MEMORY_DIMM
      * @subsys EPUB_MEMORY_FRU
      * @subsys EPUB_EXTERNAL_CACHE
      * @subsys EPUB_CEC_HDW_SUBSYS
      * @subsys EPUB_CEC_HDW_CLK_CTL
      * @subsys EPUB_CEC_HDW_TOD_HDW
      * @subsys EPUB_CEC_HDW_SP_PHYP_INTF
      * @subsys EPUB_MISC_SUBSYS
      * @subsys EPUB_MISC_UNKNOWN
      * @subsys EPUB_MISC_INFORMATIONAL
      * @subsys EPUB_FIRMWARE_SUBSYS
      * @subsys EPUB_FIRMWARE_SP
      * @subsys EPUB_FIRMWARE_PHYP
      * @subsys EPUB_FIRMWARE_HMC
      * @subsys EPUB_EXT_ENVIRO_USER
      * @moduleid PRDF_MAIN
      * @userdata1  PRD Chip Signature
      * @userdata2  PRD Attention Type and Cause Attention Type
      * @userdata3  PRD Signature
      * @devdesc CEC hardware failure detected. Cause is most likley Software,
      *          but there are also Hardware callouts.
      * @procedure EPUB_PRC_SP_CODE
      * @procedure  EPUB_PRC_PHYP_CODE
      * @procedure  EPUB_PRC_LVL_SUPP
      * @procedure  EPUB_PRC_ALL_PROCS
      * @procedure  EPUB_PRC_REBOOT
      */

    /*@
      * @errortype
      * @reasoncode PRDF_DETECTED_FAIL_SOFTWARE
      * @subsys EPUB_MISC_SUBSYS
      * @subsys EPUB_MISC_UNKNOWN
      * @subsys EPUB_FIRMWARE_SUBSYS
      * @subsys EPUB_FIRMWARE_SP
      * @subsys EPUB_FIRMWARE_PHYP
      * @subsys EPUB_FIRMWARE_HMC
      * @moduleid PRDF_MAIN
      * @userdata1  PRD Chip Signature
      * @userdata2  PRD Attention Type and Cause Attention Type
      * @userdata3  PRD Signature
      * @devdesc CEC hardware failure detected. Cause is most likely Software.
      * @procedure EPUB_PRC_SP_CODE
      * @procedure  EPUB_PRC_PHYP_CODE
      * @procedure  EPUB_PRC_LVL_SUPP
      * @procedure  EPUB_PRC_ALL_PROCS
      * @procedure  EPUB_PRC_REBOOT
      */

OpenPOWER on IntegriCloud