]>
Commit | Line | Data |
---|---|---|
738ec565 | 1 | /** @file\r |
2 | Implementation for PEI Services Library.\r | |
3 | \r | |
c7935105 | 4 | Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r |
19388d29 | 5 | This program and the accompanying materials\r |
738ec565 | 6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
2fc59a00 | 8 | http://opensource.org/licenses/bsd-license.php.\r |
738ec565 | 9 | \r |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
738ec565 | 13 | **/\r |
14 | \r | |
c892d846 | 15 | \r |
c7d265a9 | 16 | #include <PiPei.h>\r |
c892d846 | 17 | \r |
729675ae | 18 | #include <Ppi/FirmwareVolumeInfo.h>\r |
c7935105 | 19 | #include <Ppi/FirmwareVolumeInfo2.h>\r |
729675ae | 20 | #include <Guid/FirmwareFileSystem2.h>\r |
c892d846 | 21 | \r |
c7d265a9 | 22 | #include <Library/PeiServicesLib.h>\r |
23 | #include <Library/PeiServicesTablePointerLib.h>\r | |
729675ae | 24 | #include <Library/DebugLib.h>\r |
25 | #include <Library/MemoryAllocationLib.h>\r | |
26 | #include <Library/BaseMemoryLib.h>\r | |
27 | \r | |
738ec565 | 28 | /**\r |
29 | This service enables a given PEIM to register an interface into the PEI Foundation.\r | |
30 | \r | |
31 | @param PpiList A pointer to the list of interfaces that the caller shall install.\r | |
32 | \r | |
33 | @retval EFI_SUCCESS The interface was successfully installed.\r | |
34 | @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.\r | |
35 | @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r | |
36 | EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r | |
37 | @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r | |
38 | \r | |
39 | **/\r | |
40 | EFI_STATUS\r | |
41 | EFIAPI\r | |
42 | PeiServicesInstallPpi (\r | |
1c280088 | 43 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r |
738ec565 | 44 | )\r |
45 | {\r | |
1c280088 | 46 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 47 | \r |
5240b97c | 48 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 49 | return (*PeiServices)->InstallPpi (PeiServices, PpiList);\r |
50 | }\r | |
51 | \r | |
52 | /**\r | |
53 | This service enables PEIMs to replace an entry in the PPI database with an alternate entry.\r | |
54 | \r | |
2fc59a00 | 55 | @param OldPpi The pointer to the old PEI PPI Descriptors.\r |
56 | @param NewPpi The pointer to the new PEI PPI Descriptors.\r | |
738ec565 | 57 | \r |
58 | @retval EFI_SUCCESS The interface was successfully installed.\r | |
59 | @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.\r | |
60 | @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r | |
61 | EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r | |
62 | @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r | |
63 | @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been\r | |
64 | installed.\r | |
65 | \r | |
66 | **/\r | |
67 | EFI_STATUS\r | |
68 | EFIAPI\r | |
69 | PeiServicesReInstallPpi (\r | |
1c280088 | 70 | IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r |
71 | IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r | |
738ec565 | 72 | )\r |
73 | {\r | |
1c280088 | 74 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 75 | \r |
5240b97c | 76 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 77 | return (*PeiServices)->ReInstallPpi (PeiServices, OldPpi, NewPpi);\r |
78 | }\r | |
79 | \r | |
80 | /**\r | |
81 | This service enables PEIMs to discover a given instance of an interface.\r | |
82 | \r | |
83 | @param Guid A pointer to the GUID whose corresponding interface needs to be\r | |
84 | found.\r | |
85 | @param Instance The N-th instance of the interface that is required.\r | |
86 | @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.\r | |
87 | @param Ppi A pointer to the instance of the interface.\r | |
88 | \r | |
89 | @retval EFI_SUCCESS The interface was successfully returned.\r | |
90 | @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.\r | |
91 | \r | |
92 | **/\r | |
93 | EFI_STATUS\r | |
94 | EFIAPI\r | |
95 | PeiServicesLocatePpi (\r | |
1c280088 | 96 | IN CONST EFI_GUID *Guid,\r |
738ec565 | 97 | IN UINTN Instance,\r |
98 | IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r | |
99 | IN OUT VOID **Ppi\r | |
100 | )\r | |
101 | {\r | |
1c280088 | 102 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 103 | \r |
5240b97c | 104 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 105 | return (*PeiServices)->LocatePpi (PeiServices, Guid, Instance, PpiDescriptor, Ppi);\r |
106 | }\r | |
107 | \r | |
108 | /**\r | |
109 | This service enables PEIMs to register a given service to be invoked when another service is\r | |
110 | installed or reinstalled.\r | |
111 | \r | |
58380e9c | 112 | @param NotifyList A pointer to the list of notification interfaces \r |
113 | that the caller shall install.\r | |
738ec565 | 114 | \r |
115 | @retval EFI_SUCCESS The interface was successfully installed.\r | |
116 | @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.\r | |
58380e9c | 117 | @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do\r |
118 | not have the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES\r | |
119 | bit set in the Flags field.\r | |
738ec565 | 120 | @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r |
121 | \r | |
122 | **/\r | |
123 | EFI_STATUS\r | |
124 | EFIAPI\r | |
125 | PeiServicesNotifyPpi (\r | |
1c280088 | 126 | IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r |
738ec565 | 127 | )\r |
128 | {\r | |
1c280088 | 129 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 130 | \r |
5240b97c | 131 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 132 | return (*PeiServices)->NotifyPpi (PeiServices, NotifyList);\r |
133 | }\r | |
134 | \r | |
135 | /**\r | |
136 | This service enables PEIMs to ascertain the present value of the boot mode.\r | |
137 | \r | |
138 | @param BootMode A pointer to contain the value of the boot mode.\r | |
139 | \r | |
140 | @retval EFI_SUCCESS The boot mode was returned successfully.\r | |
141 | @retval EFI_INVALID_PARAMETER BootMode is NULL.\r | |
142 | \r | |
143 | **/\r | |
144 | EFI_STATUS\r | |
145 | EFIAPI\r | |
146 | PeiServicesGetBootMode (\r | |
c3363c92 | 147 | OUT EFI_BOOT_MODE *BootMode\r |
738ec565 | 148 | )\r |
149 | {\r | |
1c280088 | 150 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 151 | \r |
5240b97c | 152 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 153 | return (*PeiServices)->GetBootMode (PeiServices, BootMode);\r |
154 | }\r | |
155 | \r | |
156 | /**\r | |
157 | This service enables PEIMs to update the boot mode variable.\r | |
158 | \r | |
159 | @param BootMode The value of the boot mode to set.\r | |
160 | \r | |
161 | @retval EFI_SUCCESS The value was successfully updated\r | |
162 | \r | |
163 | **/\r | |
164 | EFI_STATUS\r | |
165 | EFIAPI\r | |
166 | PeiServicesSetBootMode (\r | |
167 | IN EFI_BOOT_MODE BootMode\r | |
168 | )\r | |
169 | {\r | |
1c280088 | 170 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 171 | \r |
5240b97c | 172 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 173 | return (*PeiServices)->SetBootMode (PeiServices, BootMode);\r |
174 | }\r | |
175 | \r | |
176 | /**\r | |
177 | This service enables a PEIM to ascertain the address of the list of HOBs in memory.\r | |
178 | \r | |
58380e9c | 179 | @param HobList A pointer to the list of HOBs that the PEI Foundation \r |
180 | will initialize.\r | |
181 | \r | |
738ec565 | 182 | @retval EFI_SUCCESS The list was successfully returned.\r |
183 | @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r | |
184 | \r | |
185 | **/\r | |
186 | EFI_STATUS\r | |
187 | EFIAPI\r | |
188 | PeiServicesGetHobList (\r | |
f38fdc74 | 189 | OUT VOID **HobList\r |
738ec565 | 190 | )\r |
191 | {\r | |
1c280088 | 192 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 193 | \r |
5240b97c | 194 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 195 | return (*PeiServices)->GetHobList (PeiServices, HobList);\r |
196 | }\r | |
197 | \r | |
198 | /**\r | |
199 | This service enables PEIMs to create various types of HOBs.\r | |
200 | \r | |
201 | @param Type The type of HOB to be installed.\r | |
202 | @param Length The length of the HOB to be added.\r | |
58380e9c | 203 | @param Hob The address of a pointer that will contain the \r |
204 | HOB header.\r | |
738ec565 | 205 | \r |
206 | @retval EFI_SUCCESS The HOB was successfully created.\r | |
207 | @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r | |
208 | \r | |
209 | **/\r | |
210 | EFI_STATUS\r | |
211 | EFIAPI\r | |
212 | PeiServicesCreateHob (\r | |
213 | IN UINT16 Type,\r | |
214 | IN UINT16 Length,\r | |
dd652088 | 215 | OUT VOID **Hob\r |
738ec565 | 216 | )\r |
217 | {\r | |
1c280088 | 218 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 219 | \r |
5240b97c | 220 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 221 | return (*PeiServices)->CreateHob (PeiServices, Type, Length, Hob);\r |
222 | }\r | |
223 | \r | |
224 | /**\r | |
225 | This service enables PEIMs to discover additional firmware volumes.\r | |
226 | \r | |
58380e9c | 227 | @param Instance This instance of the firmware volume to find. The \r |
228 | value 0 is the Boot Firmware Volume (BFV).\r | |
229 | @param VolumeHandle Handle of the firmware volume header of the volume\r | |
230 | to return.\r | |
738ec565 | 231 | \r |
232 | @retval EFI_SUCCESS The volume was found.\r | |
233 | @retval EFI_NOT_FOUND The volume was not found.\r | |
234 | @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.\r | |
235 | \r | |
236 | **/\r | |
237 | EFI_STATUS\r | |
238 | EFIAPI\r | |
239 | PeiServicesFfsFindNextVolume (\r | |
240 | IN UINTN Instance,\r | |
1c280088 | 241 | IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r |
738ec565 | 242 | )\r |
243 | {\r | |
1c280088 | 244 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 245 | \r |
5240b97c | 246 | PeiServices = GetPeiServicesTablePointer ();\r |
1c280088 | 247 | return (*PeiServices)->FfsFindNextVolume (PeiServices, Instance, VolumeHandle);\r |
738ec565 | 248 | }\r |
249 | \r | |
250 | /**\r | |
251 | This service enables PEIMs to discover additional firmware files.\r | |
252 | \r | |
253 | @param SearchType A filter to find files only of this type.\r | |
58380e9c | 254 | @param VolumeHandle The pointer to the firmware volume header of the \r |
255 | volume to search. This parameter must point to a \r | |
256 | valid FFS volume. \r | |
42eedea9 | 257 | @param FileHandle Handle of the current file from which to begin searching.\r |
738ec565 | 258 | \r |
259 | @retval EFI_SUCCESS The file was found.\r | |
260 | @retval EFI_NOT_FOUND The file was not found.\r | |
261 | @retval EFI_NOT_FOUND The header checksum was not zero.\r | |
262 | \r | |
263 | **/\r | |
264 | EFI_STATUS\r | |
265 | EFIAPI\r | |
266 | PeiServicesFfsFindNextFile (\r | |
267 | IN EFI_FV_FILETYPE SearchType,\r | |
1c280088 | 268 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r |
269 | IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
738ec565 | 270 | )\r |
271 | {\r | |
1c280088 | 272 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 273 | \r |
5240b97c | 274 | PeiServices = GetPeiServicesTablePointer ();\r |
1c280088 | 275 | return (*PeiServices)->FfsFindNextFile (PeiServices, SearchType, VolumeHandle, FileHandle);\r |
738ec565 | 276 | }\r |
277 | \r | |
278 | /**\r | |
279 | This service enables PEIMs to discover sections of a given type within a valid FFS file.\r | |
280 | \r | |
42eedea9 | 281 | @param SectionType The value of the section type to find.\r |
58380e9c | 282 | @param FileHandle A pointer to the file header that contains the set \r |
283 | of sections to be searched.\r | |
738ec565 | 284 | @param SectionData A pointer to the discovered section, if successful.\r |
285 | \r | |
286 | @retval EFI_SUCCESS The section was found.\r | |
287 | @retval EFI_NOT_FOUND The section was not found.\r | |
288 | \r | |
289 | **/\r | |
290 | EFI_STATUS\r | |
291 | EFIAPI\r | |
292 | PeiServicesFfsFindSectionData (\r | |
293 | IN EFI_SECTION_TYPE SectionType,\r | |
122e2191 | 294 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
67c89a21 | 295 | OUT VOID **SectionData\r |
738ec565 | 296 | )\r |
297 | {\r | |
1c280088 | 298 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 299 | \r |
5240b97c | 300 | PeiServices = GetPeiServicesTablePointer ();\r |
122e2191 | 301 | return (*PeiServices)->FfsFindSectionData (PeiServices, SectionType, FileHandle, SectionData);\r |
738ec565 | 302 | }\r |
303 | \r | |
c7935105 SZ |
304 | /**\r |
305 | This service enables PEIMs to discover sections of a given instance and type within a valid FFS file.\r | |
306 | \r | |
307 | @param SectionType The value of the section type to find.\r | |
308 | @param SectionInstance Section instance to find.\r | |
309 | @param FileHandle A pointer to the file header that contains the set \r | |
310 | of sections to be searched.\r | |
311 | @param SectionData A pointer to the discovered section, if successful.\r | |
312 | @param AuthenticationStatus A pointer to the authentication status for this section.\r | |
313 | \r | |
314 | @retval EFI_SUCCESS The section was found.\r | |
315 | @retval EFI_NOT_FOUND The section was not found.\r | |
316 | \r | |
317 | **/\r | |
318 | EFI_STATUS\r | |
319 | EFIAPI\r | |
320 | PeiServicesFfsFindSectionData3 (\r | |
321 | IN EFI_SECTION_TYPE SectionType,\r | |
322 | IN UINTN SectionInstance,\r | |
323 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
324 | OUT VOID **SectionData,\r | |
325 | OUT UINT32 *AuthenticationStatus\r | |
326 | )\r | |
327 | {\r | |
328 | CONST EFI_PEI_SERVICES **PeiServices;\r | |
329 | \r | |
330 | PeiServices = GetPeiServicesTablePointer ();\r | |
331 | return (*PeiServices)->FindSectionData3 (PeiServices, SectionType, SectionInstance, FileHandle, SectionData, AuthenticationStatus);\r | |
332 | }\r | |
333 | \r | |
738ec565 | 334 | /**\r |
335 | This service enables PEIMs to register the permanent memory configuration\r | |
336 | that has been initialized with the PEI Foundation.\r | |
337 | \r | |
338 | @param MemoryBegin The value of a region of installed memory.\r | |
339 | @param MemoryLength The corresponding length of a region of installed memory.\r | |
340 | \r | |
341 | @retval EFI_SUCCESS The region was successfully installed in a HOB.\r | |
342 | @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r | |
343 | @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r | |
344 | \r | |
345 | **/\r | |
346 | EFI_STATUS\r | |
347 | EFIAPI\r | |
348 | PeiServicesInstallPeiMemory (\r | |
349 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r | |
350 | IN UINT64 MemoryLength\r | |
351 | )\r | |
352 | {\r | |
1c280088 | 353 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 354 | \r |
5240b97c | 355 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 356 | return (*PeiServices)->InstallPeiMemory (PeiServices, MemoryBegin, MemoryLength);\r |
357 | }\r | |
358 | \r | |
359 | /**\r | |
58380e9c | 360 | This service enables PEIMs to allocate memory after the permanent memory has been\r |
361 | installed by a PEIM.\r | |
738ec565 | 362 | \r |
363 | @param MemoryType Type of memory to allocate.\r | |
2fc59a00 | 364 | @param Pages The number of pages to allocate.\r |
738ec565 | 365 | @param Memory Pointer of memory allocated.\r |
366 | \r | |
367 | @retval EFI_SUCCESS The memory range was successfully allocated.\r | |
368 | @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.\r | |
369 | @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.\r | |
370 | @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r | |
371 | \r | |
372 | **/\r | |
373 | EFI_STATUS\r | |
374 | EFIAPI\r | |
375 | PeiServicesAllocatePages (\r | |
376 | IN EFI_MEMORY_TYPE MemoryType,\r | |
377 | IN UINTN Pages,\r | |
67c89a21 | 378 | OUT EFI_PHYSICAL_ADDRESS *Memory\r |
738ec565 | 379 | )\r |
380 | {\r | |
1c280088 | 381 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 382 | \r |
5240b97c | 383 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 384 | return (*PeiServices)->AllocatePages (PeiServices, MemoryType, Pages, Memory);\r |
385 | }\r | |
386 | \r | |
387 | /**\r | |
388 | This service allocates memory from the Hand-Off Block (HOB) heap.\r | |
389 | \r | |
390 | @param Size The number of bytes to allocate from the pool.\r | |
58380e9c | 391 | @param Buffer If the call succeeds, a pointer to a pointer to \r |
392 | the allocate buffer; otherwise, undefined.\r | |
738ec565 | 393 | \r |
394 | @retval EFI_SUCCESS The allocation was successful\r | |
395 | @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r | |
396 | \r | |
397 | **/\r | |
398 | EFI_STATUS\r | |
399 | EFIAPI\r | |
400 | PeiServicesAllocatePool (\r | |
401 | IN UINTN Size,\r | |
402 | OUT VOID **Buffer\r | |
403 | )\r | |
404 | {\r | |
1c280088 | 405 | CONST EFI_PEI_SERVICES **PeiServices;\r |
738ec565 | 406 | \r |
5240b97c | 407 | PeiServices = GetPeiServicesTablePointer ();\r |
738ec565 | 408 | return (*PeiServices)->AllocatePool (PeiServices, Size, Buffer);\r |
409 | }\r | |
410 | \r | |
411 | /**\r | |
67c89a21 | 412 | Resets the entire platform.\r |
738ec565 | 413 | \r |
67c89a21 | 414 | @retval EFI_SUCCESS The function completed successfully.\r |
738ec565 | 415 | @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r |
416 | \r | |
417 | **/\r | |
418 | EFI_STATUS\r | |
419 | EFIAPI\r | |
420 | PeiServicesResetSystem (\r | |
421 | VOID\r | |
422 | )\r | |
b0d803fe | 423 | {\r |
424 | CONST EFI_PEI_SERVICES **PeiServices;\r | |
425 | \r | |
5240b97c | 426 | PeiServices = GetPeiServicesTablePointer ();\r |
b0d803fe | 427 | return (*PeiServices)->ResetSystem (PeiServices);\r |
428 | }\r | |
429 | \r | |
67c89a21 | 430 | /**\r |
58380e9c | 431 | This service is a wrapper for the PEI Service RegisterForShadow(), except the \r |
432 | pointer to the PEI Services Table has been removed. See the Platform \r | |
433 | Initialization Pre-EFI Initialization Core Interface Specification for details. \r | |
67c89a21 | 434 | \r |
58380e9c | 435 | @param FileHandle PEIM's file handle. Must be the currently\r |
436 | executing PEIM.\r | |
67c89a21 | 437 | \r |
58380e9c | 438 | @retval EFI_SUCCESS The PEIM was successfully registered for\r |
439 | shadowing.\r | |
67c89a21 | 440 | \r |
441 | @retval EFI_ALREADY_STARTED The PEIM was previously\r | |
442 | registered for shadowing.\r | |
443 | \r | |
58380e9c | 444 | @retval EFI_NOT_FOUND The FileHandle does not refer to a\r |
445 | valid file handle.\r | |
67c89a21 | 446 | **/\r |
b0d803fe | 447 | EFI_STATUS\r |
448 | EFIAPI\r | |
449 | PeiServicesRegisterForShadow (\r | |
450 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
451 | )\r | |
738ec565 | 452 | {\r |
484c7785 | 453 | return (*GetPeiServicesTablePointer())->RegisterForShadow (FileHandle);\r |
738ec565 | 454 | }\r |
b0d803fe | 455 | \r |
67c89a21 | 456 | /**\r |
457 | This service is a wrapper for the PEI Service FfsGetFileInfo(), except the pointer to the PEI Services \r | |
458 | Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r | |
459 | Specification for details. \r | |
460 | \r | |
58380e9c | 461 | @param FileHandle The handle of the file.\r |
67c89a21 | 462 | \r |
58380e9c | 463 | @param FileInfo Upon exit, points to the file's\r |
464 | information.\r | |
67c89a21 | 465 | \r |
466 | @retval EFI_SUCCESS File information returned.\r | |
467 | \r | |
468 | @retval EFI_INVALID_PARAMETER If FileHandle does not\r | |
469 | represent a valid file.\r | |
470 | \r | |
58380e9c | 471 | @retval EFI_INVALID_PARAMETER FileInfo is NULL.\r |
67c89a21 | 472 | \r |
473 | **/\r | |
b0d803fe | 474 | EFI_STATUS\r |
f38fdc74 | 475 | EFIAPI \r |
b0d803fe | 476 | PeiServicesFfsGetFileInfo (\r |
477 | IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r | |
478 | OUT EFI_FV_FILE_INFO *FileInfo\r | |
479 | )\r | |
480 | {\r | |
484c7785 | 481 | return (*GetPeiServicesTablePointer())->FfsGetFileInfo (FileHandle, FileInfo);\r |
b0d803fe | 482 | }\r |
483 | \r | |
c7935105 SZ |
484 | /**\r |
485 | This service is a wrapper for the PEI Service FfsGetFileInfo2(), except the pointer to the PEI Services\r | |
486 | Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface\r | |
487 | Specification for details.\r | |
488 | \r | |
489 | @param FileHandle The handle of the file.\r | |
490 | @param FileInfo Upon exit, points to the file's\r | |
491 | information.\r | |
492 | \r | |
493 | @retval EFI_SUCCESS File information returned.\r | |
494 | @retval EFI_INVALID_PARAMETER If FileHandle does not\r | |
495 | represent a valid file.\r | |
496 | @retval EFI_INVALID_PARAMETER FileInfo is NULL.\r | |
497 | \r | |
498 | **/\r | |
499 | EFI_STATUS\r | |
500 | EFIAPI\r | |
501 | PeiServicesFfsGetFileInfo2 (\r | |
502 | IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r | |
503 | OUT EFI_FV_FILE_INFO2 *FileInfo\r | |
504 | )\r | |
505 | {\r | |
506 | return (*GetPeiServicesTablePointer())->FfsGetFileInfo2 (FileHandle, FileInfo);\r | |
507 | }\r | |
b0d803fe | 508 | \r |
67c89a21 | 509 | /**\r |
510 | This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services \r | |
511 | Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r | |
512 | Specification for details. \r | |
513 | \r | |
58380e9c | 514 | @param FileName A pointer to the name of the file to\r |
515 | find within the firmware volume.\r | |
67c89a21 | 516 | \r |
58380e9c | 517 | @param VolumeHandle The firmware volume to search FileHandle\r |
518 | Upon exit, points to the found file's\r | |
519 | handle or NULL if it could not be found.\r | |
520 | @param FileHandle The pointer to found file handle \r | |
42eedea9 | 521 | \r |
67c89a21 | 522 | @retval EFI_SUCCESS File was found.\r |
523 | \r | |
524 | @retval EFI_NOT_FOUND File was not found.\r | |
525 | \r | |
526 | @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or\r | |
527 | FileName was NULL.\r | |
528 | \r | |
529 | **/\r | |
b0d803fe | 530 | EFI_STATUS\r |
531 | EFIAPI\r | |
532 | PeiServicesFfsFindFileByName (\r | |
533 | IN CONST EFI_GUID *FileName,\r | |
534 | IN CONST EFI_PEI_FV_HANDLE VolumeHandle,\r | |
535 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
536 | )\r | |
537 | {\r | |
538 | return (*GetPeiServicesTablePointer())->FfsFindFileByName (FileName, VolumeHandle, FileHandle);\r | |
539 | }\r | |
540 | \r | |
541 | \r | |
67c89a21 | 542 | /**\r |
543 | This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services \r | |
544 | Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r | |
545 | Specification for details. \r | |
546 | \r | |
58380e9c | 547 | @param VolumeHandle Handle of the volume.\r |
67c89a21 | 548 | \r |
58380e9c | 549 | @param VolumeInfo Upon exit, points to the volume's\r |
550 | information.\r | |
67c89a21 | 551 | \r |
552 | @retval EFI_SUCCESS File information returned.\r | |
553 | \r | |
554 | @retval EFI_INVALID_PARAMETER If FileHandle does not\r | |
555 | represent a valid file.\r | |
556 | \r | |
557 | @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r | |
558 | \r | |
559 | **/\r | |
b0d803fe | 560 | EFI_STATUS\r |
561 | EFIAPI\r | |
562 | PeiServicesFfsGetVolumeInfo (\r | |
563 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
564 | OUT EFI_FV_INFO *VolumeInfo\r | |
565 | )\r | |
566 | {\r | |
567 | return (*GetPeiServicesTablePointer())->FfsGetVolumeInfo (VolumeHandle, VolumeInfo);\r | |
568 | }\r | |
569 | \r | |
729675ae | 570 | /**\r |
c7935105 | 571 | Install a EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI instance so the PEI Core will be notified about a new firmware volume.\r |
b75a165d | 572 | \r |
c7935105 SZ |
573 | This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI using\r |
574 | the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI instance.\r | |
575 | If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI, then ASSERT().\r | |
576 | If the EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI can not be installed, then ASSERT().\r | |
577 | \r | |
578 | @param InstallFvInfoPpi Install FvInfo Ppi if it is TRUE. Otherwise, install FvInfo2 Ppi.\r | |
579 | @param FvFormat Unique identifier of the format of the memory-mapped\r | |
580 | firmware volume. This parameter is optional and\r | |
581 | may be NULL. If NULL is specified, the\r | |
58380e9c | 582 | EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r |
c7935105 SZ |
583 | @param FvInfo Points to a buffer which allows the\r |
584 | EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.\r | |
585 | The format of this buffer is specific to the FvFormat.\r | |
586 | For memory-mapped firmware volumes, this typically\r | |
58380e9c | 587 | points to the first byte of the firmware volume.\r |
c7935105 SZ |
588 | @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped\r |
589 | firmware volumes, this is typically the size of\r | |
58380e9c | 590 | the firmware volume.\r |
c7935105 SZ |
591 | @param ParentFvName If the new firmware volume originated from a file\r |
592 | in a different firmware volume, then this parameter\r | |
58380e9c | 593 | specifies the GUID name of the originating firmware\r |
594 | volume. Otherwise, this parameter must be NULL.\r | |
c7935105 SZ |
595 | @param ParentFileName If the new firmware volume originated from a file\r |
596 | in a different firmware volume, then this parameter\r | |
597 | specifies the GUID file name of the originating\r | |
58380e9c | 598 | firmware file. Otherwise, this parameter must be NULL.\r |
c7935105 | 599 | @param AuthenticationStatus Authentication Status, it will be ignored if InstallFvInfoPpi is TRUE.\r |
729675ae | 600 | **/\r |
601 | VOID\r | |
602 | EFIAPI\r | |
c7935105 SZ |
603 | InternalPeiServicesInstallFvInfoPpi (\r |
604 | IN BOOLEAN InstallFvInfoPpi,\r | |
729675ae | 605 | IN CONST EFI_GUID *FvFormat, OPTIONAL\r |
606 | IN CONST VOID *FvInfo,\r | |
607 | IN UINT32 FvInfoSize,\r | |
608 | IN CONST EFI_GUID *ParentFvName, OPTIONAL\r | |
c7935105 SZ |
609 | IN CONST EFI_GUID *ParentFileName, OPTIONAL\r |
610 | IN UINT32 AuthenticationStatus\r | |
729675ae | 611 | )\r |
612 | {\r | |
613 | EFI_STATUS Status; \r | |
614 | EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;\r | |
615 | EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;\r | |
3831f3e9 LG |
616 | EFI_GUID *ParentFvNameValue;\r |
617 | EFI_GUID *ParentFileNameValue;\r | |
c7935105 | 618 | EFI_GUID *PpiGuid;\r |
729675ae | 619 | \r |
3831f3e9 LG |
620 | ParentFvNameValue = NULL;\r |
621 | ParentFileNameValue = NULL;\r | |
c7935105 SZ |
622 | if (InstallFvInfoPpi) {\r |
623 | //\r | |
624 | // To install FvInfo Ppi.\r | |
625 | //\r | |
626 | FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));\r | |
ed84519c | 627 | ASSERT (FvInfoPpi != NULL);\r |
c7935105 SZ |
628 | PpiGuid = &gEfiPeiFirmwareVolumeInfoPpiGuid;\r |
629 | } else {\r | |
630 | //\r | |
631 | // To install FvInfo2 Ppi.\r | |
632 | //\r | |
633 | FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI));\r | |
ed84519c | 634 | ASSERT (FvInfoPpi != NULL);\r |
c7935105 SZ |
635 | ((EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI *) FvInfoPpi)->AuthenticationStatus = AuthenticationStatus;\r |
636 | PpiGuid = &gEfiPeiFirmwareVolumeInfo2PpiGuid;\r | |
637 | }\r | |
729675ae | 638 | \r |
639 | if (FvFormat != NULL) {\r | |
640 | CopyGuid (&FvInfoPpi->FvFormat, FvFormat);\r | |
641 | } else {\r | |
642 | CopyGuid (&FvInfoPpi->FvFormat, &gEfiFirmwareFileSystem2Guid);\r | |
643 | }\r | |
644 | FvInfoPpi->FvInfo = (VOID *) FvInfo;\r | |
645 | FvInfoPpi->FvInfoSize = FvInfoSize;\r | |
3831f3e9 LG |
646 | if (ParentFvName != NULL) {\r |
647 | ParentFvNameValue = AllocateCopyPool (sizeof (EFI_GUID), ParentFvName);\r | |
60bd4ccd | 648 | ASSERT (ParentFvNameValue != NULL);\r |
3831f3e9 LG |
649 | FvInfoPpi->ParentFvName = ParentFvNameValue;\r |
650 | }\r | |
651 | if (ParentFileName != NULL) {\r | |
652 | ParentFileNameValue = AllocateCopyPool (sizeof (EFI_GUID), ParentFileName);\r | |
653 | ASSERT (ParentFileNameValue != NULL);\r | |
654 | FvInfoPpi->ParentFileName = ParentFileNameValue;\r | |
655 | }\r | |
729675ae | 656 | \r |
c7935105 | 657 | FvInfoPpiDescriptor = AllocatePool (sizeof (EFI_PEI_PPI_DESCRIPTOR));\r |
729675ae | 658 | ASSERT (FvInfoPpiDescriptor != NULL);\r |
659 | \r | |
c7935105 SZ |
660 | FvInfoPpiDescriptor->Guid = PpiGuid;\r |
661 | FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;\r | |
729675ae | 662 | FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;\r |
663 | Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);\r | |
664 | ASSERT_EFI_ERROR (Status);\r | |
665 | \r | |
666 | }\r | |
667 | \r | |
c7935105 SZ |
668 | /**\r |
669 | Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.\r | |
670 | \r | |
671 | This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using\r | |
672 | the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.\r | |
673 | If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().\r | |
674 | If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().\r | |
675 | \r | |
676 | @param FvFormat Unique identifier of the format of the memory-mapped\r | |
677 | firmware volume. This parameter is optional and\r | |
678 | may be NULL. If NULL is specified, the\r | |
679 | EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r | |
680 | @param FvInfo Points to a buffer which allows the\r | |
681 | EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.\r | |
682 | The format of this buffer is specific to the FvFormat.\r | |
683 | For memory-mapped firmware volumes, this typically\r | |
684 | points to the first byte of the firmware volume.\r | |
685 | @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped\r | |
686 | firmware volumes, this is typically the size of\r | |
687 | the firmware volume.\r | |
688 | @param ParentFvName If the new firmware volume originated from a file\r | |
689 | in a different firmware volume, then this parameter\r | |
690 | specifies the GUID name of the originating firmware\r | |
691 | volume. Otherwise, this parameter must be NULL.\r | |
692 | @param ParentFileName If the new firmware volume originated from a file\r | |
693 | in a different firmware volume, then this parameter\r | |
694 | specifies the GUID file name of the originating\r | |
695 | firmware file. Otherwise, this parameter must be NULL.\r | |
696 | **/\r | |
697 | VOID\r | |
698 | EFIAPI\r | |
699 | PeiServicesInstallFvInfoPpi (\r | |
700 | IN CONST EFI_GUID *FvFormat, OPTIONAL\r | |
701 | IN CONST VOID *FvInfo,\r | |
702 | IN UINT32 FvInfoSize,\r | |
703 | IN CONST EFI_GUID *ParentFvName, OPTIONAL\r | |
704 | IN CONST EFI_GUID *ParentFileName OPTIONAL\r | |
705 | )\r | |
706 | {\r | |
707 | InternalPeiServicesInstallFvInfoPpi (TRUE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, 0);\r | |
708 | }\r | |
709 | \r | |
710 | /**\r | |
711 | Install a EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance so the PEI Core will be notified about a new firmware volume.\r | |
712 | \r | |
713 | This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI using\r | |
714 | the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance.\r | |
715 | If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI, then ASSERT().\r | |
716 | If the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI can not be installed, then ASSERT().\r | |
717 | \r | |
718 | @param FvFormat Unique identifier of the format of the memory-mapped\r | |
719 | firmware volume. This parameter is optional and\r | |
720 | may be NULL. If NULL is specified, the\r | |
721 | EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r | |
722 | @param FvInfo Points to a buffer which allows the\r | |
723 | EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume.\r | |
724 | The format of this buffer is specific to the FvFormat.\r | |
725 | For memory-mapped firmware volumes, this typically\r | |
726 | points to the first byte of the firmware volume.\r | |
727 | @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped\r | |
728 | firmware volumes, this is typically the size of\r | |
729 | the firmware volume.\r | |
730 | @param ParentFvName If the new firmware volume originated from a file\r | |
731 | in a different firmware volume, then this parameter\r | |
732 | specifies the GUID name of the originating firmware\r | |
733 | volume. Otherwise, this parameter must be NULL.\r | |
734 | @param ParentFileName If the new firmware volume originated from a file\r | |
735 | in a different firmware volume, then this parameter\r | |
736 | specifies the GUID file name of the originating\r | |
737 | firmware file. Otherwise, this parameter must be NULL.\r | |
738 | @param AuthenticationStatus Authentication Status\r | |
739 | **/\r | |
740 | VOID\r | |
741 | EFIAPI\r | |
742 | PeiServicesInstallFvInfo2Ppi (\r | |
743 | IN CONST EFI_GUID *FvFormat, OPTIONAL\r | |
744 | IN CONST VOID *FvInfo,\r | |
745 | IN UINT32 FvInfoSize,\r | |
746 | IN CONST EFI_GUID *ParentFvName, OPTIONAL\r | |
747 | IN CONST EFI_GUID *ParentFileName, OPTIONAL\r | |
748 | IN UINT32 AuthenticationStatus\r | |
749 | )\r | |
750 | {\r | |
751 | InternalPeiServicesInstallFvInfoPpi (FALSE, FvFormat, FvInfo, FvInfoSize, ParentFvName, ParentFileName, AuthenticationStatus);\r | |
752 | }\r | |
753 | \r |