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