3 Copyright (c) 2006 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
24 // Include common header file for this module.
26 #include "CommonHeader.h"
29 // Statements that include other header files
33 // BugBug: We need relcate the head file.
35 #include <Common/Variable.h>
37 #define VARIABLE_RECLAIM_THRESHOLD (1024)
39 #define VARIABLE_STORE_SIZE (64 * 1024)
40 #define SCRATCH_SIZE (4 * 1024)
43 // Define GET_PAD_SIZE to optimize compiler
45 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
46 #define GET_PAD_SIZE(a) (0)
48 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
51 #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
56 } VARIABLE_POINTER_TYPE
;
59 VARIABLE_HEADER
*CurrPtr
;
60 VARIABLE_HEADER
*EndPtr
;
61 VARIABLE_HEADER
*StartPtr
;
63 } VARIABLE_POINTER_TRACK
;
66 EFI_PHYSICAL_ADDRESS VolatileVariableBase
;
67 EFI_PHYSICAL_ADDRESS NonVolatileVariableBase
;
68 EFI_LOCK VariableServicesLock
;
72 VARIABLE_GLOBAL VariableGlobal
[2];
73 UINTN VolatileLastVariableOffset
;
74 UINTN NonVolatileLastVariableOffset
;
76 } ESAL_VARIABLE_GLOBAL
;
78 extern ESAL_VARIABLE_GLOBAL
*mVariableModuleGlobal
;
85 VariableCommonInitialize (
86 IN EFI_HANDLE ImageHandle
,
87 IN EFI_SYSTEM_TABLE
*SystemTable
93 VariableServiceInitialize (
94 IN EFI_HANDLE ImageHandle
,
95 IN EFI_SYSTEM_TABLE
*SystemTable
101 VariableClassAddressChangeEvent (
110 IN CHAR16
*VariableName
,
111 IN EFI_GUID
* VendorGuid
,
112 OUT UINT32
*Attributes OPTIONAL
,
113 IN OUT UINTN
*DataSize
,
115 IN VARIABLE_GLOBAL
* Global
,
122 GetNextVariableName (
123 IN OUT UINTN
*VariableNameSize
,
124 IN OUT CHAR16
*VariableName
,
125 IN OUT EFI_GUID
*VendorGuid
,
126 IN VARIABLE_GLOBAL
*Global
,
134 IN CHAR16
*VariableName
,
135 IN EFI_GUID
*VendorGuid
,
136 IN UINT32 Attributes
,
139 IN VARIABLE_GLOBAL
*Global
,
140 IN UINTN
*VolatileOffset
,
141 IN UINTN
*NonVolatileOffset
,
149 IN UINT32 Attributes
,
150 OUT UINT64
*MaximumVariableStorageSize
,
151 OUT UINT64
*RemainingVariableStorageSize
,
152 OUT UINT64
*MaximumVariableSize
,
153 IN VARIABLE_GLOBAL
*Global
,