]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/Pei/Variable.h
Add comments and DoxyGen format for these files.
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / Pei / Variable.h
1 /** @file
2
3 The internal header file includes the common header files, defines
4 internal structure and functions used by PeiVariable module.
5
6 Copyright (c) 2006 - 2008, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16
17 #ifndef _PEI_VARIABLE_H
18 #define _PEI_VARIABLE_H
19
20 #include <PiPei.h>
21 #include <Ppi/ReadOnlyVariable2.h>
22 #include <Library/DebugLib.h>
23 #include <Library/PeimEntryPoint.h>
24 #include <Library/HobLib.h>
25 #include <Library/PcdLib.h>
26 #include <Library/BaseMemoryLib.h>
27 #include <Library/PeiServicesTablePointerLib.h>
28 #include <VariableFormat.h>
29
30 //
31 // Define GET_PAD_SIZE to optimize compiler
32 //
33 #if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
34 #define GET_PAD_SIZE(a) (0)
35 #else
36 #define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
37 #endif
38
39 #define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
40
41 typedef struct {
42 VARIABLE_HEADER *CurrPtr;
43 VARIABLE_HEADER *EndPtr;
44 VARIABLE_HEADER *StartPtr;
45 } VARIABLE_POINTER_TRACK;
46
47 #define VARIABLE_INDEX_TABLE_VOLUME 122
48
49 #define EFI_VARIABLE_INDEX_TABLE_GUID \
50 { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }
51
52 typedef struct {
53 UINT16 Length;
54 UINT16 GoneThrough;
55 VARIABLE_HEADER *EndPtr;
56 VARIABLE_HEADER *StartPtr;
57 UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];
58 } VARIABLE_INDEX_TABLE;
59
60
61 //
62 // Functions
63 //
64 EFI_STATUS
65 EFIAPI
66 PeimInitializeVariableServices (
67 IN EFI_FFS_FILE_HEADER *FfsHeader,
68 IN EFI_PEI_SERVICES **PeiServices
69 )
70 /*++
71
72 Routine Description:
73
74 TODO: Add function description
75
76 Arguments:
77
78 FfsHeader - TODO: add argument description
79 PeiServices - TODO: add argument description
80
81 Returns:
82
83 TODO: add return values
84
85 --*/
86 ;
87
88 EFI_STATUS
89 EFIAPI
90 PeiGetVariable (
91 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
92 IN CONST CHAR16 *VariableName,
93 IN CONST EFI_GUID *VariableGuid,
94 OUT UINT32 *Attributes,
95 IN OUT UINTN *DataSize,
96 OUT VOID *Data
97 )
98 /*++
99
100 Routine Description:
101
102 TODO: Add function description
103
104 Arguments:
105
106 PeiServices - TODO: add argument description
107 VariableName - TODO: add argument description
108 VendorGuid - TODO: add argument description
109 Attributes - TODO: add argument description
110 DataSize - TODO: add argument description
111 Data - TODO: add argument description
112
113 Returns:
114
115 TODO: add return values
116
117 --*/
118 ;
119
120 EFI_STATUS
121 EFIAPI
122 PeiGetNextVariableName (
123 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
124 IN OUT UINTN *VariableNameSize,
125 IN OUT CHAR16 *VariableName,
126 IN OUT EFI_GUID *VariableGuid
127 )
128 /*++
129
130 Routine Description:
131
132 TODO: Add function description
133
134 Arguments:
135
136 PeiServices - TODO: add argument description
137 VariableNameSize - TODO: add argument description
138 VariableName - TODO: add argument description
139 VendorGuid - TODO: add argument description
140
141 Returns:
142
143 TODO: add return values
144
145 --*/
146 ;
147
148 /**
149 Get one variable by the index count.
150
151 @param IndexTable The pointer to variable index table.
152 @param Count The index count of variable in index table.
153
154 @return The pointer to variable header indexed by count.
155
156 **/
157 VARIABLE_HEADER *
158 GetVariableByIndex (
159 IN VARIABLE_INDEX_TABLE *IndexTable,
160 IN UINT32 Count
161 );
162
163 /**
164 Record Variable in VariableIndex HOB.
165
166 Record Variable in VariableIndex HOB and update the length of variable index table.
167
168 @param IndexTable The pointer to variable index table.
169 @param Variable The pointer to the variable that will be recorded.
170
171 @retval VOID
172
173 **/
174 VOID
175 VariableIndexTableUpdate (
176 IN OUT VARIABLE_INDEX_TABLE *IndexTable,
177 IN VARIABLE_HEADER *Variable
178 );
179
180 #endif // _PEI_VARIABLE_H