]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h
1) Fix the bug that Variable Cache Search does not be protected by lock during boot...
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / RuntimeDxe / Variable.h
1 /*++
2
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
8
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.
11
12 Module Name:
13
14 Variable.h
15
16 Abstract:
17
18 --*/
19
20 #ifndef _VARIABLE_H
21 #define _VARIABLE_H
22
23 #include <PiDxe.h>
24 #include <Protocol/VariableWrite.h>
25 #include <Protocol/FaultTolerantWriteLite.h>
26 #include <Protocol/FirmwareVolumeBlock.h>
27 #include <Protocol/Variable.h>
28 #include <Library/PcdLib.h>
29 #include <Library/UefiDriverEntryPoint.h>
30 #include <Library/DxeServicesTableLib.h>
31 #include <Library/UefiRuntimeLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/BaseMemoryLib.h>
34 #include <Library/FvbServiceLib.h>
35 #include <Library/UefiBootServicesTableLib.h>
36 #include <Library/UefiLib.h>
37 #include <Library/BaseLib.h>
38 #include <Library/MemoryAllocationLib.h>
39 #include <Library/HobLib.h>
40 #include <Guid/VariableInfo.h>
41 #include <Guid/GlobalVariable.h>
42 #include <VariableFormat.h>
43
44
45
46 #define VARIABLE_RECLAIM_THRESHOLD (1024)
47
48 #define VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)
49 #define SCRATCH_SIZE FixedPcdGet32(PcdMaxVariableSize)
50
51 //
52 // Define GET_PAD_SIZE to optimize compiler
53 //
54 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
55 #define GET_PAD_SIZE(a) (0)
56 #else
57 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
58 #endif
59
60 #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
61
62
63 typedef struct {
64 VARIABLE_HEADER *CurrPtr;
65 VARIABLE_HEADER *EndPtr;
66 VARIABLE_HEADER *StartPtr;
67 BOOLEAN Volatile;
68 } VARIABLE_POINTER_TRACK;
69
70 typedef struct {
71 EFI_PHYSICAL_ADDRESS VolatileVariableBase;
72 EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;
73 EFI_LOCK VariableServicesLock;
74 UINT32 ReentrantState;
75 } VARIABLE_GLOBAL;
76
77 typedef struct {
78 VARIABLE_GLOBAL VariableGlobal;
79 UINTN VolatileLastVariableOffset;
80 UINTN NonVolatileLastVariableOffset;
81 UINT32 FvbInstance;
82 } VARIABLE_MODULE_GLOBAL;
83
84 typedef struct {
85 EFI_GUID *Guid;
86 CHAR16 *Name;
87 UINT32 Attributes;
88 UINTN DataSize;
89 VOID *Data;
90 } VARIABLE_CACHE_ENTRY;
91
92
93 //
94 // Functions
95 //
96
97 EFI_STATUS
98 EFIAPI
99 VariableServiceInitialize (
100 IN EFI_HANDLE ImageHandle,
101 IN EFI_SYSTEM_TABLE *SystemTable
102 );
103
104
105 EFI_STATUS
106 FtwVariableSpace (
107 IN EFI_PHYSICAL_ADDRESS VariableBaseAddress,
108 IN UINT8 *Buffer,
109 IN UINTN BufferSize
110 );
111
112 #endif