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