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