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