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