public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH v1 0/3] MinPlatformPkg: Add SpiFvbServiceStandaloneMm
@ 2021-02-06  0:15 Michael Kubacki
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 1/3] MinPlatformPkg/SpiFlashCommonLibNull: Make MODULE_TYPE BASE Michael Kubacki
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Michael Kubacki @ 2021-02-06  0:15 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Liming Gao, Eric Dong

From: Michael Kubacki <michael.kubacki@microsoft.com>

Adds a new component called SpiFvbServiceStandaloneMm that serves
as a Standalone MM compatible SPI FVB service driver.

Note that a MM_STANDALONE version of SpiFlashCommonLib is being
prepared to be sent but for the time being the module can be added
to the MinPlatformPkg build and rely upon a NULL instance in the
build.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>

Michael Kubacki (3):
  MinPlatformPkg/SpiFlashCommonLibNull: Make MODULE_TYPE BASE
  MinPlatformPkg/MinPlatformPkg.dsc: Add basic MM_STANDALONE libraries
  MinPlatformPkg/SpiFvbService: Add Standalone MM support

 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Common => }/FvbInfo.c                                  |  0
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Common => }/SpiFvbServiceCommon.c                      |  0
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Smm/SpiFvbServiceSmm.c => SpiFvbServiceMm.c}           | 34 +++++------------
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.c                             | 32 ++++++++++++++++
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditionalMm.c                            | 32 ++++++++++++++++
 Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf               |  4 +-
 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                                                          |  9 +++++
 11 files changed, 138 insertions(+), 56 deletions(-)
 rename Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Common => }/FvbInfo.c (100%)
 rename Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Common => }/SpiFvbServiceCommon.c (100%)
 rename Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Smm/SpiFvbServiceSmm.c => SpiFvbServiceMm.c} (89%)
 create mode 100644 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.c
 create mode 100644 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditionalMm.c
 rename Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{Common => }/SpiFvbServiceCommon.h (94%)
 create mode 100644 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.h
 copy Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/{SpiFvbServiceSmm.inf => SpiFvbServiceStandaloneMm.inf} (64%)

-- 
2.28.0.windows.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH v1 1/3] MinPlatformPkg/SpiFlashCommonLibNull: Make MODULE_TYPE BASE
  2021-02-06  0:15 [edk2-platforms][PATCH v1 0/3] MinPlatformPkg: Add SpiFvbServiceStandaloneMm Michael Kubacki
@ 2021-02-06  0:15 ` Michael Kubacki
  2021-02-11  2:22   ` Nate DeSimone
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 2/3] MinPlatformPkg/MinPlatformPkg.dsc: Add basic MM_STANDALONE libraries Michael Kubacki
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 3/3] MinPlatformPkg/SpiFvbService: Add Standalone MM support Michael Kubacki
  2 siblings, 1 reply; 8+ messages in thread
From: Michael Kubacki @ 2021-02-06  0:15 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Liming Gao, Eric Dong

From: Michael Kubacki <michael.kubacki@microsoft.com>

This NULL library can be used to link against a MODULE_TYPE other
than BASE and that would be useful as it is a NULL class instance.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf b/Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf
index d4964681de3d..75ef1cb921df 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf
+++ b/Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf
@@ -12,8 +12,8 @@ [Defines]
   BASE_NAME                      = SpiFlashCommonLibNull
   FILE_GUID                      = F35BBEE7-A681-443E-BB15-07AF9FABBDED
   VERSION_STRING                 = 1.0
-  MODULE_TYPE                    = DXE_SMM_DRIVER
-  LIBRARY_CLASS                  = SpiFlashCommonLib|DXE_SMM_DRIVER
+  MODULE_TYPE                    = BASE
+  LIBRARY_CLASS                  = SpiFlashCommonLib
 #
 # The following information is for reference only and not required by the build tools.
 #
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH v1 2/3] MinPlatformPkg/MinPlatformPkg.dsc: Add basic MM_STANDALONE libraries
  2021-02-06  0:15 [edk2-platforms][PATCH v1 0/3] MinPlatformPkg: Add SpiFvbServiceStandaloneMm Michael Kubacki
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 1/3] MinPlatformPkg/SpiFlashCommonLibNull: Make MODULE_TYPE BASE Michael Kubacki
@ 2021-02-06  0:15 ` Michael Kubacki
  2021-02-11  2:22   ` Nate DeSimone
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 3/3] MinPlatformPkg/SpiFvbService: Add Standalone MM support Michael Kubacki
  2 siblings, 1 reply; 8+ messages in thread
From: Michael Kubacki @ 2021-02-06  0:15 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Liming Gao, Eric Dong

From: Michael Kubacki <michael.kubacki@microsoft.com>

Adds a fundamental set of library instances that are needed to build
MM_STANDALONE modules.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index d0b559381720..5e88de43e08d 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -2,6 +2,7 @@
 #  Platform description.
 #
 # Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) Microsoft Corporation.<BR>
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -112,6 +113,12 @@ [LibraryClasses.common.DXE_SMM_DRIVER]
   TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/SmmTestPointLib.inf
 
+[LibraryClasses.common.MM_STANDALONE]
+  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+  MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
+  MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
+  StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
+
 ###################################################################################################
 #
 # Components Section - list of the modules and components that will be processed by compilation
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [edk2-platforms][PATCH v1 3/3] MinPlatformPkg/SpiFvbService: Add Standalone MM support
  2021-02-06  0:15 [edk2-platforms][PATCH v1 0/3] MinPlatformPkg: Add SpiFvbServiceStandaloneMm Michael Kubacki
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 1/3] MinPlatformPkg/SpiFlashCommonLibNull: Make MODULE_TYPE BASE Michael Kubacki
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 2/3] MinPlatformPkg/MinPlatformPkg.dsc: Add basic MM_STANDALONE libraries Michael Kubacki
@ 2021-02-06  0:15 ` Michael Kubacki
  2021-02-11  2:20   ` [edk2-devel] " Nate DeSimone
  2 siblings, 1 reply; 8+ messages in thread
From: Michael Kubacki @ 2021-02-06  0:15 UTC (permalink / raw)
  To: devel; +Cc: Chasel Chiu, Nate DeSimone, Liming Gao, Eric Dong

From: Michael Kubacki <michael.kubacki@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@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@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/SpiFvbServiceSmm.c => SpiFvbServiceMm.c}           | 34 +++++------------
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.c                             | 32 ++++++++++++++++
 Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditionalMm.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/SpiFvbServiceCommon.c b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c
similarity index 100%
rename from Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/SpiFvbServiceCommon.c
rename to Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.c
diff --git a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Smm/SpiFvbServiceSmm.c b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c
similarity index 89%
rename from Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Smm/SpiFvbServiceSmm.c
rename to Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceMm.c
index 251fcae30b90..3175f5f32e31 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Smm/SpiFvbServiceSmm.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/SpiFvbServiceStandaloneMm.c b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.c
new file mode 100644
index 000000000000..252c818d6551
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.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/SpiFvbServiceTraditionalMm.c b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditionalMm.c
new file mode 100644
index 000000000000..1c2dac70e3c6
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceTraditionalMm.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/SpiFvbServiceCommon.h b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.h
similarity index 94%
rename from Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/SpiFvbServiceCommon.h
rename to Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.h
index 6379fc86d52e..e9d69e985814 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/Common/SpiFvbServiceCommon.h
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceCommon.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.inf b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
index d59c499b2e9e..10e51e11756f 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+++ 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.inf b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf
similarity index 64%
copy from Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
copy to Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf
index d59c499b2e9e..9f08d3673f41 100644
--- a/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+++ b/Platform/Intel/MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.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/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
   MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
+  SpiFlashCommonLib|MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf
   StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
 
 ###################################################################################################
@@ -155,6 +156,7 @@ [Components]
   MinPlatformPkg/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
 
   MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceSmm.inf
+  MinPlatformPkg/Flash/SpiFvbService/SpiFvbServiceStandaloneMm.inf
   MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFlashCommonLibNull.inf
 
   MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH v1 3/3] MinPlatformPkg/SpiFvbService: Add Standalone MM support
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 3/3] MinPlatformPkg/SpiFvbService: Add Standalone MM support Michael Kubacki
@ 2021-02-11  2:20   ` Nate DeSimone
  2021-02-11 20:21     ` Michael Kubacki
  0 siblings, 1 reply; 8+ messages in thread
From: Nate DeSimone @ 2021-02-11  2:20 UTC (permalink / raw)
  To: devel@edk2.groups.io, mikuback@linux.microsoft.com
  Cc: Chiu, Chasel, Liming Gao, Dong, Eric

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 <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 <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
> Subject: [edk2-devel] [edk2-platforms][PATCH v1 3/3]
> MinPlatformPkg/SpiFvbService: Add Standalone MM support
> 
> From: Michael Kubacki <michael.kubacki@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@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@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@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [nathaniel.l.desimone@intel.com]
> -=-=-=-=-=-=
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-platforms][PATCH v1 1/3] MinPlatformPkg/SpiFlashCommonLibNull: Make MODULE_TYPE BASE
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 1/3] MinPlatformPkg/SpiFlashCommonLibNull: Make MODULE_TYPE BASE Michael Kubacki
@ 2021-02-11  2:22   ` Nate DeSimone
  0 siblings, 0 replies; 8+ messages in thread
From: Nate DeSimone @ 2021-02-11  2:22 UTC (permalink / raw)
  To: mikuback@linux.microsoft.com, devel@edk2.groups.io
  Cc: Chiu, Chasel, Liming Gao, Dong, Eric

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: mikuback@linux.microsoft.com <mikuback@linux.microsoft.com>
> Sent: Friday, February 5, 2021 4:15 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
> Subject: [edk2-platforms][PATCH v1 1/3]
> MinPlatformPkg/SpiFlashCommonLibNull: Make MODULE_TYPE BASE
> 
> From: Michael Kubacki <michael.kubacki@microsoft.com>
> 
> This NULL library can be used to link against a MODULE_TYPE other than BASE
> and that would be useful as it is a NULL class instance.
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
> 
> Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/SpiFla
> shCommonLibNull.inf | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/Spi
> FlashCommonLibNull.inf
> b/Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/Spi
> FlashCommonLibNull.inf
> index d4964681de3d..75ef1cb921df 100644
> ---
> a/Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/Spi
> FlashCommonLibNull.inf
> +++
> b/Platform/Intel/MinPlatformPkg/Flash/Library/SpiFlashCommonLibNull/
> +++ SpiFlashCommonLibNull.inf
> @@ -12,8 +12,8 @@ [Defines]
>    BASE_NAME                      = SpiFlashCommonLibNull
>    FILE_GUID                      = F35BBEE7-A681-443E-BB15-07AF9FABBDED
>    VERSION_STRING                 = 1.0
> -  MODULE_TYPE                    = DXE_SMM_DRIVER
> -  LIBRARY_CLASS                  = SpiFlashCommonLib|DXE_SMM_DRIVER
> +  MODULE_TYPE                    = BASE
> +  LIBRARY_CLASS                  = SpiFlashCommonLib
>  #
>  # The following information is for reference only and not required by the
> build tools.
>  #
> --
> 2.28.0.windows.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-platforms][PATCH v1 2/3] MinPlatformPkg/MinPlatformPkg.dsc: Add basic MM_STANDALONE libraries
  2021-02-06  0:15 ` [edk2-platforms][PATCH v1 2/3] MinPlatformPkg/MinPlatformPkg.dsc: Add basic MM_STANDALONE libraries Michael Kubacki
@ 2021-02-11  2:22   ` Nate DeSimone
  0 siblings, 0 replies; 8+ messages in thread
From: Nate DeSimone @ 2021-02-11  2:22 UTC (permalink / raw)
  To: mikuback@linux.microsoft.com, devel@edk2.groups.io
  Cc: Chiu, Chasel, Liming Gao, Dong, Eric

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: mikuback@linux.microsoft.com <mikuback@linux.microsoft.com>
> Sent: Friday, February 5, 2021 4:15 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
> Subject: [edk2-platforms][PATCH v1 2/3]
> MinPlatformPkg/MinPlatformPkg.dsc: Add basic MM_STANDALONE libraries
> 
> From: Michael Kubacki <michael.kubacki@microsoft.com>
> 
> Adds a fundamental set of library instances that are needed to build
> MM_STANDALONE modules.
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> index d0b559381720..5e88de43e08d 100644
> --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
> @@ -2,6 +2,7 @@
>  #  Platform description.
>  #
>  # Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) Microsoft Corporation.<BR>
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -112,6 +113,12 @@
> [LibraryClasses.common.DXE_SMM_DRIVER]
> 
> TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTe
> stPointCheckLib.inf
> 
> TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/SmmTestPointLib.in
> f
> 
> +[LibraryClasses.common.MM_STANDALONE]
> +  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> +
> +MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryA
> llocatio
> +nLib/StandaloneMmMemoryAllocationLib.inf
> +
> +MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Sta
> ndalo
> +neMmServicesTableLib.inf
> +
> +StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntr
> yPoin
> +t/StandaloneMmDriverEntryPoint.inf
> +
> 
> ##########################################################
> #########################################
>  #
>  # Components Section - list of the modules and components that will be
> processed by compilation
> --
> 2.28.0.windows.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH v1 3/3] MinPlatformPkg/SpiFvbService: Add Standalone MM support
  2021-02-11  2:20   ` [edk2-devel] " Nate DeSimone
@ 2021-02-11 20:21     ` Michael Kubacki
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Kubacki @ 2021-02-11 20:21 UTC (permalink / raw)
  To: devel, nathaniel.l.desimone; +Cc: Chiu, Chasel, Liming Gao, Dong, Eric

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 <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 <chasel.chiu@intel.com>; Desimone, Nathaniel L
>> <nathaniel.l.desimone@intel.com>; Liming Gao
>> <gaoliming@byosoft.com.cn>; Dong, Eric <eric.dong@intel.com>
>> Subject: [edk2-devel] [edk2-platforms][PATCH v1 3/3]
>> MinPlatformPkg/SpiFvbService: Add Standalone MM support
>>
>> From: Michael Kubacki <michael.kubacki@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@intel.com>
>> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Signed-off-by: Michael Kubacki <michael.kubacki@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@edk2.groups.io
>> Unsubscribe: https://edk2.groups.io/g/devel/unsub
>> [nathaniel.l.desimone@intel.com]
>> -=-=-=-=-=-=
>>
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-11 20:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-06  0:15 [edk2-platforms][PATCH v1 0/3] MinPlatformPkg: Add SpiFvbServiceStandaloneMm Michael Kubacki
2021-02-06  0:15 ` [edk2-platforms][PATCH v1 1/3] MinPlatformPkg/SpiFlashCommonLibNull: Make MODULE_TYPE BASE Michael Kubacki
2021-02-11  2:22   ` Nate DeSimone
2021-02-06  0:15 ` [edk2-platforms][PATCH v1 2/3] MinPlatformPkg/MinPlatformPkg.dsc: Add basic MM_STANDALONE libraries Michael Kubacki
2021-02-11  2:22   ` Nate DeSimone
2021-02-06  0:15 ` [edk2-platforms][PATCH v1 3/3] MinPlatformPkg/SpiFvbService: Add Standalone MM support Michael Kubacki
2021-02-11  2:20   ` [edk2-devel] " Nate DeSimone
2021-02-11 20:21     ` Michael Kubacki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox