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