From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.1960.1628609327689363983 for ; Tue, 10 Aug 2021 08:28:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=deTRDXKF; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from [10.124.238.202] (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id F283720B36E0; Tue, 10 Aug 2021 08:28:46 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F283720B36E0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1628609327; bh=3H6yne56q+jV/ZFFwXOP7wJ4tQkJVSc+SxyXBrSekMM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=deTRDXKFgHt/4fFV3urA0AKsZnttdF1wasLD4D8rQy98P3PZfz6CG1ckTzPQ0Oc3e inidzTm6H1L0c9S8Sbs53efSyTL0GloF0O8HjpK5ay78A/5DMNSp/vtHtm+Vs9WGc6 Dvz98BEPFCOXAAgfsNQorxLnSgLWcC8S157UcPbA= Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg: Add BaseSmmAccessLibNull To: devel@edk2.groups.io, ray.ni@intel.com Cc: "Chaganty, Rangasai V" References: <20210809141554.2568-1-mikuback@linux.microsoft.com> From: "Michael Kubacki" Message-ID: Date: Tue, 10 Aug 2021 11:28:47 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit There is not a SmmAccess PEIM in IntelSiliconPkg. There is a SmmAccessDxe driver: https://github.com/tianocore/edk2-platforms/blob/master/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/SmmAccessDxe/SmmAccess.inf And there is a PeiSmmAccessLib: https://github.com/tianocore/edk2-platforms/tree/master/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess As long as this is a library class, the NULL library instance is necessary for the same reason many NULL instances are necessary. Scenario #1: If a user has a library that depends on SmmAccessLib and that library is linked to two different modules, the user may wish to actually call the install function from one module and not link the functionality (or inherit the non-NULL SmmAccessLib dependencies) in the other module. Scenario #2: Someone is trying to build common code. That common code has a PEIM. That PEIM links SmmAccessLib. A downstream package leveraging that PEIM does not use the functionality in the PEIM that invokes SmmAccessLib. Therefore, the package would like to reduce the overall PEIM dependencies by linking a NULL library instance. --- This is the result of an invoke-once interface being exposed as a generic library class. --- This patch is not trying to modify interfaces such as converting the library class to a driver or anything more involved/impactful. It is simply making the design already in place have an alternative, optional instance available for platform integration. Thanks Michael On 8/9/2021 10:30 PM, Ni, Ray wrote: > Michael, > If your platform doesn't need SmmAccessPPI, you don't put the SmmAccess PEIM in the FDF. > Why do you need: > 1. Put SmmAccess PEIM in FDF > 2. Let SmmAccess PEIM link to a NULL dummy-do-nothing library > > I feel the additional abstraction is not necessary. > > Thanks, > Ray > >> -----Original Message----- >> From: mikuback@linux.microsoft.com >> Sent: Monday, August 9, 2021 10:16 PM >> To: devel@edk2.groups.io >> Cc: Ni, Ray ; Chaganty, Rangasai V >> Subject: [edk2-platforms][PATCH v1 1/1] IntelSiliconPkg: Add BaseSmmAccessLibNull >> >> From: Michael Kubacki >> >> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3540 >> >> Adds a NULL instance of SmmAccessLib. >> >> Cc: Ray Ni >> Cc: Rangasai V Chaganty >> Signed-off-by: Michael Kubacki >> --- >> Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c | 33 >> ++++++++++++++++++++ >> Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf | 26 >> +++++++++++++++ >> Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc | 1 + >> 3 files changed, 60 insertions(+) >> >> diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c >> b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c >> new file mode 100644 >> index 000000000000..f5ad306b380b >> --- /dev/null >> +++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.c >> @@ -0,0 +1,33 @@ >> +/** @file >> + A NULL library instance of SmmAccessLib. >> + >> + Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
>> + Copyright (c) Microsoft Corporation.
>> + >> + SPDX-License-Identifier: BSD-2-Clause-Patent >> + >> +**/ >> + >> +#include >> +#include >> +#include >> + >> +/** >> + This function is to install an SMM Access PPI >> + >> + @retval EFI_SUCCESS - Ppi successfully started and installed. >> + @retval EFI_NOT_FOUND - Ppi can't be found. >> + @retval EFI_OUT_OF_RESOURCES - Ppi does not have enough resources to initialize the driver. >> + @retval EFI_UNSUPPORTED - The PPI was not installed and installation is unsupported in >> + this instance of function implementation. >> + >> +**/ >> +EFI_STATUS >> +EFIAPI >> +PeiInstallSmmAccessPpi ( >> + VOID >> + ) >> +{ >> + ASSERT (FALSE); >> + return EFI_UNSUPPORTED; >> +} >> diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf >> b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf >> new file mode 100644 >> index 000000000000..7fd3b0b89655 >> --- /dev/null >> +++ b/Silicon/Intel/IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf >> @@ -0,0 +1,26 @@ >> +## @file >> +# A NULL library instance of SmmAccessLib. >> +# >> +# Copyright (c) 2019, Intel Corporation. All rights reserved.
>> +# Copyright (c) Microsoft Corporation.
>> +# SPDX-License-Identifier: BSD-2-Clause-Patent >> +# >> +## >> + >> +[Defines] >> +INF_VERSION = 0x00010017 >> +BASE_NAME = BaseSmmAccessLibNull >> +FILE_GUID = C1A14AB6-B757-4046-9B92-9DCE1A2154C6 >> +VERSION_STRING = 1.0 >> +MODULE_TYPE = BASE >> +LIBRARY_CLASS = SmmAccessLib >> + >> +[Packages] >> + MdePkg/MdePkg.dec >> + IntelSiliconPkg/IntelSiliconPkg.dec >> + >> +[LibraryClasses] >> + DebugLib >> + >> +[Sources] >> + BaseSmmAccessLibNull.c >> diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc >> index 1092371d848e..dd0928ec58f3 100644 >> --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc >> +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc >> @@ -90,6 +90,7 @@ [Components] >> IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf >> IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf >> IntelSiliconPkg/Feature/ShadowMicrocode/ShadowMicrocodePei.inf >> + IntelSiliconPkg/Feature/SmmAccess/Library/BaseSmmAccessLibNull/BaseSmmAccessLibNull.inf >> IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf >> IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMediaLib.inf >> IntelSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf >> -- >> 2.28.0.windows.1 > > > > >