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