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>
Subject: [edk2-devel] [PATCH edk2-platforms 2/4] IpmiFeaturePkg/BmcAcpiSwChild: Support Standalone MM
Date: Thu, 21 Dec 2023 01:01:43 +0800	[thread overview]
Message-ID: <f053780a5ec76070e3706619754e70307c5f6a78.1703090380.git.wei6.xu@intel.com> (raw)
In-Reply-To: <cover.1703090380.git.wei6.xu@intel.com>

Refactor BmcAcpiSwChild to support Standalone MM.

Cc: Abner Chang <Abner.Chang@amd.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
---
 .../BmcAcpiSwChild/BmcAcpiSwChild.c           | 12 ++----
 .../BmcAcpiSwChild/BmcAcpiSwChild.h           | 15 ++-----
 .../BmcAcpiSwChild/BmcAcpiSwChild.inf         |  5 ++-
 .../BmcAcpiSwChildStandaloneMm.c              | 31 ++++++++++++++
 .../BmcAcpiSwChildStandaloneMm.inf            | 40 +++++++++++++++++++
 .../BmcAcpiSwChildTraditionalMm.c             | 31 ++++++++++++++
 .../IpmiFeaturePkg/Include/IpmiFeature.dsc    |  1 +
 7 files changed, 113 insertions(+), 22 deletions(-)
 create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildStandaloneMm.c
 create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildStandaloneMm.inf
 create mode 100644 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildTraditionalMm.c

diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.c
index ba134db8d50d..2a058fe687f9 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.c
@@ -15,21 +15,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 EFI_BMC_ACPI_SW_CHILD_POLICY_PROTOCOL  mBmcAcpiSwChild;
 
 /**
-  This is the standard EFI driver entrypoint. This function initializes
-  the BMC ACPI SW Child protocol.
-
-  @param ImageHandle - ImageHandle of the loaded driver
-  @param SystemTable - Pointer to the System Table
+  This function initializes the BMC ACPI SW Child protocol.
 
   @retval EFI_SUCCESS - If all services discovered.
   @retval Other       - Failure in constructor.
 
 **/
 EFI_STATUS
-EFIAPI
 InitializeBmcAcpiSwChild (
-  IN EFI_HANDLE        ImageHandle,
-  IN EFI_SYSTEM_TABLE  *SystemTable
+  VOID
   )
 {
   EFI_STATUS  Status;
@@ -43,7 +37,7 @@ InitializeBmcAcpiSwChild (
   // Install protocol
   //
   Handle = NULL;
-  Status = gSmst->SmmInstallProtocolInterface (
+  Status = gMmst->MmInstallProtocolInterface (
                     &Handle,
                     &gEfiBmcAcpiSwChildPolicyProtocolGuid,
                     EFI_NATIVE_INTERFACE,
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.h b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.h
index 10d687ed2b84..7eb839483879 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.h
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.h
@@ -12,12 +12,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 // Statements that include other files
 //
-#include <Uefi.h>
+#include <PiMm.h>
 #include <Library/BaseLib.h>
-#include <Library/SmmLib.h>
 #include <Library/DebugLib.h>
 #include <Library/BaseMemoryLib.h>
-#include <Library/SmmServicesTableLib.h>
+#include <Library/MmServicesTableLib.h>
 #include <Library/MemoryAllocationLib.h>
 
 #include "ServerManagement.h"
@@ -33,21 +32,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 
 /**
-  This is the standard EFI driver entrypoint. This function initializes
-  the BMC ACPI SW Child protocol.
-
-  @param ImageHandle - ImageHandle of the loaded driver
-  @param SystemTable - Pointer to the System Table
+  This function initializes the BMC ACPI SW Child protocol.
 
   @retval EFI_SUCCESS - If all services discovered.
   @retval Other       - Failure in constructor.
 
 **/
 EFI_STATUS
-EFIAPI
 InitializeBmcAcpiSwChild (
-  IN EFI_HANDLE        ImageHandle,
-  IN EFI_SYSTEM_TABLE  *SystemTable
+  VOID
   );
 
 /**
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.inf
index 59a9f77d9f10..c2de4a1c82a9 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.inf
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.inf
@@ -14,11 +14,12 @@
   MODULE_TYPE              = DXE_SMM_DRIVER
   PI_SPECIFICATION_VERSION = 0x0001000A
   VERSION_STRING           = 1.0
-  ENTRY_POINT              = InitializeBmcAcpiSwChild
+  ENTRY_POINT              = BmcAcpiSwChildSmmEntry
 
 [Sources]
   BmcAcpiSwChild.c
   BmcAcpiSwChild.h
+  BmcAcpiSwChildTraditionalMm.c
 
 [Packages]
   IpmiFeaturePkg/IpmiFeaturePkg.dec
@@ -28,7 +29,7 @@
 [LibraryClasses]
   UefiDriverEntryPoint
   DebugLib
-  SmmServicesTableLib
+  MmServicesTableLib
   ServerManagementLib
   IpmiBaseLib
 
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildStandaloneMm.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildStandaloneMm.c
new file mode 100644
index 000000000000..f302f9976565
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildStandaloneMm.c
@@ -0,0 +1,31 @@
+/** @file
+  This driver publishes a protocol that is used by the ACPI SMM Platform
+  driver to notify the BMC of Power State transitions.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "BmcAcpiSwChild.h"
+
+/**
+  This is the Stanalone MM driver entrypoint. This function intitializes
+  the BMC ACPI SW Child protocol.
+
+  @param[in] ImageHandle   ImageHandle of the loaded driver
+  @param[in] SystemTable   Pointer to the System Table
+
+  @retval EFI_SUCCESS      If all services discovered.
+  @retval Other            Failure in constructor.
+
+**/
+EFI_STATUS
+EFIAPI
+BmcAcpiSwChildMmEntry (
+  IN EFI_HANDLE           ImageHandle,
+  IN EFI_MM_SYSTEM_TABLE  *SystemTable
+  )
+{
+  return InitializeBmcAcpiSwChild ();
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildStandaloneMm.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildStandaloneMm.inf
new file mode 100644
index 000000000000..cf8a715bd9e4
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildStandaloneMm.inf
@@ -0,0 +1,40 @@
+### @file
+#
+# Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+
+[Defines]
+  INF_VERSION              = 0x00010005
+  BASE_NAME                = BmcAcpiSwChild
+  FILE_GUID                = 81657b09-61ea-4f4a-ac6a-9f7f4cdd7450
+  MODULE_TYPE              = MM_STANDALONE
+  PI_SPECIFICATION_VERSION = 0x00010032
+  VERSION_STRING           = 1.0
+  ENTRY_POINT              = BmcAcpiSwChildMmEntry
+
+[Sources]
+  BmcAcpiSwChild.c
+  BmcAcpiSwChild.h
+  BmcAcpiSwChildStandaloneMm.c
+
+[Packages]
+  IpmiFeaturePkg/IpmiFeaturePkg.dec
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+  StandaloneMmDriverEntryPoint
+  DebugLib
+  MmServicesTableLib
+  ServerManagementLib
+  IpmiBaseLib
+
+[Protocols]
+  gEfiBmcAcpiSwChildPolicyProtocolGuid   # PROTOCOL ALWAYS_PRODUCED
+
+[Depex]
+  gSmmIpmiTransportProtocolGuid
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildTraditionalMm.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildTraditionalMm.c
new file mode 100644
index 000000000000..f1acee932214
--- /dev/null
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildTraditionalMm.c
@@ -0,0 +1,31 @@
+/** @file
+  This driver publishes a protocol that is used by the ACPI SMM Platform
+  driver to notify the BMC of Power State transitions.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "BmcAcpiSwChild.h"
+
+/**
+  This is the standard EFI driver entrypoint. This function intitializes
+  the BMC ACPI SW Child protocol.
+
+  @param[in] ImageHandle   ImageHandle of the loaded driver
+  @param[in] SystemTable   Pointer to the System Table
+
+  @retval EFI_SUCCESS      If all services discovered.
+  @retval Other            Failure in constructor.
+
+**/
+EFI_STATUS
+EFIAPI
+BmcAcpiSwChildSmmEntry (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  return InitializeBmcAcpiSwChild ();
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
index 45439f92eaac..1192c6e9739c 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
@@ -127,6 +127,7 @@
   IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf
   IpmiFeaturePkg/BmcAcpiState/BmcAcpiState.inf
   IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChild.inf
+  IpmiFeaturePkg/BmcAcpiSwChild/BmcAcpiSwChildStandaloneMm.inf
   IpmiFeaturePkg/BmcElog/DxeBmcElog.inf
   IpmiFeaturePkg/BmcElog/SmmBmcElog.inf
   IpmiFeaturePkg/GenericElog/Dxe/GenericElog.inf
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112766): https://edk2.groups.io/g/devel/message/112766
Mute This Topic: https://groups.io/mt/103284562/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 ` Xu, Wei6 [this message]
2023-12-20 17:01 ` [edk2-devel] [PATCH edk2-platforms 3/4] IpmiFeaturePkg/GenericElog: " Xu, Wei6
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=f053780a5ec76070e3706619754e70307c5f6a78.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