From nobody Fri Dec 27 18:42:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 150123320334649.430058764162595; Fri, 28 Jul 2017 02:13:23 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E6C7121E0C31A; Fri, 28 Jul 2017 02:11:14 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 B722221E0C304 for ; Fri, 28 Jul 2017 02:11:13 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jul 2017 02:13:18 -0700 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.12]) by fmsmga001.fm.intel.com with ESMTP; 28 Jul 2017 02:13:01 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,425,1496127600"; d="scan'208";a="1177283792" From: Star Zeng To: edk2-devel@lists.01.org Date: Fri, 28 Jul 2017 17:12:13 +0800 Message-Id: <1501233133-23612-3-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 In-Reply-To: <1501233133-23612-1-git-send-email-star.zeng@intel.com> References: <1501233133-23612-1-git-send-email-star.zeng@intel.com> Subject: [edk2] [PATCH 2/2] MdeModulePkg PeiCore: Handle notification PPI from SEC X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" InstallPpi() will be used for normal PPI in PPI list from SEC, and NotifyPpi() will be used for notification PPI in PPI list from SEC. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng --- MdeModulePkg/Core/Pei/PeiMain.h | 14 ++++ MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 7 +- MdeModulePkg/Core/Pei/Ppi/Ppi.c | 140 ++++++++++++++++++++++++++++= ---- 3 files changed, 142 insertions(+), 19 deletions(-) diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMai= n.h index 8b58916e65b3..e95b1c3d8cd7 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.h +++ b/MdeModulePkg/Core/Pei/PeiMain.h @@ -557,6 +557,20 @@ DispatchNotify ( IN INTN NotifyStopIndex ); =20 +/** + Process PpiList from SEC phase. + + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table = published by the PEI Foundation. + @param PpiList Points to a list of one or more PPI descriptors to= be installed initially by the PEI core. + These PPI's will be installed and/or immediately s= ignaled if they are notification type. + +**/ +VOID +ProcessPpiListFromSec ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList + ); + // // Boot mode support functions // diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pe= i/PeiMain/PeiMain.c index 27484bafc575..556c40a3035c 100644 --- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c +++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c @@ -1,7 +1,7 @@ /** @file Pei Core Main Entry Point =20 -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, 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 @@ -380,11 +380,10 @@ PeiCore ( ); =20 // - // If SEC provided any PPI services to PEI, install them. + // If SEC provided the PpiList, process it. // if (PpiList !=3D NULL) { - Status =3D PeiServicesInstallPpi (PpiList); - ASSERT_EFI_ERROR (Status); + ProcessPpiListFromSec (&PrivateData.Ps, PpiList); } } else { // diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Pp= i.c index db6eded6d6ed..b2ab3fbd2086 100644 --- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c +++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c @@ -1,7 +1,7 @@ /** @file EFI PEI Core PPI services =20 -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, 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 @@ -171,6 +171,9 @@ ConvertPpiPointers ( =20 @param PeiServices An indirect pointer to the EFI_PEI_SER= VICES table published by the PEI Foundation. @param PpiList Pointer to a list of PEI PPI Descripto= rs. + @param Single TRUE if only single entry in the PpiLi= st. + FALSE if the PpiList is ended with an = entry which has the + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST = flag set in its Flags field. =20 @retval EFI_SUCCESS if all PPIs in PpiList are successfully= installed. @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer @@ -179,10 +182,10 @@ ConvertPpiPointers ( =20 **/ EFI_STATUS -EFIAPI -PeiInstallPpi ( +InternalPeiInstallPpi ( IN CONST EFI_PEI_SERVICES **PeiServices, - IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList, + IN BOOLEAN Single ) { PEI_CORE_INSTANCE *PrivateData; @@ -229,11 +232,16 @@ PeiInstallPpi ( PrivateData->PpiData.PpiListPtrs[Index].Ppi =3D (EFI_PEI_PPI_DESCRIPTO= R*) PpiList; PrivateData->PpiData.PpiListEnd++; =20 - // - // Continue until the end of the PPI List. - // - if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) =3D=3D - EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) { + if (Single) { + // + // Only single entry in the PpiList. + // + break; + } else if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) = =3D=3D + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) { + // + // Continue until the end of the PPI List. + // break; } PpiList++; @@ -258,6 +266,31 @@ PeiInstallPpi ( =20 /** =20 + This function installs an interface in the PEI PPI database by GUID.=20 + The purpose of the service is to publish an interface that other parties + can use to call additional PEIMs. + + @param PeiServices An indirect pointer to the EFI_PEI_SER= VICES table published by the PEI Foundation. + @param PpiList Pointer to a list of PEI PPI Descripto= rs. + + @retval EFI_SUCCESS if all PPIs in PpiList are successfully= installed. + @retval EFI_INVALID_PARAMETER if PpiList is NULL pointer + if any PPI in PpiList is not valid + @retval EFI_OUT_OF_RESOURCES if there is no more memory resource to = install PPI + +**/ +EFI_STATUS +EFIAPI +PeiInstallPpi ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList + ) +{ + return InternalPeiInstallPpi (PeiServices, PpiList, FALSE); +} + +/** + This function reinstalls an interface in the PEI PPI database by GUID.=20 The purpose of the service is to publish an interface that other parties= can=20 use to replace an interface of the same name in the protocol database wi= th a=20 @@ -409,17 +442,20 @@ PeiLocatePpi ( =20 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES ta= ble published by the PEI Foundation. @param NotifyList Pointer to list of Descriptors to notify upon. + @param Single TRUE if only single entry in the NotifyList. + FALSE if the NotifyList is ended with an entry= which has the + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST flag set= in its Flags field. =20 @retval EFI_SUCCESS if successful @retval EFI_OUT_OF_RESOURCES if no space in the database - @retval EFI_INVALID_PARAMETER if not a good decriptor + @retval EFI_INVALID_PARAMETER if not a good descriptor =20 **/ EFI_STATUS -EFIAPI -PeiNotifyPpi ( +InternalPeiNotifyPpi ( IN CONST EFI_PEI_SERVICES **PeiServices, - IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList + IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList, + IN BOOLEAN Single ) { PEI_CORE_INSTANCE *PrivateData; @@ -474,8 +510,16 @@ PeiNotifyPpi ( =20 PrivateData->PpiData.NotifyListEnd--; DEBUG((EFI_D_INFO, "Register PPI Notify: %g\n", NotifyList->Guid)); - if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) =3D=3D - EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) { + if (Single) { + // + // Only single entry in the NotifyList. + // + break; + } else if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST)= =3D=3D + EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) { + // + // Continue until the end of the Notify List. + // break; } // @@ -519,6 +563,30 @@ PeiNotifyPpi ( return EFI_SUCCESS; } =20 +/** + + This function installs a notification service to be called back when a g= iven=20 + interface is installed or reinstalled. The purpose of the service is to = publish=20 + an interface that other parties can use to call additional PPIs that may= materialize later. + + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES ta= ble published by the PEI Foundation. + @param NotifyList Pointer to list of Descriptors to notify upon. + + @retval EFI_SUCCESS if successful + @retval EFI_OUT_OF_RESOURCES if no space in the database + @retval EFI_INVALID_PARAMETER if not a good descriptor + +**/ +EFI_STATUS +EFIAPI +PeiNotifyPpi ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList + ) +{ + return InternalPeiNotifyPpi (PeiServices, NotifyList, FALSE); +} + =20 /** =20 @@ -644,3 +712,45 @@ DispatchNotify ( } } =20 +/** + Process PpiList from SEC phase. + + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table = published by the PEI Foundation. + @param PpiList Points to a list of one or more PPI descriptors to= be installed initially by the PEI core. + These PPI's will be installed and/or immediately s= ignaled if they are notification type. + +**/ +VOID +ProcessPpiListFromSec ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList + ) +{ + EFI_STATUS Status; + + for (;;) { + if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES) !=3D 0) { + // + // It is a notification PPI. + // + Status =3D InternalPeiNotifyPpi (PeiServices, (CONST EFI_PEI_NOTIFY_= DESCRIPTOR *) PpiList, TRUE); + ASSERT_EFI_ERROR (Status); + } else { + // + // It is a normal PPI. + // + Status =3D InternalPeiInstallPpi (PeiServices, PpiList, TRUE); + ASSERT_EFI_ERROR (Status); + } + + if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) =3D=3D EF= I_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) { + // + // Continue until the end of the PPI List. + // + break; + } + + PpiList++; + } +} + --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel