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