2008-10-31 05:36:53 +01:00
/** @file
2017-09-20 14:20:05 +02:00
Copyright ( c ) 2007 - 2017 , Intel Corporation . All rights reserved . < BR >
2010-04-24 11:33:45 +02:00
This program and the accompanying materials
2008-10-31 05:36:53 +01:00
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution . The full text of the license may be found at
http : //opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN " AS IS " BASIS ,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND , EITHER EXPRESS OR IMPLIED .
Module Name :
NVDataStruc . h
Abstract :
NVData structure used by the sample driver
Revision History :
* */
2008-11-19 14:36:34 +01:00
# ifndef _NVDATASTRUC_H_
# define _NVDATASTRUC_H_
2008-10-31 05:36:53 +01:00
2009-04-17 07:28:31 +02:00
# include <Guid/HiiPlatformSetupFormset.h>
2010-03-01 00:56:57 +01:00
# include <Guid/HiiFormMapMethodGuid.h>
2011-09-18 14:21:01 +02:00
# include <Guid/DriverSampleHii.h>
# include <Guid/ZeroGuid.h>
2011-08-30 14:39:53 +02:00
2008-11-04 15:28:08 +01:00
# define CONFIGURATION_VARSTORE_ID 0x1234
2017-09-20 14:20:05 +02:00
# define BITS_VARSTORE_ID 0x2345
2008-10-31 05:36:53 +01:00
# pragma pack(1)
2017-09-20 14:20:05 +02:00
2018-02-08 15:28:39 +01:00
//
// !!! 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.
// In the C code use sizeof() to get the size the strucure, the results may vary form the compiler(VS,GCC...).
// But the size of the storage calculated by VfrCompiler is fixed (calculate with alignment).
// 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:
// 1. Add bit field (with/without name) with remianing with for padding.
// 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.
//
2017-09-20 14:20:05 +02:00
typedef struct {
UINT16 NestByteField ;
UINT8 : 1 ; // unamed field can be used for padding
UINT8 NestBitCheckbox : 1 ;
UINT8 NestBitOneof : 2 ;
UINT8 : 0 ; // Special width 0 can be used to force alignment at the next word boundary
UINT8 NestBitNumeric : 4 ;
} MY_BITS_DATA ;
typedef union {
UINT16 BitField : 10 ;
UINT8 ByteField ;
} MY_EFI_UNION_DATA ;
2008-10-31 05:36:53 +01:00
typedef struct {
UINT16 MyStringData [ 40 ] ;
UINT16 SomethingHiddenForHtml ;
UINT8 HowOldAreYouInYearsManual ;
UINT16 HowTallAreYouManual ;
UINT8 HowOldAreYouInYears ;
UINT16 HowTallAreYou ;
UINT8 MyFavoriteNumber ;
UINT8 TestLateCheck ;
UINT8 TestLateCheck2 ;
UINT8 QuestionAboutTreeHugging ;
UINT8 ChooseToActivateNuclearWeaponry ;
UINT8 SuppressGrayOutSomething ;
UINT8 OrderedList [ 8 ] ;
2009-11-12 05:58:19 +01:00
UINT16 BootOrder [ 8 ] ;
2008-10-31 05:36:53 +01:00
UINT8 BootOrderLarge ;
2008-11-04 15:28:08 +01:00
UINT8 DynamicRefresh ;
UINT8 DynamicOneof ;
UINT8 DynamicOrderedList [ 5 ] ;
2010-02-11 02:59:35 +01:00
UINT8 Reserved ;
2011-08-30 14:39:53 +02:00
EFI_HII_REF RefData ;
2010-02-11 02:59:35 +01:00
UINT8 NameValueVar0 ;
UINT16 NameValueVar1 ;
UINT16 NameValueVar2 [ 20 ] ;
2010-03-01 00:56:57 +01:00
UINT8 SerialPortNo ;
UINT8 SerialPortStatus ;
UINT16 SerialPortIo ;
UINT8 SerialPortIrq ;
2011-05-20 04:58:35 +02:00
UINT8 GetDefaultValueFromCallBack ;
UINT8 GetDefaultValueFromAccess ;
EFI_HII_TIME Time ;
2011-06-08 10:09:47 +02:00
UINT8 RefreshGuidCount ;
2015-05-06 12:40:53 +02:00
UINT8 Match2 ;
2016-04-15 07:25:55 +02:00
UINT8 GetDefaultValueFromCallBackForOrderedList [ 3 ] ;
2017-09-20 14:20:05 +02:00
UINT8 BitCheckbox : 1 ;
2018-02-08 15:28:39 +01:00
UINT8 ReservedBits : 7 ; // Reserved bit fields for padding.
2017-09-20 14:20:05 +02:00
UINT16 BitOneof : 6 ;
2018-02-08 15:28:39 +01:00
UINT16 : 0 ; // Width 0 used to force alignment.
2017-09-20 14:20:05 +02:00
UINT16 BitNumeric : 12 ;
MY_BITS_DATA MyBitData ;
MY_EFI_UNION_DATA MyUnionData ;
2008-10-31 05:36:53 +01:00
} DRIVER_SAMPLE_CONFIGURATION ;
//
// 2nd NV data structure definition
//
typedef struct {
UINT8 Field8 ;
UINT16 Field16 ;
UINT8 OrderedList [ 3 ] ;
2016-02-23 04:04:20 +01:00
UINT16 SubmittedCallback ;
2011-08-30 14:39:53 +02:00
} MY_EFI_VARSTORE_DATA ;
2008-10-31 05:36:53 +01:00
2017-09-20 14:20:05 +02:00
//
// 3rd NV data structure definition
//
typedef struct {
MY_BITS_DATA BitsData ;
UINT32 EfiBitGrayoutTest : 5 ;
UINT32 EfiBitNumeric : 4 ;
UINT32 EfiBitOneof : 10 ;
UINT32 EfiBitCheckbox : 1 ;
2018-02-08 15:28:39 +01:00
UINT32 : 0 ; // Width 0 used to force alignment.
2017-09-20 14:20:05 +02:00
} MY_EFI_BITS_VARSTORE_DATA ;
2009-04-13 08:05:15 +02:00
//
// Labels definition
//
# define LABEL_UPDATE1 0x1234
# define LABEL_UPDATE2 0x2234
2011-06-08 10:09:47 +02:00
# define LABEL_UPDATE3 0x3234
2009-04-13 08:05:15 +02:00
# define LABEL_END 0x2223
2008-10-31 05:36:53 +01:00
# pragma pack()
# endif