3 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
12 NVData structure used by the sample driver
19 #ifndef _NVDATASTRUC_H_
20 #define _NVDATASTRUC_H_
22 #include <Guid/HiiPlatformSetupFormset.h>
23 #include <Guid/HiiFormMapMethodGuid.h>
24 #include <Guid/DriverSampleHii.h>
25 #include <Guid/ZeroGuid.h>
27 #define CONFIGURATION_VARSTORE_ID 0x1234
28 #define BITS_VARSTORE_ID 0x2345
33 // !!! 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.
34 // In the C code use sizeof() to get the size the strucure, the results may vary form the compiler(VS,GCC...).
35 // But the size of the storage calculated by VfrCompiler is fixed (calculate with alignment).
36 // 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:
37 // 1. Add bit field (with/without name) with remianing with for padding.
38 // 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.
42 UINT8
: 1; // unamed field can be used for padding
43 UINT8 NestBitCheckbox
: 1;
44 UINT8 NestBitOneof
: 2;
45 UINT8
: 0; // Special width 0 can be used to force alignment at the next word boundary
46 UINT8 NestBitNumeric
: 4;
51 UINT8 UnionNumericAlias
;
55 UINT16 MyStringData
[40];
56 UINT16 SomethingHiddenForHtml
;
57 UINT8 HowOldAreYouInYearsManual
;
58 UINT16 HowTallAreYouManual
;
59 UINT8 HowOldAreYouInYears
;
61 UINT8 MyFavoriteNumber
;
64 UINT8 QuestionAboutTreeHugging
;
65 UINT8 ChooseToActivateNuclearWeaponry
;
66 UINT8 SuppressGrayOutSomething
;
72 UINT8 DynamicOrderedList
[5];
77 UINT16 NameValueVar2
[20];
79 UINT8 SerialPortStatus
;
82 UINT8 GetDefaultValueFromCallBack
;
83 UINT8 GetDefaultValueFromAccess
;
85 UINT8 RefreshGuidCount
;
87 UINT8 GetDefaultValueFromCallBackForOrderedList
[3];
88 UINT8 BitCheckbox
: 1;
89 UINT8 ReservedBits
: 7; // Reserved bit fields for padding.
91 UINT16
: 0; // Width 0 used to force alignment.
92 UINT16 BitNumeric
: 12;
93 MY_BITS_DATA MyBitData
;
94 MY_EFI_UNION_DATA MyUnionData
;
95 } DRIVER_SAMPLE_CONFIGURATION
;
98 // 2nd NV data structure definition
103 UINT8 OrderedList
[3];
104 UINT16 SubmittedCallback
;
105 } MY_EFI_VARSTORE_DATA
;
108 // 3rd NV data structure definition
111 MY_BITS_DATA BitsData
;
112 UINT32 EfiBitGrayoutTest
: 5;
113 UINT32 EfiBitNumeric
: 4;
114 UINT32 EfiBitOneof
: 10;
115 UINT32 EfiBitCheckbox
: 1;
116 UINT32
: 0; // Width 0 used to force alignment.
117 } MY_EFI_BITS_VARSTORE_DATA
;
122 #define LABEL_UPDATE1 0x1234
123 #define LABEL_UPDATE2 0x2234
124 #define LABEL_UPDATE3 0x3234
125 #define LABEL_END 0x2223