]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / DriverSampleDxe / NVDataStruc.h
CommitLineData
0bb0f8b8 1/** @file\r
2\r
f7d05bdd 3Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 4SPDX-License-Identifier: BSD-2-Clause-Patent\r
0bb0f8b8 5\r
6Module Name:\r
7\r
8 NVDataStruc.h\r
9\r
10Abstract:\r
11\r
12 NVData structure used by the sample driver\r
13\r
14Revision History:\r
15\r
16\r
17**/\r
18\r
7064c0a5 19#ifndef _NVDATASTRUC_H_\r
20#define _NVDATASTRUC_H_\r
0bb0f8b8 21\r
d91c7bf9 22#include <Guid/HiiPlatformSetupFormset.h>\r
96a65fc8 23#include <Guid/HiiFormMapMethodGuid.h>\r
c8ad2d7a
LG
24#include <Guid/DriverSampleHii.h>\r
25#include <Guid/ZeroGuid.h>\r
78c2b9a3 26\r
8d00a0f1 27#define CONFIGURATION_VARSTORE_ID 0x1234\r
911405a3 28#define BITS_VARSTORE_ID 0x2345\r
0bb0f8b8 29\r
30#pragma pack(1)\r
911405a3 31\r
6b86f6f3
BD
32//\r
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.\r
34// In the C code use sizeof() to get the size the strucure, the results may vary form the compiler(VS,GCC...).\r
35// But the size of the storage calculated by VfrCompiler is fixed (calculate with alignment).\r
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:\r
37// 1. Add bit field (with/without name) with remianing with for padding.\r
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.\r
39//\r
911405a3
DB
40typedef struct {\r
41 UINT16 NestByteField;\r
42 UINT8 : 1; // unamed field can be used for padding\r
43 UINT8 NestBitCheckbox : 1;\r
44 UINT8 NestBitOneof : 2;\r
45 UINT8 : 0; // Special width 0 can be used to force alignment at the next word boundary\r
46 UINT8 NestBitNumeric : 4;\r
47} MY_BITS_DATA;\r
48\r
49typedef union {\r
f7d05bdd
DB
50 UINT8 UnionNumeric;\r
51 UINT8 UnionNumericAlias;\r
911405a3
DB
52} MY_EFI_UNION_DATA;\r
53\r
0bb0f8b8 54typedef struct {\r
0bb0f8b8 55 UINT16 MyStringData[40];\r
0bb0f8b8 56 UINT16 SomethingHiddenForHtml;\r
57 UINT8 HowOldAreYouInYearsManual;\r
58 UINT16 HowTallAreYouManual;\r
59 UINT8 HowOldAreYouInYears;\r
60 UINT16 HowTallAreYou;\r
61 UINT8 MyFavoriteNumber;\r
62 UINT8 TestLateCheck;\r
63 UINT8 TestLateCheck2;\r
64 UINT8 QuestionAboutTreeHugging;\r
65 UINT8 ChooseToActivateNuclearWeaponry;\r
66 UINT8 SuppressGrayOutSomething;\r
67 UINT8 OrderedList[8];\r
b5a906f4 68 UINT16 BootOrder[8];\r
0bb0f8b8 69 UINT8 BootOrderLarge;\r
8d00a0f1 70 UINT8 DynamicRefresh;\r
71 UINT8 DynamicOneof;\r
72 UINT8 DynamicOrderedList[5];\r
38ebfecb 73 UINT8 Reserved;\r
78c2b9a3 74 EFI_HII_REF RefData;\r
38ebfecb
LG
75 UINT8 NameValueVar0;\r
76 UINT16 NameValueVar1;\r
77 UINT16 NameValueVar2[20];\r
96a65fc8
LG
78 UINT8 SerialPortNo;\r
79 UINT8 SerialPortStatus;\r
80 UINT16 SerialPortIo;\r
81 UINT8 SerialPortIrq;\r
ee31d1be
ED
82 UINT8 GetDefaultValueFromCallBack;\r
83 UINT8 GetDefaultValueFromAccess;\r
84 EFI_HII_TIME Time;\r
211cc6e5 85 UINT8 RefreshGuidCount;\r
9bd22b08 86 UINT8 Match2;\r
622ce645 87 UINT8 GetDefaultValueFromCallBackForOrderedList[3];\r
911405a3 88 UINT8 BitCheckbox : 1;\r
6b86f6f3 89 UINT8 ReservedBits: 7; // Reserved bit fields for padding.\r
911405a3 90 UINT16 BitOneof : 6;\r
6b86f6f3 91 UINT16 : 0; // Width 0 used to force alignment.\r
911405a3
DB
92 UINT16 BitNumeric : 12;\r
93 MY_BITS_DATA MyBitData;\r
94 MY_EFI_UNION_DATA MyUnionData;\r
0bb0f8b8 95} DRIVER_SAMPLE_CONFIGURATION;\r
96\r
97//\r
98// 2nd NV data structure definition\r
99//\r
100typedef struct {\r
101 UINT8 Field8;\r
102 UINT16 Field16;\r
103 UINT8 OrderedList[3];\r
003f3c00 104 UINT16 SubmittedCallback;\r
78c2b9a3 105} MY_EFI_VARSTORE_DATA;\r
0bb0f8b8 106\r
911405a3
DB
107//\r
108// 3rd NV data structure definition\r
109//\r
110typedef struct {\r
111 MY_BITS_DATA BitsData;\r
112 UINT32 EfiBitGrayoutTest : 5;\r
113 UINT32 EfiBitNumeric : 4;\r
114 UINT32 EfiBitOneof : 10;\r
115 UINT32 EfiBitCheckbox : 1;\r
6b86f6f3 116 UINT32 : 0; // Width 0 used to force alignment.\r
911405a3
DB
117} MY_EFI_BITS_VARSTORE_DATA;\r
118\r
7e3bcccb
LG
119//\r
120// Labels definition\r
121//\r
122#define LABEL_UPDATE1 0x1234\r
123#define LABEL_UPDATE2 0x2234\r
211cc6e5 124#define LABEL_UPDATE3 0x3234\r
7e3bcccb 125#define LABEL_END 0x2223\r
0bb0f8b8 126\r
127#pragma pack()\r
128\r
129#endif\r