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/ReadOnlyVariable2.h>
27 #include <Library/DebugLib.h>
28 #include <Library/PeimEntryPoint.h>
29 #include <Library/HobLib.h>
30 #include <Library/PcdLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/PeiServicesTablePointerLib.h>
33 #include <VariableFormat.h>
36 // Define GET_PAD_SIZE to optimize compiler
38 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
39 #define GET_PAD_SIZE(a) (0)
41 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
44 #define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
46 #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
48 #define GET_VARIABLE_DATA_PTR(a) \
49 (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (a) + NameSizeOfVariable(a) + GET_PAD_SIZE (NameSizeOfVariable(a)))
52 VARIABLE_HEADER
*CurrPtr
;
53 VARIABLE_HEADER
*EndPtr
;
54 VARIABLE_HEADER
*StartPtr
;
55 } VARIABLE_POINTER_TRACK
;
57 #define VARIABLE_INDEX_TABLE_VOLUME 122
59 #define EFI_VARIABLE_INDEX_TABLE_GUID \
60 { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }
65 VARIABLE_HEADER
*EndPtr
;
66 VARIABLE_HEADER
*StartPtr
;
67 UINT16 Index
[VARIABLE_INDEX_TABLE_VOLUME
];
68 } VARIABLE_INDEX_TABLE
;
76 PeimInitializeVariableServices (
77 IN EFI_FFS_FILE_HEADER
*FfsHeader
,
78 IN EFI_PEI_SERVICES
**PeiServices
84 TODO: Add function description
88 FfsHeader - TODO: add argument description
89 PeiServices - TODO: add argument description
93 TODO: add return values
101 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI
*This
,
102 IN CONST CHAR16
*VariableName
,
103 IN CONST EFI_GUID
*VariableGuid
,
104 OUT UINT32
*Attributes
,
105 IN OUT UINTN
*DataSize
,
112 TODO: Add function description
116 PeiServices - TODO: add argument description
117 VariableName - TODO: add argument description
118 VendorGuid - TODO: add argument description
119 Attributes - TODO: add argument description
120 DataSize - TODO: add argument description
121 Data - TODO: add argument description
125 TODO: add return values
132 PeiGetNextVariableName (
133 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI
*This
,
134 IN OUT UINTN
*VariableNameSize
,
135 IN OUT CHAR16
*VariableName
,
136 IN OUT EFI_GUID
*VariableGuid
142 TODO: Add function description
146 PeiServices - TODO: add argument description
147 VariableNameSize - TODO: add argument description
148 VariableName - TODO: add argument description
149 VendorGuid - TODO: add argument description
153 TODO: add return values
159 Get one variable by the index count.
161 @param IndexTable The pointer to variable index table.
162 @param Count The index count of variable in index table.
164 @return The pointer to variable header indexed by count.
169 IN VARIABLE_INDEX_TABLE
*IndexTable
,
174 Record Variable in VariableIndex HOB.
176 Record Variable in VariableIndex HOB and update the length of variable index table.
178 @param IndexTable The pointer to variable index table.
179 @param Variable The pointer to the variable that will be recorded.
185 VariableIndexTableUpdate (
186 IN OUT VARIABLE_INDEX_TABLE
*IndexTable
,
187 IN VARIABLE_HEADER
*Variable
190 #endif // _PEI_VARIABLE_H