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