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
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.
18 Tiano PEIM to provide the variable functionality
22 #ifndef _PEI_VARIABLE_H
23 #define _PEI_VARIABLE_H
26 #include <Ppi/ReadOnlyVariable.h>
27 #include <Ppi/ReadOnlyVariable2.h>
28 #include <Library/DebugLib.h>
29 #include <Library/PeimEntryPoint.h>
30 #include <Library/HobLib.h>
31 #include <Library/PcdLib.h>
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/PeiServicesTablePointerLib.h>
34 #include <VariableFormat.h>
37 // Define GET_PAD_SIZE to optimize compiler
39 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
40 #define GET_PAD_SIZE(a) (0)
42 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
45 #define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
48 VARIABLE_HEADER
*CurrPtr
;
49 VARIABLE_HEADER
*EndPtr
;
50 VARIABLE_HEADER
*StartPtr
;
51 } VARIABLE_POINTER_TRACK
;
53 #define VARIABLE_INDEX_TABLE_VOLUME 122
55 #define EFI_VARIABLE_INDEX_TABLE_GUID \
56 { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }
61 VARIABLE_HEADER
*EndPtr
;
62 VARIABLE_HEADER
*StartPtr
;
63 UINT16 Index
[VARIABLE_INDEX_TABLE_VOLUME
];
64 } VARIABLE_INDEX_TABLE
;
72 PeimInitializeVariableServices (
73 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
74 IN EFI_PEI_SERVICES
**PeiServices
80 TODO: Add function description
84 FfsHeader - TODO: add argument description
85 PeiServices - TODO: add argument description
89 TODO: add return values
97 IN EFI_PEI_SERVICES
**PeiServices
,
98 IN CHAR16
*VariableName
,
99 IN EFI_GUID
* VendorGuid
,
100 OUT UINT32
*Attributes OPTIONAL
,
101 IN OUT UINTN
*DataSize
,
108 TODO: Add function description
112 PeiServices - TODO: add argument description
113 VariableName - TODO: add argument description
114 VendorGuid - TODO: add argument description
115 Attributes - TODO: add argument description
116 DataSize - TODO: add argument description
117 Data - TODO: add argument description
121 TODO: add return values
129 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI
*This
,
130 IN CONST CHAR16
*VariableName
,
131 IN CONST EFI_GUID
*VariableGuid
,
132 OUT UINT32
*Attributes
,
133 IN OUT UINTN
*DataSize
,
140 Provide the read variable functionality of the variable services.
144 PeiServices - General purpose services available to every PEIM.
146 VariableName - The variable name
148 VendorGuid - The vendor's GUID
150 Attributes - Pointer to the attribute
152 DataSize - Size of data
154 Data - Pointer to data
158 EFI_SUCCESS - The interface could be successfully installed
160 EFI_NOT_FOUND - The variable could not be discovered
162 EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough
169 PeiGetNextVariableName2 (
170 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI
*This
,
171 IN OUT UINTN
*VariableNameSize
,
172 IN OUT CHAR16
*VariableName
,
173 IN OUT EFI_GUID
*VariableGuid
179 Provide the get next variable functionality of the variable services.
183 PeiServices - General purpose services available to every PEIM.
184 VariabvleNameSize - The variable name's size.
185 VariableName - A pointer to the variable's name.
186 VariableGuid - A pointer to the EFI_GUID structure.
188 VariableNameSize - Size of the variable name
190 VariableName - The variable name
192 VendorGuid - The vendor's GUID
196 EFI_SUCCESS - The interface could be successfully installed
198 EFI_NOT_FOUND - The variable could not be discovered
205 PeiGetNextVariableName (
206 IN EFI_PEI_SERVICES
**PeiServices
,
207 IN OUT UINTN
*VariableNameSize
,
208 IN OUT CHAR16
*VariableName
,
209 IN OUT EFI_GUID
*VendorGuid
215 TODO: Add function description
219 PeiServices - TODO: add argument description
220 VariableNameSize - TODO: add argument description
221 VariableName - TODO: add argument description
222 VendorGuid - TODO: add argument description
226 TODO: add return values
232 Get one variable by the index count.
234 @param IndexTable The pointer to variable index table.
235 @param Count The index count of variable in index table.
237 @return The pointer to variable header indexed by count.
242 IN VARIABLE_INDEX_TABLE
*IndexTable
,
247 Record Variable in VariableIndex HOB.
249 Record Variable in VariableIndex HOB and update the length of variable index table.
251 @param IndexTable The pointer to variable index table.
252 @param Variable The pointer to the variable that will be recorded.
258 VariableIndexTableUpdate (
259 IN OUT VARIABLE_INDEX_TABLE
*IndexTable
,
260 IN VARIABLE_HEADER
*Variable
263 #endif // _PEI_VARIABLE_H