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