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