[edk2-devel] [edk2-platforms][PATCH] ManageabilityPkg/Ipmi: IPMI Get System Interface Capabilities Command

Chang, Abner via groups.io posted 1 patch 6 months, 3 weeks ago
Failed in applying to current master (apply log)
.../IpmiCommandLib/IpmiCommandLibNetFnApp.c   | 68 +++++++++++++++++++
1 file changed, 68 insertions(+)
[edk2-devel] [edk2-platforms][PATCH] ManageabilityPkg/Ipmi: IPMI Get System Interface Capabilities Command
Posted by Chang, Abner via groups.io 6 months, 3 weeks ago
From: Abner Chang <abner.chang@amd.com>

Implment AppFn, 0x57 command.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
---
 .../IpmiCommandLib/IpmiCommandLibNetFnApp.c   | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
index e580ec2ece..f145e291a9 100644
--- a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
+++ b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
@@ -442,3 +442,71 @@ IpmiGetChannelInfo (
                                   );
   return Status;
 }
+
+/**
+  This function gets system interface capability
+
+  @param[in]  InterfaceCapabilityRequest    Get system interface capability request.
+  @param[out] InterfaceCapabilityResponse   The response of system interface capability.
+                                            That is caller's responsibility to allocate
+                                            memory for the response data.
+
+  @retval EFI_SUCCESS            Command is sent successfully.
+  @retval Other                  Failure.
+
+**/
+EFI_STATUS
+EFIAPI
+IpmiGetSystemInterfaceCapability (
+  IN  IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_REQUEST   *InterfaceCapabilityRequest,
+  OUT IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_RESPONSE  *InterfaceCapabilityResponse
+  )
+{
+  UINT8       InterfaceType;
+  UINT32      ResponseSize;
+  UINT32      ActualResponseSize;
+  UINT8       *ResponsePtr;
+  EFI_STATUS  Status;
+
+  if (InterfaceCapabilityRequest == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  InterfaceType = InterfaceCapabilityRequest->Bits.InterfaceType;
+  if ((InterfaceType != IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_INTERFACE_TYPE_SSIF) &&
+      (InterfaceType != IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_INTERFACE_TYPE_KCS) &&
+      (InterfaceType != IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_INTERFACE_TYPE_SMIC))
+  {
+    DEBUG ((DEBUG_ERROR, "%a: Unsupported given system interface type = 0x%x.\n", __func__, InterfaceType));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  if (InterfaceType == IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_INTERFACE_TYPE_SSIF) {
+    ResponseSize = sizeof (IPMI_GET_SYSTEM_INTERFACE_SSIF_CAPABILITIES_RESPONSE);
+    ResponsePtr  = (UINT8 *)InterfaceCapabilityResponse->InterfaceSsifCapability;
+  } else {
+    ResponseSize = sizeof (IPMI_GET_SYSTEM_INTERFACE_KCS_SMIC_CAPABILITIES_RESPONSE);
+    ResponsePtr  = (UINT8 *)InterfaceCapabilityResponse->InterfaceKcsSmicCapability;
+  }
+
+  ActualResponseSize = ResponseSize;
+  Status             = IpmiSubmitCommand (
+                         IPMI_NETFN_APP,
+                         IPMI_APP_GET_SYSTEM_INTERFACE_CAPABILITIES,
+                         (UINT8 *)InterfaceCapabilityRequest,
+                         sizeof (IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_REQUEST),
+                         ResponsePtr,
+                         &ActualResponseSize
+                         );
+  if (ActualResponseSize != ResponseSize) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: The expected response size 0x%x is not equal to the returned size 0x%x.\n",
+      __func__,
+      ResponseSize,
+      ActualResponseSize
+      ));
+  }
+
+  return Status;
+}
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109497): https://edk2.groups.io/g/devel/message/109497
Mute This Topic: https://groups.io/mt/101877172/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms][PATCH] ManageabilityPkg/Ipmi: IPMI Get System Interface Capabilities Command
Posted by Attar, AbdulLateef (Abdul Lateef) via groups.io 6 months, 3 weeks ago
[AMD Official Use Only - General]

Looks good.
Reviewed-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>

-----Original Message-----
From: Chang, Abner <Abner.Chang@amd.com>
Sent: Tuesday, October 10, 2023 8:47 PM
To: devel@edk2.groups.io
Cc: Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@amd.com>; Nickle Wang <nicklew@nvidia.com>
Subject: [edk2-platforms][PATCH] ManageabilityPkg/Ipmi: IPMI Get System Interface Capabilities Command

From: Abner Chang <abner.chang@amd.com>

Implment AppFn, 0x57 command.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
---
 .../IpmiCommandLib/IpmiCommandLibNetFnApp.c   | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
index e580ec2ece..f145e291a9 100644
--- a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
+++ b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
@@ -442,3 +442,71 @@ IpmiGetChannelInfo (
                                   );
   return Status;
 }
+
+/**
+  This function gets system interface capability
+
+  @param[in]  InterfaceCapabilityRequest    Get system interface capability request.
+  @param[out] InterfaceCapabilityResponse   The response of system interface capability.
+                                            That is caller's responsibility to allocate
+                                            memory for the response data.
+
+  @retval EFI_SUCCESS            Command is sent successfully.
+  @retval Other                  Failure.
+
+**/
+EFI_STATUS
+EFIAPI
+IpmiGetSystemInterfaceCapability (
+  IN  IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_REQUEST   *InterfaceCapabilityRequest,
+  OUT IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_RESPONSE  *InterfaceCapabilityResponse
+  )
+{
+  UINT8       InterfaceType;
+  UINT32      ResponseSize;
+  UINT32      ActualResponseSize;
+  UINT8       *ResponsePtr;
+  EFI_STATUS  Status;
+
+  if (InterfaceCapabilityRequest == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  InterfaceType = InterfaceCapabilityRequest->Bits.InterfaceType;
+  if ((InterfaceType != IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_INTERFACE_TYPE_SSIF) &&
+      (InterfaceType != IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_INTERFACE_TYPE_KCS) &&
+      (InterfaceType != IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_INTERFACE_TYPE_SMIC))
+  {
+    DEBUG ((DEBUG_ERROR, "%a: Unsupported given system interface type = 0x%x.\n", __func__, InterfaceType));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  if (InterfaceType == IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_INTERFACE_TYPE_SSIF) {
+    ResponseSize = sizeof (IPMI_GET_SYSTEM_INTERFACE_SSIF_CAPABILITIES_RESPONSE);
+    ResponsePtr  = (UINT8 *)InterfaceCapabilityResponse->InterfaceSsifCapability;
+  } else {
+    ResponseSize = sizeof (IPMI_GET_SYSTEM_INTERFACE_KCS_SMIC_CAPABILITIES_RESPONSE);
+    ResponsePtr  = (UINT8 *)InterfaceCapabilityResponse->InterfaceKcsSmicCapability;
+  }
+
+  ActualResponseSize = ResponseSize;
+  Status             = IpmiSubmitCommand (
+                         IPMI_NETFN_APP,
+                         IPMI_APP_GET_SYSTEM_INTERFACE_CAPABILITIES,
+                         (UINT8 *)InterfaceCapabilityRequest,
+                         sizeof (IPMI_GET_SYSTEM_INTERFACE_CAPABILITIES_REQUEST),
+                         ResponsePtr,
+                         &ActualResponseSize
+                         );
+  if (ActualResponseSize != ResponseSize) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "%a: The expected response size 0x%x is not equal to the returned size 0x%x.\n",
+      __func__,
+      ResponseSize,
+      ActualResponseSize
+      ));
+  }
+
+  return Status;
+}
--
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109500): https://edk2.groups.io/g/devel/message/109500
Mute This Topic: https://groups.io/mt/101877172/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-