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