]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/PeiServicesLib/PeiServicesLib.c
Minor grammatical work--mostly adding periods. Items with ONLY period added did...
[mirror_edk2.git] / MdePkg / Library / PeiServicesLib / PeiServicesLib.c
CommitLineData
738ec565 1/** @file\r
2 Implementation for PEI Services Library.\r
3\r
58380e9c 4 Copyright (c) 2006 - 2010, 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
19#include <Guid/FirmwareFileSystem2.h>\r
c892d846 20\r
c7d265a9 21#include <Library/PeiServicesLib.h>\r
22#include <Library/PeiServicesTablePointerLib.h>\r
729675ae 23#include <Library/DebugLib.h>\r
24#include <Library/MemoryAllocationLib.h>\r
25#include <Library/BaseMemoryLib.h>\r
26\r
27\r
367573d3 28GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_PEI_PPI_DESCRIPTOR mPpiListTemplate[] = {\r
729675ae 29 {\r
30 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
31 &gEfiPeiFirmwareVolumeInfoPpiGuid,\r
32 NULL\r
33 }\r
34};\r
738ec565 35\r
36/**\r
37 This service enables a given PEIM to register an interface into the PEI Foundation.\r
38\r
39 @param PpiList A pointer to the list of interfaces that the caller shall install.\r
40\r
41 @retval EFI_SUCCESS The interface was successfully installed.\r
42 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.\r
43 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
44 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
45 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
46\r
47**/\r
48EFI_STATUS\r
49EFIAPI\r
50PeiServicesInstallPpi (\r
1c280088 51 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
738ec565 52 )\r
53{\r
1c280088 54 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 55\r
5240b97c 56 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 57 return (*PeiServices)->InstallPpi (PeiServices, PpiList);\r
58}\r
59\r
60/**\r
61 This service enables PEIMs to replace an entry in the PPI database with an alternate entry.\r
62\r
2fc59a00 63 @param OldPpi The pointer to the old PEI PPI Descriptors.\r
64 @param NewPpi The pointer to the new PEI PPI Descriptors.\r
738ec565 65\r
66 @retval EFI_SUCCESS The interface was successfully installed.\r
67 @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.\r
68 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
69 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
70 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
71 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been\r
72 installed.\r
73\r
74**/\r
75EFI_STATUS\r
76EFIAPI\r
77PeiServicesReInstallPpi (\r
1c280088 78 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
79 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
738ec565 80 )\r
81{\r
1c280088 82 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 83\r
5240b97c 84 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 85 return (*PeiServices)->ReInstallPpi (PeiServices, OldPpi, NewPpi);\r
86}\r
87\r
88/**\r
89 This service enables PEIMs to discover a given instance of an interface.\r
90\r
91 @param Guid A pointer to the GUID whose corresponding interface needs to be\r
92 found.\r
93 @param Instance The N-th instance of the interface that is required.\r
94 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.\r
95 @param Ppi A pointer to the instance of the interface.\r
96\r
97 @retval EFI_SUCCESS The interface was successfully returned.\r
98 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.\r
99\r
100**/\r
101EFI_STATUS\r
102EFIAPI\r
103PeiServicesLocatePpi (\r
1c280088 104 IN CONST EFI_GUID *Guid,\r
738ec565 105 IN UINTN Instance,\r
106 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
107 IN OUT VOID **Ppi\r
108 )\r
109{\r
1c280088 110 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 111\r
5240b97c 112 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 113 return (*PeiServices)->LocatePpi (PeiServices, Guid, Instance, PpiDescriptor, Ppi);\r
114}\r
115\r
116/**\r
117 This service enables PEIMs to register a given service to be invoked when another service is\r
118 installed or reinstalled.\r
119\r
58380e9c 120 @param NotifyList A pointer to the list of notification interfaces \r
121 that the caller shall install.\r
738ec565 122\r
123 @retval EFI_SUCCESS The interface was successfully installed.\r
124 @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.\r
58380e9c 125 @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do\r
126 not have the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES\r
127 bit set in the Flags field.\r
738ec565 128 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
129\r
130**/\r
131EFI_STATUS\r
132EFIAPI\r
133PeiServicesNotifyPpi (\r
1c280088 134 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
738ec565 135 )\r
136{\r
1c280088 137 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 138\r
5240b97c 139 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 140 return (*PeiServices)->NotifyPpi (PeiServices, NotifyList);\r
141}\r
142\r
143/**\r
144 This service enables PEIMs to ascertain the present value of the boot mode.\r
145\r
146 @param BootMode A pointer to contain the value of the boot mode.\r
147\r
148 @retval EFI_SUCCESS The boot mode was returned successfully.\r
149 @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
150\r
151**/\r
152EFI_STATUS\r
153EFIAPI\r
154PeiServicesGetBootMode (\r
c3363c92 155 OUT EFI_BOOT_MODE *BootMode\r
738ec565 156 )\r
157{\r
1c280088 158 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 159\r
5240b97c 160 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 161 return (*PeiServices)->GetBootMode (PeiServices, BootMode);\r
162}\r
163\r
164/**\r
165 This service enables PEIMs to update the boot mode variable.\r
166\r
167 @param BootMode The value of the boot mode to set.\r
168\r
169 @retval EFI_SUCCESS The value was successfully updated\r
170\r
171**/\r
172EFI_STATUS\r
173EFIAPI\r
174PeiServicesSetBootMode (\r
175 IN EFI_BOOT_MODE BootMode\r
176 )\r
177{\r
1c280088 178 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 179\r
5240b97c 180 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 181 return (*PeiServices)->SetBootMode (PeiServices, BootMode);\r
182}\r
183\r
184/**\r
185 This service enables a PEIM to ascertain the address of the list of HOBs in memory.\r
186\r
58380e9c 187 @param HobList A pointer to the list of HOBs that the PEI Foundation \r
188 will initialize.\r
189 \r
738ec565 190 @retval EFI_SUCCESS The list was successfully returned.\r
191 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r
192\r
193**/\r
194EFI_STATUS\r
195EFIAPI\r
196PeiServicesGetHobList (\r
f38fdc74 197 OUT VOID **HobList\r
738ec565 198 )\r
199{\r
1c280088 200 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 201\r
5240b97c 202 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 203 return (*PeiServices)->GetHobList (PeiServices, HobList);\r
204}\r
205\r
206/**\r
207 This service enables PEIMs to create various types of HOBs.\r
208\r
209 @param Type The type of HOB to be installed.\r
210 @param Length The length of the HOB to be added.\r
58380e9c 211 @param Hob The address of a pointer that will contain the \r
212 HOB header.\r
738ec565 213\r
214 @retval EFI_SUCCESS The HOB was successfully created.\r
215 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
216\r
217**/\r
218EFI_STATUS\r
219EFIAPI\r
220PeiServicesCreateHob (\r
221 IN UINT16 Type,\r
222 IN UINT16 Length,\r
dd652088 223 OUT VOID **Hob\r
738ec565 224 )\r
225{\r
1c280088 226 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 227\r
5240b97c 228 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 229 return (*PeiServices)->CreateHob (PeiServices, Type, Length, Hob);\r
230}\r
231\r
232/**\r
233 This service enables PEIMs to discover additional firmware volumes.\r
234\r
58380e9c 235 @param Instance This instance of the firmware volume to find. The \r
236 value 0 is the Boot Firmware Volume (BFV).\r
237 @param VolumeHandle Handle of the firmware volume header of the volume\r
238 to return.\r
738ec565 239\r
240 @retval EFI_SUCCESS The volume was found.\r
241 @retval EFI_NOT_FOUND The volume was not found.\r
242 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.\r
243\r
244**/\r
245EFI_STATUS\r
246EFIAPI\r
247PeiServicesFfsFindNextVolume (\r
248 IN UINTN Instance,\r
1c280088 249 IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
738ec565 250 )\r
251{\r
1c280088 252 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 253\r
5240b97c 254 PeiServices = GetPeiServicesTablePointer ();\r
1c280088 255 return (*PeiServices)->FfsFindNextVolume (PeiServices, Instance, VolumeHandle);\r
738ec565 256}\r
257\r
258/**\r
259 This service enables PEIMs to discover additional firmware files.\r
260\r
261 @param SearchType A filter to find files only of this type.\r
58380e9c 262 @param VolumeHandle The pointer to the firmware volume header of the \r
263 volume to search. This parameter must point to a \r
264 valid FFS volume. \r
42eedea9 265 @param FileHandle Handle of the current file from which to begin searching.\r
738ec565 266\r
267 @retval EFI_SUCCESS The file was found.\r
268 @retval EFI_NOT_FOUND The file was not found.\r
269 @retval EFI_NOT_FOUND The header checksum was not zero.\r
270\r
271**/\r
272EFI_STATUS\r
273EFIAPI\r
274PeiServicesFfsFindNextFile (\r
275 IN EFI_FV_FILETYPE SearchType,\r
1c280088 276 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
277 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
738ec565 278 )\r
279{\r
1c280088 280 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 281\r
5240b97c 282 PeiServices = GetPeiServicesTablePointer ();\r
1c280088 283 return (*PeiServices)->FfsFindNextFile (PeiServices, SearchType, VolumeHandle, FileHandle);\r
738ec565 284}\r
285\r
286/**\r
287 This service enables PEIMs to discover sections of a given type within a valid FFS file.\r
288\r
42eedea9 289 @param SectionType The value of the section type to find.\r
58380e9c 290 @param FileHandle A pointer to the file header that contains the set \r
291 of sections to be searched.\r
738ec565 292 @param SectionData A pointer to the discovered section, if successful.\r
293\r
294 @retval EFI_SUCCESS The section was found.\r
295 @retval EFI_NOT_FOUND The section was not found.\r
296\r
297**/\r
298EFI_STATUS\r
299EFIAPI\r
300PeiServicesFfsFindSectionData (\r
301 IN EFI_SECTION_TYPE SectionType,\r
122e2191 302 IN EFI_PEI_FILE_HANDLE FileHandle,\r
67c89a21 303 OUT VOID **SectionData\r
738ec565 304 )\r
305{\r
1c280088 306 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 307\r
5240b97c 308 PeiServices = GetPeiServicesTablePointer ();\r
122e2191 309 return (*PeiServices)->FfsFindSectionData (PeiServices, SectionType, FileHandle, SectionData);\r
738ec565 310}\r
311\r
312/**\r
313 This service enables PEIMs to register the permanent memory configuration\r
314 that has been initialized with the PEI Foundation.\r
315\r
316 @param MemoryBegin The value of a region of installed memory.\r
317 @param MemoryLength The corresponding length of a region of installed memory.\r
318\r
319 @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
320 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
321 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
322\r
323**/\r
324EFI_STATUS\r
325EFIAPI\r
326PeiServicesInstallPeiMemory (\r
327 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
328 IN UINT64 MemoryLength\r
329 )\r
330{\r
1c280088 331 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 332\r
5240b97c 333 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 334 return (*PeiServices)->InstallPeiMemory (PeiServices, MemoryBegin, MemoryLength);\r
335}\r
336\r
337/**\r
58380e9c 338 This service enables PEIMs to allocate memory after the permanent memory has been\r
339 installed by a PEIM.\r
738ec565 340\r
341 @param MemoryType Type of memory to allocate.\r
2fc59a00 342 @param Pages The number of pages to allocate.\r
738ec565 343 @param Memory Pointer of memory allocated.\r
344\r
345 @retval EFI_SUCCESS The memory range was successfully allocated.\r
346 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.\r
347 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.\r
348 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
349\r
350**/\r
351EFI_STATUS\r
352EFIAPI\r
353PeiServicesAllocatePages (\r
354 IN EFI_MEMORY_TYPE MemoryType,\r
355 IN UINTN Pages,\r
67c89a21 356 OUT EFI_PHYSICAL_ADDRESS *Memory\r
738ec565 357 )\r
358{\r
1c280088 359 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 360\r
5240b97c 361 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 362 return (*PeiServices)->AllocatePages (PeiServices, MemoryType, Pages, Memory);\r
363}\r
364\r
365/**\r
366 This service allocates memory from the Hand-Off Block (HOB) heap.\r
367\r
368 @param Size The number of bytes to allocate from the pool.\r
58380e9c 369 @param Buffer If the call succeeds, a pointer to a pointer to \r
370 the allocate buffer; otherwise, undefined.\r
738ec565 371\r
372 @retval EFI_SUCCESS The allocation was successful\r
373 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
374\r
375**/\r
376EFI_STATUS\r
377EFIAPI\r
378PeiServicesAllocatePool (\r
379 IN UINTN Size,\r
380 OUT VOID **Buffer\r
381 )\r
382{\r
1c280088 383 CONST EFI_PEI_SERVICES **PeiServices;\r
738ec565 384\r
5240b97c 385 PeiServices = GetPeiServicesTablePointer ();\r
738ec565 386 return (*PeiServices)->AllocatePool (PeiServices, Size, Buffer);\r
387}\r
388\r
389/**\r
67c89a21 390 Resets the entire platform.\r
738ec565 391\r
67c89a21 392 @retval EFI_SUCCESS The function completed successfully.\r
738ec565 393 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
394\r
395**/\r
396EFI_STATUS\r
397EFIAPI\r
398PeiServicesResetSystem (\r
399 VOID\r
400 )\r
b0d803fe 401{\r
402 CONST EFI_PEI_SERVICES **PeiServices;\r
403\r
5240b97c 404 PeiServices = GetPeiServicesTablePointer ();\r
b0d803fe 405 return (*PeiServices)->ResetSystem (PeiServices);\r
406}\r
407\r
67c89a21 408/**\r
58380e9c 409 This service is a wrapper for the PEI Service RegisterForShadow(), except the \r
410 pointer to the PEI Services Table has been removed. See the Platform \r
411 Initialization Pre-EFI Initialization Core Interface Specification for details. \r
67c89a21 412\r
58380e9c 413 @param FileHandle PEIM's file handle. Must be the currently\r
414 executing PEIM.\r
67c89a21 415 \r
58380e9c 416 @retval EFI_SUCCESS The PEIM was successfully registered for\r
417 shadowing.\r
67c89a21 418\r
419 @retval EFI_ALREADY_STARTED The PEIM was previously\r
420 registered for shadowing.\r
421\r
58380e9c 422 @retval EFI_NOT_FOUND The FileHandle does not refer to a\r
423 valid file handle.\r
67c89a21 424**/\r
b0d803fe 425EFI_STATUS\r
426EFIAPI\r
427PeiServicesRegisterForShadow (\r
428 IN EFI_PEI_FILE_HANDLE FileHandle\r
429 )\r
738ec565 430{\r
484c7785 431 return (*GetPeiServicesTablePointer())->RegisterForShadow (FileHandle);\r
738ec565 432}\r
b0d803fe 433\r
67c89a21 434/**\r
435 This service is a wrapper for the PEI Service FfsGetFileInfo(), except the pointer to the PEI Services \r
436 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
437 Specification for details. \r
438\r
58380e9c 439 @param FileHandle The handle of the file.\r
67c89a21 440\r
58380e9c 441 @param FileInfo Upon exit, points to the file's\r
442 information.\r
67c89a21 443\r
444 @retval EFI_SUCCESS File information returned.\r
445 \r
446 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
447 represent a valid file.\r
448 \r
58380e9c 449 @retval EFI_INVALID_PARAMETER FileInfo is NULL.\r
67c89a21 450 \r
451**/\r
b0d803fe 452EFI_STATUS\r
f38fdc74 453EFIAPI \r
b0d803fe 454PeiServicesFfsGetFileInfo (\r
455 IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r
456 OUT EFI_FV_FILE_INFO *FileInfo\r
457 )\r
458{\r
484c7785 459 return (*GetPeiServicesTablePointer())->FfsGetFileInfo (FileHandle, FileInfo);\r
b0d803fe 460}\r
461\r
462\r
67c89a21 463/**\r
464 This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services \r
465 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
466 Specification for details. \r
467\r
58380e9c 468 @param FileName A pointer to the name of the file to\r
469 find within the firmware volume.\r
67c89a21 470\r
58380e9c 471 @param VolumeHandle The firmware volume to search FileHandle\r
472 Upon exit, points to the found file's\r
473 handle or NULL if it could not be found.\r
474 @param FileHandle The pointer to found file handle \r
42eedea9 475\r
67c89a21 476 @retval EFI_SUCCESS File was found.\r
477\r
478 @retval EFI_NOT_FOUND File was not found.\r
479\r
480 @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or\r
481 FileName was NULL.\r
482\r
483**/\r
b0d803fe 484EFI_STATUS\r
485EFIAPI\r
486PeiServicesFfsFindFileByName (\r
487 IN CONST EFI_GUID *FileName,\r
488 IN CONST EFI_PEI_FV_HANDLE VolumeHandle,\r
489 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
490 )\r
491{\r
492 return (*GetPeiServicesTablePointer())->FfsFindFileByName (FileName, VolumeHandle, FileHandle);\r
493}\r
494\r
495\r
67c89a21 496/**\r
497 This service is a wrapper for the PEI Service FfsGetVolumeInfo(), except the pointer to the PEI Services \r
498 Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface \r
499 Specification for details. \r
500\r
58380e9c 501 @param VolumeHandle Handle of the volume.\r
67c89a21 502\r
58380e9c 503 @param VolumeInfo Upon exit, points to the volume's\r
504 information.\r
67c89a21 505\r
506 @retval EFI_SUCCESS File information returned.\r
507 \r
508 @retval EFI_INVALID_PARAMETER If FileHandle does not\r
509 represent a valid file.\r
510 \r
511 @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r
512\r
513**/\r
b0d803fe 514EFI_STATUS\r
515EFIAPI\r
516PeiServicesFfsGetVolumeInfo (\r
517 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
518 OUT EFI_FV_INFO *VolumeInfo\r
519 )\r
520{\r
521 return (*GetPeiServicesTablePointer())->FfsGetVolumeInfo (VolumeHandle, VolumeInfo);\r
522}\r
523\r
729675ae 524/**\r
b75a165d 525 Install a EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance so the PEI Core will be notified about a new firmware volume.\r
729675ae 526 \r
b75a165d
LG
527 This function allocates, initializes, and installs a new EFI_PEI_FIRMWARE_VOLUME_INFO_PPI using \r
528 the parameters passed in to initialize the fields of the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance.\r
529 If the resources can not be allocated for EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT().\r
530 If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then ASSERT().\r
531\r
729675ae 532 \r
58380e9c 533 @param FvFormat Unique identifier of the format of the memory-mapped \r
534 firmware volume. This parameter is optional and \r
535 may be NULL. If NULL is specified, the \r
536 EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed.\r
537 @param FvInfo Points to a buffer which allows the \r
538 EFI_PEI_FIRMWARE_VOLUME_PPI to process the volume. \r
539 The format of this buffer is specific to the FvFormat. \r
540 For memory-mapped firmware volumes, this typically \r
541 points to the first byte of the firmware volume.\r
542 @param FvInfoSize The size, in bytes, of FvInfo. For memory-mapped \r
543 firmware volumes, this is typically the size of \r
544 the firmware volume.\r
545 @param ParentFvName If the new firmware volume originated from a file \r
546 in a different firmware volume, then this parameter \r
547 specifies the GUID name of the originating firmware\r
548 volume. Otherwise, this parameter must be NULL.\r
549 @param ParentFileName If the new firmware volume originated from a file \r
550 in a different firmware volume, then this parameter \r
551 specifies the GUID file name of the originating \r
552 firmware file. Otherwise, this parameter must be NULL.\r
729675ae 553**/\r
554VOID\r
555EFIAPI\r
556PeiServicesInstallFvInfoPpi (\r
557 IN CONST EFI_GUID *FvFormat, OPTIONAL\r
558 IN CONST VOID *FvInfo,\r
559 IN UINT32 FvInfoSize,\r
560 IN CONST EFI_GUID *ParentFvName, OPTIONAL\r
561 IN CONST EFI_GUID *ParentFileName OPTIONAL\r
562 )\r
563{\r
564 EFI_STATUS Status; \r
565 EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;\r
566 EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;\r
3831f3e9
LG
567 EFI_GUID *ParentFvNameValue;\r
568 EFI_GUID *ParentFileNameValue;\r
729675ae 569\r
3831f3e9
LG
570 ParentFvNameValue = NULL;\r
571 ParentFileNameValue = NULL;\r
729675ae 572 FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));\r
3831f3e9 573 ASSERT(FvInfoPpi != NULL);\r
729675ae 574\r
575 if (FvFormat != NULL) {\r
576 CopyGuid (&FvInfoPpi->FvFormat, FvFormat);\r
577 } else {\r
578 CopyGuid (&FvInfoPpi->FvFormat, &gEfiFirmwareFileSystem2Guid);\r
579 }\r
580 FvInfoPpi->FvInfo = (VOID *) FvInfo;\r
581 FvInfoPpi->FvInfoSize = FvInfoSize;\r
3831f3e9
LG
582 if (ParentFvName != NULL) {\r
583 ParentFvNameValue = AllocateCopyPool (sizeof (EFI_GUID), ParentFvName);\r
60bd4ccd 584 ASSERT (ParentFvNameValue != NULL);\r
3831f3e9
LG
585 FvInfoPpi->ParentFvName = ParentFvNameValue;\r
586 }\r
587 if (ParentFileName != NULL) {\r
588 ParentFileNameValue = AllocateCopyPool (sizeof (EFI_GUID), ParentFileName);\r
589 ASSERT (ParentFileNameValue != NULL);\r
590 FvInfoPpi->ParentFileName = ParentFileNameValue;\r
591 }\r
729675ae 592\r
593 FvInfoPpiDescriptor = AllocateCopyPool (sizeof(EFI_PEI_PPI_DESCRIPTOR), mPpiListTemplate);\r
594 ASSERT (FvInfoPpiDescriptor != NULL);\r
595\r
596 FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;\r
597 Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);\r
598 ASSERT_EFI_ERROR (Status);\r
599\r
600}\r
601\r