public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Xu, Wei6" <wei6.xu@intel.com>
To: devel@edk2.groups.io
Cc: Wei6 Xu <wei6.xu@intel.com>, Abner Chang <Abner.Chang@amd.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Lixia Huang <lisa.huang@intel.com>
Subject: [edk2-devel] [PATCH edk2-platforms 3/4] IpmiFeaturePkg/GenericElog: Support Standalone MM
Date: Thu, 21 Dec 2023 01:01:44 +0800	[thread overview]
Message-ID: <20d97dad031390ae6019e19b6b0063399b3240f7.1703090380.git.wei6.xu@intel.com> (raw)
In-Reply-To: <cover.1703090380.git.wei6.xu@intel.com>

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

Cc: Abner Chang <Abner.Chang@amd.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Lixia Huang <lisa.huang@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/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-12-20 17:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20 17:01 [edk2-devel] [PATCH edk2-platforms 0/4] IpmiFeaturePkg: Support Standalone MM Xu, Wei6
2023-12-20 17:01 ` [edk2-devel] [PATCH edk2-platforms 1/4] IpmiFeaturePkg/ServerManagementLib: " Xu, Wei6
2023-12-20 17:01 ` [edk2-devel] [PATCH edk2-platforms 2/4] IpmiFeaturePkg/BmcAcpiSwChild: " Xu, Wei6
2023-12-20 17:01 ` Xu, Wei6 [this message]
2023-12-20 17:01 ` [edk2-devel] [PATCH edk2-platforms 4/4] IpmiFeaturePkg/BmcElog: " Xu, Wei6
2023-12-21  1:58 ` [edk2-devel] [PATCH edk2-platforms 0/4] IpmiFeaturePkg: " Nate DeSimone
2023-12-21  2:02 ` Nate DeSimone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20d97dad031390ae6019e19b6b0063399b3240f7.1703090380.git.wei6.xu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox