public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Isaac Oram" <isaac.w.oram@intel.com>
To: "abner.chang@amd.com" <abner.chang@amd.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Abdul Lateef Attar <abdattar@amd.com>,
	Nickle Wang <nicklew@nvidia.com>,
	Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Subject: Re: [edk2-platforms][PATCH 2/2] ManageabilityPkg/ManageabilityTransportKcsLib: Add debug message of IPMI KCS Completion Code
Date: Tue, 9 May 2023 23:54:17 +0000	[thread overview]
Message-ID: <SA1PR11MB58013239F15C95A5B36B6133D0769@SA1PR11MB5801.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230509075602.342-2-abner.chang@amd.com>

Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>

Multiple instances of typo:  AdditioalStatus       
I think it is ok to fix before push since it is simple search and replace.

-----Original Message-----
From: abner.chang@amd.com <abner.chang@amd.com> 
Sent: Tuesday, May 9, 2023 12:56 AM
To: devel@edk2.groups.io
Cc: Oram, Isaac W <isaac.w.oram@intel.com>; Abdul Lateef Attar <abdattar@amd.com>; Nickle Wang <nicklew@nvidia.com>; Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Subject: [edk2-platforms][PATCH 2/2] ManageabilityPkg/ManageabilityTransportKcsLib: Add debug message of IPMI KCS Completion Code

From: abnchang <abnchang@amd.com>

Print out IPMI Completion Code and return additional transport interface status.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
---
 .../Common/ManageabilityTransportKcs.h        | 18 +++++----
 .../Common/KcsCommon.c                        | 39 +++++++++++++------
 .../Dxe/ManageabilityTransportKcs.c           |  7 +++-
 3 files changed, 42 insertions(+), 22 deletions(-)

diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
index 8c6a64416a..166aa8dcde 100644
--- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ManageabilityTransportKcs.h
+++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com
+++ mon/ManageabilityTransportKcs.h
@@ -51,6 +51,7 @@ typedef struct {
                                         code is the first byte of response
                                         data.
   @param[in, out] ResponseDataSize      Size of Command Response Data.
+  @param[out]     AdditioalStatus       Additional status of this transaction.
 
   @retval         EFI_SUCCESS           The command byte stream was
                                         successfully submit to the device and a @@ -71,14 +72,15 @@ typedef struct {  EFI_STATUS  EFIAPI  KcsTransportSendCommand (
-  IN  MANAGEABILITY_TRANSPORT_HEADER   TransmitHeader OPTIONAL,
-  IN  UINT16                           TransmitHeaderSize,
-  IN  MANAGEABILITY_TRANSPORT_TRAILER  TransmitTrailer OPTIONAL,
-  IN  UINT16                           TransmitTrailerSize,
-  IN  UINT8                            *RequestData OPTIONAL,
-  IN  UINT32                           RequestDataSize,
-  OUT UINT8                            *ResponseData OPTIONAL,
-  IN OUT UINT32                        *ResponseDataSize OPTIONAL
+  IN  MANAGEABILITY_TRANSPORT_HEADER              TransmitHeader OPTIONAL,
+  IN  UINT16                                      TransmitHeaderSize,
+  IN  MANAGEABILITY_TRANSPORT_TRAILER             TransmitTrailer OPTIONAL,
+  IN  UINT16                                      TransmitTrailerSize,
+  IN  UINT8                                       *RequestData OPTIONAL,
+  IN  UINT32                                      RequestDataSize,
+  OUT UINT8                                       *ResponseData OPTIONAL,
+  IN  OUT UINT32                                  *ResponseDataSize OPTIONAL,
+  OUT  MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS  *AdditioalStatus
   );
 
 /**
diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c
index a8c6a674c9..84792311be 100644
--- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/KcsCommon.c
+++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com
+++ mon/KcsCommon.c
@@ -392,10 +392,8 @@ KcsTransportRead (
                                         code is the first byte of response
                                         data.
   @param[in, out] ResponseDataSize      Size of Command Response Data.
-                                        When IN, it is the expected data size
-                                        of response data.
-                                        When OUT, it is the data size of response
-                                        exactly returned.
+  @param[out]     AdditioalStatus       Additional status of this transaction.
+
   @retval         EFI_SUCCESS           The command byte stream was
                                         successfully submit to the device and a
                                         response was successfully received.
@@ -414,20 +412,22 @@ KcsTransportRead (  EFI_STATUS  EFIAPI  KcsTransportSendCommand (
-  IN  MANAGEABILITY_TRANSPORT_HEADER   TransmitHeader OPTIONAL,
-  IN  UINT16                           TransmitHeaderSize,
-  IN  MANAGEABILITY_TRANSPORT_TRAILER  TransmitTrailer OPTIONAL,
-  IN  UINT16                           TransmitTrailerSize,
-  IN  UINT8                            *RequestData OPTIONAL,
-  IN  UINT32                           RequestDataSize,
-  OUT UINT8                            *ResponseData OPTIONAL,
-  IN OUT UINT32                        *ResponseDataSize OPTIONAL
+  IN  MANAGEABILITY_TRANSPORT_HEADER              TransmitHeader OPTIONAL,
+  IN  UINT16                                      TransmitHeaderSize,
+  IN  MANAGEABILITY_TRANSPORT_TRAILER             TransmitTrailer OPTIONAL,
+  IN  UINT16                                      TransmitTrailerSize,
+  IN  UINT8                                       *RequestData OPTIONAL,
+  IN  UINT32                                      RequestDataSize,
+  OUT UINT8                                       *ResponseData OPTIONAL,
+  IN  OUT UINT32                                  *ResponseDataSize OPTIONAL,
+  OUT  MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS  *AdditioalStatus
   )
 {
   EFI_STATUS                Status;
   UINT32                    RspHeaderSize;
   IPMI_KCS_RESPONSE_HEADER  RspHeader;
   UINT32                    ExpectedResponseDataSize;
+  CHAR16                    *CompletionCodeStr;
 
   if ((RequestData != NULL) && (RequestDataSize == 0)) {
     DEBUG ((DEBUG_ERROR, "%a: Mismatched values of RequestData and RequestDataSize\n", __FUNCTION__)); @@ -439,6 +439,11 @@ KcsTransportSendCommand (
     return EFI_INVALID_PARAMETER;
   }
 
+  if (AdditioalStatus == NULL) {
+    DEBUG ((DEBUG_ERROR, "%a: AdditioalStatus is NULL.\n", __func__));
+    return EFI_INVALID_PARAMETER;
+  }
+
   // Print out the request payloads.
   if ((TransmitHeader != NULL) && (TransmitHeaderSize != 0)) {
     HelperManageabilityDebugPrint ((VOID *)TransmitHeader, (UINT32)TransmitHeaderSize, "KCS Transmit Header:\n"); @@ -504,6 +509,16 @@ KcsTransportSendCommand (
       }
 
       HelperManageabilityDebugPrint ((VOID *)ResponseData, (UINT32)*ResponseDataSize, "KCS Response Data:\n");
+
+      // Print Completion Code
+      Status = IpmiHelperCheckCompletionCode (*((UINT8 *)ResponseData), &CompletionCodeStr, AdditioalStatus);
+      if (!EFI_ERROR (Status)) {
+        DEBUG ((DEBUG_MANAGEABILITY_INFO, "Cc: %02x %s.\n", *((UINT8 *)ResponseData), CompletionCodeStr));
+      } else if (Status == EFI_NOT_FOUND) {
+        DEBUG ((DEBUG_MANAGEABILITY_INFO, "Cc: %02x not defined in IpmiCompletionCodeMapping or invalid.\n", *((UINT8 *)ResponseData)));
+      }
+    } else {
+      DEBUG ((DEBUG_ERROR, "No response, can't determine Completion 
+ Code.\n"));
     }
   } else {
     *ResponseDataSize = 0;
diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c
index 9175556a26..c2d1ac6b62 100644
--- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/ManageabilityTransportKcs.c
+++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe
+++ /ManageabilityTransportKcs.c
@@ -219,7 +219,8 @@ KcsTransportTransmitReceive (
   IN  MANAGEABILITY_TRANSFER_TOKEN   *TransferToken
   )
 {
-  EFI_STATUS  Status;
+  EFI_STATUS                                 Status;
+  MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS  AdditioalStatus;
 
   if ((TransportToken == NULL) || (TransferToken == NULL)) {
     DEBUG ((DEBUG_ERROR, "%a: Invalid transport token or transfer token.\n", __FUNCTION__)); @@ -234,11 +235,13 @@ KcsTransportTransmitReceive (
              TransferToken->TransmitPackage.TransmitPayload,
              TransferToken->TransmitPackage.TransmitSizeInByte,
              TransferToken->ReceivePackage.ReceiveBuffer,
-             &TransferToken->ReceivePackage.ReceiveSizeInByte
+             &TransferToken->ReceivePackage.ReceiveSizeInByte,
+             &AdditioalStatus
              );
 
   TransferToken->TransferStatus = Status;
   KcsTransportStatus (TransportToken, &TransferToken->TransportAdditionalStatus);
+  TransferToken->TransportAdditionalStatus |= AdditioalStatus;
 }
 
 /**
--
2.37.1.windows.1


  reply	other threads:[~2023-05-09 23:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09  7:56 [edk2-platforms][PATCH 1/2] ManageabilityPkg: Add Manageability IPMI helper Library Chang, Abner
2023-05-09  7:56 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/ManageabilityTransportKcsLib: Add debug message of IPMI KCS Completion Code Chang, Abner
2023-05-09 23:54   ` Isaac Oram [this message]
2023-05-10  2:31     ` Chang, Abner
2023-05-09 10:25 ` [edk2-platforms][PATCH 1/2] ManageabilityPkg: Add Manageability IPMI helper Library Attar, AbdulLateef (Abdul Lateef)
2023-05-09 23:50 ` Isaac Oram
2023-05-10  2:09   ` 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=SA1PR11MB58013239F15C95A5B36B6133D0769@SA1PR11MB5801.namprd11.prod.outlook.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