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