]>
Commit | Line | Data |
---|---|---|
615c6dd0 | 1 | /** @file\r |
b1f6a7c6 | 2 | EFI PEI Core dispatch services\r |
3 | \r | |
f4391d63 | 4 | Copyright (c) 2006 - 2010, Intel Corporation\r |
192f6d4c | 5 | All rights reserved. This program and the accompanying materials\r |
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 |
0d516397 | 15 | #include "PeiMain.h"\r |
192f6d4c | 16 | \r |
b1f6a7c6 | 17 | ///\r |
3d4d0c34 | 18 | /// temporary memory is filled with this initial value during SEC phase\r |
b1f6a7c6 | 19 | ///\r |
a7715e73 | 20 | #define INIT_CAR_VALUE 0x5AA55AA5\r |
21 | \r | |
797a9d67 | 22 | typedef struct {\r |
23 | EFI_STATUS_CODE_DATA DataHeader;\r | |
24 | EFI_HANDLE Handle;\r | |
25 | } PEIM_FILE_HANDLE_EXTENDED_DATA;\r | |
26 | \r | |
b1f6a7c6 | 27 | /**\r |
b0d803fe | 28 | \r |
29 | Discover all Peims and optional Apriori file in one FV. There is at most one\r | |
30 | Apriori file in one FV.\r | |
31 | \r | |
b0d803fe | 32 | \r |
3b428ade | 33 | @param Private Pointer to the private data passed in from caller\r |
34 | @param CoreFileHandle The instance of PEI_CORE_FV_HANDLE.\r | |
b0d803fe | 35 | \r |
b1f6a7c6 | 36 | **/\r |
37 | VOID\r | |
38 | DiscoverPeimsAndOrderWithApriori (\r | |
39 | IN PEI_CORE_INSTANCE *Private,\r | |
3b428ade | 40 | IN PEI_CORE_FV_HANDLE *CoreFileHandle\r |
b1f6a7c6 | 41 | )\r |
b0d803fe | 42 | {\r |
43 | EFI_STATUS Status;\r | |
44 | EFI_PEI_FV_HANDLE FileHandle;\r | |
177aabe6 | 45 | EFI_PEI_FILE_HANDLE AprioriFileHandle;\r |
b0d803fe | 46 | EFI_GUID *Apriori;\r |
47 | UINTN Index;\r | |
48 | UINTN Index2;\r | |
49 | UINTN PeimIndex;\r | |
50 | UINTN PeimCount;\r | |
51 | EFI_GUID *Guid;\r | |
177aabe6 | 52 | EFI_PEI_FV_HANDLE TempFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r |
53 | EFI_GUID FileGuid[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];\r | |
3b428ade | 54 | EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;\r |
55 | EFI_FV_FILE_INFO FileInfo;\r | |
56 | \r | |
57 | FvPpi = CoreFileHandle->FvPpi;\r | |
58 | \r | |
b0d803fe | 59 | //\r |
60 | // Walk the FV and find all the PEIMs and the Apriori file.\r | |
61 | //\r | |
62 | AprioriFileHandle = NULL;\r | |
63 | Private->CurrentFvFileHandles[0] = NULL;\r | |
64 | Guid = NULL;\r | |
65 | FileHandle = NULL;\r | |
66 | \r | |
67 | //\r | |
68 | // If the current Fv has been scanned, directly get its cachable record.\r | |
69 | //\r | |
70 | if (Private->Fv[Private->CurrentPeimFvCount].ScanFv) {\r | |
71 | CopyMem (Private->CurrentFvFileHandles, Private->Fv[Private->CurrentPeimFvCount].FvFileHandles, sizeof (Private->CurrentFvFileHandles));\r | |
72 | return;\r | |
73 | }\r | |
74 | \r | |
75 | //\r | |
76 | // Go ahead to scan this Fv, and cache FileHandles within it.\r | |
77 | //\r | |
188e4e84 | 78 | for (PeimCount = 0; PeimCount < PcdGet32 (PcdPeiCoreMaxPeimPerFv); PeimCount++) {\r |
3b428ade | 79 | Status = FvPpi->FindFileByType (FvPpi, PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE, CoreFileHandle->FvHandle, &FileHandle);\r |
b0d803fe | 80 | if (Status != EFI_SUCCESS) {\r |
81 | break;\r | |
82 | }\r | |
58dcdada | 83 | \r |
b0d803fe | 84 | Private->CurrentFvFileHandles[PeimCount] = FileHandle;\r |
85 | }\r | |
97b2c9b5 LG |
86 | \r |
87 | //\r | |
88 | // Check whether the count of Peims exceeds the max support PEIMs in a FV image\r | |
89 | // If more Peims are required in a FV image, PcdPeiCoreMaxPeimPerFv can be set to a larger value in DSC file.\r | |
90 | //\r | |
188e4e84 | 91 | ASSERT (PeimCount < PcdGet32 (PcdPeiCoreMaxPeimPerFv));\r |
b0d803fe | 92 | \r |
3b428ade | 93 | //\r |
94 | // Get Apriori File handle\r | |
95 | //\r | |
58dcdada | 96 | Private->AprioriCount = 0;\r |
3b428ade | 97 | Status = FvPpi->FindFileByName (FvPpi, &gPeiAprioriFileNameGuid, &CoreFileHandle->FvHandle, &AprioriFileHandle);\r |
98 | if (!EFI_ERROR(Status) && AprioriFileHandle != NULL) {\r | |
b0d803fe | 99 | //\r |
100 | // Read the Apriori file\r | |
101 | //\r | |
3b428ade | 102 | Status = FvPpi->FindSectionByType (FvPpi, EFI_SECTION_RAW, AprioriFileHandle, (VOID **) &Apriori);\r |
b0d803fe | 103 | if (!EFI_ERROR (Status)) {\r |
104 | //\r | |
105 | // Calculate the number of PEIMs in the A Priori list\r | |
106 | //\r | |
3b428ade | 107 | Status = FvPpi->GetFileInfo (FvPpi, AprioriFileHandle, &FileInfo);\r |
108 | ASSERT_EFI_ERROR (Status);\r | |
109 | Private->AprioriCount = FileInfo.BufferSize & 0x00FFFFFF;\r | |
595d4b4c | 110 | Private->AprioriCount -= sizeof (EFI_COMMON_SECTION_HEADER);\r |
b0d803fe | 111 | Private->AprioriCount /= sizeof (EFI_GUID);\r |
58dcdada | 112 | \r |
82b8c8df | 113 | ZeroMem (FileGuid, sizeof (FileGuid));\r |
b0d803fe | 114 | for (Index = 0; Index < PeimCount; Index++) {\r |
115 | //\r | |
116 | // Make an array of file name guids that matches the FileHandle array so we can convert\r | |
117 | // quickly from file name to file handle\r | |
118 | //\r | |
3b428ade | 119 | Status = FvPpi->GetFileInfo (FvPpi, Private->CurrentFvFileHandles[Index], &FileInfo);\r |
120 | CopyMem (&FileGuid[Index], &FileInfo.FileName, sizeof(EFI_GUID));\r | |
b0d803fe | 121 | }\r |
122 | \r | |
123 | //\r | |
124 | // Walk through FileGuid array to find out who is invalid PEIM guid in Apriori file.\r | |
58dcdada | 125 | // Add avalible PEIMs in Apriori file into TempFileHandles array at first.\r |
b0d803fe | 126 | //\r |
127 | Index2 = 0;\r | |
128 | for (Index = 0; Index2 < Private->AprioriCount; Index++) {\r | |
129 | while (Index2 < Private->AprioriCount) {\r | |
130 | Guid = ScanGuid (FileGuid, PeimCount * sizeof (EFI_GUID), &Apriori[Index2++]);\r | |
131 | if (Guid != NULL) {\r | |
132 | break;\r | |
133 | }\r | |
134 | }\r | |
135 | if (Guid == NULL) {\r | |
58dcdada | 136 | break;\r |
b0d803fe | 137 | }\r |
138 | PeimIndex = ((UINTN)Guid - (UINTN)&FileGuid[0])/sizeof (EFI_GUID);\r | |
139 | TempFileHandles[Index] = Private->CurrentFvFileHandles[PeimIndex];\r | |
140 | \r | |
141 | //\r | |
142 | // Since we have copied the file handle we can remove it from this list.\r | |
143 | //\r | |
144 | Private->CurrentFvFileHandles[PeimIndex] = NULL;\r | |
145 | }\r | |
146 | \r | |
147 | //\r | |
148 | // Update valid Aprioricount\r | |
149 | //\r | |
150 | Private->AprioriCount = Index;\r | |
58dcdada | 151 | \r |
b0d803fe | 152 | //\r |
153 | // Add in any PEIMs not in the Apriori file\r | |
154 | //\r | |
155 | for (;Index < PeimCount; Index++) {\r | |
156 | for (Index2 = 0; Index2 < PeimCount; Index2++) {\r | |
157 | if (Private->CurrentFvFileHandles[Index2] != NULL) {\r | |
158 | TempFileHandles[Index] = Private->CurrentFvFileHandles[Index2];\r | |
159 | Private->CurrentFvFileHandles[Index2] = NULL;\r | |
160 | break;\r | |
161 | }\r | |
162 | }\r | |
163 | }\r | |
164 | //\r | |
165 | //Index the end of array contains re-range Pei moudle.\r | |
166 | //\r | |
167 | TempFileHandles[Index] = NULL;\r | |
58dcdada | 168 | \r |
b0d803fe | 169 | //\r |
170 | // Private->CurrentFvFileHandles is currently in PEIM in the FV order.\r | |
58dcdada | 171 | // We need to update it to start with files in the A Priori list and\r |
172 | // then the remaining files in PEIM order.\r | |
b0d803fe | 173 | //\r |
174 | CopyMem (Private->CurrentFvFileHandles, TempFileHandles, sizeof (Private->CurrentFvFileHandles));\r | |
175 | }\r | |
176 | }\r | |
177 | //\r | |
178 | // Cache the current Fv File Handle. So that we don't have to scan the Fv again.\r | |
179 | // Instead, we can retrieve the file handles within this Fv from cachable data.\r | |
180 | //\r | |
181 | Private->Fv[Private->CurrentPeimFvCount].ScanFv = TRUE;\r | |
182 | CopyMem (Private->Fv[Private->CurrentPeimFvCount].FvFileHandles, Private->CurrentFvFileHandles, sizeof (Private->CurrentFvFileHandles));\r | |
58dcdada | 183 | \r |
184 | }\r | |
185 | \r | |
b1f6a7c6 | 186 | /**\r |
187 | Shadow PeiCore module from flash to installed memory.\r | |
188 | \r | |
d73d93c3 | 189 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r |
b1f6a7c6 | 190 | @param PrivateInMem PeiCore's private data structure\r |
191 | \r | |
82b8c8df | 192 | @return PeiCore function address after shadowing.\r |
b1f6a7c6 | 193 | **/\r |
58dcdada | 194 | VOID*\r |
195 | ShadowPeiCore(\r | |
6c7a807a | 196 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
197 | IN PEI_CORE_INSTANCE *PrivateInMem\r | |
58dcdada | 198 | )\r |
199 | {\r | |
200 | EFI_PEI_FILE_HANDLE PeiCoreFileHandle;\r | |
201 | EFI_PHYSICAL_ADDRESS EntryPoint;\r | |
202 | EFI_STATUS Status;\r | |
203 | UINT32 AuthenticationState;\r | |
204 | \r | |
205 | PeiCoreFileHandle = NULL;\r | |
206 | \r | |
207 | //\r | |
208 | // Find the PEI Core in the BFV\r | |
209 | //\r | |
3b428ade | 210 | Status = PrivateInMem->Fv[0].FvPpi->FindFileByType (\r |
211 | PrivateInMem->Fv[0].FvPpi,\r | |
212 | EFI_FV_FILETYPE_PEI_CORE,\r | |
213 | PrivateInMem->Fv[0].FvHandle,\r | |
214 | &PeiCoreFileHandle\r | |
215 | );\r | |
58dcdada | 216 | ASSERT_EFI_ERROR (Status);\r |
217 | \r | |
218 | //\r | |
219 | // Shadow PEI Core into memory so it will run faster\r | |
220 | //\r | |
221 | Status = PeiLoadImage (\r | |
222 | PeiServices,\r | |
223 | *((EFI_PEI_FILE_HANDLE*)&PeiCoreFileHandle),\r | |
341a658f | 224 | PEIM_STATE_REGISITER_FOR_SHADOW,\r |
58dcdada | 225 | &EntryPoint,\r |
226 | &AuthenticationState\r | |
227 | );\r | |
228 | ASSERT_EFI_ERROR (Status);\r | |
229 | \r | |
82b8c8df | 230 | //\r |
231 | // Compute the PeiCore's function address after shaowed PeiCore.\r | |
232 | // _ModuleEntryPoint is PeiCore main function entry\r | |
233 | //\r | |
58dcdada | 234 | return (VOID*) ((UINTN) EntryPoint + (UINTN) PeiCore - (UINTN) _ModuleEntryPoint);\r |
b0d803fe | 235 | }\r |
236 | \r | |
b1f6a7c6 | 237 | /**\r |
192f6d4c | 238 | Conduct PEIM dispatch.\r |
239 | \r | |
b1f6a7c6 | 240 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r |
5aae0aa7 | 241 | environment, such as the size and location of temporary RAM, the stack location and\r |
242 | the BFV location.\r | |
b1f6a7c6 | 243 | @param Private Pointer to the private data passed in from caller\r |
192f6d4c | 244 | \r |
b1f6a7c6 | 245 | **/\r |
246 | VOID\r | |
247 | PeiDispatcher (\r | |
248 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,\r | |
249 | IN PEI_CORE_INSTANCE *Private\r | |
250 | )\r | |
192f6d4c | 251 | {\r |
b0d803fe | 252 | EFI_STATUS Status;\r |
253 | UINT32 Index1;\r | |
254 | UINT32 Index2;\r | |
6c7a807a | 255 | CONST EFI_PEI_SERVICES **PeiServices;\r |
b0d803fe | 256 | EFI_PEI_FILE_HANDLE PeimFileHandle;\r |
257 | UINTN FvCount;\r | |
258 | UINTN PeimCount;\r | |
259 | UINT32 AuthenticationState;\r | |
260 | EFI_PHYSICAL_ADDRESS EntryPoint;\r | |
797a9d67 | 261 | EFI_PEIM_ENTRY_POINT2 PeimEntryPoint;\r |
b0d803fe | 262 | UINTN SaveCurrentPeimCount;\r |
1053e0c5 | 263 | UINTN SaveCurrentFvCount;\r |
b0d803fe | 264 | EFI_PEI_FILE_HANDLE SaveCurrentFileHandle;\r |
797a9d67 | 265 | PEIM_FILE_HANDLE_EXTENDED_DATA ExtendedData;\r |
58dcdada | 266 | EFI_PHYSICAL_ADDRESS NewPermenentMemoryBase;\r |
267 | TEMPORARY_RAM_SUPPORT_PPI *TemporaryRamSupportPpi;\r | |
268 | EFI_HOB_HANDOFF_INFO_TABLE *OldHandOffTable;\r | |
269 | EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffTable;\r | |
66c69dea | 270 | INTN StackOffset;\r |
271 | INTN HeapOffset;\r | |
58dcdada | 272 | PEI_CORE_INSTANCE *PrivateInMem;\r |
273 | UINT64 NewPeiStackSize;\r | |
274 | UINT64 OldPeiStackSize;\r | |
275 | UINT64 StackGap;\r | |
288f9b38 | 276 | EFI_FV_FILE_INFO FvFileInfo;\r |
58dcdada | 277 | UINTN OldCheckingTop;\r |
278 | UINTN OldCheckingBottom;\r | |
3b428ade | 279 | PEI_CORE_FV_HANDLE *CoreFvHandle;\r |
b0d803fe | 280 | \r |
6c7a807a | 281 | PeiServices = (CONST EFI_PEI_SERVICES **) &Private->PS;\r |
b0d803fe | 282 | PeimEntryPoint = NULL;\r |
283 | PeimFileHandle = NULL;\r | |
288f9b38 | 284 | EntryPoint = 0;\r |
b0d803fe | 285 | \r |
286 | if ((Private->PeiMemoryInstalled) && (Private->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME)) {\r | |
287 | //\r | |
288 | // Once real memory is available, shadow the RegisterForShadow modules. And meanwhile\r | |
289 | // update the modules' status from PEIM_STATE_REGISITER_FOR_SHADOW to PEIM_STATE_DONE.\r | |
290 | //\r | |
291 | SaveCurrentPeimCount = Private->CurrentPeimCount;\r | |
1053e0c5 | 292 | SaveCurrentFvCount = Private->CurrentPeimFvCount;\r |
b0d803fe | 293 | SaveCurrentFileHandle = Private->CurrentFileHandle;\r |
294 | \r | |
1053e0c5 | 295 | for (Index1 = 0; Index1 <= SaveCurrentFvCount; Index1++) {\r |
188e4e84 | 296 | for (Index2 = 0; (Index2 < PcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->Fv[Index1].FvFileHandles[Index2] != NULL); Index2++) {\r |
b0d803fe | 297 | if (Private->Fv[Index1].PeimState[Index2] == PEIM_STATE_REGISITER_FOR_SHADOW) {\r |
58dcdada | 298 | PeimFileHandle = Private->Fv[Index1].FvFileHandles[Index2];\r |
b0d803fe | 299 | Status = PeiLoadImage (\r |
6c7a807a | 300 | (CONST EFI_PEI_SERVICES **) &Private->PS,\r |
58dcdada | 301 | PeimFileHandle,\r |
341a658f | 302 | PEIM_STATE_REGISITER_FOR_SHADOW,\r |
58dcdada | 303 | &EntryPoint,\r |
b0d803fe | 304 | &AuthenticationState\r |
305 | );\r | |
306 | if (Status == EFI_SUCCESS) {\r | |
307 | //\r | |
308 | // PEIM_STATE_REGISITER_FOR_SHADOW move to PEIM_STATE_DONE\r | |
309 | //\r | |
310 | Private->Fv[Index1].PeimState[Index2]++;\r | |
1053e0c5 | 311 | Private->CurrentFileHandle = PeimFileHandle;\r |
58dcdada | 312 | Private->CurrentPeimFvCount = Index1;\r |
313 | Private->CurrentPeimCount = Index2;\r | |
b0d803fe | 314 | //\r |
315 | // Call the PEIM entry point\r | |
316 | //\r | |
797a9d67 | 317 | PeimEntryPoint = (EFI_PEIM_ENTRY_POINT2)(UINTN)EntryPoint;\r |
58dcdada | 318 | \r |
087e13cb | 319 | PERF_START (PeimFileHandle, "PEIM", NULL, 0);\r |
797a9d67 | 320 | PeimEntryPoint(PeimFileHandle, (const EFI_PEI_SERVICES **) &Private->PS);\r |
087e13cb | 321 | PERF_END (PeimFileHandle, "PEIM", NULL, 0);\r |
58dcdada | 322 | }\r |
323 | \r | |
b0d803fe | 324 | //\r |
325 | // Process the Notify list and dispatch any notifies for\r | |
326 | // newly installed PPIs.\r | |
327 | //\r | |
328 | ProcessNotifyList (Private);\r | |
329 | }\r | |
330 | }\r | |
331 | }\r | |
58dcdada | 332 | Private->CurrentFileHandle = SaveCurrentFileHandle;\r |
333 | Private->CurrentPeimFvCount = SaveCurrentFvCount;\r | |
334 | Private->CurrentPeimCount = SaveCurrentPeimCount;\r | |
b0d803fe | 335 | }\r |
192f6d4c | 336 | \r |
337 | //\r | |
338 | // This is the main dispatch loop. It will search known FVs for PEIMs and\r | |
339 | // attempt to dispatch them. If any PEIM gets dispatched through a single\r | |
340 | // pass of the dispatcher, it will start over from the Bfv again to see\r | |
341 | // if any new PEIMs dependencies got satisfied. With a well ordered\r | |
342 | // FV where PEIMs are found in the order their dependencies are also\r | |
343 | // satisfied, this dipatcher should run only once.\r | |
344 | //\r | |
b0d803fe | 345 | do {\r |
82b8c8df | 346 | //\r |
347 | // In case that reenter PeiCore happens, the last pass record is still available. \r | |
348 | //\r | |
349 | if (!Private->PeimDispatcherReenter) {\r | |
350 | Private->PeimNeedingDispatch = FALSE;\r | |
351 | Private->PeimDispatchOnThisPass = FALSE;\r | |
352 | } else {\r | |
353 | Private->PeimDispatcherReenter = FALSE;\r | |
354 | }\r | |
355 | \r | |
b0d803fe | 356 | for (FvCount = Private->CurrentPeimFvCount; FvCount < Private->FvCount; FvCount++) {\r |
3b428ade | 357 | CoreFvHandle = FindNextCoreFvHandle (Private, FvCount);\r |
358 | ASSERT (CoreFvHandle != NULL);\r | |
359 | \r | |
2a00326e | 360 | //\r |
3b428ade | 361 | // If the FV has corresponding EFI_PEI_FIRMWARE_VOLUME_PPI instance, then dispatch it.\r |
2a00326e | 362 | //\r |
3b428ade | 363 | if (CoreFvHandle->FvPpi == NULL) {\r |
364 | continue;\r | |
365 | }\r | |
366 | \r | |
367 | Private->CurrentPeimFvCount = FvCount;\r | |
192f6d4c | 368 | \r |
b0d803fe | 369 | if (Private->CurrentPeimCount == 0) {\r |
370 | //\r | |
371 | // When going through each FV, at first, search Apriori file to\r | |
58dcdada | 372 | // reorder all PEIMs to ensure the PEIMs in Apriori file to get\r |
b0d803fe | 373 | // dispatch at first.\r |
374 | //\r | |
3b428ade | 375 | DiscoverPeimsAndOrderWithApriori (Private, CoreFvHandle);\r |
b0d803fe | 376 | }\r |
192f6d4c | 377 | \r |
378 | //\r | |
b0d803fe | 379 | // Start to dispatch all modules within the current Fv.\r |
192f6d4c | 380 | //\r |
58dcdada | 381 | for (PeimCount = Private->CurrentPeimCount;\r |
188e4e84 | 382 | (PeimCount < PcdGet32 (PcdPeiCoreMaxPeimPerFv)) && (Private->CurrentFvFileHandles[PeimCount] != NULL);\r |
b0d803fe | 383 | PeimCount++) {\r |
384 | Private->CurrentPeimCount = PeimCount;\r | |
385 | PeimFileHandle = Private->CurrentFileHandle = Private->CurrentFvFileHandles[PeimCount];\r | |
386 | \r | |
387 | if (Private->Fv[FvCount].PeimState[PeimCount] == PEIM_STATE_NOT_DISPATCHED) {\r | |
388 | if (!DepexSatisfied (Private, PeimFileHandle, PeimCount)) {\r | |
82b8c8df | 389 | Private->PeimNeedingDispatch = TRUE;\r |
b0d803fe | 390 | } else {\r |
3b428ade | 391 | Status = CoreFvHandle->FvPpi->GetFileInfo (CoreFvHandle->FvPpi, PeimFileHandle, &FvFileInfo);\r |
288f9b38 LG |
392 | ASSERT_EFI_ERROR (Status);\r |
393 | if (FvFileInfo.FileType == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {\r | |
394 | //\r | |
395 | // For Fv type file, Produce new FV PPI and FV hob\r | |
396 | //\r | |
3b428ade | 397 | Status = ProcessFvFile (&Private->Fv[FvCount], PeimFileHandle);\r |
398 | AuthenticationState = 0;\r | |
288f9b38 LG |
399 | } else {\r |
400 | //\r | |
401 | // For PEIM driver, Load its entry point\r | |
402 | //\r | |
403 | Status = PeiLoadImage (\r | |
58dcdada | 404 | PeiServices,\r |
405 | PeimFileHandle,\r | |
341a658f | 406 | PEIM_STATE_NOT_DISPATCHED,\r |
58dcdada | 407 | &EntryPoint,\r |
288f9b38 LG |
408 | &AuthenticationState\r |
409 | );\r | |
410 | }\r | |
411 | \r | |
b0d803fe | 412 | if ((Status == EFI_SUCCESS)) {\r |
192f6d4c | 413 | //\r |
58dcdada | 414 | // The PEIM has its dependencies satisfied, and its entry point\r |
415 | // has been found, so invoke it.\r | |
192f6d4c | 416 | //\r |
087e13cb | 417 | PERF_START (PeimFileHandle, "PEIM", NULL, 0);\r |
192f6d4c | 418 | \r |
b0d803fe | 419 | ExtendedData.Handle = (EFI_HANDLE)PeimFileHandle;\r |
192f6d4c | 420 | \r |
421 | REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r | |
422 | EFI_PROGRESS_CODE,\r | |
f9876ecf | 423 | (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN),\r |
192f6d4c | 424 | (VOID *)(&ExtendedData),\r |
425 | sizeof (ExtendedData)\r | |
426 | );\r | |
427 | \r | |
3b428ade | 428 | Status = VerifyPeim (Private, CoreFvHandle->FvHandle, PeimFileHandle);\r |
b0d803fe | 429 | if (Status != EFI_SECURITY_VIOLATION && (AuthenticationState == 0)) {\r |
430 | //\r | |
431 | // PEIM_STATE_NOT_DISPATCHED move to PEIM_STATE_DISPATCHED\r | |
432 | //\r | |
433 | Private->Fv[FvCount].PeimState[PeimCount]++;\r | |
58dcdada | 434 | \r |
288f9b38 LG |
435 | if (FvFileInfo.FileType != EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {\r |
436 | //\r | |
437 | // Call the PEIM entry point for PEIM driver\r | |
438 | //\r | |
797a9d67 | 439 | PeimEntryPoint = (EFI_PEIM_ENTRY_POINT2)(UINTN)EntryPoint;\r |
440 | PeimEntryPoint (PeimFileHandle, (const EFI_PEI_SERVICES **) PeiServices);\r | |
288f9b38 | 441 | }\r |
797a9d67 | 442 | \r |
82b8c8df | 443 | Private->PeimDispatchOnThisPass = TRUE;\r |
192f6d4c | 444 | }\r |
445 | \r | |
446 | REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r | |
447 | EFI_PROGRESS_CODE,\r | |
f9876ecf | 448 | (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN),\r |
192f6d4c | 449 | (VOID *)(&ExtendedData),\r |
450 | sizeof (ExtendedData)\r | |
451 | );\r | |
087e13cb | 452 | PERF_END (PeimFileHandle, "PEIM", NULL, 0);\r |
b0d803fe | 453 | \r |
58dcdada | 454 | }\r |
455 | \r | |
456 | if (Private->SwitchStackSignal) {\r | |
a7715e73 | 457 | //\r |
3d4d0c34 | 458 | // Before switch stack from temporary memory to permenent memory, caculate the heap and stack\r |
a7715e73 | 459 | // usage in temporary memory for debuging.\r |
460 | //\r | |
461 | DEBUG_CODE_BEGIN ();\r | |
96317468 | 462 | UINT32 *StackPointer;\r |
a7715e73 | 463 | \r |
96317468 | 464 | for (StackPointer = (UINT32*)SecCoreData->StackBase;\r |
465 | (StackPointer < (UINT32*)((UINTN)SecCoreData->StackBase + SecCoreData->StackSize)) \\r | |
a7715e73 | 466 | && (*StackPointer == INIT_CAR_VALUE);\r |
467 | StackPointer ++);\r | |
468 | \r | |
3d4d0c34 | 469 | DEBUG ((EFI_D_INFO, "Total temporary memory: %d bytes.\n", (UINT32)SecCoreData->TemporaryRamSize));\r |
470 | DEBUG ((EFI_D_INFO, " temporary memory stack ever used: %d bytes.\n",\r | |
a7715e73 | 471 | (SecCoreData->StackSize - ((UINTN) StackPointer - (UINTN)SecCoreData->StackBase))\r |
472 | ));\r | |
3d4d0c34 | 473 | DEBUG ((EFI_D_INFO, " temporary memory heap used: %d bytes.\n",\r |
a7715e73 | 474 | ((UINTN) Private->HobList.HandoffInformationTable->EfiFreeMemoryBottom -\r |
475 | (UINTN) Private->HobList.Raw)\r | |
476 | ));\r | |
477 | DEBUG_CODE_END ();\r | |
478 | \r | |
a3a15d21 | 479 | //\r |
58dcdada | 480 | // Reserve the size of new stack at bottom of physical memory\r |
a3a15d21 | 481 | //\r |
63b62331 | 482 | OldPeiStackSize = (UINT64) SecCoreData->StackSize;\r |
58dcdada | 483 | NewPeiStackSize = (RShiftU64 (Private->PhysicalMemoryLength, 1) + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;\r |
f4391d63 | 484 | if (PcdGet32(PcdPeiCoreMaxPeiStackSize) > (UINT32) NewPeiStackSize) {\r |
58dcdada | 485 | Private->StackSize = NewPeiStackSize;\r |
486 | } else {\r | |
f4391d63 | 487 | Private->StackSize = PcdGet32(PcdPeiCoreMaxPeiStackSize);\r |
58dcdada | 488 | }\r |
192f6d4c | 489 | \r |
58dcdada | 490 | //\r |
491 | // In theory, the size of new stack in permenent memory should large than\r | |
492 | // size of old stack in temporary memory.\r | |
493 | // But if new stack is smaller than the size of old stack, we also reserve\r | |
494 | // the size of old stack at bottom of permenent memory.\r | |
495 | //\r | |
90e128e2 | 496 | DEBUG ((EFI_D_INFO, "Old Stack size %d, New stack size %d\n", (INT32) OldPeiStackSize, (INT32) Private->StackSize));\r |
28127cc7 LG |
497 | ASSERT (Private->StackSize >= OldPeiStackSize);\r |
498 | StackGap = Private->StackSize - OldPeiStackSize;\r | |
d74eeda8 | 499 | \r |
58dcdada | 500 | //\r |
501 | // Update HandOffHob for new installed permenent memory\r | |
502 | //\r | |
503 | OldHandOffTable = Private->HobList.HandoffInformationTable;\r | |
5c5a0601 | 504 | OldCheckingBottom = (UINTN)(SecCoreData->TemporaryRamBase);\r |
58dcdada | 505 | OldCheckingTop = (UINTN)(OldCheckingBottom + SecCoreData->TemporaryRamSize);\r |
192f6d4c | 506 | \r |
507 | //\r | |
58dcdada | 508 | // The whole temporary memory will be migrated to physical memory.\r |
509 | // CAUTION: The new base is computed accounding to gap of new stack.\r | |
192f6d4c | 510 | //\r |
58dcdada | 511 | NewPermenentMemoryBase = Private->PhysicalMemoryBegin + StackGap;\r |
40f26b8f | 512 | \r |
513 | //\r | |
3d4d0c34 | 514 | // Caculate stack offset and heap offset between temporary memory and new permement \r |
40f26b8f | 515 | // memory seperately.\r |
516 | //\r | |
d74eeda8 | 517 | StackOffset = (UINTN) NewPermenentMemoryBase - (UINTN) SecCoreData->StackBase;\r |
66c69dea | 518 | HeapOffset = (INTN) ((UINTN) Private->PhysicalMemoryBegin + Private->StackSize - \\r |
519 | (UINTN) SecCoreData->PeiTemporaryRamBase);\r | |
7df7393f | 520 | DEBUG ((EFI_D_INFO, "Heap Offset = 0x%lX Stack Offset = 0x%lX\n", (INT64)HeapOffset, (INT64)StackOffset));\r |
66c69dea | 521 | \r |
40f26b8f | 522 | //\r |
523 | // Caculate new HandOffTable and PrivateData address in permenet memory's stack\r | |
524 | //\r | |
66c69dea | 525 | NewHandOffTable = (EFI_HOB_HANDOFF_INFO_TABLE *)((UINTN)OldHandOffTable + HeapOffset);\r |
526 | PrivateInMem = (PEI_CORE_INSTANCE *)((UINTN) (VOID*) Private + StackOffset);\r | |
192f6d4c | 527 | \r |
528 | //\r | |
58dcdada | 529 | // TemporaryRamSupportPpi is produced by platform's SEC\r |
192f6d4c | 530 | //\r |
58dcdada | 531 | Status = PeiLocatePpi (\r |
532 | (CONST EFI_PEI_SERVICES **) PeiServices,\r | |
533 | &gEfiTemporaryRamSupportPpiGuid,\r | |
534 | 0,\r | |
535 | NULL,\r | |
536 | (VOID**)&TemporaryRamSupportPpi\r | |
537 | );\r | |
538 | \r | |
81c7803c | 539 | \r |
58dcdada | 540 | if (!EFI_ERROR (Status)) {\r |
40f26b8f | 541 | //\r |
542 | // Temporary Ram support Ppi is provided by platform, it will copy \r | |
543 | // temporary memory to permenent memory and do stack switching.\r | |
544 | // After invoken temporary Ram support, following code's stack is in \r | |
3d4d0c34 | 545 | // memory but not in temporary memory.\r |
40f26b8f | 546 | //\r |
58dcdada | 547 | TemporaryRamSupportPpi->TemporaryRamMigration (\r |
548 | (CONST EFI_PEI_SERVICES **) PeiServices,\r | |
549 | (EFI_PHYSICAL_ADDRESS)(UINTN) SecCoreData->TemporaryRamBase,\r | |
550 | (EFI_PHYSICAL_ADDRESS)(UINTN) NewPermenentMemoryBase,\r | |
551 | SecCoreData->TemporaryRamSize\r | |
552 | );\r | |
553 | \r | |
554 | } else {\r | |
b414ea4b | 555 | //\r |
556 | // In IA32/x64/Itanium architecture, we need platform provide\r | |
557 | // TEMPORAY_RAM_MIGRATION_PPI.\r | |
558 | //\r | |
559 | ASSERT (FALSE);\r | |
58dcdada | 560 | }\r |
561 | \r | |
562 | \r | |
563 | //\r | |
b0d803fe | 564 | //\r |
58dcdada | 565 | // Fixup the PeiCore's private data\r |
b0d803fe | 566 | //\r |
58dcdada | 567 | PrivateInMem->PS = &PrivateInMem->ServiceTableShadow;\r |
568 | PrivateInMem->CpuIo = &PrivateInMem->ServiceTableShadow.CpuIo;\r | |
66c69dea | 569 | PrivateInMem->HobList.Raw = (VOID*) ((UINTN) PrivateInMem->HobList.Raw + HeapOffset);\r |
58dcdada | 570 | PrivateInMem->StackBase = (EFI_PHYSICAL_ADDRESS)(((UINTN)PrivateInMem->PhysicalMemoryBegin + EFI_PAGE_MASK) & ~EFI_PAGE_MASK);\r |
571 | \r | |
6c7a807a | 572 | PeiServices = (CONST EFI_PEI_SERVICES **) &PrivateInMem->PS;\r |
58dcdada | 573 | \r |
574 | //\r | |
575 | // Fixup for PeiService's address\r | |
576 | //\r | |
577 | SetPeiServicesTablePointer(PeiServices);\r | |
578 | \r | |
579 | //\r | |
580 | // Update HandOffHob for new installed permenent memory\r | |
581 | //\r | |
582 | NewHandOffTable->EfiEndOfHobList =\r | |
66c69dea | 583 | (EFI_PHYSICAL_ADDRESS)((UINTN) NewHandOffTable->EfiEndOfHobList + HeapOffset);\r |
58dcdada | 584 | NewHandOffTable->EfiMemoryTop = PrivateInMem->PhysicalMemoryBegin +\r |
585 | PrivateInMem->PhysicalMemoryLength;\r | |
586 | NewHandOffTable->EfiMemoryBottom = PrivateInMem->PhysicalMemoryBegin;\r | |
587 | NewHandOffTable->EfiFreeMemoryTop = PrivateInMem->FreePhysicalMemoryTop;\r | |
588 | NewHandOffTable->EfiFreeMemoryBottom = NewHandOffTable->EfiEndOfHobList +\r | |
589 | sizeof (EFI_HOB_GENERIC_HEADER);\r | |
590 | \r | |
591 | //\r | |
592 | // We need convert the PPI desciptor's pointer\r | |
593 | //\r | |
40f26b8f | 594 | ConvertPpiPointers (PrivateInMem, \r |
58dcdada | 595 | OldCheckingBottom, \r |
596 | OldCheckingTop, \r | |
5c5a0601 | 597 | HeapOffset\r |
598 | );\r | |
58dcdada | 599 | \r |
7df7393f | 600 | DEBUG ((EFI_D_INFO, "Stack Hob: BaseAddress=0x%lX Length=0x%lX\n",\r |
601 | PrivateInMem->StackBase,\r | |
58dcdada | 602 | PrivateInMem->StackSize));\r |
603 | BuildStackHob (PrivateInMem->StackBase, PrivateInMem->StackSize);\r | |
604 | \r | |
605 | //\r | |
606 | // After the whole temporary memory is migrated, then we can allocate page in\r | |
607 | // permenent memory.\r | |
608 | //\r | |
609 | PrivateInMem->PeiMemoryInstalled = TRUE;\r | |
610 | \r | |
1bd90a4c | 611 | //\r |
82b8c8df | 612 | // Indicate that PeiCore reenter\r |
1bd90a4c | 613 | //\r |
82b8c8df | 614 | PrivateInMem->PeimDispatcherReenter = TRUE;\r |
615 | \r | |
192f6d4c | 616 | //\r |
b0d803fe | 617 | // Shadow PEI Core. When permanent memory is avaiable, shadow\r |
618 | // PEI Core and PEIMs to get high performance.\r | |
192f6d4c | 619 | //\r |
58dcdada | 620 | PrivateInMem->ShadowedPeiCore = ShadowPeiCore (\r |
621 | PeiServices,\r | |
622 | PrivateInMem\r | |
623 | );\r | |
b0d803fe | 624 | //\r |
58dcdada | 625 | // Process the Notify list and dispatch any notifies for\r |
626 | // newly installed PPIs.\r | |
b0d803fe | 627 | //\r |
58dcdada | 628 | ProcessNotifyList (PrivateInMem);\r |
629 | \r | |
b0d803fe | 630 | //\r |
58dcdada | 631 | // Entry PEI Phase 2\r |
b0d803fe | 632 | //\r |
58dcdada | 633 | PeiCore (SecCoreData, NULL, PrivateInMem);\r |
b0d803fe | 634 | \r |
58dcdada | 635 | //\r |
636 | // Code should not come here\r | |
637 | //\r | |
638 | ASSERT_EFI_ERROR(FALSE);\r | |
192f6d4c | 639 | }\r |
192f6d4c | 640 | \r |
58dcdada | 641 | //\r |
642 | // Process the Notify list and dispatch any notifies for\r | |
643 | // newly installed PPIs.\r | |
644 | //\r | |
645 | ProcessNotifyList (Private);\r | |
646 | \r | |
b0d803fe | 647 | if ((Private->PeiMemoryInstalled) && (Private->Fv[FvCount].PeimState[PeimCount] == PEIM_STATE_REGISITER_FOR_SHADOW) && \\r |
648 | (Private->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME)) {\r | |
649 | //\r | |
58dcdada | 650 | // If memory is availble we shadow images by default for performance reasons.\r |
651 | // We call the entry point a 2nd time so the module knows it's shadowed.\r | |
b0d803fe | 652 | //\r |
653 | //PERF_START (PeiServices, L"PEIM", PeimFileHandle, 0);\r | |
e67ca95c | 654 | ASSERT (PeimEntryPoint != NULL);\r |
797a9d67 | 655 | PeimEntryPoint (PeimFileHandle, (const EFI_PEI_SERVICES **) PeiServices);\r |
b0d803fe | 656 | //PERF_END (PeiServices, L"PEIM", PeimFileHandle, 0);\r |
58dcdada | 657 | \r |
b0d803fe | 658 | //\r |
659 | // PEIM_STATE_REGISITER_FOR_SHADOW move to PEIM_STATE_DONE\r | |
660 | //\r | |
661 | Private->Fv[FvCount].PeimState[PeimCount]++;\r | |
192f6d4c | 662 | \r |
192f6d4c | 663 | //\r |
b0d803fe | 664 | // Process the Notify list and dispatch any notifies for\r |
665 | // newly installed PPIs.\r | |
192f6d4c | 666 | //\r |
b0d803fe | 667 | ProcessNotifyList (Private);\r |
192f6d4c | 668 | }\r |
669 | }\r | |
670 | }\r | |
192f6d4c | 671 | }\r |
192f6d4c | 672 | \r |
b0d803fe | 673 | //\r |
674 | // We set to NULL here to optimize the 2nd entry to this routine after\r | |
675 | // memory is found. This reprevents rescanning of the FV. We set to\r | |
676 | // NULL here so we start at the begining of the next FV\r | |
677 | //\r | |
678 | Private->CurrentFileHandle = NULL;\r | |
679 | Private->CurrentPeimCount = 0;\r | |
680 | //\r | |
681 | // Before walking through the next FV,Private->CurrentFvFileHandles[]should set to NULL\r | |
682 | //\r | |
683 | SetMem (Private->CurrentFvFileHandles, sizeof (Private->CurrentFvFileHandles), 0);\r | |
192f6d4c | 684 | }\r |
685 | \r | |
686 | //\r | |
58dcdada | 687 | // Before making another pass, we should set Private->CurrentPeimFvCount =0 to go\r |
b0d803fe | 688 | // through all the FV.\r |
192f6d4c | 689 | //\r |
b0d803fe | 690 | Private->CurrentPeimFvCount = 0;\r |
192f6d4c | 691 | \r |
692 | //\r | |
58dcdada | 693 | // PeimNeedingDispatch being TRUE means we found a PEIM that did not get\r |
b0d803fe | 694 | // dispatched. So we need to make another pass\r |
192f6d4c | 695 | //\r |
58dcdada | 696 | // PeimDispatchOnThisPass being TRUE means we dispatched a PEIM on this\r |
b0d803fe | 697 | // pass. If we did not dispatch a PEIM there is no point in trying again\r |
698 | // as it will fail the next time too (nothing has changed).\r | |
192f6d4c | 699 | //\r |
82b8c8df | 700 | } while (Private->PeimNeedingDispatch && Private->PeimDispatchOnThisPass);\r |
192f6d4c | 701 | \r |
192f6d4c | 702 | }\r |
703 | \r | |
b1f6a7c6 | 704 | /**\r |
192f6d4c | 705 | Initialize the Dispatcher's data members\r |
706 | \r | |
b1f6a7c6 | 707 | @param PrivateData PeiCore's private data structure\r |
708 | @param OldCoreData Old data from SecCore\r | |
192f6d4c | 709 | NULL if being run in non-permament memory mode.\r |
b1f6a7c6 | 710 | @param SecCoreData Points to a data structure containing information about the PEI core's operating\r |
5aae0aa7 | 711 | environment, such as the size and location of temporary RAM, the stack location and\r |
712 | the BFV location.\r | |
192f6d4c | 713 | \r |
b1f6a7c6 | 714 | @return None.\r |
192f6d4c | 715 | \r |
b1f6a7c6 | 716 | **/\r |
717 | VOID\r | |
718 | InitializeDispatcherData (\r | |
719 | IN PEI_CORE_INSTANCE *PrivateData,\r | |
720 | IN PEI_CORE_INSTANCE *OldCoreData,\r | |
721 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData\r | |
722 | )\r | |
192f6d4c | 723 | {\r |
192f6d4c | 724 | if (OldCoreData == NULL) {\r |
82b8c8df | 725 | PrivateData->PeimDispatcherReenter = FALSE;\r |
b0d803fe | 726 | PeiInitializeFv (PrivateData, SecCoreData);\r |
8e0e40ed | 727 | } else {\r |
7ec93917 | 728 | PeiReinitializeFv (PrivateData);\r |
192f6d4c | 729 | }\r |
730 | \r | |
731 | return;\r | |
732 | }\r | |
733 | \r | |
b1f6a7c6 | 734 | /**\r |
735 | This routine parses the Dependency Expression, if available, and\r | |
736 | decides if the module can be executed.\r | |
737 | \r | |
738 | \r | |
739 | @param Private PeiCore's private data structure\r | |
740 | @param FileHandle PEIM's file handle\r | |
741 | @param PeimCount Peim count in all dispatched PEIMs.\r | |
192f6d4c | 742 | \r |
b1f6a7c6 | 743 | @retval TRUE Can be dispatched\r |
744 | @retval FALSE Cannot be dispatched\r | |
745 | \r | |
746 | **/\r | |
192f6d4c | 747 | BOOLEAN\r |
748 | DepexSatisfied (\r | |
b0d803fe | 749 | IN PEI_CORE_INSTANCE *Private,\r |
750 | IN EFI_PEI_FILE_HANDLE FileHandle,\r | |
751 | IN UINTN PeimCount\r | |
192f6d4c | 752 | )\r |
192f6d4c | 753 | {\r |
288f9b38 LG |
754 | EFI_STATUS Status;\r |
755 | VOID *DepexData;\r | |
b0d803fe | 756 | \r |
757 | if (PeimCount < Private->AprioriCount) {\r | |
758 | //\r | |
759 | // If its in the A priori file then we set Depex to TRUE\r | |
760 | //\r | |
761 | return TRUE;\r | |
762 | }\r | |
58dcdada | 763 | \r |
288f9b38 | 764 | //\r |
58dcdada | 765 | // Depex section not in the encapsulated section.\r |
288f9b38 LG |
766 | //\r |
767 | Status = PeiServicesFfsFindSectionData (\r | |
768 | EFI_SECTION_PEI_DEPEX,\r | |
58dcdada | 769 | FileHandle,\r |
288f9b38 LG |
770 | (VOID **)&DepexData\r |
771 | );\r | |
b0d803fe | 772 | \r |
192f6d4c | 773 | if (EFI_ERROR (Status)) {\r |
b0d803fe | 774 | //\r |
775 | // If there is no DEPEX, assume the module can be executed\r | |
776 | //\r | |
192f6d4c | 777 | return TRUE;\r |
778 | }\r | |
779 | \r | |
780 | //\r | |
781 | // Evaluate a given DEPEX\r | |
782 | //\r | |
b0d803fe | 783 | return PeimDispatchReadiness (&Private->PS, DepexData);\r |
192f6d4c | 784 | }\r |
785 | \r | |
14e8823a | 786 | /**\r |
787 | This routine enable a PEIM to register itself to shadow when PEI Foundation\r | |
788 | discovery permanent memory.\r | |
789 | \r | |
b1f6a7c6 | 790 | @param FileHandle File handle of a PEIM.\r |
58dcdada | 791 | \r |
b1f6a7c6 | 792 | @retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.\r |
793 | @retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.\r | |
794 | @retval EFI_SUCCESS Successfully to register itself.\r | |
14e8823a | 795 | \r |
58dcdada | 796 | **/\r |
14e8823a | 797 | EFI_STATUS\r |
798 | EFIAPI\r | |
799 | PeiRegisterForShadow (\r | |
800 | IN EFI_PEI_FILE_HANDLE FileHandle\r | |
801 | )\r | |
802 | {\r | |
803 | PEI_CORE_INSTANCE *Private;\r | |
804 | Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ());\r | |
805 | \r | |
806 | if (Private->CurrentFileHandle != FileHandle) {\r | |
807 | //\r | |
808 | // The FileHandle must be for the current PEIM\r | |
809 | //\r | |
810 | return EFI_NOT_FOUND;\r | |
811 | }\r | |
812 | \r | |
813 | if (Private->Fv[Private->CurrentPeimFvCount].PeimState[Private->CurrentPeimCount] >= PEIM_STATE_REGISITER_FOR_SHADOW) {\r | |
814 | //\r | |
815 | // If the PEIM has already entered the PEIM_STATE_REGISTER_FOR_SHADOW or PEIM_STATE_DONE then it's already been started\r | |
816 | //\r | |
817 | return EFI_ALREADY_STARTED;\r | |
818 | }\r | |
58dcdada | 819 | \r |
14e8823a | 820 | Private->Fv[Private->CurrentPeimFvCount].PeimState[Private->CurrentPeimCount] = PEIM_STATE_REGISITER_FOR_SHADOW;\r |
821 | \r | |
822 | return EFI_SUCCESS;\r | |
823 | }\r | |
824 | \r | |
3b428ade | 825 | \r |
341a658f | 826 | \r |