2008-07-08 15:29:42 +02:00
|
|
|
/** @file
|
2009-06-11 16:17:23 +02:00
|
|
|
The variable data structures are related to EDK II-specific implementation of UEFI variables.
|
|
|
|
VariableFormat.h defines variable data headers and variable storage region headers.
|
2007-07-24 12:52:02 +02:00
|
|
|
|
2010-04-24 11:49:11 +02:00
|
|
|
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
2010-03-17 21:48:52 +01:00
|
|
|
This program and the accompanying materials are licensed and made available under
|
|
|
|
the terms and conditions of the BSD License that accompanies this distribution.
|
|
|
|
The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php.
|
2008-11-27 05:53:43 +01:00
|
|
|
|
2010-03-17 21:48:52 +01:00
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
2007-07-24 12:52:02 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __VARIABLE_FORMAT_H__
|
|
|
|
#define __VARIABLE_FORMAT_H__
|
|
|
|
|
2009-02-27 06:35:08 +01:00
|
|
|
#define EFI_VARIABLE_GUID \
|
|
|
|
{ 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d } }
|
|
|
|
|
|
|
|
extern EFI_GUID gEfiVariableGuid;
|
|
|
|
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2009-06-11 16:17:23 +02:00
|
|
|
/// Alignment of variable name and data, according to the architecture:
|
2010-03-17 21:48:52 +01:00
|
|
|
/// * For IA-32 and Intel(R) 64 architectures: 1.
|
|
|
|
/// * For IA-64 architecture: 8.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
#if defined (MDE_CPU_IPF)
|
2008-01-10 05:26:13 +01:00
|
|
|
#define ALIGNMENT 8
|
2007-07-24 12:52:02 +02:00
|
|
|
#else
|
2008-01-10 05:26:13 +01:00
|
|
|
#define ALIGNMENT 1
|
2007-07-24 12:52:02 +02:00
|
|
|
#endif
|
|
|
|
|
2009-01-09 07:26:42 +01:00
|
|
|
//
|
2009-06-11 16:17:23 +02:00
|
|
|
// GET_PAD_SIZE calculates the miminal pad bytes needed to make the current pad size satisfy the alignment requirement.
|
2009-01-09 07:26:42 +01:00
|
|
|
//
|
2009-02-27 08:07:27 +01:00
|
|
|
#if (ALIGNMENT == 1)
|
2009-01-09 07:26:42 +01:00
|
|
|
#define GET_PAD_SIZE(a) (0)
|
|
|
|
#else
|
|
|
|
#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Alignment of Variable Data Header in Variable Store region.
|
2009-01-09 07:26:42 +01:00
|
|
|
///
|
2008-01-10 05:26:13 +01:00
|
|
|
#define HEADER_ALIGNMENT 4
|
2009-01-09 07:26:42 +01:00
|
|
|
#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
|
2008-01-10 05:26:13 +01:00
|
|
|
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Status of Variable Store Region.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
typedef enum {
|
|
|
|
EfiRaw,
|
|
|
|
EfiValid,
|
|
|
|
EfiInvalid,
|
|
|
|
EfiUnknown
|
|
|
|
} VARIABLE_STORE_STATUS;
|
|
|
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
2009-02-27 06:35:08 +01:00
|
|
|
#define VARIABLE_STORE_SIGNATURE EFI_VARIABLE_GUID
|
2008-11-27 05:53:43 +01:00
|
|
|
|
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Variable Store Header Format and State.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
|
|
|
#define VARIABLE_STORE_FORMATTED 0x5a
|
|
|
|
#define VARIABLE_STORE_HEALTHY 0xfe
|
|
|
|
|
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Variable Store region header.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
typedef struct {
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
|
|
|
/// Variable store region signature.
|
|
|
|
///
|
2009-02-27 06:35:08 +01:00
|
|
|
EFI_GUID Signature;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2009-02-27 06:35:08 +01:00
|
|
|
/// Size of entire variable store,
|
|
|
|
/// including size of variable store header but not including the size of FvHeader.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT32 Size;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Variable region format state.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT8 Format;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Variable region healthy state.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT8 State;
|
|
|
|
UINT16 Reserved;
|
|
|
|
UINT32 Reserved1;
|
|
|
|
} VARIABLE_STORE_HEADER;
|
|
|
|
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Variable data start flag.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
|
|
|
#define VARIABLE_DATA 0x55AA
|
|
|
|
|
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Variable State flags.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
#define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transition.
|
|
|
|
#define VAR_DELETED 0xfd ///< Variable is obsolete.
|
|
|
|
#define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid.
|
|
|
|
#define VAR_ADDED 0x3f ///< Variable has been completely added.
|
2008-11-27 05:53:43 +01:00
|
|
|
|
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Single Variable Data Header Structure.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
typedef struct {
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Variable Data Start Flag.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT16 StartId;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Variable State defined above.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT8 State;
|
|
|
|
UINT8 Reserved;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Attributes of variable defined in UEFI specification.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT32 Attributes;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Size of variable null-terminated Unicode string name.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT32 NameSize;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2010-03-17 21:48:52 +01:00
|
|
|
/// Size of the variable data without this header.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT32 DataSize;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2009-06-11 16:17:23 +02:00
|
|
|
/// A unique identifier for the vendor that produces and consumes this varaible.
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
EFI_GUID VendorGuid;
|
|
|
|
} VARIABLE_HEADER;
|
|
|
|
|
|
|
|
#pragma pack()
|
|
|
|
|
2009-02-27 06:35:08 +01:00
|
|
|
typedef struct _VARIABLE_INFO_ENTRY VARIABLE_INFO_ENTRY;
|
|
|
|
|
|
|
|
///
|
|
|
|
/// This structure contains the variable list that is put in EFI system table.
|
2009-06-11 16:17:23 +02:00
|
|
|
/// The variable driver collects all variables that were used at boot service time and produces this list.
|
2009-02-27 06:35:08 +01:00
|
|
|
/// This is an optional feature to dump all used variables in shell environment.
|
|
|
|
///
|
|
|
|
struct _VARIABLE_INFO_ENTRY {
|
2010-03-17 21:48:52 +01:00
|
|
|
VARIABLE_INFO_ENTRY *Next; ///< Pointer to next entry.
|
|
|
|
EFI_GUID VendorGuid; ///< Guid of Variable.
|
|
|
|
CHAR16 *Name; ///< Name of Variable.
|
|
|
|
UINT32 Attributes; ///< Attributes of variable defined in UEFI specification.
|
|
|
|
UINT32 ReadCount; ///< Number of times to read this variable.
|
|
|
|
UINT32 WriteCount; ///< Number of times to write this variable.
|
|
|
|
UINT32 DeleteCount; ///< Number of times to delete this variable.
|
|
|
|
UINT32 CacheCount; ///< Number of times that cache hits this variable.
|
|
|
|
BOOLEAN Volatile; ///< TRUE if volatile, FALSE if non-volatile.
|
2009-02-27 06:35:08 +01:00
|
|
|
};
|
|
|
|
|
2007-07-24 12:52:02 +02:00
|
|
|
#endif // _EFI_VARIABLE_H_
|