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 GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
47 #define GET_VARIABLE_DATA_PTR(a) \
48 (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (a) + (a)->NameSize + GET_PAD_SIZE ((a)->NameSize))
51 VARIABLE_HEADER
*CurrPtr
;
52 VARIABLE_HEADER
*EndPtr
;
53 VARIABLE_HEADER
*StartPtr
;
54 } VARIABLE_POINTER_TRACK
;
56 #define VARIABLE_INDEX_TABLE_VOLUME 122
58 #define EFI_VARIABLE_INDEX_TABLE_GUID \
59 { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }
64 VARIABLE_HEADER
*EndPtr
;
65 VARIABLE_HEADER
*StartPtr
;
66 UINT16 Index
[VARIABLE_INDEX_TABLE_VOLUME
];
67 } VARIABLE_INDEX_TABLE
;
75 PeimInitializeVariableServices (
76 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
77 IN EFI_PEI_SERVICES
**PeiServices
83 TODO: Add function description
87 FfsHeader - TODO: add argument description
88 PeiServices - TODO: add argument description
92 TODO: add return values
100 IN EFI_PEI_SERVICES
**PeiServices
,
101 IN CHAR16
*VariableName
,
102 IN EFI_GUID
* VendorGuid
,
103 OUT UINT32
*Attributes OPTIONAL
,
104 IN OUT UINTN
*DataSize
,
111 TODO: Add function description
115 PeiServices - TODO: add argument description
116 VariableName - TODO: add argument description
117 VendorGuid - TODO: add argument description
118 Attributes - TODO: add argument description
119 DataSize - TODO: add argument description
120 Data - TODO: add argument description
124 TODO: add return values
132 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI
*This
,
133 IN CONST CHAR16
*VariableName
,
134 IN CONST EFI_GUID
*VariableGuid
,
135 OUT UINT32
*Attributes
,
136 IN OUT UINTN
*DataSize
,
143 Provide the read variable functionality of the variable services.
147 PeiServices - General purpose services available to every PEIM.
149 VariableName - The variable name
151 VendorGuid - The vendor's GUID
153 Attributes - Pointer to the attribute
155 DataSize - Size of data
157 Data - Pointer to data
161 EFI_SUCCESS - The interface could be successfully installed
163 EFI_NOT_FOUND - The variable could not be discovered
165 EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough
172 PeiGetNextVariableName2 (
173 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI
*This
,
174 IN OUT UINTN
*VariableNameSize
,
175 IN OUT CHAR16
*VariableName
,
176 IN OUT EFI_GUID
*VariableGuid
182 Provide the get next variable functionality of the variable services.
186 PeiServices - General purpose services available to every PEIM.
187 VariabvleNameSize - The variable name's size.
188 VariableName - A pointer to the variable's name.
189 VariableGuid - A pointer to the EFI_GUID structure.
191 VariableNameSize - Size of the variable name
193 VariableName - The variable name
195 VendorGuid - The vendor's GUID
199 EFI_SUCCESS - The interface could be successfully installed
201 EFI_NOT_FOUND - The variable could not be discovered
208 PeiGetNextVariableName (
209 IN EFI_PEI_SERVICES
**PeiServices
,
210 IN OUT UINTN
*VariableNameSize
,
211 IN OUT CHAR16
*VariableName
,
212 IN OUT EFI_GUID
*VendorGuid
218 TODO: Add function description
222 PeiServices - TODO: add argument description
223 VariableNameSize - TODO: add argument description
224 VariableName - TODO: add argument description
225 VendorGuid - TODO: add argument description
229 TODO: add return values
235 Get one variable by the index count.
237 @param IndexTable The pointer to variable index table.
238 @param Count The index count of variable in index table.
240 @return The pointer to variable header indexed by count.
245 IN VARIABLE_INDEX_TABLE
*IndexTable
,
250 Record Variable in VariableIndex HOB.
252 Record Variable in VariableIndex HOB and update the length of variable index table.
254 @param IndexTable The pointer to variable index table.
255 @param Variable The pointer to the variable that will be recorded.
261 VariableIndexTableUpdate (
262 IN OUT VARIABLE_INDEX_TABLE
*IndexTable
,
263 IN VARIABLE_HEADER
*Variable
266 #endif // _PEI_VARIABLE_H