]>
Commit | Line | Data |
---|---|---|
615c6dd0 | 1 | /** @file\r |
b1f6a7c6 | 2 | Definition of Pei Core Structures and Services\r |
3 | \r | |
2b2f3533 | 4 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r |
cd5ebaa0 | 5 | This program and the accompanying materials\r |
192f6d4c | 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 | |
615c6dd0 | 13 | **/\r |
192f6d4c | 14 | \r |
15 | #ifndef _PEI_MAIN_H_\r | |
16 | #define _PEI_MAIN_H_\r | |
17 | \r | |
859b72fa | 18 | #include <PiPei.h>\r |
859b72fa A |
19 | #include <Ppi/DxeIpl.h>\r |
20 | #include <Ppi/MemoryDiscovered.h>\r | |
859b72fa | 21 | #include <Ppi/StatusCode.h>\r |
859b72fa | 22 | #include <Ppi/Reset.h>\r |
b0d803fe | 23 | #include <Ppi/FirmwareVolume.h>\r |
24 | #include <Ppi/FirmwareVolumeInfo.h>\r | |
25 | #include <Ppi/Decompress.h>\r | |
26 | #include <Ppi/GuidedSectionExtraction.h>\r | |
27 | #include <Ppi/LoadFile.h>\r | |
28 | #include <Ppi/Security2.h>\r | |
58dcdada | 29 | #include <Ppi/TemporaryRamSupport.h>\r |
859b72fa A |
30 | #include <Library/DebugLib.h>\r |
31 | #include <Library/PeiCoreEntryPoint.h>\r | |
32 | #include <Library/BaseLib.h>\r | |
33 | #include <Library/HobLib.h>\r | |
34 | #include <Library/PerformanceLib.h>\r | |
35 | #include <Library/PeiServicesLib.h>\r | |
36 | #include <Library/ReportStatusCodeLib.h>\r | |
c58cf83d | 37 | #include <Library/PeCoffLib.h>\r |
859b72fa A |
38 | #include <Library/PeCoffGetEntryPointLib.h>\r |
39 | #include <Library/BaseMemoryLib.h>\r | |
b0d803fe | 40 | #include <Library/CacheMaintenanceLib.h>\r |
177aabe6 | 41 | #include <Library/PcdLib.h>\r |
28dc3c67 | 42 | #include <IndustryStandard/PeImage.h>\r |
14e8823a | 43 | #include <Library/PeiServicesTablePointerLib.h>\r |
b0d803fe | 44 | #include <Library/MemoryAllocationLib.h>\r |
45 | #include <Guid/FirmwareFileSystem2.h>\r | |
46 | #include <Guid/AprioriFileName.h>\r | |
192f6d4c | 47 | \r |
15273993 | 48 | ///\r |
49 | /// It is an FFS type extension used for PeiFindFileEx. It indicates current\r | |
50 | /// Ffs searching is for all PEIMs can be dispatched by PeiCore.\r | |
51 | ///\r | |
3a63377f | 52 | #define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff\r |
53 | \r | |
b1f6a7c6 | 54 | ///\r |
55 | /// Pei Core private data structures\r | |
56 | ///\r | |
192f6d4c | 57 | typedef union {\r |
58 | EFI_PEI_PPI_DESCRIPTOR *Ppi;\r | |
59 | EFI_PEI_NOTIFY_DESCRIPTOR *Notify;\r | |
60 | VOID *Raw;\r | |
61 | } PEI_PPI_LIST_POINTERS;\r | |
62 | \r | |
40f26b8f | 63 | ///\r |
1cc76977 | 64 | /// PPI database structure which contains two link: PpiList and NotifyList. PpiList\r |
65 | /// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.\r | |
40f26b8f | 66 | ///\r |
192f6d4c | 67 | typedef struct {\r |
1cc76977 | 68 | ///\r |
69 | /// index of end of PpiList link list.\r | |
70 | ///\r | |
192f6d4c | 71 | INTN PpiListEnd;\r |
1cc76977 | 72 | ///\r |
73 | /// index of end of notify link list.\r | |
74 | ///\r | |
192f6d4c | 75 | INTN NotifyListEnd;\r |
1cc76977 | 76 | ///\r |
77 | /// index of the dispatched notify list.\r | |
78 | ///\r | |
192f6d4c | 79 | INTN DispatchListEnd;\r |
1cc76977 | 80 | ///\r |
81 | /// index of last installed Ppi description in PpiList link list.\r | |
82 | ///\r | |
192f6d4c | 83 | INTN LastDispatchedInstall;\r |
1cc76977 | 84 | ///\r |
85 | /// index of last dispatched notify in Notify link list.\r | |
86 | /// \r | |
192f6d4c | 87 | INTN LastDispatchedNotify;\r |
1cc76977 | 88 | ///\r |
89 | /// Ppi database.\r | |
90 | ///\r | |
eaf539d0 | 91 | PEI_PPI_LIST_POINTERS PpiListPtrs[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)];\r |
192f6d4c | 92 | } PEI_PPI_DATABASE;\r |
93 | \r | |
3a63377f | 94 | \r |
3a63377f | 95 | //\r |
96 | // PEI_CORE_FV_HANDE.PeimState\r | |
97 | // Do not change these values as there is code doing math to change states.\r | |
98 | // Look for Private->Fv[FvCount].PeimState[PeimCount]++;\r | |
99 | //\r | |
100 | #define PEIM_STATE_NOT_DISPATCHED 0x00\r | |
101 | #define PEIM_STATE_DISPATCHED 0x01\r | |
102 | #define PEIM_STATE_REGISITER_FOR_SHADOW 0x02\r | |
103 | #define PEIM_STATE_DONE 0x03\r | |
104 | \r | |
105 | typedef struct {\r | |
106 | EFI_FIRMWARE_VOLUME_HEADER *FvHeader;\r | |
3b428ade | 107 | EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;\r |
108 | EFI_PEI_FV_HANDLE FvHandle;\r | |
50cb16d9 | 109 | UINT8 PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
177aabe6 | 110 | EFI_PEI_FILE_HANDLE FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
3a63377f | 111 | BOOLEAN ScanFv;\r |
112 | } PEI_CORE_FV_HANDLE;\r | |
113 | \r | |
f3358329 | 114 | typedef struct {\r |
115 | EFI_GUID FvFormat;\r | |
116 | VOID *FvInfo;\r | |
117 | UINT32 FvInfoSize;\r | |
118 | EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor;\r | |
119 | } PEI_CORE_UNKNOW_FORMAT_FV_INFO;\r | |
120 | \r | |
288f9b38 LG |
121 | #define CACHE_SETION_MAX_NUMBER 0x10\r |
122 | typedef struct {\r | |
123 | EFI_COMMON_SECTION_HEADER* Section[CACHE_SETION_MAX_NUMBER];\r | |
124 | VOID* SectionData[CACHE_SETION_MAX_NUMBER];\r | |
125 | UINTN SectionSize[CACHE_SETION_MAX_NUMBER];\r | |
126 | UINTN AllSectionCount;\r | |
127 | UINTN SectionIndex;\r | |
128 | } CACHE_SECTION_DATA;\r | |
129 | \r | |
ef05e063 | 130 | ///\r |
131 | /// Forward declaration for PEI_CORE_INSTANCE\r | |
132 | ///\r | |
133 | typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE;\r | |
134 | \r | |
135 | \r | |
136 | /**\r | |
137 | Function Pointer type for PeiCore function.\r | |
138 | @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r | |
139 | and location of temporary RAM, the stack location and the BFV location.\r | |
140 | @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r | |
141 | An empty PPI list consists of a single descriptor with the end-tag\r | |
142 | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r | |
143 | phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r | |
144 | that both the PEI Foundation and any modules can leverage the associated service\r | |
145 | calls and/or code in these early PPIs\r | |
146 | @param OldCoreData Pointer to old core data that is used to initialize the\r | |
147 | core's data areas.\r | |
148 | **/\r | |
149 | typedef\r | |
150 | EFI_STATUS\r | |
151 | (EFIAPI *PEICORE_FUNCTION_POINTER)(\r | |
152 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
153 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r | |
154 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
155 | );\r | |
192f6d4c | 156 | \r |
f3f2e05d | 157 | #define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')\r |
192f6d4c | 158 | \r |
40f26b8f | 159 | ///\r |
160 | /// Pei Core private data structure instance\r | |
161 | ///\r | |
ef05e063 | 162 | struct _PEI_CORE_INSTANCE {\r |
192f6d4c | 163 | UINTN Signature;\r |
3b428ade | 164 | \r |
165 | ///\r | |
166 | /// Point to ServiceTableShadow\r | |
167 | ///\r | |
4140a663 | 168 | EFI_PEI_SERVICES *Ps;\r |
192f6d4c | 169 | PEI_PPI_DATABASE PpiData;\r |
3b428ade | 170 | \r |
171 | ///\r | |
172 | /// The count of FVs which contains FFS and could be dispatched by PeiCore.\r | |
173 | ///\r | |
3a63377f | 174 | UINTN FvCount;\r |
3b428ade | 175 | \r |
176 | ///\r | |
177 | /// The instance arrary for FVs which contains FFS and could be dispatched by PeiCore.\r | |
178 | ///\r | |
177aabe6 | 179 | PEI_CORE_FV_HANDLE Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r |
f3358329 | 180 | PEI_CORE_UNKNOW_FORMAT_FV_INFO UnknownFvInfo[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];\r |
181 | UINTN UnknownFvInfoCount;\r | |
182 | \r | |
177aabe6 | 183 | EFI_PEI_FILE_HANDLE CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
3a63377f | 184 | UINTN AprioriCount;\r |
50cb16d9 | 185 | UINTN CurrentPeimFvCount;\r |
3a63377f | 186 | UINTN CurrentPeimCount;\r |
187 | EFI_PEI_FILE_HANDLE CurrentFileHandle;\r | |
82b8c8df | 188 | BOOLEAN PeimNeedingDispatch;\r |
189 | BOOLEAN PeimDispatchOnThisPass;\r | |
190 | BOOLEAN PeimDispatcherReenter;\r | |
192f6d4c | 191 | EFI_PEI_HOB_POINTERS HobList;\r |
192 | BOOLEAN SwitchStackSignal;\r | |
193 | BOOLEAN PeiMemoryInstalled;\r | |
192f6d4c | 194 | VOID *CpuIo;\r |
b0d803fe | 195 | EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi;\r |
192f6d4c | 196 | EFI_PEI_SERVICES ServiceTableShadow;\r |
b0d803fe | 197 | EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;\r |
58dcdada | 198 | EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin;\r |
199 | UINT64 PhysicalMemoryLength;\r | |
200 | EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop;\r | |
ef05e063 | 201 | UINTN HeapOffset;\r |
202 | BOOLEAN HeapOffsetPositive;\r | |
203 | PEICORE_FUNCTION_POINTER ShadowedPeiCore;\r | |
288f9b38 | 204 | CACHE_SECTION_DATA CacheSection;\r |
54ea99a7 | 205 | //\r |
206 | // For Loading modules at fixed address feature to cache the top address below which the \r | |
207 | // Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field \r | |
4140a663 | 208 | // and Ps should not be changed since maybe user could get this top address by using the offet to Ps. \r |
54ea99a7 | 209 | //\r |
210 | EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress;\r | |
211 | //\r | |
212 | // The field is define for Loading modules at fixed address feature to tracker the PEI code\r | |
213 | // memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page\r | |
214 | // available or not. \r | |
215 | //\r | |
216 | UINT64 *PeiCodeMemoryRangeUsageBitMap;\r | |
25973fc3 | 217 | //\r |
218 | // This field points to the shadowed image read function\r | |
219 | //\r | |
220 | PE_COFF_LOADER_READ_FILE ShadowedImageRead;\r | |
ef05e063 | 221 | };\r |
192f6d4c | 222 | \r |
40f26b8f | 223 | ///\r |
224 | /// Pei Core Instance Data Macros\r | |
225 | ///\r | |
192f6d4c | 226 | #define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \\r |
4140a663 | 227 | CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)\r |
192f6d4c | 228 | \r |
b1f6a7c6 | 229 | ///\r |
230 | /// Union of temporarily used function pointers (to save stack space)\r | |
231 | ///\r | |
192f6d4c | 232 | typedef union {\r |
15273993 | 233 | PEICORE_FUNCTION_POINTER PeiCore;\r |
1c9d209f | 234 | EFI_PEIM_ENTRY_POINT2 PeimEntry;\r |
192f6d4c | 235 | EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;\r |
236 | EFI_DXE_IPL_PPI *DxeIpl;\r | |
237 | EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r | |
238 | EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;\r | |
239 | VOID *Raw;\r | |
240 | } PEI_CORE_TEMP_POINTERS;\r | |
241 | \r | |
b98c2ab7 | 242 | typedef struct {\r |
243 | CONST EFI_SEC_PEI_HAND_OFF *SecCoreData;\r | |
244 | EFI_PEI_PPI_DESCRIPTOR *PpiList;\r | |
245 | VOID *Data;\r | |
246 | } PEI_CORE_PARAMETERS;\r | |
247 | \r | |
192f6d4c | 248 | //\r |
249 | // PeiCore function\r | |
250 | //\r | |
b1f6a7c6 | 251 | /**\r |
192f6d4c | 252 | \r |
253 | The entry routine to Pei Core, invoked by PeiMain during transition\r | |
254 | from SEC to PEI. After switching stack in the PEI core, it will restart\r | |
255 | with the old core data.\r | |
256 | \r | |
192f6d4c | 257 | \r |
111e48f3 | 258 | @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r |
f34aec3b | 259 | and location of temporary RAM, the stack location and the BFV location.\r |
b1f6a7c6 | 260 | @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r |
261 | An empty PPI list consists of a single descriptor with the end-tag\r | |
262 | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r | |
263 | phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r | |
264 | that both the PEI Foundation and any modules can leverage the associated service\r | |
265 | calls and/or code in these early PPIs\r | |
266 | @param Data Pointer to old core data that is used to initialize the\r | |
192f6d4c | 267 | core's data areas.\r |
268 | \r | |
b1f6a7c6 | 269 | **/\r |
0308e20d | 270 | VOID\r |
b1f6a7c6 | 271 | EFIAPI\r |
272 | PeiCore (\r | |
273 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
d976bf31 | 274 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r |
b1f6a7c6 | 275 | IN VOID *Data\r |
ed66e1bc | 276 | );\r |
192f6d4c | 277 | \r |
278 | //\r | |
279 | // Dispatcher support functions\r | |
280 | //\r | |
281 | \r | |
b1f6a7c6 | 282 | /**\r |
192f6d4c | 283 | \r |
284 | This is the POSTFIX version of the dependency evaluator. When a\r | |
285 | PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on\r | |
286 | the evaluation stack. When that entry is poped from the evaluation\r | |
287 | stack, the PPI is checked if it is installed. This method allows\r | |
288 | some time savings as not all PPIs must be checked for certain\r | |
289 | operation types (AND, OR).\r | |
290 | \r | |
192f6d4c | 291 | \r |
1cc76977 | 292 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 293 | @param DependencyExpression Pointer to a dependency expression. The Grammar adheres to\r |
294 | the BNF described above and is stored in postfix notation.\r | |
192f6d4c | 295 | \r |
b1f6a7c6 | 296 | @retval TRUE if it is a well-formed Grammar\r |
297 | @retval FALSE if the dependency expression overflows the evaluation stack\r | |
298 | if the dependency expression underflows the evaluation stack\r | |
299 | if the dependency expression is not a well-formed Grammar.\r | |
192f6d4c | 300 | \r |
b1f6a7c6 | 301 | **/\r |
302 | BOOLEAN\r | |
303 | PeimDispatchReadiness (\r | |
304 | IN EFI_PEI_SERVICES **PeiServices,\r | |
305 | IN VOID *DependencyExpression\r | |
ed66e1bc | 306 | );\r |
192f6d4c | 307 | \r |
b1f6a7c6 | 308 | /**\r |
309 | Conduct PEIM dispatch.\r | |
310 | \r | |
731bd38e | 311 | @param SecCoreData Pointer to the data structure containing SEC to PEI handoff data\r |
1cc76977 | 312 | @param PrivateData Pointer to the private data passed in from caller\r |
192f6d4c | 313 | \r |
b1f6a7c6 | 314 | **/\r |
b0d803fe | 315 | VOID\r |
192f6d4c | 316 | PeiDispatcher (\r |
5aae0aa7 | 317 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
b0d803fe | 318 | IN PEI_CORE_INSTANCE *PrivateData\r |
ed66e1bc | 319 | );\r |
192f6d4c | 320 | \r |
b1f6a7c6 | 321 | /**\r |
322 | Initialize the Dispatcher's data members\r | |
192f6d4c | 323 | \r |
b1f6a7c6 | 324 | @param PrivateData PeiCore's private data structure\r |
325 | @param OldCoreData Old data from SecCore\r | |
326 | NULL if being run in non-permament memory mode.\r | |
aa79b0b3 | 327 | @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size\r |
328 | and location of temporary RAM, the stack location and the BFV location.\r | |
192f6d4c | 329 | \r |
b1f6a7c6 | 330 | **/\r |
192f6d4c | 331 | VOID\r |
332 | InitializeDispatcherData (\r | |
b0d803fe | 333 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 334 | IN PEI_CORE_INSTANCE *OldCoreData,\r |
5aae0aa7 | 335 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r |
ed66e1bc | 336 | );\r |
192f6d4c | 337 | \r |
b1f6a7c6 | 338 | /**\r |
339 | This routine parses the Dependency Expression, if available, and\r | |
340 | decides if the module can be executed.\r | |
192f6d4c | 341 | \r |
192f6d4c | 342 | \r |
b1f6a7c6 | 343 | @param Private PeiCore's private data structure\r |
344 | @param FileHandle PEIM's file handle\r | |
731bd38e | 345 | @param PeimCount The index of last dispatched PEIM.\r |
192f6d4c | 346 | \r |
731bd38e | 347 | @retval TRUE Can be dispatched\r |
348 | @retval FALSE Cannot be dispatched\r | |
192f6d4c | 349 | \r |
b1f6a7c6 | 350 | **/\r |
192f6d4c | 351 | BOOLEAN\r |
352 | DepexSatisfied (\r | |
b0d803fe | 353 | IN PEI_CORE_INSTANCE *Private,\r |
354 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
355 | IN UINTN PeimCount\r | |
ed66e1bc | 356 | );\r |
192f6d4c | 357 | \r |
192f6d4c | 358 | //\r |
359 | // PPI support functions\r | |
360 | //\r | |
b1f6a7c6 | 361 | /**\r |
362 | \r | |
363 | Initialize PPI services.\r | |
364 | \r | |
b1f6a7c6 | 365 | @param PrivateData Pointer to the PEI Core data.\r |
366 | @param OldCoreData Pointer to old PEI Core data. \r | |
367 | NULL if being run in non-permament memory mode.\r | |
368 | \r | |
369 | **/\r | |
192f6d4c | 370 | VOID\r |
371 | InitializePpiServices (\r | |
b0d803fe | 372 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 373 | IN PEI_CORE_INSTANCE *OldCoreData\r |
ed66e1bc | 374 | );\r |
192f6d4c | 375 | \r |
b1f6a7c6 | 376 | /**\r |
192f6d4c | 377 | \r |
3d4d0c34 | 378 | Migrate the Hob list from the temporary memory stack to PEI installed memory.\r |
731bd38e | 379 | \r |
380 | @param PrivateData Pointer to PeiCore's private data structure.\r | |
381 | @param OldCheckingBottom Bottom of temporary memory range. All Ppi in this range\r | |
382 | will be fixup for PpiData and PpiDescriptor pointer.\r | |
383 | @param OldCheckingTop Top of temporary memory range. All Ppi in this range\r | |
384 | will be fixup for PpiData and PpiDescriptor.\r | |
5c5a0601 | 385 | @param Fixup The address difference between\r |
386 | the new Hob list and old Hob list.\r | |
ef05e063 | 387 | @param FixupPositive TRUE if new Hob list is above the old Hob list. \r |
388 | Otherwise FALSE.\r | |
192f6d4c | 389 | \r |
b1f6a7c6 | 390 | **/\r |
192f6d4c | 391 | VOID\r |
392 | ConvertPpiPointers (\r | |
40f26b8f | 393 | IN PEI_CORE_INSTANCE *PrivateData,\r |
394 | IN UINTN OldCheckingBottom,\r | |
395 | IN UINTN OldCheckingTop,\r | |
ef05e063 | 396 | IN UINTN Fixup,\r |
397 | IN BOOLEAN FixupPositive\r | |
ed66e1bc | 398 | );\r |
192f6d4c | 399 | \r |
b1f6a7c6 | 400 | /**\r |
192f6d4c | 401 | \r |
731bd38e | 402 | Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.\r |
192f6d4c | 403 | \r |
15273993 | 404 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
405 | @param PpiList Pointer to ppi array that want to be installed.\r | |
192f6d4c | 406 | \r |
15273993 | 407 | @retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.\r |
408 | @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer\r | |
731bd38e | 409 | if any PPI in PpiList is not valid\r |
15273993 | 410 | @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI\r |
192f6d4c | 411 | \r |
b1f6a7c6 | 412 | **/\r |
192f6d4c | 413 | EFI_STATUS\r |
414 | EFIAPI\r | |
415 | PeiInstallPpi (\r | |
0c2b5da8 | 416 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
417 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList\r | |
ed66e1bc | 418 | );\r |
192f6d4c | 419 | \r |
b1f6a7c6 | 420 | /**\r |
192f6d4c | 421 | \r |
b1f6a7c6 | 422 | Re-Install PPI services.\r |
192f6d4c | 423 | \r |
1cc76977 | 424 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
425 | @param OldPpi Pointer to the old PEI PPI Descriptors.\r | |
426 | @param NewPpi Pointer to the new PEI PPI Descriptors.\r | |
192f6d4c | 427 | \r |
1cc76977 | 428 | @retval EFI_SUCCESS if the operation was successful\r |
429 | @retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL\r | |
731bd38e | 430 | if NewPpi is not valid\r |
1cc76977 | 431 | @retval EFI_NOT_FOUND if the PPI was not in the database\r |
192f6d4c | 432 | \r |
b1f6a7c6 | 433 | **/\r |
192f6d4c | 434 | EFI_STATUS\r |
435 | EFIAPI\r | |
436 | PeiReInstallPpi (\r | |
0c2b5da8 | 437 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
438 | IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r | |
439 | IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi\r | |
ed66e1bc | 440 | );\r |
192f6d4c | 441 | \r |
b1f6a7c6 | 442 | /**\r |
192f6d4c | 443 | \r |
b1f6a7c6 | 444 | Locate a given named PPI.\r |
192f6d4c | 445 | \r |
192f6d4c | 446 | \r |
1cc76977 | 447 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
448 | @param Guid Pointer to GUID of the PPI.\r | |
449 | @param Instance Instance Number to discover.\r | |
450 | @param PpiDescriptor Pointer to reference the found descriptor. If not NULL,\r | |
b1f6a7c6 | 451 | returns a pointer to the descriptor (includes flags, etc)\r |
1cc76977 | 452 | @param Ppi Pointer to reference the found PPI\r |
192f6d4c | 453 | \r |
b1f6a7c6 | 454 | @retval EFI_SUCCESS if the PPI is in the database\r |
455 | @retval EFI_NOT_FOUND if the PPI is not in the database\r | |
192f6d4c | 456 | \r |
b1f6a7c6 | 457 | **/\r |
192f6d4c | 458 | EFI_STATUS\r |
459 | EFIAPI\r | |
460 | PeiLocatePpi (\r | |
1cc76977 | 461 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
462 | IN CONST EFI_GUID *Guid,\r | |
192f6d4c | 463 | IN UINTN Instance,\r |
464 | IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r | |
465 | IN OUT VOID **Ppi\r | |
ed66e1bc | 466 | );\r |
192f6d4c | 467 | \r |
b1f6a7c6 | 468 | /**\r |
192f6d4c | 469 | \r |
b1f6a7c6 | 470 | Install a notification for a given PPI.\r |
192f6d4c | 471 | \r |
192f6d4c | 472 | \r |
1cc76977 | 473 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
474 | @param NotifyList Pointer to list of Descriptors to notify upon.\r | |
192f6d4c | 475 | \r |
b1f6a7c6 | 476 | @retval EFI_SUCCESS if successful\r |
477 | @retval EFI_OUT_OF_RESOURCES if no space in the database\r | |
478 | @retval EFI_INVALID_PARAMETER if not a good decriptor\r | |
192f6d4c | 479 | \r |
b1f6a7c6 | 480 | **/\r |
192f6d4c | 481 | EFI_STATUS\r |
482 | EFIAPI\r | |
483 | PeiNotifyPpi (\r | |
0c2b5da8 | 484 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
485 | IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r | |
ed66e1bc | 486 | );\r |
192f6d4c | 487 | \r |
b1f6a7c6 | 488 | /**\r |
192f6d4c | 489 | \r |
b1f6a7c6 | 490 | Process the Notify List at dispatch level.\r |
192f6d4c | 491 | \r |
b1f6a7c6 | 492 | @param PrivateData PeiCore's private data structure.\r |
192f6d4c | 493 | \r |
b1f6a7c6 | 494 | **/\r |
192f6d4c | 495 | VOID\r |
496 | ProcessNotifyList (\r | |
b0d803fe | 497 | IN PEI_CORE_INSTANCE *PrivateData\r |
ed66e1bc | 498 | );\r |
192f6d4c | 499 | \r |
b1f6a7c6 | 500 | /**\r |
192f6d4c | 501 | \r |
b1f6a7c6 | 502 | Dispatch notifications.\r |
192f6d4c | 503 | \r |
b1f6a7c6 | 504 | @param PrivateData PeiCore's private data structure\r |
505 | @param NotifyType Type of notify to fire.\r | |
506 | @param InstallStartIndex Install Beginning index.\r | |
507 | @param InstallStopIndex Install Ending index.\r | |
508 | @param NotifyStartIndex Notify Beginning index.\r | |
509 | @param NotifyStopIndex Notify Ending index.\r | |
192f6d4c | 510 | \r |
b1f6a7c6 | 511 | **/\r |
192f6d4c | 512 | VOID\r |
513 | DispatchNotify (\r | |
b0d803fe | 514 | IN PEI_CORE_INSTANCE *PrivateData,\r |
192f6d4c | 515 | IN UINTN NotifyType,\r |
516 | IN INTN InstallStartIndex,\r | |
517 | IN INTN InstallStopIndex,\r | |
518 | IN INTN NotifyStartIndex,\r | |
519 | IN INTN NotifyStopIndex\r | |
ed66e1bc | 520 | );\r |
192f6d4c | 521 | \r |
522 | //\r | |
523 | // Boot mode support functions\r | |
524 | //\r | |
b1f6a7c6 | 525 | /**\r |
526 | This service enables PEIMs to ascertain the present value of the boot mode.\r | |
527 | \r | |
1cc76977 | 528 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 529 | @param BootMode A pointer to contain the value of the boot mode.\r |
530 | \r | |
531 | @retval EFI_SUCCESS The boot mode was returned successfully.\r | |
532 | @retval EFI_INVALID_PARAMETER BootMode is NULL.\r | |
533 | \r | |
534 | **/\r | |
192f6d4c | 535 | EFI_STATUS\r |
536 | EFIAPI\r | |
537 | PeiGetBootMode (\r | |
0c2b5da8 | 538 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
d976bf31 | 539 | IN OUT EFI_BOOT_MODE *BootMode\r |
ed66e1bc | 540 | );\r |
192f6d4c | 541 | \r |
b1f6a7c6 | 542 | /**\r |
543 | This service enables PEIMs to update the boot mode variable.\r | |
192f6d4c | 544 | \r |
192f6d4c | 545 | \r |
1cc76977 | 546 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
547 | @param BootMode The value of the boot mode to set.\r | |
192f6d4c | 548 | \r |
1cc76977 | 549 | @return EFI_SUCCESS The value was successfully updated\r |
192f6d4c | 550 | \r |
b1f6a7c6 | 551 | **/\r |
192f6d4c | 552 | EFI_STATUS\r |
553 | EFIAPI\r | |
554 | PeiSetBootMode (\r | |
0c2b5da8 | 555 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 556 | IN EFI_BOOT_MODE BootMode\r |
ed66e1bc | 557 | );\r |
192f6d4c | 558 | \r |
559 | //\r | |
560 | // Security support functions\r | |
561 | //\r | |
b1f6a7c6 | 562 | /**\r |
563 | \r | |
564 | Initialize the security services.\r | |
565 | \r | |
1cc76977 | 566 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
40f26b8f | 567 | @param OldCoreData Pointer to the old core data.\r |
b1f6a7c6 | 568 | NULL if being run in non-permament memory mode.\r |
569 | \r | |
570 | **/\r | |
192f6d4c | 571 | VOID\r |
572 | InitializeSecurityServices (\r | |
573 | IN EFI_PEI_SERVICES **PeiServices,\r | |
574 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
ed66e1bc | 575 | );\r |
192f6d4c | 576 | \r |
b1f6a7c6 | 577 | /**\r |
d976bf31 | 578 | Verify a Firmware volume.\r |
192f6d4c | 579 | \r |
40f26b8f | 580 | @param CurrentFvAddress Pointer to the current Firmware Volume under consideration\r |
192f6d4c | 581 | \r |
40f26b8f | 582 | @retval EFI_SUCCESS Firmware Volume is legal\r |
583 | @retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test\r | |
192f6d4c | 584 | \r |
b1f6a7c6 | 585 | **/\r |
192f6d4c | 586 | EFI_STATUS\r |
587 | VerifyFv (\r | |
588 | IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress\r | |
ed66e1bc | 589 | );\r |
192f6d4c | 590 | \r |
b1f6a7c6 | 591 | /**\r |
192f6d4c | 592 | \r |
b1f6a7c6 | 593 | Provide a callout to the security verification service.\r |
192f6d4c | 594 | \r |
192f6d4c | 595 | \r |
b1f6a7c6 | 596 | @param PrivateData PeiCore's private data structure\r |
597 | @param VolumeHandle Handle of FV\r | |
598 | @param FileHandle Handle of PEIM's ffs\r | |
192f6d4c | 599 | \r |
b1f6a7c6 | 600 | @retval EFI_SUCCESS Image is OK\r |
601 | @retval EFI_SECURITY_VIOLATION Image is illegal\r | |
192f6d4c | 602 | \r |
b1f6a7c6 | 603 | **/\r |
192f6d4c | 604 | EFI_STATUS\r |
605 | VerifyPeim (\r | |
b0d803fe | 606 | IN PEI_CORE_INSTANCE *PrivateData,\r |
607 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
608 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
ed66e1bc | 609 | );\r |
192f6d4c | 610 | \r |
b1f6a7c6 | 611 | /**\r |
192f6d4c | 612 | \r |
b1f6a7c6 | 613 | Gets the pointer to the HOB List.\r |
192f6d4c | 614 | \r |
192f6d4c | 615 | \r |
1cc76977 | 616 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 617 | @param HobList Pointer to the HOB List.\r |
192f6d4c | 618 | \r |
b1f6a7c6 | 619 | @retval EFI_SUCCESS Get the pointer of HOB List\r |
620 | @retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published\r | |
621 | @retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)\r | |
192f6d4c | 622 | \r |
b1f6a7c6 | 623 | **/\r |
192f6d4c | 624 | EFI_STATUS\r |
625 | EFIAPI\r | |
626 | PeiGetHobList (\r | |
0c2b5da8 | 627 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 628 | IN OUT VOID **HobList\r |
ed66e1bc | 629 | );\r |
192f6d4c | 630 | \r |
b1f6a7c6 | 631 | /**\r |
632 | Add a new HOB to the HOB List.\r | |
192f6d4c | 633 | \r |
1cc76977 | 634 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
635 | @param Type Type of the new HOB.\r | |
636 | @param Length Length of the new HOB to allocate.\r | |
637 | @param Hob Pointer to the new HOB.\r | |
192f6d4c | 638 | \r |
b1f6a7c6 | 639 | @return EFI_SUCCESS Success to create hob.\r |
640 | @retval EFI_INVALID_PARAMETER if Hob is NULL\r | |
641 | @retval EFI_NOT_AVAILABLE_YET if HobList is still not available.\r | |
642 | @retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.\r | |
192f6d4c | 643 | \r |
b1f6a7c6 | 644 | **/\r |
192f6d4c | 645 | EFI_STATUS\r |
646 | EFIAPI\r | |
647 | PeiCreateHob (\r | |
0c2b5da8 | 648 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 649 | IN UINT16 Type,\r |
650 | IN UINT16 Length,\r | |
651 | IN OUT VOID **Hob\r | |
ed66e1bc | 652 | );\r |
192f6d4c | 653 | \r |
b1f6a7c6 | 654 | /**\r |
192f6d4c | 655 | \r |
b1f6a7c6 | 656 | Builds a Handoff Information Table HOB\r |
192f6d4c | 657 | \r |
b1f6a7c6 | 658 | @param BootMode - Current Bootmode\r |
659 | @param MemoryBegin - Start Memory Address.\r | |
660 | @param MemoryLength - Length of Memory.\r | |
192f6d4c | 661 | \r |
b1f6a7c6 | 662 | @return EFI_SUCCESS Always success to initialize HOB.\r |
192f6d4c | 663 | \r |
b1f6a7c6 | 664 | **/\r |
192f6d4c | 665 | EFI_STATUS\r |
666 | PeiCoreBuildHobHandoffInfoTable (\r | |
667 | IN EFI_BOOT_MODE BootMode,\r | |
668 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r | |
669 | IN UINT64 MemoryLength\r | |
ed66e1bc | 670 | );\r |
192f6d4c | 671 | \r |
672 | \r | |
673 | //\r | |
674 | // FFS Fw Volume support functions\r | |
675 | //\r | |
b1f6a7c6 | 676 | /**\r |
3b428ade | 677 | Searches for the next matching file in the firmware volume.\r |
b1f6a7c6 | 678 | \r |
1cc76977 | 679 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 680 | @param SearchType Filter to find only files of this type.\r |
681 | Type EFI_FV_FILETYPE_ALL causes no filtering to be done.\r | |
aa75dfec | 682 | @param FvHandle Handle of firmware volume in which to search.\r |
3b428ade | 683 | @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start\r |
684 | at the beginning of the firmware volume. On exit, points the file handle of the next file\r | |
685 | in the volume or NULL if there are no more files.\r | |
686 | \r | |
687 | @retval EFI_NOT_FOUND The file was not found.\r | |
688 | @retval EFI_NOT_FOUND The header checksum was not zero.\r | |
689 | @retval EFI_SUCCESS The file was found.\r | |
b1f6a7c6 | 690 | \r |
691 | **/\r | |
192f6d4c | 692 | EFI_STATUS\r |
693 | EFIAPI\r | |
694 | PeiFfsFindNextFile (\r | |
0c2b5da8 | 695 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 696 | IN UINT8 SearchType,\r |
3b428ade | 697 | IN EFI_PEI_FV_HANDLE FvHandle,\r |
698 | IN OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
ed66e1bc | 699 | );\r |
192f6d4c | 700 | \r |
b1f6a7c6 | 701 | /**\r |
3b428ade | 702 | Searches for the next matching section within the specified file.\r |
192f6d4c | 703 | \r |
3b428ade | 704 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r |
b1f6a7c6 | 705 | @param SectionType Filter to find only sections of this type.\r |
3b428ade | 706 | @param FileHandle Pointer to the current file to search.\r |
707 | @param SectionData A pointer to the discovered section, if successful.\r | |
b1f6a7c6 | 708 | NULL if section not found\r |
192f6d4c | 709 | \r |
3b428ade | 710 | @retval EFI_NOT_FOUND The section was not found.\r |
711 | @retval EFI_SUCCESS The section was found.\r | |
192f6d4c | 712 | \r |
b1f6a7c6 | 713 | **/\r |
192f6d4c | 714 | EFI_STATUS\r |
715 | EFIAPI\r | |
716 | PeiFfsFindSectionData (\r | |
3b428ade | 717 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
718 | IN EFI_SECTION_TYPE SectionType,\r | |
719 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
720 | OUT VOID **SectionData\r | |
ed66e1bc | 721 | );\r |
192f6d4c | 722 | \r |
b1f6a7c6 | 723 | /**\r |
3b428ade | 724 | Search the firmware volumes by index\r |
192f6d4c | 725 | \r |
3b428ade | 726 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r |
727 | @param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware\r | |
728 | Volume (BFV).\r | |
729 | @param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.\r | |
192f6d4c | 730 | \r |
3b428ade | 731 | @retval EFI_INVALID_PARAMETER VolumeHandle is NULL\r |
732 | @retval EFI_NOT_FOUND The volume was not found.\r | |
733 | @retval EFI_SUCCESS The volume was found.\r | |
192f6d4c | 734 | \r |
b1f6a7c6 | 735 | **/\r |
192f6d4c | 736 | EFI_STATUS\r |
737 | EFIAPI\r | |
3b428ade | 738 | PeiFfsFindNextVolume (\r |
15273993 | 739 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 740 | IN UINTN Instance,\r |
aa75dfec | 741 | IN OUT EFI_PEI_FV_HANDLE *VolumeHandle\r |
ed66e1bc | 742 | );\r |
192f6d4c | 743 | \r |
744 | //\r | |
745 | // Memory support functions\r | |
746 | //\r | |
b1f6a7c6 | 747 | /**\r |
748 | \r | |
749 | Initialize the memory services.\r | |
750 | \r | |
1cc76977 | 751 | @param PrivateData PeiCore's private data structure\r |
111e48f3 | 752 | @param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size \r |
f34aec3b | 753 | and location of temporary RAM, the stack location and the BFV location.\r |
b1f6a7c6 | 754 | @param OldCoreData Pointer to the PEI Core data.\r |
755 | NULL if being run in non-permament memory mode.\r | |
756 | \r | |
757 | **/\r | |
192f6d4c | 758 | VOID\r |
759 | InitializeMemoryServices (\r | |
b0d803fe | 760 | IN PEI_CORE_INSTANCE *PrivateData,\r |
5aae0aa7 | 761 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r |
192f6d4c | 762 | IN PEI_CORE_INSTANCE *OldCoreData\r |
ed66e1bc | 763 | );\r |
192f6d4c | 764 | \r |
b1f6a7c6 | 765 | /**\r |
192f6d4c | 766 | \r |
b1f6a7c6 | 767 | Install the permanent memory is now available.\r |
768 | Creates HOB (PHIT and Stack).\r | |
192f6d4c | 769 | \r |
1cc76977 | 770 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
771 | @param MemoryBegin Start of memory address.\r | |
772 | @param MemoryLength Length of memory.\r | |
192f6d4c | 773 | \r |
b1f6a7c6 | 774 | @return EFI_SUCCESS Always success.\r |
192f6d4c | 775 | \r |
b1f6a7c6 | 776 | **/\r |
192f6d4c | 777 | EFI_STATUS\r |
778 | EFIAPI\r | |
779 | PeiInstallPeiMemory (\r | |
0c2b5da8 | 780 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 781 | IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r |
782 | IN UINT64 MemoryLength\r | |
ed66e1bc | 783 | );\r |
192f6d4c | 784 | \r |
b1f6a7c6 | 785 | /**\r |
192f6d4c | 786 | \r |
b1f6a7c6 | 787 | Memory allocation service on permanent memory,\r |
788 | not usable prior to the memory installation.\r | |
192f6d4c | 789 | \r |
192f6d4c | 790 | \r |
1cc76977 | 791 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
792 | @param MemoryType Type of memory to allocate.\r | |
793 | @param Pages Number of pages to allocate.\r | |
794 | @param Memory Pointer of memory allocated.\r | |
192f6d4c | 795 | \r |
b1f6a7c6 | 796 | @retval EFI_SUCCESS The allocation was successful\r |
797 | @retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.\r | |
798 | @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available\r | |
799 | @retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement\r | |
800 | to allocate the number of pages.\r | |
192f6d4c | 801 | \r |
b1f6a7c6 | 802 | **/\r |
192f6d4c | 803 | EFI_STATUS\r |
804 | EFIAPI\r | |
805 | PeiAllocatePages (\r | |
0c2b5da8 | 806 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 807 | IN EFI_MEMORY_TYPE MemoryType,\r |
808 | IN UINTN Pages,\r | |
809 | OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
ed66e1bc | 810 | );\r |
192f6d4c | 811 | \r |
b1f6a7c6 | 812 | /**\r |
192f6d4c | 813 | \r |
3d4d0c34 | 814 | Memory allocation service on the temporary memory.\r |
192f6d4c | 815 | \r |
192f6d4c | 816 | \r |
1cc76977 | 817 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
818 | @param Size Amount of memory required\r | |
819 | @param Buffer Address of pointer to the buffer\r | |
192f6d4c | 820 | \r |
b1f6a7c6 | 821 | @retval EFI_SUCCESS The allocation was successful\r |
822 | @retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement\r | |
823 | to allocate the requested size.\r | |
192f6d4c | 824 | \r |
b1f6a7c6 | 825 | **/\r |
192f6d4c | 826 | EFI_STATUS\r |
827 | EFIAPI\r | |
828 | PeiAllocatePool (\r | |
0c2b5da8 | 829 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 830 | IN UINTN Size,\r |
831 | OUT VOID **Buffer\r | |
ed66e1bc | 832 | );\r |
192f6d4c | 833 | \r |
b1f6a7c6 | 834 | /**\r |
192f6d4c | 835 | \r |
b1f6a7c6 | 836 | Routine for load image file.\r |
192f6d4c | 837 | \r |
192f6d4c | 838 | \r |
1cc76977 | 839 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
840 | @param FileHandle Pointer to the FFS file header of the image.\r | |
341a658f | 841 | @param PeimState The dispatch state of the input PEIM handle.\r |
1cc76977 | 842 | @param EntryPoint Pointer to entry point of specified image file for output.\r |
843 | @param AuthenticationState Pointer to attestation authentication state of image.\r | |
192f6d4c | 844 | \r |
1cc76977 | 845 | @retval EFI_SUCCESS Image is successfully loaded.\r |
846 | @retval EFI_NOT_FOUND Fail to locate necessary PPI\r | |
847 | @retval Others Fail to load file.\r | |
192f6d4c | 848 | \r |
b1f6a7c6 | 849 | **/\r |
192f6d4c | 850 | EFI_STATUS\r |
851 | PeiLoadImage (\r | |
6c7a807a | 852 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
b0d803fe | 853 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
341a658f | 854 | IN UINT8 PeimState,\r |
b0d803fe | 855 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r |
856 | OUT UINT32 *AuthenticationState\r | |
ed66e1bc | 857 | );\r |
192f6d4c | 858 | \r |
b1f6a7c6 | 859 | /**\r |
192f6d4c | 860 | \r |
b1f6a7c6 | 861 | Core version of the Status Code reporter\r |
192f6d4c | 862 | \r |
192f6d4c | 863 | \r |
1cc76977 | 864 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
865 | @param CodeType Type of Status Code.\r | |
866 | @param Value Value to output for Status Code.\r | |
867 | @param Instance Instance Number of this status code.\r | |
868 | @param CallerId ID of the caller of this status code.\r | |
869 | @param Data Optional data associated with this status code.\r | |
192f6d4c | 870 | \r |
b1f6a7c6 | 871 | @retval EFI_SUCCESS if status code is successfully reported\r |
872 | @retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed\r | |
192f6d4c | 873 | \r |
b1f6a7c6 | 874 | **/\r |
192f6d4c | 875 | EFI_STATUS\r |
876 | EFIAPI\r | |
877 | PeiReportStatusCode (\r | |
0c2b5da8 | 878 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
192f6d4c | 879 | IN EFI_STATUS_CODE_TYPE CodeType,\r |
880 | IN EFI_STATUS_CODE_VALUE Value,\r | |
881 | IN UINT32 Instance,\r | |
0c2b5da8 | 882 | IN CONST EFI_GUID *CallerId,\r |
883 | IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
ed66e1bc | 884 | );\r |
192f6d4c | 885 | \r |
b1f6a7c6 | 886 | /**\r |
192f6d4c | 887 | \r |
b1f6a7c6 | 888 | Core version of the Reset System\r |
192f6d4c | 889 | \r |
192f6d4c | 890 | \r |
1cc76977 | 891 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
192f6d4c | 892 | \r |
b1f6a7c6 | 893 | @retval EFI_NOT_AVAILABLE_YET PPI not available yet.\r |
894 | @retval EFI_DEVICE_ERROR Did not reset system.\r | |
895 | Otherwise, resets the system.\r | |
192f6d4c | 896 | \r |
b1f6a7c6 | 897 | **/\r |
192f6d4c | 898 | EFI_STATUS\r |
899 | EFIAPI\r | |
900 | PeiResetSystem (\r | |
b0d803fe | 901 | IN CONST EFI_PEI_SERVICES **PeiServices\r |
ed66e1bc | 902 | );\r |
192f6d4c | 903 | \r |
b1f6a7c6 | 904 | /**\r |
192f6d4c | 905 | \r |
b1f6a7c6 | 906 | Initialize PeiCore Fv List.\r |
192f6d4c | 907 | \r |
192f6d4c | 908 | \r |
b1f6a7c6 | 909 | @param PrivateData - Pointer to PEI_CORE_INSTANCE.\r |
910 | @param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.\r | |
192f6d4c | 911 | \r |
b1f6a7c6 | 912 | **/\r |
50cb16d9 | 913 | VOID\r |
b0d803fe | 914 | PeiInitializeFv (\r |
915 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
916 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r | |
ed66e1bc | 917 | );\r |
b0d803fe | 918 | \r |
b1f6a7c6 | 919 | /**\r |
920 | Process Firmware Volum Information once FvInfoPPI install.\r | |
b0d803fe | 921 | \r |
1cc76977 | 922 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
923 | @param NotifyDescriptor Address of the notification descriptor data structure.\r | |
924 | @param Ppi Address of the PPI that was installed.\r | |
50cb16d9 | 925 | \r |
b1f6a7c6 | 926 | @retval EFI_SUCCESS if the interface could be successfully installed\r |
b0d803fe | 927 | \r |
b1f6a7c6 | 928 | **/\r |
b0d803fe | 929 | EFI_STATUS\r |
930 | EFIAPI\r | |
931 | FirmwareVolmeInfoPpiNotifyCallback (\r | |
932 | IN EFI_PEI_SERVICES **PeiServices,\r | |
933 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r | |
934 | IN VOID *Ppi\r | |
ed66e1bc | 935 | );\r |
b0d803fe | 936 | \r |
b1f6a7c6 | 937 | /**\r |
50cb16d9 | 938 | \r |
b1f6a7c6 | 939 | Given the input VolumeHandle, search for the next matching name file.\r |
b0d803fe | 940 | \r |
1cc76977 | 941 | @param FileName File name to search.\r |
942 | @param VolumeHandle The current FV to search.\r | |
943 | @param FileHandle Pointer to the file matching name in VolumeHandle.\r | |
944 | NULL if file not found\r | |
b0d803fe | 945 | \r |
15273993 | 946 | @retval EFI_NOT_FOUND No files matching the search criteria were found\r |
947 | @retval EFI_SUCCESS Success to search given file\r | |
b0d803fe | 948 | \r |
b1f6a7c6 | 949 | **/\r |
b0d803fe | 950 | EFI_STATUS\r |
50cb16d9 | 951 | EFIAPI\r |
b0d803fe | 952 | PeiFfsFindFileByName (\r |
953 | IN CONST EFI_GUID *FileName,\r | |
954 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
955 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r | |
ed66e1bc | 956 | );\r |
b0d803fe | 957 | \r |
b1f6a7c6 | 958 | /**\r |
b1f6a7c6 | 959 | Returns information about a specific file.\r |
b0d803fe | 960 | \r |
3b428ade | 961 | @param FileHandle Handle of the file.\r |
aa75dfec | 962 | @param FileInfo Upon exit, points to the file's information.\r |
b0d803fe | 963 | \r |
3b428ade | 964 | @retval EFI_INVALID_PARAMETER If FileInfo is NULL.\r |
965 | @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.\r | |
966 | @retval EFI_SUCCESS File information returned.\r | |
b0d803fe | 967 | \r |
b1f6a7c6 | 968 | **/\r |
b0d803fe | 969 | EFI_STATUS\r |
50cb16d9 | 970 | EFIAPI\r |
b0d803fe | 971 | PeiFfsGetFileInfo (\r |
972 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
973 | OUT EFI_FV_FILE_INFO *FileInfo\r | |
ed66e1bc | 974 | );\r |
b0d803fe | 975 | \r |
b1f6a7c6 | 976 | /**\r |
3b428ade | 977 | Returns information about the specified volume.\r |
b0d803fe | 978 | \r |
3b428ade | 979 | @param VolumeHandle Handle of the volume.\r |
aa75dfec | 980 | @param VolumeInfo Upon exit, points to the volume's information.\r |
b0d803fe | 981 | \r |
3b428ade | 982 | @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.\r |
983 | @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.\r | |
984 | @retval EFI_SUCCESS Volume information returned.\r | |
b1f6a7c6 | 985 | **/\r |
b0d803fe | 986 | EFI_STATUS\r |
50cb16d9 | 987 | EFIAPI\r |
b0d803fe | 988 | PeiFfsGetVolumeInfo (\r |
989 | IN EFI_PEI_FV_HANDLE VolumeHandle,\r | |
990 | OUT EFI_FV_INFO *VolumeInfo\r | |
ed66e1bc | 991 | );\r |
b0d803fe | 992 | \r |
14e8823a | 993 | /**\r |
994 | This routine enable a PEIM to register itself to shadow when PEI Foundation\r | |
995 | discovery permanent memory.\r | |
996 | \r | |
b1f6a7c6 | 997 | @param FileHandle File handle of a PEIM.\r |
50cb16d9 | 998 | \r |
b1f6a7c6 | 999 | @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r |
1000 | @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r | |
1001 | @retval EFI_SUCCESS Successfully to register itself.\r | |
14e8823a | 1002 | \r |
50cb16d9 | 1003 | **/\r |
14e8823a | 1004 | EFI_STATUS\r |
1005 | EFIAPI\r | |
1006 | PeiRegisterForShadow (\r | |
1007 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
ed66e1bc | 1008 | );\r |
14e8823a | 1009 | \r |
b1f6a7c6 | 1010 | /**\r |
15273993 | 1011 | Initialize image service that install PeiLoadFilePpi.\r |
b0d803fe | 1012 | \r |
15273993 | 1013 | @param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.\r |
1014 | @param OldCoreData Pointer to Old PeiCore's private data.\r | |
1015 | If NULL, PeiCore is entered at first time, stack/heap in temporary memory.\r | |
1016 | If not NULL, PeiCore is entered at second time, stack/heap has been moved\r | |
1017 | to permenent memory.\r | |
b0d803fe | 1018 | \r |
b1f6a7c6 | 1019 | **/\r |
1020 | VOID\r | |
1021 | InitializeImageServices (\r | |
1022 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
1023 | IN PEI_CORE_INSTANCE *OldCoreData\r | |
ed66e1bc | 1024 | );\r |
b0d803fe | 1025 | \r |
aa79b0b3 | 1026 | /**\r |
1027 | The wrapper function of PeiLoadImageLoadImage().\r | |
1028 | \r | |
f34aec3b | 1029 | @param This Pointer to EFI_PEI_LOAD_FILE_PPI.\r |
1030 | @param FileHandle Pointer to the FFS file header of the image.\r | |
1031 | @param ImageAddressArg Pointer to PE/TE image.\r | |
1032 | @param ImageSizeArg Size of PE/TE image.\r | |
1033 | @param EntryPoint Pointer to entry point of specified image file for output.\r | |
1034 | @param AuthenticationState Pointer to attestation authentication state of image.\r | |
aa79b0b3 | 1035 | \r |
1036 | @return Status of PeiLoadImageLoadImage().\r | |
1037 | \r | |
1038 | **/\r | |
1039 | EFI_STATUS\r | |
1040 | EFIAPI\r | |
1041 | PeiLoadImageLoadImageWrapper (\r | |
1042 | IN CONST EFI_PEI_LOAD_FILE_PPI *This,\r | |
1043 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
1044 | OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg, OPTIONAL\r | |
1045 | OUT UINT64 *ImageSizeArg, OPTIONAL\r | |
1046 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint,\r | |
1047 | OUT UINT32 *AuthenticationState\r | |
1048 | );\r | |
1049 | \r | |
1050 | /**\r | |
1051 | \r | |
1052 | Provide a callback for when the security PPI is installed.\r | |
1053 | \r | |
1054 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
1055 | @param NotifyDescriptor The descriptor for the notification event.\r | |
1056 | @param Ppi Pointer to the PPI in question.\r | |
1057 | \r | |
1058 | @return Always success\r | |
1059 | \r | |
1060 | **/\r | |
1061 | EFI_STATUS\r | |
1062 | EFIAPI\r | |
1063 | SecurityPpiNotifyCallback (\r | |
1064 | IN EFI_PEI_SERVICES **PeiServices,\r | |
1065 | IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r | |
1066 | IN VOID *Ppi\r | |
1067 | );\r | |
1068 | \r | |
3b428ade | 1069 | /**\r |
1070 | Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r | |
1071 | \r | |
1072 | @param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.\r | |
1073 | @param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.\r | |
1074 | \r | |
1075 | @retval EFI_NOT_FOUND FV image can't be found.\r | |
1076 | @retval EFI_SUCCESS Successfully to process it.\r | |
1077 | @retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image\r | |
1078 | @retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section\r | |
1079 | \r | |
1080 | **/\r | |
1081 | EFI_STATUS\r | |
1082 | ProcessFvFile (\r | |
1083 | IN PEI_CORE_FV_HANDLE *ParentFvCoreHandle,\r | |
1084 | IN EFI_PEI_FILE_HANDLE ParentFvFileHandle\r | |
1085 | );\r | |
1086 | \r | |
1087 | /**\r | |
1088 | Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.\r | |
1089 | \r | |
1090 | This routine also will install FvInfo ppi for FV hob in PI ways.\r | |
1091 | \r | |
1092 | @param Private Pointer of PEI_CORE_INSTANCE\r | |
1093 | @param Instance The index of FV want to be searched.\r | |
1094 | \r | |
1095 | @return Instance of PEI_CORE_FV_HANDLE.\r | |
1096 | **/\r | |
1097 | PEI_CORE_FV_HANDLE *\r | |
1098 | FindNextCoreFvHandle (\r | |
1099 | IN PEI_CORE_INSTANCE *Private,\r | |
1100 | IN UINTN Instance\r | |
1101 | );\r | |
1102 | \r | |
8d415937 | 1103 | //\r |
1104 | // Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r | |
1105 | // \r | |
1106 | \r | |
1107 | /**\r | |
1108 | Memory-based read services.\r | |
1109 | \r | |
1110 | This function is to perform the Memory Access Read service based on installed \r | |
1111 | instance of the EFI_PEI_CPU_IO_PPI. \r | |
1112 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1113 | return EFI_NOT_YET_AVAILABLE. \r | |
1114 | \r | |
1115 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1116 | published by the PEI Foundation.\r | |
1117 | @param This Pointer to local data for the interface.\r | |
1118 | @param Width The width of the access. Enumerated in bytes.\r | |
1119 | @param Address The physical address of the access.\r | |
1120 | @param Count The number of accesses to perform.\r | |
1121 | @param Buffer A pointer to the buffer of data.\r | |
1122 | \r | |
1123 | @retval EFI_SUCCESS The function completed successfully.\r | |
1124 | @retval EFI_NOT_YET_AVAILABLE The service has not been installed. \r | |
1125 | **/\r | |
1126 | EFI_STATUS\r | |
1127 | EFIAPI\r | |
1128 | PeiDefaultMemRead (\r | |
1129 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1130 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1131 | IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r | |
1132 | IN UINT64 Address,\r | |
1133 | IN UINTN Count,\r | |
1134 | IN OUT VOID *Buffer\r | |
1135 | );\r | |
1136 | \r | |
1137 | /**\r | |
1138 | Memory-based write services.\r | |
1139 | \r | |
1140 | This function is to perform the Memory Access Write service based on installed \r | |
1141 | instance of the EFI_PEI_CPU_IO_PPI. \r | |
1142 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1143 | return EFI_NOT_YET_AVAILABLE. \r | |
1144 | \r | |
1145 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1146 | published by the PEI Foundation.\r | |
1147 | @param This Pointer to local data for the interface.\r | |
1148 | @param Width The width of the access. Enumerated in bytes.\r | |
1149 | @param Address The physical address of the access.\r | |
1150 | @param Count The number of accesses to perform.\r | |
1151 | @param Buffer A pointer to the buffer of data.\r | |
1152 | \r | |
1153 | @retval EFI_SUCCESS The function completed successfully.\r | |
1154 | @retval EFI_NOT_YET_AVAILABLE The service has not been installed. \r | |
1155 | **/\r | |
1156 | EFI_STATUS\r | |
1157 | EFIAPI\r | |
1158 | PeiDefaultMemWrite (\r | |
1159 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1160 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1161 | IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r | |
1162 | IN UINT64 Address,\r | |
1163 | IN UINTN Count,\r | |
1164 | IN OUT VOID *Buffer\r | |
1165 | );\r | |
1166 | \r | |
1167 | /**\r | |
1168 | IO-based read services.\r | |
1169 | \r | |
1170 | This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.\r | |
1171 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1172 | return EFI_NOT_YET_AVAILABLE. \r | |
1173 | \r | |
1174 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1175 | published by the PEI Foundation.\r | |
1176 | @param This Pointer to local data for the interface.\r | |
1177 | @param Width The width of the access. Enumerated in bytes.\r | |
1178 | @param Address The physical address of the access.\r | |
1179 | @param Count The number of accesses to perform.\r | |
1180 | @param Buffer A pointer to the buffer of data.\r | |
1181 | \r | |
1182 | @retval EFI_SUCCESS The function completed successfully.\r | |
1183 | @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r | |
1184 | **/\r | |
1185 | EFI_STATUS\r | |
1186 | EFIAPI\r | |
1187 | PeiDefaultIoRead (\r | |
1188 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1189 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1190 | IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r | |
1191 | IN UINT64 Address,\r | |
1192 | IN UINTN Count,\r | |
1193 | IN OUT VOID *Buffer\r | |
1194 | );\r | |
1195 | \r | |
1196 | /**\r | |
1197 | IO-based write services.\r | |
1198 | \r | |
1199 | This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.\r | |
1200 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1201 | return EFI_NOT_YET_AVAILABLE. \r | |
1202 | \r | |
1203 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1204 | published by the PEI Foundation.\r | |
1205 | @param This Pointer to local data for the interface.\r | |
1206 | @param Width The width of the access. Enumerated in bytes.\r | |
1207 | @param Address The physical address of the access.\r | |
1208 | @param Count The number of accesses to perform.\r | |
1209 | @param Buffer A pointer to the buffer of data.\r | |
1210 | \r | |
1211 | @retval EFI_SUCCESS The function completed successfully.\r | |
1212 | @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r | |
1213 | **/\r | |
1214 | EFI_STATUS\r | |
1215 | EFIAPI\r | |
1216 | PeiDefaultIoWrite (\r | |
1217 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1218 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1219 | IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r | |
1220 | IN UINT64 Address,\r | |
1221 | IN UINTN Count,\r | |
1222 | IN OUT VOID *Buffer\r | |
1223 | );\r | |
1224 | \r | |
1225 | /**\r | |
1226 | 8-bit I/O read operations.\r | |
1227 | \r | |
1228 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1229 | return 0.\r | |
1230 | \r | |
1231 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1232 | @param This Pointer to local data for the interface.\r | |
1233 | @param Address The physical address of the access.\r | |
1234 | \r | |
1235 | @return An 8-bit value returned from the I/O space.\r | |
1236 | **/\r | |
1237 | UINT8\r | |
1238 | EFIAPI\r | |
1239 | PeiDefaultIoRead8 (\r | |
1240 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1241 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1242 | IN UINT64 Address\r | |
1243 | );\r | |
1244 | \r | |
1245 | /**\r | |
1246 | Reads an 16-bit I/O port.\r | |
1247 | \r | |
1248 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1249 | return 0.\r | |
1250 | \r | |
1251 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1252 | @param This Pointer to local data for the interface.\r | |
1253 | @param Address The physical address of the access.\r | |
1254 | \r | |
1255 | @return A 16-bit value returned from the I/O space.\r | |
1256 | **/\r | |
1257 | UINT16\r | |
1258 | EFIAPI\r | |
1259 | PeiDefaultIoRead16 (\r | |
1260 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1261 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1262 | IN UINT64 Address\r | |
1263 | );\r | |
1264 | \r | |
1265 | /**\r | |
1266 | Reads an 32-bit I/O port.\r | |
1267 | \r | |
1268 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1269 | return 0.\r | |
1270 | \r | |
1271 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1272 | @param This Pointer to local data for the interface.\r | |
1273 | @param Address The physical address of the access.\r | |
1274 | \r | |
1275 | @return A 32-bit value returned from the I/O space.\r | |
1276 | **/\r | |
1277 | UINT32\r | |
1278 | EFIAPI\r | |
1279 | PeiDefaultIoRead32 (\r | |
1280 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1281 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1282 | IN UINT64 Address\r | |
1283 | );\r | |
1284 | \r | |
1285 | /**\r | |
1286 | Reads an 64-bit I/O port.\r | |
1287 | \r | |
1288 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1289 | return 0.\r | |
1290 | \r | |
1291 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1292 | @param This Pointer to local data for the interface.\r | |
1293 | @param Address The physical address of the access.\r | |
1294 | \r | |
1295 | @return A 64-bit value returned from the I/O space.\r | |
1296 | **/\r | |
1297 | UINT64\r | |
1298 | EFIAPI\r | |
1299 | PeiDefaultIoRead64 (\r | |
1300 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1301 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1302 | IN UINT64 Address\r | |
1303 | );\r | |
1304 | \r | |
1305 | /**\r | |
1306 | 8-bit I/O write operations.\r | |
1307 | \r | |
1308 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1309 | @param This Pointer to local data for the interface.\r | |
1310 | @param Address The physical address of the access.\r | |
1311 | @param Data The data to write.\r | |
1312 | **/\r | |
1313 | VOID\r | |
1314 | EFIAPI\r | |
1315 | PeiDefaultIoWrite8 (\r | |
1316 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1317 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1318 | IN UINT64 Address,\r | |
1319 | IN UINT8 Data\r | |
1320 | );\r | |
1321 | \r | |
1322 | /**\r | |
1323 | 16-bit I/O write operations.\r | |
1324 | \r | |
1325 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1326 | @param This Pointer to local data for the interface.\r | |
1327 | @param Address The physical address of the access.\r | |
1328 | @param Data The data to write.\r | |
1329 | **/\r | |
1330 | VOID\r | |
1331 | EFIAPI\r | |
1332 | PeiDefaultIoWrite16 (\r | |
1333 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1334 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1335 | IN UINT64 Address,\r | |
1336 | IN UINT16 Data\r | |
1337 | );\r | |
1338 | \r | |
1339 | /**\r | |
1340 | 32-bit I/O write operations.\r | |
1341 | \r | |
1342 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1343 | @param This Pointer to local data for the interface.\r | |
1344 | @param Address The physical address of the access.\r | |
1345 | @param Data The data to write.\r | |
1346 | **/\r | |
1347 | VOID\r | |
1348 | EFIAPI\r | |
1349 | PeiDefaultIoWrite32 (\r | |
1350 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1351 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1352 | IN UINT64 Address,\r | |
1353 | IN UINT32 Data\r | |
1354 | );\r | |
1355 | \r | |
1356 | /**\r | |
1357 | 64-bit I/O write operations.\r | |
1358 | \r | |
1359 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1360 | @param This Pointer to local data for the interface.\r | |
1361 | @param Address The physical address of the access.\r | |
1362 | @param Data The data to write.\r | |
1363 | **/\r | |
1364 | VOID\r | |
1365 | EFIAPI\r | |
1366 | PeiDefaultIoWrite64 (\r | |
1367 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1368 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1369 | IN UINT64 Address,\r | |
1370 | IN UINT64 Data\r | |
1371 | );\r | |
1372 | \r | |
1373 | /**\r | |
1374 | 8-bit memory read operations.\r | |
1375 | \r | |
1376 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1377 | return 0.\r | |
1378 | \r | |
1379 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1380 | @param This Pointer to local data for the interface.\r | |
1381 | @param Address The physical address of the access.\r | |
1382 | \r | |
1383 | @return An 8-bit value returned from the memory space.\r | |
1384 | \r | |
1385 | **/\r | |
1386 | UINT8\r | |
1387 | EFIAPI\r | |
1388 | PeiDefaultMemRead8 (\r | |
1389 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1390 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1391 | IN UINT64 Address\r | |
1392 | );\r | |
1393 | \r | |
1394 | /**\r | |
1395 | 16-bit memory read operations.\r | |
1396 | \r | |
1397 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1398 | return 0.\r | |
1399 | \r | |
1400 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1401 | @param This Pointer to local data for the interface.\r | |
1402 | @param Address The physical address of the access.\r | |
1403 | \r | |
1404 | @return An 16-bit value returned from the memory space.\r | |
1405 | \r | |
1406 | **/\r | |
1407 | UINT16\r | |
1408 | EFIAPI\r | |
1409 | PeiDefaultMemRead16 (\r | |
1410 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1411 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1412 | IN UINT64 Address\r | |
1413 | );\r | |
1414 | \r | |
1415 | /**\r | |
1416 | 32-bit memory read operations.\r | |
1417 | \r | |
1418 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1419 | return 0.\r | |
1420 | \r | |
1421 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1422 | @param This Pointer to local data for the interface.\r | |
1423 | @param Address The physical address of the access.\r | |
1424 | \r | |
1425 | @return An 32-bit value returned from the memory space.\r | |
1426 | \r | |
1427 | **/\r | |
1428 | UINT32\r | |
1429 | EFIAPI\r | |
1430 | PeiDefaultMemRead32 (\r | |
1431 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1432 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1433 | IN UINT64 Address\r | |
1434 | );\r | |
1435 | \r | |
1436 | /**\r | |
1437 | 64-bit memory read operations.\r | |
1438 | \r | |
1439 | If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then \r | |
1440 | return 0.\r | |
1441 | \r | |
1442 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1443 | @param This Pointer to local data for the interface.\r | |
1444 | @param Address The physical address of the access.\r | |
1445 | \r | |
1446 | @return An 64-bit value returned from the memory space.\r | |
1447 | \r | |
1448 | **/\r | |
1449 | UINT64\r | |
1450 | EFIAPI\r | |
1451 | PeiDefaultMemRead64 (\r | |
1452 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1453 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1454 | IN UINT64 Address\r | |
1455 | );\r | |
1456 | \r | |
1457 | /**\r | |
1458 | 8-bit memory write operations.\r | |
1459 | \r | |
1460 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1461 | @param This Pointer to local data for the interface.\r | |
1462 | @param Address The physical address of the access.\r | |
1463 | @param Data The data to write.\r | |
1464 | \r | |
1465 | **/\r | |
1466 | VOID\r | |
1467 | EFIAPI\r | |
1468 | PeiDefaultMemWrite8 (\r | |
1469 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1470 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1471 | IN UINT64 Address,\r | |
1472 | IN UINT8 Data\r | |
1473 | );\r | |
1474 | \r | |
1475 | /**\r | |
1476 | 16-bit memory write operations.\r | |
1477 | \r | |
1478 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1479 | @param This Pointer to local data for the interface.\r | |
1480 | @param Address The physical address of the access.\r | |
1481 | @param Data The data to write.\r | |
1482 | \r | |
1483 | **/\r | |
1484 | VOID\r | |
1485 | EFIAPI\r | |
1486 | PeiDefaultMemWrite16 (\r | |
1487 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1488 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1489 | IN UINT64 Address,\r | |
1490 | IN UINT16 Data\r | |
1491 | );\r | |
1492 | \r | |
1493 | /**\r | |
1494 | 32-bit memory write operations.\r | |
1495 | \r | |
1496 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1497 | @param This Pointer to local data for the interface.\r | |
1498 | @param Address The physical address of the access.\r | |
1499 | @param Data The data to write.\r | |
1500 | \r | |
1501 | **/\r | |
1502 | VOID\r | |
1503 | EFIAPI\r | |
1504 | PeiDefaultMemWrite32 (\r | |
1505 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1506 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1507 | IN UINT64 Address,\r | |
1508 | IN UINT32 Data\r | |
1509 | );\r | |
1510 | \r | |
1511 | /**\r | |
1512 | 64-bit memory write operations.\r | |
1513 | \r | |
1514 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1515 | @param This Pointer to local data for the interface.\r | |
1516 | @param Address The physical address of the access.\r | |
1517 | @param Data The data to write.\r | |
1518 | \r | |
1519 | **/\r | |
1520 | VOID\r | |
1521 | EFIAPI\r | |
1522 | PeiDefaultMemWrite64 (\r | |
1523 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1524 | IN CONST EFI_PEI_CPU_IO_PPI *This,\r | |
1525 | IN UINT64 Address,\r | |
1526 | IN UINT64 Data\r | |
1527 | );\r | |
1528 | \r | |
1529 | extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi; \r | |
1530 | \r | |
1531 | //\r | |
1532 | // Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.\r | |
1533 | // \r | |
1534 | \r | |
1535 | /**\r | |
1536 | Reads from a given location in the PCI configuration space.\r | |
1537 | \r | |
1538 | If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then \r | |
1539 | return EFI_NOT_YET_AVAILABLE. \r | |
1540 | \r | |
1541 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1542 | @param This Pointer to local data for the interface.\r | |
1543 | @param Width The width of the access. Enumerated in bytes.\r | |
1544 | See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r | |
1545 | @param Address The physical address of the access. The format of\r | |
1546 | the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r | |
1547 | @param Buffer A pointer to the buffer of data.\r | |
1548 | \r | |
1549 | @retval EFI_SUCCESS The function completed successfully.\r | |
1550 | @retval EFI_INVALID_PARAMETER The invalid access width.\r | |
1551 | @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r | |
1552 | \r | |
1553 | **/\r | |
1554 | EFI_STATUS\r | |
1555 | EFIAPI\r | |
1556 | PeiDefaultPciCfg2Read (\r | |
1557 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1558 | IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r | |
1559 | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r | |
1560 | IN UINT64 Address,\r | |
1561 | IN OUT VOID *Buffer\r | |
1562 | );\r | |
1563 | \r | |
1564 | /**\r | |
1565 | Write to a given location in the PCI configuration space.\r | |
1566 | \r | |
1567 | If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then \r | |
1568 | return EFI_NOT_YET_AVAILABLE. \r | |
1569 | \r | |
1570 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
1571 | @param This Pointer to local data for the interface.\r | |
1572 | @param Width The width of the access. Enumerated in bytes.\r | |
1573 | See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r | |
1574 | @param Address The physical address of the access. The format of\r | |
1575 | the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r | |
1576 | @param Buffer A pointer to the buffer of data.\r | |
1577 | \r | |
1578 | @retval EFI_SUCCESS The function completed successfully.\r | |
1579 | @retval EFI_INVALID_PARAMETER The invalid access width.\r | |
1580 | @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r | |
1581 | **/\r | |
1582 | EFI_STATUS\r | |
1583 | EFIAPI\r | |
1584 | PeiDefaultPciCfg2Write (\r | |
1585 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1586 | IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r | |
1587 | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r | |
1588 | IN UINT64 Address,\r | |
1589 | IN OUT VOID *Buffer\r | |
1590 | );\r | |
1591 | \r | |
1592 | /**\r | |
1593 | This function performs a read-modify-write operation on the contents from a given\r | |
1594 | location in the PCI configuration space.\r | |
1595 | \r | |
1596 | @param PeiServices An indirect pointer to the PEI Services Table\r | |
1597 | published by the PEI Foundation.\r | |
1598 | @param This Pointer to local data for the interface.\r | |
1599 | @param Width The width of the access. Enumerated in bytes. Type\r | |
1600 | EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r | |
1601 | @param Address The physical address of the access.\r | |
1602 | @param SetBits Points to value to bitwise-OR with the read configuration value.\r | |
1603 | The size of the value is determined by Width.\r | |
1604 | @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r | |
1605 | The size of the value is determined by Width.\r | |
1606 | \r | |
1607 | @retval EFI_SUCCESS The function completed successfully.\r | |
1608 | @retval EFI_INVALID_PARAMETER The invalid access width.\r | |
1609 | @retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.\r | |
1610 | **/\r | |
1611 | EFI_STATUS\r | |
1612 | EFIAPI\r | |
1613 | PeiDefaultPciCfg2Modify (\r | |
1614 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
1615 | IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r | |
1616 | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r | |
1617 | IN UINT64 Address,\r | |
1618 | IN VOID *SetBits,\r | |
1619 | IN VOID *ClearBits\r | |
1620 | ); \r | |
1621 | \r | |
1622 | extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi;\r | |
1623 | \r | |
8e0e40ed | 1624 | /**\r |
1625 | After PeiCore image is shadowed into permanent memory, all build-in FvPpi should\r | |
1626 | be re-installed with the instance in permanent memory and all cached FvPpi pointers in \r | |
1627 | PrivateData->Fv[] array should be fixed up to be pointed to the one in permenant\r | |
1628 | memory.\r | |
1629 | \r | |
1630 | @param PrivateData Pointer to PEI_CORE_INSTANCE.\r | |
1631 | **/ \r | |
1632 | VOID\r | |
1633 | PeiReinitializeFv (\r | |
1634 | IN PEI_CORE_INSTANCE *PrivateData\r | |
1635 | );\r | |
1636 | \r | |
192f6d4c | 1637 | #endif\r |