public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nickle Wang" <nicklew@nvidia.com>
To: "abner.chang@amd.com" <abner.chang@amd.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Isaac Oram <isaac.w.oram@intel.com>,
	Abdul Lateef Attar <abdattar@amd.com>,
	Igor Kulchytskyy <igork@ami.com>
Subject: Re: [edk2-platforms][PATCH V2 10/14] ManageabilityPkg: Add MCTP transport interface
Date: Thu, 20 Apr 2023 07:04:03 +0000	[thread overview]
Message-ID: <MW4PR12MB70314E416F566DD3F6354796D9639@MW4PR12MB7031.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20230418071543.1951-11-abner.chang@amd.com>

Please find my comments below.

Regards,
Nickle

> -----Original Message-----
> From: abner.chang@amd.com <abner.chang@amd.com>
> Sent: Tuesday, April 18, 2023 3:16 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram <isaac.w.oram@intel.com>; Abdul Lateef Attar
> <abdattar@amd.com>; Nickle Wang <nicklew@nvidia.com>; Igor Kulchytskyy
> <igork@ami.com>
> Subject: [edk2-platforms][PATCH V2 10/14] ManageabilityPkg: Add MCTP
> transport interface
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang <abner.chang@amd.com>
> 
> Add MCTP manageability transport interface library.
> 
> The functionality is verified by checking the binary debug output of payload.
> 
> 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: Igor Kulchytskyy <igork@ami.com>
> ---
>  .../ManageabilityPkg/ManageabilityPkg.dsc     |   1 +
>  .../Dxe/DxeManageabilityTransportMctp.inf     |  44 +++
>  .../Dxe/ManageabilityTransportMctp.h          |  26 ++
>  .../Dxe/ManageabilityTransportMctp.c          | 367 ++++++++++++++++++
>  .../Dxe/ManageabilityTransportMctp.uni        |  13 +
>  5 files changed, 451 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeM
> anageabilityTransportMctp.inf
>  create mode 100644
> Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Mana
> geabilityTransportMctp.h
>  create mode 100644
> Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Mana
> geabilityTransportMctp.c
>  create mode 100644
> Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Mana
> geabilityTransportMctp.uni
> 
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index 412029ef6c..959b3eabd2 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -37,6 +37,7 @@
> 
>  [Components]
> 
> ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageability
> TransportKcs.inf
> +
> +
> ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageab
> + ilityTransportMctp.inf
>    ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf
> 
>  [LibraryClasses]
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Dxe
> ManageabilityTransportMctp.inf
> b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Dxe
> ManageabilityTransportMctp.inf
> new file mode 100644
> index 0000000000..22ea37c516
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx
> +++ e/DxeManageabilityTransportMctp.inf
> @@ -0,0 +1,44 @@
> +## @file
> +# MCTP instance of Manageability Transport Library # # Copyright (C)
> +2023 Advanced Micro Devices, Inc. All rights reserved.<BR> #
> +SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> +
> +[Defines]
> +  INF_VERSION                    = 0x0001001B
> +  BASE_NAME                      = DxeManageabilityTransportMctp
> +  MODULE_UNI_FILE                = ManageabilityTransportMctp.uni
> +  FILE_GUID                      = 7770FA0F-4808-47BD-89F4-717185332486
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  LIBRARY_CLASS                  = ManageabilityTransportLib
> +
> +#
> +#  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64
> +#
> +
> +[Sources]
> +  ManageabilityTransportMctp.c
> +  ManageabilityTransportMctp.h
> +
> +[Packages]
> +  ManageabilityPkg/ManageabilityPkg.dec
> +  MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> +  DebugLib
> +  MemoryAllocationLib
> +  UefiBootServicesTableLib
> +
> +[Protocols]
> +  gEdkiiMctpProtocolGuid
> +
> +[Guids]
> +  gManageabilityProtocolPldmGuid
> +  gManageabilityTransportMctpGuid
> +
> +[Depex]
> +  gEdkiiMctpProtocolGuid  ## ALWAYS_CONSUMES
> +
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma
> nageabilityTransportMctp.h
> b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma
> nageabilityTransportMctp.h
> new file mode 100644
> index 0000000000..1ce0d3a8bc
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx
> +++ e/ManageabilityTransportMctp.h
> @@ -0,0 +1,26 @@
> +/** @file
> +
> +  Manageability transport MCTP internal used definitions.
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> +reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> +
> +#ifndef MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_
> +#define MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_
> +
> +#include <Library/ManageabilityTransportLib.h>
> +
> +#define MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE  SIGNATURE_32
> ('M', 'T',
> +'M', 'C')
> +
> +///
> +/// Manageability transport KCS internal data structure.
> +///
> +typedef struct {
> +  UINTN                            Signature;
> +  MANAGEABILITY_TRANSPORT_TOKEN    Token;
> +} MANAGEABILITY_TRANSPORT_MCTP;
> +
> +#define MANAGEABILITY_TRANSPORT_MCTP_FROM_LINK(a)  CR (a,
> +MANAGEABILITY_TRANSPORT_MCTP, Token,
> +MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE)
> +
> +#endif // MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma
> nageabilityTransportMctp.c
> b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma
> nageabilityTransportMctp.c
> new file mode 100644
> index 0000000000..5b186e53f3
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx
> +++ e/ManageabilityTransportMctp.c
> @@ -0,0 +1,367 @@
> +/** @file
> +
> +  MCTP instance of Manageability Transport Library
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> + reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +*/
> +
> +#include <Uefi.h>
> +#include <Library/IoLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/MemoryAllocationLib.h> #include
> +<Library/ManageabilityTransportLib.h>
> +#include <Library/ManageabilityTransportMctpLib.h>
> +#include <Library/ManageabilityTransportHelperLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Protocol/MctpProtocol.h>
> +
> +#include "ManageabilityTransportMctp.h"
> +
> +MANAGEABILITY_TRANSPORT_MCTP  *mSingleSessionToken = NULL;
> +EDKII_MCTP_PROTOCOL           *mMctpProtocol       = NULL;
> +
> +EFI_GUID  *SupportedManageabilityProtocol[] = {
> +  &gManageabilityProtocolPldmGuid
> +};


This is global variable and I think we need 'm' prefix for it.

> +
> +UINT8  NumberOfSupportedProtocol = (sizeof
> +(SupportedManageabilityProtocol)/sizeof (EFI_GUID *));
> +

This is global variable and I think we need 'm' prefix for it.


> +/**
> +  This function initializes the transport interface.
> +
> +  @param [in]  TransportToken           The transport token acquired through
> +                                        AcquireTransportSession function.
> +  @param [in]  HardwareInfo             The hardware information
> +                                        assigned to MCTP transport interface.
> +
> +  @retval      EFI_SUCCESS              Transport interface is initialized
> +                                        successfully.
> +  @retval      EFI_INVALID_PARAMETER    The invalid transport token.
> +  @retval      EFI_NOT_READY            The transport interface works fine but
> +  @retval                               is not ready.
> +  @retval      EFI_DEVICE_ERROR         The transport interface has problems.
> +  @retval      EFI_ALREADY_STARTED      Teh protocol interface has already
> initialized.
> +  @retval      Otherwise                Other errors.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MctpTransportInit (
> +  IN  MANAGEABILITY_TRANSPORT_TOKEN                 *TransportToken,
> +  IN  MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION  HardwareInfo
> +OPTIONAL
> +  )
> +{
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  This function returns the transport interface status.
> +  The generic EFI_STATUS is returned to caller directly, The additional
> +  information of transport interface could be optionally returned in
> +  TransportAdditionalStatus to describes the status that can't be
> +  described obviously through EFI_STATUS.
> +  See the definition of MANAGEABILITY_TRANSPORT_STATUS.
> +
> +  @param [in]   TransportToken             The transport token acquired through
> +                                           AcquireTransportSession function.
> +  @param [out]  TransportAdditionalStatus  The additional status of transport
> +                                           interface.
> +                                           NULL means no additional status of this
> +                                           transport interface.
> +
> +  @retval      EFI_SUCCESS              Transport interface status is returned.
> +  @retval      EFI_INVALID_PARAMETER    The invalid transport token.
> +  @retval      EFI_DEVICE_ERROR         The transport interface has problems to
> return
> +  @retval      EFI_UNSUPPORTED          The transport interface doesn't have
> status report.
> +               Otherwise                Other errors.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MctpTransportStatus (
> +  IN  MANAGEABILITY_TRANSPORT_TOKEN              *TransportToken,
> +  OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS
> +*TransportAdditionalStatus OPTIONAL
> +  )
> +{
> +  if (TransportToken == NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: Invalid transport token.\n", __FUNCTION__));
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  if (TransportAdditionalStatus != NULL) {
> +    *TransportAdditionalStatus =
> + MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NO_ERRORS;
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  This function resets the transport interface.
> +  The generic EFI_STATUS is returned to caller directly after reseting
> +transport
> +  interface. The additional information of transport interface could be
> +optionally
> +  returned in TransportAdditionalStatus to describes the status that
> +can't be
> +  described obviously through EFI_STATUS.
> +  See the definition of MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS.
> +
> +  @param [in]   TransportToken             The transport token acquired through
> +                                           AcquireTransportSession function.
> +  @param [out]  TransportAdditionalStatus  The additional status of specific
> transport
> +                                           interface after the reset.
> +                                           NULL means no additional status of this
> +                                           transport interface.
> +
> +  @retval      EFI_SUCCESS              Transport interface status is returned.
> +  @retval      EFI_INVALID_PARAMETER    The invalid transport token.
> +  @retval      EFI_TIMEOUT              The reset process is time out.
> +  @retval      EFI_DEVICE_ERROR         The transport interface has problems to
> return
> +                                        status.
> +               Otherwise                Other errors.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MctpTransportReset (
> +  IN  MANAGEABILITY_TRANSPORT_TOKEN              *TransportToken,
> +  OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS
> +*TransportAdditionalStatus OPTIONAL
> +  )
> +{
> +  if (TransportAdditionalStatus != NULL) {
> +    *TransportAdditionalStatus =
> +MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NOT_AVAILABLE;
> +  }
> +
> +  return EFI_UNSUPPORTED;
> +}
> +
> +/**
> +  This function transmit the request over target transport interface.
> +  The generic EFI_STATUS is returned to caller directly after reseting
> +transport
> +  interface. The additional information of transport interface could be
> +optionally
> +  returned in TransportAdditionalStatus to describes the status that
> +can't be
> +  described obviously through EFI_STATUS.
> +  See the definition of MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS.
> +
> +  @param [in]  TransportToken           The transport token acquired through
> +                                        AcquireTransportSession function.
> +  @param [in]  TransferToken            The transfer token, see the definition of
> +                                        MANAGEABILITY_TRANSFER_TOKEN.
> +
> +  @retval      The EFI status is returned in MANAGEABILITY_TRANSFER_TOKEN.
> +
> +**/
> +VOID
> +EFIAPI
> +MctpTransportTransmitReceive (
> +  IN  MANAGEABILITY_TRANSPORT_TOKEN  *TransportToken,
> +  IN  MANAGEABILITY_TRANSFER_TOKEN   *TransferToken
> +  )
> +{
> +  EFI_STATUS                           Status;
> +  MANAGEABILITY_MCTP_TRANSPORT_HEADER  *TransmitHeader;
> +
> +  if (TransportToken == NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: Invalid transport token.\n", __FUNCTION__));
> +    TransferToken->TransportAdditionalStatus =
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NOT_AVAILABLE;
> +    return;
> +  }
> +
> +  TransmitHeader = (MANAGEABILITY_MCTP_TRANSPORT_HEADER
> + *)TransferToken->TransmitHeader;  if (TransmitHeader == NULL) {
> +    TransferToken->TransferStatus            = EFI_INVALID_PARAMETER;
> +    TransferToken->TransportAdditionalStatus =
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NOT_AVAILABLE;
> +    return;
> +  }
> +
> +  if (mMctpProtocol == NULL) {
> +    Status = gBS->LocateProtocol (
> +                    &gEdkiiMctpProtocolGuid,
> +                    NULL,
> +                    (VOID **)&mMctpProtocol
> +                    );
> +    if (EFI_ERROR (Status)) {
> +      //
> +      // Dxe MCTP Protocol is not installed.
> +      //
> +      DEBUG ((DEBUG_ERROR, "%a: EDKII MCTP protocol is not found - %r\n",
> Status));

"__func__" is missing in debug macro.

Nickle

> +      return;
> +    }
> +  }
> +
> +  DEBUG ((
> +    DEBUG_MANAGEABILITY_INFO,
> +    "%a: MCTP message type: 0x%x, SourceEndpointId: 0x%x,
> DestinationEndpointId: 0x%x\n",
> +    __FUNCTION__,
> +    TransmitHeader->MessageHeader.MessageType,
> +    TransmitHeader->SourceEndpointId,
> +    TransmitHeader->DestinationEndpointId
> +    ));
> +  DEBUG ((
> +    DEBUG_MANAGEABILITY_INFO,
> +    "  - Request message size: 0x%x, Response message size: %x\n",
> +    TransferToken->TransmitPackage.TransmitSizeInByte,
> +    TransferToken->ReceivePackage.ReceiveSizeInByte
> +    ));
> +  Status = mMctpProtocol->Functions.Version1_0->MctpSubmitCommand (
> +                                                  mMctpProtocol,
> +                                                  TransmitHeader->MessageHeader.MessageType,
> +                                                  TransmitHeader->SourceEndpointId,
> +                                                  TransmitHeader->DestinationEndpointId,
> +                                                  (BOOLEAN)TransmitHeader-
> >MessageHeader.IntegrityCheck,
> +                                                  TransferToken->TransmitPackage.TransmitPayload,
> +                                                  TransferToken-
> >TransmitPackage.TransmitSizeInByte,
> +                                                  TransferToken-
> >TransmitPackage.TransmitTimeoutInMillisecond,
> +                                                  TransferToken->ReceivePackage.ReceiveBuffer,
> +                                                  &TransferToken-
> >ReceivePackage.ReceiveSizeInByte,
> +                                                  TransferToken-
> >ReceivePackage.TransmitTimeoutInMillisecond,
> +                                                  &TransferToken->TransportAdditionalStatus
> +                                                  );
> +  TransferToken->TransferStatus = Status; }
> +
> +/**
> +  This function acquires to create a transport session to transmit
> +manageability
> +  packet. A transport token is returned to caller for the follow up operations.
> +
> +  @param [in]   ManageabilityProtocolSpec  The protocol spec the transport
> interface is acquired.
> +  @param [out]  TransportToken             The pointer to receive the transport
> token created by
> +                                           the target transport interface library.
> +  @retval       EFI_SUCCESS                Token is created successfully.
> +  @retval       EFI_OUT_OF_RESOURCES       Out of resource to create a new
> transport session.
> +  @retval       EFI_UNSUPPORTED            Protocol is not supported on this
> transport interface.
> +  @retval       Otherwise                  Other errors.
> +
> +**/
> +EFI_STATUS
> +AcquireTransportSession (
> +  IN  EFI_GUID                       *ManageabilityProtocolSpec,
> +  OUT MANAGEABILITY_TRANSPORT_TOKEN  **TransportToken
> +  )
> +{
> +  EFI_STATUS                    Status;
> +  MANAGEABILITY_TRANSPORT_MCTP  *MctpTransportToken;
> +
> +  if (ManageabilityProtocolSpec == NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: No Manageability protocol specification
> specified.\n", __FUNCTION__));
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  Status = HelperManageabilityCheckSupportedSpec (
> +             &gManageabilityTransportMctpGuid,
> +             SupportedManageabilityProtocol,
> +             NumberOfSupportedProtocol,
> +             ManageabilityProtocolSpec
> +             );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "%a: Protocol is not supported on this transport
> interface.\n", __FUNCTION__));
> +    return EFI_UNSUPPORTED;
> +  }
> +
> +  if (mSingleSessionToken != NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: This manageability transport library only
> supports one session transport token.\n", __FUNCTION__));
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  MctpTransportToken = (MANAGEABILITY_TRANSPORT_MCTP
> *)AllocateZeroPool
> + (sizeof (MANAGEABILITY_TRANSPORT_MCTP));  if (MctpTransportToken ==
> NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for
> MANAGEABILITY_TRANSPORT_MCTP\n", __FUNCTION__));
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  MctpTransportToken->Token.Transport = AllocateZeroPool (sizeof
> + (MANAGEABILITY_TRANSPORT));  if (MctpTransportToken->Token.Transport
> == NULL) {
> +    FreePool (MctpTransportToken);
> +    DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for
> MANAGEABILITY_TRANSPORT\n", __FUNCTION__));
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  MctpTransportToken->Signature                                            =
> MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE;
> +  MctpTransportToken->Token.ManageabilityProtocolSpecification             =
> ManageabilityProtocolSpec;
> +  MctpTransportToken->Token.Transport->TransportVersion                    =
> MANAGEABILITY_TRANSPORT_TOKEN_VERSION;
> +  MctpTransportToken->Token.Transport-
> >ManageabilityTransportSpecification = &gManageabilityTransportMctpGuid;
> +  MctpTransportToken->Token.Transport->TransportName                       =
> L"MCTP";
> +  MctpTransportToken->Token.Transport->Function.Version1_0                 =
> AllocateZeroPool (sizeof (MANAGEABILITY_TRANSPORT_FUNCTION_V1_0));
> +  if (MctpTransportToken->Token.Transport->Function.Version1_0 == NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for
> MANAGEABILITY_TRANSPORT_FUNCTION_V1_0\n", __FUNCTION__));
> +    FreePool (MctpTransportToken);
> +    FreePool (MctpTransportToken->Token.Transport);
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  MctpTransportToken->Token.Transport->Function.Version1_0->TransportInit
> = MctpTransportInit;
> +  MctpTransportToken->Token.Transport->Function.Version1_0-
> >TransportReset           = MctpTransportReset;
> +  MctpTransportToken->Token.Transport->Function.Version1_0-
> >TransportStatus          = MctpTransportStatus;
> +
> + MctpTransportToken->Token.Transport->Function.Version1_0->TransportTra
> + nsmitReceive = MctpTransportTransmitReceive;
> +
> +  mSingleSessionToken = MctpTransportToken;
> +  *TransportToken     = &MctpTransportToken->Token;
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  This function returns the transport capabilities according to
> +  the manageability protocol.
> +
> +  @param [in]   TransportToken             Transport token acquired from
> manageability
> +                                           transport library.
> +  @param [out]  TransportFeature           Pointer to receive transport capabilities.
> +                                           See the definitions of
> +                                           MANAGEABILITY_TRANSPORT_CAPABILITY.
> +  @retval       EFI_SUCCESS                TransportCapability is returned successfully.
> +  @retval       EFI_INVALID_PARAMETER      TransportToken is not a valid token.
> +**/
> +EFI_STATUS
> +GetTransportCapability (
> +  IN MANAGEABILITY_TRANSPORT_TOKEN        *TransportToken,
> +  OUT MANAGEABILITY_TRANSPORT_CAPABILITY  *TransportCapability
> +  )
> +{
> +  if ((TransportToken == NULL) || (TransportCapability == NULL)) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  *TransportCapability = 0;
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  This function releases the manageability session.
> +
> +  @param [in]  TransportToken         The transport token acquired through
> +                                      AcquireTransportSession.
> +  @retval      EFI_SUCCESS            Token is released successfully.
> +  @retval      EFI_INVALID_PARAMETER  Invalid TransportToken.
> +  @retval      Otherwise              Other errors.
> +
> +**/
> +EFI_STATUS
> +ReleaseTransportSession (
> +  IN MANAGEABILITY_TRANSPORT_TOKEN  *TransportToken
> +  )
> +{
> +  EFI_STATUS                    Status;
> +  MANAGEABILITY_TRANSPORT_MCTP  *MctpTransportToken;
> +
> +  if (TransportToken == NULL) {
> +    Status = EFI_INVALID_PARAMETER;
> +  }
> +
> +  MctpTransportToken = MANAGEABILITY_TRANSPORT_MCTP_FROM_LINK
> + (TransportToken);  if (mSingleSessionToken != MctpTransportToken) {
> +    Status = EFI_INVALID_PARAMETER;
> +  }
> +
> +  if (MctpTransportToken != NULL) {
> +    FreePool (MctpTransportToken->Token.Transport->Function.Version1_0);
> +    FreePool (MctpTransportToken->Token.Transport);
> +    FreePool (MctpTransportToken);
> +    mSingleSessionToken = NULL;
> +    Status              = EFI_SUCCESS;
> +  }
> +
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "%a: Fail to release MCTP transport token
> + (%r).\n", __FUNCTION__, Status));  }
> +
> +  return Status;
> +}
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma
> nageabilityTransportMctp.uni
> b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma
> nageabilityTransportMctp.uni
> new file mode 100644
> index 0000000000..ca8125a4a7
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx
> +++ e/ManageabilityTransportMctp.uni
> @@ -0,0 +1,13 @@
> +// /** @file
> +// MCTP instance of Manageability Transport Library // // Copyright (C)
> +2023 Advanced Micro Devices, Inc. All rights reserved.<BR> // //
> +SPDX-License-Identifier: BSD-2-Clause-Patent // // **/
> +
> +#string STR_MODULE_ABSTRACT             #language en-US "MCTP instance of
> Manageability Transport Library"
> +
> +#string STR_MODULE_DESCRIPTION          #language en-US "MCTP
> Manageability Transport library implementation."
> +
> --
> 2.37.1.windows.1


  reply	other threads:[~2023-04-20  7:04 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  7:15 [edk2-platforms][PATCH V2 00/14] ManageabilityPkg part II Chang, Abner
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 01/14] ManageabilityPkg: Add more helper functions Chang, Abner
2023-04-19  5:29   ` Attar, AbdulLateef (Abdul Lateef)
2023-04-20 15:18     ` Chang, Abner
2023-04-20  6:42   ` Nickle Wang
2023-04-20 15:45     ` Chang, Abner
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 02/14] ManageabilityPkg: Support Maximum Transfer Unit Chang, Abner
2023-04-20  4:28   ` Attar, AbdulLateef (Abdul Lateef)
2023-04-20  6:08   ` [edk2-devel] " Tinh Nguyen
2023-04-21  0:51     ` Chang, Abner
2023-04-21  6:59       ` Tinh Nguyen
2023-04-21  7:09         ` Chang, Abner
     [not found]         ` <1757E190B31AA266.29498@groups.io>
2023-04-24  1:42           ` Chang, Abner
     [not found]     ` <1757CCE5059D419D.29498@groups.io>
2023-04-21  5:26       ` Chang, Abner
2023-04-20  6:44   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 03/14] ManageabilityPkg: Add HeaderSize and TrailerSize Chang, Abner
2023-04-20  6:47   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 04/14] ManageabilityPkg: Add PldmProtocolLib Chang, Abner
2023-04-20  6:50   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 05/14] ManageabilityPkg: Add PldmSmbiosTransferDxe driver Chang, Abner
2023-04-20  6:52   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 06/14] ManageabilityPkg/KCS: KCS transport interface Chang, Abner
2023-04-20  6:53   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 07/14] ManageabilityPkg: Add definitions of MCTP Chang, Abner
2023-04-20  6:54   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 08/14] ManageabilityPkg: Add MCTP manageability header file Chang, Abner
2023-04-20  6:56   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 09/14] ManageabilityPkg/MctpProtocol: Add MctpProtocol Chang, Abner
2023-04-20  7:00   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 10/14] ManageabilityPkg: Add MCTP transport interface Chang, Abner
2023-04-20  7:04   ` Nickle Wang [this message]
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 11/14] ManageabilityPkg/PldmProtocol: Add PLDM protocol Chang, Abner
2023-04-20  7:05   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 12/14] ManageabilityPkg: Add Manageability PCDs Chang, Abner
2023-04-20  5:26   ` Tinh Nguyen
2023-04-20  7:07   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 13/14] ManageabilityPkg: Relocate Manageability.dsc Chang, Abner
2023-04-20  5:28   ` Tinh Nguyen
2023-04-20  7:08   ` Nickle Wang
2023-04-18  7:15 ` [edk2-platforms][PATCH V2 14/14] ManageabilityPkg: Add Manageability FDFs Chang, Abner
2023-04-20  5:29   ` Tinh Nguyen
2023-04-20  7:08   ` Nickle Wang

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=MW4PR12MB70314E416F566DD3F6354796D9639@MW4PR12MB7031.namprd12.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