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
13 NVData structure used by the sample driver
20 #ifndef _NVDATASTRUC_H_
21 #define _NVDATASTRUC_H_
23 #include <Guid/HiiPlatformSetupFormset.h>
24 #include <Guid/HiiFormMapMethodGuid.h>
25 #include <Guid/DriverSampleHii.h>
26 #include <Guid/ZeroGuid.h>
28 #define CONFIGURATION_VARSTORE_ID 0x1234
29 #define BITS_VARSTORE_ID 0x2345
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.
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;
52 UINT8 UnionNumericAlias
;
56 UINT16 MyStringData
[40];
57 UINT16 SomethingHiddenForHtml
;
58 UINT8 HowOldAreYouInYearsManual
;
59 UINT16 HowTallAreYouManual
;
60 UINT8 HowOldAreYouInYears
;
62 UINT8 MyFavoriteNumber
;
65 UINT8 QuestionAboutTreeHugging
;
66 UINT8 ChooseToActivateNuclearWeaponry
;
67 UINT8 SuppressGrayOutSomething
;
73 UINT8 DynamicOrderedList
[5];
78 UINT16 NameValueVar2
[20];
80 UINT8 SerialPortStatus
;
83 UINT8 GetDefaultValueFromCallBack
;
84 UINT8 GetDefaultValueFromAccess
;
86 UINT8 RefreshGuidCount
;
88 UINT8 GetDefaultValueFromCallBackForOrderedList
[3];
89 UINT8 BitCheckbox
: 1;
90 UINT8 ReservedBits
: 7; // Reserved bit fields for padding.
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
;
101 // 2nd NV data structure definition
106 UINT8 OrderedList
[3];
107 UINT16 SubmittedCallback
;
108 } MY_EFI_VARSTORE_DATA
;
111 // 3rd NV data structure definition
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
;
125 #define LABEL_UPDATE1 0x1234
126 #define LABEL_UPDATE2 0x2234
127 #define LABEL_UPDATE3 0x3234
128 #define LABEL_END 0x2223