summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/nest_chiplets/nest_chiplets.C
blob: 5f54ae9e01443a33856558e18bf14fbb9d330d57 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hwpf/hwp/nest_chiplets/nest_chiplets.C $              */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2012,2014                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/**
   @file nest_chiplets.C                                                
 *
 *  Support file for IStep: nest_chiplets                                                    
 *   Nest Chiplets
 *
 *  HWP_IGNORE_VERSION_CHECK
 *
 */

/******************************************************************************/
// Includes
/******************************************************************************/
#include    <stdint.h>

#include    <trace/interface.H>
#include    <initservice/taskargs.H>
#include    <errl/errlentry.H>

#include    <hwpisteperror.H>
#include    <errl/errludtarget.H>

#include    <initservice/isteps_trace.H>
#include    <initservice/initserviceif.H>

//  targeting support
#include    <targeting/common/commontargeting.H>
#include    <targeting/common/utilFilter.H>

//  fapi support
#include    <fapi.H>
#include    <fapiPlatHwpInvoker.H>

//  MVPD
#include <devicefw/userif.H>
#include <vpd/mvpdenums.H>


//  --  prototype   includes    --
//  Add any customized routines that you don't want overwritten into
//      "start_clocks_on_nest_chiplets_custom.C" and include 
//      the prototypes here.
//  #include    "nest_chiplets_custom.H"
#include    "nest_chiplets.H"
#include    "proc_start_clocks_chiplets/proc_start_clocks_chiplets.H"
#include    "proc_chiplet_scominit/proc_chiplet_scominit.H"
#include    "proc_chiplet_scominit/proc_xbus_scominit.H"
#include    "proc_chiplet_scominit/proc_abus_scominit.H"
#include    "proc_scomoverride_chiplets/proc_scomoverride_chiplets.H"
#include    "proc_a_x_pci_dmi_pll_setup/proc_a_x_pci_dmi_pll_setup.H"
#include    "proc_a_x_pci_dmi_pll_setup/proc_a_x_pci_dmi_pll_initf.H"
#include    "proc_pcie_scominit/proc_pcie_scominit.H"
#include    "../bus_training/pbusLinkSvc.H"
#include    <fapiHwpExecInitFile.H>
#include    "proc_pcie_slot_power.H"

const char * const PROC_CHIPLET_ABUS_IF = "p8.abus.scom.if";
const char * const PROC_CHIPLET_XBUS_IF = "p8.xbus.scom.if";

namespace   NEST_CHIPLETS
{

using   namespace   ISTEP;
using   namespace   ISTEP_ERROR;
using   namespace   ERRORLOG;
using   namespace   TARGETING;
using   namespace   fapi;

//*****************************************************************************
// wrapper function to call proc_attr_update
//*****************************************************************************
void * call_proc_attr_update( void * io_pArgs )
{
    IStepError l_StepError;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
            "call_proc_attr_update entry" );

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
            "call_proc_attr_update exit" );

    return l_StepError.getErrorHandle();

}
//*****************************************************************************
// wrapper function to call proc_a_x_pci_dmi_pll_initf
//*****************************************************************************
void*    call_proc_a_x_pci_dmi_pll_initf( void    *io_pArgs )
{
    errlHndl_t l_err = NULL;

    IStepError l_StepError;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
            "call_proc_a_x_pci_dmi_pll_initf entry" );

    TARGETING::TargetHandleList l_procTargetList;
    getAllChips(l_procTargetList, TYPE_PROC);

    for ( TargetHandleList::const_iterator
          l_iter = l_procTargetList.begin();
          l_iter != l_procTargetList.end();
          ++l_iter )
    {
        const TARGETING::Target*  l_proc_target = *l_iter;
        const fapi::Target l_fapi_proc_target( TARGET_TYPE_PROC_CHIP,
                            ( const_cast<TARGETING::Target*>(l_proc_target) ) );

        TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                "Running proc_a_x_pci_dmi_pll_initf HWP on "
                "target HUID %.8X", TARGETING::get_huid(l_proc_target));

        bool l_startXbusPll = false;
        bool l_startAbusPll = false;
        bool l_startPCIEPll = false;
        bool l_startDMIPll = false;
        
        TARGETING::TargetHandleList l_xbus;
        getChildChiplets( l_xbus, l_proc_target, TYPE_XBUS );
        if (l_xbus.size() > 0)
        {
            l_startXbusPll = true;
        }

        TARGETING::TargetHandleList l_abus;
        getChildChiplets( l_abus, l_proc_target, TYPE_ABUS );
        if (l_abus.size() > 0)
        {
            l_startAbusPll = true;
        }

        TARGETING::TargetHandleList l_pci;
        getChildChiplets( l_pci, l_proc_target, TYPE_PCI );
        if (l_pci.size() > 0)
        {
            l_startPCIEPll = true;
        }

        TARGETING::TargetHandleList l_mcs;
        getChildChiplets( l_mcs, l_proc_target, TYPE_MCS );
        if (l_mcs.size() > 0)
        {
            l_startDMIPll = true;
        }

        //  call proc_a_x_pci_dmi_pll_initf
        FAPI_INVOKE_HWP(l_err, proc_a_x_pci_dmi_pll_initf,
                        l_fapi_proc_target,
                        l_startXbusPll,   // xbus
                        l_startAbusPll,   // abus
                        l_startPCIEPll,   // pcie
                        l_startDMIPll);   // dmi

        if (l_err)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                      "ERROR 0x%.8X: proc_a_x_pci_dmi_pll_initf"
                      " HWP returns error",
                      l_err->reasonCode());

            // capture the target data in the elog
            ErrlUserDetailsTarget(l_proc_target).addToLog( l_err );

            // Create IStep error log and cross reference to error that occurred
            l_StepError.addErrorDetails( l_err );

            // Commit Error
            errlCommit( l_err, HWPF_COMP_ID );
        }
        else
        {
            TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                       "SUCCESS: proc_a_x_pci_dmi_pll_initf HWP( )" );
        }
    }

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
               "call_proc_a_x_pci_dmi_pll_initf exit" );
    return l_StepError.getErrorHandle();
}

//*****************************************************************************
// wrapper function to call proc_a_x_pci_dmi_pll_setup
//*****************************************************************************
void*    call_proc_a_x_pci_dmi_pll_setup( void    *io_pArgs )
{
    errlHndl_t l_err = NULL;

    IStepError l_StepError;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
            "call_proc_a_x_pci_dmi_pll_setup entry" );

    TARGETING::TargetHandleList l_procTargetList;
    getAllChips(l_procTargetList, TYPE_PROC);

    for (TARGETING::TargetHandleList::const_iterator
         l_cpuIter = l_procTargetList.begin();
         l_cpuIter != l_procTargetList.end();
         ++l_cpuIter)
    {
        const TARGETING::Target* l_proc_target = *l_cpuIter;
        const fapi::Target l_fapi_proc_target( TARGET_TYPE_PROC_CHIP,
                ( const_cast<TARGETING::Target*>(l_proc_target) ) );

        TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                "Running proc_a_x_pci_dmi_pll_setup HWP on "
                "target HUID %.8X", TARGETING::get_huid(l_proc_target));

        bool l_startXbusPll = false;
        bool l_startAbusPll = false;
        bool l_startPCIEPll = false;
        bool l_startDMIPll = false;
        
        TARGETING::TargetHandleList l_xbus;
        getChildChiplets( l_xbus, l_proc_target, TYPE_XBUS );
        if (l_xbus.size() > 0)
        {
            l_startXbusPll = true;
        }

        TARGETING::TargetHandleList l_abus;
        getChildChiplets( l_abus, l_proc_target, TYPE_ABUS );
        if (l_abus.size() > 0)
        {
            l_startAbusPll = true;
        }

        TARGETING::TargetHandleList l_pci;
        getChildChiplets( l_pci, l_proc_target, TYPE_PCI );
        if (l_pci.size() > 0)
        {
            l_startPCIEPll = true;
        }

        TARGETING::TargetHandleList l_mcs;
        getChildChiplets( l_mcs, l_proc_target, TYPE_MCS );
        if (l_mcs.size() > 0)
        {
            l_startDMIPll = true;
        }

        //  call proc_a_x_pci_dmi_pll_setup
        FAPI_INVOKE_HWP(l_err, proc_a_x_pci_dmi_pll_setup,
                        l_fapi_proc_target,
                        l_startXbusPll,   // xbus
                        l_startAbusPll,   // abus
                        l_startPCIEPll,   // pcie
                        l_startDMIPll);   // dmi

        if (l_err)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                      "ERROR 0x%.8X: proc_a_x_pci_dmi_pll_setup"
                      " HWP returns error",
                      l_err->reasonCode());

            // capture the target data in the elog
            ErrlUserDetailsTarget(l_proc_target).addToLog( l_err );

            // Create IStep error log and cross reference to error that occurred
            l_StepError.addErrorDetails( l_err );

            // Commit Error
            errlCommit( l_err, HWPF_COMP_ID );
        }
        else
        {
            TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                       "SUCCESS: proc_a_x_pci_dmi_pll_setup HWP( )" );
        }
    }


#ifdef CONFIG_PCIE_HOTPLUG_CONTROLLER
    //  Loop through all the procs in the system
    //  and run proc_pcie_slot_power to
    //  power off hot plug controller to avoid downstream MEX issues


    for (TargetHandleList::const_iterator
            l_proc_iter = l_procTargetList.begin();
            l_proc_iter != l_procTargetList.end();
            ++l_proc_iter)
    {
        //  make a local copy of the Processor target
        TARGETING::Target* l_pProcTarget = *l_proc_iter;

        TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                    "target HUID %.8X",
                    TARGETING::get_huid(l_pProcTarget));

        fapi::Target l_fapiProcTarget( fapi::TARGET_TYPE_PROC_CHIP,
                                       l_pProcTarget    );

        // Invoke the HWP
        FAPI_INVOKE_HWP(l_err,
                        proc_pcie_slot_power,
                        l_fapiProcTarget,
                        false  );  // turn off
        if (l_err)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                  "ERROR : proc_pcie_hotplug_control",
                  " failed, returning errorlog" );

            // capture the target data in the elog
            ErrlUserDetailsTarget(l_pProcTarget).addToLog( l_err );

            // informational. Don't add to istep error or return error
            l_err->setSev(ERRORLOG::ERRL_SEV_INFORMATIONAL);

            // Commit error log
            errlCommit( l_err, HWPF_COMP_ID );
        }
        else
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
              "SUCCESS : proc_pcie_hotplug_control",
              " completed ok");
        }
    }   // endfor
#endif


    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
               "call_proc_a_x_pci_dmi_pll_setup exit" );

    // end task, returning any errorlogs to IStepDisp
    return l_StepError.getErrorHandle();
}

//******************************************************************************
// customizeChipRegions
//******************************************************************************
errlHndl_t customizeChipRegions(TARGETING::Target* i_procTarget)
{

    errlHndl_t l_err = NULL;
    uint8_t *l_pgData = NULL;

    do{

        size_t l_pgSize = 0;

        // First get the size
        l_err = deviceRead(i_procTarget,
                           NULL,
                           l_pgSize,
                           DEVICE_MVPD_ADDRESS(MVPD::CP00, MVPD::PG));
        if (l_err)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                      "ERROR: deviceRead of MVPD for PG failed (size): "
                      "errorlog PLID=0x%x",
                      l_err->plid());
            break;
        }

        // Now allocate a buffer and read it
        l_pgData = static_cast<uint8_t *>(malloc(l_pgSize));
        l_err = deviceRead(i_procTarget,
                           l_pgData,
                           l_pgSize,
                           DEVICE_MVPD_ADDRESS(MVPD::CP00, MVPD::PG));
        if (l_err)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                      "ERROR: deviceRead of MVPD for PG failed (data): "
                      "errorlog PLID=0x%x",
                      l_err->plid());
            break;
        }

        TRACDBIN(ISTEPS_TRACE::g_trac_isteps_trace,
                 "Binary dump of PG:",l_pgData,l_pgSize);

        static const size_t VPD_CP00_PG_HDR_LENGTH =  01;
        // TODO RTC 47050 : Debate on a max config interface
        static const uint32_t MAX_CHIPLETS_PER_PROC = 32;
        //Starting position of the PG VPD data in ATTR_CHIP_REGIONS_TO_ENABLE
        static const size_t PG_START_POS = ( 64-16-4);

        //prepare the vector to be populated to ATTR_CHIP_REGIONS_TO_ENABLE
        TARGETING::ATTR_CHIP_REGIONS_TO_ENABLE_type l_chipRegionData;
        memset(&l_chipRegionData,0,sizeof(ATTR_CHIP_REGIONS_TO_ENABLE_type));

        //Skip the header
        uint16_t *l_partialGoodUint16=reinterpret_cast<uint16_t*>(
                    &l_pgData[VPD_CP00_PG_HDR_LENGTH]);

        //For customizing the image data, the 16 bit partial good value
        //retrieved for the chiplets ( 32 no. ) , should be set from bit 4..19
        //of the attribute ATTR_CHIP_REGIONS_TO_ENABLE for the processor

        for ( uint32_t l_chipRegionIndex = 0  ;
                l_chipRegionIndex <  MAX_CHIPLETS_PER_PROC ;
                ++l_chipRegionIndex)
        {
            l_chipRegionData[l_chipRegionIndex] =
                l_partialGoodUint16[l_chipRegionIndex];
            l_chipRegionData[l_chipRegionIndex] =
                l_chipRegionData[l_chipRegionIndex]<<PG_START_POS;
        }

        TRACDBIN(ISTEPS_TRACE::g_trac_isteps_trace,
                 "Binary dump of ATTR_CHIP_REGIONS_TO_ENABLE:",
                 l_chipRegionData,sizeof(ATTR_CHIP_REGIONS_TO_ENABLE_type));

        i_procTarget->setAttr<TARGETING::ATTR_CHIP_REGIONS_TO_ENABLE>
            (l_chipRegionData);

    }while(0);

    free(l_pgData);

    return l_err;

}

//*****************************************************************************
// wrapper function to call proc_startclock_chiplets
//*****************************************************************************
void*    call_proc_startclock_chiplets( void    *io_pArgs )
{
    errlHndl_t l_err =   NULL;

    IStepError l_StepError;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
               "call_proc_startclock_chiplets entry" );

    TARGETING::TargetHandleList l_procTargetList;
    getAllChips(l_procTargetList, TYPE_PROC);


    for ( TargetHandleList::const_iterator
          l_iter = l_procTargetList.begin();
          l_iter != l_procTargetList.end();
          ++l_iter )
    {
        const TARGETING::Target*  l_proc_target = *l_iter;
        const fapi::Target l_fapi_proc_target( TARGET_TYPE_PROC_CHIP,
                ( const_cast<TARGETING::Target*>(l_proc_target) ));

        l_err = customizeChipRegions(*l_iter);
        if(l_err)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                      "ERROR 0x%.8X : customizeChipRegions "
                      "returns error",
                      l_err->reasonCode());

            // capture the target data in the elog
            ErrlUserDetailsTarget(l_proc_target).addToLog( l_err );

            // Create IStep error log and cross reference to error that occurred
            l_StepError.addErrorDetails( l_err );

            // Commit Error
            errlCommit( l_err, HWPF_COMP_ID );

            break;
        }

        TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                "Running proc_startclock_chiplets HWP on "
                "target HUID %.8X", TARGETING::get_huid(l_proc_target));

        //  call the HWP with each fapi::Target
        FAPI_INVOKE_HWP(l_err, proc_start_clocks_chiplets,
                        l_fapi_proc_target,
                        true,   // xbus
                        true,   // abus
                        true);  // pcie
        if (l_err)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                      "ERROR 0x%.8X : proc_startclock_chiplets HWP "
                      "returns error",
                       l_err->reasonCode());

            // capture the target data in the elog
            ErrlUserDetailsTarget(l_proc_target).addToLog( l_err );

            // Create IStep error log and cross reference to error that occurred
            l_StepError.addErrorDetails( l_err );

            // Commit Error
            errlCommit( l_err, HWPF_COMP_ID );

        }
        else
        {
            TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                       "SUCCESS :  proc_startclock_chiplets HWP( )" );
        }
    }

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
               "call_proc_startclock_chiplets exit" );

    // end task, returning any errorlogs to IStepDisp
    return l_StepError.getErrorHandle();
}

//******************************************************************************
// wrapper function to call proc_chiplet_scominit
//******************************************************************************
void*    call_proc_chiplet_scominit( void    *io_pArgs )
{
    errlHndl_t l_err = NULL;
    IStepError l_StepError;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                             "call_proc_chiplet_scominit entry" );

    TARGETING::TargetHandleList l_cpuTargetList;
    getAllChips(l_cpuTargetList, TYPE_PROC);

    do
    {
        // If running Sapphire, set sleep enable attribute here so
        // initfile can be run correctly
        if(is_sapphire_load())
        {
            TARGETING::Target* l_sys = NULL;
            TARGETING::targetService().getTopLevelTarget(l_sys);
            assert( l_sys != NULL );
            uint8_t l_sleepEnable = 1;
            l_sys->setAttr<TARGETING::ATTR_PM_SLEEP_ENABLE>(l_sleepEnable);
        }

        // ----------------------------------------------
        // Execute PROC_CHIPLET_SCOMINIT_FBC_IF initfile
        // ----------------------------------------------

        for (TARGETING::TargetHandleList::const_iterator
             l_cpuIter = l_cpuTargetList.begin();
             l_cpuIter != l_cpuTargetList.end();
             ++l_cpuIter)
        {
            const TARGETING::Target* l_cpu_target = *l_cpuIter;
            const fapi::Target l_fapi_proc_target( TARGET_TYPE_PROC_CHIP,
                    ( const_cast<TARGETING::Target*>(l_cpu_target) ) );

            TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                "Running proc_chiplet_scominit HWP on "
                "target HUID %.8X", TARGETING::get_huid(l_cpu_target));

            //  call the HWP with each fapi::Target
            FAPI_INVOKE_HWP(l_err, proc_chiplet_scominit, l_fapi_proc_target);
            if (l_err)
            {
                TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, "ERROR 0x%.8X : "
                 "proc_chiplet_scominit HWP returns error.  target HUID %.8X",
                        l_err->reasonCode(), TARGETING::get_huid(l_cpu_target));

                ErrlUserDetailsTarget(l_cpu_target).addToLog( l_err );

                // Create IStep error log and cross ref to error that occurred
                l_StepError.addErrorDetails( l_err );
                // We want to continue to the next target instead of exiting,
                // Commit the error log and move on
                // Note: Error log should already be deleted and set to NULL
                // after committing
                errlCommit(l_err, HWPF_COMP_ID);
            }
        }

    } while (0);

    return l_StepError.getErrorHandle();
}

//*****************************************************************************
// wrapper function to call proc_xbus_scominit
//******************************************************************************
void* call_proc_xbus_scominit( void    *io_pArgs )
{
    errlHndl_t l_err = NULL;
    IStepError l_StepError;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
        "call_proc_xbus_scominit entry" );

    do
    {
        EDI_EI_INITIALIZATION::TargetPairs_t l_XbusConnections;
        // Note:
        // i_noDuplicate parameter must be set to false because
        // two separate  calls would be needed:
        //    X0 <--> X1
        //    X1 <--> X0
        // only the first target is used to issue SCOMs
        l_err =
        EDI_EI_INITIALIZATION::PbusLinkSvc::getTheInstance().getPbusConnections(
                                          l_XbusConnections, TYPE_XBUS, false);
        if (l_err)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                    "ERROR 0x%.8X : getPbusConnections XBUS returns error",
                    l_err->reasonCode());

            // Create IStep error log and cross reference to error that occurred
            l_StepError.addErrorDetails( l_err );
            // Commit the error log
            // Log should be deleted and set to NULL in errlCommit.
            errlCommit(l_err, HWPF_COMP_ID);

            // Shouldn't continue on this fatal error (no XBUS), break out
            break;
        }

        for (EDI_EI_INITIALIZATION::TargetPairs_t::const_iterator
                        l_itr = l_XbusConnections.begin();
             l_itr != l_XbusConnections.end(); ++l_itr)
        {
            const TARGETING::Target* l_thisXbusTarget = l_itr->first;
            const TARGETING::Target* l_connectedXbusTarget = l_itr->second;

            // Call HW procedure
            TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                "Running proc_xbus_scominit HWP on "
                "This XBUS target %.8X - Connected XBUS target  %.8X",
                TARGETING::get_huid(l_thisXbusTarget),
                TARGETING::get_huid(l_connectedXbusTarget));

             const fapi::Target l_thisXbusFapiTarget(
                       TARGET_TYPE_XBUS_ENDPOINT,
                       (const_cast<TARGETING::Target*>(l_thisXbusTarget)));

             const fapi::Target l_connectedXbusFapiTarget(
                       TARGET_TYPE_XBUS_ENDPOINT,
                       (const_cast<TARGETING::Target*>(l_connectedXbusTarget)));

            FAPI_INVOKE_HWP(l_err, proc_xbus_scominit,
                            l_thisXbusFapiTarget, l_connectedXbusFapiTarget);
            if (l_err)
            {
                TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                    "ERROR 0x%.8X : proc_xbus_scominit HWP returns error. "
                    "This XBUS target %.8X - Connected XBUS target  %.8X",
                    l_err->reasonCode(),
                    TARGETING::get_huid(l_thisXbusTarget),
                    TARGETING::get_huid(l_connectedXbusTarget));

                // capture the target data in the elog
                ErrlUserDetailsTarget(l_thisXbusTarget).addToLog( l_err );
                ErrlUserDetailsTarget(l_connectedXbusTarget).addToLog( l_err );

                // Create IStep error log and cross ref to error that occurred
                l_StepError.addErrorDetails( l_err );
                // We want to continue to the next target instead of exiting,
                // Commit the error log and move on
                // Note: Error log should already be deleted and set to NULL
                // after committing
                errlCommit(l_err, HWPF_COMP_ID);
            }

        }

    } while (0);

    return l_StepError.getErrorHandle();
}

//*****************************************************************************
// wrapper function to call proc_abus_scominit
//******************************************************************************
void* call_proc_abus_scominit( void    *io_pArgs )
{

    errlHndl_t l_err = NULL;
    IStepError l_StepError;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
        "call_proc_abus_scominit entry" );

    TARGETING::TargetHandleList l_cpuTargetList;
    getAllChips(l_cpuTargetList, TYPE_PROC);

    do
    {

        EDI_EI_INITIALIZATION::TargetPairs_t l_AbusConnections;
        // Note:
        // i_noDuplicate parameter must be set to false because
        // two separate  calls would be needed:
        //    A0 <--> A1
        //    A1 <--> A0
        // only the first target is used to issue SCOMs
        l_err =
        EDI_EI_INITIALIZATION::PbusLinkSvc::getTheInstance().getPbusConnections(
                                          l_AbusConnections, TYPE_ABUS, false);
        if (l_err)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                    "ERROR 0x%.8X : getPbusConnections ABUS returns error",
                    l_err->reasonCode());

            // Create IStep error log and cross reference to error that occurred
            l_StepError.addErrorDetails( l_err );

            // Commit the error log
            // Log should be deleted and set to NULL in errlCommit.
            errlCommit(l_err, HWPF_COMP_ID);

            // Shouldn't continue on this fatal error (no ABUS), break out
            break;
        }

        // For each ABUS pair
        for (EDI_EI_INITIALIZATION::TargetPairs_t::iterator 
                l_abusPairIter = l_AbusConnections.begin();
                l_abusPairIter != l_AbusConnections.end();
                ++l_abusPairIter)
        {
            // Make local copies of ABUS targets for ease of use
            TARGETING::Target* l_thisAbusTarget =
                 const_cast<TARGETING::Target*>(l_abusPairIter->first);
            TARGETING::Target* l_connectedAbusTarget =
                 const_cast<TARGETING::Target*>(l_abusPairIter->second);

            // Get this abus fapi taget
            const fapi::Target l_fapi_this_abus_target(
                   TARGET_TYPE_ABUS_ENDPOINT,
                   const_cast<TARGETING::Target*>(l_thisAbusTarget));

            // Get connected abus fapi taget
            const fapi::Target l_fapi_connected_abus_target(
                   TARGET_TYPE_ABUS_ENDPOINT,
                   const_cast<TARGETING::Target*>(l_connectedAbusTarget));

            // Call HW procedure
            TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                "Running proc_abus_scominit HWP on "
                "Abus target HUID %.8X Connected Abus target HUID %.8X",
                TARGETING::get_huid(l_thisAbusTarget),
                TARGETING::get_huid(l_connectedAbusTarget));

            FAPI_INVOKE_HWP(l_err, proc_abus_scominit,
                            l_fapi_this_abus_target,
                            l_fapi_connected_abus_target);
            if (l_err)
            {
                TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                    "ERROR %.8X : proc_abus_scominit HWP returns error. "
                    "Abus target HUID %.8X,  Connected Abus target HUID %.8X",
                    l_err->reasonCode(),
                    TARGETING::get_huid(l_thisAbusTarget),
                    TARGETING::get_huid(l_connectedAbusTarget));

                // capture the target data in the elog
                ErrlUserDetailsTarget(l_thisAbusTarget).addToLog( l_err );
                ErrlUserDetailsTarget(l_connectedAbusTarget).addToLog( l_err );

                // Create IStep error log and cross ref to error that occurred
                l_StepError.addErrorDetails( l_err );
                // We want to continue to the next target instead of exiting,
                // Commit the error log and move on
                // Note: Error log should already be deleted and set to NULL
                // after committing
                errlCommit(l_err, HWPF_COMP_ID);
            }
        } // End abus list loop

    } while (0);

    return l_StepError.getErrorHandle();
}

//******************************************************************************
// _queryIopsToBifurcateAndPhbsToDisable
//******************************************************************************

#ifdef DYNAMIC_BIFURCATION
// Normally a x16 PCIE adapter is driven by one PHB in the processor.
// Some x16 adapters have two logically different devices integrated
// onto the same adapter, each acting as a x8 PCIE endpoint driven by
// its own PHB.  The ability to detect which type of PCIE adapter is
// present and dynamically reconfigure the PCIE langes / PHBs to support
// whatever is present is called 'dynamic bifurcation'.  This feature is
// not officially supported however hooks remain in place to add that
// support easily.  To enable it, define the DYNAMIC_BIFURCATION flag
// and implement the guts of the
// _queryIopsToBifurcateAndPhbsToDisable function.

errlHndl_t _queryIopsToBifurcateAndPhbsToDisable(
    TARGETING::ConstTargetHandle_t const       i_pProcChipTarget,
    BifurcatedIopsContainer&                   o_iopList,
    TARGETING::ATTR_PROC_PCIE_PHB_ACTIVE_type& o_disabledPhbsMask)
{
    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
        ENTER_MRK "_queryIopsToBifurcateAndPhbsToDisable: Proc chip target "
        "HUID = 0x%08X.",
        i_pProcChipTarget ?
            i_pProcChipTarget->getAttr<TARGETING::ATTR_HUID>() : 0);

    errlHndl_t pError = NULL;
    o_iopList.clear();
    o_disabledPhbsMask = 0;

    do {

    // Extension point to return bifurcated IOPs and PHBs to disable.
    // Assuming no extensions are added, the function returns no IOPs to
    // bifurcate and no PHBs to disable

    // If implemented, this function should only return error on software code
    // bug.  Any other condition should result in IOPs not being bifurcated and
    // host taking care of that condition.

    } while(0);

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
        EXIT_MRK "_queryIopsToBifurcateAndPhbsToDisable: EID = 0x%08X, "
        "PLID = 0x%08X, RC = 0x%08X.",
        ERRL_GETEID_SAFE(pError),ERRL_GETPLID_SAFE(pError),
        ERRL_GETRC_SAFE(pError));

    return pError;
}

#endif

//******************************************************************************
// _deconfigPhbsBasedOnPciState
//******************************************************************************

void _deconfigPhbsBasedOnPciState(
    TARGETING::ConstTargetHandle_t const       i_pProcChipTarget,
    TARGETING::ATTR_PROC_PCIE_PHB_ACTIVE_type& io_phbActiveMask)
{
    errlHndl_t pError = NULL;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
        ENTER_MRK "_deconfigPhbsBasedOnPciState: Proc chip target HUID = "
        "0x%08X, PHB active mask = 0x%02X.",
        i_pProcChipTarget ?
            i_pProcChipTarget->getAttr<TARGETING::ATTR_HUID>() : 0,
        io_phbActiveMask);

    // Get proc chip's functional PCI units
    TARGETING::TargetHandleList funcPciList;
    (void)TARGETING::getChildChiplets(
        funcPciList,i_pProcChipTarget,TARGETING::TYPE_PCI);

    // Activate PHB mask bits based on functional PCI units
    TARGETING::ATTR_PROC_PCIE_PHB_ACTIVE_type activePciMask = 0;
    for (TARGETING::TargetHandleList::const_iterator pciItr
            = funcPciList.begin();
         pciItr != funcPciList.end();
         ++pciItr)
    {
        // PCI chip unit to PHB mapping is as follows:
        //
        // PCI-0 => PHB0
        // PCI-1 => PHB1
        // PCI-2 => PHB2
        //
        // Further, io_phbActiveMask and activePciMask are bitmasks whose
        // leftmost bit corresponds to PHB0, followed by bits for PHB1 and PHB2.
        // The remaining bits are ignored.

        // Compensate for the fact that PHB mask bits start on left side of the
        // mask
        const size_t bitsToLeftShift
            = ((sizeof(activePciMask)*BITS_PER_BYTE) - 1);

        // Committing an error here because this would mean a read only
        // attribute was set to a value which should be impossible, the
        // side effect will be that whatever PHB this should really correspond
        // to will not be enabled
        if((*pciItr)->getAttr<TARGETING::ATTR_CHIP_UNIT>() > bitsToLeftShift)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                ERR_MRK "_deconfigPhbsBasedOnPciState> "
                "Code Bug! CHIP_UNIT attribute (%d) for PCI unit with HUID of "
                "0x%08X was larger than max value of %d in "
                "_deconfigPhbsBasedOnPciState().",
                (*pciItr)->getAttr<TARGETING::ATTR_CHIP_UNIT>(),
                (*pciItr)->getAttr<TARGETING::ATTR_HUID>(),
                bitsToLeftShift );
            /*@
             * @errortype
             * @moduleid         ISTEP_DECONFIG_PHBS_BASED_ON_PCI_STATE
             * @reasoncode       ISTEP_TARGET_NULL
             * @userdata1[0:31]  HUID of PCI target with bad ATTR_CHIP_UNIT
             * @userdata1[32:39] ATTR_CHIP_UNIT value
             * @userdata2[40:47] # bits to shift
             * @devdesc          Attribute model inconsistency detected; Cannot
             *                   represent PHB bitmask given the value of the
             *                   PCI target's chip unit attribute.  Continuing
             *                   without PHB enabled
             * @custdesc         A problem isolated to firmware occurred during
             *                   the IPL of the system.
             */
            pError = new ERRORLOG::ErrlEntry(
                ERRORLOG::ERRL_SEV_UNRECOVERABLE,
                ISTEP_DECONFIG_PHBS_BASED_ON_PCI_STATE,
                ISTEP_TARGET_NULL,
                TWO_UINT32_TO_UINT64(
                    (*pciItr)->getAttr<TARGETING::ATTR_HUID>(),
                    TWO_UINT16_TO_UINT32(
                        TWO_UINT8_TO_UINT16(
                            (*pciItr)->getAttr<TARGETING::ATTR_CHIP_UNIT>(),
                            bitsToLeftShift),
                        0)),
                0,
                true);

            ERRORLOG::ErrlUserDetailsTarget(*pciItr).addToLog(pError);
            pError->collectTrace(ISTEP_COMP_NAME);
            errlCommit(pError, ISTEP_COMP_ID);

            continue;
        }

        activePciMask |=
            (1 << (  bitsToLeftShift
                   - (*pciItr)->getAttr<TARGETING::ATTR_CHIP_UNIT>()));
    }

    // Can never enable more PHBs than were supplied as input.  It's conceivable
    // that due to code bug in the chip unit attribute, the unit value
    // corresponds to a non supported PHB.  This masking will also prevent the
    // error from propagating.  There is no way to trap for valid PHBs that are
    // cross-wired vis a vis the chip unit attribute.
    io_phbActiveMask &= activePciMask;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
        EXIT_MRK "_deconfigPhbsBasedOnPciState: io_phbActiveMask = 0x%02X",
        io_phbActiveMask);

    return;
}

//******************************************************************************
// Local logical equality operator for matching lane configuration rows
//******************************************************************************

inline bool operator==(
    const laneConfigRow& i_lhs,
    const laneConfigRow& i_rhs)
{
    return ( memcmp(i_lhs.laneSet,i_rhs.laneSet,sizeof(i_lhs.laneSet)) == 0);
}

//******************************************************************************
// _laneMaskToLaneWidth
//******************************************************************************

LaneWidth _laneMaskToLaneWidth(const uint16_t i_laneMask)
{
    LaneWidth laneWidth = LANE_WIDTH_NC;
    if(i_laneMask == LANE_MASK_X16)
    {
        laneWidth = LANE_WIDTH_16X;
    }
    else if(   (i_laneMask == LANE_MASK_X8_GRP0)
            || (i_laneMask == LANE_MASK_X8_GRP1))
    {
        laneWidth = LANE_WIDTH_8X;
    }

    return laneWidth;
}

//******************************************************************************
// computeProcPcieConfigAttrs
//******************************************************************************

errlHndl_t computeProcPcieConfigAttrs(
    TARGETING::TargetHandle_t const i_pProcChipTarget)
{
    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
        ENTER_MRK "computeProcPcieConfigAttrs: Proc chip target HUID = "
        "0x%08X.",
        i_pProcChipTarget ?
            i_pProcChipTarget->getAttr<TARGETING::ATTR_HUID>() : 0);

    // Currently there are two IOP config tables, one for procs with 24 usable
    // PCIE lanes and one for proces with 32 usable PCIE lanes.  In general, the
    // code accumulates the current configuration of the IOPs from the MRW and
    // other dynamic information (such as bifurcation, etc.), then matches that
    // config to one of the rows in the table.  Once a match is discovered, the
    // IOP config value is pulled from the matching row and set in the
    // attributes.
    const laneConfigRow x24_laneConfigTable[] =
        {{{{{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x0,PHB0_MASK|PHB1_MASK},

         {{{{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_NC,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x0,PHB0_MASK},

         {{{{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x1,PHB0_MASK|PHB1_MASK},

         {{{{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_NC,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x1,PHB0_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x2,PHB0_MASK|PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x3,PHB0_MASK|PHB1_MASK|PHB2_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}},
           {{LANE_WIDTH_NC,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x3,PHB0_MASK|PHB2_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_ENABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x4,PHB0_MASK|PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_ENABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x5,PHB0_MASK|PHB1_MASK},

         {{{{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x6,PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x7,PHB1_MASK|PHB2_MASK},

         {{{{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_8X,DSMP_ENABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x8,PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_8X,DSMP_ENABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x9,PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0xA,PHB2_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_ENABLE}},
           {{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0xB,PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0xC,PHB1_MASK|PHB2_MASK},
        };

    const laneConfigRow* x24_end = x24_laneConfigTable +
        (  sizeof(x24_laneConfigTable)
         / sizeof(x24_laneConfigTable[0]));

    const laneConfigRow x32_laneConfigTable[] =
        {{{{{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x0,PHB0_MASK|PHB1_MASK},

         {{{{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}}},
             0x1,PHB0_MASK|PHB1_MASK|PHB2_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x2,PHB0_MASK|PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}}},
             0x3,PHB0_MASK|PHB1_MASK|PHB2_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_ENABLE}},
           {{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x4,PHB0_MASK|PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_ENABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}}},
             0x5,PHB0_MASK|PHB1_MASK|PHB2_MASK},

         {{{{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}},
           {{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x6,PHB0_MASK|PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}}},
             0x7,PHB0_MASK|PHB1_MASK|PHB2_MASK},

         {{{{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_8X,DSMP_ENABLE}},
           {{LANE_WIDTH_16X,DSMP_DISABLE},
            {LANE_WIDTH_NC,DSMP_DISABLE}}},
             0x8,PHB1_MASK},

         {{{{LANE_WIDTH_8X,DSMP_ENABLE},
            {LANE_WIDTH_8X,DSMP_ENABLE}},
           {{LANE_WIDTH_8X,DSMP_DISABLE},
            {LANE_WIDTH_8X,DSMP_DISABLE}}},
             0x9,PHB1_MASK|PHB2_MASK},
        };

    const laneConfigRow* x32_end = x32_laneConfigTable +
        (  sizeof(x32_laneConfigTable)
         / sizeof(x32_laneConfigTable[0]));

    errlHndl_t pError = NULL;
    const laneConfigRow* pLaneConfigTableBegin = NULL;
    const laneConfigRow* pLaneConfigTableEnd = NULL;

    do
    {
        if(i_pProcChipTarget == NULL)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                ERR_MRK "computeProcPcieConfigAttrs> "
                "Code bug! Input processor target is NULL");

            /*@
             * @errortype
             * @moduleid    ISTEP_COMPUTE_PCIE_CONFIG_ATTRS
             * @reasoncode  ISTEP_TARGET_NULL
             * @devdesc     Caller passed a NULL processor target
             * @custdesc    A problem isolated to firmware occurred during the
             *              IPL of the system.
             */
            pError = new ERRORLOG::ErrlEntry(
                ERRORLOG::ERRL_SEV_UNRECOVERABLE,
                ISTEP_COMPUTE_PCIE_CONFIG_ATTRS,
                ISTEP_TARGET_NULL,
                0,
                0,
                true);
            pError->collectTrace(ISTEP_COMP_NAME);
            break;
        }

        const TARGETING::ATTR_CLASS_type targetClass
            = i_pProcChipTarget->getAttr<TARGETING::ATTR_CLASS>();
        const TARGETING::ATTR_TYPE_type targetType
            = i_pProcChipTarget->getAttr<TARGETING::ATTR_TYPE>();
        const bool targetPresent =
            i_pProcChipTarget->getAttr<TARGETING::ATTR_HWAS_STATE>()
                .present;

        if(   (targetClass != TARGETING::CLASS_CHIP)
           || (targetType != TARGETING::TYPE_PROC)
           || (!targetPresent))
        {
            const TARGETING::ATTR_HUID_type targetHuid
                = i_pProcChipTarget->getAttr<TARGETING::ATTR_HUID>();

            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                ERR_MRK "computeProcPcieConfigAttrs> Code bug!"
                "Input target is not a processor chip or is not present.  "
                "Class = 0x%08X, "
                "Type = 0x%08X, HUID = 0x%08X, Present? = %d",
                targetClass,targetType,
                targetHuid,
                targetPresent);

            /*@
             * @errortype
             * @moduleid         ISTEP_COMPUTE_PCIE_CONFIG_ATTRS
             * @reasoncode       ISTEP_INVALID_TARGET_TYPE
             * @userdata1[0:31]  Illegal target's class
             * @userdata1[32:63] Illegal target's type
             * @userdata2[0:31]  Illegal target's HUID
             * @userdata2[32:63] Illegal target's presence (0=no, 1=yes)
             * @devdesc          Caller passed a non-processor chip target or
             *                   passed a processor chip target that was not
             *                   present
             * @custdesc         A problem isolated to firmware occurred during
             *                   the IPL of the system.
             */
            pError = new ERRORLOG::ErrlEntry(
                ERRORLOG::ERRL_SEV_UNRECOVERABLE,
                ISTEP_COMPUTE_PCIE_CONFIG_ATTRS,
                ISTEP_INVALID_TARGET_TYPE,
                TWO_UINT32_TO_UINT64(
                    targetClass,targetType),
                TWO_UINT32_TO_UINT64(
                    targetHuid,targetPresent),
                true);
            ERRORLOG::ErrlUserDetailsTarget(i_pProcChipTarget).addToLog(pError);
            pError->collectTrace(ISTEP_COMP_NAME);
            break;
        }

        // Pick the appropriate IOP configuration table
        if(   i_pProcChipTarget->getAttr<TARGETING::ATTR_IOP_LANES_PER_PROC>()
           == IOP_LANES_PER_PROC_32X)
        {
            pLaneConfigTableBegin = x32_laneConfigTable;
            pLaneConfigTableEnd = x32_end;
        }
        else if(   i_pProcChipTarget->getAttr<
                       TARGETING::ATTR_IOP_LANES_PER_PROC>()
                == IOP_LANES_PER_PROC_24X)
        {
            pLaneConfigTableBegin = x24_laneConfigTable;
            pLaneConfigTableEnd = x24_end;
        }
        else
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                ERR_MRK "computeProcPcieConfigAttrs> "
                "Code bug! Unsupported ATTR_IOP_LANES_PER_PROC attribute for "
                "processor with HUID of 0x%08X.  Expected 24 or 32, but read "
                "value of %d.",
                i_pProcChipTarget->getAttr<TARGETING::ATTR_HUID>(),
                i_pProcChipTarget->getAttr<
                    TARGETING::ATTR_IOP_LANES_PER_PROC>());

            /*@
             * @errortype
             * @moduleid         ISTEP_COMPUTE_PCIE_CONFIG_ATTRS
             * @reasoncode       ISTEP_INVALID_ATTR_VALUE
             * @userdata1[0:31]  Target's HUID
             * @userdata2[32:63] ATTR_IOP_LANES_PER_PROC attribute value
             * @devdesc          Illegal ATTR_IOP_LANES_PER_PROC attribute read
             *                   from a processor chip target.
             * @custdesc         A problem isolated to firmware or firmware
             *                   customization occurred during the IPL of the
             *                   system.
             */
            pError = new ERRORLOG::ErrlEntry(
                ERRORLOG::ERRL_SEV_UNRECOVERABLE,
                ISTEP_COMPUTE_PCIE_CONFIG_ATTRS,
                ISTEP_INVALID_ATTR_VALUE,
                TWO_UINT32_TO_UINT64(
                    i_pProcChipTarget->getAttr<TARGETING::ATTR_HUID>(),
                    i_pProcChipTarget->getAttr<
                        TARGETING::ATTR_IOP_LANES_PER_PROC>()),
                0,
                true);
            ERRORLOG::ErrlUserDetailsTarget(i_pProcChipTarget).addToLog(pError);
            pError->collectTrace(ISTEP_COMP_NAME);
            break;
        }

        TARGETING::ATTR_PROC_PCIE_PHB_ACTIVE_type disabledPhbs = 0;

#ifdef DYNAMIC_BIFURCATION

        // Figure out which IOPs need bifurcation, and as a result, which PHBs
        // to disable
        BifurcatedIopsContainer iopList;
        pError = _queryIopsToBifurcateAndPhbsToDisable(
            i_pProcChipTarget,
            iopList,
            disabledPhbs);
        if(pError!=NULL)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                ERR_MRK "computeProcPcieConfigAttrs> "
                "Failed in call to _queryIopsToBifurcateAndPhbsToDisable; "
                "Proc HUID = 0x%08X.",
                i_pProcChipTarget->getAttr<TARGETING::ATTR_HUID>());
            break;
        }
#endif

        // Arrays require all try[Get|Set]Attr API calls in order to be able to
        // read them properly.  All attributes should exist, so assert if they
        // do not.
        TARGETING::ATTR_PROC_PCIE_LANE_MASK_NON_BIFURCATED_type
            laneMaskNonBifurcated = {{0}};
        assert(i_pProcChipTarget->tryGetAttr<
            TARGETING::ATTR_PROC_PCIE_LANE_MASK_NON_BIFURCATED>(
                laneMaskNonBifurcated));

        TARGETING::ATTR_PROC_PCIE_IOP_REVERSAL_NON_BIFURCATED_type
            laneReversalNonBifrucated = {{0}};
        assert(i_pProcChipTarget->tryGetAttr<
            TARGETING::ATTR_PROC_PCIE_IOP_REVERSAL_NON_BIFURCATED>(
                laneReversalNonBifrucated));

        TARGETING::ATTR_PROC_PCIE_IOP_SWAP_NON_BIFURCATED_type
            laneSwapNonBifurcated = {{0}};
        assert(i_pProcChipTarget->tryGetAttr<
            TARGETING::ATTR_PROC_PCIE_IOP_SWAP_NON_BIFURCATED>(
                laneSwapNonBifurcated));

        TARGETING::ATTR_PROC_PCIE_LANE_MASK_type
            effectiveLaneMask = {{0}};
        memcpy(effectiveLaneMask,laneMaskNonBifurcated,
            sizeof(effectiveLaneMask));

        TARGETING::ATTR_PROC_PCIE_IOP_REVERSAL_type
            effectiveLaneReversal = {{0}};
        memcpy(effectiveLaneReversal,laneReversalNonBifrucated,
            sizeof(effectiveLaneReversal));

        TARGETING::ATTR_PROC_PCIE_IOP_SWAP_type
            effectiveLaneSwap = {0};

        // Apply the non-bifurcated lane swap
        for(size_t iop = 0; iop<MAX_IOPS_PER_PROC; ++iop)
        {
            uint8_t laneSwap = 0;
            for(size_t laneGroup = 0;
                laneGroup <
                    (sizeof(laneSwapNonBifurcated)/sizeof(effectiveLaneSwap));
                ++laneGroup)
            {
                // If lanes are used and swap not yet set, then set it
                if(   (effectiveLaneMask[iop][laneGroup])
                   && (!laneSwap))
                {
                    laneSwap =
                        laneSwapNonBifurcated[iop][laneGroup];
                }
            }
            effectiveLaneSwap[iop] = laneSwap;
        }

#ifdef DYNAMIC_BIFURCATION

        TARGETING::ATTR_PROC_PCIE_LANE_MASK_BIFURCATED_type
            laneMaskBifurcated = {{0}};
        assert(i_pProcChipTarget->tryGetAttr<
            TARGETING::ATTR_PROC_PCIE_LANE_MASK_BIFURCATED>(
                laneMaskBifurcated));

        TARGETING::ATTR_PROC_PCIE_IOP_REVERSAL_BIFURCATED_type
            laneReversalBifurcated = {{0}};
        assert(i_pProcChipTarget->tryGetAttr<
            TARGETING::ATTR_PROC_PCIE_IOP_REVERSAL_BIFURCATED>(
                laneReversalBifurcated));

        TARGETING::ATTR_PROC_PCIE_IOP_SWAP_BIFURCATED_type
            bifurcatedSwap = {{0}};
        assert(i_pProcChipTarget->tryGetAttr<
            TARGETING::ATTR_PROC_PCIE_IOP_SWAP_BIFURCATED>(
                bifurcatedSwap));

        // Apply any IOP bifurcation settings
        for(BifurcatedIopsContainer::const_iterator iopItr = iopList.begin();
            iopItr != iopList.end();
            ++iopItr)
        {
            BifurcatedIopsContainer::const_reference iop = *iopItr;
            memcpy(
                &effectiveLaneReversal[iop][0],
                &laneReversalBifurcated[iop][0],
                sizeof(effectiveLaneReversal)/MAX_IOPS_PER_PROC);

            memcpy(
                &effectiveLaneMask[iop][0],
                &laneMaskBifurcated[iop][0],
                sizeof(effectiveLaneMask)/MAX_IOPS_PER_PROC);

            uint8_t laneSwap = 0;
            for(size_t laneGroup=0;
                laneGroup <
                    (sizeof(bifurcatedSwap)/sizeof(effectiveLaneSwap));
                ++laneGroup)
            {
                // If lanes are used and swap not yet set, then set it
                if(   (effectiveLaneMask[iop][laneGroup])
                   && (!laneSwap))
                {
                    laneSwap =
                        bifurcatedSwap[iop][laneGroup];
                }
            }
            effectiveLaneSwap[iop] = laneSwap;
        }
#endif

        i_pProcChipTarget->setAttr<
            TARGETING::ATTR_PROC_PCIE_LANE_MASK>(effectiveLaneMask);

        i_pProcChipTarget->setAttr<
            TARGETING::ATTR_PROC_PCIE_IOP_REVERSAL>(effectiveLaneReversal);

        i_pProcChipTarget->setAttr<
            TARGETING::ATTR_PROC_PCIE_IOP_SWAP>(effectiveLaneSwap);

        TARGETING::ATTR_PROC_PCIE_DSMP_CAPABLE_type
            dsmpCapable = {{0}};
        assert(i_pProcChipTarget->tryGetAttr<
            TARGETING::ATTR_PROC_PCIE_DSMP_CAPABLE>(dsmpCapable));

        TARGETING::ATTR_PROC_PCIE_PHB_ACTIVE_type phbActiveMask = 0;
        TARGETING::ATTR_PROC_PCIE_IOP_CONFIG_type iopConfig = 0;

        laneConfigRow effectiveConfig =
            {{{{LANE_WIDTH_NC,DSMP_DISABLE},
                {LANE_WIDTH_NC,DSMP_DISABLE}},
               {{LANE_WIDTH_NC,DSMP_DISABLE},
                {LANE_WIDTH_NC,DSMP_DISABLE}}},
               0x0,PHB_MASK_NA};

        // Transform effective config to match lane config table format
        for(size_t iop = 0;
            iop < MAX_IOPS_PER_PROC;
            ++iop)
        {
            for(size_t laneGroup = 0;
                laneGroup < MAX_LANE_GROUPS_PER_IOP;
                ++laneGroup)
            {
                effectiveConfig.laneSet[iop][laneGroup].width
                    = _laneMaskToLaneWidth(effectiveLaneMask[iop][laneGroup]);
                effectiveConfig.laneSet[iop][laneGroup].dsmp
                    = dsmpCapable[iop][laneGroup];
            }
        }

        const laneConfigRow* laneConfigItr =
            std::find(
                pLaneConfigTableBegin,
                pLaneConfigTableEnd,
                effectiveConfig);

        if(laneConfigItr != pLaneConfigTableEnd)
        {
            iopConfig = laneConfigItr->laneConfig;
            phbActiveMask = laneConfigItr->phbActive;

            // Disable applicable PHBs
            phbActiveMask &= (~disabledPhbs);
            (void)_deconfigPhbsBasedOnPciState(
                i_pProcChipTarget,
                phbActiveMask);
        }
        else
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                ERR_MRK "computeProcPcieConfigAttrs> "
                "Code bug! Proc PCIE IOP configuration not found.  Continuing "
                "with no PHBs active.  "
                "IOP0 Lane set 0: Lane mask = 0x%04X, DSMP enable = 0x%02X.  "
                "IOP0 Lane set 1: Lane mask = 0x%04X, DSMP enable = 0x%02X.  ",
                effectiveLaneMask[0][0],dsmpCapable[0][0],
                effectiveLaneMask[0][1],dsmpCapable[0][1]);
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                "IOP1 Lane set 0: Lane mask = 0x%04X, DSMP enable = 0x%02X.  "
                "IOP1 Lane set 1: Lane mask = 0x%04X, DSMP enable = 0x%02X.  ",
                effectiveLaneMask[1][0],dsmpCapable[1][0],
                effectiveLaneMask[1][1],dsmpCapable[1][1]);
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                "Proc chip target HUID = 0x%08X.",
                i_pProcChipTarget->getAttr<TARGETING::ATTR_HUID>());
            /*@
             * @errortype
             * @moduleid         ISTEP_COMPUTE_PCIE_CONFIG_ATTRS
             * @reasoncode       ISTEP_INVALID_CONFIGURATION
             * @userdata1[0:31]  Target processor chip's HUID
             * @userdata1[32:39] IOP 0 lane set 0 DSMP enable
             * @userdata1[40:47] IOP 0 lane set 1 DSMP enable
             * @userdata1[48:55] IOP 1 lane set 0 DSMP enable
             * @userdata1[56:63] IOP 1 lane set 1 DSMP enable
             * @userdata2[0:15]  IOP 0 lane set 0 lane mask
             * @userdata2[16:31] IOP 0 lane set 1 lane mask
             * @userdata2[32:47] IOP 1 lane set 0 lane mask
             * @userdata2[48:63] IOP 1 lane set 1 lane mask
             * @devdesc          No valid PCIE IOP configuration found.  All
             *                   PHBs on the processor will be disabled.
             * @custdesc         A problem isolated to firmware or firmware
             *                   customization occurred during the IPL of the
             *                   system.
             */
            pError = new ERRORLOG::ErrlEntry(
                ERRORLOG::ERRL_SEV_UNRECOVERABLE,
                ISTEP_COMPUTE_PCIE_CONFIG_ATTRS,
                ISTEP_INVALID_CONFIGURATION,
                TWO_UINT32_TO_UINT64(
                    i_pProcChipTarget->getAttr<TARGETING::ATTR_HUID>(),
                    FOUR_UINT8_TO_UINT32(
                        dsmpCapable[0][0],
                        dsmpCapable[0][1],
                        dsmpCapable[1][0],
                        dsmpCapable[1][1])),
                FOUR_UINT16_TO_UINT64(
                    effectiveLaneMask[0][0],
                    effectiveLaneMask[0][1],
                    effectiveLaneMask[1][0],
                    effectiveLaneMask[1][1]),
                true);
            ERRORLOG::ErrlUserDetailsTarget(i_pProcChipTarget).addToLog(pError);
            pError->collectTrace(ISTEP_COMP_NAME);
            errlCommit(pError, ISTEP_COMP_ID);
        }

        i_pProcChipTarget->setAttr<
            TARGETING::ATTR_PROC_PCIE_PHB_ACTIVE>(phbActiveMask);
        i_pProcChipTarget->setAttr<
            TARGETING::ATTR_PROC_PCIE_IOP_CONFIG>(iopConfig);

    } while(0);

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
        EXIT_MRK "computeProcPcieConfigAttrs: EID = 0x%08X, PLID = 0x%08X, "
        "RC = 0x%08X.",
        ERRL_GETEID_SAFE(pError),ERRL_GETPLID_SAFE(pError),
        ERRL_GETRC_SAFE(pError));

    return pError;
}

//*****************************************************************************
// wrapper function to call proc_pcie_scominit
//******************************************************************************
void*    call_proc_pcie_scominit( void    *io_pArgs )
{
    errlHndl_t          l_errl      =   NULL;
    IStepError          l_StepError;

    bool spBaseServicesEnabled = INITSERVICE::spBaseServicesEnabled();

    TARGETING::TargetHandleList l_procTargetList;
    getAllChips(l_procTargetList, TYPE_PROC);

    for ( TargetHandleList::const_iterator
          l_iter = l_procTargetList.begin();
          l_iter != l_procTargetList.end();
          ++l_iter )
    {
        TARGETING::Target* const l_proc_target = *l_iter;

        // Compute the PCIE attribute config on all non-SP systems, since SP
        // won't be there to do it.
        if(!spBaseServicesEnabled)
        {
            // Unlike SP which operates on all present procs, the SP-less
            // algorithm only needs to operate on functional ones
            l_errl = computeProcPcieConfigAttrs(l_proc_target);
            if(l_errl != NULL)
            {
                // Any failure to configure PCIE that makes it to this handler
                // implies a firmware bug that should be fixed, everything else
                // is tolerated internally (usually as disabled PHBs)
                TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                    ERR_MRK "call_proc_pcie_scominit> Failed in call to "
                    "computeProcPcieConfigAttrs for target with HUID = "
                    "0x%08X",
                    l_proc_target->getAttr<TARGETING::ATTR_HUID>());
                l_StepError.addErrorDetails(l_errl);
                errlCommit( l_errl, ISTEP_COMP_ID );
            }
        }

        const fapi::Target l_fapi_proc_target( TARGET_TYPE_PROC_CHIP,
                ( const_cast<TARGETING::Target*>(l_proc_target) ));

        TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                "Running proc_pcie_scominit HWP on "
                "target HUID %.8X", TARGETING::get_huid(l_proc_target));

        //  call the HWP with each fapi::Target
        FAPI_INVOKE_HWP(l_errl, proc_pcie_scominit, l_fapi_proc_target);

        if (l_errl)
        {
            TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                      "ERROR 0x%.8X : proc_pcie_scominit HWP returns error",
                      l_errl->reasonCode());

            // capture the target data in the elog
            ErrlUserDetailsTarget(l_proc_target).addToLog( l_errl );

            // Create IStep error log and cross reference to error that occurred
            l_StepError.addErrorDetails( l_errl );

            // Commit Error
            errlCommit( l_errl, HWPF_COMP_ID );

        }
        else
        {
            TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                   "SUCCESS :  proc_pcie_scominit HWP" );
        }
    }

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                            "call_proc_pcie_scominit exit" );

    // end task, returning any errorlogs to IStepDisp 
    return l_StepError.getErrorHandle();
}

//*****************************************************************************
// wrapper function to call proc_scomoverride_chiplets
//*****************************************************************************
void*    call_proc_scomoverride_chiplets( void    *io_pArgs )
{
    errlHndl_t          l_errl      =   NULL;

    IStepError          l_StepError;

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
                    "call_proc_scomoverride_chiplets entry" );

    FAPI_INVOKE_HWP(l_errl, proc_scomoverride_chiplets);

    if (l_errl)
    {
        TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                  "ERROR 0x%.8X : proc_scomoverride_chiplets "
                  "HWP returns error",
                  l_errl->reasonCode());

            // Create IStep error log and cross reference to error that occurred
            l_StepError.addErrorDetails( l_errl );

            // Commit Error
            errlCommit( l_errl, HWPF_COMP_ID );
    }
    else
    {
        TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
                  "SUCCESS :  proc_scomoverride_chiplets HWP");
    }

    TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
               "call_proc_scomoverride_chiplets exit" );

    // end task, returning any errorlogs to IStepDisp
    return l_StepError.getErrorHandle();
}


};   // end namespace
OpenPOWER on IntegriCloud