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