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