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