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