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