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