]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
MdeModulePkg/Core: Fix typos in comments
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain / PeiMain.c
CommitLineData
615c6dd0 1/** @file\r
b1f6a7c6 2 Pei Core Main Entry Point\r
3 \r
ebaafbe6 4Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 5This program and the accompanying materials\r
192f6d4c 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT 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
fe1e36e5 17EFI_PEI_PPI_DESCRIPTOR mMemoryDiscoveredPpi = {\r
192f6d4c 18 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
19 &gEfiPeiMemoryDiscoveredPpiGuid,\r
20 NULL\r
21};\r
22\r
40f26b8f 23///\r
82b8c8df 24/// Pei service instance\r
40f26b8f 25///\r
fe1e36e5 26EFI_PEI_SERVICES gPs = {\r
192f6d4c 27 {\r
28 PEI_SERVICES_SIGNATURE,\r
29 PEI_SERVICES_REVISION,\r
30 sizeof (EFI_PEI_SERVICES),\r
31 0,\r
32 0\r
33 },\r
34 PeiInstallPpi,\r
35 PeiReInstallPpi,\r
36 PeiLocatePpi,\r
37 PeiNotifyPpi,\r
38\r
39 PeiGetBootMode,\r
40 PeiSetBootMode,\r
41\r
42 PeiGetHobList,\r
43 PeiCreateHob,\r
44\r
3b428ade 45 PeiFfsFindNextVolume,\r
192f6d4c 46 PeiFfsFindNextFile,\r
47 PeiFfsFindSectionData,\r
48\r
b0d803fe 49 PeiInstallPeiMemory, \r
192f6d4c 50 PeiAllocatePages,\r
51 PeiAllocatePool,\r
52 (EFI_PEI_COPY_MEM)CopyMem,\r
53 (EFI_PEI_SET_MEM)SetMem,\r
54\r
55 PeiReportStatusCode,\r
14e8823a 56 PeiResetSystem,\r
b0d803fe 57\r
8d415937 58 &gPeiDefaultCpuIoPpi,\r
59 &gPeiDefaultPciCfg2Ppi,\r
b0d803fe 60\r
61 PeiFfsFindFileByName,\r
62 PeiFfsGetFileInfo,\r
63 PeiFfsGetVolumeInfo,\r
c7935105
SZ
64 PeiRegisterForShadow,\r
65 PeiFfsFindSectionData3,\r
672473ea
SZ
66 PeiFfsGetFileInfo2,\r
67 PeiResetSystem2\r
192f6d4c 68};\r
69\r
ef05e063 70/**\r
71 Shadow PeiCore module from flash to installed memory.\r
72 \r
73 @param PrivateData PeiCore's private data structure\r
74\r
75 @return PeiCore function address after shadowing.\r
76**/\r
77PEICORE_FUNCTION_POINTER\r
78ShadowPeiCore (\r
79 IN PEI_CORE_INSTANCE *PrivateData\r
80 )\r
81{\r
82 EFI_PEI_FILE_HANDLE PeiCoreFileHandle;\r
83 EFI_PHYSICAL_ADDRESS EntryPoint;\r
84 EFI_STATUS Status;\r
85 UINT32 AuthenticationState;\r
86\r
87 PeiCoreFileHandle = NULL;\r
88\r
89 //\r
90 // Find the PEI Core in the BFV\r
91 //\r
92 Status = PrivateData->Fv[0].FvPpi->FindFileByType (\r
93 PrivateData->Fv[0].FvPpi,\r
94 EFI_FV_FILETYPE_PEI_CORE,\r
95 PrivateData->Fv[0].FvHandle,\r
96 &PeiCoreFileHandle\r
97 );\r
98 ASSERT_EFI_ERROR (Status);\r
99\r
100 //\r
101 // Shadow PEI Core into memory so it will run faster\r
102 //\r
103 Status = PeiLoadImage (\r
104 GetPeiServicesTablePointer (),\r
105 *((EFI_PEI_FILE_HANDLE*)&PeiCoreFileHandle),\r
106 PEIM_STATE_REGISITER_FOR_SHADOW,\r
107 &EntryPoint,\r
108 &AuthenticationState\r
109 );\r
110 ASSERT_EFI_ERROR (Status);\r
111\r
112 //\r
113 // Compute the PeiCore's function address after shaowed PeiCore.\r
114 // _ModuleEntryPoint is PeiCore main function entry\r
115 //\r
116 return (PEICORE_FUNCTION_POINTER)((UINTN) EntryPoint + (UINTN) PeiCore - (UINTN) _ModuleEntryPoint);\r
117}\r
118\r
b1f6a7c6 119/**\r
82b8c8df 120 This routine is invoked by main entry of PeiMain module during transition\r
192f6d4c 121 from SEC to PEI. After switching stack in the PEI core, it will restart\r
122 with the old core data.\r
123\r
0f9ebb32 124 @param SecCoreDataPtr Points to a data structure containing information about the PEI core's operating\r
5aae0aa7 125 environment, such as the size and location of temporary RAM, the stack location and\r
126 the BFV location.\r
b1f6a7c6 127 @param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.\r
5aae0aa7 128 An empty PPI list consists of a single descriptor with the end-tag\r
129 EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization\r
130 phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such\r
131 that both the PEI Foundation and any modules can leverage the associated service\r
132 calls and/or code in these early PPIs\r
b1f6a7c6 133 @param Data Pointer to old core data that is used to initialize the\r
192f6d4c 134 core's data areas.\r
82b8c8df 135 If NULL, it is first PeiCore entering.\r
192f6d4c 136\r
b1f6a7c6 137**/\r
0308e20d 138VOID\r
b1f6a7c6 139EFIAPI\r
140PeiCore (\r
0f9ebb32 141 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreDataPtr,\r
b1f6a7c6 142 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,\r
143 IN VOID *Data\r
144 )\r
192f6d4c 145{\r
ef05e063 146 PEI_CORE_INSTANCE PrivateData;\r
0f9ebb32
LG
147 EFI_SEC_PEI_HAND_OFF *SecCoreData;\r
148 EFI_SEC_PEI_HAND_OFF NewSecCoreData;\r
ef05e063 149 EFI_STATUS Status;\r
150 PEI_CORE_TEMP_POINTERS TempPtr;\r
ef05e063 151 PEI_CORE_INSTANCE *OldCoreData;\r
152 EFI_PEI_CPU_IO_PPI *CpuIo;\r
153 EFI_PEI_PCI_CFG2_PPI *PciCfg;\r
154 EFI_HOB_HANDOFF_INFO_TABLE *HandoffInformationTable;\r
0f9ebb32 155 EFI_PEI_TEMPORARY_RAM_DONE_PPI *TemporaryRamDonePpi;\r
fe781940 156 UINTN Index;\r
0f9ebb32 157 \r
6b22483f 158 //\r
159 // Retrieve context passed into PEI Core\r
160 //\r
0f9ebb32
LG
161 OldCoreData = (PEI_CORE_INSTANCE *) Data;\r
162 SecCoreData = (EFI_SEC_PEI_HAND_OFF *) SecCoreDataPtr;\r
192f6d4c 163\r
40f26b8f 164 //\r
6b22483f 165 // Perform PEI Core phase specific actions.\r
166 //\r
167 if (OldCoreData == NULL) {\r
168 //\r
169 // If OldCoreData is NULL, means current is the first entry into the PEI Core before memory is available.\r
170 //\r
171 ZeroMem (&PrivateData, sizeof (PEI_CORE_INSTANCE));\r
172 PrivateData.Signature = PEI_CORE_HANDLE_SIGNATURE;\r
173 CopyMem (&PrivateData.ServiceTableShadow, &gPs, sizeof (gPs));\r
174 } else {\r
175 //\r
176 // Memory is available to the PEI Core. See if the PEI Core has been shadowed to memory yet.\r
177 //\r
ef05e063 178 if (OldCoreData->ShadowedPeiCore == NULL) {\r
ef05e063 179 //\r
180 // Fixup the PeiCore's private data\r
181 //\r
6b22483f 182 OldCoreData->Ps = &OldCoreData->ServiceTableShadow;\r
183 OldCoreData->CpuIo = &OldCoreData->ServiceTableShadow.CpuIo;\r
ef05e063 184 if (OldCoreData->HeapOffsetPositive) {\r
185 OldCoreData->HobList.Raw = (VOID *)(OldCoreData->HobList.Raw + OldCoreData->HeapOffset);\r
fe781940
SZ
186 OldCoreData->UnknownFvInfo = (PEI_CORE_UNKNOW_FORMAT_FV_INFO *) ((UINT8 *) OldCoreData->UnknownFvInfo + OldCoreData->HeapOffset);\r
187 OldCoreData->CurrentFvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->CurrentFvFileHandles + OldCoreData->HeapOffset);\r
188 OldCoreData->PpiData.PpiListPtrs = (PEI_PPI_LIST_POINTERS *) ((UINT8 *) OldCoreData->PpiData.PpiListPtrs + OldCoreData->HeapOffset);\r
189 OldCoreData->Fv = (PEI_CORE_FV_HANDLE *) ((UINT8 *) OldCoreData->Fv + OldCoreData->HeapOffset);\r
190 for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {\r
191 OldCoreData->Fv[Index].PeimState = (UINT8 *) OldCoreData->Fv[Index].PeimState + OldCoreData->HeapOffset;\r
192 OldCoreData->Fv[Index].FvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->Fv[Index].FvFileHandles + OldCoreData->HeapOffset);\r
193 }\r
194 OldCoreData->FileGuid = (EFI_GUID *) ((UINT8 *) OldCoreData->FileGuid + OldCoreData->HeapOffset);\r
195 OldCoreData->FileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->FileHandles + OldCoreData->HeapOffset);\r
ef05e063 196 } else {\r
197 OldCoreData->HobList.Raw = (VOID *)(OldCoreData->HobList.Raw - OldCoreData->HeapOffset);\r
fe781940
SZ
198 OldCoreData->UnknownFvInfo = (PEI_CORE_UNKNOW_FORMAT_FV_INFO *) ((UINT8 *) OldCoreData->UnknownFvInfo - OldCoreData->HeapOffset);\r
199 OldCoreData->CurrentFvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->CurrentFvFileHandles - OldCoreData->HeapOffset);\r
200 OldCoreData->PpiData.PpiListPtrs = (PEI_PPI_LIST_POINTERS *) ((UINT8 *) OldCoreData->PpiData.PpiListPtrs - OldCoreData->HeapOffset);\r
201 OldCoreData->Fv = (PEI_CORE_FV_HANDLE *) ((UINT8 *) OldCoreData->Fv - OldCoreData->HeapOffset);\r
202 for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {\r
203 OldCoreData->Fv[Index].PeimState = (UINT8 *) OldCoreData->Fv[Index].PeimState - OldCoreData->HeapOffset;\r
204 OldCoreData->Fv[Index].FvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->Fv[Index].FvFileHandles - OldCoreData->HeapOffset);\r
205 }\r
206 OldCoreData->FileGuid = (EFI_GUID *) ((UINT8 *) OldCoreData->FileGuid - OldCoreData->HeapOffset);\r
207 OldCoreData->FileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->FileHandles - OldCoreData->HeapOffset);\r
ef05e063 208 }\r
209\r
6b22483f 210 //\r
211 // Initialize libraries that the PEI Core is linked against\r
212 //\r
213 ProcessLibraryConstructorList (NULL, (CONST EFI_PEI_SERVICES **)&OldCoreData->Ps);\r
214 \r
ef05e063 215 //\r
216 // Fixup for PeiService's address\r
217 //\r
218 SetPeiServicesTablePointer ((CONST EFI_PEI_SERVICES **)&OldCoreData->Ps);\r
219\r
220 //\r
6393d9c8 221 // Update HandOffHob for new installed permanent memory\r
ef05e063 222 //\r
223 HandoffInformationTable = OldCoreData->HobList.HandoffInformationTable;\r
224 if (OldCoreData->HeapOffsetPositive) {\r
225 HandoffInformationTable->EfiEndOfHobList = HandoffInformationTable->EfiEndOfHobList + OldCoreData->HeapOffset;\r
226 } else {\r
227 HandoffInformationTable->EfiEndOfHobList = HandoffInformationTable->EfiEndOfHobList - OldCoreData->HeapOffset;\r
228 }\r
229 HandoffInformationTable->EfiMemoryTop = OldCoreData->PhysicalMemoryBegin + OldCoreData->PhysicalMemoryLength;\r
230 HandoffInformationTable->EfiMemoryBottom = OldCoreData->PhysicalMemoryBegin;\r
231 HandoffInformationTable->EfiFreeMemoryTop = OldCoreData->FreePhysicalMemoryTop;\r
232 HandoffInformationTable->EfiFreeMemoryBottom = HandoffInformationTable->EfiEndOfHobList + sizeof (EFI_HOB_GENERIC_HEADER);\r
233\r
234 //\r
424b7c9f 235 // We need convert the PPI descriptor's pointer\r
ef05e063 236 //\r
424b7c9f 237 ConvertPpiPointers (SecCoreData, OldCoreData);\r
ef05e063 238\r
239 //\r
240 // After the whole temporary memory is migrated, then we can allocate page in\r
6393d9c8 241 // permanent memory.\r
ef05e063 242 //\r
243 OldCoreData->PeiMemoryInstalled = TRUE;\r
244\r
245 //\r
246 // Indicate that PeiCore reenter\r
247 //\r
248 OldCoreData->PeimDispatcherReenter = TRUE;\r
249 \r
250 if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0 && (OldCoreData->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME)) {\r
251 //\r
252 // if Loading Module at Fixed Address is enabled, allocate the PEI code memory range usage bit map array.\r
253 // Every bit in the array indicate the status of the corresponding memory page available or not\r
254 //\r
255 OldCoreData->PeiCodeMemoryRangeUsageBitMap = AllocateZeroPool (((PcdGet32(PcdLoadFixAddressPeiCodePageNumber)>>6) + 1)*sizeof(UINT64));\r
256 }\r
257\r
ef05e063 258 //\r
259 // Shadow PEI Core. When permanent memory is avaiable, shadow\r
260 // PEI Core and PEIMs to get high performance.\r
261 //\r
3d44658c
LG
262 OldCoreData->ShadowedPeiCore = (PEICORE_FUNCTION_POINTER) (UINTN) PeiCore;\r
263 if ((HandoffInformationTable->BootMode == BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnS3Boot))\r
264 || (HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME && PcdGetBool (PcdShadowPeimOnBoot))) {\r
265 OldCoreData->ShadowedPeiCore = ShadowPeiCore (OldCoreData);\r
266 }\r
ef05e063 267 \r
268 //\r
6b22483f 269 // PEI Core has now been shadowed to memory. Restart PEI Core in memory.\r
ef05e063 270 //\r
271 OldCoreData->ShadowedPeiCore (SecCoreData, PpiList, OldCoreData);\r
6b22483f 272 \r
273 //\r
274 // Should never reach here.\r
275 //\r
276 ASSERT (FALSE);\r
277 CpuDeadLoop();\r
3a7daf9e
MH
278\r
279 UNREACHABLE ();\r
58dcdada 280 }\r
281\r
6b22483f 282 //\r
283 // Memory is available to the PEI Core and the PEI Core has been shadowed to memory.\r
284 //\r
0f9ebb32
LG
285 CopyMem (&NewSecCoreData, SecCoreDataPtr, sizeof (NewSecCoreData));\r
286 SecCoreData = &NewSecCoreData;\r
287\r
ef05e063 288 CopyMem (&PrivateData, OldCoreData, sizeof (PrivateData));\r
0f9ebb32 289\r
b0d803fe 290 CpuIo = (VOID*)PrivateData.ServiceTableShadow.CpuIo;\r
291 PciCfg = (VOID*)PrivateData.ServiceTableShadow.PciCfg;\r
292 \r
b1f6a7c6 293 CopyMem (&PrivateData.ServiceTableShadow, &gPs, sizeof (gPs));\r
b0d803fe 294 \r
295 PrivateData.ServiceTableShadow.CpuIo = CpuIo;\r
296 PrivateData.ServiceTableShadow.PciCfg = PciCfg;\r
192f6d4c 297 }\r
6b22483f 298 \r
299 //\r
300 // Cache a pointer to the PEI Services Table that is either in temporary memory or permanent memory\r
301 //\r
4140a663 302 PrivateData.Ps = &PrivateData.ServiceTableShadow;\r
192f6d4c 303\r
304 //\r
6b22483f 305 // Initialize libraries that the PEI Core is linked against\r
192f6d4c 306 //\r
4140a663 307 ProcessLibraryConstructorList (NULL, (CONST EFI_PEI_SERVICES **)&PrivateData.Ps);\r
192f6d4c 308\r
81c7803c 309 //\r
310 // Save PeiServicePointer so that it can be retrieved anywhere.\r
311 //\r
6b22483f 312 SetPeiServicesTablePointer ((CONST EFI_PEI_SERVICES **)&PrivateData.Ps);\r
192f6d4c 313\r
6b22483f 314 //\r
315 // Initialize PEI Core Services\r
fe781940 316 //\r
6b22483f 317 InitializeMemoryServices (&PrivateData, SecCoreData, OldCoreData);\r
fe781940
SZ
318 if (OldCoreData == NULL) {\r
319 //\r
320 // Initialize PEI Core Private Data Buffer\r
321 //\r
322 PrivateData.PpiData.PpiListPtrs = AllocateZeroPool (sizeof (PEI_PPI_LIST_POINTERS) * PcdGet32 (PcdPeiCoreMaxPpiSupported));\r
0a13a624 323 ASSERT (PrivateData.PpiData.PpiListPtrs != NULL);\r
fe781940 324 PrivateData.Fv = AllocateZeroPool (sizeof (PEI_CORE_FV_HANDLE) * PcdGet32 (PcdPeiCoreMaxFvSupported));\r
0a13a624 325 ASSERT (PrivateData.Fv != NULL);\r
fe781940 326 PrivateData.Fv[0].PeimState = AllocateZeroPool (sizeof (UINT8) * PcdGet32 (PcdPeiCoreMaxPeimPerFv) * PcdGet32 (PcdPeiCoreMaxFvSupported));\r
0a13a624 327 ASSERT (PrivateData.Fv[0].PeimState != NULL);\r
fe781940 328 PrivateData.Fv[0].FvFileHandles = AllocateZeroPool (sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv) * PcdGet32 (PcdPeiCoreMaxFvSupported));\r
0a13a624 329 ASSERT (PrivateData.Fv[0].FvFileHandles != NULL);\r
fe781940
SZ
330 for (Index = 1; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {\r
331 PrivateData.Fv[Index].PeimState = PrivateData.Fv[Index - 1].PeimState + PcdGet32 (PcdPeiCoreMaxPeimPerFv);\r
332 PrivateData.Fv[Index].FvFileHandles = PrivateData.Fv[Index - 1].FvFileHandles + PcdGet32 (PcdPeiCoreMaxPeimPerFv);\r
333 }\r
334 PrivateData.UnknownFvInfo = AllocateZeroPool (sizeof (PEI_CORE_UNKNOW_FORMAT_FV_INFO) * PcdGet32 (PcdPeiCoreMaxFvSupported));\r
0a13a624 335 ASSERT (PrivateData.UnknownFvInfo != NULL);\r
fe781940 336 PrivateData.CurrentFvFileHandles = AllocateZeroPool (sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));\r
0a13a624 337 ASSERT (PrivateData.CurrentFvFileHandles != NULL);\r
fe781940 338 PrivateData.FileGuid = AllocatePool (sizeof (EFI_GUID) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));\r
0a13a624 339 ASSERT (PrivateData.FileGuid != NULL);\r
fe781940 340 PrivateData.FileHandles = AllocatePool (sizeof (EFI_PEI_FILE_HANDLE) * (PcdGet32 (PcdPeiCoreMaxPeimPerFv) + 1));\r
0a13a624 341 ASSERT (PrivateData.FileHandles != NULL);\r
fe781940 342 }\r
6b22483f 343 InitializePpiServices (&PrivateData, OldCoreData);\r
344 \r
345 //\r
346 // Update performance measurements \r
347 //\r
348 if (OldCoreData == NULL) {\r
349 PERF_START (NULL, "SEC", NULL, 1);\r
350 PERF_END (NULL, "SEC", NULL, 0);\r
192f6d4c 351\r
192f6d4c 352 //\r
6b22483f 353 // If first pass, start performance measurement.\r
192f6d4c 354 //\r
6b22483f 355 PERF_START (NULL,"PEI", NULL, 0);\r
356 PERF_START (NULL,"PreMem", NULL, 0);\r
192f6d4c 357\r
358 } else {\r
6b22483f 359 PERF_END (NULL,"PreMem", NULL, 0);\r
360 PERF_START (NULL,"PostMem", NULL, 0);\r
361 }\r
362\r
363 //\r
364 // Complete PEI Core Service initialization\r
365 // \r
366 InitializeSecurityServices (&PrivateData.Ps, OldCoreData);\r
367 InitializeDispatcherData (&PrivateData, OldCoreData, SecCoreData);\r
368 InitializeImageServices (&PrivateData, OldCoreData);\r
192f6d4c 369\r
6b22483f 370 //\r
371 // Perform PEI Core Phase specific actions\r
372 // \r
373 if (OldCoreData == NULL) {\r
192f6d4c 374 //\r
375 // Report Status Code EFI_SW_PC_INIT\r
376 //\r
377 REPORT_STATUS_CODE (\r
378 EFI_PROGRESS_CODE,\r
f9876ecf 379 (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT)\r
192f6d4c 380 );\r
008d4018 381 \r
192f6d4c 382 //\r
383 // If SEC provided any PPI services to PEI, install them.\r
384 //\r
5088e385 385 if (PpiList != NULL) {\r
386 Status = PeiServicesInstallPpi (PpiList);\r
192f6d4c 387 ASSERT_EFI_ERROR (Status);\r
388 }\r
6b22483f 389 } else {\r
0f9ebb32
LG
390 //\r
391 // Try to locate Temporary RAM Done Ppi.\r
392 //\r
393 Status = PeiServicesLocatePpi (\r
394 &gEfiTemporaryRamDonePpiGuid,\r
395 0,\r
396 NULL,\r
397 (VOID**)&TemporaryRamDonePpi\r
398 );\r
399 if (!EFI_ERROR (Status)) {\r
400 //\r
401 // Disable the use of Temporary RAM after the transition from Temporary RAM to Permanent RAM is complete.\r
402 //\r
403 TemporaryRamDonePpi->TemporaryRamDone ();\r
404 }\r
405\r
6b22483f 406 //\r
407 // Alert any listeners that there is permanent memory available\r
408 //\r
409 PERF_START (NULL,"DisMem", NULL, 0);\r
410 Status = PeiServicesInstallPpi (&mMemoryDiscoveredPpi);\r
b0d803fe 411\r
6b22483f 412 //\r
413 // Process the Notify list and dispatch any notifies for the Memory Discovered PPI\r
414 //\r
415 ProcessNotifyList (&PrivateData);\r
b0d803fe 416\r
6b22483f 417 PERF_END (NULL,"DisMem", NULL, 0);\r
418 }\r
192f6d4c 419\r
420 //\r
421 // Call PEIM dispatcher\r
422 //\r
b0d803fe 423 PeiDispatcher (SecCoreData, &PrivateData);\r
192f6d4c 424\r
ebaafbe6
EC
425 if (PrivateData.HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME) {\r
426 //\r
427 // Check if InstallPeiMemory service was called on non-S3 resume boot path.\r
428 //\r
429 ASSERT(PrivateData.PeiMemoryInstalled == TRUE);\r
430 }\r
192f6d4c 431\r
40f26b8f 432 //\r
6b22483f 433 // Measure PEI Core execution time.\r
40f26b8f 434 //\r
192f6d4c 435 PERF_END (NULL, "PostMem", NULL, 0);\r
436\r
6b22483f 437 //\r
438 // Lookup DXE IPL PPI\r
439 //\r
192f6d4c 440 Status = PeiServicesLocatePpi (\r
441 &gEfiDxeIplPpiGuid,\r
442 0,\r
443 NULL,\r
444 (VOID **)&TempPtr.DxeIpl\r
445 );\r
446 ASSERT_EFI_ERROR (Status);\r
447\r
206f4121
EL
448 if (EFI_ERROR (Status)) {\r
449 //\r
450 // Report status code to indicate DXE IPL PPI could not be found.\r
451 //\r
452 REPORT_STATUS_CODE (\r
453 EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
454 (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND)\r
455 );\r
456 CpuDeadLoop ();\r
457 }\r
458\r
40f26b8f 459 //\r
460 // Enter DxeIpl to load Dxe core.\r
461 //\r
192f6d4c 462 DEBUG ((EFI_D_INFO, "DXE IPL Entry\n"));\r
463 Status = TempPtr.DxeIpl->Entry (\r
464 TempPtr.DxeIpl,\r
4140a663 465 &PrivateData.Ps,\r
192f6d4c 466 PrivateData.HobList\r
467 );\r
0308e20d 468 //\r
469 // Should never reach here.\r
470 //\r
192f6d4c 471 ASSERT_EFI_ERROR (Status);\r
0308e20d 472 CpuDeadLoop();\r
3a7daf9e
MH
473\r
474 UNREACHABLE ();\r
192f6d4c 475}\r