]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
MdeModulePkg/FaultTolerantWriteDxe: factor out boot service accesses
[mirror_edk2.git] / MdeModulePkg / Universal / DriverSampleDxe / NVDataStruc.h
1 /** @file
2
3 Copyright (c) 2007 - 2018, 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
8
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.
11
12 Module Name:
13
14 NVDataStruc.h
15
16 Abstract:
17
18 NVData structure used by the sample driver
19
20 Revision History:
21
22
23 **/
24
25 #ifndef _NVDATASTRUC_H_
26 #define _NVDATASTRUC_H_
27
28 #include <Guid/HiiPlatformSetupFormset.h>
29 #include <Guid/HiiFormMapMethodGuid.h>
30 #include <Guid/DriverSampleHii.h>
31 #include <Guid/ZeroGuid.h>
32
33 #define CONFIGURATION_VARSTORE_ID 0x1234
34 #define BITS_VARSTORE_ID 0x2345
35
36 #pragma pack(1)
37
38 //
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.
45 //
46 typedef struct {
47 UINT16 NestByteField;
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;
53 } MY_BITS_DATA;
54
55 typedef union {
56 UINT8 UnionNumeric;
57 UINT8 UnionNumericAlias;
58 } MY_EFI_UNION_DATA;
59
60 typedef struct {
61 UINT16 MyStringData[40];
62 UINT16 SomethingHiddenForHtml;
63 UINT8 HowOldAreYouInYearsManual;
64 UINT16 HowTallAreYouManual;
65 UINT8 HowOldAreYouInYears;
66 UINT16 HowTallAreYou;
67 UINT8 MyFavoriteNumber;
68 UINT8 TestLateCheck;
69 UINT8 TestLateCheck2;
70 UINT8 QuestionAboutTreeHugging;
71 UINT8 ChooseToActivateNuclearWeaponry;
72 UINT8 SuppressGrayOutSomething;
73 UINT8 OrderedList[8];
74 UINT16 BootOrder[8];
75 UINT8 BootOrderLarge;
76 UINT8 DynamicRefresh;
77 UINT8 DynamicOneof;
78 UINT8 DynamicOrderedList[5];
79 UINT8 Reserved;
80 EFI_HII_REF RefData;
81 UINT8 NameValueVar0;
82 UINT16 NameValueVar1;
83 UINT16 NameValueVar2[20];
84 UINT8 SerialPortNo;
85 UINT8 SerialPortStatus;
86 UINT16 SerialPortIo;
87 UINT8 SerialPortIrq;
88 UINT8 GetDefaultValueFromCallBack;
89 UINT8 GetDefaultValueFromAccess;
90 EFI_HII_TIME Time;
91 UINT8 RefreshGuidCount;
92 UINT8 Match2;
93 UINT8 GetDefaultValueFromCallBackForOrderedList[3];
94 UINT8 BitCheckbox : 1;
95 UINT8 ReservedBits: 7; // Reserved bit fields for padding.
96 UINT16 BitOneof : 6;
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;
102
103 //
104 // 2nd NV data structure definition
105 //
106 typedef struct {
107 UINT8 Field8;
108 UINT16 Field16;
109 UINT8 OrderedList[3];
110 UINT16 SubmittedCallback;
111 } MY_EFI_VARSTORE_DATA;
112
113 //
114 // 3rd NV data structure definition
115 //
116 typedef struct {
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;
124
125 //
126 // Labels definition
127 //
128 #define LABEL_UPDATE1 0x1234
129 #define LABEL_UPDATE2 0x2234
130 #define LABEL_UPDATE3 0x3234
131 #define LABEL_END 0x2223
132
133 #pragma pack()
134
135 #endif