]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGluePeiServicesLib.h
Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Include / Library / EdkIIGluePeiServicesLib.h
CommitLineData
3eb9473e 1/*++\r
2\r
2c7e5c2f
HT
3Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12\r
13Module Name:\r
14\r
15 EdkIIGluePeiServicesLib.h\r
16 \r
17Abstract: \r
18\r
19 Public header file for PEI Services Lib\r
20\r
21--*/\r
22\r
23#ifndef __EDKII_GLUE_PEI_SERVICES_LIB_H__\r
24#define __EDKII_GLUE_PEI_SERVICES_LIB_H__\r
25\r
d1d1603e 26//\r
27// To avoid macro expansion issue when the parameter list has #if #endif. \r
28// \r
29#define PeiServicesLocatePpi GluePeiServicesLocatePpi\r
30\r
3eb9473e 31/**\r
32 This service enables a given PEIM to register an interface into the PEI Foundation. \r
33\r
34 @param PpiList A pointer to the list of interfaces that the caller shall install.\r
35\r
36 @retval EFI_SUCCESS The interface was successfully installed.\r
37 @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.\r
38 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
39 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
40 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
41\r
42**/\r
43EFI_STATUS\r
44EFIAPI\r
45PeiServicesInstallPpi (\r
46 IN EFI_PEI_PPI_DESCRIPTOR *PpiList\r
47 );\r
48\r
49/**\r
50 This service enables PEIMs to replace an entry in the PPI database with an alternate entry.\r
51\r
52 @param OldPpi Pointer to the old PEI PPI Descriptors.\r
53 @param NewPpi Pointer to the new PEI PPI Descriptors.\r
54\r
55 @retval EFI_SUCCESS The interface was successfully installed.\r
56 @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.\r
57 @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
58 EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
59 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
60 @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been\r
61 installed.\r
62\r
63**/\r
64EFI_STATUS\r
65EFIAPI\r
66PeiServicesReInstallPpi (\r
67 IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
68 IN EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
69 );\r
70\r
71/**\r
72 This service enables PEIMs to discover a given instance of an interface.\r
73\r
74 @param Guid A pointer to the GUID whose corresponding interface needs to be\r
75 found.\r
76 @param Instance The N-th instance of the interface that is required.\r
77 @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.\r
78 @param Ppi A pointer to the instance of the interface.\r
79\r
80 @retval EFI_SUCCESS The interface was successfully returned.\r
81 @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.\r
82\r
83**/\r
84EFI_STATUS\r
85EFIAPI\r
86PeiServicesLocatePpi (\r
87 IN EFI_GUID *Guid,\r
88 IN UINTN Instance,\r
89 IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
90 IN OUT VOID **Ppi\r
91 );\r
92\r
93/**\r
94 This service enables PEIMs to register a given service to be invoked when another service is\r
95 installed or reinstalled.\r
96\r
97 @param NotifyList A pointer to the list of notification interfaces that the caller\r
98 shall install.\r
99\r
100 @retval EFI_SUCCESS The interface was successfully installed.\r
101 @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.\r
102 @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the\r
103 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.\r
104 @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
105\r
106**/\r
107EFI_STATUS\r
108EFIAPI\r
109PeiServicesNotifyPpi (\r
110 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
111 );\r
112\r
113/**\r
114 This service enables PEIMs to ascertain the present value of the boot mode. \r
115\r
116 @param BootMode A pointer to contain the value of the boot mode.\r
117\r
118 @retval EFI_SUCCESS The boot mode was returned successfully.\r
119 @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
120\r
121**/\r
122EFI_STATUS\r
123EFIAPI\r
124PeiServicesGetBootMode (\r
125 IN OUT EFI_BOOT_MODE *BootMode\r
126 );\r
127\r
128/**\r
129 This service enables PEIMs to update the boot mode variable. \r
130\r
131 @param BootMode The value of the boot mode to set.\r
132\r
133 @retval EFI_SUCCESS The value was successfully updated\r
134\r
135**/\r
136EFI_STATUS\r
137EFIAPI\r
138PeiServicesSetBootMode (\r
139 IN EFI_BOOT_MODE BootMode\r
140 );\r
141\r
142/**\r
143 This service enables a PEIM to ascertain the address of the list of HOBs in memory.\r
144\r
145 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.\r
146\r
147 @retval EFI_SUCCESS The list was successfully returned.\r
148 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r
149\r
150**/\r
151EFI_STATUS\r
152EFIAPI\r
153PeiServicesGetHobList (\r
154 IN OUT VOID **HobList\r
155 );\r
156\r
157/**\r
158 This service enables PEIMs to create various types of HOBs.\r
159\r
160 @param Type The type of HOB to be installed.\r
161 @param Length The length of the HOB to be added.\r
162 @param Hob The address of a pointer that will contain the HOB header.\r
163\r
164 @retval EFI_SUCCESS The HOB was successfully created.\r
165 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
166\r
167**/\r
168EFI_STATUS\r
169EFIAPI\r
170PeiServicesCreateHob (\r
171 IN UINT16 Type,\r
172 IN UINT16 Length,\r
173 IN OUT VOID **Hob\r
174 );\r
175\r
176#if (PI_SPECIFICATION_VERSION < 0x00010000)\r
177/**\r
178 This service enables PEIMs to discover additional firmware volumes.\r
179\r
180 @param Instance This instance of the firmware volume to find. The value 0 is the\r
181 Boot Firmware Volume (BFV).\r
182 @param FwVolHeader Pointer to the firmware volume header of the volume to return.\r
183\r
184 @retval EFI_SUCCESS The volume was found.\r
185 @retval EFI_NOT_FOUND The volume was not found.\r
186 @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.\r
187\r
188**/\r
189EFI_STATUS\r
190EFIAPI\r
191PeiServicesFfsFindNextVolume (\r
192 IN UINTN Instance,\r
193 IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
194 );\r
195\r
196/**\r
197 This service enables PEIMs to discover additional firmware files.\r
198\r
199 @param SearchType A filter to find files only of this type.\r
200 @param FwVolHeader Pointer to the firmware volume header of the volume to search.\r
201 This parameter must point to a valid FFS volume.\r
202 @param FileHeader Pointer to the current file from which to begin searching.\r
203\r
204 @retval EFI_SUCCESS The file was found.\r
205 @retval EFI_NOT_FOUND The file was not found.\r
206 @retval EFI_NOT_FOUND The header checksum was not zero.\r
207\r
208**/\r
209EFI_STATUS\r
210EFIAPI\r
211PeiServicesFfsFindNextFile (\r
212 IN EFI_FV_FILETYPE SearchType,\r
213 IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,\r
214 IN OUT EFI_FFS_FILE_HEADER **FileHeader\r
215 );\r
216\r
217/**\r
218 This service enables PEIMs to discover sections of a given type within a valid FFS file.\r
219\r
220 @param SearchType The value of the section type to find.\r
221 @param FfsFileHeader A pointer to the file header that contains the set of sections to\r
222 be searched.\r
223 @param SectionData A pointer to the discovered section, if successful.\r
224\r
225 @retval EFI_SUCCESS The section was found.\r
226 @retval EFI_NOT_FOUND The section was not found.\r
227\r
228**/\r
229EFI_STATUS\r
230EFIAPI\r
231PeiServicesFfsFindSectionData (\r
232 IN EFI_SECTION_TYPE SectionType,\r
233 IN EFI_FFS_FILE_HEADER *FfsFileHeader,\r
234 IN OUT VOID **SectionData\r
235 );\r
236#endif\r
237\r
238/**\r
239 This service enables PEIMs to register the permanent memory configuration\r
240 that has been initialized with the PEI Foundation.\r
241\r
242 @param MemoryBegin The value of a region of installed memory.\r
243 @param MemoryLength The corresponding length of a region of installed memory.\r
244\r
245 @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
246 @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
247 @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
248\r
249**/\r
250EFI_STATUS\r
251EFIAPI\r
252PeiServicesInstallPeiMemory (\r
253 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
254 IN UINT64 MemoryLength\r
255 );\r
256\r
257/**\r
258 This service enables PEIMs to allocate memory after the permanent memory has been installed by a\r
259 PEIM.\r
260\r
261 @param MemoryType Type of memory to allocate.\r
262 @param Pages Number of pages to allocate.\r
263 @param Memory Pointer of memory allocated.\r
264\r
265 @retval EFI_SUCCESS The memory range was successfully allocated.\r
266 @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.\r
267 @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.\r
268 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
269\r
270**/\r
271EFI_STATUS\r
272EFIAPI\r
273PeiServicesAllocatePages (\r
274 IN EFI_MEMORY_TYPE MemoryType,\r
275 IN UINTN Pages,\r
276 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
277 );\r
278\r
279/**\r
280 This service allocates memory from the Hand-Off Block (HOB) heap.\r
281\r
282 @param Size The number of bytes to allocate from the pool.\r
283 @param Buffer If the call succeeds, a pointer to a pointer to the allocate\r
284 buffer; undefined otherwise.\r
285\r
286 @retval EFI_SUCCESS The allocation was successful\r
287 @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
288\r
289**/\r
290EFI_STATUS\r
291EFIAPI\r
292PeiServicesAllocatePool (\r
293 IN UINTN Size,\r
294 OUT VOID **Buffer\r
295 );\r
296\r
297/**\r
298 This service resets the entire platform, including all processors and devices, and reboots the\r
299 system. \r
300\r
301 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
302\r
303**/\r
304EFI_STATUS\r
305EFIAPI\r
306PeiServicesResetSystem (\r
307 VOID\r
308 );\r
309\r
64cd21af
LG
310/**\r
311 PCI read-modify-write operations.\r
312\r
313 PIWG's PI specification replaces Inte's EFI Specification 1.10.\r
314 EFI_PEI_PCI_CFG_PPI defined in Inte's EFI Specification 1.10 is replaced by\r
315 EFI_PEI_PCI_CFG2_PPI in PI 1.0. "Modify" function in these two PPI are not \r
316 compatibile with each other.\r
317\r
318 For Framework code that make the following call:\r
319 PciCfg->Modify (\r
320 PeiServices,\r
321 PciCfg,\r
322 Width,\r
323 Address,\r
324 SetBits,\r
325 ClearBits\r
326 );\r
327 it will be updated to the following code which call this library API:\r
328 PeiLibPciCfgModify (\r
329 PeiServices,\r
330 PciCfg,\r
331 Width,\r
332 Address,\r
333 SetBits,\r
334 ClearBits\r
335 );\r
336\r
337 @param PeiServices An indirect pointer to the PEI Services Table\r
338 published by the PEI Foundation.\r
339 @param PciCfg A pointer to the this pointer of EFI_PEI_PCI_CFG_PPI. \r
340 This parameter is unused as a place holder to make\r
341 the parameter list identical to PEI_PCI_CFG_PPI_RW.\r
342 @param Width The width of the access. Enumerated in bytes. Type\r
343 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
344 @param Address The physical address of the access.\r
345 @param SetBits Points to value to bitwise-OR with the read configuration value.\r
346 The size of the value is determined by Width.\r
347 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r
348 The size of the value is determined by Width.\r
349\r
350 @retval EFI_SUCCESS The function completed successfully.\r
351 @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
352**/\r
353EFI_STATUS\r
354EFIAPI \r
355PeiLibPciCfgModify (\r
356 IN EFI_PEI_SERVICES **PeiServices,\r
357 IN PEI_PCI_CFG_PPI *PciCfg,\r
358 IN PEI_PCI_CFG_PPI_WIDTH Width,\r
359 IN UINT64 Address,\r
360 IN UINTN SetBits,\r
361 IN UINTN ClearBits\r
362 )\r
363;\r
3eb9473e 364\r
365#endif\r