]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Pi/PiPeiCis.h
MdePkg PiHob.h: Add FV3 HOB definitions
[mirror_edk2.git] / MdePkg / Include / Pi / PiPeiCis.h
... / ...
CommitLineData
1/** @file\r
2 PI PEI master include file. This file should match the PI spec.\r
3\r
4Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials are licensed and made available under \r
6the terms and conditions of the BSD License that accompanies this distribution. \r
7The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php. \r
9 \r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
13\r
14 @par Revision Reference:\r
15 PI Version 1.4a.\r
16\r
17**/\r
18\r
19#ifndef __PI_PEICIS_H__\r
20#define __PI_PEICIS_H__\r
21\r
22#include <Uefi/UefiMultiPhase.h>\r
23#include <Pi/PiMultiPhase.h>\r
24\r
25///\r
26/// The handles of EFI FV.\r
27/// \r
28typedef VOID *EFI_PEI_FV_HANDLE;\r
29\r
30///\r
31/// The handles of EFI FFS.\r
32/// \r
33typedef VOID *EFI_PEI_FILE_HANDLE;\r
34\r
35///\r
36/// Declare the forward reference data structure for EFI_PEI_SERVICE.\r
37/// \r
38typedef struct _EFI_PEI_SERVICES EFI_PEI_SERVICES;\r
39\r
40///\r
41/// Declare the forward reference data structure for EFI_PEI_NOTIFY_DESCRIPTOR.\r
42/// \r
43typedef struct _EFI_PEI_NOTIFY_DESCRIPTOR EFI_PEI_NOTIFY_DESCRIPTOR;\r
44\r
45\r
46#include <Ppi/CpuIo.h>\r
47#include <Ppi/PciCfg2.h>\r
48\r
49\r
50/**\r
51 The PEI Dispatcher will invoke each PEIM one time. During this pass, the PEI \r
52 Dispatcher will pass control to the PEIM at the AddressOfEntryPoint in the PE Header. \r
53\r
54 @param FileHandle Pointer to the FFS file header.\r
55 @param PeiServices Describes the list of possible PEI Services.\r
56\r
57 @retval EFI_SUCCESS The PEI completed successfully.\r
58 @retval !EFI_SUCCESS There is error in PEIM.\r
59\r
60**/\r
61typedef\r
62EFI_STATUS\r
63(EFIAPI *EFI_PEIM_ENTRY_POINT2)(\r
64 IN EFI_PEI_FILE_HANDLE FileHandle,\r
65 IN CONST EFI_PEI_SERVICES **PeiServices\r
66 );\r
67\r
68/**\r
69 Entry point of the notification callback function itself within the PEIM.\r
70\r
71 @param PeiServices Indirect reference to the PEI Services Table.\r
72 @param NotifyDescriptor Address of the notification descriptor data structure.\r
73 @param Ppi Address of the PPI that was installed.\r
74\r
75 @return Status of the notification.\r
76 The status code returned from this function is ignored.\r
77**/\r
78typedef\r
79EFI_STATUS\r
80(EFIAPI *EFI_PEIM_NOTIFY_ENTRY_POINT)(\r
81 IN EFI_PEI_SERVICES **PeiServices,\r
82 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
83 IN VOID *Ppi\r
84 );\r
85\r
86//\r
87// PEI Ppi Services List Descriptors\r
88//\r
89#define EFI_PEI_PPI_DESCRIPTOR_PIC 0x00000001\r
90#define EFI_PEI_PPI_DESCRIPTOR_PPI 0x00000010\r
91#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK 0x00000020\r
92#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH 0x00000040\r
93#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES 0x00000060\r
94#define EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST 0x80000000\r
95\r
96///\r
97/// The data structure through which a PEIM describes available services to the PEI Foundation.\r
98/// \r
99typedef struct {\r
100 ///\r
101 /// This field is a set of flags describing the characteristics of this imported table entry.\r
102 /// All flags are defined as EFI_PEI_PPI_DESCRIPTOR_***, which can also be combined into one.\r
103 ///\r
104 UINTN Flags;\r
105 ///\r
106 /// The address of the EFI_GUID that names the interface.\r
107 ///\r
108 EFI_GUID *Guid;\r
109 ///\r
110 /// A pointer to the PPI. It contains the information necessary to install a service.\r
111 ///\r
112 VOID *Ppi;\r
113} EFI_PEI_PPI_DESCRIPTOR;\r
114\r
115/// \r
116/// The data structure in a given PEIM that tells the PEI \r
117/// Foundation where to invoke the notification service.\r
118/// \r
119struct _EFI_PEI_NOTIFY_DESCRIPTOR {\r
120 ///\r
121 /// Details if the type of notification are callback or dispatch.\r
122 ///\r
123 UINTN Flags;\r
124 ///\r
125 /// The address of the EFI_GUID that names the interface.\r
126 ///\r
127 EFI_GUID *Guid;\r
128 ///\r
129 /// Address of the notification callback function itself within the PEIM.\r
130 ///\r
131 EFI_PEIM_NOTIFY_ENTRY_POINT Notify;\r
132};\r
133\r
134///\r
135/// This data structure is the means by which callable services are installed and\r
136/// notifications are registered in the PEI phase.\r
137///\r
138typedef union {\r
139 ///\r
140 /// The typedef structure of the notification descriptor.\r
141 ///\r
142 EFI_PEI_NOTIFY_DESCRIPTOR Notify;\r
143 ///\r
144 /// The typedef structure of the PPI descriptor.\r
145 ///\r
146 EFI_PEI_PPI_DESCRIPTOR Ppi;\r
147} EFI_PEI_DESCRIPTOR;\r
148\r
149/**\r
150 This service is the first one provided by the PEI Foundation. This function \r
151 installs an interface in the PEI PPI database by GUID. The purpose of the \r
152 service is to publish an interface that other parties can use to call \r
153 additional PEIMs.\r
154\r
155 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table\r
156 published by the PEI Foundation.\r
157 @param PpiList A pointer to the list of interfaces that the caller shall install.\r
158\r
159 @retval EFI_SUCCESS The interface was successfully installed.\r
160 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI \r
161 descriptors in the list do not have the \r
162 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
163 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
164\r
165**/\r
166typedef\r
167EFI_STATUS\r
168(EFIAPI *EFI_PEI_INSTALL_PPI)(\r
169 IN CONST EFI_PEI_SERVICES **PeiServices,\r
170 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
171 );\r
172\r
173/**\r
174 This function reinstalls an interface in the PEI PPI database by GUID. \r
175 The purpose of the service is to publish an interface that other parties \r
176 can use to replace a same-named interface in the protocol database \r
177 with a different interface. \r
178\r
179 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table\r
180 published by the PEI Foundation.\r
181 @param OldPpi A pointer to the former PPI in the database.\r
182 @param NewPpi A pointer to the new interfaces that the caller shall install.\r
183\r
184 @retval EFI_SUCCESS The interface was successfully installed.\r
185 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL or Any of the PEI PPI descriptors in the \r
186 list do not have the EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
187 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
188 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been installed.\r
189\r
190**/\r
191typedef\r
192EFI_STATUS\r
193(EFIAPI *EFI_PEI_REINSTALL_PPI)(\r
194 IN CONST EFI_PEI_SERVICES **PeiServices,\r
195 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
196 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
197 );\r
198\r
199/**\r
200 This function locates an interface in the PEI PPI database by GUID. \r
201\r
202 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES published by the PEI Foundation.\r
203 @param Guid A pointer to the GUID whose corresponding interface needs to be found.\r
204 @param Instance The N-th instance of the interface that is required.\r
205 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.\r
206 @param Ppi A pointer to the instance of the interface.\r
207\r
208 @retval EFI_SUCCESS The interface was successfully returned.\r
209 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.\r
210\r
211**/\r
212typedef\r
213EFI_STATUS\r
214(EFIAPI *EFI_PEI_LOCATE_PPI)(\r
215 IN CONST EFI_PEI_SERVICES **PeiServices,\r
216 IN CONST EFI_GUID *Guid,\r
217 IN UINTN Instance,\r
218 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor OPTIONAL,\r
219 IN OUT VOID **Ppi\r
220 );\r
221\r
222/**\r
223 This function installs a notification service to be called back when a \r
224 given interface is installed or reinstalled. The purpose of the service \r
225 is to publish an interface that other parties can use to call additional PPIs \r
226 that may materialize later.\r
227\r
228 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
229 @param NotifyList A pointer to the list of notification interfaces that the caller shall install.\r
230\r
231 @retval EFI_SUCCESS The interface was successfully installed.\r
232 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL, or any of the PEI PPI descriptors in the \r
233 list do not have the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.\r
234 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
235\r
236**/\r
237typedef\r
238EFI_STATUS\r
239(EFIAPI *EFI_PEI_NOTIFY_PPI)(\r
240 IN CONST EFI_PEI_SERVICES **PeiServices,\r
241 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
242 );\r
243\r
244/**\r
245 This function returns the present value of the boot mode.\r
246\r
247 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
248 @param BootMode A pointer to contain the value of the boot mode.\r
249\r
250 @retval EFI_SUCCESS The boot mode returned successfully.\r
251\r
252**/\r
253typedef\r
254EFI_STATUS\r
255(EFIAPI *EFI_PEI_GET_BOOT_MODE)(\r
256 IN CONST EFI_PEI_SERVICES **PeiServices,\r
257 OUT EFI_BOOT_MODE *BootMode\r
258 );\r
259\r
260/**\r
261 This function sets the value of the boot mode.\r
262\r
263 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
264 @param BootMode The value of the boot mode to set.\r
265\r
266 @retval EFI_SUCCESS The boot mode returned successfully.\r
267\r
268**/\r
269typedef\r
270EFI_STATUS\r
271(EFIAPI *EFI_PEI_SET_BOOT_MODE)(\r
272 IN CONST EFI_PEI_SERVICES **PeiServices,\r
273 IN EFI_BOOT_MODE BootMode\r
274 );\r
275\r
276/**\r
277 This function returns the pointer to the list of Hand-Off Blocks (HOBs) in memory. \r
278\r
279 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
280 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize\r
281\r
282 @retval EFI_SUCCESS The list was successfully returned.\r
283 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r
284\r
285**/\r
286typedef\r
287EFI_STATUS\r
288(EFIAPI *EFI_PEI_GET_HOB_LIST)(\r
289 IN CONST EFI_PEI_SERVICES **PeiServices,\r
290 OUT VOID **HobList\r
291 );\r
292\r
293/**\r
294 This service, published by the PEI Foundation, abstracts the creation of a Hand-Off Block's (HOB's) headers.\r
295\r
296 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
297 @param Type The type of HOB to be installed.\r
298 @param Length The length of the HOB to be added.\r
299 @param Hob The address of a pointer that will contain the HOB header.\r
300\r
301 @retval EFI_SUCCESS The HOB was successfully created.\r
302 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
303\r
304**/\r
305typedef\r
306EFI_STATUS\r
307(EFIAPI *EFI_PEI_CREATE_HOB)(\r
308 IN CONST EFI_PEI_SERVICES **PeiServices,\r
309 IN UINT16 Type,\r
310 IN UINT16 Length,\r
311 IN OUT VOID **Hob\r
312 );\r
313\r
314/**\r
315 The purpose of the service is to abstract the capability of the PEI \r
316 Foundation to discover instances of firmware volumes in the system. \r
317\r
318 This service enables PEIMs to discover additional firmware volumes. The PEI Foundation uses this\r
319 service to abstract the locations and formats of various firmware volumes. These volumes include\r
320 the Boot Firmware Volume and any other volumes exposed by EFI_PEI_FV_PPI. The service\r
321 returns a volume handle of type EFI_PEI_FV_HANDLE, which must be unique within the system.\r
322\r
323 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
324 @param Instance This instance of the firmware volume to find.\r
325 The value 0 is the Boot Firmware Volume (BFV).\r
326 @param VolumeHandle On exit, points to the next volumn handle or NULL if it does not exist.\r
327\r
328 @retval EFI_SUCCESS The volume was found.\r
329 @retval EFI_NOT_FOUND The volume was not found.\r
330 @retval EFI_INVALID_PARAMETER VolumeHandle is NULL.\r
331\r
332**/\r
333typedef\r
334EFI_STATUS\r
335(EFIAPI *EFI_PEI_FFS_FIND_NEXT_VOLUME2)(\r
336 IN CONST EFI_PEI_SERVICES **PeiServices,\r
337 IN UINTN Instance,\r
338 OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
339 );\r
340\r
341/**\r
342 Searches for the next matching file in the firmware volume.\r
343\r
344 This service enables PEIMs to discover firmware files within a specified volume.\r
345 To find the first instance of a firmware file, pass a FileHandle value of NULL into the service.\r
346 The service returns a file handle of type EFI_PEI_FILE_HANDLE, which must be unique within\r
347 the system.\r
348\r
349 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
350 @param SearchType A filter to find files only of this type.\r
351 @param FvHandle Handle of firmware volume in which to search.\r
352 @param FileHandle On entry, points to the current handle from which to begin searching\r
353 or NULL to start at the beginning of the firmware volume.\r
354 On exit, points the file handle of the next file in the volume or NULL\r
355 if there are no more files.\r
356\r
357 @retval EFI_SUCCESS The file was found.\r
358 @retval EFI_NOT_FOUND The file was not found.\r
359 @retval EFI_NOT_FOUND The header checksum was not zero.\r
360\r
361**/\r
362typedef\r
363EFI_STATUS\r
364(EFIAPI *EFI_PEI_FFS_FIND_NEXT_FILE2)(\r
365 IN CONST EFI_PEI_SERVICES **PeiServices,\r
366 IN EFI_FV_FILETYPE SearchType,\r
367 IN CONST EFI_PEI_FV_HANDLE FvHandle,\r
368 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
369 );\r
370\r
371/**\r
372 Searches for the next matching section within the specified file.\r
373\r
374 This service enables PEI modules to discover the first section of a given type within a valid file.\r
375 This service will search within encapsulation sections (compression and GUIDed) as well. It will\r
376 search inside of a GUIDed section or a compressed section, but may not, for example, search a\r
377 GUIDed section inside a GUIDes section.\r
378 This service will not search within compression sections or GUIDed sections that require\r
379 extraction if memory is not present.\r
380\r
381 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
382 @param SectionType The value of the section type to find.\r
383 @param FileHandle Handle of the firmware file to search.\r
384 @param SectionData A pointer to the discovered section, if successful.\r
385\r
386 @retval EFI_SUCCESS The section was found.\r
387 @retval EFI_NOT_FOUND The section was not found.\r
388\r
389**/\r
390typedef\r
391EFI_STATUS\r
392(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA2)(\r
393 IN CONST EFI_PEI_SERVICES **PeiServices,\r
394 IN EFI_SECTION_TYPE SectionType,\r
395 IN EFI_PEI_FILE_HANDLE FileHandle,\r
396 OUT VOID **SectionData\r
397 );\r
398\r
399/**\r
400 Searches for the next matching section within the specified file.\r
401\r
402 This service enables PEI modules to discover the section of a given type within a valid file.\r
403 This service will search within encapsulation sections (compression and GUIDed) as well. It will\r
404 search inside of a GUIDed section or a compressed section, but may not, for example, search a\r
405 GUIDed section inside a GUIDes section.\r
406 This service will not search within compression sections or GUIDed sections that require\r
407 extraction if memory is not present.\r
408\r
409 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
410 @param SectionType The value of the section type to find.\r
411 @param SectionInstance Section instance to find.\r
412 @param FileHandle Handle of the firmware file to search.\r
413 @param SectionData A pointer to the discovered section, if successful.\r
414 @param AuthenticationStatus A pointer to the authentication status for this section.\r
415\r
416 @retval EFI_SUCCESS The section was found.\r
417 @retval EFI_NOT_FOUND The section was not found.\r
418\r
419**/\r
420typedef\r
421EFI_STATUS\r
422(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA3)(\r
423 IN CONST EFI_PEI_SERVICES **PeiServices,\r
424 IN EFI_SECTION_TYPE SectionType,\r
425 IN UINTN SectionInstance,\r
426 IN EFI_PEI_FILE_HANDLE FileHandle,\r
427 OUT VOID **SectionData,\r
428 OUT UINT32 *AuthenticationStatus\r
429 );\r
430\r
431/**\r
432 This function registers the found memory configuration with the PEI Foundation.\r
433\r
434 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
435 @param MemoryBegin The value of a region of installed memory.\r
436 @param MemoryLength The corresponding length of a region of installed memory.\r
437\r
438 @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
439 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
440 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
441\r
442**/\r
443typedef\r
444EFI_STATUS\r
445(EFIAPI *EFI_PEI_INSTALL_PEI_MEMORY)(\r
446 IN CONST EFI_PEI_SERVICES **PeiServices,\r
447 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
448 IN UINT64 MemoryLength\r
449 );\r
450\r
451/**\r
452 The purpose of the service is to publish an interface that allows \r
453 PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
454\r
455 Prior to InstallPeiMemory() being called, PEI will allocate pages from the heap.\r
456 After InstallPeiMemory() is called, PEI will allocate pages within the region\r
457 of memory provided by InstallPeiMemory() service in a best-effort fashion.\r
458 Location-specific allocations are not managed by the PEI foundation code.\r
459\r
460 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
461 @param MemoryType The type of memory to allocate.\r
462 @param Pages The number of contiguous 4 KB pages to allocate.\r
463 @param Memory A pointer to a physical address. On output, the address is set to the base \r
464 of the page range that was allocated.\r
465\r
466 @retval EFI_SUCCESS The memory range was successfully allocated.\r
467 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
468 @retval EFI_INVALID_PARAMETER The type is not equal to EfiLoaderCode, EfiLoaderData, EfiRuntimeServicesCode, \r
469 EfiRuntimeServicesData, EfiBootServicesCode, EfiBootServicesData,\r
470 EfiACPIReclaimMemory, EfiReservedMemoryType, or EfiACPIMemoryNVS.\r
471\r
472**/\r
473typedef\r
474EFI_STATUS\r
475(EFIAPI *EFI_PEI_ALLOCATE_PAGES)(\r
476 IN CONST EFI_PEI_SERVICES **PeiServices,\r
477 IN EFI_MEMORY_TYPE MemoryType,\r
478 IN UINTN Pages,\r
479 OUT EFI_PHYSICAL_ADDRESS *Memory\r
480 );\r
481\r
482/**\r
483 Frees memory pages.\r
484\r
485 @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
486 @param[in] Memory The base physical address of the pages to be freed.\r
487 @param[in] Pages The number of contiguous 4 KB pages to free.\r
488\r
489 @retval EFI_SUCCESS The requested pages were freed.\r
490 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.\r
491 @retval EFI_NOT_FOUND The requested memory pages were not allocated with\r
492 AllocatePages().\r
493\r
494**/\r
495typedef\r
496EFI_STATUS\r
497(EFIAPI *EFI_PEI_FREE_PAGES) (\r
498 IN CONST EFI_PEI_SERVICES **PeiServices,\r
499 IN EFI_PHYSICAL_ADDRESS Memory,\r
500 IN UINTN Pages\r
501 );\r
502\r
503/**\r
504 The purpose of this service is to publish an interface that \r
505 allows PEIMs to allocate memory ranges that are managed by the PEI Foundation.\r
506\r
507 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
508 @param Size The number of bytes to allocate from the pool.\r
509 @param Buffer If the call succeeds, a pointer to a pointer to the allocated buffer; undefined otherwise.\r
510\r
511 @retval EFI_SUCCESS The allocation was successful.\r
512 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
513\r
514**/\r
515typedef\r
516EFI_STATUS\r
517(EFIAPI *EFI_PEI_ALLOCATE_POOL)(\r
518 IN CONST EFI_PEI_SERVICES **PeiServices,\r
519 IN UINTN Size,\r
520 OUT VOID **Buffer\r
521 );\r
522\r
523/**\r
524 This service copies the contents of one buffer to another buffer.\r
525\r
526 @param Destination The pointer to the destination buffer of the memory copy.\r
527 @param Source The pointer to the source buffer of the memory copy.\r
528 @param Length The number of bytes to copy from Source to Destination.\r
529\r
530**/\r
531typedef\r
532VOID\r
533(EFIAPI *EFI_PEI_COPY_MEM)(\r
534 IN VOID *Destination,\r
535 IN VOID *Source,\r
536 IN UINTN Length\r
537 );\r
538\r
539/**\r
540 The service fills a buffer with a specified value.\r
541\r
542 @param Buffer The pointer to the buffer to fill.\r
543 @param Size The number of bytes in Buffer to fill.\r
544 @param Value The value to fill Buffer with.\r
545\r
546**/\r
547typedef\r
548VOID\r
549(EFIAPI *EFI_PEI_SET_MEM)(\r
550 IN VOID *Buffer,\r
551 IN UINTN Size,\r
552 IN UINT8 Value\r
553 );\r
554\r
555/**\r
556 This service publishes an interface that allows PEIMs to report status codes.\r
557\r
558 ReportStatusCode() is called by PEIMs that wish to report status information on their\r
559 progress. The principal use model is for a PEIM to emit one of the standard 32-bit error codes. This\r
560 will allow a platform owner to ascertain the state of the system, especially under conditions where\r
561 the full consoles might not have been installed.\r
562\r
563 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
564 @param Type Indicates the type of status code being reported.\r
565 @param Value Describes the current status of a hardware or\r
566 software entity. This includes information about the class and\r
567 subclass that is used to classify the entity as well as an operation.\r
568 For progress codes, the operation is the current activity.\r
569 For error codes, it is the exception.For debug codes,it is not defined at this time.\r
570 @param Instance The enumeration of a hardware or software entity within\r
571 the system. A system may contain multiple entities that match a class/subclass\r
572 pairing. The instance differentiates between them. An instance of 0 indicates\r
573 that instance information is unavailable, not meaningful, or not relevant.\r
574 Valid instance numbers start with 1.\r
575 @param CallerId This optional parameter may be used to identify the caller.\r
576 This parameter allows the status code driver to apply different rules to\r
577 different callers.\r
578 @param Data This optional parameter may be used to pass additional data.\r
579\r
580 @retval EFI_SUCCESS The function completed successfully.\r
581 @retval EFI_NOT_AVAILABLE_YET No progress code provider has installed an interface in the system.\r
582\r
583**/\r
584typedef\r
585EFI_STATUS\r
586(EFIAPI *EFI_PEI_REPORT_STATUS_CODE)(\r
587 IN CONST EFI_PEI_SERVICES **PeiServices,\r
588 IN EFI_STATUS_CODE_TYPE Type,\r
589 IN EFI_STATUS_CODE_VALUE Value,\r
590 IN UINT32 Instance,\r
591 IN CONST EFI_GUID *CallerId OPTIONAL,\r
592 IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r
593 );\r
594\r
595/**\r
596 Resets the entire platform.\r
597\r
598 This service resets the entire platform, including all processors\r
599 and devices, and reboots the system.\r
600 This service will never return EFI_SUCCESS. \r
601\r
602 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES\r
603 table published by the PEI Foundation.\r
604\r
605 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
606\r
607**/\r
608typedef\r
609EFI_STATUS\r
610(EFIAPI *EFI_PEI_RESET_SYSTEM)(\r
611 IN CONST EFI_PEI_SERVICES **PeiServices\r
612 );\r
613\r
614/**\r
615 Resets the entire platform.\r
616\r
617 @param[in] ResetType The type of reset to perform.\r
618 @param[in] ResetStatus The status code for the reset.\r
619 @param[in] DataSize The size, in bytes, of ResetData.\r
620 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown\r
621 the data buffer starts with a Null-terminated string, optionally\r
622 followed by additional binary data. The string is a description\r
623 that the caller may use to further indicate the reason for the\r
624 system reset. ResetData is only valid if ResetStatus is something\r
625 other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific\r
626 where a minimum amount of ResetData is always required.\r
627\r
628**/\r
629typedef\r
630VOID\r
631(EFIAPI *EFI_PEI_RESET2_SYSTEM) (\r
632 IN EFI_RESET_TYPE ResetType,\r
633 IN EFI_STATUS ResetStatus,\r
634 IN UINTN DataSize,\r
635 IN VOID *ResetData OPTIONAL\r
636 );\r
637\r
638/**\r
639 Find a file within a volume by its name.\r
640\r
641 This service searches for files with a specific name, within\r
642 either the specified firmware volume or all firmware volumes.\r
643 The service returns a file handle of type EFI_PEI_FILE_HANDLE,\r
644 which must be unique within the system.\r
645\r
646 @param FileName A pointer to the name of the file to\r
647 find within the firmware volume.\r
648 @param VolumeHandle The firmware volume to search.\r
649 @param FileHandle Upon exit, points to the found file's\r
650 handle or NULL if it could not be found.\r
651\r
652 @retval EFI_SUCCESS The file was found.\r
653 @retval EFI_NOT_FOUND The file was not found.\r
654 @retval EFI_INVALID_PARAMETER VolumeHandle or FileHandle or\r
655 FileName was NULL.\r
656\r
657**/\r
658typedef\r
659EFI_STATUS\r
660(EFIAPI *EFI_PEI_FFS_FIND_BY_NAME)(\r
661 IN CONST EFI_GUID *FileName,\r
662 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
663 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
664 );\r
665\r
666///\r
667/// The information of the FV file.\r
668///\r
669typedef struct {\r
670 ///\r
671 /// Name of the file.\r
672 ///\r
673 EFI_GUID FileName;\r
674 ///\r
675 /// File type.\r
676 ///\r
677 EFI_FV_FILETYPE FileType;\r
678 ///\r
679 /// Attributes of the file.\r
680 ///\r
681 EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
682 ///\r
683 /// Points to the file's data (not the header).\r
684 /// Not valid if EFI_FV_FILE_ATTRIB_MEMORY_MAPPED\r
685 /// is zero.\r
686 ///\r
687 VOID *Buffer;\r
688 ///\r
689 /// Size of the file's data.\r
690 ///\r
691 UINT32 BufferSize;\r
692} EFI_FV_FILE_INFO;\r
693\r
694///\r
695/// The information with authentication status of the FV file.\r
696///\r
697typedef struct {\r
698 ///\r
699 /// Name of the file.\r
700 ///\r
701 EFI_GUID FileName;\r
702 ///\r
703 /// File type.\r
704 ///\r
705 EFI_FV_FILETYPE FileType;\r
706 ///\r
707 /// Attributes of the file.\r
708 ///\r
709 EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
710 ///\r
711 /// Points to the file's data (not the header).\r
712 /// Not valid if EFI_FV_FILE_ATTRIB_MEMORY_MAPPED\r
713 /// is zero.\r
714 ///\r
715 VOID *Buffer;\r
716 ///\r
717 /// Size of the file's data.\r
718 ///\r
719 UINT32 BufferSize;\r
720 ///\r
721 /// Authentication status for this file.\r
722 ///\r
723 UINT32 AuthenticationStatus;\r
724} EFI_FV_FILE_INFO2;\r
725\r
726/**\r
727 Returns information about a specific file.\r
728\r
729 This function returns information about a specific file,\r
730 including its file name, type, attributes, starting address and\r
731 size. If the firmware volume is not memory mapped, then the\r
732 Buffer member will be NULL.\r
733\r
734 @param FileHandle The handle of the file.\r
735 @param FileInfo Upon exit, points to the file's\r
736 information.\r
737\r
738 @retval EFI_SUCCESS File information was returned.\r
739 @retval EFI_INVALID_PARAMETER FileHandle does not\r
740 represent a valid file.\r
741 @retval EFI_INVALID_PARAMETER FileInfo is NULL.\r
742 \r
743**/\r
744typedef\r
745EFI_STATUS\r
746(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO)(\r
747 IN EFI_PEI_FILE_HANDLE FileHandle,\r
748 OUT EFI_FV_FILE_INFO *FileInfo\r
749 );\r
750\r
751/**\r
752 Returns information about a specific file.\r
753\r
754 This function returns information about a specific file,\r
755 including its file name, type, attributes, starting address, size and authentication status.\r
756 If the firmware volume is not memory mapped, then the Buffer member will be NULL.\r
757\r
758 @param FileHandle The handle of the file.\r
759 @param FileInfo Upon exit, points to the file's\r
760 information.\r
761\r
762 @retval EFI_SUCCESS File information was returned.\r
763 @retval EFI_INVALID_PARAMETER FileHandle does not\r
764 represent a valid file.\r
765 @retval EFI_INVALID_PARAMETER FileInfo is NULL.\r
766\r
767**/\r
768typedef\r
769EFI_STATUS\r
770(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO2)(\r
771 IN EFI_PEI_FILE_HANDLE FileHandle,\r
772 OUT EFI_FV_FILE_INFO2 *FileInfo\r
773 );\r
774\r
775///\r
776/// The information of the FV volume.\r
777///\r
778typedef struct {\r
779 ///\r
780 /// Attributes of the firmware volume.\r
781 ///\r
782 EFI_FVB_ATTRIBUTES_2 FvAttributes;\r
783 ///\r
784 /// Format of the firmware volume.\r
785 ///\r
786 EFI_GUID FvFormat;\r
787 ///\r
788 /// Name of the firmware volume.\r
789 ///\r
790 EFI_GUID FvName;\r
791 ///\r
792 /// Points to the first byte of the firmware\r
793 /// volume, if bit EFI_FVB_MEMORY_MAPPED is\r
794 /// set in FvAttributes.\r
795 ///\r
796 VOID *FvStart;\r
797 ///\r
798 /// Size of the firmware volume.\r
799 ///\r
800 UINT64 FvSize;\r
801} EFI_FV_INFO;\r
802\r
803/**\r
804 Returns information about the specified volume.\r
805\r
806 This function returns information about a specific firmware\r
807 volume, including its name, type, attributes, starting address\r
808 and size.\r
809\r
810 @param VolumeHandle Handle of the volume.\r
811 @param VolumeInfo Upon exit, points to the volume's information.\r
812\r
813 @retval EFI_SUCCESS The volume information returned.\r
814 @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.\r
815 @retval EFI_INVALID_PARAMETER If VolumeHandle is NULL.\r
816 @retval EFI_SUCCESS Information was successfully returned.\r
817 @retval EFI_INVALID_PARAMETER The volume designated by the VolumeHandle is not available.\r
818\r
819**/\r
820typedef\r
821EFI_STATUS\r
822(EFIAPI *EFI_PEI_FFS_GET_VOLUME_INFO)(\r
823 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
824 OUT EFI_FV_INFO *VolumeInfo\r
825 );\r
826\r
827/**\r
828 Register a PEIM so that it will be shadowed and called again.\r
829\r
830 This service registers a file handle so that after memory is\r
831 available, the PEIM will be re-loaded into permanent memory and\r
832 re-initialized. The PEIM registered this way will always be\r
833 initialized twice. The first time, this function call will\r
834 return EFI_SUCCESS. The second time, this function call will\r
835 return EFI_ALREADY_STARTED. Depending on the order in which\r
836 PEIMs are dispatched, the PEIM making this call may be\r
837 initialized after permanent memory is installed, even the first\r
838 time.\r
839\r
840 @param FileHandle PEIM's file handle. Must be the currently\r
841 executing PEIM.\r
842 \r
843 @retval EFI_SUCCESS The PEIM was successfully registered for\r
844 shadowing.\r
845 @retval EFI_ALREADY_STARTED The PEIM was previously\r
846 registered for shadowing.\r
847 @retval EFI_NOT_FOUND The FileHandle does not refer to a\r
848 valid file handle.\r
849\r
850**/\r
851typedef\r
852EFI_STATUS\r
853(EFIAPI *EFI_PEI_REGISTER_FOR_SHADOW)(\r
854 IN EFI_PEI_FILE_HANDLE FileHandle\r
855 );\r
856\r
857\r
858//\r
859// PEI Specification Revision information\r
860//\r
861#define PEI_SPECIFICATION_MAJOR_REVISION 1\r
862#define PEI_SPECIFICATION_MINOR_REVISION 40\r
863///\r
864/// Specification inconsistency here: \r
865/// In the PI1.0 spec, PEI_SERVICES_SIGNATURE is defined as 0x5652455320494550. But \r
866/// to pass a multiple tool chain, it appends an ULL.\r
867///\r
868//\r
869// PEI Services Table\r
870//\r
871#define PEI_SERVICES_SIGNATURE 0x5652455320494550ULL\r
872///\r
873/// Specification inconsistency here: \r
874/// In the PI1.0 specification, there is a typo error in PEI_SERVICES_REVISION. In the specification the defintion is \r
875/// #define ((PEI_SPECIFICATION_MAJOR_REVISION<<16) |(PEI_SPECIFICATION_MINOR_REVISION))\r
876/// and it should be as follows:\r
877///\r
878#define PEI_SERVICES_REVISION ((PEI_SPECIFICATION_MAJOR_REVISION<<16) | (PEI_SPECIFICATION_MINOR_REVISION))\r
879\r
880/// \r
881/// EFI_PEI_SERVICES is a collection of functions whose implementation is provided by the PEI\r
882/// Foundation. These services fall into various classes, including the following:\r
883/// - Managing the boot mode\r
884/// - Allocating both early and permanent memory\r
885/// - Supporting the Firmware File System (FFS)\r
886/// - Abstracting the PPI database abstraction\r
887/// - Creating Hand-Off Blocks (HOBs).\r
888///\r
889struct _EFI_PEI_SERVICES {\r
890 ///\r
891 /// The table header for the PEI Services Table.\r
892 ///\r
893 EFI_TABLE_HEADER Hdr;\r
894\r
895 //\r
896 // PPI Functions\r
897 //\r
898 EFI_PEI_INSTALL_PPI InstallPpi;\r
899 EFI_PEI_REINSTALL_PPI ReInstallPpi;\r
900 EFI_PEI_LOCATE_PPI LocatePpi;\r
901 EFI_PEI_NOTIFY_PPI NotifyPpi;\r
902\r
903 //\r
904 // Boot Mode Functions\r
905 //\r
906 EFI_PEI_GET_BOOT_MODE GetBootMode;\r
907 EFI_PEI_SET_BOOT_MODE SetBootMode;\r
908\r
909 //\r
910 // HOB Functions\r
911 //\r
912 EFI_PEI_GET_HOB_LIST GetHobList;\r
913 EFI_PEI_CREATE_HOB CreateHob;\r
914\r
915 //\r
916 // Firmware Volume Functions\r
917 //\r
918 EFI_PEI_FFS_FIND_NEXT_VOLUME2 FfsFindNextVolume;\r
919 EFI_PEI_FFS_FIND_NEXT_FILE2 FfsFindNextFile;\r
920 EFI_PEI_FFS_FIND_SECTION_DATA2 FfsFindSectionData;\r
921\r
922 //\r
923 // PEI Memory Functions\r
924 //\r
925 EFI_PEI_INSTALL_PEI_MEMORY InstallPeiMemory;\r
926 EFI_PEI_ALLOCATE_PAGES AllocatePages;\r
927 EFI_PEI_ALLOCATE_POOL AllocatePool;\r
928 EFI_PEI_COPY_MEM CopyMem;\r
929 EFI_PEI_SET_MEM SetMem;\r
930\r
931 //\r
932 // Status Code\r
933 //\r
934 EFI_PEI_REPORT_STATUS_CODE ReportStatusCode;\r
935\r
936 //\r
937 // Reset\r
938 //\r
939 EFI_PEI_RESET_SYSTEM ResetSystem;\r
940\r
941 //\r
942 // (the following interfaces are installed by publishing PEIM)\r
943 // I/O Abstractions\r
944 //\r
945 EFI_PEI_CPU_IO_PPI *CpuIo;\r
946 EFI_PEI_PCI_CFG2_PPI *PciCfg;\r
947\r
948 //\r
949 // Future Installed Services\r
950 //\r
951 EFI_PEI_FFS_FIND_BY_NAME FfsFindFileByName;\r
952 EFI_PEI_FFS_GET_FILE_INFO FfsGetFileInfo;\r
953 EFI_PEI_FFS_GET_VOLUME_INFO FfsGetVolumeInfo;\r
954 EFI_PEI_REGISTER_FOR_SHADOW RegisterForShadow;\r
955 EFI_PEI_FFS_FIND_SECTION_DATA3 FindSectionData3;\r
956 EFI_PEI_FFS_GET_FILE_INFO2 FfsGetFileInfo2;\r
957 EFI_PEI_RESET2_SYSTEM ResetSystem2;\r
958 EFI_PEI_FREE_PAGES FreePages;\r
959};\r
960\r
961\r
962///\r
963/// EFI_SEC_PEI_HAND_OFF structure holds information about\r
964/// PEI core's operating environment, such as the size of location of\r
965/// temporary RAM, the stack location and BFV location.\r
966/// \r
967typedef struct _EFI_SEC_PEI_HAND_OFF {\r
968 ///\r
969 /// Size of the data structure.\r
970 /// \r
971 UINT16 DataSize;\r
972\r
973 ///\r
974 /// Points to the first byte of the boot firmware volume, \r
975 /// which the PEI Dispatcher should search for \r
976 /// PEI modules.\r
977 /// \r
978 VOID *BootFirmwareVolumeBase;\r
979\r
980 ///\r
981 /// Size of the boot firmware volume, in bytes.\r
982 /// \r
983 UINTN BootFirmwareVolumeSize;\r
984\r
985 ///\r
986 /// Points to the first byte of the temporary RAM.\r
987 /// \r
988 VOID *TemporaryRamBase;\r
989\r
990 ///\r
991 /// Size of the temporary RAM, in bytes.\r
992 /// \r
993 UINTN TemporaryRamSize;\r
994\r
995 ///\r
996 /// Points to the first byte of the temporary RAM \r
997 /// available for use by the PEI Foundation. The area \r
998 /// described by PeiTemporaryRamBase and PeiTemporaryRamSize \r
999 /// must not extend outside beyond the area described by\r
1000 /// TemporaryRamBase & TemporaryRamSize. This area should not\r
1001 /// overlap with the area reported by StackBase and \r
1002 /// StackSize.\r
1003 ///\r
1004 VOID *PeiTemporaryRamBase;\r
1005\r
1006 ///\r
1007 /// The size of the available temporary RAM available for \r
1008 /// use by the PEI Foundation, in bytes.\r
1009 /// \r
1010 UINTN PeiTemporaryRamSize;\r
1011\r
1012 ///\r
1013 /// Points to the first byte of the stack. \r
1014 /// This are may be part of the memory described by \r
1015 /// TemporaryRamBase and TemporaryRamSize \r
1016 /// or may be an entirely separate area.\r
1017 /// \r
1018 VOID *StackBase;\r
1019\r
1020 ///\r
1021 /// Size of the stack, in bytes.\r
1022 /// \r
1023 UINTN StackSize;\r
1024} EFI_SEC_PEI_HAND_OFF;\r
1025\r
1026\r
1027/**\r
1028 The entry point of PEI Foundation.\r
1029\r
1030 This function is the entry point for the PEI Foundation, which\r
1031 allows the SEC phase to pass information about the stack,\r
1032 temporary RAM and the Boot Firmware Volume. In addition, it also\r
1033 allows the SEC phase to pass services and data forward for use\r
1034 during the PEI phase in the form of one or more PPIs. These PPI's\r
1035 will be installed and/or immediately signaled if they are\r
1036 notification type. There is no limit to the number of additional\r
1037 PPIs that can be passed from SEC into the PEI Foundation. As part\r
1038 of its initialization phase, the PEI Foundation will add these\r
1039 SEC-hosted PPIs to its PPI database such that both the PEI\r
1040 Foundation and any modules can leverage the associated service\r
1041 calls and/or code in these early PPIs.\r
1042\r
1043 @param SecCoreData Points to a data structure containing\r
1044 information about the PEI core's\r
1045 operating environment, such as the size\r
1046 and location of temporary RAM, the stack\r
1047 location and the BFV location.\r
1048\r
1049 @param PpiList Points to a list of one or more PPI\r
1050 descriptors to be installed initially by\r
1051 the PEI core. An empty PPI list consists\r
1052 of a single descriptor with the end-tag\r
1053 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST.\r
1054 As part of its initialization phase, the\r
1055 PEI Foundation will add these SEC-hosted\r
1056 PPIs to its PPI database such that both\r
1057 the PEI Foundation and any modules can\r
1058 leverage the associated service calls\r
1059 and/or code in these early PPIs.\r
1060\r
1061\r
1062**/\r
1063typedef\r
1064VOID\r
1065(EFIAPI *EFI_PEI_CORE_ENTRY_POINT)(\r
1066 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r
1067 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
1068);\r
1069\r
1070#endif\r