]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/PeiServicesLib.h
Merge branch of PI tree to main trunk
[mirror_edk2.git] / MdePkg / Include / Library / PeiServicesLib.h
CommitLineData
fb3df220 1/** @file\r
2 Header file for PEI Services Library.\r
3\r
4 Copyright (c) 2006, 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
fb3df220 13**/\r
14\r
15#ifndef __PEI_SERVICES_LIB_H__\r
16#define __PEI_SERVICES_LIB_H__\r
17\r
18/**\r
19 This service enables a given PEIM to register an interface into the PEI Foundation. \r
20\r
21 @param PpiList A pointer to the list of interfaces that the caller shall install.\r
22\r
23 @retval EFI_SUCCESS The interface was successfully installed.\r
24 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.\r
25 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
26 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
27 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
28\r
29**/\r
30EFI_STATUS\r
31EFIAPI\r
32PeiServicesInstallPpi (\r
1c280088 33 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r
fb3df220 34 );\r
35\r
36/**\r
37 This service enables PEIMs to replace an entry in the PPI database with an alternate entry.\r
38\r
39 @param OldPpi Pointer to the old PEI PPI Descriptors.\r
40 @param NewPpi Pointer to the new PEI PPI Descriptors.\r
41\r
42 @retval EFI_SUCCESS The interface was successfully installed.\r
43 @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.\r
44 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
45 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
46 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
47 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been\r
48 installed.\r
49\r
50**/\r
51EFI_STATUS\r
52EFIAPI\r
53PeiServicesReInstallPpi (\r
1c280088 54 IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
55 IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
fb3df220 56 );\r
57\r
58/**\r
59 This service enables PEIMs to discover a given instance of an interface.\r
60\r
61 @param Guid A pointer to the GUID whose corresponding interface needs to be\r
62 found.\r
63 @param Instance The N-th instance of the interface that is required.\r
64 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.\r
65 @param Ppi A pointer to the instance of the interface.\r
66\r
67 @retval EFI_SUCCESS The interface was successfully returned.\r
68 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.\r
69\r
70**/\r
71EFI_STATUS\r
72EFIAPI\r
73PeiServicesLocatePpi (\r
1c280088 74 IN CONST EFI_GUID *Guid,\r
fb3df220 75 IN UINTN Instance,\r
76 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
77 IN OUT VOID **Ppi\r
78 );\r
79\r
80/**\r
81 This service enables PEIMs to register a given service to be invoked when another service is\r
82 installed or reinstalled.\r
83\r
84 @param NotifyList A pointer to the list of notification interfaces that the caller\r
85 shall install.\r
86\r
87 @retval EFI_SUCCESS The interface was successfully installed.\r
88 @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.\r
89 @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the\r
90 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.\r
91 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
92\r
93**/\r
94EFI_STATUS\r
95EFIAPI\r
96PeiServicesNotifyPpi (\r
1c280088 97 IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
fb3df220 98 );\r
99\r
100/**\r
101 This service enables PEIMs to ascertain the present value of the boot mode. \r
102\r
103 @param BootMode A pointer to contain the value of the boot mode.\r
104\r
105 @retval EFI_SUCCESS The boot mode was returned successfully.\r
106 @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
107\r
108**/\r
109EFI_STATUS\r
110EFIAPI\r
111PeiServicesGetBootMode (\r
112 IN OUT EFI_BOOT_MODE *BootMode\r
113 );\r
114\r
115/**\r
116 This service enables PEIMs to update the boot mode variable. \r
117\r
118 @param BootMode The value of the boot mode to set.\r
119\r
120 @retval EFI_SUCCESS The value was successfully updated\r
121\r
122**/\r
123EFI_STATUS\r
124EFIAPI\r
125PeiServicesSetBootMode (\r
126 IN EFI_BOOT_MODE BootMode\r
127 );\r
128\r
129/**\r
130 This service enables a PEIM to ascertain the address of the list of HOBs in memory.\r
131\r
132 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.\r
133\r
134 @retval EFI_SUCCESS The list was successfully returned.\r
135 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r
136\r
137**/\r
138EFI_STATUS\r
139EFIAPI\r
140PeiServicesGetHobList (\r
141 IN OUT VOID **HobList\r
142 );\r
143\r
144/**\r
145 This service enables PEIMs to create various types of HOBs.\r
146\r
147 @param Type The type of HOB to be installed.\r
148 @param Length The length of the HOB to be added.\r
149 @param Hob The address of a pointer that will contain the HOB header.\r
150\r
151 @retval EFI_SUCCESS The HOB was successfully created.\r
152 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
153\r
154**/\r
155EFI_STATUS\r
156EFIAPI\r
157PeiServicesCreateHob (\r
158 IN UINT16 Type,\r
159 IN UINT16 Length,\r
160 IN OUT VOID **Hob\r
161 );\r
162\r
163/**\r
164 This service enables PEIMs to discover additional firmware volumes.\r
165\r
166 @param Instance This instance of the firmware volume to find. The value 0 is the\r
167 Boot Firmware Volume (BFV).\r
168 @param FwVolHeader Pointer to the firmware volume header of the volume to return.\r
169\r
170 @retval EFI_SUCCESS The volume was found.\r
171 @retval EFI_NOT_FOUND The volume was not found.\r
172 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.\r
173\r
174**/\r
175EFI_STATUS\r
176EFIAPI\r
177PeiServicesFfsFindNextVolume (\r
178 IN UINTN Instance,\r
1c280088 179 IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r
fb3df220 180 );\r
181\r
182/**\r
183 This service enables PEIMs to discover additional firmware files.\r
184\r
185 @param SearchType A filter to find files only of this type.\r
186 @param FwVolHeader Pointer to the firmware volume header of the volume to search.\r
187 This parameter must point to a valid FFS volume.\r
188 @param FileHeader Pointer to the current file from which to begin searching.\r
189\r
190 @retval EFI_SUCCESS The file was found.\r
191 @retval EFI_NOT_FOUND The file was not found.\r
192 @retval EFI_NOT_FOUND The header checksum was not zero.\r
193\r
194**/\r
195EFI_STATUS\r
196EFIAPI\r
197PeiServicesFfsFindNextFile (\r
198 IN EFI_FV_FILETYPE SearchType,\r
1c280088 199 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
200 IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r
fb3df220 201 );\r
202\r
203/**\r
204 This service enables PEIMs to discover sections of a given type within a valid FFS file.\r
205\r
206 @param SearchType The value of the section type to find.\r
207 @param FfsFileHeader A pointer to the file header that contains the set of sections to\r
208 be searched.\r
209 @param SectionData A pointer to the discovered section, if successful.\r
210\r
211 @retval EFI_SUCCESS The section was found.\r
212 @retval EFI_NOT_FOUND The section was not found.\r
213\r
214**/\r
215EFI_STATUS\r
216EFIAPI\r
217PeiServicesFfsFindSectionData (\r
218 IN EFI_SECTION_TYPE SectionType,\r
1c280088 219 IN EFI_PEI_FILE_HANDLE FileHandle,\r
fb3df220 220 IN OUT VOID **SectionData\r
221 );\r
222\r
223/**\r
224 This service enables PEIMs to register the permanent memory configuration\r
225 that has been initialized with the PEI Foundation.\r
226\r
227 @param MemoryBegin The value of a region of installed memory.\r
228 @param MemoryLength The corresponding length of a region of installed memory.\r
229\r
230 @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
231 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
232 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
233\r
234**/\r
235EFI_STATUS\r
236EFIAPI\r
237PeiServicesInstallPeiMemory (\r
238 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
239 IN UINT64 MemoryLength\r
240 );\r
241\r
242/**\r
243 This service enables PEIMs to allocate memory after the permanent memory has been installed by a\r
244 PEIM.\r
245\r
246 @param MemoryType Type of memory to allocate.\r
247 @param Pages Number of pages to allocate.\r
248 @param Memory Pointer of memory allocated.\r
249\r
250 @retval EFI_SUCCESS The memory range was successfully allocated.\r
251 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.\r
252 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.\r
253 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
254\r
255**/\r
256EFI_STATUS\r
257EFIAPI\r
258PeiServicesAllocatePages (\r
259 IN EFI_MEMORY_TYPE MemoryType,\r
260 IN UINTN Pages,\r
261 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
262 );\r
263\r
264/**\r
265 This service allocates memory from the Hand-Off Block (HOB) heap.\r
266\r
267 @param Size The number of bytes to allocate from the pool.\r
268 @param Buffer If the call succeeds, a pointer to a pointer to the allocate\r
269 buffer; undefined otherwise.\r
270\r
271 @retval EFI_SUCCESS The allocation was successful\r
272 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
273\r
274**/\r
275EFI_STATUS\r
276EFIAPI\r
277PeiServicesAllocatePool (\r
278 IN UINTN Size,\r
279 OUT VOID **Buffer\r
280 );\r
281\r
282/**\r
283 This service resets the entire platform, including all processors and devices, and reboots the\r
284 system. \r
285\r
286 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
287\r
288**/\r
289EFI_STATUS\r
290EFIAPI\r
291PeiServicesResetSystem (\r
292 VOID\r
293 );\r
294\r
295\r
b0d803fe 296EFI_STATUS\r
297EFIAPI\r
298PeiServicesFfsFindByName (\r
299 IN CONST EFI_GUID *FileName,\r
300 IN CONST EFI_PEI_FV_HANDLE VolumeHandle,\r
301 OUT EFI_PEI_FILE_HANDLE *FileHandle\r
302 );\r
303\r
304\r
305EFI_STATUS\r
306EFIAPI \r
307PeiServicesFfsGetFileInfo (\r
308 IN CONST EFI_PEI_FILE_HANDLE FileHandle,\r
309 OUT EFI_FV_FILE_INFO *FileInfo\r
310 );\r
311\r
312EFI_STATUS\r
313EFIAPI\r
314PeiServicesFfsGetVolumeInfo (\r
315 IN EFI_PEI_FV_HANDLE VolumeHandle,\r
316 OUT EFI_FV_INFO *VolumeInfo\r
317 );\r
318\r
319\r
320EFI_STATUS\r
321EFIAPI\r
322PeiServicesRegisterForShadow (\r
323 IN EFI_PEI_FILE_HANDLE FileHandle\r
324 );\r
325\r
326\r
fb3df220 327#endif\r