]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.c
Fix a type in the directory name. Compatiblity -> Compatibility.
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / ReadOnlyVariable2ToReadOnlyVariableThunk / ReadOnlyVariable2ToReadOnlyVariableThunk.c
CommitLineData
4259256b 1/*++\r
2\r
3Copyright (c) 2006 - 2008 Intel Corporation. <BR>\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
11Module Name:\r
12\r
13 Variable.c\r
14\r
15Abstract:\r
16\r
17 PEIM to provide the Variable functionality\r
18\r
19--*/\r
20\r
21#include <PiPei.h>\r
22#include <Ppi/ReadOnlyVariable2.h>\r
23#include <Ppi/ReadOnlyVariable.h>\r
24#include <Library/DebugLib.h>\r
25#include <Library/PeiServicesTablePointerLib.h>\r
26#include <Library/PeiServicesLib.h>\r
27\r
28//\r
29// Function Prototypes\r
30//\r
31EFI_STATUS\r
32EFIAPI\r
33PeiGetVariable (\r
34 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
35 IN CONST CHAR16 *VariableName,\r
36 IN CONST EFI_GUID *VariableGuid,\r
37 OUT UINT32 *Attributes,\r
38 IN OUT UINTN *DataSize,\r
39 OUT VOID *Data\r
40 );\r
41\r
42EFI_STATUS\r
43EFIAPI\r
44PeiGetNextVariableName (\r
45 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
46 IN OUT UINTN *VariableNameSize,\r
47 IN OUT CHAR16 *VariableName,\r
48 IN OUT EFI_GUID *VariableGuid\r
49 );\r
50\r
51//\r
52// Module globals\r
53//\r
54EFI_PEI_READ_ONLY_VARIABLE2_PPI mVariablePpi = {\r
55 PeiGetVariable,\r
56 PeiGetNextVariableName\r
57};\r
58\r
59EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {\r
60 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
61 &gEfiPeiReadOnlyVariable2PpiGuid,\r
62 &mVariablePpi\r
63};\r
64\r
65EFI_STATUS\r
66EFIAPI\r
67PeimInitializeReadOnlyVariable2 (\r
68 IN EFI_FFS_FILE_HEADER *FfsHeader,\r
69 IN EFI_PEI_SERVICES **PeiServices\r
70 )\r
71/*++\r
72\r
73Routine Description:\r
74\r
75 Provide the functionality of the variable services.\r
76\r
77Arguments:\r
78\r
79 FfsHeadher - The FFS file header\r
80 PeiServices - General purpose services available to every PEIM.\r
81\r
82Returns:\r
83\r
84 Status - EFI_SUCCESS if the interface could be successfully\r
85 installed\r
86\r
87--*/\r
88{\r
89 //\r
90 // Publish the variable capability to other modules\r
91 //\r
92 return PeiServicesInstallPpi (&mPpiListVariable);\r
93}\r
94\r
95EFI_STATUS\r
96EFIAPI\r
97PeiGetVariable (\r
98 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
99 IN CONST CHAR16 *VariableName,\r
100 IN CONST EFI_GUID *VariableGuid,\r
101 OUT UINT32 *Attributes,\r
102 IN OUT UINTN *DataSize,\r
103 OUT VOID *Data\r
104 )\r
105/*++\r
106\r
107Routine Description:\r
108\r
109 Provide the read variable functionality of the variable services.\r
110\r
111Arguments:\r
112\r
113 PeiServices - General purpose services available to every PEIM.\r
114\r
115 VariableName - The variable name\r
116\r
117 VendorGuid - The vendor's GUID\r
118\r
119 Attributes - Pointer to the attribute\r
120\r
121 DataSize - Size of data\r
122\r
123 Data - Pointer to data\r
124\r
125Returns:\r
126\r
127 EFI_SUCCESS - The interface could be successfully installed\r
128\r
129 EFI_NOT_FOUND - The variable could not be discovered\r
130\r
131 EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough\r
132\r
133--*/\r
134{\r
135 EFI_STATUS Status;\r
136 EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable;\r
137\r
138 Status = PeiServicesLocatePpi (\r
139 &gEfiPeiReadOnlyVariablePpiGuid,\r
140 0,\r
141 NULL,\r
142 (VOID **)&ReadOnlyVariable\r
143 );\r
144 ASSERT_EFI_ERROR (Status);\r
145\r
146 return ReadOnlyVariable->PeiGetVariable (\r
147 GetPeiServicesTablePointer (),\r
148 (CHAR16 *)VariableName,\r
149 (EFI_GUID *)VariableGuid,\r
150 Attributes,\r
151 DataSize,\r
152 Data\r
153 );\r
154}\r
155\r
156EFI_STATUS\r
157EFIAPI\r
158PeiGetNextVariableName (\r
159 IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
160 IN OUT UINTN *VariableNameSize,\r
161 IN OUT CHAR16 *VariableName,\r
162 IN OUT EFI_GUID *VariableGuid\r
163 )\r
164/*++\r
165\r
166Routine Description:\r
167\r
168 Provide the get next variable functionality of the variable services.\r
169\r
170Arguments:\r
171\r
172 PeiServices - General purpose services available to every PEIM.\r
173 VariabvleNameSize - The variable name's size.\r
174 VariableName - A pointer to the variable's name.\r
175 VariableGuid - A pointer to the EFI_GUID structure.\r
176\r
177 VariableNameSize - Size of the variable name\r
178\r
179 VariableName - The variable name\r
180\r
181 VendorGuid - The vendor's GUID\r
182\r
183Returns:\r
184\r
185 EFI_SUCCESS - The interface could be successfully installed\r
186\r
187 EFI_NOT_FOUND - The variable could not be discovered\r
188\r
189--*/\r
190{\r
191 EFI_STATUS Status;\r
192 EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable;\r
193\r
194 Status = PeiServicesLocatePpi (\r
195 &gEfiPeiReadOnlyVariablePpiGuid,\r
196 0,\r
197 NULL,\r
198 (VOID **)&ReadOnlyVariable\r
199 );\r
200 ASSERT_EFI_ERROR (Status);\r
201\r
202 return ReadOnlyVariable->PeiGetNextVariableName (\r
203 GetPeiServicesTablePointer (),\r
204 VariableNameSize,\r
205 VariableName,\r
206 VariableGuid\r
207 );\r
208}\r