Refactor BmcAcpiSwChild to support Standalone MM.

Cc: Abner Chang <abner.ch...@amd.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Signed-off-by: Wei6 Xu <wei6...@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/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to