3 Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 NVData structure used by the sample driver
25 #ifndef _NVDATASTRUC_H_
26 #define _NVDATASTRUC_H_
28 #include <Guid/HiiPlatformSetupFormset.h>
29 #include <Guid/HiiFormMapMethodGuid.h>
30 #include <Guid/DriverSampleHii.h>
31 #include <Guid/ZeroGuid.h>
33 #define CONFIGURATION_VARSTORE_ID 0x1234
34 #define BITS_VARSTORE_ID 0x2345
39 // !!! 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.
40 // In the C code use sizeof() to get the size the strucure, the results may vary form the compiler(VS,GCC...).
41 // But the size of the storage calculated by VfrCompiler is fixed (calculate with alignment).
42 // 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:
43 // 1. Add bit field (with/without name) with remianing with for padding.
44 // 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.
48 UINT8
: 1; // unamed field can be used for padding
49 UINT8 NestBitCheckbox
: 1;
50 UINT8 NestBitOneof
: 2;
51 UINT8
: 0; // Special width 0 can be used to force alignment at the next word boundary
52 UINT8 NestBitNumeric
: 4;
61 UINT16 MyStringData
[40];
62 UINT16 SomethingHiddenForHtml
;
63 UINT8 HowOldAreYouInYearsManual
;
64 UINT16 HowTallAreYouManual
;
65 UINT8 HowOldAreYouInYears
;
67 UINT8 MyFavoriteNumber
;
70 UINT8 QuestionAboutTreeHugging
;
71 UINT8 ChooseToActivateNuclearWeaponry
;
72 UINT8 SuppressGrayOutSomething
;
78 UINT8 DynamicOrderedList
[5];
83 UINT16 NameValueVar2
[20];
85 UINT8 SerialPortStatus
;
88 UINT8 GetDefaultValueFromCallBack
;
89 UINT8 GetDefaultValueFromAccess
;
91 UINT8 RefreshGuidCount
;
93 UINT8 GetDefaultValueFromCallBackForOrderedList
[3];
94 UINT8 BitCheckbox
: 1;
95 UINT8 ReservedBits
: 7; // Reserved bit fields for padding.
97 UINT16
: 0; // Width 0 used to force alignment.
98 UINT16 BitNumeric
: 12;
99 MY_BITS_DATA MyBitData
;
100 MY_EFI_UNION_DATA MyUnionData
;
101 } DRIVER_SAMPLE_CONFIGURATION
;
104 // 2nd NV data structure definition
109 UINT8 OrderedList
[3];
110 UINT16 SubmittedCallback
;
111 } MY_EFI_VARSTORE_DATA
;
114 // 3rd NV data structure definition
117 MY_BITS_DATA BitsData
;
118 UINT32 EfiBitGrayoutTest
: 5;
119 UINT32 EfiBitNumeric
: 4;
120 UINT32 EfiBitOneof
: 10;
121 UINT32 EfiBitCheckbox
: 1;
122 UINT32
: 0; // Width 0 used to force alignment.
123 } MY_EFI_BITS_VARSTORE_DATA
;
128 #define LABEL_UPDATE1 0x1234
129 #define LABEL_UPDATE2 0x2234
130 #define LABEL_UPDATE3 0x3234
131 #define LABEL_END 0x2223