From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=chasel.chiu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5295920886D99 for ; Thu, 14 Feb 2019 02:59:18 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2019 02:59:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,368,1544515200"; d="scan'208";a="116151291" Received: from cchiu4-mobl1.gar.corp.intel.com ([10.5.240.60]) by orsmga006.jf.intel.com with ESMTP; 14 Feb 2019 02:59:16 -0800 From: "Chasel, Chiu" To: edk2-devel@lists.01.org Cc: Eric Dong , Ray Ni , Laszlo Ersek , Chasel Chiu Date: Thu, 14 Feb 2019 18:58:58 +0800 Message-Id: <20190214105858.5580-4-chasel.chiu@intel.com> X-Mailer: git-send-email 2.13.3.windows.1 In-Reply-To: <20190214105858.5580-1-chasel.chiu@intel.com> References: <20190214105858.5580-1-chasel.chiu@intel.com> Subject: [PATCH v3 3/3] UefiCpuPkg/SecCore: Support EFI_PEI_CORE_FV_LOCATION_PPI X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2019 10:59:18 -0000 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 Cc: Ray Ni Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu --- UefiCpuPkg/SecCore/SecMain.c | 35 +++++++++++++++++++++++++++++------ UefiCpuPkg/SecCore/SecCore.inf | 3 ++- UefiCpuPkg/SecCore/SecMain.h | 3 ++- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index b24e190617..d84eb675f5 100644 --- a/UefiCpuPkg/SecCore/SecMain.c +++ b/UefiCpuPkg/SecCore/SecMain.c @@ -1,7 +1,7 @@ /** @file C functions in SEC - Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -232,22 +232,45 @@ SecStartupPhase2( EFI_PEI_PPI_DESCRIPTOR *AllSecPpiList; EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint; + PeiCoreEntryPoint = NULL; SecCoreData = (EFI_SEC_PEI_HAND_OFF *) Context; AllSecPpiList = (EFI_PEI_PPI_DESCRIPTOR *) SecCoreData->PeiTemporaryRamBase; + // // Find Pei Core entry point. It will report SEC and Pei Core debug information if remote debug // is enabled. // - FindAndReportEntryPoints ((EFI_FIRMWARE_VOLUME_HEADER *) SecCoreData->BootFirmwareVolumeBase, &PeiCoreEntryPoint); - if (PeiCoreEntryPoint == NULL) - { - CpuDeadLoop (); + PpiList = SecPlatformMain (SecCoreData); + if (PpiList != NULL) { + for (Index = 0; + (PpiList[Index].Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) != EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; + Index++) { + if (CompareGuid (PpiList[Index].Guid, &gEfiPeiCoreFvLocationPpiGuid) && (((EFI_PEI_CORE_FV_LOCATION_PPI *) PpiList[Index].Ppi)->PeiCoreFvLocation != 0)) { + FindAndReportEntryPoints ((EFI_FIRMWARE_VOLUME_HEADER *) ((EFI_PEI_CORE_FV_LOCATION_PPI *) PpiList[Index].Ppi)->PeiCoreFvLocation, &PeiCoreEntryPoint); + if (PeiCoreEntryPoint != NULL) { + break; + } else { + // + // PeiCore not found + // + CpuDeadLoop (); + } + } + } + } + // + // If EFI_PEI_CORE_FV_LOCATION_PPI not found, try to locate PeiCore from BFV. + // + if (PeiCoreEntryPoint == NULL) { + FindAndReportEntryPoints ((EFI_FIRMWARE_VOLUME_HEADER *) SecCoreData->BootFirmwareVolumeBase, &PeiCoreEntryPoint); + if (PeiCoreEntryPoint == NULL) { + CpuDeadLoop (); + } } // // Perform platform specific initialization before entering PeiCore. // - PpiList = SecPlatformMain (SecCoreData); if (PpiList != NULL) { // // Remove the terminal flag from the terminal PPI diff --git a/UefiCpuPkg/SecCore/SecCore.inf b/UefiCpuPkg/SecCore/SecCore.inf index 442f663911..fc1485b5cb 100644 --- a/UefiCpuPkg/SecCore/SecCore.inf +++ b/UefiCpuPkg/SecCore/SecCore.inf @@ -7,7 +7,7 @@ # protected mode, setup flat memory model, enable temporary memory and # call into SecStartup(). # -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -73,6 +73,7 @@ ## NOTIFY ## SOMETIMES_CONSUMES gPeiSecPerformancePpiGuid + gEfiPeiCoreFvLocationPpiGuid [Guids] ## SOMETIMES_PRODUCES ## HOB diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h index 83244af119..80045d34f4 100644 --- a/UefiCpuPkg/SecCore/SecMain.h +++ b/UefiCpuPkg/SecCore/SecMain.h @@ -1,7 +1,7 @@ /** @file Master header file for SecCore. - Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -20,6 +20,7 @@ #include #include #include +#include #include -- 2.13.3.windows.1