3 Caution: This file is used for Duet platform only, do not use them in real platform.
4 All variable code, variable metadata, and variable data used by Duet platform are on
5 disk. They can be changed by user. BIOS is not able to protoect those.
6 Duet trusts all meta data from disk. If variable code, variable metadata and variable
7 data is modified in inproper way, the behavior is undefined.
9 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
10 This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
26 #ifndef _FS_VARIABLE_H
27 #define _FS_VARIABLE_H
30 // Statements that include other header files
34 #include <Library/BaseLib.h>
35 #include <Library/PcdLib.h>
36 #include <Library/BaseMemoryLib.h>
37 #include <Library/MemoryAllocationLib.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/UefiRuntimeLib.h>
40 #include <Library/DebugLib.h>
41 #include <Library/UefiLib.h>
42 #include <Library/HobLib.h>
43 #include <Library/DxeServicesTableLib.h>
44 #include <Library/DevicePathLib.h>
46 #include <Guid/HobList.h>
47 #include <Guid/FlashMapHob.h>
48 #include <Guid/VariableFormat.h>
49 #include <Guid/GlobalVariable.h>
50 #include <Protocol/Variable.h>
51 #include <Protocol/VariableWrite.h>
52 #include <Protocol/SimpleFileSystem.h>
53 #include <Protocol/BlockIo.h>
56 #include "EfiFlashMap.h"
57 #include "VariableStorage.h"
59 #define VOLATILE_VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)
60 #define VARIABLE_SCRATCH_SIZE MAX(FixedPcdGet32(PcdMaxVariableSize), FixedPcdGet32(PcdMaxHardwareErrorVariableSize))
61 #define VARIABLE_RECLAIM_THRESHOLD (1024)
63 /// The size of a 3 character ISO639 language code.
65 #define ISO_639_2_ENTRY_SIZE 3
67 #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
72 } VARIABLE_POINTER_TYPE
;
78 } VARIABLE_STORAGE_TYPE
;
81 VARIABLE_HEADER
*CurrPtr
;
82 VARIABLE_HEADER
*EndPtr
;
83 VARIABLE_HEADER
*StartPtr
;
84 VARIABLE_STORAGE_TYPE Type
;
85 } VARIABLE_POINTER_TRACK
;
87 #define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \
88 ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \
89 (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \
94 EFI_EVENT_NOTIFY GoVirtualChildEvent
[MaxType
];
95 VARIABLE_STORAGE
*VariableStore
[MaxType
]; // Instance of VariableStorage
96 VOID
*VariableBase
[MaxType
]; // Start address of variable storage
97 UINTN LastVariableOffset
[MaxType
]; // The position to write new variable to (index from VariableBase)
98 VOID
*Scratch
; // Buffer used during reclaim
99 UINTN CommonVariableTotalSize
;
100 UINTN HwErrVariableTotalSize
;
101 CHAR8
*PlatformLangCodes
;
104 CHAR8 Lang
[ISO_639_2_ENTRY_SIZE
+ 1];
113 VariableServiceInitialize (
114 IN EFI_HANDLE ImageHandle
,
115 IN EFI_SYSTEM_TABLE
*SystemTable
120 VariableClassAddressChangeEvent (
128 IN CHAR16
*VariableName
,
129 IN EFI_GUID
*VendorGuid
,
130 OUT UINT32
*Attributes OPTIONAL
,
131 IN OUT UINTN
*DataSize
,
137 GetNextVariableName (
138 IN OUT UINTN
*VariableNameSize
,
139 IN OUT CHAR16
*VariableName
,
140 IN OUT EFI_GUID
*VendorGuid
146 IN CHAR16
*VariableName
,
147 IN EFI_GUID
*VendorGuid
,
148 IN UINT32 Attributes
,
156 IN UINT32 Attributes
,
157 OUT UINT64
*MaximumVariableStorageSize
,
158 OUT UINT64
*RemainingVariableStorageSize
,
159 OUT UINT64
*MaximumVariableSize