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