[edk2-devel] [edk2-platforms][PATCH 2/2] ManageabilityPkg/ManageabilityTransportKcsLib: Add debug message of IPMI KCS Completion Code

Chang, Abner via groups.io abner.chang=amd.com at groups.io
Wed May 10 02:31:41 UTC 2023


[AMD Official Use Only - General]

Hi Isaac,
I fixed those typos and had a push.

Thanks 
Abner

> -----Original Message-----
> From: Oram, Isaac W <isaac.w.oram at intel.com>
> Sent: Wednesday, May 10, 2023 7:54 AM
> To: Chang, Abner <Abner.Chang at amd.com>; devel at edk2.groups.io
> Cc: Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar at amd.com>; Nickle
> Wang <nicklew at nvidia.com>; Tinh Nguyen
> <tinhnguyen at os.amperecomputing.com>
> Subject: RE: [edk2-platforms][PATCH 2/2]
> ManageabilityPkg/ManageabilityTransportKcsLib: Add debug message of
> IPMI KCS Completion Code
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Reviewed-by: Isaac Oram <isaac.w.oram at 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 at amd.com <abner.chang at amd.com>
> Sent: Tuesday, May 9, 2023 12:56 AM
> To: devel at edk2.groups.io
> Cc: Oram, Isaac W <isaac.w.oram at intel.com>; Abdul Lateef Attar
> <abdattar at amd.com>; Nickle Wang <nicklew at nvidia.com>; Tinh Nguyen
> <tinhnguyen at os.amperecomputing.com>
> Subject: [edk2-platforms][PATCH 2/2]
> ManageabilityPkg/ManageabilityTransportKcsLib: Add debug message of
> IPMI KCS Completion Code
> 
> From: abnchang <abnchang at amd.com>
> 
> Print out IPMI Completion Code and return additional transport interface
> status.
> 
> Signed-off-by: Abner Chang <abner.chang at amd.com>
> Cc: Isaac Oram <isaac.w.oram at intel.com>
> Cc: Abdul Lateef Attar <abdattar at amd.com>
> Cc: Nickle Wang <nicklew at nvidia.com>
> Cc: Tinh Nguyen <tinhnguyen at 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/Commo
> n/ManageabilityTransportKcs.h
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Comm
> on/ManageabilityTransportKcs.h
> index 8c6a64416a..166aa8dcde 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Commo
> n/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/Commo
> n/KcsCommon.c
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Comm
> on/KcsCommon.c
> index a8c6a674c9..84792311be 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Commo
> n/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/M
> anageabilityTransportKcs.c
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/M
> anageabilityTransportKcs.c
> index 9175556a26..c2d1ac6b62 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/M
> anageabilityTransportKcs.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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104467): https://edk2.groups.io/g/devel/message/104467
Mute This Topic: https://groups.io/mt/98779145/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list