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