]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
MdeModulePkg: Add Reset2 ppi support in PEI CORE.
[mirror_edk2.git] / MdeModulePkg / Core / Pei / PeiMain / PeiMain.c
CommitLineData
615c6dd0 1/** @file\r
b1f6a7c6 2 Pei Core Main Entry Point\r
3 \r
206f4121 4Copyright (c) 2006 - 2015, 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
221 // Update HandOffHob for new installed permenent memory\r
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
241 // permenent memory.\r
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
262 OldCoreData->ShadowedPeiCore = ShadowPeiCore (OldCoreData);\r
263 \r
264 //\r
6b22483f 265 // PEI Core has now been shadowed to memory. Restart PEI Core in memory.\r
ef05e063 266 //\r
267 OldCoreData->ShadowedPeiCore (SecCoreData, PpiList, OldCoreData);\r
6b22483f 268 \r
269 //\r
270 // Should never reach here.\r
271 //\r
272 ASSERT (FALSE);\r
273 CpuDeadLoop();\r
58dcdada 274 }\r
275\r
6b22483f 276 //\r
277 // Memory is available to the PEI Core and the PEI Core has been shadowed to memory.\r
278 //\r
0f9ebb32
LG
279 CopyMem (&NewSecCoreData, SecCoreDataPtr, sizeof (NewSecCoreData));\r
280 SecCoreData = &NewSecCoreData;\r
281\r
ef05e063 282 CopyMem (&PrivateData, OldCoreData, sizeof (PrivateData));\r
0f9ebb32 283\r
b0d803fe 284 CpuIo = (VOID*)PrivateData.ServiceTableShadow.CpuIo;\r
285 PciCfg = (VOID*)PrivateData.ServiceTableShadow.PciCfg;\r
286 \r
b1f6a7c6 287 CopyMem (&PrivateData.ServiceTableShadow, &gPs, sizeof (gPs));\r
b0d803fe 288 \r
289 PrivateData.ServiceTableShadow.CpuIo = CpuIo;\r
290 PrivateData.ServiceTableShadow.PciCfg = PciCfg;\r
192f6d4c 291 }\r
6b22483f 292 \r
293 //\r
294 // Cache a pointer to the PEI Services Table that is either in temporary memory or permanent memory\r
295 //\r
4140a663 296 PrivateData.Ps = &PrivateData.ServiceTableShadow;\r
192f6d4c 297\r
298 //\r
6b22483f 299 // Initialize libraries that the PEI Core is linked against\r
192f6d4c 300 //\r
4140a663 301 ProcessLibraryConstructorList (NULL, (CONST EFI_PEI_SERVICES **)&PrivateData.Ps);\r
192f6d4c 302\r
81c7803c 303 //\r
304 // Save PeiServicePointer so that it can be retrieved anywhere.\r
305 //\r
6b22483f 306 SetPeiServicesTablePointer ((CONST EFI_PEI_SERVICES **)&PrivateData.Ps);\r
192f6d4c 307\r
6b22483f 308 //\r
309 // Initialize PEI Core Services\r
fe781940 310 //\r
6b22483f 311 InitializeMemoryServices (&PrivateData, SecCoreData, OldCoreData);\r
fe781940
SZ
312 if (OldCoreData == NULL) {\r
313 //\r
314 // Initialize PEI Core Private Data Buffer\r
315 //\r
316 PrivateData.PpiData.PpiListPtrs = AllocateZeroPool (sizeof (PEI_PPI_LIST_POINTERS) * PcdGet32 (PcdPeiCoreMaxPpiSupported));\r
0a13a624 317 ASSERT (PrivateData.PpiData.PpiListPtrs != NULL);\r
fe781940 318 PrivateData.Fv = AllocateZeroPool (sizeof (PEI_CORE_FV_HANDLE) * PcdGet32 (PcdPeiCoreMaxFvSupported));\r
0a13a624 319 ASSERT (PrivateData.Fv != NULL);\r
fe781940 320 PrivateData.Fv[0].PeimState = AllocateZeroPool (sizeof (UINT8) * PcdGet32 (PcdPeiCoreMaxPeimPerFv) * PcdGet32 (PcdPeiCoreMaxFvSupported));\r
0a13a624 321 ASSERT (PrivateData.Fv[0].PeimState != NULL);\r
fe781940 322 PrivateData.Fv[0].FvFileHandles = AllocateZeroPool (sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv) * PcdGet32 (PcdPeiCoreMaxFvSupported));\r
0a13a624 323 ASSERT (PrivateData.Fv[0].FvFileHandles != NULL);\r
fe781940
SZ
324 for (Index = 1; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {\r
325 PrivateData.Fv[Index].PeimState = PrivateData.Fv[Index - 1].PeimState + PcdGet32 (PcdPeiCoreMaxPeimPerFv);\r
326 PrivateData.Fv[Index].FvFileHandles = PrivateData.Fv[Index - 1].FvFileHandles + PcdGet32 (PcdPeiCoreMaxPeimPerFv);\r
327 }\r
328 PrivateData.UnknownFvInfo = AllocateZeroPool (sizeof (PEI_CORE_UNKNOW_FORMAT_FV_INFO) * PcdGet32 (PcdPeiCoreMaxFvSupported));\r
0a13a624 329 ASSERT (PrivateData.UnknownFvInfo != NULL);\r
fe781940 330 PrivateData.CurrentFvFileHandles = AllocateZeroPool (sizeof (EFI_PEI_FILE_HANDLE) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));\r
0a13a624 331 ASSERT (PrivateData.CurrentFvFileHandles != NULL);\r
fe781940 332 PrivateData.FileGuid = AllocatePool (sizeof (EFI_GUID) * PcdGet32 (PcdPeiCoreMaxPeimPerFv));\r
0a13a624 333 ASSERT (PrivateData.FileGuid != NULL);\r
fe781940 334 PrivateData.FileHandles = AllocatePool (sizeof (EFI_PEI_FILE_HANDLE) * (PcdGet32 (PcdPeiCoreMaxPeimPerFv) + 1));\r
0a13a624 335 ASSERT (PrivateData.FileHandles != NULL);\r
fe781940 336 }\r
6b22483f 337 InitializePpiServices (&PrivateData, OldCoreData);\r
338 \r
339 //\r
340 // Update performance measurements \r
341 //\r
342 if (OldCoreData == NULL) {\r
343 PERF_START (NULL, "SEC", NULL, 1);\r
344 PERF_END (NULL, "SEC", NULL, 0);\r
192f6d4c 345\r
192f6d4c 346 //\r
6b22483f 347 // If first pass, start performance measurement.\r
192f6d4c 348 //\r
6b22483f 349 PERF_START (NULL,"PEI", NULL, 0);\r
350 PERF_START (NULL,"PreMem", NULL, 0);\r
192f6d4c 351\r
352 } else {\r
6b22483f 353 PERF_END (NULL,"PreMem", NULL, 0);\r
354 PERF_START (NULL,"PostMem", NULL, 0);\r
355 }\r
356\r
357 //\r
358 // Complete PEI Core Service initialization\r
359 // \r
360 InitializeSecurityServices (&PrivateData.Ps, OldCoreData);\r
361 InitializeDispatcherData (&PrivateData, OldCoreData, SecCoreData);\r
362 InitializeImageServices (&PrivateData, OldCoreData);\r
192f6d4c 363\r
6b22483f 364 //\r
365 // Perform PEI Core Phase specific actions\r
366 // \r
367 if (OldCoreData == NULL) {\r
192f6d4c 368 //\r
369 // Report Status Code EFI_SW_PC_INIT\r
370 //\r
371 REPORT_STATUS_CODE (\r
372 EFI_PROGRESS_CODE,\r
f9876ecf 373 (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT)\r
192f6d4c 374 );\r
008d4018 375 \r
192f6d4c 376 //\r
377 // If SEC provided any PPI services to PEI, install them.\r
378 //\r
5088e385 379 if (PpiList != NULL) {\r
380 Status = PeiServicesInstallPpi (PpiList);\r
192f6d4c 381 ASSERT_EFI_ERROR (Status);\r
382 }\r
6b22483f 383 } else {\r
0f9ebb32
LG
384 //\r
385 // Try to locate Temporary RAM Done Ppi.\r
386 //\r
387 Status = PeiServicesLocatePpi (\r
388 &gEfiTemporaryRamDonePpiGuid,\r
389 0,\r
390 NULL,\r
391 (VOID**)&TemporaryRamDonePpi\r
392 );\r
393 if (!EFI_ERROR (Status)) {\r
394 //\r
395 // Disable the use of Temporary RAM after the transition from Temporary RAM to Permanent RAM is complete.\r
396 //\r
397 TemporaryRamDonePpi->TemporaryRamDone ();\r
398 }\r
399\r
6b22483f 400 //\r
401 // Alert any listeners that there is permanent memory available\r
402 //\r
403 PERF_START (NULL,"DisMem", NULL, 0);\r
404 Status = PeiServicesInstallPpi (&mMemoryDiscoveredPpi);\r
b0d803fe 405\r
6b22483f 406 //\r
407 // Process the Notify list and dispatch any notifies for the Memory Discovered PPI\r
408 //\r
409 ProcessNotifyList (&PrivateData);\r
b0d803fe 410\r
6b22483f 411 PERF_END (NULL,"DisMem", NULL, 0);\r
412 }\r
192f6d4c 413\r
414 //\r
415 // Call PEIM dispatcher\r
416 //\r
b0d803fe 417 PeiDispatcher (SecCoreData, &PrivateData);\r
192f6d4c 418\r
419 //\r
420 // Check if InstallPeiMemory service was called.\r
421 //\r
422 ASSERT(PrivateData.PeiMemoryInstalled == TRUE);\r
423\r
40f26b8f 424 //\r
6b22483f 425 // Measure PEI Core execution time.\r
40f26b8f 426 //\r
192f6d4c 427 PERF_END (NULL, "PostMem", NULL, 0);\r
428\r
6b22483f 429 //\r
430 // Lookup DXE IPL PPI\r
431 //\r
192f6d4c 432 Status = PeiServicesLocatePpi (\r
433 &gEfiDxeIplPpiGuid,\r
434 0,\r
435 NULL,\r
436 (VOID **)&TempPtr.DxeIpl\r
437 );\r
438 ASSERT_EFI_ERROR (Status);\r
439\r
206f4121
EL
440 if (EFI_ERROR (Status)) {\r
441 //\r
442 // Report status code to indicate DXE IPL PPI could not be found.\r
443 //\r
444 REPORT_STATUS_CODE (\r
445 EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
446 (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND)\r
447 );\r
448 CpuDeadLoop ();\r
449 }\r
450\r
40f26b8f 451 //\r
452 // Enter DxeIpl to load Dxe core.\r
453 //\r
192f6d4c 454 DEBUG ((EFI_D_INFO, "DXE IPL Entry\n"));\r
455 Status = TempPtr.DxeIpl->Entry (\r
456 TempPtr.DxeIpl,\r
4140a663 457 &PrivateData.Ps,\r
192f6d4c 458 PrivateData.HobList\r
459 );\r
0308e20d 460 //\r
461 // Should never reach here.\r
462 //\r
192f6d4c 463 ASSERT_EFI_ERROR (Status);\r
0308e20d 464 CpuDeadLoop();\r
192f6d4c 465}\r