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

-----Original Message-----
From: Huang, Li-Xia <lisa.hu...@intel.com> 
Sent: Tuesday, December 5, 2023 11:00 PM
To: devel@edk2.groups.io
Cc: Abner Chang <abner.ch...@amd.com>; Desimone, Nathaniel L 
<nathaniel.l.desim...@intel.com>
Subject: [PATCH v1 1/1] IpmiFeaturePkg/GenericIpmi: Sync change from SMM

Sync change from SMM to StandaloneMm GenericIpmi driver.
Update SmmIpmbInterface and SmmSsifInterface Lib to support MM_STANDALONE. And 
Format code with uncrustify.

Cc: Abner Chang <abner.ch...@amd.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>

Signed-off-by: Lixia Huang <lisa.hu...@intel.com>
---
 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c
                        | 315 +++++++++++++++++---
 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.c
   |   4 +-
 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.c
   |  64 ++--
 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.inf
                      |  10 +
 Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc      
                                             |   2 +-
 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf
 |   4 +-
 
Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf
 |   4 +-
 7 files changed, 326 insertions(+), 77 deletions(-)

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c
index d808e2517c99..1b9841e4b745 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Stan
+++ daloneMm/StandaloneMmGenericIpmi.c
@@ -19,17 +19,157 @@
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/IpmiBaseLib.h>
 #include <Library/TimerLib.h>
+#include <Library/BmcCommonInterfaceLib.h>
 #include <SmStatusCodes.h>
 #include "IpmiHooks.h"
 #include "IpmiBmcCommon.h"
 #include "IpmiBmc.h"
 
-IPMI_BMC_INSTANCE_DATA             *mIpmiInstance;
-EFI_HANDLE                         mHandle;
+IPMI_BMC_INSTANCE_DATA  *mIpmiInstance;
+EFI_HANDLE              mIpmiTransportHandle;
+EFI_HANDLE              mIpmiTransport2Handle;
 
 /**
+
+Routine Description:
+  Initialize the API and parameters for IPMI Transport2 Instance
+
+Arguments:
+  IpmiInstance    - Pointer to IPMI Instance.
+
+Returns:
+  VOID            - Nothing.
+
+**/
+VOID
+InitIpmiTransport2 (
+  IN  IPMI_BMC_INSTANCE_DATA  *IpmiInstance
+  )
+{
+  IpmiInstance->IpmiTransport2.InterfaceType           = FixedPcdGet8 
(PcdDefaultSystemInterface);
+  IpmiInstance->IpmiTransport2.IpmiTransport2BmcStatus = BmcStatusOk;
+  IpmiInstance->IpmiTransport2.IpmiSubmitCommand2      = IpmiSendCommand2;
+  IpmiInstance->IpmiTransport2.IpmiSubmitCommand2Ex    = IpmiSendCommand2Ex;
+
+  if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
+    InitBtInterfaceData (&IpmiInstance->IpmiTransport2);  }
+
+  if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
+    InitSsifInterfaceData (&IpmiInstance->IpmiTransport2);  }
+
+  if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
+    InitIpmbInterfaceData (&IpmiInstance->IpmiTransport2);
+  }
+}
+
+/**
+
+Routine Description:
+  Notify call back to initialize the interfaces and install SMM IPMI
+  protocol.
+
+Arguments:
+  Protocol    - Pointer to the protocol guid.
+  Interface   - Pointer to the protocol instance.
+  Handle      - Handle on which the protocol is installed.
+
+Returns:
+  Status of Notify call back.
+
+**/
+EFI_STATUS
+EFIAPI
+SmmNotifyCallback (
+  IN CONST  EFI_GUID    *Protocol,
+  IN        VOID        *Interface,
+  IN        EFI_HANDLE  Handle
+  )
+{
+  EFI_STATUS            Status;
+  IPMI_INTERFACE_STATE  InterfaceState;
+
+  InterfaceState = IpmiInterfaceNotReady;
+
+  if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
+    InitSsifInterfaceData (&mIpmiInstance->IpmiTransport2);
+
+    if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == 
IpmiInterfaceInitialized) {
+      InterfaceState = IpmiInterfaceInitialized;
+    }
+  }
+
+  if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
+    InitIpmbInterfaceData (&mIpmiInstance->IpmiTransport2);  }
+
+  if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == 
IpmiInterfaceInitialized) {
+    InterfaceState = IpmiInterfaceInitialized;  }
+
+  if (InterfaceState != IpmiInterfaceInitialized) {
+    return EFI_SUCCESS;
+  }
+
+  // Default Interface data should be initialized to install Ipmi Transport2 
Protocol.
+  if (InterfaceState == IpmiInterfaceInitialized) {
+    mIpmiTransport2Handle = NULL;
+    Status                = gMmst->MmInstallProtocolInterface (
+                                     &mIpmiTransport2Handle,
+                                     &gSmmIpmiTransport2ProtocolGuid,
+                                     EFI_NATIVE_INTERFACE,
+                                     &mIpmiInstance->IpmiTransport2
+                                     );  }
+
+  ASSERT_EFI_ERROR (Status);
+  return EFI_SUCCESS;
+}
+
+/**
+
+Routine Description:
+  Registers Protocol call back.
+
+Arguments:
+  ProtocolGuid    - Pointer to Protocol GUID to register call back.
+
+Returns:
+  Status.
+
+**/
+EFI_STATUS
+MmRegisterProtocolCallback (
+  IN  EFI_GUID  *ProtocolGuid
+  )
+{
+  EFI_STATUS  Status;
+  VOID        *Registration;
+
+  if ((ProtocolGuid == NULL) ||
+      ((ProtocolGuid != NULL) && IsZeroBuffer (ProtocolGuid, sizeof 
+ (EFI_GUID))))  {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Status = gMmst->MmRegisterProtocolNotify (
+                    ProtocolGuid,
+                    SmmNotifyCallback,
+                    &Registration
+                    );
+  return Status;
+}
+
+EFI_STATUS
+SmmInitializeIpmiKcsPhysicalLayer (
+  VOID
+  )
+
+/**
+
 Routine Description:
-  Setup and initialize the BMC for the SMM phase.  In order to verify the BMC 
is functioning
+  Setup and initialize the BMC for the DXE phase.  In order to verify 
+ the BMC is functioning
   as expected, the BMC Selftest is performed.  The results are then checked 
and any errors are
   reported to the error manager.  Errors are collected throughout this routine 
and reported
   just prior to installing the driver.  If there are more errors than 
MAX_SOFT_COUNT, then they @@ -43,25 +183,27 @@ Returns:
   EFI_SUCCESS - Successful driver initialization
 
 **/
-EFI_STATUS
-SmmInitializeIpmiKcsPhysicalLayer (
-  VOID
-  )
 {
-  EFI_STATUS                       Status;
+  EFI_STATUS            Status;
+  UINT8                 ErrorCount;
+  IPMI_INTERFACE_STATE  InterfaceState;
+  UINT8                 Index;
 
-  DEBUG ((DEBUG_INFO,"SmmInitializeIpmiKcsPhysicalLayer entry \n"));
+  DEBUG ((DEBUG_INFO, "SmmInitializeIpmiKcsPhysicalLayer entry \n"));
+  ErrorCount     = 0;
+  InterfaceState = IpmiInterfaceNotReady;
 
   Status = gMmst->MmAllocatePool (
                     EfiRuntimeServicesData,
                     sizeof (IPMI_BMC_INSTANCE_DATA),
-                    (VOID **)&mIpmiInstance);
-
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "mIpmiInstance mem alloc failed - 0x%x\n", Status));
-    return Status;
+                    (VOID **)&mIpmiInstance
+                    );
+  ASSERT (mIpmiInstance != NULL);
+  if (mIpmiInstance == NULL) {
+    DEBUG ((DEBUG_ERROR, "ERROR!! Null Pointer returned by AllocateZeroPool 
()\n"));
+    ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+    return EFI_OUT_OF_RESOURCES;
   } else {
-
     //
     // Initialize the KCS transaction timeout. Assume delay unit is 1000 us.
     //
@@ -70,23 +212,110 @@ SmmInitializeIpmiKcsPhysicalLayer (
     //
     // Initialize IPMI IO Base, we still use SMS IO base to get device ID and 
Seltest result since SMM IF may have different cmds supported
     //
-    mIpmiInstance->IpmiIoBase                       = FixedPcdGet16 
(PcdIpmiSmmIoBaseAddress);
-    mIpmiInstance->Signature                        = SM_IPMI_BMC_SIGNATURE;
-    mIpmiInstance->SlaveAddress                     = BMC_SLAVE_ADDRESS;
-    mIpmiInstance->BmcStatus                        = BMC_NOTREADY;
-    mIpmiInstance->IpmiTransport.IpmiSubmitCommand  = IpmiSendCommand;
-    mIpmiInstance->IpmiTransport.GetBmcStatus       = IpmiGetBmcStatus;
-
-    mHandle = NULL;
-    Status = gMmst->MmInstallProtocolInterface (
-                      &mHandle,
-                      &gSmmIpmiTransportProtocolGuid,
-                      EFI_NATIVE_INTERFACE,
-                      &mIpmiInstance->IpmiTransport
-                      );
-    ASSERT_EFI_ERROR (Status);
-
-    DEBUG ((DEBUG_INFO,"SmmInitializeIpmiKcsPhysicalLayer exit \n"));
+    mIpmiInstance->IpmiIoBase                      = FixedPcdGet16 
(PcdIpmiSmmIoBaseAddress);
+    mIpmiInstance->Signature                       = SM_IPMI_BMC_SIGNATURE;
+    mIpmiInstance->SlaveAddress                    = BMC_SLAVE_ADDRESS;
+    mIpmiInstance->BmcStatus                       = BMC_NOTREADY;
+    mIpmiInstance->IpmiTransport.IpmiSubmitCommand = IpmiSendCommand;
+    mIpmiInstance->IpmiTransport.GetBmcStatus      = IpmiGetBmcStatus;
+
+    if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
+      DEBUG ((DEBUG_INFO, "IPMI: Waiting for Getting BMC DID in SMM \n"));
+      //
+      // Get the Device ID and check if the system is in Force Update mode.
+      //
+      // Just obey the Spec..
+      // To improve performance, we're going to comment it.
+      //
+
+      mIpmiTransportHandle = NULL;
+      Status               = gMmst->MmInstallProtocolInterface (
+                                      &mIpmiTransportHandle,
+                                      &gSmmIpmiTransportProtocolGuid,
+                                      EFI_NATIVE_INTERFACE,
+                                      &mIpmiInstance->IpmiTransport
+                                      );
+      ASSERT_EFI_ERROR (Status);
+    }
+
+    InitIpmiTransport2 (mIpmiInstance);
+
+    // Check interface data initialized successfully else register notify 
protocol.
+    for (Index = SysInterfaceKcs; Index < SysInterfaceMax; Index++) {
+      switch (Index) {
+        case SysInterfaceKcs:
+          if (FixedPcdGet8 (PcdKcsInterfaceSupport) == 1) {
+            if ((mIpmiInstance->BmcStatus != BMC_HARDFAIL) && 
(mIpmiInstance->BmcStatus != BMC_UPDATE_IN_PROGRESS)) {
+              BMC_INTERFACE_STATUS  BmcStatus;
+              mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = 
IpmiInterfaceInitialized;
+              Status                                                    = 
CheckSelfTestByInterfaceType (
+                                                                            
&mIpmiInstance->IpmiTransport2,
+                                                                            
&BmcStatus,
+                                                                            
SysInterfaceKcs
+                                                                            );
+              if (!EFI_ERROR (Status) && (BmcStatus != BmcStatusHardFail)) {
+                InterfaceState = IpmiInterfaceInitialized;
+              } else {
+                mIpmiInstance->IpmiTransport2.Interface.KcsInterfaceState = 
IpmiInterfaceInitError;
+              }
+            }
+          }
+
+          break;
+
+        case SysInterfaceBt:
+          if (FixedPcdGet8 (PcdBtInterfaceSupport) == 1) {
+            if (mIpmiInstance->IpmiTransport2.Interface.Bt.InterfaceState == 
IpmiInterfaceInitialized) {
+              InterfaceState = IpmiInterfaceInitialized;
+            }
+          }
+
+          break;
+
+        case SysInterfaceSsif:
+          if (FixedPcdGet8 (PcdSsifInterfaceSupport) == 1) {
+            if (mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == 
IpmiInterfaceInitialized) {
+              InterfaceState = IpmiInterfaceInitialized;
+            } else if 
(mIpmiInstance->IpmiTransport2.Interface.Ssif.InterfaceState == 
IpmiInterfaceInitError) {
+              // Register protocol notify for SMBUS Protocol.
+              Status = MmRegisterProtocolCallback 
(&mIpmiInstance->IpmiTransport2.Interface.Ssif.SsifInterfaceApiGuid);
+            }
+          }
+
+          break;
+
+        case SysInterfaceIpmb:
+          if (FixedPcdGet8 (PcdIpmbInterfaceSupport) == 1) {
+            if (mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == 
IpmiInterfaceInitialized) {
+              InterfaceState = IpmiInterfaceInitialized;
+            } else if 
(mIpmiInstance->IpmiTransport2.Interface.Ipmb.InterfaceState == 
IpmiInterfaceInitError) {
+              // Register protocol notify for SMBUS Protocol.
+              Status = MmRegisterProtocolCallback 
(&mIpmiInstance->IpmiTransport2.Interface.Ipmb.IpmbInterfaceApiGuid);
+            }
+          }
+
+          break;
+
+        default:
+          break;
+      }
+    }
+
+    // Default Interface data should be initialized to install Ipmi Transport2 
Protocol.
+    if (InterfaceState == IpmiInterfaceInitialized) {
+      mIpmiTransport2Handle = NULL;
+      Status                = gMmst->MmInstallProtocolInterface (
+                                       &mIpmiTransport2Handle,
+                                       &gSmmIpmiTransport2ProtocolGuid,
+                                       EFI_NATIVE_INTERFACE,
+                                       &mIpmiInstance->IpmiTransport2
+                                       );
+      if (EFI_ERROR (Status)) {
+        DEBUG ((DEBUG_ERROR, "IPMI Transport2 protocol install Status = %r 
\n", Status));
+      }
+    }
+
+    DEBUG ((DEBUG_INFO, "SmmInitializeIpmiKcsPhysicalLayer exit \n"));
 
     return EFI_SUCCESS;
   }
@@ -104,8 +333,8 @@ SmmInitializeIpmiKcsPhysicalLayer (  **/  EFI_STATUS  
InitializeGenericIpmiStandaloneMm (
-  IN EFI_HANDLE             ImageHandle,
-  IN EFI_MM_SYSTEM_TABLE    *SystemTable
+  IN EFI_HANDLE           ImageHandle,
+  IN EFI_MM_SYSTEM_TABLE  *SystemTable
   )
 {
   SmmInitializeIpmiKcsPhysicalLayer (); @@ -124,21 +353,31 @@ 
InitializeGenericIpmiStandaloneMm (  EFI_STATUS  EFIAPI  
GenericIpmiStandaloneMmUnload (
-  IN EFI_HANDLE             ImageHandle
+  IN EFI_HANDLE  ImageHandle
   )
 {
-  EFI_STATUS                Status;
+  EFI_STATUS  Status;
 
   Status = EFI_SUCCESS;
   if (mIpmiInstance != NULL) {
-    if (mHandle != NULL) {
+    if (mIpmiTransportHandle != NULL) {
       Status = gMmst->MmUninstallProtocolInterface (
-                        mHandle,
+                        mIpmiTransportHandle,
                         &gSmmIpmiTransportProtocolGuid,
                         &mIpmiInstance->IpmiTransport
                         );
       ASSERT_EFI_ERROR (Status);
     }
+
+    if (mIpmiTransport2Handle != NULL) {
+      Status = gMmst->MmUninstallProtocolInterface (
+                        mIpmiTransport2Handle,
+                        &gSmmIpmiTransport2ProtocolGuid,
+                        &mIpmiInstance->IpmiTransport2
+                        );
+      ASSERT_EFI_ERROR (Status);
+    }
+
     gMmst->MmFreePool (mIpmiInstance);
   }
 
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.c
index b5d63353e403..589ea81a72c1 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInter
+++ faceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.c
@@ -8,7 +8,7 @@
 **/
 
 #include <Library/DebugLib.h>
-#include <Library/SmmServicesTableLib.h>
+#include <Library/MmServicesTableLib.h>
 #include <Library/BmcCommonInterfaceLib.h>  #include 
<Library/IpmbInterfaceLib.h>  #include <Protocol/I2cMaster.h> @@ -76,7 +76,7 @@ 
IpmiGetI2cApiPtr (
   IpmiTransport2->Interface.Ipmb.IpmbInterfaceApiGuid = 
gEfiI2cMasterProtocolGuid;
 
   // Locate the I2C SMM Protocol for Communication.
-  Status = gSmst->SmmLocateProtocol (
+  Status = gMmst->MmLocateProtocol (
                                      &gEfiI2cMasterProtocolGuid,
                                      NULL,
                                      (VOID **)&I2cMasterTransmit diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.c
index e784631909ce..1f50977c31be 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInter
+++ faceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.c
@@ -8,7 +8,7 @@
 **/
 
 #include <Library/DebugLib.h>
-#include <Library/SmmServicesTableLib.h>
+#include <Library/MmServicesTableLib.h>
 #include <Library/BmcCommonInterfaceLib.h>  #include 
<Library/MemoryAllocationLib.h>  #include <Library/SsifInterfaceLib.h> @@ 
-54,14 +54,14 @@ IpmiSmbusSendCommand (
 
   if (EfiSmbusHcProtocol != NULL) {
     Status = EfiSmbusHcProtocol->Execute (
-                                          EfiSmbusHcProtocol,
-                                          SlaveAddress,
-                                          Command,
-                                          Operation,
-                                          PecCheck,
-                                          Length,
-                                          Buffer
-                                          );
+                                   EfiSmbusHcProtocol,
+                                   SlaveAddress,
+                                   Command,
+                                   Operation,
+                                   PecCheck,
+                                   Length,
+                                   Buffer
+                                   );
   }
 
   DEBUG ((DEBUG_INFO, "%a EfiSmbusHcProtocol->Execute Status = %r\n", 
__func__, Status)); @@ -95,13 +95,13 @@ IpmiGetSmbusApiPtr (
   IpmiTransport2->Interface.Ssif.SsifInterfaceApiGuid = 
gEfiSmbusHcProtocolGuid;
   HandleCount                                         = 0;
 
-  Status = gSmst->SmmLocateHandle (
-                                   ByProtocol,
-                                   &gEfiSmbusHcProtocolGuid,
-                                   NULL,
-                                   &HandleCount,
-                                   HandleBuffer
-                                   );
+  Status = gMmst->MmLocateHandle (
+                    ByProtocol,
+                    &gEfiSmbusHcProtocolGuid,
+                    NULL,
+                    &HandleCount,
+                    HandleBuffer
+                    );
   if (EFI_ERROR (Status) && (Status == EFI_BUFFER_TOO_SMALL)) {
     // Allocate memory for Handle buffer
     HandleBuffer = AllocateZeroPool (HandleCount); @@ -109,13 +109,13 @@ 
IpmiGetSmbusApiPtr (
       return EFI_NOT_FOUND;
     }
 
-    Status = gSmst->SmmLocateHandle (
-                                     ByProtocol,
-                                     &gEfiSmbusHcProtocolGuid,
-                                     NULL,
-                                     &HandleCount,
-                                     HandleBuffer
-                                     );
+    Status = gMmst->MmLocateHandle (
+                      ByProtocol,
+                      &gEfiSmbusHcProtocolGuid,
+                      NULL,
+                      &HandleCount,
+                      HandleBuffer
+                      );
     if (EFI_ERROR (Status)) {
       // Free HandleBuffer memory
       FreePool (HandleBuffer);
@@ -124,11 +124,11 @@ IpmiGetSmbusApiPtr (
   }
 
   for (Index = 0; Index < HandleCount; Index++) {
-    Status = gSmst->SmmHandleProtocol (
-                                       HandleBuffer[Index],
-                                       &gEfiSmbusHcProtocolGuid,
-                                       (VOID **)&EfiSmbusHcProtocol
-                                       );
+    Status = gMmst->MmHandleProtocol (
+                      HandleBuffer[Index],
+                      &gEfiSmbusHcProtocolGuid,
+                      (VOID **)&EfiSmbusHcProtocol
+                      );
     if (EFI_ERROR (Status)) {
       continue;
     }
@@ -137,10 +137,10 @@ IpmiGetSmbusApiPtr (
     IpmiTransport2->Interface.Ssif.SsifInterfaceApiPtr = 
(UINTN)EfiSmbusHcProtocol;
 
     Status = CheckSelfTestByInterfaceType (
-                                           IpmiTransport2,
-                                           &BmcStatus,
-                                           SysInterfaceSsif
-                                           );
+               IpmiTransport2,
+               &BmcStatus,
+               SysInterfaceSsif
+               );
     if (EFI_ERROR (Status) || (BmcStatus == BmcStatusHardFail)) {
       IpmiTransport2->Interface.Ssif.InterfaceState = IpmiInterfaceInitError;
       continue;
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.inf
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.inf
index 170e0a8d136b..e4abc4db29fe 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.inf
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Stan
+++ daloneMm/StandaloneMmGenericIpmi.inf
@@ -38,14 +38,24 @@
   IoLib
   ReportStatusCodeLib
   TimerLib
+  BmcCommonInterfaceLib
+  BtInterfaceLib
+  SsifInterfaceLib
+  IpmbInterfaceLib
 
 [Protocols]
   gSmmIpmiTransportProtocolGuid                     # PROTOCOL ALWAYS_PRODUCED
+  gSmmIpmiTransport2ProtocolGuid                    # PROTOCOL ALWAYS_PRODUCED
 
 [Guids]
 
 [Pcd]
   gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiSmmIoBaseAddress
+  gIpmiFeaturePkgTokenSpaceGuid.PcdDefaultSystemInterface
+  gIpmiFeaturePkgTokenSpaceGuid.PcdBtInterfaceSupport
+  gIpmiFeaturePkgTokenSpaceGuid.PcdSsifInterfaceSupport
+  gIpmiFeaturePkgTokenSpaceGuid.PcdKcsInterfaceSupport
+  gIpmiFeaturePkgTokenSpaceGuid.PcdIpmbInterfaceSupport
 
 [Depex]
   gIpmiTransportProtocolGuid
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
index cfdfc916a464..c9c76565c672 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeat
+++ ure.dsc
@@ -57,7 +57,7 @@
   
SsifInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/DxeSsifInterfaceLib.inf
   
IpmbInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/DxeIpmbInterfaceLib.inf
 
-[LibraryClasses.common.DXE_SMM_DRIVER]
+[LibraryClasses.common.DXE_SMM_DRIVER,LibraryClasses.common.MM_STANDALO
+NE]
   IpmiBaseLib|IpmiFeaturePkg/Library/SmmIpmiBaseLib/SmmIpmiBaseLib.inf
   
SsifInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf
   
IpmbInterfaceLib|IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf
index 5030d5659dc2..32e72bef9bc1 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInter
+++ faceCommonAccess/IpmbInterfaceLib/SmmIpmbInterfaceLib.inf
@@ -14,7 +14,7 @@
   FILE_GUID         = C39F9DC3-37C7-41C1-BE05-8C1524493947
   MODULE_TYPE       = DXE_SMM_DRIVER
   VERSION_STRING    = 1.1
-  LIBRARY_CLASS     = IpmbInterfaceLib | DXE_SMM_DRIVER
+  LIBRARY_CLASS     = IpmbInterfaceLib | DXE_SMM_DRIVER MM_STANDALONE
 
 [Sources]
   SmmIpmbInterfaceLib.c
@@ -27,7 +27,7 @@
 [LibraryClasses]
   DebugLib
   BaseMemoryLib
-  SmmServicesTableLib
+  MmServicesTableLib
   BmcCommonInterfaceLib
 
 [Protocols]
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf
index b1fb44241c37..8ff1a2cf927e 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInterfaceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/BmcInter
+++ faceCommonAccess/SsifInterfaceLib/SmmSsifInterfaceLib.inf
@@ -14,7 +14,7 @@
   FILE_GUID         = DB817B63-FA26-44FA-BF84-8D48596F982B
   MODULE_TYPE       = DXE_SMM_DRIVER
   VERSION_STRING    = 1.1
-  LIBRARY_CLASS     = SsifInterfaceLib | DXE_SMM_DRIVER
+  LIBRARY_CLASS     = SsifInterfaceLib | DXE_SMM_DRIVER MM_STANDALONE
 
 [Sources]
   SmmSsifInterfaceLib.c
@@ -26,7 +26,7 @@
   IpmiFeaturePkg/IpmiFeaturePkg.dec
 
 [LibraryClasses]
-  SmmServicesTableLib
+  MmServicesTableLib
   MemoryAllocationLib
   BmcCommonInterfaceLib
 
--
2.26.2.windows.1



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


Reply via email to