]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/FSVariable/FSVariable.h
1. delete Include/Guid/VariableInfo.h
[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 #include <Guid/VariableFormat.h>
42
43 #include <Protocol/Variable.h>
44 #include <Protocol/VariableWrite.h>
45 #include <Protocol/SimpleFileSystem.h>
46 #include <Protocol/BlockIo.h>
47
48
49 #include "EfiFlashMap.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 #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
57
58 typedef enum {
59 Physical,
60 Virtual
61 } VARIABLE_POINTER_TYPE;
62
63 typedef enum {
64 NonVolatile,
65 Volatile,
66 MaxType
67 } VARIABLE_STORAGE_TYPE;
68
69 typedef struct {
70 VARIABLE_HEADER *CurrPtr;
71 VARIABLE_HEADER *EndPtr;
72 VARIABLE_HEADER *StartPtr;
73 VARIABLE_STORAGE_TYPE Type;
74 } VARIABLE_POINTER_TRACK;
75
76 #define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \
77 ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \
78 (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \
79 )
80
81
82 typedef struct {
83 EFI_EVENT_NOTIFY GoVirtualChildEvent[MaxType];
84 VARIABLE_STORAGE *VariableStore[MaxType]; // Instance of VariableStorage
85 VOID *VariableBase[MaxType]; // Start address of variable storage
86 UINTN LastVariableOffset[MaxType]; // The position to write new variable to (index from VariableBase)
87 VOID *Scratch; // Buffer used during reclaim
88 } VARIABLE_GLOBAL;
89
90 //
91 // Functions
92 //
93
94 EFI_STATUS
95 EFIAPI
96 VariableServiceInitialize (
97 IN EFI_HANDLE ImageHandle,
98 IN EFI_SYSTEM_TABLE *SystemTable
99 );
100
101 VOID
102 EFIAPI
103 VariableClassAddressChangeEvent (
104 IN EFI_EVENT Event,
105 IN VOID *Context
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 );
117
118 EFI_STATUS
119 EFIAPI
120 GetNextVariableName (
121 IN OUT UINTN *VariableNameSize,
122 IN OUT CHAR16 *VariableName,
123 IN OUT EFI_GUID *VendorGuid
124 );
125
126 EFI_STATUS
127 EFIAPI
128 SetVariable (
129 IN CHAR16 *VariableName,
130 IN EFI_GUID *VendorGuid,
131 IN UINT32 Attributes,
132 IN UINTN DataSize,
133 IN VOID *Data
134 );
135
136 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
137 EFI_STATUS
138 EFIAPI
139 QueryVariableInfo (
140 IN UINT32 Attributes,
141 OUT UINT64 *MaximumVariableStorageSize,
142 OUT UINT64 *RemainingVariableStorageSize,
143 OUT UINT64 *MaximumVariableSize
144 );
145 #endif // EFI_SPECIFICATION_VERSION >= 0x00020000
146
147 #endif