]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/CpuMpPei/CpuMpPei.c
8ed52436c98ff8a3ea5fd19fdd71539606cbcf4e
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / CpuMpPei.c
1 /** @file
2 CPU PEI Module installs CPU Multiple Processor PPI.
3
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include "CpuMpPei.h"
16
17 //
18 // Global Descriptor Table (GDT)
19 //
20 GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT mGdtEntries[] = {
21 /* selector { Global Segment Descriptor } */
22 /* 0x00 */ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //null descriptor
23 /* 0x08 */ {{0xffff, 0, 0, 0x2, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //linear data segment descriptor
24 /* 0x10 */ {{0xffff, 0, 0, 0xf, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //linear code segment descriptor
25 /* 0x18 */ {{0xffff, 0, 0, 0x3, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //system data segment descriptor
26 /* 0x20 */ {{0xffff, 0, 0, 0xa, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //system code segment descriptor
27 /* 0x28 */ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //spare segment descriptor
28 /* 0x30 */ {{0xffff, 0, 0, 0x2, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //system data segment descriptor
29 /* 0x38 */ {{0xffff, 0, 0, 0xa, 1, 0, 1, 0xf, 0, 1, 0, 1, 0}}, //system code segment descriptor
30 /* 0x40 */ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //spare segment descriptor
31 };
32
33 //
34 // IA32 Gdt register
35 //
36 GLOBAL_REMOVE_IF_UNREFERENCED IA32_DESCRIPTOR mGdt = {
37 sizeof (mGdtEntries) - 1,
38 (UINTN) mGdtEntries
39 };
40
41 GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {
42 (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
43 &gEfiEndOfPeiSignalPpiGuid,
44 CpuMpEndOfPeiCallback
45 };
46
47 /**
48 Sort the APIC ID of all processors.
49
50 This function sorts the APIC ID of all processors so that processor number is
51 assigned in the ascending order of APIC ID which eases MP debugging.
52
53 @param PeiCpuMpData Pointer to PEI CPU MP Data
54 **/
55 VOID
56 SortApicId (
57 IN PEI_CPU_MP_DATA *PeiCpuMpData
58 )
59 {
60 UINTN Index1;
61 UINTN Index2;
62 UINTN Index3;
63 UINT32 ApicId;
64 EFI_HEALTH_FLAGS Health;
65 UINT32 ApCount;
66
67 ApCount = PeiCpuMpData->CpuCount - 1;
68
69 if (ApCount != 0) {
70 for (Index1 = 0; Index1 < ApCount; Index1++) {
71 Index3 = Index1;
72 //
73 // Sort key is the hardware default APIC ID
74 //
75 ApicId = PeiCpuMpData->CpuData[Index1].ApicId;
76 for (Index2 = Index1 + 1; Index2 <= ApCount; Index2++) {
77 if (ApicId > PeiCpuMpData->CpuData[Index2].ApicId) {
78 Index3 = Index2;
79 ApicId = PeiCpuMpData->CpuData[Index2].ApicId;
80 }
81 }
82 if (Index3 != Index1) {
83 PeiCpuMpData->CpuData[Index3].ApicId = PeiCpuMpData->CpuData[Index1].ApicId;
84 PeiCpuMpData->CpuData[Index1].ApicId = ApicId;
85 Health = PeiCpuMpData->CpuData[Index3].Health;
86 PeiCpuMpData->CpuData[Index3].Health = PeiCpuMpData->CpuData[Index1].Health;
87 PeiCpuMpData->CpuData[Index1].Health = Health;
88 }
89 }
90
91 //
92 // Get the processor number for the BSP
93 //
94 ApicId = GetInitialApicId ();
95 for (Index1 = 0; Index1 < PeiCpuMpData->CpuCount; Index1++) {
96 if (PeiCpuMpData->CpuData[Index1].ApicId == ApicId) {
97 PeiCpuMpData->BspNumber = (UINT32) Index1;
98 break;
99 }
100 }
101 }
102 }
103
104 /**
105 Get CPU MP Data pointer from the Guided HOB.
106
107 @return Pointer to Pointer to PEI CPU MP Data
108 **/
109 PEI_CPU_MP_DATA *
110 GetMpHobData (
111 VOID
112 )
113 {
114 EFI_HOB_GUID_TYPE *GuidHob;
115 VOID *DataInHob;
116 PEI_CPU_MP_DATA *CpuMpData;
117
118 CpuMpData = NULL;
119 GuidHob = GetFirstGuidHob (&gEfiCallerIdGuid);
120 if (GuidHob != NULL) {
121 DataInHob = GET_GUID_HOB_DATA (GuidHob);
122 CpuMpData = (PEI_CPU_MP_DATA *)(*(UINTN *)DataInHob);
123 }
124 ASSERT (CpuMpData != NULL);
125 return CpuMpData;
126 }
127
128 /**
129 This function will be called from AP reset code if BSP uses WakeUpAP.
130
131 @param ExchangeInfo Pointer to the MP exchange info buffer
132 @param NumApsExecuting Number of curret executing AP
133 **/
134 VOID
135 EFIAPI
136 ApCFunction (
137 IN MP_CPU_EXCHANGE_INFO *ExchangeInfo,
138 IN UINTN NumApsExecuting
139 )
140 {
141 PEI_CPU_MP_DATA *PeiCpuMpData;
142 UINTN ProcessorNumber;
143 EFI_AP_PROCEDURE Procedure;
144 UINTN BistData;
145
146 PeiCpuMpData = ExchangeInfo->PeiCpuMpData;
147 if (PeiCpuMpData->InitFlag) {
148 //
149 // This is first time AP wakeup, get BIST information from AP stack
150 //
151 BistData = *(UINTN *) (PeiCpuMpData->Buffer + NumApsExecuting * PeiCpuMpData->CpuApStackSize - sizeof (UINTN));
152 PeiCpuMpData->CpuData[NumApsExecuting].Health.Uint32 = (UINT32) BistData;
153 PeiCpuMpData->CpuData[NumApsExecuting].ApicId = GetInitialApicId ();
154 if (PeiCpuMpData->CpuData[NumApsExecuting].ApicId >= 0xFF) {
155 //
156 // Set x2APIC mode if there are any logical processor reporting
157 // an APIC ID of 255 or greater.
158 //
159 AcquireSpinLock(&PeiCpuMpData->MpLock);
160 PeiCpuMpData->X2ApicEnable = TRUE;
161 ReleaseSpinLock(&PeiCpuMpData->MpLock);
162 }
163 //
164 // Sync BSP's Mtrr table to all wakeup APs and load microcode on APs.
165 //
166 MtrrSetAllMtrrs (&PeiCpuMpData->MtrrTable);
167 MicrocodeDetect ();
168 } else {
169 //
170 // Execute AP function if AP is not disabled
171 //
172 GetProcessorNumber (PeiCpuMpData, &ProcessorNumber);
173 if ((PeiCpuMpData->CpuData[ProcessorNumber].State != CpuStateDisabled) &&
174 (PeiCpuMpData->ApFunction != 0)) {
175 PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateBusy;
176 Procedure = (EFI_AP_PROCEDURE)(UINTN)PeiCpuMpData->ApFunction;
177 Procedure ((VOID *)(UINTN)PeiCpuMpData->ApFunctionArgument);
178 PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateIdle;
179 }
180 }
181
182 //
183 // AP finished executing C code
184 //
185 InterlockedIncrement ((UINT32 *)&PeiCpuMpData->FinishedCount);
186
187 AsmCliHltLoop ();
188 }
189
190 /**
191 This function will be called by BSP to wakeup AP.
192
193 @param PeiCpuMpData Pointer to PEI CPU MP Data
194 @param Broadcast TRUE: Send broadcast IPI to all APs
195 FALSE: Send IPI to AP by ApicId
196 @param ApicId Apic ID for the processor to be waked
197 @param Procedure The function to be invoked by AP
198 @param ProcedureArgument The argument to be passed into AP function
199 **/
200 VOID
201 WakeUpAP (
202 IN PEI_CPU_MP_DATA *PeiCpuMpData,
203 IN BOOLEAN Broadcast,
204 IN UINT32 ApicId,
205 IN EFI_AP_PROCEDURE Procedure, OPTIONAL
206 IN VOID *ProcedureArgument OPTIONAL
207 )
208 {
209 volatile MP_CPU_EXCHANGE_INFO *ExchangeInfo;
210
211 PeiCpuMpData->ApFunction = (UINTN) Procedure;
212 PeiCpuMpData->ApFunctionArgument = (UINTN) ProcedureArgument;
213 PeiCpuMpData->FinishedCount = 0;
214
215 ExchangeInfo = PeiCpuMpData->MpCpuExchangeInfo;
216 ExchangeInfo->Lock = 0;
217 ExchangeInfo->StackStart = PeiCpuMpData->Buffer;
218 ExchangeInfo->StackSize = PeiCpuMpData->CpuApStackSize;
219 ExchangeInfo->BufferStart = PeiCpuMpData->WakeupBuffer;
220 ExchangeInfo->PmodeOffset = PeiCpuMpData->AddressMap.PModeEntryOffset;
221 ExchangeInfo->LmodeOffset = PeiCpuMpData->AddressMap.LModeEntryOffset;
222 ExchangeInfo->Cr3 = AsmReadCr3 ();
223 ExchangeInfo->CFunction = (UINTN) ApCFunction;
224 ExchangeInfo->NumApsExecuting = 0;
225 ExchangeInfo->PeiCpuMpData = PeiCpuMpData;
226
227 //
228 // Get the BSP's data of GDT and IDT
229 //
230 CopyMem ((VOID *)&ExchangeInfo->GdtrProfile, &mGdt, sizeof(mGdt));
231 AsmReadIdtr ((IA32_DESCRIPTOR *) &ExchangeInfo->IdtrProfile);
232
233 if (Broadcast) {
234 SendInitSipiSipiAllExcludingSelf ((UINT32) ExchangeInfo->BufferStart);
235 } else {
236 SendInitSipiSipi (ApicId, (UINT32) ExchangeInfo->BufferStart);
237 }
238
239 return ;
240 }
241
242 /**
243 Get available system memory below 1MB by specified size.
244
245 @param WakeupBufferSize Wakeup buffer size required
246
247 @retval other Return wakeup buffer address below 1MB.
248 @retval -1 Cannot find free memory below 1MB.
249 **/
250 UINTN
251 GetWakeupBuffer (
252 IN UINTN WakeupBufferSize
253 )
254 {
255 EFI_PEI_HOB_POINTERS Hob;
256 UINTN WakeupBufferStart;
257 UINTN WakeupBufferEnd;
258
259 //
260 // Get the HOB list for processing
261 //
262 Hob.Raw = GetHobList ();
263
264 //
265 // Collect memory ranges
266 //
267 while (!END_OF_HOB_LIST (Hob)) {
268 if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
269 if ((Hob.ResourceDescriptor->PhysicalStart < BASE_1MB) &&
270 (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) &&
271 ((Hob.ResourceDescriptor->ResourceAttribute &
272 (EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED |
273 EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED |
274 EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED
275 )) == 0)
276 ) {
277 //
278 // Need memory under 1MB to be collected here
279 //
280 WakeupBufferEnd = (UINTN) (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength);
281 if (WakeupBufferEnd > BASE_1MB) {
282 //
283 // Wakeup buffer should be under 1MB
284 //
285 WakeupBufferEnd = BASE_1MB;
286 }
287 //
288 // Wakeup buffer should be aligned on 4KB
289 //
290 WakeupBufferStart = (WakeupBufferEnd - WakeupBufferSize) & ~(SIZE_4KB - 1);
291 if (WakeupBufferStart < Hob.ResourceDescriptor->PhysicalStart) {
292 continue;
293 }
294 //
295 // Create a memory allocation HOB.
296 //
297 BuildMemoryAllocationHob (
298 WakeupBufferStart,
299 WakeupBufferSize,
300 EfiBootServicesData
301 );
302 return WakeupBufferStart;
303 }
304 }
305 //
306 // Find the next HOB
307 //
308 Hob.Raw = GET_NEXT_HOB (Hob);
309 }
310
311 return (UINTN) -1;
312 }
313
314 /**
315 Get available system memory below 1MB by specified size.
316
317 @param PeiCpuMpData Pointer to PEI CPU MP Data
318 **/
319 VOID
320 BackupAndPrepareWakeupBuffer(
321 IN PEI_CPU_MP_DATA *PeiCpuMpData
322 )
323 {
324 CopyMem (
325 (VOID *) PeiCpuMpData->BackupBuffer,
326 (VOID *) PeiCpuMpData->WakeupBuffer,
327 PeiCpuMpData->BackupBufferSize
328 );
329 CopyMem (
330 (VOID *) PeiCpuMpData->WakeupBuffer,
331 (VOID *) PeiCpuMpData->AddressMap.RendezvousFunnelAddress,
332 PeiCpuMpData->AddressMap.RendezvousFunnelSize
333 );
334 }
335
336 /**
337 Restore wakeup buffer data.
338
339 @param PeiCpuMpData Pointer to PEI CPU MP Data
340 **/
341 VOID
342 RestoreWakeupBuffer(
343 IN PEI_CPU_MP_DATA *PeiCpuMpData
344 )
345 {
346 CopyMem ((VOID *) PeiCpuMpData->WakeupBuffer, (VOID *) PeiCpuMpData->BackupBuffer, PeiCpuMpData->BackupBufferSize);
347 }
348
349 /**
350 This function will get CPU count in the system.
351
352 @param PeiCpuMpData Pointer to PEI CPU MP Data
353
354 @return AP processor count
355 **/
356 UINT32
357 CountProcessorNumber (
358 IN PEI_CPU_MP_DATA *PeiCpuMpData
359 )
360 {
361 //
362 // Load Microcode on BSP
363 //
364 MicrocodeDetect ();
365 //
366 // Store BSP's MTRR setting
367 //
368 MtrrGetAllMtrrs (&PeiCpuMpData->MtrrTable);
369
370 //
371 // Only perform AP detection if PcdCpuMaxLogicalProcessorNumber is greater than 1
372 //
373 if (PcdGet32 (PcdCpuMaxLogicalProcessorNumber) > 1) {
374 //
375 // Send 1st broadcast IPI to APs to wakeup APs
376 //
377 PeiCpuMpData->InitFlag = TRUE;
378 PeiCpuMpData->X2ApicEnable = FALSE;
379 WakeUpAP (PeiCpuMpData, TRUE, 0, NULL, NULL);
380 //
381 // Wait for AP task to complete and then exit.
382 //
383 MicroSecondDelay (PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds));
384 PeiCpuMpData->InitFlag = FALSE;
385 PeiCpuMpData->CpuCount += (UINT32)PeiCpuMpData->MpCpuExchangeInfo->NumApsExecuting;
386 ASSERT (PeiCpuMpData->CpuCount <= PcdGet32 (PcdCpuMaxLogicalProcessorNumber));
387 //
388 // Sort BSP/Aps by CPU APIC ID in ascending order
389 //
390 SortApicId (PeiCpuMpData);
391 }
392
393 DEBUG ((EFI_D_INFO, "CpuMpPei: Find %d processors in system.\n", PeiCpuMpData->CpuCount));
394 return PeiCpuMpData->CpuCount;
395 }
396
397 /**
398 Prepare for AP wakeup buffer and copy AP reset code into it.
399
400 Get wakeup buffer below 1MB. Allocate memory for CPU MP Data and APs Stack.
401
402 @return Pointer to PEI CPU MP Data
403 **/
404 PEI_CPU_MP_DATA *
405 PrepareAPStartupVector (
406 VOID
407 )
408 {
409 EFI_STATUS Status;
410 UINT32 MaxCpuCount;
411 PEI_CPU_MP_DATA *PeiCpuMpData;
412 EFI_PHYSICAL_ADDRESS Buffer;
413 UINTN BufferSize;
414 UINTN WakeupBuffer;
415 UINTN WakeupBufferSize;
416 MP_ASSEMBLY_ADDRESS_MAP AddressMap;
417
418 AsmGetAddressMap (&AddressMap);
419 WakeupBufferSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);
420 WakeupBuffer = GetWakeupBuffer ((WakeupBufferSize + SIZE_4KB - 1) & ~(SIZE_4KB - 1));
421 ASSERT (WakeupBuffer != (UINTN) -1);
422 DEBUG ((EFI_D_INFO, "CpuMpPei: WakeupBuffer = 0x%x\n", WakeupBuffer));
423
424 //
425 // Allocate Pages for APs stack, CPU MP Data and backup buffer for wakeup buffer
426 //
427 MaxCpuCount = PcdGet32(PcdCpuMaxLogicalProcessorNumber);
428 BufferSize = PcdGet32 (PcdCpuApStackSize) * MaxCpuCount + sizeof (PEI_CPU_MP_DATA)
429 + WakeupBufferSize + sizeof (PEI_CPU_DATA) * MaxCpuCount;
430 Status = PeiServicesAllocatePages (
431 EfiBootServicesData,
432 EFI_SIZE_TO_PAGES (BufferSize),
433 &Buffer
434 );
435 ASSERT_EFI_ERROR (Status);
436
437 PeiCpuMpData = (PEI_CPU_MP_DATA *) (UINTN) (Buffer + PcdGet32 (PcdCpuApStackSize) * MaxCpuCount);
438 PeiCpuMpData->Buffer = (UINTN) Buffer;
439 PeiCpuMpData->CpuApStackSize = PcdGet32 (PcdCpuApStackSize);
440 PeiCpuMpData->WakeupBuffer = WakeupBuffer;
441 PeiCpuMpData->BackupBuffer = (UINTN)PeiCpuMpData + sizeof (PEI_CPU_MP_DATA);
442 PeiCpuMpData->BackupBufferSize = WakeupBufferSize;
443 PeiCpuMpData->MpCpuExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (WakeupBuffer + AddressMap.RendezvousFunnelSize);
444
445 PeiCpuMpData->CpuCount = 1;
446 PeiCpuMpData->BspNumber = 0;
447 PeiCpuMpData->CpuData = (PEI_CPU_DATA *) (PeiCpuMpData->BackupBuffer +
448 PeiCpuMpData->BackupBufferSize);
449 PeiCpuMpData->CpuData[0].ApicId = GetInitialApicId ();
450 PeiCpuMpData->CpuData[0].Health.Uint32 = 0;
451 PeiCpuMpData->EndOfPeiFlag = FALSE;
452 InitializeSpinLock(&PeiCpuMpData->MpLock);
453 CopyMem (&PeiCpuMpData->AddressMap, &AddressMap, sizeof (MP_ASSEMBLY_ADDRESS_MAP));
454
455 //
456 // Backup original data and copy AP reset code in it
457 //
458 BackupAndPrepareWakeupBuffer(PeiCpuMpData);
459
460 return PeiCpuMpData;
461 }
462
463 /**
464 Notify function on End Of Pei PPI.
465
466 On S3 boot, this function will restore wakeup buffer data.
467 On normal boot, this function will flag wakeup buffer to be un-used type.
468
469 @param PeiServices The pointer to the PEI Services Table.
470 @param NotifyDescriptor Address of the notification descriptor data structure.
471 @param Ppi Address of the PPI that was installed.
472
473 @retval EFI_SUCCESS When everything is OK.
474
475 **/
476 EFI_STATUS
477 EFIAPI
478 CpuMpEndOfPeiCallback (
479 IN EFI_PEI_SERVICES **PeiServices,
480 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
481 IN VOID *Ppi
482 )
483 {
484 EFI_STATUS Status;
485 EFI_BOOT_MODE BootMode;
486 PEI_CPU_MP_DATA *PeiCpuMpData;
487 EFI_PEI_HOB_POINTERS Hob;
488 EFI_HOB_MEMORY_ALLOCATION *MemoryHob;
489
490 DEBUG ((EFI_D_INFO, "CpuMpPei: CpuMpEndOfPeiCallback () invokded\n"));
491
492 Status = PeiServicesGetBootMode (&BootMode);
493 ASSERT_EFI_ERROR (Status);
494
495 PeiCpuMpData = GetMpHobData ();
496 ASSERT (PeiCpuMpData != NULL);
497
498 if (BootMode != BOOT_ON_S3_RESUME) {
499 //
500 // Get the HOB list for processing
501 //
502 Hob.Raw = GetHobList ();
503 //
504 // Collect memory ranges
505 //
506 while (!END_OF_HOB_LIST (Hob)) {
507 if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
508 MemoryHob = Hob.MemoryAllocation;
509 if(MemoryHob->AllocDescriptor.MemoryBaseAddress == PeiCpuMpData->WakeupBuffer) {
510 //
511 // Flag this HOB type to un-used
512 //
513 GET_HOB_TYPE (Hob) = EFI_HOB_TYPE_UNUSED;
514 break;
515 }
516 }
517 Hob.Raw = GET_NEXT_HOB (Hob);
518 }
519 } else {
520 RestoreWakeupBuffer (PeiCpuMpData);
521 PeiCpuMpData->EndOfPeiFlag = TRUE;
522 }
523 return EFI_SUCCESS;
524 }
525
526 /**
527 The Entry point of the MP CPU PEIM.
528
529 This function will wakeup APs and collect CPU AP count and install the
530 Mp Service Ppi.
531
532 @param FileHandle Handle of the file being invoked.
533 @param PeiServices Describes the list of possible PEI Services.
534
535 @retval EFI_SUCCESS MpServicePpi is installed successfully.
536
537 **/
538 EFI_STATUS
539 EFIAPI
540 CpuMpPeimInit (
541 IN EFI_PEI_FILE_HANDLE FileHandle,
542 IN CONST EFI_PEI_SERVICES **PeiServices
543 )
544 {
545 EFI_STATUS Status;
546 PEI_CPU_MP_DATA *PeiCpuMpData;
547 UINT32 ProcessorCount;
548
549 //
550 // Load new GDT table on BSP
551 //
552 AsmInitializeGdt (&mGdt);
553 //
554 // Get wakeup buffer and copy AP reset code in it
555 //
556 PeiCpuMpData = PrepareAPStartupVector ();
557 //
558 // Count processor number and collect processor information
559 //
560 ProcessorCount = CountProcessorNumber (PeiCpuMpData);
561 //
562 // Build location of PEI CPU MP DATA buffer in HOB
563 //
564 BuildGuidDataHob (
565 &gEfiCallerIdGuid,
566 (VOID *)&PeiCpuMpData,
567 sizeof(UINT64)
568 );
569 //
570 // Update and publish CPU BIST information
571 //
572 CollectBistDataFromPpi (PeiServices, PeiCpuMpData);
573 //
574 // register an event for EndOfPei
575 //
576 Status = PeiServicesNotifyPpi (&mNotifyList);
577 ASSERT_EFI_ERROR (Status);
578 //
579 // Install CPU MP PPI
580 //
581 Status = PeiServicesInstallPpi(&mPeiCpuMpPpiDesc);
582 ASSERT_EFI_ERROR (Status);
583
584 return Status;
585 }