1 | /** @file
|
---|
2 |
|
---|
3 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>*
|
---|
4 | (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | Module Name:
|
---|
8 |
|
---|
9 | NVDataStruc.h
|
---|
10 |
|
---|
11 | Abstract:
|
---|
12 |
|
---|
13 | NVData structure used by the sample driver
|
---|
14 |
|
---|
15 | Revision History:
|
---|
16 |
|
---|
17 |
|
---|
18 | **/
|
---|
19 |
|
---|
20 | #ifndef _NVDATASTRUC_H_
|
---|
21 | #define _NVDATASTRUC_H_
|
---|
22 |
|
---|
23 | #include <Guid/HiiPlatformSetupFormset.h>
|
---|
24 | #include <Guid/HiiFormMapMethodGuid.h>
|
---|
25 | #include <Guid/DriverSampleHii.h>
|
---|
26 | #include <Guid/ZeroGuid.h>
|
---|
27 |
|
---|
28 | #define CONFIGURATION_VARSTORE_ID 0x1234
|
---|
29 | #define BITS_VARSTORE_ID 0x2345
|
---|
30 |
|
---|
31 | #pragma pack(1)
|
---|
32 |
|
---|
33 | //
|
---|
34 | // !!! For a structure with a series of bit fields and used as a storage in vfr file, and if the bit fields do not add up to the size of the defined type.
|
---|
35 | // In the C code use sizeof() to get the size the strucure, the results may vary form the compiler(VS,GCC...).
|
---|
36 | // But the size of the storage calculated by VfrCompiler is fixed (calculate with alignment).
|
---|
37 | // To avoid above case, we need to make the total bit width in the structure aligned with the size of the defined type for these bit fields. We can:
|
---|
38 | // 1. Add bit field (with/without name) with remianing with for padding.
|
---|
39 | // 2. Add unnamed bit field with 0 for padding, the amount of padding is determined by the alignment characteristics of the members of the structure.
|
---|
40 | //
|
---|
41 | typedef struct {
|
---|
42 | UINT16 NestByteField;
|
---|
43 | UINT8 : 1; // unamed field can be used for padding
|
---|
44 | UINT8 NestBitCheckbox : 1;
|
---|
45 | UINT8 NestBitOneof : 2;
|
---|
46 | UINT8 : 0; // Special width 0 can be used to force alignment at the next word boundary
|
---|
47 | UINT8 NestBitNumeric : 4;
|
---|
48 | } MY_BITS_DATA;
|
---|
49 |
|
---|
50 | typedef union {
|
---|
51 | UINT8 UnionNumeric;
|
---|
52 | UINT8 UnionNumericAlias;
|
---|
53 | } MY_EFI_UNION_DATA;
|
---|
54 |
|
---|
55 | typedef struct {
|
---|
56 | UINT16 MyStringData[40];
|
---|
57 | UINT16 SomethingHiddenForHtml;
|
---|
58 | UINT8 HowOldAreYouInYearsManual;
|
---|
59 | UINT16 HowTallAreYouManual;
|
---|
60 | UINT8 HowOldAreYouInYears;
|
---|
61 | UINT16 HowTallAreYou;
|
---|
62 | UINT8 MyFavoriteNumber;
|
---|
63 | UINT8 TestLateCheck;
|
---|
64 | UINT8 TestLateCheck2;
|
---|
65 | UINT8 QuestionAboutTreeHugging;
|
---|
66 | UINT8 ChooseToActivateNuclearWeaponry;
|
---|
67 | UINT8 SuppressGrayOutSomething;
|
---|
68 | UINT8 OrderedList[8];
|
---|
69 | UINT16 BootOrder[8];
|
---|
70 | UINT8 BootOrderLarge;
|
---|
71 | UINT8 DynamicRefresh;
|
---|
72 | UINT8 DynamicOneof;
|
---|
73 | UINT8 DynamicOrderedList[5];
|
---|
74 | UINT8 Reserved;
|
---|
75 | EFI_HII_REF RefData;
|
---|
76 | UINT8 NameValueVar0;
|
---|
77 | UINT16 NameValueVar1;
|
---|
78 | UINT16 NameValueVar2[20];
|
---|
79 | UINT8 SerialPortNo;
|
---|
80 | UINT8 SerialPortStatus;
|
---|
81 | UINT16 SerialPortIo;
|
---|
82 | UINT8 SerialPortIrq;
|
---|
83 | UINT8 GetDefaultValueFromCallBack;
|
---|
84 | UINT8 GetDefaultValueFromAccess;
|
---|
85 | EFI_HII_TIME Time;
|
---|
86 | UINT8 RefreshGuidCount;
|
---|
87 | UINT8 Match2;
|
---|
88 | UINT8 GetDefaultValueFromCallBackForOrderedList[3];
|
---|
89 | UINT8 BitCheckbox : 1;
|
---|
90 | UINT8 ReservedBits: 7; // Reserved bit fields for padding.
|
---|
91 | UINT16 BitOneof : 6;
|
---|
92 | UINT16 : 0; // Width 0 used to force alignment.
|
---|
93 | UINT16 BitNumeric : 12;
|
---|
94 | MY_BITS_DATA MyBitData;
|
---|
95 | MY_EFI_UNION_DATA MyUnionData;
|
---|
96 | UINT8 QuestionXUefiKeywordRestStyle;
|
---|
97 | UINT8 QuestionNonXUefiKeywordRestStyle;
|
---|
98 | } DRIVER_SAMPLE_CONFIGURATION;
|
---|
99 |
|
---|
100 | //
|
---|
101 | // 2nd NV data structure definition
|
---|
102 | //
|
---|
103 | typedef struct {
|
---|
104 | UINT8 Field8;
|
---|
105 | UINT16 Field16;
|
---|
106 | UINT8 OrderedList[3];
|
---|
107 | UINT16 SubmittedCallback;
|
---|
108 | } MY_EFI_VARSTORE_DATA;
|
---|
109 |
|
---|
110 | //
|
---|
111 | // 3rd NV data structure definition
|
---|
112 | //
|
---|
113 | typedef struct {
|
---|
114 | MY_BITS_DATA BitsData;
|
---|
115 | UINT32 EfiBitGrayoutTest : 5;
|
---|
116 | UINT32 EfiBitNumeric : 4;
|
---|
117 | UINT32 EfiBitOneof : 10;
|
---|
118 | UINT32 EfiBitCheckbox : 1;
|
---|
119 | UINT32 : 0; // Width 0 used to force alignment.
|
---|
120 | } MY_EFI_BITS_VARSTORE_DATA;
|
---|
121 |
|
---|
122 | //
|
---|
123 | // Labels definition
|
---|
124 | //
|
---|
125 | #define LABEL_UPDATE1 0x1234
|
---|
126 | #define LABEL_UPDATE2 0x2234
|
---|
127 | #define LABEL_UPDATE3 0x3234
|
---|
128 | #define LABEL_END 0x2223
|
---|
129 |
|
---|
130 | #pragma pack()
|
---|
131 |
|
---|
132 | #endif
|
---|