]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/EmuRuntimeDxe/Variable.h
Add comments and DoxyGen format for these files.
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / EmuRuntimeDxe / Variable.h
1 /** @file
2
3 The internal header file includes the common header files, defines
4 internal structure and functions used by EmuVariable module.
5
6 Copyright (c) 2006 - 2008, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16
17 #ifndef _VARIABLE_H
18 #define _VARIABLE_H
19
20 //
21 // Statements that include other header files
22 //
23
24 #include <PiDxe.h>
25
26 #include <Protocol/VariableWrite.h>
27 #include <Protocol/Variable.h>
28
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/MemoryAllocationLib.h>
31 #include <Library/DebugLib.h>
32 #include <Library/UefiRuntimeLib.h>
33 #include <Library/UefiDriverEntryPoint.h>
34 #include <Library/UefiBootServicesTableLib.h>
35 #include <Library/UefiLib.h>
36 #include <Library/BaseLib.h>
37 #include <Library/PcdLib.h>
38 #include <VariableFormat.h>
39
40 #define VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)
41 #define SCRATCH_SIZE FixedPcdGet32(PcdMaxVariableSize)
42
43 //
44 // Define GET_PAD_SIZE to optimize compiler
45 //
46 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
47 #define GET_PAD_SIZE(a) (0)
48 #else
49 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
50 #endif
51
52 #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
53
54 typedef enum {
55 Physical,
56 Virtual
57 } VARIABLE_POINTER_TYPE;
58
59 typedef struct {
60 VARIABLE_HEADER *CurrPtr;
61 VARIABLE_HEADER *EndPtr;
62 VARIABLE_HEADER *StartPtr;
63 BOOLEAN Volatile;
64 } VARIABLE_POINTER_TRACK;
65
66 typedef struct {
67 EFI_PHYSICAL_ADDRESS VolatileVariableBase;
68 EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;
69 EFI_LOCK VariableServicesLock;
70 } VARIABLE_GLOBAL;
71
72 typedef struct {
73 VARIABLE_GLOBAL VariableGlobal[2];
74 UINTN VolatileLastVariableOffset;
75 UINTN NonVolatileLastVariableOffset;
76 UINT32 FvbInstance;
77 } ESAL_VARIABLE_GLOBAL;
78
79 extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;
80
81 //
82 // Functions
83 //
84 EFI_STATUS
85 EFIAPI
86 VariableCommonInitialize (
87 IN EFI_HANDLE ImageHandle,
88 IN EFI_SYSTEM_TABLE *SystemTable
89 )
90 ;
91
92 EFI_STATUS
93 EFIAPI
94 VariableServiceInitialize (
95 IN EFI_HANDLE ImageHandle,
96 IN EFI_SYSTEM_TABLE *SystemTable
97 )
98 ;
99
100 VOID
101 EFIAPI
102 VariableClassAddressChangeEvent (
103 IN EFI_EVENT Event,
104 IN VOID *Context
105 )
106 ;
107
108 EFI_STATUS
109 EFIAPI
110 GetVariable (
111 IN CHAR16 *VariableName,
112 IN EFI_GUID * VendorGuid,
113 OUT UINT32 *Attributes OPTIONAL,
114 IN OUT UINTN *DataSize,
115 OUT VOID *Data,
116 IN VARIABLE_GLOBAL * Global,
117 IN UINT32 Instance
118 )
119 ;
120
121 EFI_STATUS
122 EFIAPI
123 GetNextVariableName (
124 IN OUT UINTN *VariableNameSize,
125 IN OUT CHAR16 *VariableName,
126 IN OUT EFI_GUID *VendorGuid,
127 IN VARIABLE_GLOBAL *Global,
128 IN UINT32 Instance
129 )
130 ;
131
132 EFI_STATUS
133 EFIAPI
134 SetVariable (
135 IN CHAR16 *VariableName,
136 IN EFI_GUID *VendorGuid,
137 IN UINT32 Attributes,
138 IN UINTN DataSize,
139 IN VOID *Data,
140 IN VARIABLE_GLOBAL *Global,
141 IN UINTN *VolatileOffset,
142 IN UINTN *NonVolatileOffset,
143 IN UINT32 Instance
144 )
145 ;
146
147 EFI_STATUS
148 EFIAPI
149 QueryVariableInfo (
150 IN UINT32 Attributes,
151 OUT UINT64 *MaximumVariableStorageSize,
152 OUT UINT64 *RemainingVariableStorageSize,
153 OUT UINT64 *MaximumVariableSize,
154 IN VARIABLE_GLOBAL *Global,
155 IN UINT32 Instance
156 )
157 ;
158
159 #endif