]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/SecCore/SecMain.c
UefiCpuPkg: support single EFI_PEI_CORE_FV_LOCATION_PPI in PpiList
[mirror_edk2.git] / UefiCpuPkg / SecCore / SecMain.c
index 14696c81a5486cee036153e176483416995e6043..5d5e7f17dced59c9f2253d7b2b14d53cf7784d42 100644 (file)
@@ -2,13 +2,7 @@
   C functions in SEC\r
 \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
-  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
@@ -234,7 +228,6 @@ SecStartupPhase2(
 \r
   PeiCoreEntryPoint = NULL;\r
   SecCoreData   = (EFI_SEC_PEI_HAND_OFF *) Context;\r
-  AllSecPpiList = (EFI_PEI_PPI_DESCRIPTOR *) SecCoreData->PeiTemporaryRamBase;\r
 \r
   //\r
   // Perform platform specific initialization before entering PeiCore.\r
@@ -245,9 +238,8 @@ SecStartupPhase2(
   // is enabled.\r
   //\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
+    Index = 0;\r
+    do {\r
       if (CompareGuid (PpiList[Index].Guid, &gEfiPeiCoreFvLocationPpiGuid) &&\r
           (((EFI_PEI_CORE_FV_LOCATION_PPI *) PpiList[Index].Ppi)->PeiCoreFvLocation != 0)\r
          ) {\r
@@ -263,12 +255,12 @@ SecStartupPhase2(
           break;\r
         } else {\r
           //\r
-          // PeiCore not found\r
+          // Invalid PeiCore FV provided by platform\r
           //\r
           CpuDeadLoop ();\r
         }\r
       }\r
-    }\r
+    } while ((PpiList[Index++].Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) != EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);\r
   }\r
   //\r
   // If EFI_PEI_CORE_FV_LOCATION_PPI not found, try to locate PeiCore from BFV.\r
@@ -288,6 +280,8 @@ SecStartupPhase2(
   }\r
 \r
   if (PpiList != NULL) {\r
+    AllSecPpiList = (EFI_PEI_PPI_DESCRIPTOR *) SecCoreData->PeiTemporaryRamBase;\r
+\r
     //\r
     // Remove the terminal flag from the terminal PPI\r
     //\r