[edk2-devel] [edk2-platforms][PATCH v1 3/3] MinPlatformPkg/SpiFvbService: Add Standalone MM support

Nate DeSimone nathaniel.l.desimone at intel.com
Thu Feb 11 02:20:53 UTC 2021


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 at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Michael
> Kubacki
> Sent: Friday, February 5, 2021 4:15 PM
> To: devel at edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu at intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone at intel.com>; Liming Gao
> <gaoliming at byosoft.com.cn>; Dong, Eric <eric.dong at intel.com>
> Subject: [edk2-devel] [edk2-platforms][PATCH v1 3/3]
> MinPlatformPkg/SpiFvbService: Add Standalone MM support
> 
> From: Michael Kubacki <michael.kubacki at microsoft.com>
> 
> Adds support for MM_STANDALONE. Retains the directory path to the SMM
> INF instance for backward compatibility with existing platforms.
> 
> Cc: Chasel Chiu <chasel.chiu at intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
> Cc: Liming Gao <gaoliming at byosoft.com.cn>
> Cc: Eric Dong <eric.dong at intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki at microsoft.com>
> ---
>  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.<BR>
> -SPDX-License-Identifier: BSD-2-Clause-Patent
> +  Copyright (c) Microsoft Corporation.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
>  #include "SpiFvbServiceCommon.h"
> -#include <Library/SmmServicesTableLib.h>
> +#include <Library/MmServicesTableLib.h> #include
> +<Library/UefiDriverEntryPoint.h>
>  #include <Protocol/SmmFirmwareVolumeBlock.h>
> 
>  /**
> @@ -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.<BR>
> +  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.<BR>
> +  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
> <Protocol/DevicePath.h>  #include <Protocol/FirmwareVolumeBlock.h>
> 
> -#include <Library/UefiDriverEntryPoint.h> -#include
> <Library/UefiBootServicesTableLib.h>
> -#include <Library/UefiLib.h>
>  #include <Library/BaseLib.h>
>  #include <Library/DebugLib.h>
>  #include <Library/BaseMemoryLib.h>
> @@ -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.<BR>
> +  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.<BR>
> +# Copyright (c) Microsoft Corporation.<BR>
>  #
>  # 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.<BR>
> +# Copyright (c) Microsoft Corporation.<BR>
>  #
>  # 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 at edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [nathaniel.l.desimone at intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#71598): https://edk2.groups.io/g/devel/message/71598
Mute This Topic: https://groups.io/mt/80420930/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list