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