]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuFeatures/CpuFeaturesPei.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UefiCpuPkg / CpuFeatures / CpuFeaturesPei.c
index b052d554a91985bce7d0946200fb9d359d340447..8448668e5ad1bd50f2a1c879ab35272e69bc6e48 100644 (file)
@@ -2,13 +2,7 @@
   CPU Features PEIM driver to initialize CPU features.\r
 \r
   Copyright (c) 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
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/PeiServicesLib.h>\r
 #include <Library/RegisterCpuFeaturesLib.h>\r
+#include <Library/HobLib.h>\r
 \r
 #include <Guid/CpuFeaturesInitDone.h>\r
 \r
-EFI_PEI_PPI_DESCRIPTOR           mPeiCpuFeaturesInitDonePpiDesc = {\r
+EFI_PEI_PPI_DESCRIPTOR  mPeiCpuFeaturesInitDonePpiDesc = {\r
   (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
   &gEdkiiCpuFeaturesInitDoneGuid,\r
   NULL\r
@@ -45,14 +40,15 @@ CpuFeaturesPeimInitialize (
   IN CONST EFI_PEI_SERVICES     **PeiServices\r
   )\r
 {\r
-  EFI_STATUS                 Status;\r
-  EFI_BOOT_MODE              BootMode;\r
+  EFI_STATUS     Status;\r
+  EFI_BOOT_MODE  BootMode;\r
 \r
   Status = PeiServicesGetBootMode (&BootMode);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  if (BootMode == BOOT_ON_S3_RESUME &&\r
-      !PcdGetBool (PcdCpuFeaturesInitOnS3Resume)) {\r
+  if ((BootMode == BOOT_ON_S3_RESUME) &&\r
+      !PcdGetBool (PcdCpuFeaturesInitOnS3Resume))\r
+  {\r
     //\r
     // Does nothing when if PcdCpuFeaturesInitOnS3Resume is FLASE\r
     // on S3 boot mode\r
@@ -67,9 +63,13 @@ CpuFeaturesPeimInitialize (
   //\r
   // Install CPU Features Init Done PPI\r
   //\r
-  Status = PeiServicesInstallPpi(&mPeiCpuFeaturesInitDonePpiDesc);\r
+  Status = PeiServicesInstallPpi (&mPeiCpuFeaturesInitDonePpiDesc);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  //\r
+  // Build HOB to let CpuFeatureDxe driver skip the initialization process.\r
+  //\r
+  BuildGuidHob (&gEdkiiCpuFeaturesInitDoneGuid, 0);\r
+\r
   return EFI_SUCCESS;\r
 }\r
-\r