2008-04-09 09:07:50 +02:00
|
|
|
/** @file
|
2007-07-19 12:09:07 +02:00
|
|
|
|
2008-04-09 09:07:50 +02:00
|
|
|
The internal header file includes the common header files, defines
|
|
|
|
internal structure and functions used by RuntimeVariable module.
|
|
|
|
|
|
|
|
Copyright (c) 2006 - 2008, Intel Corporation
|
2007-07-19 12:09:07 +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
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
2008-04-09 09:07:50 +02:00
|
|
|
**/
|
2007-07-19 12:09:07 +02:00
|
|
|
|
2008-12-12 10:27:17 +01:00
|
|
|
#ifndef _VARIABLE_H_
|
|
|
|
#define _VARIABLE_H_
|
2007-07-19 12:09:07 +02:00
|
|
|
|
2008-10-09 03:12:34 +02:00
|
|
|
#include <PiDxe.h>
|
2007-07-19 12:09:07 +02:00
|
|
|
#include <Protocol/VariableWrite.h>
|
|
|
|
#include <Protocol/FaultTolerantWriteLite.h>
|
|
|
|
#include <Protocol/FirmwareVolumeBlock.h>
|
|
|
|
#include <Protocol/Variable.h>
|
|
|
|
#include <Library/PcdLib.h>
|
|
|
|
#include <Library/UefiDriverEntryPoint.h>
|
|
|
|
#include <Library/DxeServicesTableLib.h>
|
|
|
|
#include <Library/UefiRuntimeLib.h>
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include <Library/FvbServiceLib.h>
|
|
|
|
#include <Library/UefiBootServicesTableLib.h>
|
|
|
|
#include <Library/UefiLib.h>
|
|
|
|
#include <Library/BaseLib.h>
|
|
|
|
#include <Library/MemoryAllocationLib.h>
|
2007-10-05 16:40:23 +02:00
|
|
|
#include <Guid/VariableInfo.h>
|
|
|
|
#include <Guid/GlobalVariable.h>
|
2007-07-24 12:52:02 +02:00
|
|
|
#include <VariableFormat.h>
|
2007-07-19 12:09:07 +02:00
|
|
|
|
2007-10-05 16:40:23 +02:00
|
|
|
|
|
|
|
|
2007-07-19 12:09:07 +02:00
|
|
|
#define VARIABLE_RECLAIM_THRESHOLD (1024)
|
|
|
|
|
2007-11-05 17:11:50 +01:00
|
|
|
#define VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)
|
|
|
|
#define SCRATCH_SIZE FixedPcdGet32(PcdMaxVariableSize)
|
2007-07-19 12:09:07 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Define GET_PAD_SIZE to optimize compiler
|
|
|
|
//
|
|
|
|
#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
|
|
|
|
#define GET_PAD_SIZE(a) (0)
|
|
|
|
#else
|
|
|
|
#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
|
|
|
|
#endif
|
|
|
|
|
2008-01-10 05:26:13 +01:00
|
|
|
#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
|
|
|
|
|
2007-07-19 12:09:07 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
VARIABLE_HEADER *CurrPtr;
|
|
|
|
VARIABLE_HEADER *EndPtr;
|
|
|
|
VARIABLE_HEADER *StartPtr;
|
|
|
|
BOOLEAN Volatile;
|
|
|
|
} VARIABLE_POINTER_TRACK;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EFI_PHYSICAL_ADDRESS VolatileVariableBase;
|
|
|
|
EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;
|
|
|
|
EFI_LOCK VariableServicesLock;
|
2008-01-09 11:10:16 +01:00
|
|
|
UINT32 ReentrantState;
|
2007-07-19 12:09:07 +02:00
|
|
|
} VARIABLE_GLOBAL;
|
|
|
|
|
|
|
|
typedef struct {
|
2007-10-05 16:40:23 +02:00
|
|
|
VARIABLE_GLOBAL VariableGlobal;
|
2007-07-19 12:09:07 +02:00
|
|
|
UINTN VolatileLastVariableOffset;
|
|
|
|
UINTN NonVolatileLastVariableOffset;
|
|
|
|
UINT32 FvbInstance;
|
2007-10-05 16:40:23 +02:00
|
|
|
} VARIABLE_MODULE_GLOBAL;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EFI_GUID *Guid;
|
|
|
|
CHAR16 *Name;
|
|
|
|
UINT32 Attributes;
|
|
|
|
UINTN DataSize;
|
|
|
|
VOID *Data;
|
|
|
|
} VARIABLE_CACHE_ENTRY;
|
2007-07-19 12:09:07 +02:00
|
|
|
|
|
|
|
#endif
|