]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/SecCore: Support EFI_PEI_CORE_FV_LOCATION_PPI
authorChasel, Chiu <chasel.chiu@intel.com>
Tue, 12 Feb 2019 12:38:08 +0000 (20:38 +0800)
committerChasel, Chiu <chasel.chiu@intel.com>
Fri, 15 Feb 2019 05:42:34 +0000 (13:42 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1524

EFI_PEI_CORE_FV_LOCATION_PPI may be passed by platform
when PeiCore not in BFV so SecCore has to search PeiCore
either from the FV location provided by
EFI_PEI_CORE_FV_LOCATION_PPI or from BFV.

Test: Verified on internal platform and booting successfully.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
UefiCpuPkg/SecCore/SecCore.inf
UefiCpuPkg/SecCore/SecMain.c
UefiCpuPkg/SecCore/SecMain.h

index 442f66391162fb360aaa0f1b8d77cd9824ad4002..fc1485b5cbe07e6f0956a2b16758f93b9dbb7318 100644 (file)
@@ -7,7 +7,7 @@
 #  protected mode, setup flat memory model, enable temporary memory and\r
 #  call into SecStartup().\r
 #\r
-#  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2019, 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
@@ -73,6 +73,7 @@
   ## NOTIFY\r
   ## SOMETIMES_CONSUMES\r
   gPeiSecPerformancePpiGuid\r
+  gEfiPeiCoreFvLocationPpiGuid\r
 \r
 [Guids]\r
   ## SOMETIMES_PRODUCES   ## HOB\r
index b24e190617764ed244344b21dc071303110225e3..d84eb675f593e253a3dac87ccc50693d4f491cdf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   C functions in SEC\r
 \r
-  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2008 - 2019, 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
@@ -232,22 +232,45 @@ SecStartupPhase2(
   EFI_PEI_PPI_DESCRIPTOR      *AllSecPpiList;\r
   EFI_PEI_CORE_ENTRY_POINT    PeiCoreEntryPoint;\r
 \r
+  PeiCoreEntryPoint = NULL;\r
   SecCoreData   = (EFI_SEC_PEI_HAND_OFF *) Context;\r
   AllSecPpiList = (EFI_PEI_PPI_DESCRIPTOR *) SecCoreData->PeiTemporaryRamBase;\r
+\r
   //\r
   // Find Pei Core entry point. It will report SEC and Pei Core debug information if remote debug\r
   // is enabled.\r
   //\r
-  FindAndReportEntryPoints ((EFI_FIRMWARE_VOLUME_HEADER *) SecCoreData->BootFirmwareVolumeBase, &PeiCoreEntryPoint);\r
-  if (PeiCoreEntryPoint == NULL)\r
-  {\r
-    CpuDeadLoop ();\r
+  PpiList = SecPlatformMain (SecCoreData);\r
+  if (PpiList != NULL) {\r
+    for (Index = 0;\r
+      (PpiList[Index].Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) != EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;\r
+      Index++) {\r
+      if (CompareGuid (PpiList[Index].Guid, &gEfiPeiCoreFvLocationPpiGuid) && (((EFI_PEI_CORE_FV_LOCATION_PPI *) PpiList[Index].Ppi)->PeiCoreFvLocation != 0)) {\r
+        FindAndReportEntryPoints ((EFI_FIRMWARE_VOLUME_HEADER *) ((EFI_PEI_CORE_FV_LOCATION_PPI *) PpiList[Index].Ppi)->PeiCoreFvLocation, &PeiCoreEntryPoint);\r
+        if (PeiCoreEntryPoint != NULL) {\r
+          break;\r
+        } else {\r
+          //\r
+          // PeiCore not found\r
+          //\r
+          CpuDeadLoop ();\r
+        }\r
+      }\r
+    }\r
+  }\r
+  //\r
+  // If EFI_PEI_CORE_FV_LOCATION_PPI not found, try to locate PeiCore from BFV.\r
+  //\r
+  if (PeiCoreEntryPoint == NULL) {\r
+    FindAndReportEntryPoints ((EFI_FIRMWARE_VOLUME_HEADER *) SecCoreData->BootFirmwareVolumeBase, &PeiCoreEntryPoint);\r
+    if (PeiCoreEntryPoint == NULL) {\r
+      CpuDeadLoop ();\r
+    }\r
   }\r
 \r
   //\r
   // Perform platform specific initialization before entering PeiCore.\r
   //\r
-  PpiList = SecPlatformMain (SecCoreData);\r
   if (PpiList != NULL) {\r
     //\r
     // Remove the terminal flag from the terminal PPI\r
index 83244af1197149fe2c808ca2a0a7299f6e52baac..80045d34f445a1e68a82242625db3bde882d185f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Master header file for SecCore.\r
 \r
-  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2008 - 2019, 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
@@ -20,6 +20,7 @@
 #include <Ppi/SecPlatformInformation2.h>\r
 #include <Ppi/TemporaryRamDone.h>\r
 #include <Ppi/SecPerformance.h>\r
+#include <Ppi/PeiCoreFvLocation.h>\r
 \r
 #include <Guid/FirmwarePerformance.h>\r
 \r