]>
Commit | Line | Data |
---|---|---|
9071550e | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006 - 2007, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | FSVariable.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | --*/\r | |
19 | \r | |
20 | #ifndef _FS_VARIABLE_H\r | |
21 | #define _FS_VARIABLE_H\r | |
22 | \r | |
23 | //\r | |
24 | // Statements that include other header files\r | |
25 | //\r | |
26 | #include <PiDxe.h>\r | |
27 | \r | |
28 | #include <Library/BaseLib.h>\r | |
29 | #include <Library/PcdLib.h>\r | |
30 | #include <Library/BaseMemoryLib.h>\r | |
31 | #include <Library/UefiBootServicesTableLib.h>\r | |
32 | #include <Library/UefiRuntimeLib.h>\r | |
33 | #include <Library/DebugLib.h>\r | |
34 | #include <Library/UefiLib.h>\r | |
35 | #include <Library/HobLib.h>\r | |
36 | #include <Library/DxeServicesTableLib.h>\r | |
37 | #include <Library/DevicePathLib.h>\r | |
38 | \r | |
39 | #include <Guid/HobList.h>\r | |
40 | #include <Guid/FlashMapHob.h>\r | |
41 | \r | |
42 | #include <Protocol/Variable.h>\r | |
43 | #include <Protocol/VariableWrite.h>\r | |
44 | #include <Protocol/SimpleFileSystem.h>\r | |
45 | #include <Protocol/BlockIo.h>\r | |
46 | \r | |
47 | \r | |
48 | #include "EfiFlashMap.h"\r | |
49 | #include "VariableFormat.h"\r | |
50 | #include "VariableStorage.h"\r | |
51 | \r | |
52 | #define VOLATILE_VARIABLE_STORE_SIZE (64 * 1024)\r | |
53 | #define VARIABLE_SCRATCH_SIZE (4 * 1024)\r | |
54 | #define VARIABLE_RECLAIM_THRESHOLD (1024)\r | |
55 | \r | |
9071550e | 56 | #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r |
57 | \r | |
58 | typedef enum {\r | |
59 | Physical,\r | |
60 | Virtual\r | |
61 | } VARIABLE_POINTER_TYPE;\r | |
62 | \r | |
63 | typedef enum {\r | |
64 | NonVolatile,\r | |
65 | Volatile,\r | |
66 | MaxType\r | |
67 | } VARIABLE_STORAGE_TYPE;\r | |
68 | \r | |
69 | typedef struct {\r | |
70 | VARIABLE_HEADER *CurrPtr;\r | |
71 | VARIABLE_HEADER *EndPtr;\r | |
72 | VARIABLE_HEADER *StartPtr;\r | |
73 | VARIABLE_STORAGE_TYPE Type;\r | |
74 | } VARIABLE_POINTER_TRACK;\r | |
75 | \r | |
76 | #define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \\r | |
77 | ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \\r | |
78 | (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \\r | |
79 | )\r | |
80 | \r | |
81 | \r | |
82 | typedef struct {\r | |
83 | EFI_EVENT_NOTIFY GoVirtualChildEvent[MaxType];\r | |
84 | VARIABLE_STORAGE *VariableStore[MaxType]; // Instance of VariableStorage\r | |
85 | VOID *VariableBase[MaxType]; // Start address of variable storage\r | |
86 | UINTN LastVariableOffset[MaxType]; // The position to write new variable to (index from VariableBase)\r | |
87 | VOID *Scratch; // Buffer used during reclaim\r | |
88 | } VARIABLE_GLOBAL;\r | |
89 | \r | |
90 | //\r | |
91 | // Functions\r | |
92 | //\r | |
93 | \r | |
94 | EFI_STATUS\r | |
95 | EFIAPI\r | |
96 | VariableServiceInitialize (\r | |
97 | IN EFI_HANDLE ImageHandle,\r | |
98 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
ed66e1bc | 99 | );\r |
9071550e | 100 | \r |
101 | VOID\r | |
102 | EFIAPI\r | |
103 | VariableClassAddressChangeEvent (\r | |
104 | IN EFI_EVENT Event,\r | |
105 | IN VOID *Context\r | |
ed66e1bc | 106 | );\r |
9071550e | 107 | \r |
108 | EFI_STATUS\r | |
109 | EFIAPI\r | |
110 | GetVariable (\r | |
111 | IN CHAR16 *VariableName,\r | |
112 | IN EFI_GUID *VendorGuid,\r | |
113 | OUT UINT32 *Attributes OPTIONAL,\r | |
114 | IN OUT UINTN *DataSize,\r | |
115 | OUT VOID *Data\r | |
ed66e1bc | 116 | );\r |
9071550e | 117 | \r |
118 | EFI_STATUS\r | |
119 | EFIAPI\r | |
120 | GetNextVariableName (\r | |
121 | IN OUT UINTN *VariableNameSize,\r | |
122 | IN OUT CHAR16 *VariableName,\r | |
123 | IN OUT EFI_GUID *VendorGuid\r | |
ed66e1bc | 124 | );\r |
9071550e | 125 | \r |
126 | EFI_STATUS\r | |
127 | EFIAPI\r | |
128 | SetVariable (\r | |
129 | IN CHAR16 *VariableName,\r | |
130 | IN EFI_GUID *VendorGuid,\r | |
131 | IN UINT32 Attributes,\r | |
132 | IN UINTN DataSize,\r | |
133 | IN VOID *Data\r | |
ed66e1bc | 134 | );\r |
9071550e | 135 | \r |
136 | #if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r | |
137 | EFI_STATUS\r | |
138 | EFIAPI\r | |
139 | QueryVariableInfo (\r | |
140 | IN UINT32 Attributes,\r | |
141 | OUT UINT64 *MaximumVariableStorageSize,\r | |
142 | OUT UINT64 *RemainingVariableStorageSize,\r | |
143 | OUT UINT64 *MaximumVariableSize\r | |
ed66e1bc | 144 | );\r |
9071550e | 145 | #endif // EFI_SPECIFICATION_VERSION >= 0x00020000\r |
146 | \r | |
147 | #endif\r |