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