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.1914.1613074863665279863 for ; Thu, 11 Feb 2021 12:21:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=DetkIpHR; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from [10.124.238.202] (unknown [131.107.174.202]) by linux.microsoft.com (Postfix) with ESMTPSA id 2A77E20B6C40; Thu, 11 Feb 2021 12:21:02 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2A77E20B6C40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1613074862; bh=K1UKsAd1IfiskN1vYp6kxQVGbDPgQCUVdGq6egKTsPs=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=DetkIpHR2SjNdmTkowpJlxHfd+RNVNV4waLGpg+EdBbJaHgKzpKKdyZAM4ahpVaRO DdU1xKdAiqI5aDEieX4TMJCwuW4i6HjRqL8zcCdwsOpmFU/BczOvlc0SUzwwIDLov7 MKnGmP6LUepbdAffyasd5o9nmx+XkQ/wTMO5Mnek= Subject: Re: [edk2-devel] [edk2-platforms][PATCH v1 3/3] MinPlatformPkg/SpiFvbService: Add Standalone MM support To: devel@edk2.groups.io, nathaniel.l.desimone@intel.com Cc: "Chiu, Chasel" , Liming Gao , "Dong, Eric" References: <20210206001507.1224-1-mikuback@linux.microsoft.com> <20210206001507.1224-4-mikuback@linux.microsoft.com> From: "Michael Kubacki" Message-ID: <34e9951b-4e1f-62dd-0a77-3da60808ae0f@linux.microsoft.com> Date: Thu, 11 Feb 2021 12:21:02 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Hi Nate, Thanks for the review. I apologize, that was a mistake due to quickly changing file headers based on what VS Code showed as new files. I will update it in a v2. Thanks, Michael On 2/10/2021 6:20 PM, Nate DeSimone wrote: > Hi Michael, > > Given that MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c is almost identical to MinPlatformPkg/Flash/SpiFvbService/Smm/SpiFvbServiceSmm.c, it seems a little inappropriate to remove Intel's copyright from that file. You are welcome to add a Microsoft copyright of course. Other than that, your patch series look's good! > > Thanks, > Nate > >> -----Original Message----- >> From: devel@edk2.groups.io On Behalf Of Michael >> Kubacki >> Sent: Friday, February 5, 2021 4:15 PM >> To: devel@edk2.groups.io >> Cc: Chiu, Chasel ; Desimone, Nathaniel L >> ; Liming Gao >> ; Dong, Eric >> Subject: [edk2-devel] [edk2-platforms][PATCH v1 3/3] >> MinPlatformPkg/SpiFvbService: Add Standalone MM support >> >> From: Michael Kubacki >> >> Adds support for MM_STANDALONE. Retains the directory path to the SMM >> INF instance for backward compatibility with existing platforms. >> >> Cc: Chasel Chiu >> Cc: Nate DeSimone >> Cc: Liming Gao >> Cc: Eric Dong >> Signed-off-by: Michael Kubacki >> --- >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Common => >> }/FvbInfo.c | 0 >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Common => >> }/SpiFvbServiceCommon.c | 0 >> >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Smm/SpiFvbServiceSm >> m.c => SpiFvbServiceMm.c} | 34 +++++------------ >> >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandalon >> eMm.c | 32 ++++++++++++++++ >> >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditiona >> lMm.c | 32 ++++++++++++++++ >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Common => >> }/SpiFvbServiceCommon.h | 4 -- >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.h >> | 22 +++++++++++ >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf >> | 17 +++++---- >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{SpiFvbServiceSmm.inf >> => SpiFvbServiceStandaloneMm.inf} | 40 ++++++++++---------- >> Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc >> | 2 + >> 10 files changed, 129 insertions(+), 54 deletions(-) >> >> diff --git >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/FvbInfo.c >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c >> similarity index 100% >> rename from >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/FvbInfo.c >> rename to Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/FvbInfo.c >> diff --git >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/SpiFvbServi >> ceCommon.c >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceComm >> on.c >> similarity index 100% >> rename from >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/SpiFvbServic >> eCommon.c >> rename to >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon. >> c >> diff --git >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Smm/SpiFvbServiceS >> mm.c >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c >> similarity index 89% >> rename from >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Smm/SpiFvbServiceSm >> m.c >> rename to >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c >> index 251fcae30b90..3175f5f32e31 100644 >> --- >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Smm/SpiFvbServiceS >> mm.c >> +++ >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm. >> +++ c >> @@ -1,14 +1,15 @@ >> /** @file >> - Common driver source for several Serial Flash devices >> + MM driver source for several Serial Flash devices >> which are compliant with the Intel(R) Serial Flash Interface Compatibility >> Specification. >> >> -Copyright (c) 2017, Intel Corporation. All rights reserved.
>> -SPDX-License-Identifier: BSD-2-Clause-Patent >> + Copyright (c) Microsoft Corporation.
>> + SPDX-License-Identifier: BSD-2-Clause-Patent >> >> **/ >> >> #include "SpiFvbServiceCommon.h" >> -#include >> +#include #include >> + >> #include >> >> /** >> @@ -74,7 +75,7 @@ InstallFvbProtocol ( >> // >> FvbHandle = NULL; >> >> - Status = gSmst->SmmInstallProtocolInterface ( >> + Status = gMmst->MmInstallProtocolInterface ( >> &FvbHandle, >> &gEfiSmmFirmwareVolumeBlockProtocolGuid, >> EFI_NATIVE_INTERFACE, @@ -82,7 +83,7 @@ InstallFvbProtocol ( >> ); >> ASSERT_EFI_ERROR (Status); >> >> - Status = gSmst->SmmInstallProtocolInterface ( >> + Status = gMmst->MmInstallProtocolInterface ( >> &FvbHandle, >> &gEfiDevicePathProtocolGuid, >> EFI_NATIVE_INTERFACE, @@ -92,22 +93,13 @@ InstallFvbProtocol >> ( } >> >> /** >> - >> The function does the necessary initialization work for >> Firmware Volume Block Driver. >> >> - @param[in] ImageHandle The firmware allocated handle for the UEFI >> image. >> - @param[in] SystemTable A pointer to the EFI system table. >> - >> - @retval EFI_SUCCESS This funtion always return EFI_SUCCESS. >> - It will ASSERT on errors. >> - >> **/ >> -EFI_STATUS >> -EFIAPI >> +VOID >> FvbInitialize ( >> - IN EFI_HANDLE ImageHandle, >> - IN EFI_SYSTEM_TABLE *SystemTable >> + VOID >> ) >> { >> EFI_FVB_INSTANCE *FvbInstance; >> @@ -219,8 +211,7 @@ FvbInitialize ( >> mFvbModuleGlobal.FvbInstance = (EFI_FVB_INSTANCE *) >> AllocateRuntimeZeroPool (BufferSize); >> if (mFvbModuleGlobal.FvbInstance == NULL) { >> ASSERT (FALSE); >> - Status = EFI_OUT_OF_RESOURCES; >> - goto ERROR; >> + return; >> } >> >> MaxLbaSize = 0; >> @@ -276,9 +267,4 @@ FvbInitialize ( >> >> } >> } >> - >> - return EFI_SUCCESS; >> - >> -ERROR: >> - return Status; >> } >> diff --git >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandal >> oneMm.c >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandal >> oneMm.c >> new file mode 100644 >> index 000000000000..252c818d6551 >> --- /dev/null >> +++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSta >> +++ ndaloneMm.c >> @@ -0,0 +1,32 @@ >> +/** @file >> + MM driver source for several Serial Flash devices >> + which are compliant with the Intel(R) Serial Flash Interface Compatibility >> Specification. >> + >> + Copyright (c) Microsoft Corporation.
>> + SPDX-License-Identifier: BSD-2-Clause-Patent >> + >> +**/ >> + >> +#include "SpiFvbServiceCommon.h" >> +#include "SpiFvbServiceMm.h" >> + >> +/** >> + The driver Standalone MM entry point. >> + >> + @param[in] ImageHandle Image handle of this driver. >> + @param[in] MmSystemTable A pointer to the MM system table. >> + >> + @retval EFI_SUCCESS This function always returns EFI_SUCCESS. >> + >> +**/ >> +EFI_STATUS >> +EFIAPI >> +SpiFvbStandaloneMmInitialize ( >> + IN EFI_HANDLE ImageHandle, >> + IN EFI_MM_SYSTEM_TABLE *MmSystemTable >> + ) >> +{ >> + FvbInitialize (); >> + >> + return EFI_SUCCESS; >> +} >> diff --git >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditio >> nalMm.c >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditio >> nalMm.c >> new file mode 100644 >> index 000000000000..1c2dac70e3c6 >> --- /dev/null >> +++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTra >> +++ ditionalMm.c >> @@ -0,0 +1,32 @@ >> +/** @file >> + MM driver source for several Serial Flash devices >> + which are compliant with the Intel(R) Serial Flash Interface Compatibility >> Specification. >> + >> + Copyright (c) Microsoft Corporation.
>> + SPDX-License-Identifier: BSD-2-Clause-Patent >> + >> +**/ >> + >> +#include "SpiFvbServiceCommon.h" >> +#include "SpiFvbServiceMm.h" >> + >> +/** >> + The driver Traditional MM entry point. >> + >> + @param[in] ImageHandle Image handle of this driver. >> + @param[in] SystemTable A pointer to the EFI system table. >> + >> + @retval EFI_SUCCESS This function always returns EFI_SUCCESS. >> + >> +**/ >> +EFI_STATUS >> +EFIAPI >> +SpiFvbTraditionalMmInitialize ( >> + IN EFI_HANDLE ImageHandle, >> + IN EFI_SYSTEM_TABLE *SystemTable >> + ) >> +{ >> + FvbInitialize (); >> + >> + return EFI_SUCCESS; >> +} >> diff --git >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/SpiFvbServi >> ceCommon.h >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceComm >> on.h >> similarity index 94% >> rename from >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/SpiFvbServic >> eCommon.h >> rename to >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon. >> h >> index 6379fc86d52e..e9d69e985814 100644 >> --- >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/SpiFvbServi >> ceCommon.h >> +++ >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCom >> +++ mon.h >> @@ -15,9 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include >> #include >> >> -#include -#include >> >> -#include >> #include >> #include >> #include >> @@ -159,4 +156,3 @@ extern FV_INFO >> mPlatformFvBaseAddress[]; >> extern FV_INFO mPlatformDefaultBaseAddress[]; >> >> #endif >> - >> diff --git >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.h >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.h >> new file mode 100644 >> index 000000000000..36af1130c8ee >> --- /dev/null >> +++ >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm. >> +++ h >> @@ -0,0 +1,22 @@ >> +/** @file >> + Definitions common to MM implementation in this driver. >> + >> + Copyright (c) Microsoft Corporation.
>> + SPDX-License-Identifier: BSD-2-Clause-Patent >> + >> +**/ >> + >> +#ifndef _SPI_FVB_SERVICE_MM_H_ >> +#define _SPI_FVB_SERVICE_MM_H_ >> + >> +/** >> + The function does the necessary initialization work for >> + Firmware Volume Block Driver. >> + >> +**/ >> +VOID >> +FvbInitialize ( >> + VOID >> + ); >> + >> +#endif >> diff --git >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.in >> f >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.in >> f >> index d59c499b2e9e..10e51e11756f 100644 >> --- >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.in >> f >> +++ >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm >> +++ .inf >> @@ -2,6 +2,7 @@ >> # Component description file for the Serial Flash device Runtime driver. >> # >> # Copyright (c) 2017-2019, Intel Corporation. All rights reserved.
>> +# Copyright (c) Microsoft Corporation.
>> # >> # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -14,7 +15,8 @@ >> [Defines] >> VERSION_STRING = 1.0 >> MODULE_TYPE = DXE_SMM_DRIVER >> PI_SPECIFICATION_VERSION = 1.10 >> - ENTRY_POINT = FvbInitialize >> + ENTRY_POINT = SpiFvbTraditionalMmInitialize >> + >> # >> # The following information is for reference only and not required by the >> build tools. >> # >> @@ -28,11 +30,10 @@ [LibraryClasses] >> BaseMemoryLib >> DebugLib >> BaseLib >> - UefiLib >> UefiBootServicesTableLib >> UefiDriverEntryPoint >> SpiFlashCommonLib >> - SmmServicesTableLib >> + MmServicesTableLib >> >> [Packages] >> MdePkg/MdePkg.dec >> @@ -48,10 +49,12 @@ [Pcd] >> gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize ## >> CONSUMES >> >> [Sources] >> - Common/SpiFvbServiceCommon.c >> - Common/FvbInfo.c >> - Common/SpiFvbServiceCommon.h >> - Smm/SpiFvbServiceSmm.c >> + FvbInfo.c >> + SpiFvbServiceCommon.h >> + SpiFvbServiceCommon.c >> + SpiFvbServiceMm.h >> + SpiFvbServiceMm.c >> + SpiFvbServiceTraditionalMm.c >> >> [Protocols] >> gEfiDevicePathProtocolGuid ## PRODUCES >> diff --git >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.in >> f >> b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandal >> oneMm.inf >> similarity index 64% >> copy from >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf >> copy to >> Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandalon >> eMm.inf >> index d59c499b2e9e..9f08d3673f41 100644 >> --- >> a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.in >> f >> +++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSta >> +++ ndaloneMm.inf >> @@ -1,20 +1,22 @@ >> ### @file >> -# Component description file for the Serial Flash device Runtime driver. >> +# Component description file for the Serial Flash device Standalone MM >> driver. >> # >> # Copyright (c) 2017-2019, Intel Corporation. All rights reserved.
>> +# Copyright (c) Microsoft Corporation.
>> # >> # SPDX-License-Identifier: BSD-2-Clause-Patent # ### >> >> [Defines] >> - INF_VERSION = 0x00010017 >> - BASE_NAME = SpiFvbServiceSmm >> - FILE_GUID = 68A10D85-6858-4402-B070-028B3EA21747 >> + INF_VERSION = 0x0001001B >> + BASE_NAME = SpiFvbServiceStandaloneMm >> + FILE_GUID = E6313655-8BD0-4EAB-B319-AD5E212CE6AB >> VERSION_STRING = 1.0 >> - MODULE_TYPE = DXE_SMM_DRIVER >> - PI_SPECIFICATION_VERSION = 1.10 >> - ENTRY_POINT = FvbInitialize >> + MODULE_TYPE = MM_STANDALONE >> + PI_SPECIFICATION_VERSION = 0x00010032 >> + ENTRY_POINT = SpiFvbStandaloneMmInitialize >> + >> # >> # The following information is for reference only and not required by the >> build tools. >> # >> @@ -22,17 +24,15 @@ [Defines] >> # >> >> [LibraryClasses] >> - PcdLib >> - MemoryAllocationLib >> - CacheMaintenanceLib >> + BaseLib >> BaseMemoryLib >> + CacheMaintenanceLib >> DebugLib >> - BaseLib >> - UefiLib >> - UefiBootServicesTableLib >> - UefiDriverEntryPoint >> + MemoryAllocationLib >> + PcdLib >> + MmServicesTableLib >> SpiFlashCommonLib >> - SmmServicesTableLib >> + StandaloneMmDriverEntryPoint >> >> [Packages] >> MdePkg/MdePkg.dec >> @@ -48,10 +48,12 @@ [Pcd] >> gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize ## >> CONSUMES >> >> [Sources] >> - Common/SpiFvbServiceCommon.c >> - Common/FvbInfo.c >> - Common/SpiFvbServiceCommon.h >> - Smm/SpiFvbServiceSmm.c >> + FvbInfo.c >> + SpiFvbServiceCommon.h >> + SpiFvbServiceCommon.c >> + SpiFvbServiceMm.h >> + SpiFvbServiceMm.c >> + SpiFvbServiceStandaloneMm.c >> >> [Protocols] >> gEfiDevicePathProtocolGuid ## PRODUCES >> diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc >> b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc >> index 5e88de43e08d..0460fd5a3206 100644 >> --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc >> +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc >> @@ -117,6 +117,7 @@ [LibraryClasses.common.MM_STANDALONE] >> DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf >> >> MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAll >> ocationLib/StandaloneMmMemoryAllocationLib.inf >> >> MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Stan >> daloneMmServicesTableLib.inf >> + >> + >> SpiFlashCommonLib|MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/ >> S >> + piFlashCommonLibNull.inf >> >> StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntry >> Point/StandaloneMmDriverEntryPoint.inf >> >> >> ########################################################## >> ######################################### >> @@ -155,6 +156,7 @@ [Components] >> >> MinPlatformPkg/Bds/Library/DxePlatformBootManagerLib/DxePlatformBoot >> ManagerLib.inf >> >> MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf >> + MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf >> >> MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFlashCommonLib >> Null.inf >> >> MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf >> -- >> 2.28.0.windows.1 >> >> >> >> -=-=-=-=-=-= >> Groups.io Links: You receive all messages sent to this group. >> View/Reply Online (#71385): https://edk2.groups.io/g/devel/message/71385 >> Mute This Topic: https://groups.io/mt/80420930/1767664 >> Group Owner: devel+owner@edk2.groups.io >> Unsubscribe: https://edk2.groups.io/g/devel/unsub >> [nathaniel.l.desimone@intel.com] >> -=-=-=-=-=-= >> > > > > >