public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chang, Abner" <abner.chang@amd.com>
To: <devel@edk2.groups.io>
Cc: Isaac Oram <isaac.w.oram@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Nickle Wang <nicklew@nvidia.com>,
	Igor Kulchytskyy <igork@ami.com>
Subject: [edk2-platforms][PATCH V2] IpmiFeaturePkg/IpmiCommandLib: Add IPMI functions
Date: Fri, 6 Jan 2023 00:00:59 +0800	[thread overview]
Message-ID: <20230105160100.772-3-abner.chang@amd.com> (raw)
In-Reply-To: <20230105160100.772-1-abner.chang@amd.com>

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

Add functions to get system UUID and LAN
configuration parameter.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>
---
 .../IpmiCommandLib/IpmiCommandLibNetFnApp.c   | 88 +++++++++++++++++++
 .../IpmiCommandLibNetFnTransport.c            | 43 +++++++++
 2 files changed, 131 insertions(+)

diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
index addabc554e..2e34909f3e 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
@@ -2,6 +2,8 @@
   IPMI Command - NetFnApp.
 
   Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR>
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -245,3 +247,89 @@ IpmiSendMessage (
              );
   return Status;
 }
+
+/**
+  This function gets the system UUID.
+
+  @param[out] SystemGuid   The pointer to retrieve system UUID.
+
+  @retval EFI_SUCCESS               UUID is returned.
+  @retval EFI_INVALID_PARAMETER     SystemGuid is a NULL pointer.
+  @retval Others                    Other errors.
+
+**/
+EFI_STATUS
+EFIAPI
+IpmiGetSystemUuid (
+  OUT EFI_GUID *SystemGuid
+  )
+{
+  EFI_STATUS                    Status;
+  UINT32                        RequestSize;
+  UINT32                        ResponseSize;
+  IPMI_GET_SYSTEM_UUID_RESPONSE GetSystemUuidResponse;
+
+  if (SystemGuid == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+  RequestSize = 0;
+  ResponseSize = sizeof (IPMI_GET_SYSTEM_UUID_RESPONSE);
+  Status = IpmiSubmitCommand (
+             IPMI_NETFN_APP,
+             IPMI_APP_GET_SYSTEM_GUID,
+             (VOID *)NULL,
+             RequestSize,
+             (VOID *)&GetSystemUuidResponse,
+             &ResponseSize
+             );
+  if (!EFI_ERROR (Status) && GetSystemUuidResponse.CompletionCode == IPMI_COMP_CODE_NORMAL) {
+    CopyMem (
+      (VOID *)SystemGuid,
+      (VOID *)&GetSystemUuidResponse.SystemUuid,
+      sizeof (EFI_GUID)
+      );
+  }
+  return Status;
+}
+
+/**
+  This function gets the channel information.
+
+  @param[in]  GetChannelInfoRequest          The get channel information request.
+  @param[out] GetChannelInfoResponse         The get channel information response.
+  @param[out] GetChannelInfoResponseSize     When input, the expected size of response.
+                                             When output, the exact size of the returned
+                                             response.
+
+  @retval EFI_SUCCESS            Get channel information successfully.
+  @retval EFI_INVALID_PARAMETER  One of the given input parameters is invalid.
+  @retval Others                 Other errors.
+
+**/
+EFI_STATUS
+EFIAPI
+IpmiGetChannelInfo (
+  IN  IPMI_GET_CHANNEL_INFO_REQUEST  *GetChannelInfoRequest,
+  OUT IPMI_GET_CHANNEL_INFO_RESPONSE *GetChannelInfoResponse,
+  OUT UINT32                         *GetChannelInfoResponseSize
+  )
+{
+  EFI_STATUS Status;
+
+  if (GetChannelInfoRequest == NULL ||
+      GetChannelInfoResponse == NULL ||
+      GetChannelInfoResponseSize == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  *GetChannelInfoResponseSize = sizeof (IPMI_GET_CHANNEL_INFO_RESPONSE);
+  Status = IpmiSubmitCommand (
+             IPMI_NETFN_APP,
+             IPMI_APP_GET_CHANNEL_INFO,
+             (UINT8 *)GetChannelInfoRequest,
+             sizeof (IPMI_GET_CHANNEL_INFO_REQUEST),
+             (UINT8 *)GetChannelInfoResponse,
+             GetChannelInfoResponseSize
+             );
+  return Status;
+}
diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
index 7dfcf86126..30ea84c04b 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c
@@ -2,6 +2,8 @@
   IPMI Command - NetFnTransport.
 
   Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.<BR>
+  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
+
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -78,3 +80,44 @@ IpmiGetSolConfigurationParameters (
              );
   return Status;
 }
+
+/**
+  This function gets the LAN configuration parameter.
+
+  @param[in]     GetLanConfigurationParametersRequest   Request data
+  @param[out]    GetLanConfigurationParametersResponse  Response data
+  @param[in,out] GetLanConfigurationParametersSize      When input, the expected size of response data.
+                                                        When out, the exact  size of response data.
+
+  @retval EFI_SUCCESS            Lan configuration parameter is returned in the response.
+  @retval EFI_INVALID_PARAMETER  One of the given input parameters is invalid.
+  @retval Others                 Other errors.
+
+**/
+
+EFI_STATUS
+EFIAPI
+IpmiGetLanConfigurationParameters (
+  IN     IPMI_GET_LAN_CONFIGURATION_PARAMETERS_REQUEST  *GetLanConfigurationParametersRequest,
+  OUT    IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE *GetLanConfigurationParametersResponse,
+  IN OUT UINT32                                         *GetLanConfigurationParametersSize
+  )
+{
+  EFI_STATUS Status;
+
+  if (GetLanConfigurationParametersRequest == NULL ||
+      GetLanConfigurationParametersResponse == NULL ||
+      GetLanConfigurationParametersSize == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Status = IpmiSubmitCommand (
+             IPMI_NETFN_TRANSPORT,
+             IPMI_TRANSPORT_GET_LAN_CONFIG_PARAMETERS,
+             (UINT8 *)GetLanConfigurationParametersRequest,
+             sizeof(*GetLanConfigurationParametersRequest),
+             (UINT8 *)GetLanConfigurationParametersResponse,
+             GetLanConfigurationParametersSize
+             );
+  return Status;
+}
-- 
2.37.1.windows.1


  parent reply	other threads:[~2023-01-05 16:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 16:00 [edk2-platforms][PATCH V2] IPMI changes for Redfish Chang, Abner
2023-01-05 16:00 ` [edk2-platforms][PATCH V2] Features/IpmiFeaturePkg: Add IPMI functions Chang, Abner
2023-01-05 16:00 ` Chang, Abner [this message]
2023-01-05 16:01 ` [edk2-platforms][PATCH V2] IpmiFeaturePkg: Add reference of IpmiBaseLib Chang, Abner
2023-01-05 17:05 ` [edk2-platforms][PATCH V2] IPMI changes for Redfish Isaac Oram
     [not found] ` <17377895696F6651.2132@groups.io>
2023-01-05 17:41   ` [edk2-devel] " Isaac Oram
2023-01-06  2:27     ` Chang, Abner
2023-01-11 23:14       ` Isaac Oram
2023-01-12  8:33         ` Chang, Abner

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=20230105160100.772-3-abner.chang@amd.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