Refactor GenericElog to support Standalone MM.
Remove unused function SmElogServiceInitialize.

Cc: Abner Chang <abner.ch...@amd.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Signed-off-by: Lixia Huang <lisa.hu...@intel.com>
---
 .../GenericElog/Smm/GenericElog.c             | 35 +++-------------
 .../GenericElog/Smm/GenericElog.h             | 28 ++++++-------
 .../GenericElog/Smm/GenericElog.inf           |  5 ++-
 .../GenericElog/Smm/GenericElogStandaloneMm.c | 28 +++++++++++++
 .../Smm/GenericElogStandaloneMm.inf           | 41 +++++++++++++++++++
 .../Smm/GenericElogTraditionalMm.c            | 28 +++++++++++++
 .../IpmiFeaturePkg/Include/IpmiFeature.dsc    |  1 +
 7 files changed, 118 insertions(+), 48 deletions(-)
 create mode 100644 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogStandaloneMm.c
 create mode 100644 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogStandaloneMm.inf
 create mode 100644 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogTraditionalMm.c

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.c
index d6a129a181fb..ce69d36af896 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.c
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.c
@@ -374,7 +374,7 @@ SetElogRedirInstances (
   //
   // Check for all IPMI Controllers
   //
-  Status = gSmst->SmmLocateHandle (
+  Status = gMmst->MmLocateHandle (
                     ByProtocol,
                     &gSmmRedirElogProtocolGuid,
                     NULL,
@@ -389,7 +389,7 @@ SetElogRedirInstances (
   for (Index = 0; ((Index < NumHandles) && (Index < 
mElogModuleGlobal->MaxDescriptors)); Index++) {
     EmptyIndex = mElogModuleGlobal->MaxDescriptors;
 
-    Status = gSmst->SmmHandleProtocol (
+    Status = gMmst->MmHandleProtocol (
                       Buffer[Index],
                       &gSmmRedirElogProtocolGuid,
                       (VOID *)&Redir
@@ -452,17 +452,12 @@ NotifyElogRedirEventCallback (
 /**
   Initialize the generic Elog driver of server management.
 
-  @param ImageHandle  - The image handle of this driver
-  @param SystemTable  - The pointer of EFI_SYSTEM_TABLE
-
   @retval EFI_SUCCESS - The driver initialized successfully
 
 **/
 EFI_STATUS
-EFIAPI
 InitializeSmElogLayer (
-  IN EFI_HANDLE        ImageHandle,
-  IN EFI_SYSTEM_TABLE  *SystemTable
+  VOID
   )
 {
   EFI_HANDLE            NewHandle;
@@ -475,8 +470,6 @@ InitializeSmElogLayer (
     return EFI_OUT_OF_RESOURCES;
   }
 
-  SmElogServiceInitialize (ImageHandle, SystemTable);
-
   mElogModuleGlobal->MaxDescriptors = MAX_REDIR_DESCRIPTOR;
 
   //
@@ -496,7 +489,7 @@ InitializeSmElogLayer (
   ElogProtocol->SetEventLogData   = (EFI_SET_ELOG_DATA)EfiSetElogData;
 
   NewHandle = NULL;
-  Status    = gSmst->SmmInstallProtocolInterface (
+  Status    = gMmst->MmInstallProtocolInterface (
                        &NewHandle,
                        &gSmmGenericElogProtocolGuid,
                        EFI_NATIVE_INTERFACE,
@@ -512,7 +505,7 @@ InitializeSmElogLayer (
   // Register to be notified when the ELOG REDIR protocol has been
   // produced.
   //
-  Status = gSmst->SmmRegisterProtocolNotify (
+  Status = gMmst->MmRegisterProtocolNotify (
                     &gSmmRedirElogProtocolGuid,
                     NULL,
                     &mEfiElogRedirProtocolEvent
@@ -538,21 +531,3 @@ EfiSetFunctionEntry (
   FunctionPointer->Function = (EFI_PLABEL *)Function;
   return EFI_SUCCESS;
 }
-
-/**
-  Entry point of SM Elog service Driver
-
-  @param ImageHandle         - The Image handle of this driver.
-  @param SystemTable         - The pointer of EFI_SYSTEM_TABLE.
-
-  @retval EFI_SUCCESS - The driver successfully initialized
-
-**/
-EFI_STATUS
-SmElogServiceInitialize (
-  IN EFI_HANDLE        ImageHandle,
-  IN EFI_SYSTEM_TABLE  *SystemTable
-  )
-{
-  return EFI_SUCCESS;
-}
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.h
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.h
index ad6530616309..71dd247bfe58 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.h
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.h
@@ -15,7 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/DebugLib.h>
 
 #include <Library/BaseMemoryLib.h>
-#include <Library/SmmServicesTableLib.h>
+#include <Library/MmServicesTableLib.h>
 #include <Library/MemoryAllocationLib.h>
 
 #include "ServerManagement.h"
@@ -84,21 +84,6 @@ EfiSetFunctionEntry (
   IN  VOID          *Function
   );
 
-/**
-  Entry point of SM Elog service Driver
-
-  @param ImageHandle         - The Image handle of this driver.
-  @param SystemTable         - The pointer of EFI_SYSTEM_TABLE.
-
-  @retval EFI_SUCCESS - The driver successfully initialized
-
-**/
-EFI_STATUS
-SmElogServiceInitialize (
-  IN EFI_HANDLE        ImageHandle,
-  IN EFI_SYSTEM_TABLE  *SystemTable
-  );
-
 /**
   Sm Redir Address Change Event.
 
@@ -213,4 +198,15 @@ EfiLibActivateElog (
   BOOLEAN               Virtual
   );
 
+/**
+  Initialize the generic ELog driver of server management.
+
+  @retval EFI_SUCCESS - The driver initialized successfully
+
+**/
+EFI_STATUS
+InitializeSmElogLayer (
+  VOID
+  );
+
 #endif //_SMM_GENELOG_H_
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.inf
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.inf
index ea1cf9d61bbd..2255dfb54a46 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.inf
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElog.inf
@@ -14,11 +14,12 @@
   MODULE_TYPE              = DXE_SMM_DRIVER
   PI_SPECIFICATION_VERSION = 0x0001000A
   VERSION_STRING           = 1.0
-  ENTRY_POINT              = InitializeSmElogLayer
+  ENTRY_POINT              = InitializeSmElogLayerSmm
 
 [Sources]
   GenericElog.c
   GenericElog.h
+  GenericElogTraditionalMm.c
 
 [Packages]
   IpmiFeaturePkg/IpmiFeaturePkg.dec
@@ -27,7 +28,7 @@
 [LibraryClasses]
   UefiDriverEntryPoint
   DebugLib
-  SmmServicesTableLib
+  MmServicesTableLib
   MemoryAllocationLib
 
 [Protocols]
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogStandaloneMm.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogStandaloneMm.c
new file mode 100644
index 000000000000..9c83384819c0
--- /dev/null
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogStandaloneMm.c
@@ -0,0 +1,28 @@
+/** @file
+  Generic Event Log functions of StandaloneMm GenericElog driver.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "GenericElog.h"
+
+/**
+  The Driver Entry Point.
+
+  @param[in] ImageHandle    The image handle of this driver
+  @param[in] SystemTable    The pointer of EFI_MM_SYSTEM_TABLE
+
+  @retval EFI_SUCCESS       The driver initialized successfully
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeSmElogLayerStandaloneMm (
+  IN EFI_HANDLE           ImageHandle,
+  IN EFI_MM_SYSTEM_TABLE  *SystemTable
+  )
+{
+  return InitializeSmElogLayer ();
+}
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogStandaloneMm.inf
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogStandaloneMm.inf
new file mode 100644
index 000000000000..25aecb1920b7
--- /dev/null
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogStandaloneMm.inf
@@ -0,0 +1,41 @@
+### @file
+#
+# Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+
+[Defines]
+  INF_VERSION              = 0x00010005
+  BASE_NAME                = GenericElogStandaloneMm
+  FILE_GUID                = dbc3cc63-3fb9-4314-b87d-caabf75862c4
+  MODULE_TYPE              = MM_STANDALONE
+  PI_SPECIFICATION_VERSION = 0x00010032
+  VERSION_STRING           = 1.0
+  ENTRY_POINT              = InitializeSmElogLayerStandaloneMm
+
+
+[Sources]
+  GenericElog.c
+  GenericElog.h
+  GenericElogStandaloneMm.c
+
+[Packages]
+  IpmiFeaturePkg/IpmiFeaturePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  StandaloneMmDriverEntryPoint
+  DebugLib
+  MmServicesTableLib
+  MemoryAllocationLib
+
+[Protocols]
+  gSmmGenericElogProtocolGuid     # PROTOCOL ALWAYS_PRODUCED
+  gSmmRedirElogProtocolGuid       #PROTOCOL ALWAYS_COMSUMED
+
+[Depex]
+  gSmmRedirElogProtocolGuid AND
+  gSmmIpmiTransportProtocolGuid
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogTraditionalMm.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogTraditionalMm.c
new file mode 100644
index 000000000000..5322a49d416d
--- /dev/null
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericElog/Smm/GenericElogTraditionalMm.c
@@ -0,0 +1,28 @@
+/** @file
+  Generic Event Log functions of SMM GenericElog driver.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "GenericElog.h"
+
+/**
+  The Driver Entry Point.
+
+  @param[in] ImageHandle    The image handle of this driver
+  @param[in] SystemTable    The pointer of EFI_SYSTEM_TABLE
+
+  @retval EFI_SUCCESS       The driver initialized successfully
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeSmElogLayerSmm (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  return InitializeSmElogLayer ();
+}
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
index 1192c6e9739c..12060d156ef4 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
@@ -132,6 +132,7 @@
   IpmiFeaturePkg/BmcElog/SmmBmcElog.inf
   IpmiFeaturePkg/GenericElog/Dxe/GenericElog.inf
   IpmiFeaturePkg/GenericElog/Smm/GenericElog.inf
+  IpmiFeaturePkg/GenericElog/Smm/GenericElogStandaloneMm.inf
   IpmiFeaturePkg/Frb/FrbDxe.inf
   IpmiFeaturePkg/IpmiRedirFru/IpmiRedirFru.inf
   IpmiFeaturePkg/GenericFru/GenericFru.inf
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112767): https://edk2.groups.io/g/devel/message/112767
Mute This Topic: https://groups.io/mt/103284563/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to