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