summaryrefslogtreecommitdiffstats
path: root/src/usr/hdat/hdatiplparms.H
blob: 7e7380e9364134adc66e096d6d2cccbaa94149de (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hdat/hdatiplparms.H $                                 */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2020                        */
/* [+] 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                                                     */

#ifndef HDATIPLPARMS_H
#define HDATIPLPARMS_H

/**
 *  @file hdatiplparms.H
 *
 *  @brief This file contains the class definition for the IPL parms object
 *         constructed with data obtained from the registry and iplp component.
 *
 */

// Change Log *****************************************************************/
//
// End Change Log *************************************************************/

/*----------------------------------------------------------------------------*/
/* Includes                                                                   */
/*----------------------------------------------------------------------------*/
#include <stdint.h>              // standard types
#include <errl/errlentry.H>
#include <hdat/hdat_reasoncodes.H>
#include "hdatutil.H"
#include <hdat/hdat.H>

namespace HDAT
{

/*----------------------------------------------------------------------------*/
/* Typedefs                                                                   */
/*----------------------------------------------------------------------------*/

const uint16_t HDAT_IPL_PARAMS_VERSION    = 0x71; // Second P9 version
const char HDAT_IPLP_STRUCT_NAME[7] = "IPLPMS";


/** @enum hdatDataPtrs
 *        Constants for the internal data pointers that are added to the base
 *        class
 */
enum hdatIplDataPtrs
{
  HDAT_IPL_SYS   = 0,
  HDAT_IPL_PARMS,
  HDAT_IPL_TIME, 
  HDAT_IPL_PVT, 
  HDAT_IPL_DUMP, 
  HDAT_IPL_HMC,
  HDAT_IPL_CUOD,
  HDAT_IPL_MANF,
  HDAT_IPL_PORT_CODES,
  HDAT_IPL_FEATURE_FLAGS,
  HDAT_IPL_LAST
};

/** @brief Structure definition for system model and feature code
 */
struct hdatSysParms_t
{
    uint32_t hdatSysModel;
    uint32_t hdatProcFeatCode;
    uint32_t hdatEffectivePvr;
    uint32_t hdatSysType;
    uint8_t  hdatReserved3[8];         // Reserved
    uint32_t hdatABCBusSpeed;          // Speed in MHz
    uint32_t hdatWXYZBusSpeed;         // Speed in MHz
    uint32_t hdatSystemECOMode;        // System ECO Mode set by the user
    uint32_t hdatSystemAttributes;     // System supports multiple TPMDs
    uint32_t hdatMemoryScrubbing;      // Memory Scrubbing
    uint16_t hdatCurrentSPPLValue;     // The Current SPPL Value
    uint8_t  hdatReserved2;            // Reserved
    uint8_t  usePoreSleep;             // Use PORE Sleep
    uint32_t hdatReserved1;            // Reserved
    uint8_t  vTpmEnabled;              // vTPM Enabled
    uint8_t  hdatHwPageTbl;            // Hardware Page Table
    uint16_t  hdatDispWheel;           // Hypervisor Dispatch Wheel
    uint32_t hdatNestFreq;             // Nest Clock Frequency in MHz
    uint8_t  hdatSplitCoreMode;        // Split Core Mode
    uint8_t  hdatReserved4;            // Reserved
    uint16_t hdatReserved5;            // Reserved
    uint8_t  hdatSystemVendorName[64]; // System Vendor Name
    uint16_t hdatSysSecuritySetting;   // System Security Settings
    uint16_t hdatTpmConfBits;          // TPM Configuration Bits
    uint16_t hdatTpmDrawer;            // TPMs/Drawer
    uint16_t hdatHwKeyHashSize;        // Size of HW Keys' Hash
    uint8_t  hdatHwKeyHashValue[64];   // Hardware Keys Hash Value
    char     hdatSystemFamily[64];     // System Family/Vendor Name
    char     hdatSystemType[64];       // System Type/Vendor Type
} __attribute__ ((packed));

/** @brief Structure definition for Other IPL Attributes within hdatIPLParams_t
 *  */
struct hdatOtherIPLAttributes_t
{
    uint32_t hdatReserved1 : 1;        // Reserved
    uint32_t hdatCreDefPartition : 1;  // Create Default Parititon
    uint32_t hdatCTAState : 1;         // Click To Accept State
    uint32_t hdatDisVirtIOConn : 1;    // Disable Virtual IO Connectivity
    uint32_t hdatResetPCINOs : 1;      // Reset PCI Numbers
    uint32_t hdatClrPhypNvram : 1;     // Clear PHYP NVRAM
    uint32_t hdatMDCLogPartVPD : 1;    // Preserve MDC Logical Paritition VPD
    uint32_t hdatCECCMCapable : 1;     // CEC Concurrent Maintanance Capable
    uint32_t hdati5OSEnable : 1;       // i5/OS enable
    uint32_t hdatSELFlagsValid : 1;    // SEL Flags Valid
    uint32_t hdatDelSELFromHyp : 1;    // Delete SELs originated from PHYP/OPAL
    uint32_t hdatDelSELFromHB : 1;     // Delete SELs originated from Hostboot
    uint32_t hdatDelSELFromBMC : 1;    // Delete SELs originated from BMC
    uint32_t hdatReserved2 : 15;       // Reserved
    uint32_t hdatServiceIndMode : 2;   // Platform Service Indicator Mode
    uint32_t hdatDefPartitionType : 2; // Default Partition Type
}__attribute__ ((packed));

/** @brief Structure definition for IPL Parameters
 *  */
struct hdatIPLParams_t
{
    uint8_t  hdatReserved1;            // Reserved
    uint8_t  hdatIPLDestination;       // Hypervisor IPL Destination
    uint8_t  hdatIPLSide;              // Platform IPL Side
    uint8_t  hdatIPLSpeed;             // Platform IPL Speed for Current IPL
    uint16_t hdatCECIPLAttributes;     // CEC IPL Attributes
    uint8_t  hdatIPLMajorType;         // CEC IPL Major Type
    uint8_t  hdatIPLMinorType;         // CEC IPL Minor Type
    uint8_t  hdatOSIPLMode;            // Operating System IPL Mode
    uint8_t  hdatKeyLockPosition;      // Key Lock Position
    uint8_t  hdatLMBSize;              // Logical Memory Block Size
    uint8_t  hdatReserved2;            // Reserved
    uint32_t hdatMaxHSLConns;          // Max number of HSL Opticonnect
                                       //                         connections
    hdatOtherIPLAttributes_t hdatOIA;  // Other IPL Attributes
    uint16_t hdatHugePageMemCount;     // Huge Page Memory Count
    uint8_t  hdatHugePageMemSize;      // Huge Page Memory Size
    uint8_t  hdatNumVlanSwitches;      // Number of VLAN Switches
    uint32_t hdatReserved3;            // Reserved
    uint32_t hdatEnlargedIOCap;        // Enlarged IO Capacity
}__attribute__ ((packed));


/** @brief Structure definition for IPL Time Data
 *  */
struct hdatIplTimeData_t
{
    uint32_t hdatReserved1;            // Reserved
    uint32_t hdatReserved2;            // Reserved
    uint32_t hdatReserved3;            // Reserved
    union {uint32_t hdatRTCValidFlags; // Real Time Clock and Delta Valid Flags
           uint32_t hdatReserved4  :27,
                    hdatFSPTimeRef : 1,
                    hdatHYPSetTOD  : 1,
                    hdatReserved5  : 1,
                    hdatCumRTCDeltaValid : 1,
                    hdatIPLStartRTCValid : 1;};
    uint64_t hdatCumulativeRTCDelta;   // Cumulative RTC Delta
    uint32_t hdatReserved6;            // Reserved
    uint32_t hdatReserved7;            // Reserved
} __attribute__ ((packed));

/** @brief Structure definition for service processor private IPL type
 */
struct hdatIplSpPvt_t
{
    uint32_t  hdatIplType;
} __attribute__ ((packed));


/** @brief Structure definition for dump information
 */
struct hdatDump_t
{
    union {uint16_t hdatFlags;                // word view unioned with bit view
           uint16_t hdatRptPending    : 1,    // 1 = A dump exists and is
                                              //        waiting to be extracted
                    hdatHdwDumpExists : 1,    // 1 = Hardware dump exists
                    hdatMemDumpExists : 1,    // 1 = Memory dump exists
                    hdatHdwDumpErrs   : 1,    // 1 = Errors occurred during
                                              //       hardware dump collection
                    hdatMemDumpErrs   : 1,    // 1 = Errors occurred during
                                              //        memory dump collection
                    hdatHdwDumpReq    : 1,    // 1 = Hardware dump requested
                    hdatMemDumpReq    : 1,    // 1 = Memory dump requested
                    hdatUserReq       : 1,    // 1 = User requested the dump
                    hdatErrReq        : 1,    // 1 = Hardware or software
                                              //        error caused the dump
                    hdatReserved1     : 7;};  // Reserved for future use
    uint8_t  hdatReserved2;
    uint8_t  hdatHypDumpPolicy;
    uint32_t hdatDumpId;
    uint8_t  hdatReserved3[8];
    uint64_t hdatActPlatformDumpSize;
    uint32_t hdatMaxHdwSize;
    uint32_t hdatActHdwSize;
    uint32_t hdatMaxSpSize;
    uint32_t hdatPlid;
} __attribute__ ((packed));


/** @brief Structure definition for hardware management console information
 */
struct hdatHmc_t
{
    uint8_t hdatHmcFlags;
    uint8_t hdatReserved1[3];
} __attribute__ ((packed));

const uint8_t HDAT_HMC_MANAGED = 0x80;


/** @brief Structure definition for capacity upgrade on demand information
 */
struct hdatCuod_t
{
    uint8_t hdatCuodFlags;
    uint8_t hdatReserved1[3];
} __attribute__ ((packed));


const uint32_t HDAT_POWER_LOST = 0x80;
const uint32_t HDAT_POWER_OFF = 0x40;


const uint32_t HDAT_MNFG_MAX_CELLS = 0x04;

/** @brief Structure definition for manufacturing mode information
 */
struct hdatManf_t
{
    uint32_t hdatPolicyFlags[HDAT_MNFG_MAX_CELLS]; // 4 cells of mfg mode data
} __attribute__ ((packed));


/** @brief Structure definition for SP serial port information
 */
const uint32_t hdatMaxPorts = 2;  // maximum number of serial ports

struct hdatPortCodes_t
{
    char     hdatLocCode[80];   // serial port location code
    uint16_t hdatResourceId;    // serial port resource id
    uint16_t hdatCallHome  : 1, // 1 = designated as the "Call Home" port
             hdatReserved1 : 15;// Reserved for future use
} __attribute__ ((packed));

#define MAX_FEATURE_FLAGS 64     // Maximum number of feature flags
#define NUM_RISK_LEVELS 6  // 0, 1, 2, 3, 4, 5
#define NUM_OF_DD_LVLS  3  // DD2.0/2.1, 2.2, 2.3
#define NUM_FF_FLAGS    18

enum HDAT_FEATURE_FLAG_VERSION : uint32_t
{
    V1 = 0x00000001
};

const uint8_t HDAT_PROC_NIMBUS_DD_20 = 0x20;
const uint8_t HDAT_PROC_NIMBUS_DD_21 = 0x21;
const uint8_t HDAT_PROC_NIMBUS_DD_22 = 0x22;
const uint8_t HDAT_PROC_NIMBUS_DD_23 = 0x23;
const uint8_t HDAT_NIMBUS_DD_20_21_IDX = 0;
const uint8_t HDAT_NIMBUS_DD_22_IDX = 1;
const uint8_t HDAT_NIMBUS_DD_23_IDX = 2;

struct hdatIplpFeatureFlagSetting_t
{
    char     hdatIplpFeatureFlagString[64]; // Feature flag null terminated string
    uint64_t hdatIplpFeatureFlagSetting;    // bit0 indicates IPL time setting.
}__attribute__ ((packed));

// Agreed strings and settings of different feature flags
// based on risk level and DD levels.

const hdatIplpFeatureFlagSetting_t hdatIplpFeatureFlagSettingsArray[NUM_RISK_LEVELS][NUM_OF_DD_LVLS][NUM_FF_FLAGS]=
{
//RISK 0 (AIX/Linux/IBMi)
{
// Risk Level 0 , compat mode, nimbus DD2.0 / nimbus DD2.1 
{
{"tm-suspend-mode",                                 0x0000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x8000000000000000},
{"fw-bcctrl-serialized",                            0x0000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x0000000000000000},
{"fw-l1d-thread-split",                             0x8000000000000000},
{"fw-branch-hints-honored",                         0x8000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x8000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x8000000000000000},
{"user-mode-branch-speculation",                    0x8000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x8000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x8000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},

// Risk Level 0 , compat mode , nimbus DD 2.2
{
{"tm-suspend-mode",                                 0x8000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x8000000000000000},
{"fw-bcctrl-serialized",                            0x0000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x8000000000000000},
{"fw-l1d-thread-split",                             0x8000000000000000},
{"fw-branch-hints-honored",                         0x8000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x8000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x8000000000000000},
{"user-mode-branch-speculation",                    0x0000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x8000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x8000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},

// Risk Level 0 , compat mode , nimbus DD 2.3
{
{"tm-suspend-mode",                                 0x8000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x8000000000000000},
{"fw-bcctrl-serialized",                            0x0000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x8000000000000000},
{"fw-l1d-thread-split",                             0x8000000000000000},
{"fw-branch-hints-honored",                         0x8000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x8000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x8000000000000000},
{"user-mode-branch-speculation",                    0x0000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x8000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x8000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},
// End of Risk Level 0
},

//RISK 1 (AIX/Linux)
{
// Risk Level 1 , compat mode , nimbus DD 2.0 / nimbus DD 2.1
{
{"tm-suspend-mode",                                 0x0000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x8000000000000000},
{"fw-bcctrl-serialized",                            0x8000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x0000000000000000},
{"fw-l1d-thread-split",                             0x8000000000000000},
{"fw-branch-hints-honored",                         0x8000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x0000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x8000000000000000},
{"user-mode-branch-speculation",                    0x0000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x8000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x8000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},

// Risk Level 1 , compat mode , nimbus DD 2.2
{
{"tm-suspend-mode",                                 0x8000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x8000000000000000},
{"fw-bcctrl-serialized",                            0x8000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x8000000000000000},
{"fw-l1d-thread-split",                             0x8000000000000000},
{"fw-branch-hints-honored",                         0x8000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x0000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x8000000000000000},
{"user-mode-branch-speculation",                    0x8000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x8000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x8000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},
// Risk Level 1 , compat mode , nimbus DD 2.3
{
{"tm-suspend-mode",                                 0x8000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x8000000000000000},
{"fw-bcctrl-serialized",                            0x8000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x8000000000000000},
{"fw-l1d-thread-split",                             0x8000000000000000},
{"fw-branch-hints-honored",                         0x8000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x0000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x8000000000000000},
{"user-mode-branch-speculation",                    0x8000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x8000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x8000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},
// End of Risk Level 1
},

//RISK 2 (No Security)
{
// Risk Level 2 , compat mode , nimbus DD 2.0 / nimbus DD 2.1
{
{"tm-suspend-mode",                                 0x0000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x0000000000000000},
{"fw-bcctrl-serialized",                            0x0000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x0000000000000000},
{"fw-l1d-thread-split",                             0x0000000000000000},
{"fw-branch-hints-honored",                         0x0000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x0000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x0000000000000000},
{"user-mode-branch-speculation",                    0x0000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x0000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x0000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x0000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},

// Risk Level 2 , compat mode , nimbus DD 2.2
{
{"tm-suspend-mode",                                 0x8000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x0000000000000000},
{"fw-bcctrl-serialized",                            0x0000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x0000000000000000},
{"fw-l1d-thread-split",                             0x0000000000000000},
{"fw-branch-hints-honored",                         0x0000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x0000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x0000000000000000},
{"user-mode-branch-speculation",                    0x0000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x0000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x0000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x0000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},

// Risk Level 2 , compat mode , nimbus DD 2.3
{
{"tm-suspend-mode",                                 0x8000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x0000000000000000},
{"fw-bcctrl-serialized",                            0x0000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x0000000000000000},
{"fw-l1d-thread-split",                             0x0000000000000000},
{"fw-branch-hints-honored",                         0x0000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x0000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x0000000000000000},
{"user-mode-branch-speculation",                    0x0000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x0000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x0000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x0000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},
// End of Risk Level 2
},


//Risk levels 3 is being skipped as of now. Add values if needed infuture.
//RISK3 
{
// Risk Level3 2.0 / nimbus DD 2.1
{},

// Risk Level 3 nimbus DD2.2
{},

// Risk Level 3 nimbus DD2.3
{},
// End of Risk Level 3 
},


//RISK 4
{
// Risk Level 4 , native mode , nimbus DD 2.0 / nimbus DD 2.1
{},

// Risk Level 4 , native mode , nimbus DD 2.2
{},

// Risk Level 4 , native mode , nimbus DD 2.3
{
{"tm-suspend-mode",                                 0x8000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x8000000000000000},
{"fw-bcctrl-serialized",                            0x0000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x8000000000000000},
{"fw-l1d-thread-split",                             0x8000000000000000},
{"fw-branch-hints-honored",                         0x0000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x0000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x8000000000000000},
{"speculation-policy-favor-security",               0x8000000000000000},
{"user-mode-branch-speculation",                    0x0000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x8000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x8000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x8000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x8000000000000000}},
// End of Risk Level 4
},


//RISK 5
{
// Risk Level 5 , native mode , nimbus DD 2.0 / nimbus DD 2.1
{},

// Risk Level 5 , native mode , nimbus DD 2.2
{},

// Risk Level 5 , native mode , nimbus DD 2.3
{
{"tm-suspend-mode",                                 0x8000000000000000},
{"inst-spec-barrier-ori31,31,0",                    0x0000000000000000},
{"fw-bcctrl-serialized",                            0x0000000000000000},
{"inst-l1d-flush-ori30,30,0",                       0x0000000000000000},
{"inst-l1d-flush-trig2",                            0x0000000000000000},
{"fw-l1d-thread-split",                             0x0000000000000000},
{"fw-branch-hints-honored",                         0x0000000000000000},
{"inst-thread-reconfig-control-trig0-1",            0x0000000000000000},
{"fw-count-cache-disabled",                         0x0000000000000000},
{"fw-ltptr-serialized",                             0x0000000000000000},
{"fw-count-cache-flush-bcctr2,0,0",                 0x0000000000000000},
{"speculation-policy-favor-security",               0x0000000000000000},
{"user-mode-branch-speculation",                    0x0000000000000000},
{"needs-l1d-flush-msr-hv-1-to-0",                   0x0000000000000000},
{"needs-l1d-flush-msr-pr-0-to-1",                   0x0000000000000000},
{"needs-spec-barrier-for-bound-checks",             0x0000000000000000},
{"needs-pmu-restricted",                            0x0000000000000000},
{"needs-count-cache-flush-on-context-switch",       0x0000000000000000}},
// End of Risk Level 5
},

};

#define HDAT_CHIP_TYPE_MURANO                      "MURANO"
#define HDAT_CHIP_TYPE_VENICE                      "VENICE"
#define HDAT_CHIP_TYPE_NIMBUS                      "NIMBUS"
#define HDAT_CHIP_TYPE_CUMULUS                     "CUMULUS"

#define HDAT_SYSTEM_TYPE_BASE_FIRENZE              0x30000000
#define HDAT_SYSTEM_TYPE_PLUS_FIRENZE              0x30000001
#define HDAT_SYSTEM_TYPE_MISC_OPENPOWER            0x00150000

#define HDAT_FIRMWARE_SIDE_GOLDEN                  0x00
#define HDAT_FIRMWARE_SIDE_WORKING                 0x22

#define HDAT_KEYLOCK_MANUAL                        0x02
#define HDAT_KEYLOCK_NORMAL                        0x04

#define HDAT_MULT_TPMDS                            0x80000000
#define HDAT_SMM_ENABLED                           0x40000000
#define HDAT_CRYPTO_DISABLED_BIT                   0x20000000
#define HDAT_RISK_LEVEL_ELEVATED                   0x10000000       
#define HDAT_MPIPL_SUPPORTED                       0x04000000

#define HDAT_ECO_ENABLED                           0x80000000
#define HDAT_ECO_CAPABLE                           0x40000000

#define HDAT_TURBO_CORE_MODE_PART_SIZE_128         0x0080
#define HDAT_NONTURBO_EIGHT_CORE_PART_SIZE_32      0x0020
#define HDAT_NONTURBO_EIGHT_CORE_PART_SIZE_256     0x8020
#define HDAT_NONTURBO_SIX_CORE_PART_SIZE_24        0x0018
#define HDAT_NONTURBO_SIX_CORE_PART_SIZE_256       0x8018


#define HDAT_MFG_FLAGS_CELL_0                      0x00000000
#define HDAT_MFG_FLAGS_CELL_1                      0x00020000
#define HDAT_MFG_FLAGS_CELL_2                      0x00040000
#define HDAT_MFG_FLAGS_CELL_3                      0x00080000

#define HDAT_MFG_FLAG_AVP_ENABLED                  0x00000100
#define HDAT_MFG_FLAG_HDAT_AVP_ENABLED             0x00000010
#define HDAT_MNFG_FLAG_SRC_TERM                    0x00000200
#define HDAT_MNFG_IPL_MEM_CE_CHECKING_ACTIVE       0x00000008
#define HDAT_MNFG_FAST_BKG_SCRUB_ACTIVE            0x00000080
#define HDAT_MNFG_TEST_DRAM_REPAIRS                0x00000200
#define HDAT_MNFG_DISABLE_DRAM_REPAIRS             0x00000008
#define HDAT_MNFG_ENABLE_EXHAUSTIVE_PATTERN_TEST   0x00000001
#define HDAT_MNFG_ENABLE_STANDARD_PATTERN_TEST     0x00000002
#define HDAT_MNFG_ENABLE_MIN_PATTERN_TEST          0x00000004
#define HDAT_MNFG_DISABLE_FABRIC_ERPAIR            0x00000010
#define HDAT_MNFG_DISABLE_MEMORY_ERPAIR            0x00000020
#define HDAT_MNFG_FABRIC_DEPLOY_LANE_SPARES        0x00000200
#define HDAT_MNFG_DMI_DEPLOY_LANE_SPARES           0x00000100
#define HDAT_MNFG_PSI_DIAGNOSTIC                   0x00000001
#define HDAT_MNFG_FSP_UPDATE_SBE_IMAGE             0x00000004
#define HDAT_MNFG_UPDATE_BOTH_SIDES_OF_SBE         0x00000008

enum hdatIPLParamsDataPtrs
{
  HDAT_IPL_PARAMS_SYS_PARAMS    = 0,
  HDAT_IPL_PARAMS_IPL_PARAMS    = 1,
  HDAT_IPL_PARAMS_TIME_DATA     = 2,
  HDAT_IPL_PARAMS_SPPL_PARAMS   = 3,
  HDAT_IPL_PARAMS_PDUMP_DATA    = 4,
  HDAT_IPL_PARAMS_HMC_CONNS     = 5,
  HDAT_IPL_PARAMS_CUOD_DATA     = 6,
  HDAT_IPL_PARAMS_MFG_DATA      = 7,
  HDAT_IPL_PARAMS_SERIAL_PORTS  = 8,
  HDAT_IPL_PARAMS_FEATURE_FLAGS = 9,
  HDAT_IPL_PARAMS_DA_CNT        = 10,
  HDAT_IPL_PARAMS_DA_LAST       = 11
};

struct hdatIPLParameters_t{
       /** Object Instance Data
         *
         * @li iv_sysParms     - system model/feature code
         * @li iv_iplParms     - IPL parameter information
         * @li iv_iplTime      - IPL time information
         * @li iv_pvt          - SP private IPL information
         * @li iv_dump         - dump information
         * @li iv_hmc          - hardware management console information
         * @li iv_cuod         - Capacity upgrade on demand information
         * @li iv_manf         - manufacturing flags
         * @li iv_portArrayHdr - serial port array header
         * @li iv_ports        - serial port location codes and resource ids
         * @li iv_featureFlagArrayHdr - feature flag array header
         * @li iv_featureFlagSettings - feature flag settings
         * @li iv_featureFlagArrSize - feature flag array size
         */
        hdatHDIF_t             hdatHdr;
        hdatHDIFDataHdr_t      hdatIPLParamsIntData[HDAT_IPL_PARAMS_DA_LAST];
        hdatSysParms_t         iv_sysParms;
        hdatIPLParams_t        iv_iplParms;
        hdatIplTimeData_t      iv_iplTime;
        hdatIplSpPvt_t         iv_pvt;
        hdatDump_t             iv_dump;
        hdatHmc_t              iv_hmc;
        hdatCuod_t             iv_cuod;
        hdatManf_t             iv_manf;
        hdatHDIFDataArray_t    iv_portArrayHdr;
        hdatPortCodes_t        iv_ports[hdatMaxPorts];
        hdatHDIFVersionedDataArray_t    iv_featureFlagArrayHdr;
        hdatIplpFeatureFlagSetting_t    iv_featureFlagSettings[MAX_FEATURE_FLAGS];
        uint32_t               iv_featureFlagArrSize;
};

/*----------------------------------------------------------------------------*/
/* C++ class definition                                                       */
/*----------------------------------------------------------------------------*/

/** Begin Class Description
 *
 * @brief  The HdatIplParms class is used to construct the IPL Parameters
 *         hypervisor data area.
 *
 * Description: This class defines a specialized object.  It is not intended
 *              that any component can create an object of this type.
 *              In particular, the object is built only by the hdat component.
 *
 *              The real purpose of the object is to create the IPL parameters
 *              data structure as defined by the PHYP Initialization
 *              architecture.  This data structure is eventually copied to
 *              main memory.  The class is not defined to be a general purpose
 *              interface for building this object by anyone other than the
 *              hdat process.
 *
 * Thread safety:  An HdatIplParms object is not thread safe.  That is, a
 *                 single object cannot be shared and used concurrently by
 *                 multiple threads at the same time.  An object can be used by
 *                 multiple threads if the threads serialize access.  And of
 *                 course, each thread can use its own object with no concerns
 *                 about what other threads are doing.
 *
 * Signal handler usage: This class is not intended to be used in a signal
 *                        handler and nothing has been done to try and make
 *                        it safe to use in a signal handler.
 *
 * End Class Description
 */
class HdatIplParms
{
    public:

/*
         * @brief Construct an HdatIplParms object.
         *
         *       This is the constructor for the HdatIplParms object.
         *
         *       If you are constructing this object on the heap by using new,
         *       then you must check the pointer returned from new to see if
         *       it is null.
         *       If it is null, new failed to allocate storage and the
         *       constructor was not called.  If it is not null, then you must
         *       check o_errlHndl to see if the constructor ran successfully.
         *       If o_errlHndl indicates an error was reported by the
         *       constructor, new has already allocated heap storage and the
         *       object must be deleted in order to free the heap storage.
         *
         * @pre None
         *
         * @post An HdatIplParms object has been constructed.
         *       Heap storage has been allocated.
         *
         * @param o_errlHndl - output parameter - If any errors occur, the
         *                                        HdatIplParms object is NOT
         *                                        constructed and errors are
         *                                        returned in this parameter
         * @param i_msAddr   - input parameter - The main memory address that
         *                                       the service processor subsystem
         *                                       structure will be DMA'd to.
         *
         * @return A null error log handle if successful, else the return
         *         code pointed  to by o_errlHndl contains one of:
         *
         * @retval HDAT_REGISTRY_ERROR
         */
        HdatIplParms(errlHndl_t &o_errlHndl,
                        const HDAT::hdatMsAddr_t &i_msAddr);


        /**
         * @brief HdatIplParms object destructor
         *
         *        This is the destructor for an HdatIplParms object.
         *        Any heap storage allocated for the object is dallocated.
         *
         * @pre No preconditions exist
         *
         * @post The HdatIplParms object has been destroyed and can
         *       no longer be used.
         *
         */
        ~HdatIplParms();

         /**
          * @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 hdatLoadIplParams(uint32_t &o_size,uint32_t &o_count);
    private:

        void hdatGetSystemParamters(void);

        void hdatGetIplParmsData(void);

        HDAT::hdatMsAddr_t     iv_msAddr;

        hdatIPLParameters_t *iv_hdatIPLParams;


}; // end of HdatIplParms class

}
#endif // HDATIPLPARMS_H
OpenPOWER on IntegriCloud