]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/PeiServicesLib.h
• BaseMemoryLib:
[mirror_edk2.git] / MdePkg / Include / Library / PeiServicesLib.h
CommitLineData
878ddf1f 1/** @file\r
24e25d11 2 PEI Core Library implementation\r
878ddf1f 3\r
24e25d11 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
878ddf1f 9\r
24e25d11 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
878ddf1f 12\r
24e25d11 13 Module Name: PeiServicesLib.h\r
878ddf1f 14\r
15**/\r
16\r
84a99d48 17#ifndef __PEI_SERVICES_LIB_H__\r
18#define __PEI_SERVICES_LIB_H__\r
878ddf1f 19\r
20/**\r
24e25d11 21 This service enables a given PEIM to register an interface into the PEI Foundation. \r
878ddf1f 22\r
24e25d11 23 @param PpiList A pointer to the list of interfaces that the caller shall install.\r
878ddf1f 24\r
24e25d11 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
878ddf1f 30\r
31**/\r
32EFI_STATUS\r
33EFIAPI\r
84a99d48 34PeiServicesInstallPpi (\r
878ddf1f 35 IN EFI_PEI_PPI_DESCRIPTOR *PpiList\r
36 )\r
37;\r
38\r
39/**\r
24e25d11 40 This service enables PEIMs to replace an entry in the PPI database with an alternate entry.\r
878ddf1f 41\r
24e25d11 42 @param OldPpi Pointer to the old PEI PPI Descriptors.\r
43 @param NewPpi Pointer to the new PEI PPI Descriptors.\r
878ddf1f 44\r
24e25d11 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
878ddf1f 51\r
52**/\r
53EFI_STATUS\r
54EFIAPI\r
24e25d11 55PeiServicesReInstallPpi (\r
878ddf1f 56 IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
57 IN EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
58 )\r
59;\r
60\r
61/**\r
24e25d11 62 This service enables PEIMs to discover a given instance of an interface.\r
878ddf1f 63\r
24e25d11 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
878ddf1f 68\r
24e25d11 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
878ddf1f 71\r
72**/\r
73EFI_STATUS\r
74EFIAPI\r
84a99d48 75PeiServicesLocatePpi (\r
878ddf1f 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
24e25d11 84 This service enables PEIMs to register a given service to be invoked\r
85 when another service is installed or reinstalled.\r
878ddf1f 86\r
24e25d11 87 @param NotifyList A pointer to the list of notification interfaces that the caller shall install.\r
878ddf1f 88\r
24e25d11 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
878ddf1f 94\r
95**/\r
96EFI_STATUS\r
97EFIAPI\r
84a99d48 98PeiServicesNotifyPpi (\r
878ddf1f 99 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
100 )\r
101;\r
102\r
103/**\r
24e25d11 104 This service enables PEIMs to ascertain the present value of the boot mode. \r
878ddf1f 105\r
24e25d11 106 @param BootMode A pointer to contain the value of the boot mode.\r
878ddf1f 107\r
24e25d11 108 @retval EFI_SUCCESS The boot mode was returned successfully.\r
109 @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
878ddf1f 110\r
111**/\r
112EFI_STATUS\r
113EFIAPI\r
84a99d48 114PeiServicesGetBootMode (\r
878ddf1f 115 IN OUT EFI_BOOT_MODE *BootMode\r
116 )\r
117;\r
118\r
119/**\r
24e25d11 120 This service enables PEIMs to update the boot mode variable. \r
878ddf1f 121\r
24e25d11 122 @param BootMode The value of the boot mode to set.\r
878ddf1f 123\r
24e25d11 124 @retval EFI_SUCCESS The value was successfully updated\r
878ddf1f 125\r
126**/\r
127EFI_STATUS\r
128EFIAPI\r
84a99d48 129PeiServicesSetBootMode (\r
878ddf1f 130 IN EFI_BOOT_MODE BootMode\r
131 )\r
132;\r
133\r
134/**\r
24e25d11 135 This service enables a PEIM to ascertain the address of the list of HOBs in memory.\r
878ddf1f 136\r
24e25d11 137 @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.\r
878ddf1f 138\r
24e25d11 139 @retval EFI_SUCCESS The list was successfully returned.\r
140 @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r
878ddf1f 141\r
142**/\r
143EFI_STATUS\r
144EFIAPI\r
84a99d48 145PeiServicesGetHobList (\r
878ddf1f 146 IN OUT VOID **HobList\r
147 )\r
148;\r
149\r
150/**\r
24e25d11 151 This service enables PEIMs to create various types of HOBs.\r
878ddf1f 152\r
24e25d11 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
878ddf1f 156\r
24e25d11 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
878ddf1f 159\r
160**/\r
161EFI_STATUS\r
162EFIAPI\r
84a99d48 163PeiServicesCreateHob (\r
878ddf1f 164 IN UINT16 Type,\r
165 IN UINT16 Length,\r
166 IN OUT VOID **Hob\r
167 )\r
168;\r
169\r
170/**\r
24e25d11 171 This service enables PEIMs to discover additional firmware volumes.\r
878ddf1f 172\r
24e25d11 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
878ddf1f 176\r
24e25d11 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
878ddf1f 180\r
181**/\r
182EFI_STATUS\r
183EFIAPI\r
84a99d48 184PeiServicesFfsFindNextVolume (\r
878ddf1f 185 IN UINTN Instance,\r
186 IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
187 )\r
188;\r
189\r
190/**\r
24e25d11 191 This service enables PEIMs to discover additional firmware files.\r
878ddf1f 192\r
24e25d11 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
878ddf1f 197\r
24e25d11 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
878ddf1f 201\r
202**/\r
203EFI_STATUS\r
204EFIAPI\r
84a99d48 205PeiServicesFfsFindNextFile (\r
878ddf1f 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
24e25d11 213 This service enables PEIMs to discover sections of a given type within a valid FFS file.\r
878ddf1f 214\r
24e25d11 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
878ddf1f 218\r
24e25d11 219 @retval EFI_SUCCESS The section was found.\r
220 @retval EFI_NOT_FOUND The section was not found.\r
878ddf1f 221\r
222**/\r
223EFI_STATUS\r
224EFIAPI\r
84a99d48 225PeiServicesFfsFindSectionData (\r
878ddf1f 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
24e25d11 233 This service enables PEIMs to register the permanent memory configuration\r
234 that has been initialized with the PEI Foundation.\r
878ddf1f 235\r
24e25d11 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
878ddf1f 238\r
24e25d11 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
878ddf1f 242\r
243**/\r
244EFI_STATUS\r
245EFIAPI\r
84a99d48 246PeiServicesInstallPeiMemory (\r
878ddf1f 247 IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
248 IN UINT64 MemoryLength\r
249 )\r
250;\r
251\r
252/**\r
24e25d11 253 This service enables PEIMs to allocate memory after the permanent memory has been installed by a PEIM.\r
878ddf1f 254\r
24e25d11 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
878ddf1f 258\r
24e25d11 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
878ddf1f 263\r
264**/\r
265EFI_STATUS\r
266EFIAPI\r
84a99d48 267PeiServicesAllocatePages (\r
878ddf1f 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
24e25d11 275 This service allocates memory from the Hand-Off Block (HOB) heap.\r
878ddf1f 276\r
24e25d11 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
878ddf1f 280\r
24e25d11 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
878ddf1f 283\r
284**/\r
285EFI_STATUS\r
286EFIAPI\r
84a99d48 287PeiServicesAllocatePool (\r
878ddf1f 288 IN UINTN Size,\r
289 OUT VOID **Buffer\r
290 )\r
291;\r
292\r
293/**\r
24e25d11 294 This service resets the entire platform, including all processors and devices, and reboots the system. \r
878ddf1f 295\r
24e25d11 296 @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
878ddf1f 297\r
298**/\r
299EFI_STATUS\r
300EFIAPI\r
84a99d48 301PeiServicesResetSystem (\r
878ddf1f 302 VOID\r
303 )\r
304;\r
305\r
306#endif\r