TianoCore EDK2 master
Loading...
Searching...
No Matches
NVDataStruc.h
Go to the documentation of this file.
1
20#ifndef _NVDATASTRUC_H_
21#define _NVDATASTRUC_H_
22
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//
41typedef 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;
49
50typedef union {
51 UINT8 UnionNumeric;
52 UINT8 UnionNumericAlias;
54
55typedef 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 UINT8 QuestionApply;
100
101//
102// 2nd NV data structure definition
103//
104typedef struct {
105 UINT8 Field8;
106 UINT16 Field16;
107 UINT8 OrderedList[3];
108 UINT16 SubmittedCallback;
110
111//
112// 3rd NV data structure definition
113//
114typedef struct {
115 MY_BITS_DATA BitsData;
116 UINT32 EfiBitGrayoutTest : 5;
117 UINT32 EfiBitNumeric : 4;
118 UINT32 EfiBitOneof : 10;
119 UINT32 EfiBitCheckbox : 1;
120 UINT32 : 0; // Width 0 used to force alignment.
122
123//
124// Labels definition
125//
126#define LABEL_UPDATE1 0x1234
127#define LABEL_UPDATE2 0x2234
128#define LABEL_UPDATE3 0x3234
129#define LABEL_END 0x2223
130
131#pragma pack()
132
133#endif