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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/hdat/hdatiplparms.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
/* implied. See the License for the specific language governing */
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
/**
* @file hdatiplparms.C
*
* @brief This file contains the implementation of the HdatIplParms class.
*
*/
/*------------------------------------------------------------------------*/
/* Includes */
/*------------------------------------------------------------------------*/
#include <ctype.h> // endian testing
#include "hdatiplparms.H" // HdatIplParms class definition
#include <attributeenums.H>
#include "hdatutil.H"
#include <sys/mm.h>
#include <sys/mmio.h>
#include <vpd/mvpdenums.H>
#include <pnor/pnorif.H>
#include <util/align.H>
#include <arch/pvrformat.H>
#include <devicefw/userif.H>
#include <targeting/common/util.H>
using namespace TARGETING;
namespace HDAT
{
extern trace_desc_t *g_trac_hdat;
/*------------------------------------------------------------------------*/
/* Constants */
/*------------------------------------------------------------------------*/
/**
* @brief This routine checks if a certain manufacturing flag is set
*
* @pre None
*
* @post None
*
* @param i_flag - input parameter - Specific mnfg flag to check
*
* @return true : The specified mnfg flag is set
* false : The specified mnfg flag is not set
*
* @retval HDAT_OTHER_COMP_ERROR
*/
static bool isMnfgFlagSet( uint32_t i_flag )
{
bool o_rc = false;
TARGETING::ATTR_MNFG_FLAGS_type l_attrValue = 0;
TARGETING::TargetHandle_t l_pTopTarget= NULL;
targetService().getTopLevelTarget(l_pTopTarget);
if(l_pTopTarget)
{
l_attrValue = l_pTopTarget->getAttr<ATTR_MNFG_FLAGS>();
o_rc = l_attrValue & i_flag;
}
else
{
HDAT_ERR("[isMnfgFlagSet] error finding l_pTopTarget");
}
return o_rc;
}
/**
* @brief This routine gets number of cores in each processor
*
* @pre None
*
* @post None
*
* @param o_numCores - output parameter - Number of cores
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
static void hdatGetNumberOfCores(uint32_t &o_numCores)
{
uint8_t l_prData[9];
size_t l_prDataSz = 8;
errlHndl_t l_err = NULL;
o_numCores = 0;
TARGETING::PredicateCTM l_procChipPredicate(TARGETING::CLASS_CHIP,
TARGETING::TYPE_PROC);
TARGETING::PredicateHwas l_predHwas;
l_predHwas.present(true);
TARGETING::PredicatePostfixExpr l_presentProc;
l_presentProc.push(&l_procChipPredicate).push(&l_predHwas).And();
TARGETING::TargetRangeFilter l_procFilter(
TARGETING::targetService().begin(),
TARGETING::targetService().end(),
&l_presentProc);
TARGETING::Target *l_procTarget = (*l_procFilter);
l_err = deviceRead(l_procTarget,l_prData,l_prDataSz,
DEVICE_MVPD_ADDRESS(MVPD::VINI,MVPD::PR));
if(l_err)
{
HDAT_ERR("Error during VPD PR keyword read");
}
else
{
o_numCores = l_prData[2] >> 4;
HDAT_DBG("Number of Cores: %d",o_numCores);
}
}
/**
* @brief This routine gets the information for Enlarged IO Slot Count
*
* @pre None
*
* @post None
*
* @param o_EnlargedSlotCount - output parameter - Enlarged IO Slot Count for
* all nodes
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
static void hdatGetEnlargedIOCapacity(uint32_t &o_EnlargedSlotCount)
{
TARGETING::PredicateCTM l_nodePredicate(TARGETING::CLASS_ENC,
TARGETING::TYPE_NODE);
TARGETING::PredicateHwas l_predHwas;
l_predHwas.present(true);
TARGETING::PredicatePostfixExpr l_presentNode;
l_presentNode.push(&l_nodePredicate).push(&l_predHwas).And();
TARGETING::TargetRangeFilter l_nodeFilter(
TARGETING::targetService().begin(),
TARGETING::targetService().end(),
&l_presentNode);
o_EnlargedSlotCount = 0;
uint8_t l_nodeindex = 3;
for (;l_nodeFilter;++l_nodeFilter)
{
TARGETING::Target *l_nodeTarget = (*l_nodeFilter);
TARGETING::ATTR_ENLARGED_IO_SLOT_COUNT_type l_enlargedIOSlotCount;
if(l_nodeTarget->tryGetAttr<TARGETING::ATTR_ENLARGED_IO_SLOT_COUNT>
(l_enlargedIOSlotCount))
{
o_EnlargedSlotCount |= (uint32_t)l_enlargedIOSlotCount <<
(8 * l_nodeindex);
}
else
{
HDAT_ERR("Error in getting ENLARGED_IO_SLOT_COUNT attribute");
}
l_nodeindex--;
}
}
/**
* @brief This routine gets the information for IPL Parameters
*
* @pre None
*
* @post None
*
* @param o_hdatOTA - output parameter - The structure to update with the
* other IPL attributes
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
static void hdatPopulateOtherIPLAttributes(hdatOtherIPLAttributes_t &o_hdatOTA)
{
TARGETING::Target *l_pSysTarget = NULL;
(void) TARGETING::targetService().getTopLevelTarget(l_pSysTarget);
if(l_pSysTarget == NULL)
{
HDAT_ERR("Error in getting Top Level Target");
assert(l_pSysTarget != NULL);
}
TARGETING::ATTR_IPL_ATTRIBUTES_type l_iplAttributes;
l_iplAttributes = l_pSysTarget->getAttr<TARGETING::ATTR_IPL_ATTRIBUTES>();
o_hdatOTA.hdatCreDefPartition = l_iplAttributes.createDefaultPartition;
o_hdatOTA.hdatCTAState = l_iplAttributes.clickToAcceptState;
o_hdatOTA.hdatDisVirtIOConn = l_iplAttributes.disableVirtIO;
o_hdatOTA.hdatResetPCINOs = l_iplAttributes.resetPCINumbers;
o_hdatOTA.hdatClrPhypNvram = l_iplAttributes.clearHypNVRAM;
TARGETING::ATTR_PRESERVE_MDC_PARTITION_VPD_type l_preserveMDCPartitionVPD;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_PRESERVE_MDC_PARTITION_VPD>
(l_preserveMDCPartitionVPD))
{
o_hdatOTA.hdatMDCLogPartVPD = l_preserveMDCPartitionVPD;
}
else
{
HDAT_ERR("Error in getting PRESERVE_MDC_PARTITION_VPD attribute");
}
//No CEC CM Capability on these systems
o_hdatOTA.hdatCECCMCapable = 0;
//i5/OS not available on this system
o_hdatOTA.hdati5OSEnable = 0;
o_hdatOTA.hdatSELFlagsValid = 1;
o_hdatOTA.hdatDelSELFromHyp = 1;
o_hdatOTA.hdatDelSELFromHB = 1;
o_hdatOTA.hdatDelSELFromBMC = 1;
//Lightpath support available on these systems
o_hdatOTA.hdatServiceIndMode = 1;
//RPA AIX/Linux
o_hdatOTA.hdatDefPartitionType = 1;
}
/**
* @brief This routine gets the information for IPL Parameters
*
* @pre None
*
* @post None
*
* @param None
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
void HdatIplParms::hdatGetIplParmsData()
{
PNOR::SideInfo_t l_sideInfo;
errlHndl_t l_errl = NULL;
TARGETING::Target *l_pSysTarget = NULL;
(void) TARGETING::targetService().getTopLevelTarget(l_pSysTarget);
if(l_pSysTarget == NULL)
{
HDAT_ERR("Error in getting Top Level Target");
assert(l_pSysTarget != NULL);
}
//IPL to hypervisor running
this->iv_hdatIPLParams->iv_iplParms.hdatIPLDestination = 0x02;
l_errl = PNOR::getSideInfo(PNOR::WORKING, l_sideInfo);
if(!l_errl)
{
if(l_sideInfo.isGolden)
{
this->iv_hdatIPLParams->iv_iplParms.hdatIPLSide =
HDAT_FIRMWARE_SIDE_GOLDEN;
}
else
{
this->iv_hdatIPLParams->iv_iplParms.hdatIPLSide =
HDAT_FIRMWARE_SIDE_WORKING;
}
}
else
{
ERRORLOG::errlCommit(l_errl,HDAT_COMP_ID);
}
// Fast IPL Speed
this->iv_hdatIPLParams->iv_iplParms.hdatIPLSpeed = 0xFF;
TARGETING::ATTR_IS_MPIPL_HB_type l_mpiplHB;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_IS_MPIPL_HB>(l_mpiplHB))
{
if(l_mpiplHB)
{
this->iv_hdatIPLParams->iv_iplParms.hdatCECIPLAttributes = 0x2000;
this->iv_hdatIPLParams->iv_iplParms.hdatIPLMajorType = 0x01;
this->iv_hdatIPLParams->iv_iplParms.hdatIPLMinorType = 0x0D;
}
else
{
this->iv_hdatIPLParams->iv_iplParms.hdatCECIPLAttributes = 0x1000;
this->iv_hdatIPLParams->iv_iplParms.hdatIPLMajorType = 0x00;
TARGETING::ATTR_CEC_IPL_TYPE_type l_cecIPLType;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_CEC_IPL_TYPE>
(l_cecIPLType))
{
this->iv_hdatIPLParams->iv_iplParms.hdatIPLMinorType =
l_cecIPLType.MinorIPLType;
this->iv_hdatIPLParams->iv_iplParms.hdatIPLMinorType = 0xC;
HDAT_DBG("hdatGetIplParmsData: setting hdatIPLMinorType to 0xC0");
}
else
{
HDAT_ERR("Error in getting CEC_IPL_TYPE attribute");
}
}
}
else
{
this->iv_hdatIPLParams->iv_iplParms.hdatIPLMinorType = 0x0C;
HDAT_DBG("hdatGetIplParmsData: setting hdatIPLMinorType to 0xC0");
HDAT_ERR("Error in getting IS_MPIPL_HB attribute");
}
TARGETING::ATTR_OS_IPL_MODE_type l_OSIPLMode;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_OS_IPL_MODE>(l_OSIPLMode))
{
this->iv_hdatIPLParams->iv_iplParms.hdatOSIPLMode = l_OSIPLMode;
}
else
{
HDAT_ERR("Error in getting OS_IPL_MODE attribute");
}
this->iv_hdatIPLParams->iv_iplParms.hdatKeyLockPosition =
HDAT_KEYLOCK_MANUAL;
TARGETING::ATTR_LMB_SIZE_type l_lmbSize;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_LMB_SIZE>(l_lmbSize))
{
this->iv_hdatIPLParams->iv_iplParms.hdatLMBSize = 4;
}
else
{
HDAT_ERR("Error in getting LMB_SIZE attribute");
}
TARGETING::ATTR_MAX_HSL_OPTICONNECT_CONNECTIONS_type l_hslConnections;
if(l_pSysTarget->tryGetAttr
<TARGETING::ATTR_MAX_HSL_OPTICONNECT_CONNECTIONS>
(l_hslConnections))
{
this->iv_hdatIPLParams->iv_iplParms.hdatMaxHSLConns = l_hslConnections;
}
else
{
HDAT_ERR("Error in getting MAX_HSL_OPTICONNECT_CONNECTIONS attribute");
}
hdatPopulateOtherIPLAttributes(this->iv_hdatIPLParams->iv_iplParms.hdatOIA);
TARGETING::ATTR_HUGE_PAGE_COUNT_type l_hugePageCount;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_HUGE_PAGE_COUNT>
(l_hugePageCount))
{
this->iv_hdatIPLParams->iv_iplParms.hdatHugePageMemCount =
l_hugePageCount;
}
else
{
HDAT_ERR("Error in getting HUGE_PAGE_COUNT attribute");
}
TARGETING::ATTR_HUGE_PAGE_SIZE_type l_hugePageSize;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_HUGE_PAGE_SIZE>
(l_hugePageSize))
{
this->iv_hdatIPLParams->iv_iplParms.hdatHugePageMemSize =
l_hugePageSize;
}
else
{
HDAT_ERR("Error in getting HUGE_PAGE_SIZE attribute");
}
TARGETING::ATTR_VLAN_SWITCHES_type l_vlanSwitches;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_VLAN_SWITCHES>
(l_vlanSwitches))
{
this->iv_hdatIPLParams->iv_iplParms.hdatNumVlanSwitches =
l_vlanSwitches;
}
else
{
HDAT_ERR("Error in getting VLAN_SWITCHES attribute");
}
uint32_t hdatEnlargedIOCapacity = 0;
hdatGetEnlargedIOCapacity(hdatEnlargedIOCapacity);
this->iv_hdatIPLParams->iv_iplParms.hdatEnlargedIOCap =
hdatEnlargedIOCapacity;
}
/**
* @brief This routine gets the information for SP serial ports
*
* @pre None
*
* @post None
*
* @param o_portArrayHdr - output parameter - Array header
* @param o_ports - output parameter - The structure to update with the
* serial port information
*
* @return A null error log handle if successful, else the return code pointed
* to by errlHndl_t contains one of:
*
* @retval HDAT_OTHER_COMP_ERROR
*/
static errlHndl_t hdatGetPortInfo(HDAT::hdatHDIFDataArray_t &o_portArrayHdr,
hdatPortCodes_t o_ports[])
{
errlHndl_t l_errlHndl = NULL;
uint32_t l_loopCnt = 0;
o_portArrayHdr.hdatOffset = sizeof(HDAT::hdatHDIFDataArray_t);
o_portArrayHdr.hdatAllocSize = sizeof(hdatPortCodes_t);
o_portArrayHdr.hdatActSize = sizeof(hdatPortCodes_t);
o_portArrayHdr.hdatArrayCnt = 0;
TARGETING::PredicateCTM l_nodePredicate(TARGETING::CLASS_ENC,
TARGETING::TYPE_NODE);
TARGETING::PredicateHwas l_predHwas;
l_predHwas.present(true);
TARGETING::PredicatePostfixExpr l_presentNode;
l_presentNode.push(&l_nodePredicate).push(&l_predHwas).And();
//Get Node targets
TARGETING::TargetRangeFilter l_nodeFilter(
TARGETING::targetService().begin(),
TARGETING::targetService().end(),
&l_presentNode);
TARGETING::Target *l_nodeTarget = (*l_nodeFilter);
TARGETING::PredicateCTM l_serialPortPredicate(TARGETING::CLASS_UNIT,
TARGETING::TYPE_UART);
TARGETING::PredicatePostfixExpr l_presentSerialPort;
l_presentSerialPort.push(&l_serialPortPredicate).push(&l_predHwas).And();
TARGETING::TargetHandleList l_serialPortList;
//Get Serial Port targets associated with service processor
TARGETING::targetService().getAssociated(l_serialPortList, l_nodeTarget,
TARGETING::TargetService::CHILD,
TARGETING::TargetService::ALL,
&l_presentSerialPort);
o_portArrayHdr.hdatArrayCnt = l_serialPortList.size();
for (uint32_t l_idx = 0; l_idx < l_serialPortList.size(); ++l_idx)
{
TARGETING::Target *l_serialportTarget = l_serialPortList[l_idx];
char l_locCodePrefix[64]={0};
char l_locCode[64]={0};
hdatGetLocationCodePrefix(l_locCodePrefix);
hdatGetLocationCode(l_serialportTarget,l_locCodePrefix,l_locCode);
HDAT_DBG(" Serial Port Loc Code :%s", l_locCode);
strncpy((char *)(o_ports[l_loopCnt].hdatLocCode),
l_locCode,
sizeof(o_ports[l_loopCnt].hdatLocCode));
o_ports[l_loopCnt].hdatResourceId = l_serialportTarget->getAttr
<TARGETING::ATTR_SLCA_RID>();
// None of the ports are used for callhome
o_ports[l_loopCnt].hdatCallHome = 0;
l_loopCnt++;
}
return l_errlHndl;
}
/**
* @brief This routine fetches the information on feature flags
*
* @pre None
*
* @post None
*
* @param o_featureFlagArrayHdr - output parameter - Array header
* @param o_featureFlagSettings - output parameter - The structure to update
* with Feature flag information
* @param o_featFlagArrSize - output parameter - Feature flag array size
*
* @retval None
*/
static void hdatGetFeatureFlagInfo(
hdatHDIFVersionedDataArray_t &o_featureFlagArrayHdr,
hdatIplpFeatureFlagSetting_t o_featureFlagSettings[],
uint32_t & o_featFlagArrSize)
{
TARGETING::Target *l_pSysTarget = NULL;
(void) TARGETING::targetService().getTopLevelTarget(l_pSysTarget);
if(l_pSysTarget == NULL)
{
HDAT_ERR("hdatGetFeatureFlagInfo::Top Level Target not found");
assert(l_pSysTarget != NULL);
}
// Default the dd level to 2.3
uint8_t l_ddLevel = HDAT_PROC_NIMBUS_DD_23;
const hdatIplpFeatureFlagSetting_t * l_featFlagArr;
uint32_t l_featFlagArrSize = 0;
uint8_t l_riskLvl = 0;
// Risk level is set
l_riskLvl = l_pSysTarget->getAttr<ATTR_RISK_LEVEL>();
PVR_t l_pvr( mmio_pvr_read() & 0xFFFFFFFF );
// DD level is set
l_ddLevel = l_pvr.getDDLevel();
// Default to Nimbus DD2.3
uint8_t l_ddLvlIdx = 2;
l_featFlagArr = hdatIplpFeatureFlagSettingsArray[l_riskLvl][l_ddLvlIdx];
l_featFlagArrSize =
sizeof(hdatIplpFeatureFlagSettingsArray[l_riskLvl][l_ddLvlIdx]);
// Set the value based on DD level and risk level
if (l_pvr.chipType == PVR_t::NIMBUS_CHIP)
{
if ( (l_ddLevel == HDAT_PROC_NIMBUS_DD_20) ||
(l_ddLevel == HDAT_PROC_NIMBUS_DD_21)
)
{
l_ddLvlIdx = HDAT_NIMBUS_DD_20_21_IDX;
}
else if (l_ddLevel == HDAT_PROC_NIMBUS_DD_22)
{
l_ddLvlIdx = HDAT_NIMBUS_DD_22_IDX;
}
else if (l_ddLevel == HDAT_PROC_NIMBUS_DD_23)
{
l_ddLvlIdx = HDAT_NIMBUS_DD_23_IDX;
}
l_featFlagArr = hdatIplpFeatureFlagSettingsArray[l_riskLvl][l_ddLvlIdx];
l_featFlagArrSize =
sizeof(hdatIplpFeatureFlagSettingsArray[l_riskLvl][l_ddLvlIdx]);
}
HDAT_DBG("Feature flag array size:0x%x, Model:0x%x, DD Level:0x%x "
"Risk Level:0x%x", l_featFlagArrSize, l_pvr.chipType,
l_ddLevel, l_riskLvl);
o_featFlagArrSize = l_featFlagArrSize;
o_featureFlagArrayHdr.hdatOffset = sizeof(hdatHDIFVersionedDataArray_t);
o_featureFlagArrayHdr.hdatAllocSize = sizeof(hdatIplpFeatureFlagSetting_t);
o_featureFlagArrayHdr.hdatActSize = sizeof(hdatIplpFeatureFlagSetting_t);
o_featureFlagArrayHdr.hdatArrayCnt =
l_featFlagArrSize/sizeof(hdatIplpFeatureFlagSetting_t);
o_featureFlagArrayHdr.hdatVersion = HDAT_FEATURE_FLAG_VERSION::V1;
memcpy(o_featureFlagSettings , l_featFlagArr, l_featFlagArrSize);
}
/**
* @brief This routine gets the information for System Parameters
*
* @pre None
*
* @post None
*
* @param None
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
**/
void HdatIplParms::hdatGetSystemParamters()
{
TARGETING::Target *l_pSysTarget = NULL;
(void) TARGETING::targetService().getTopLevelTarget(l_pSysTarget);
if(l_pSysTarget == NULL)
{
HDAT_ERR("hdatGetSystemParamters::Top Level Target not found");
assert(l_pSysTarget != NULL);
}
// Get system information - system model
uint32_t l_sysModel = 0;
TARGETING::ATTR_RAW_MTM_type l_rawMTM = {0};
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_RAW_MTM>(l_rawMTM))
{
//we only want the last three bytes of the raw MTM, preceded by a 0x20
l_sysModel = *((reinterpret_cast<uint32_t*>(l_rawMTM))+1);
l_sysModel &= 0x00FFFFFF;
l_sysModel |= 0x20000000;
this->iv_hdatIPLParams->iv_sysParms.hdatSysModel = l_sysModel;
}
else
{
HDAT_ERR("Error in getting RAW_MTM attribute");
}
// Get system information - processor feature code
// Processor Feature Code = CCIN of Anchor Card
// No Anchor Card in BMC systems
this->iv_hdatIPLParams->iv_sysParms.hdatProcFeatCode = 0;
// Set the PVR
PVR_t l_pvr( mmio_pvr_read() & 0xFFFFFFFF );
this->iv_hdatIPLParams->iv_sysParms.hdatEffectivePvr = l_pvr.word;
HDAT_DBG(" Effective PVR :0X%x",
this->iv_hdatIPLParams->iv_sysParms.hdatEffectivePvr);
// Get system type
iv_hdatIPLParams->iv_sysParms.hdatSysType =
(l_pSysTarget->getAttr<TARGETING::ATTR_PHYP_SYSTEM_TYPE>());
//Get ABC Bus Speed
TARGETING::ATTR_FREQ_A_MHZ_type l_ABCBusSpeed;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_FREQ_A_MHZ>(l_ABCBusSpeed))
{
this->iv_hdatIPLParams->iv_sysParms.hdatABCBusSpeed = l_ABCBusSpeed;
}
else
{
HDAT_ERR(" Error in getting attribute FREQ_A_MHZ");
}
//Get XYZ Bus Speed
TARGETING::ATTR_FREQ_X_MHZ_type l_WXYZBusSpeed;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_FREQ_X_MHZ>(l_WXYZBusSpeed))
{
this->iv_hdatIPLParams->iv_sysParms.hdatWXYZBusSpeed = l_WXYZBusSpeed;
}
else
{
HDAT_ERR(" Error in getting attribute FREQ_X_MHZ");
}
// NO ECO Support
this->iv_hdatIPLParams->iv_sysParms.hdatSystemECOMode = 0;
this->iv_hdatIPLParams->iv_sysParms.hdatSystemAttributes = 0;
//Populate SMM Enabled/Disabled attribute
TARGETING::ATTR_PAYLOAD_IN_MIRROR_MEM_type l_payLoadMirrorMem;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_PAYLOAD_IN_MIRROR_MEM>
(l_payLoadMirrorMem))
{
this->iv_hdatIPLParams->iv_sysParms.hdatSystemAttributes |=
( static_cast<uint8_t>(l_payLoadMirrorMem) ? HDAT_SMM_ENABLED : 0);
}
else
{
HDAT_ERR(" Error in getting attribute PAYLOAD_IN_MIRROR_MEM");
}
this->iv_hdatIPLParams->iv_sysParms.hdatSystemAttributes |=
l_pSysTarget->getAttr<ATTR_RISK_LEVEL>() ? HDAT_RISK_LEVEL_ELEVATED : 0 ;
this->iv_hdatIPLParams->iv_sysParms.hdatSystemAttributes |=
l_pSysTarget->getAttr<ATTR_IS_MPIPL_SUPPORTED>() ? HDAT_MPIPL_SUPPORTED : 0 ;
this->iv_hdatIPLParams->iv_sysParms.hdatMemoryScrubbing = 0;
// Get SPPL information
uint32_t l_numCores;
TARGETING::ATTR_OPEN_POWER_TURBO_MODE_SUPPORTED_type l_turboModeSupported;
if(l_pSysTarget->tryGetAttr
<TARGETING::ATTR_OPEN_POWER_TURBO_MODE_SUPPORTED>
(l_turboModeSupported))
{
HDAT::hdatGetNumberOfCores(l_numCores);
if(l_turboModeSupported == true)
{
this->iv_hdatIPLParams->iv_sysParms.hdatCurrentSPPLValue =
HDAT_TURBO_CORE_MODE_PART_SIZE_128;
}
else if( l_numCores == 6 )
{
this->iv_hdatIPLParams->iv_sysParms.hdatCurrentSPPLValue =
HDAT_NONTURBO_SIX_CORE_PART_SIZE_256;
}
else if( l_numCores == 8 )
{
this->iv_hdatIPLParams->iv_sysParms.hdatCurrentSPPLValue =
HDAT_NONTURBO_EIGHT_CORE_PART_SIZE_256;
}
}
else
{
HDAT_ERR("Error in getting OPEN_POWER_TURBO_MODE_SUPPORTED attribute");
}
this->iv_hdatIPLParams->iv_sysParms.usePoreSleep = 0x01;
TARGETING::ATTR_VTPM_ENABLED_type l_vTpmEnabled;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_VTPM_ENABLED>
(l_vTpmEnabled))
{
this->iv_hdatIPLParams->iv_sysParms.vTpmEnabled = l_vTpmEnabled;
}
else
{
HDAT_ERR("Error in getting VTPM_ENABLED attribute");
}
//HW Page Table Size : 0x07 : 1/128
this->iv_hdatIPLParams->iv_sysParms.hdatHwPageTbl = 0x07;
TARGETING::ATTR_HYP_DISPATCH_WHEEL_type l_hyperDispatchWheel;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_HYP_DISPATCH_WHEEL>
(l_hyperDispatchWheel))
{
if(!l_hyperDispatchWheel)
{
l_hyperDispatchWheel = 0x0a;
}
this->iv_hdatIPLParams->iv_sysParms.hdatDispWheel =
l_hyperDispatchWheel;
}
else
{
HDAT_ERR("Error in getting HYP_DISPATCH_WHEEL attribute");
}
TARGETING::ATTR_FREQ_PB_MHZ_type l_nestClockFreq;
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_FREQ_PB_MHZ>
(l_nestClockFreq))
{
this->iv_hdatIPLParams->iv_sysParms.hdatNestFreq =
static_cast<uint32_t>(l_nestClockFreq);
}
else
{
HDAT_ERR("Error in getting FREQ_PB_MHZ");
}
this->iv_hdatIPLParams->iv_sysParms.hdatSplitCoreMode = 1;
TARGETING::ATTR_SYSTEM_BRAND_NAME_type l_systemBrandName = {0};
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_SYSTEM_BRAND_NAME>
(l_systemBrandName))
{
strcpy(reinterpret_cast<char*>
(this->iv_hdatIPLParams->iv_sysParms.hdatSystemVendorName),
l_systemBrandName);
}
else
{
HDAT_ERR("Error in getting SYSTEM_BRAND_NAME");
}
// The next 5 fields are set to their final values in a common handler
// in istep 21.1, to avoid trust issues when HDAT is initially populated
// by a service processor
this->iv_hdatIPLParams->iv_sysParms.hdatSysSecuritySetting = 0;
this->iv_hdatIPLParams->iv_sysParms.hdatTpmConfBits = 0;
this->iv_hdatIPLParams->iv_sysParms.hdatTpmDrawer = 0;
this->iv_hdatIPLParams->iv_sysParms.hdatHwKeyHashSize = 0;
memset(this->iv_hdatIPLParams->iv_sysParms.hdatHwKeyHashValue, 0x00,
sizeof(this->iv_hdatIPLParams->iv_sysParms.hdatHwKeyHashValue));
memset(this->iv_hdatIPLParams->iv_sysParms.hdatSystemFamily, 0x00, 64);
TARGETING::ATTR_SYSTEM_FAMILY_type l_systemFamily = {0};
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_SYSTEM_FAMILY> (l_systemFamily))
{
strcpy(reinterpret_cast<char*>
(this->iv_hdatIPLParams->iv_sysParms.hdatSystemFamily),
l_systemFamily);
}
else
{
HDAT_ERR("Error in getting SYSTEM_FAMILY");
}
TARGETING::ATTR_SYSTEM_TYPE_type l_systemType = {0};
if(l_pSysTarget->tryGetAttr<TARGETING::ATTR_SYSTEM_TYPE> (l_systemType))
{
strcpy(reinterpret_cast<char*>
(this->iv_hdatIPLParams->iv_sysParms.hdatSystemType),
l_systemType);
}
else
{
HDAT_ERR("Error in getting SYSTEM_TYPE");
}
}
/**
* @brief This routine gets the IPL Time Delta Structure
*
* @pre None
*
* @post None
*
* @param o_iplTime - output parameter - IPLTime Data
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
void hdatGetIPLTimeData(hdatIplTimeData_t & o_iplTime)
{
//RTC and Delta values marked as invalid
o_iplTime.hdatRTCValidFlags = 0;
//Cumulative RTC Delta value is reset
o_iplTime.hdatCumulativeRTCDelta = 0;
}
/**
* @brief This routine gets the Manufacturing Flags
*
* @pre None
*
* @post None
*
* @param o_hdatManfFlags - output parameter - Manufacturing Flags
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
void hdatGetMnfgFlags(hdatManf_t &o_hdatManfFlags)
{
o_hdatManfFlags.hdatPolicyFlags[0] = HDAT_MFG_FLAGS_CELL_0;
o_hdatManfFlags.hdatPolicyFlags[1] = HDAT_MFG_FLAGS_CELL_1;
o_hdatManfFlags.hdatPolicyFlags[2] = HDAT_MFG_FLAGS_CELL_2;
o_hdatManfFlags.hdatPolicyFlags[3] = HDAT_MFG_FLAGS_CELL_3;
if(HDAT::isMnfgFlagSet(TARGETING::MNFG_FLAG_AVP_ENABLE))
o_hdatManfFlags.hdatPolicyFlags[1] |= HDAT_MFG_FLAG_AVP_ENABLED;
if(HDAT::isMnfgFlagSet(TARGETING::MNFG_FLAG_HDAT_AVP_ENABLE))
o_hdatManfFlags.hdatPolicyFlags[2] |= HDAT_MFG_FLAG_HDAT_AVP_ENABLED;
if(HDAT::isMnfgFlagSet(TARGETING::MNFG_FLAG_SRC_TERM))
o_hdatManfFlags.hdatPolicyFlags[0] |= HDAT_MNFG_FLAG_SRC_TERM;
if(HDAT::isMnfgFlagSet(TARGETING::MNFG_FLAG_IPL_MEMORY_CE_CHECKING))
o_hdatManfFlags.hdatPolicyFlags[2] |=
HDAT_MNFG_IPL_MEM_CE_CHECKING_ACTIVE;
if(HDAT::isMnfgFlagSet(TARGETING::MNFG_FLAG_FAST_BACKGROUND_SCRUB))
o_hdatManfFlags.hdatPolicyFlags[1] |= HDAT_MNFG_FAST_BKG_SCRUB_ACTIVE;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_TEST_DRAM_REPAIRS))
o_hdatManfFlags.hdatPolicyFlags[0] |= HDAT_MNFG_TEST_DRAM_REPAIRS;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_DISABLE_DRAM_REPAIRS))
o_hdatManfFlags.hdatPolicyFlags[0] |= HDAT_MNFG_DISABLE_DRAM_REPAIRS;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_ENABLE_EXHAUSTIVE_PATTERN_TEST))
o_hdatManfFlags.hdatPolicyFlags[2] |=
HDAT_MNFG_ENABLE_EXHAUSTIVE_PATTERN_TEST;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_ENABLE_STANDARD_PATTERN_TEST))
o_hdatManfFlags.hdatPolicyFlags[2] |=
HDAT_MNFG_ENABLE_STANDARD_PATTERN_TEST;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_ENABLE_MINIMUM_PATTERN_TEST))
o_hdatManfFlags.hdatPolicyFlags[2] |= HDAT_MNFG_ENABLE_MIN_PATTERN_TEST;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_DISABLE_FABRIC_eREPAIR))
o_hdatManfFlags.hdatPolicyFlags[1] |= HDAT_MNFG_DISABLE_FABRIC_ERPAIR;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_DISABLE_MEMORY_eREPAIR))
o_hdatManfFlags.hdatPolicyFlags[1] |= HDAT_MNFG_DISABLE_MEMORY_ERPAIR;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_FABRIC_DEPLOY_LANE_SPARES))
o_hdatManfFlags.hdatPolicyFlags[2] |=
HDAT_MNFG_FABRIC_DEPLOY_LANE_SPARES;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_DMI_DEPLOY_LANE_SPARES))
o_hdatManfFlags.hdatPolicyFlags[2] |= HDAT_MNFG_DMI_DEPLOY_LANE_SPARES;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_PSI_DIAGNOSTIC))
o_hdatManfFlags.hdatPolicyFlags[1] |= HDAT_MNFG_PSI_DIAGNOSTIC;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_FSP_UPDATE_SBE_IMAGE))
o_hdatManfFlags.hdatPolicyFlags[1] |= HDAT_MNFG_FSP_UPDATE_SBE_IMAGE;
if(isMnfgFlagSet(TARGETING::MNFG_FLAG_UPDATE_BOTH_SIDES_OF_SBE))
o_hdatManfFlags.hdatPolicyFlags[1] |=
HDAT_MNFG_UPDATE_BOTH_SIDES_OF_SBE;
}
/**
* @brief This routine populates dump data table
*
* @pre None
*
* @post None
*
* @param o_hdatDump
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
void hdatGetPlatformDumpData(hdatDump_t &o_hdatDump)
{
o_hdatDump.hdatReserved2 = 0;
o_hdatDump.hdatHypDumpPolicy = 0;
memset(o_hdatDump.hdatReserved3, 0 , sizeof(o_hdatDump.hdatReserved3));
o_hdatDump.hdatMaxHdwSize = 0;
o_hdatDump.hdatActHdwSize = 0;
o_hdatDump.hdatMaxSpSize = 0;
o_hdatDump.hdatFlags = 0;
o_hdatDump.hdatDumpId = 0;
o_hdatDump.hdatActPlatformDumpSize = 0;
o_hdatDump.hdatPlid = 0;
}
/**
* @brief This routine sets the Header information for IPL
* Parameters structure
*
* @pre None
*
* @post None
*
* @param o_iplparams - Output Parameter - IPL Parameter headers
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
static void hdatSetIPLParamsHdrs(hdatIPLParameters_t *o_iplparams)
{
o_iplparams->hdatHdr.hdatStructId = HDAT_HDIF_STRUCT_ID;
o_iplparams->hdatHdr.hdatInstance = 0;
o_iplparams->hdatHdr.hdatVersion = HDAT_IPL_PARAMS_VERSION;
o_iplparams->hdatHdr.hdatSize = sizeof(hdatIPLParameters_t);
o_iplparams->hdatHdr.hdatHdrSize = sizeof(hdatHDIF_t);
o_iplparams->hdatHdr.hdatDataPtrOffset = sizeof(hdatHDIF_t);
o_iplparams->hdatHdr.hdatDataPtrCnt = HDAT_IPL_PARAMS_DA_CNT;
o_iplparams->hdatHdr.hdatChildStrCnt = 0;
o_iplparams->hdatHdr.hdatChildStrOffset = 0;
// Set the feature flag array size
uint32_t l_featureFlagArrSize = 0;
l_featureFlagArrSize = sizeof(hdatIplpFeatureFlagSettingsArray[0][0]);
memcpy(o_iplparams->hdatHdr.hdatStructName, HDAT_IPLP_STRUCT_NAME,
sizeof(o_iplparams->hdatHdr.hdatStructName));
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_SYS_PARAMS].hdatOffset =
offsetof(hdatIPLParameters_t,iv_sysParms);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_SYS_PARAMS].hdatSize =
sizeof(hdatSysParms_t);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_IPL_PARAMS].hdatOffset =
offsetof(hdatIPLParameters_t,iv_iplParms);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_IPL_PARAMS].hdatSize =
sizeof(hdatIPLParams_t);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_TIME_DATA].hdatOffset =
offsetof(hdatIPLParameters_t,iv_iplTime);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_TIME_DATA].hdatSize =
sizeof(hdatIplTimeData_t);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_SPPL_PARAMS].hdatOffset =
offsetof(hdatIPLParameters_t,iv_pvt);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_SPPL_PARAMS].hdatSize =
sizeof(hdatIplSpPvt_t);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_PDUMP_DATA].hdatOffset =
offsetof(hdatIPLParameters_t, iv_dump);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_PDUMP_DATA].hdatSize =
sizeof(hdatDump_t);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_HMC_CONNS].hdatOffset =
offsetof(hdatIPLParameters_t, iv_hmc);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_HMC_CONNS].hdatSize =
sizeof(hdatHmc_t);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_CUOD_DATA].hdatOffset =
offsetof(hdatIPLParameters_t, iv_cuod);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_CUOD_DATA].hdatSize =
sizeof(hdatCuod_t);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_MFG_DATA].hdatOffset =
offsetof(hdatIPLParameters_t, iv_manf);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_MFG_DATA].hdatSize =
sizeof(hdatManf_t);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_SERIAL_PORTS].hdatOffset =
offsetof(hdatIPLParameters_t, iv_portArrayHdr);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_SERIAL_PORTS].hdatSize =
sizeof(hdatHDIFDataArray_t) + sizeof(hdatPortCodes_t);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_FEATURE_FLAGS].hdatOffset =
offsetof(hdatIPLParameters_t, iv_featureFlagArrayHdr);
o_iplparams->hdatIPLParamsIntData[HDAT_IPL_PARAMS_FEATURE_FLAGS].hdatSize =
sizeof(hdatHDIFVersionedDataArray_t) + l_featureFlagArrSize;
}
/**
* @brief Constructor for IPL Parameters construction class
*
* @pre None
*
* @post None
*
* @param o_errlHndl - output parameter - Error Handlea
* i_msAddr - Mainstore address where IPL Params
* structure is loaded
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
HdatIplParms::HdatIplParms(errlHndl_t &o_errlHndl,
const HDAT::hdatMsAddr_t &i_msAddr)
{
o_errlHndl = NULL;
// Copy the main store address for the pcia data
memcpy(&iv_msAddr, &i_msAddr, sizeof(hdatMsAddr_t));
uint64_t l_base_addr = ((uint64_t) i_msAddr.hi << 32) | i_msAddr.lo;
void *l_virt_addr = mm_block_map (
reinterpret_cast<void*>(ALIGN_PAGE_DOWN(l_base_addr)),
(ALIGN_PAGE(sizeof(hdatIPLParameters_t))+ PAGESIZE));
l_virt_addr = reinterpret_cast<void *>(
reinterpret_cast<uint64_t>(l_virt_addr) +
(l_base_addr - ALIGN_PAGE_DOWN(l_base_addr)));
// initializing the space to zero
memset(l_virt_addr ,0x0, sizeof(hdatIPLParameters_t));
iv_hdatIPLParams = reinterpret_cast<hdatIPLParameters_t *>(l_virt_addr);
HDAT_DBG("Ctr iv_hdatIPLParams addr 0x%016llX virtual addr 0x%016llX",
(uint64_t) this->iv_hdatIPLParams, (uint64_t)l_virt_addr);
}
/**
* @brief Load IPL Paramsters to Mainstore
*
* @pre None
*
* @post None
*
* @param o_size - output parameter - Size of IPL Parameters structure
* o_count - output parameter - Number of IPL Parameters structures
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
errlHndl_t HdatIplParms::hdatLoadIplParams(uint32_t &o_size, uint32_t &o_count)
{
errlHndl_t l_errl = NULL;
//Set IPLParams Headers
hdatSetIPLParamsHdrs(this->iv_hdatIPLParams);
//Get the FSP private IPL type
TARGETING::Target *l_pSysTarget = NULL;
(void) TARGETING::targetService().getTopLevelTarget(l_pSysTarget);
if(l_pSysTarget == NULL)
{
HDAT_ERR("Error in getting Top Level target");
assert(l_pSysTarget != NULL);
}
//Initializing SP IPL Type to Power On Reset
this->iv_hdatIPLParams->iv_pvt.hdatIplType = 0x00000801;
// Get the IPL parameters data
hdatGetIplParmsData();
// Get the IPL time data
hdatGetIPLTimeData(this->iv_hdatIPLParams->iv_iplTime);
// Get the System Parameters
hdatGetSystemParamters();
// Get HMC information
memset(&this->iv_hdatIPLParams->iv_hmc, 0x00,
sizeof(this->iv_hdatIPLParams->iv_hmc));
// Get dump information
hdatGetPlatformDumpData(this->iv_hdatIPLParams->iv_dump);
// Get CUOD information
this->iv_hdatIPLParams->iv_cuod.hdatCuodFlags = HDAT_POWER_OFF;
// Get manufacturing mode information
memset(&this->iv_hdatIPLParams->iv_manf, 0x00, sizeof(hdatManf_t));
hdatGetMnfgFlags(this->iv_hdatIPLParams->iv_manf);
// Get serial port information
memset(&this->iv_hdatIPLParams->iv_portArrayHdr, 0x00,
sizeof(HDAT::hdatHDIFDataArray_t));
memset(this->iv_hdatIPLParams->iv_ports, 0x00, sizeof(hdatPortCodes_t) * 2);
hdatGetPortInfo(this->iv_hdatIPLParams->iv_portArrayHdr,
this->iv_hdatIPLParams->iv_ports);
// Get the feature flag information
memset(&this->iv_hdatIPLParams->iv_featureFlagArrayHdr, 0x00,
sizeof(HDAT::hdatHDIFVersionedDataArray_t));
memset(&this->iv_hdatIPLParams->iv_featureFlagSettings, 0x00,
sizeof(hdatIplpFeatureFlagSetting_t) * MAX_FEATURE_FLAGS);
this->iv_hdatIPLParams->iv_featureFlagArrSize = 0x00;
hdatGetFeatureFlagInfo(this->iv_hdatIPLParams->iv_featureFlagArrayHdr,
this->iv_hdatIPLParams->iv_featureFlagSettings,
this->iv_hdatIPLParams->iv_featureFlagArrSize);
HDAT_DBG("HDAT:: IPL Parameters Loaded :: Size : 0x%X",
sizeof(hdatIPLParameters_t));
o_count = 1;
o_size = sizeof(hdatIPLParameters_t);
return l_errl;
}
/**
* @brief Destructor for IPL Parameters construction class
*
* @pre None
*
* @post None
*
* @param None
*
* @return None
*
* @retval HDAT_OTHER_COMP_ERROR
*/
HdatIplParms::~HdatIplParms()
{
int rc = 0;
rc = mm_block_unmap(iv_hdatIPLParams);
if( rc != 0)
{
errlHndl_t l_errl = NULL;
/*@
* @errortype
* @moduleid HDAT::MOD_IPLPARMS_DESTRUCTOR
* @reasoncode HDAT::RC_DEV_MAP_FAIL
* @devdesc Unmap a mapped region failed
* @custdesc Firmware encountered an internal error.
*/
hdatBldErrLog(l_errl,
MOD_PCIA_DESTRUCTOR,
RC_DEV_MAP_FAIL,
0,0,0,0,
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
HDAT_VERSION1,
true);
}
return;
}
};
|