]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/Pei/Variable.h
Add the check- in missed file
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / Pei / Variable.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 Variable.h
15
16 Abstract:
17
18 Tiano PEIM to provide the variable functionality
19
20 --*/
21
22 #ifndef _PEI_VARIABLE_H
23 #define _PEI_VARIABLE_H
24
25 #include <PiPei.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>
34
35 //
36 // Define GET_PAD_SIZE to optimize compiler
37 //
38 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
39 #define GET_PAD_SIZE(a) (0)
40 #else
41 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
42 #endif
43
44 #define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
45
46 typedef struct {
47 VARIABLE_HEADER *CurrPtr;
48 VARIABLE_HEADER *EndPtr;
49 VARIABLE_HEADER *StartPtr;
50 } VARIABLE_POINTER_TRACK;
51
52 #define VARIABLE_INDEX_TABLE_VOLUME 122
53
54 #define EFI_VARIABLE_INDEX_TABLE_GUID \
55 { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }
56
57 typedef struct {
58 UINT16 Length;
59 UINT16 GoneThrough;
60 VARIABLE_HEADER *EndPtr;
61 VARIABLE_HEADER *StartPtr;
62 UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];
63 } VARIABLE_INDEX_TABLE;
64
65
66 //
67 // Functions
68 //
69 EFI_STATUS
70 EFIAPI
71 PeimInitializeVariableServices (
72 IN EFI_FFS_FILE_HEADER *FfsHeader,
73 IN EFI_PEI_SERVICES **PeiServices
74 )
75 /*++
76
77 Routine Description:
78
79 TODO: Add function description
80
81 Arguments:
82
83 FfsHeader - TODO: add argument description
84 PeiServices - TODO: add argument description
85
86 Returns:
87
88 TODO: add return values
89
90 --*/
91 ;
92
93 EFI_STATUS
94 EFIAPI
95 PeiGetVariable (
96 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
97 IN CONST CHAR16 *VariableName,
98 IN CONST EFI_GUID *VariableGuid,
99 OUT UINT32 *Attributes,
100 IN OUT UINTN *DataSize,
101 OUT VOID *Data
102 )
103 /*++
104
105 Routine Description:
106
107 TODO: Add function description
108
109 Arguments:
110
111 PeiServices - TODO: add argument description
112 VariableName - TODO: add argument description
113 VendorGuid - TODO: add argument description
114 Attributes - TODO: add argument description
115 DataSize - TODO: add argument description
116 Data - TODO: add argument description
117
118 Returns:
119
120 TODO: add return values
121
122 --*/
123 ;
124
125 EFI_STATUS
126 EFIAPI
127 PeiGetNextVariableName (
128 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
129 IN OUT UINTN *VariableNameSize,
130 IN OUT CHAR16 *VariableName,
131 IN OUT EFI_GUID *VariableGuid
132 )
133 /*++
134
135 Routine Description:
136
137 TODO: Add function description
138
139 Arguments:
140
141 PeiServices - TODO: add argument description
142 VariableNameSize - TODO: add argument description
143 VariableName - TODO: add argument description
144 VendorGuid - TODO: add argument description
145
146 Returns:
147
148 TODO: add return values
149
150 --*/
151 ;
152
153 /**
154 Get one variable by the index count.
155
156 @param IndexTable The pointer to variable index table.
157 @param Count The index count of variable in index table.
158
159 @return The pointer to variable header indexed by count.
160
161 **/
162 VARIABLE_HEADER *
163 GetVariableByIndex (
164 IN VARIABLE_INDEX_TABLE *IndexTable,
165 IN UINT32 Count
166 );
167
168 /**
169 Record Variable in VariableIndex HOB.
170
171 Record Variable in VariableIndex HOB and update the length of variable index table.
172
173 @param IndexTable The pointer to variable index table.
174 @param Variable The pointer to the variable that will be recorded.
175
176 @retval VOID
177
178 **/
179 VOID
180 VariableIndexTableUpdate (
181 IN OUT VARIABLE_INDEX_TABLE *IndexTable,
182 IN VARIABLE_HEADER *Variable
183 );
184
185 #endif // _PEI_VARIABLE_H