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