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