]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/EmuRuntimeDxe/Variable.h
clean up the un-suitable ';' location when declaring the functions.
[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 <Uefi.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 EFI_STATUS
92 EFIAPI
93 VariableServiceInitialize (
94 IN EFI_HANDLE ImageHandle,
95 IN EFI_SYSTEM_TABLE *SystemTable
96 );
97
98 VOID
99 EFIAPI
100 VariableClassAddressChangeEvent (
101 IN EFI_EVENT Event,
102 IN VOID *Context
103 );
104
105 EFI_STATUS
106 EFIAPI
107 GetVariable (
108 IN CHAR16 *VariableName,
109 IN EFI_GUID * VendorGuid,
110 OUT UINT32 *Attributes OPTIONAL,
111 IN OUT UINTN *DataSize,
112 OUT VOID *Data,
113 IN VARIABLE_GLOBAL * Global,
114 IN UINT32 Instance
115 );
116
117 EFI_STATUS
118 EFIAPI
119 GetNextVariableName (
120 IN OUT UINTN *VariableNameSize,
121 IN OUT CHAR16 *VariableName,
122 IN OUT EFI_GUID *VendorGuid,
123 IN VARIABLE_GLOBAL *Global,
124 IN UINT32 Instance
125 );
126
127 EFI_STATUS
128 EFIAPI
129 SetVariable (
130 IN CHAR16 *VariableName,
131 IN EFI_GUID *VendorGuid,
132 IN UINT32 Attributes,
133 IN UINTN DataSize,
134 IN VOID *Data,
135 IN VARIABLE_GLOBAL *Global,
136 IN UINTN *VolatileOffset,
137 IN UINTN *NonVolatileOffset,
138 IN UINT32 Instance
139 );
140
141 EFI_STATUS
142 EFIAPI
143 QueryVariableInfo (
144 IN UINT32 Attributes,
145 OUT UINT64 *MaximumVariableStorageSize,
146 OUT UINT64 *RemainingVariableStorageSize,
147 OUT UINT64 *MaximumVariableSize,
148 IN VARIABLE_GLOBAL *Global,
149 IN UINT32 Instance
150 );
151
152 #endif