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
|
|
|
|
2008-07-08 15:29:42 +02:00
|
|
|
Copyright (c) 2006 - 2008 Intel Corporation. <BR>
|
2007-07-24 12:52:02 +02:00
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
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
|
2008-11-27 05:53:43 +01:00
|
|
|
|
2007-07-24 12:52:02 +02: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.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#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:
|
|
|
|
/// * 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
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Alignment of Variable Data Header in Variable Store region
|
|
|
|
///
|
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
|
|
|
///
|
2009-01-09 07:26:42 +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
|
|
|
|
|
|
|
///
|
|
|
|
/// Variable Store Header Format and State
|
|
|
|
///
|
|
|
|
#define VARIABLE_STORE_FORMATTED 0x5a
|
|
|
|
#define VARIABLE_STORE_HEALTHY 0xfe
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Variable Store region header
|
|
|
|
///
|
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
|
|
|
///
|
|
|
|
/// variable region format state
|
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT8 Format;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
|
|
|
/// variable region healthy state
|
|
|
|
///
|
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
|
|
|
///
|
|
|
|
/// Variable data start flag
|
|
|
|
///
|
|
|
|
#define VARIABLE_DATA 0x55AA
|
|
|
|
|
|
|
|
///
|
|
|
|
/// Variable State flags
|
|
|
|
///
|
2009-06-11 16:17:23 +02:00
|
|
|
#define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transition
|
2008-12-25 10:13:53 +01:00
|
|
|
#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
|
|
|
|
|
|
|
///
|
2009-01-09 07:26:42 +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
|
|
|
///
|
|
|
|
/// Variable Data Start Flag
|
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT16 StartId;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
|
|
|
/// Variable State defined above
|
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT8 State;
|
|
|
|
UINT8 Reserved;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
|
|
|
/// Attributes of variable defined in UEFI spec
|
|
|
|
///
|
2007-07-24 12:52:02 +02:00
|
|
|
UINT32 Attributes;
|
2008-11-27 05:53:43 +01:00
|
|
|
///
|
2009-06-11 16:17:23 +02: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
|
|
|
///
|
|
|
|
/// Size of the variable data without this header
|
|
|
|
///
|
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 {
|
2009-07-02 20:06:45 +02: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 spec
|
|
|
|
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_
|