]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h
Update comments in Variable driver and removed references to FLASH Map Hob in INF...
[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 (64 * 1024)
49 #define SCRATCH_SIZE (4 * 1024)
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 } VARIABLE_GLOBAL;
75
76 typedef struct {
77 VARIABLE_GLOBAL VariableGlobal;
78 UINTN VolatileLastVariableOffset;
79 UINTN NonVolatileLastVariableOffset;
80 UINT32 FvbInstance;
81 } VARIABLE_MODULE_GLOBAL;
82
83 typedef struct {
84 EFI_GUID *Guid;
85 CHAR16 *Name;
86 UINT32 Attributes;
87 UINTN DataSize;
88 VOID *Data;
89 } VARIABLE_CACHE_ENTRY;
90
91
92 //
93 // Functions
94 //
95
96 EFI_STATUS
97 EFIAPI
98 VariableServiceInitialize (
99 IN EFI_HANDLE ImageHandle,
100 IN EFI_SYSTEM_TABLE *SystemTable
101 );
102
103
104 EFI_STATUS
105 FtwVariableSpace (
106 IN EFI_PHYSICAL_ADDRESS VariableBaseAddress,
107 IN UINT8 *Buffer,
108 IN UINTN BufferSize
109 );
110
111 #endif