]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/FSVariable/FSVariable.h
clean up the un-suitable ';' location when declaring the functions.
[mirror_edk2.git] / DuetPkg / FSVariable / FSVariable.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 FSVariable.h
15
16 Abstract:
17
18 --*/
19
20 #ifndef _FS_VARIABLE_H
21 #define _FS_VARIABLE_H
22
23 //
24 // Statements that include other header files
25 //
26 #include <PiDxe.h>
27
28 #include <Library/BaseLib.h>
29 #include <Library/PcdLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/UefiRuntimeLib.h>
33 #include <Library/DebugLib.h>
34 #include <Library/UefiLib.h>
35 #include <Library/HobLib.h>
36 #include <Library/DxeServicesTableLib.h>
37 #include <Library/DevicePathLib.h>
38
39 #include <Guid/HobList.h>
40 #include <Guid/FlashMapHob.h>
41
42 #include <Protocol/Variable.h>
43 #include <Protocol/VariableWrite.h>
44 #include <Protocol/SimpleFileSystem.h>
45 #include <Protocol/BlockIo.h>
46
47
48 #include "EfiFlashMap.h"
49 #include "VariableFormat.h"
50 #include "VariableStorage.h"
51
52 #define VOLATILE_VARIABLE_STORE_SIZE (64 * 1024)
53 #define VARIABLE_SCRATCH_SIZE (4 * 1024)
54 #define VARIABLE_RECLAIM_THRESHOLD (1024)
55
56 //
57 // Define GET_PAD_SIZE to optimize compiler
58 //
59 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
60 #define GET_PAD_SIZE(a) (0)
61 #else
62 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
63 #endif
64
65 #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
66
67 typedef enum {
68 Physical,
69 Virtual
70 } VARIABLE_POINTER_TYPE;
71
72 typedef enum {
73 NonVolatile,
74 Volatile,
75 MaxType
76 } VARIABLE_STORAGE_TYPE;
77
78 typedef struct {
79 VARIABLE_HEADER *CurrPtr;
80 VARIABLE_HEADER *EndPtr;
81 VARIABLE_HEADER *StartPtr;
82 VARIABLE_STORAGE_TYPE Type;
83 } VARIABLE_POINTER_TRACK;
84
85 #define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \
86 ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \
87 (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \
88 )
89
90
91 typedef struct {
92 EFI_EVENT_NOTIFY GoVirtualChildEvent[MaxType];
93 VARIABLE_STORAGE *VariableStore[MaxType]; // Instance of VariableStorage
94 VOID *VariableBase[MaxType]; // Start address of variable storage
95 UINTN LastVariableOffset[MaxType]; // The position to write new variable to (index from VariableBase)
96 VOID *Scratch; // Buffer used during reclaim
97 } VARIABLE_GLOBAL;
98
99 //
100 // Functions
101 //
102
103 EFI_STATUS
104 EFIAPI
105 VariableServiceInitialize (
106 IN EFI_HANDLE ImageHandle,
107 IN EFI_SYSTEM_TABLE *SystemTable
108 );
109
110 VOID
111 EFIAPI
112 VariableClassAddressChangeEvent (
113 IN EFI_EVENT Event,
114 IN VOID *Context
115 );
116
117 EFI_STATUS
118 EFIAPI
119 GetVariable (
120 IN CHAR16 *VariableName,
121 IN EFI_GUID *VendorGuid,
122 OUT UINT32 *Attributes OPTIONAL,
123 IN OUT UINTN *DataSize,
124 OUT VOID *Data
125 );
126
127 EFI_STATUS
128 EFIAPI
129 GetNextVariableName (
130 IN OUT UINTN *VariableNameSize,
131 IN OUT CHAR16 *VariableName,
132 IN OUT EFI_GUID *VendorGuid
133 );
134
135 EFI_STATUS
136 EFIAPI
137 SetVariable (
138 IN CHAR16 *VariableName,
139 IN EFI_GUID *VendorGuid,
140 IN UINT32 Attributes,
141 IN UINTN DataSize,
142 IN VOID *Data
143 );
144
145 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
146 EFI_STATUS
147 EFIAPI
148 QueryVariableInfo (
149 IN UINT32 Attributes,
150 OUT UINT64 *MaximumVariableStorageSize,
151 OUT UINT64 *RemainingVariableStorageSize,
152 OUT UINT64 *MaximumVariableSize
153 );
154 #endif // EFI_SPECIFICATION_VERSION >= 0x00020000
155
156 #endif