]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MpInitLib: needn't to allocate AP reset vector
authorJeff Fan <jeff.fan@intel.com>
Fri, 21 Apr 2017 03:00:59 +0000 (11:00 +0800)
committerJeff Fan <jeff.fan@intel.com>
Wed, 26 Apr 2017 00:55:44 +0000 (08:55 +0800)
Because we will always borrow the AP reset vector space for AP waking up. We
needn't allocate such range to prevent other module to use it. It could simply
the code.

https://bugzilla.tianocore.org/show_bug.cgi?id=500

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
UefiCpuPkg/Library/MpInitLib/MpLib.h
UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
UefiCpuPkg/Library/MpInitLib/PeiMpLib.c

index 7a272d78ec3376ae9157d499099753eb690bd055..989b3f809076ee44b6a9c1d629b7386a382eb6b9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Common header file for MP Initialize Library.\r
 \r
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -541,26 +541,6 @@ IsMwaitSupport (
   VOID\r
   );\r
 \r
-/**\r
-  Notify function on End Of PEI PPI.\r
-\r
-  On S3 boot, this function will restore wakeup buffer data.\r
-  On normal boot, this function will flag wakeup buffer to be un-used type.\r
-\r
-  @param[in]  PeiServices        The pointer to the PEI Services Table.\r
-  @param[in]  NotifyDescriptor   Address of the notification descriptor data structure.\r
-  @param[in]  Ppi                Address of the PPI that was installed.\r
-\r
-  @retval EFI_SUCCESS        When everything is OK.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CpuMpEndOfPeiCallback (\r
-  IN EFI_PEI_SERVICES             **PeiServices,\r
-  IN EFI_PEI_NOTIFY_DESCRIPTOR    *NotifyDescriptor,\r
-  IN VOID                         *Ppi\r
-  );\r
-\r
 /**\r
   Get available system memory below 1MB by specified size.\r
 \r
index 0c6873da79db0dfe0b7be76f2f74e6da074df0c1..fa84e392af1d72d3fbfdd8c01519c73c2ac0fb89 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  MP Initialize Library instance for PEI driver.\r
 #\r
-#  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
   LocalApicLib\r
   MemoryAllocationLib\r
   HobLib\r
-  PeiServicesLib\r
   MtrrLib\r
   CpuLib\r
   UefiCpuLib\r
   SynchronizationLib\r
 \r
-[Ppis]\r
-  gEfiEndOfPeiSignalPpiGuid                     ## NOTIFY\r
-\r
 [Pcd]\r
   gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber        ## CONSUMES\r
   gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds      ## CONSUMES\r
index 5ce5788125c4ce5a603ba19ee5e3abb54ea1a299..9ee5aca57b2bb41aa8dd85793dc9434a247fd338 100644 (file)
 **/\r
 \r
 #include "MpLib.h"\r
-#include <Ppi/EndOfPeiPhase.h>\r
-#include <Library/PeiServicesLib.h>\r
-\r
-//\r
-// Global PEI notify function descriptor on EndofPei event\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mMpInitLibNotifyList = {\r
-  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
-  &gEfiEndOfPeiSignalPpiGuid,\r
-  CpuMpEndOfPeiCallback\r
-};\r
-\r
 \r
 /**\r
   Enable Debug Agent to support source debugging on AP function.\r
@@ -76,64 +64,6 @@ SaveCpuMpData (
     );\r
 }\r
 \r
-/**\r
-  Notify function on End Of PEI PPI.\r
-\r
-  On S3 boot, this function will restore wakeup buffer data.\r
-  On normal boot, this function will flag wakeup buffer to be un-used type.\r
-\r
-  @param[in]  PeiServices        The pointer to the PEI Services Table.\r
-  @param[in]  NotifyDescriptor   Address of the notification descriptor data structure.\r
-  @param[in]  Ppi                Address of the PPI that was installed.\r
-\r
-  @retval EFI_SUCCESS        When everything is OK.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CpuMpEndOfPeiCallback (\r
-  IN EFI_PEI_SERVICES             **PeiServices,\r
-  IN EFI_PEI_NOTIFY_DESCRIPTOR    *NotifyDescriptor,\r
-  IN VOID                         *Ppi\r
-  )\r
-{\r
-  EFI_STATUS                Status;\r
-  EFI_BOOT_MODE             BootMode;\r
-  CPU_MP_DATA               *CpuMpData;\r
-  EFI_PEI_HOB_POINTERS      Hob;\r
-  EFI_HOB_MEMORY_ALLOCATION *MemoryHob;\r
-\r
-  DEBUG ((DEBUG_INFO, "PeiMpInitLib: CpuMpEndOfPeiCallback () invoked\n"));\r
-\r
-  Status = PeiServicesGetBootMode (&BootMode);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  CpuMpData = GetCpuMpData ();\r
-  if (BootMode != BOOT_ON_S3_RESUME) {\r
-    //\r
-    // Get the HOB list for processing\r
-    //\r
-    Hob.Raw = GetHobList ();\r
-    //\r
-    // Collect memory ranges\r
-    //\r
-    while (!END_OF_HOB_LIST (Hob)) {\r
-      if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {\r
-        MemoryHob = Hob.MemoryAllocation;\r
-        if (MemoryHob->AllocDescriptor.MemoryBaseAddress == CpuMpData->WakeupBuffer) {\r
-          //\r
-          // Flag this HOB type to un-used\r
-          //\r
-          GET_HOB_TYPE (Hob) = EFI_HOB_TYPE_UNUSED;\r
-          break;\r
-        }\r
-      }\r
-      Hob.Raw = GET_NEXT_HOB (Hob);\r
-    }\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
 /**\r
   Check if AP wakeup buffer is overlapped with existing allocated buffer.\r
 \r
@@ -244,14 +174,6 @@ GetWakeupBuffer (
           }\r
           DEBUG ((DEBUG_INFO, "WakeupBufferStart = %x, WakeupBufferSize = %x\n",\r
                                WakeupBufferStart, WakeupBufferSize));\r
-          //\r
-          // Create a memory allocation HOB.\r
-          //\r
-          BuildMemoryAllocationHob (\r
-            WakeupBufferStart,\r
-            WakeupBufferSize,\r
-            EfiBootServicesData\r
-            );\r
           return WakeupBufferStart;\r
         }\r
       }\r
@@ -322,22 +244,7 @@ InitMpGlobalData (
   IN CPU_MP_DATA               *CpuMpData\r
   )\r
 {\r
-  EFI_STATUS      Status;\r
-\r
   SaveCpuMpData (CpuMpData);\r
-\r
-  if (CpuMpData->CpuCount == 1) {\r
-    //\r
-    // If only BSP exists, return\r
-    //\r
-    return;\r
-  }\r
-\r
-  //\r
-  // Register an event for EndOfPei\r
-  //\r
-  Status  = PeiServicesNotifyPpi (&mMpInitLibNotifyList);\r
-  ASSERT_EFI_ERROR (Status);\r
 }\r
 \r
 /**\r