]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuMpPei/CpuMpPei.c
UefiCpuPkg/CpuMpPei: Remove un-used variables and functions
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / CpuMpPei.c
index ef1c2812e2bf7f0ca620ecde61102bdd0e9592ad..bfaaa7a6b0c660052f5ce44c47f8e95891607599 100644 (file)
 \r
 #include "CpuMpPei.h"\r
 \r
-//\r
-// Global Descriptor Table (GDT)\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT mGdtEntries[] = {\r
-/* selector { Global Segment Descriptor                              } */\r
-/* 0x00 */  {{0,      0,  0,  0,    0,  0,  0,  0,    0,  0, 0,  0,  0}}, //null descriptor\r
-/* 0x08 */  {{0xffff, 0,  0,  0x2,  1,  0,  1,  0xf,  0,  0, 1,  1,  0}}, //linear data segment descriptor\r
-/* 0x10 */  {{0xffff, 0,  0,  0xf,  1,  0,  1,  0xf,  0,  0, 1,  1,  0}}, //linear code segment descriptor\r
-/* 0x18 */  {{0xffff, 0,  0,  0x3,  1,  0,  1,  0xf,  0,  0, 1,  1,  0}}, //system data segment descriptor\r
-/* 0x20 */  {{0xffff, 0,  0,  0xa,  1,  0,  1,  0xf,  0,  0, 1,  1,  0}}, //system code segment descriptor\r
-/* 0x28 */  {{0,      0,  0,  0,    0,  0,  0,  0,    0,  0, 0,  0,  0}}, //spare segment descriptor\r
-/* 0x30 */  {{0xffff, 0,  0,  0x2,  1,  0,  1,  0xf,  0,  0, 1,  1,  0}}, //system data segment descriptor\r
-/* 0x38 */  {{0xffff, 0,  0,  0xa,  1,  0,  1,  0xf,  0,  1, 0,  1,  0}}, //system code segment descriptor\r
-/* 0x40 */  {{0,      0,  0,  0,    0,  0,  0,  0,    0,  0, 0,  0,  0}}, //spare segment descriptor\r
-};\r
-\r
-//\r
-// IA32 Gdt register\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED IA32_DESCRIPTOR mGdt = {\r
-  sizeof (mGdtEntries) - 1,\r
-  (UINTN) mGdtEntries\r
-  };\r
-\r
 GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {\r
   (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
   &gEfiEndOfPeiSignalPpiGuid,\r
@@ -302,7 +278,7 @@ ApCFunction (
       // Sync BSP's Mtrr table to all wakeup APs and load microcode on APs.\r
       //\r
       MtrrSetAllMtrrs (&PeiCpuMpData->MtrrTable);\r
-      MicrocodeDetect ();\r
+      MicrocodeDetect (PeiCpuMpData);\r
       PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateIdle;\r
     } else {\r
       //\r
@@ -455,6 +431,8 @@ WakeUpAP (
   ExchangeInfo->PmodeOffset        = PeiCpuMpData->AddressMap.PModeEntryOffset;\r
   ExchangeInfo->LmodeOffset        = PeiCpuMpData->AddressMap.LModeEntryOffset;\r
   ExchangeInfo->Cr3                = AsmReadCr3 ();\r
+  ExchangeInfo->CodeSegment        = AsmReadCs ();\r
+  ExchangeInfo->DataSegment        = AsmReadDs ();\r
   ExchangeInfo->CFunction          = (UINTN) ApCFunction;\r
   ExchangeInfo->NumApsExecuting    = 0;\r
   ExchangeInfo->PeiCpuMpData       = PeiCpuMpData;\r
@@ -462,7 +440,7 @@ WakeUpAP (
   //\r
   // Get the BSP's data of GDT and IDT\r
   //\r
-  CopyMem ((VOID *)&ExchangeInfo->GdtrProfile, &mGdt, sizeof(mGdt));\r
+  AsmReadGdtr ((IA32_DESCRIPTOR *) &ExchangeInfo->GdtrProfile);\r
   AsmReadIdtr ((IA32_DESCRIPTOR *) &ExchangeInfo->IdtrProfile);\r
 \r
   if (PeiCpuMpData->ApLoopMode == ApInMwaitLoop) {\r
@@ -624,7 +602,7 @@ CountProcessorNumber (
   //\r
   // Load Microcode on BSP\r
   //\r
-  MicrocodeDetect ();\r
+  MicrocodeDetect (PeiCpuMpData);\r
   //\r
   // Store BSP's MTRR setting\r
   //\r
@@ -852,13 +830,26 @@ CpuMpPeimInit (
   IN CONST EFI_PEI_SERVICES     **PeiServices\r
   )\r
 {\r
-  EFI_STATUS           Status;\r
-  PEI_CPU_MP_DATA      *PeiCpuMpData;\r
+  EFI_STATUS                       Status;\r
+  PEI_CPU_MP_DATA                 *PeiCpuMpData;\r
+  EFI_VECTOR_HANDOFF_INFO         *VectorInfo;\r
+  EFI_PEI_VECTOR_HANDOFF_INFO_PPI *VectorHandoffInfoPpi;\r
 \r
   //\r
-  // Load new GDT table on BSP\r
+  // Get Vector Hand-off Info PPI\r
   //\r
-  AsmInitializeGdt (&mGdt);\r
+  VectorInfo = NULL;\r
+  Status = PeiServicesLocatePpi (\r
+             &gEfiVectorHandoffInfoPpiGuid,\r
+             0,\r
+             NULL,\r
+             (VOID **)&VectorHandoffInfoPpi\r
+             );\r
+  if (Status == EFI_SUCCESS) {\r
+    VectorInfo = VectorHandoffInfoPpi->Info;\r
+  }\r
+  Status = InitializeCpuExceptionHandlers (VectorInfo);\r
+  ASSERT_EFI_ERROR (Status);\r
   //\r
   // Get wakeup buffer and copy AP reset code in it\r
   //\r