]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/EmuRuntimeDxe/Variable.h
Use <> in #include statements instead of "" for include files from packages
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / EmuRuntimeDxe / 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 //
24 // Statements that include other header files
25 //
26
27 #include <PiDxe.h>
28
29 #include <Protocol/VariableWrite.h>
30 #include <Protocol/Variable.h>
31
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/DebugLib.h>
35 #include <Library/UefiRuntimeLib.h>
36 #include <Library/UefiDriverEntryPoint.h>
37 #include <Library/UefiBootServicesTableLib.h>
38 #include <Library/UefiLib.h>
39 #include <Library/BaseLib.h>
40 #include <VariableFormat.h>
41
42 #define VARIABLE_STORE_SIZE (64 * 1024)
43 #define SCRATCH_SIZE (4 * 1024)
44
45 //
46 // Define GET_PAD_SIZE to optimize compiler
47 //
48 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
49 #define GET_PAD_SIZE(a) (0)
50 #else
51 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
52 #endif
53
54 #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
55
56 typedef enum {
57 Physical,
58 Virtual
59 } VARIABLE_POINTER_TYPE;
60
61 typedef struct {
62 VARIABLE_HEADER *CurrPtr;
63 VARIABLE_HEADER *EndPtr;
64 VARIABLE_HEADER *StartPtr;
65 BOOLEAN Volatile;
66 } VARIABLE_POINTER_TRACK;
67
68 typedef struct {
69 EFI_PHYSICAL_ADDRESS VolatileVariableBase;
70 EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;
71 EFI_LOCK VariableServicesLock;
72 } VARIABLE_GLOBAL;
73
74 typedef struct {
75 VARIABLE_GLOBAL VariableGlobal[2];
76 UINTN VolatileLastVariableOffset;
77 UINTN NonVolatileLastVariableOffset;
78 UINT32 FvbInstance;
79 } ESAL_VARIABLE_GLOBAL;
80
81 extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;
82
83 //
84 // Functions
85 //
86 EFI_STATUS
87 EFIAPI
88 VariableCommonInitialize (
89 IN EFI_HANDLE ImageHandle,
90 IN EFI_SYSTEM_TABLE *SystemTable
91 )
92 ;
93
94 EFI_STATUS
95 EFIAPI
96 VariableServiceInitialize (
97 IN EFI_HANDLE ImageHandle,
98 IN EFI_SYSTEM_TABLE *SystemTable
99 )
100 ;
101
102 VOID
103 EFIAPI
104 VariableClassAddressChangeEvent (
105 IN EFI_EVENT Event,
106 IN VOID *Context
107 )
108 ;
109
110 EFI_STATUS
111 EFIAPI
112 GetVariable (
113 IN CHAR16 *VariableName,
114 IN EFI_GUID * VendorGuid,
115 OUT UINT32 *Attributes OPTIONAL,
116 IN OUT UINTN *DataSize,
117 OUT VOID *Data,
118 IN VARIABLE_GLOBAL * Global,
119 IN UINT32 Instance
120 )
121 ;
122
123 EFI_STATUS
124 EFIAPI
125 GetNextVariableName (
126 IN OUT UINTN *VariableNameSize,
127 IN OUT CHAR16 *VariableName,
128 IN OUT EFI_GUID *VendorGuid,
129 IN VARIABLE_GLOBAL *Global,
130 IN UINT32 Instance
131 )
132 ;
133
134 EFI_STATUS
135 EFIAPI
136 SetVariable (
137 IN CHAR16 *VariableName,
138 IN EFI_GUID *VendorGuid,
139 IN UINT32 Attributes,
140 IN UINTN DataSize,
141 IN VOID *Data,
142 IN VARIABLE_GLOBAL *Global,
143 IN UINTN *VolatileOffset,
144 IN UINTN *NonVolatileOffset,
145 IN UINT32 Instance
146 )
147 ;
148
149 EFI_STATUS
150 EFIAPI
151 QueryVariableInfo (
152 IN UINT32 Attributes,
153 OUT UINT64 *MaximumVariableStorageSize,
154 OUT UINT64 *RemainingVariableStorageSize,
155 OUT UINT64 *MaximumVariableSize,
156 IN VARIABLE_GLOBAL *Global,
157 IN UINT32 Instance
158 )
159 ;
160
161 #endif