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 03/14] ManageabilityPkg: Add HeaderSize and TrailerSize
Date: Thu, 20 Apr 2023 06:47:50 +0000 [thread overview]
Message-ID: <MW4PR12MB7031E4754112C5F906AB1202D9639@MW4PR12MB7031.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20230418071543.1951-4-abner.chang@amd.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
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 03/14] ManageabilityPkg: Add HeaderSize
> and TrailerSize
>
> External email: Use caution opening links or attachments
>
>
> From: Abner Chang <abner.chang@amd.com>
>
> Add HeaderSize and TrailerSize in
> MANAGEABILITY_TRANSFER_TOKEN structure.
> Manageability transport interface may used by multiple protocols which have
> different header and trailer of payload. (e.g. MCTP over KCS and IPMI over KCS).
>
> 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>
> ---
> .../Library/ManageabilityTransportLib.h | 2 +
> .../Common/ManageabilityTransportKcs.h | 20 ++-
> .../IpmiProtocol/Common/IpmiProtocolCommon.h | 36 +++--
> .../Common/KcsCommon.c | 152 ++++++++++++------
> .../Dxe/ManageabilityTransportKcs.c | 14 +-
> .../IpmiProtocol/Common/IpmiProtocolCommon.c | 63 +++++---
> Features/ManageabilityPkg/Readme.md | 10 ++
> 7 files changed, 194 insertions(+), 103 deletions(-)
>
> diff --git
> a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> index d86d0d87d5..04072aee89 100644
> --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h
> +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLi
> +++ b.h
> @@ -168,10 +168,12 @@ struct _MANAGEABILITY_TRANSFER_TOKEN {
> ///< which is sent discretely of payload.
> ///< This field can be NULL if the
> transport
> ///< doesn't require this.
> + UINT16 TransmitHeaderSize; ///< Transmit header
> size in byte.
> MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer; ///< This
> is the transport-specific trailer
> ///< which is sent discretely of payload.
> ///< This field can be NULL if the
> transport
> ///< doesn't require this.
> + UINT16 TransmitTrailerSize; ///< Transmit trailer size
> in byte.
> MANAGEABILITY_TRANSMIT_PACKAGE TransmitPackage; ///<
> The payload sent to transport interface.
> MANAGEABILITY_RECEIVE_PACKAGE ReceivePackage; ///< The
> buffer to receive the response.
> EFI_STATUS TransferStatus; ///< The EFI Status of the
> transfer.
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> index 2cdf60ba7e..d6685c165e 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> ManageabilityTransportKcs.h
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com
> +++ mon/ManageabilityTransportKcs.h
> @@ -41,8 +41,10 @@ typedef struct {
> /**
> This service communicates with BMC using KCS protocol.
>
> - @param[in] NetFunction Net function of the command.
> - @param[in] Command IPMI Command.
> + @param[in] TransmitHeader KCS packet header.
> + @param[in] TransmitHeaderSize KCS packet header size in byte.
> + @param[in] TransmitTrailer KCS packet trailer.
> + @param[in] TransmitTrailerSize KCS packet trailer size in byte.
> @param[in] RequestData Command Request Data.
> @param[in] RequestDataSize Size of Command Request Data.
> @param[out] ResponseData Command Response Data. The completion
> @@ -69,12 +71,14 @@ typedef struct {
> EFI_STATUS
> EFIAPI
> KcsTransportSendCommand (
> - IN UINT8 NetFunction,
> - IN UINT8 Command,
> - IN UINT8 *RequestData OPTIONAL,
> - IN UINT32 RequestDataSize,
> - OUT UINT8 *ResponseData OPTIONAL,
> - IN OUT UINT32 *ResponseDataSize OPTIONAL
> + IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader,
> + 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
> );
>
> /**
> diff --git
> a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC
> ommon.h
> b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC
> ommon.h
> index 5a7236e9a6..8bf16e6277 100644
> ---
> a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC
> ommon.h
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtoc
> +++ olCommon.h
> @@ -44,21 +44,23 @@ SetupIpmiTransportHardwareInformation (
> This functions setup the final header/body/trailer packets for
> the acquired transport interface.
>
> - @param[in] TransportToken The transport interface.
> - @param[in] NetFunction IPMI function.
> - @param[in] Command IPMI command.
> - @param[out] PacketHeader The pointer to receive header of request.
> - @param[in, out] PacketBody The request body.
> - When IN, it is the caller's request body.
> - When OUT and NULL, the request body is not
> - changed.
> - Whee out and non-NULL, the request body is
> - changed to comfort the transport interface.
> - @param[in, out] PacketBodySize The request body size.
> - When IN and non-zero, it is the new data
> - length of request body.
> - When IN and zero, the request body is unchanged.
> - @param[out] PacketTrailer The pointer to receive trailer of request.
> + @param[in] TransportToken The transport interface.
> + @param[in] NetFunction IPMI function.
> + @param[in] Command IPMI command.
> + @param[out] PacketHeader The pointer to receive header of request.
> + @param[out] PacketHeaderSize Pinter to receive packet header size in
> byte.
> + @param[in, out] PacketBody The request body.
> + When IN, it is the caller's request body.
> + When OUT and NULL, the request body is not
> + changed.
> + Whee out and non-NULL, the request body is
> + changed to comfort the transport interface.
> + @param[in, out] PacketBodySize The request body size.
> + When IN and non-zero, it is the new data
> + length of request body.
> + When IN and zero, the request body is unchanged.
> + @param[out] PacketTrailer The pointer to receive trailer of request.
> + @param[out] PacketTrailerSize Pinter to receive packet trailer size in byte.
>
> @retval EFI_SUCCESS Request packet is returned.
> @retval EFI_UNSUPPORTED Request packet is not returned because
> @@ -70,9 +72,11 @@ SetupIpmiRequestTransportPacket (
> IN UINT8 NetFunction,
> IN UINT8 Command,
> OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader OPTIONAL,
> + OUT UINT16 *PacketHeaderSize,
> IN OUT UINT8 **PacketBody OPTIONAL,
> IN OUT UINT32 *PacketBodySize OPTIONAL,
> - OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL
> + OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL,
> + OUT UINT16 *PacketTrailerSize
> );
>
> /**
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> KcsCommon.c
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> KcsCommon.c
> index 17e2b8f231..14a7047447 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/
> KcsCommon.c
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com
> +++ mon/KcsCommon.c
> @@ -11,6 +11,7 @@
> #include <Library/BaseMemoryLib.h>
> #include <Library/IoLib.h>
> #include <Library/DebugLib.h>
> +#include <Library/ManageabilityTransportHelperLib.h>
> #include <Library/MemoryAllocationLib.h> #include <Library/TimerLib.h>
>
> @@ -98,8 +99,10 @@ ClearOBF (
> Algorithm is based on flow chart provided in IPMI spec 2.0
> Figure 9-6, KCS Interface BMC to SMS Write Transfer Flow Chart
>
> - @param[in] NetFunction Net function of the command.
> - @param[in] Command IPMI Command.
> + @param[in] TransmitHeader KCS packet header.
> + @param[in] TransmitHeaderSize KCS packet header size in byte.
> + @param[in] TransmitTrailer KCS packet trailer.
> + @param[in] TransmitTrailerSize KCS packet trailer size in byte.
> @param[in] RequestData Command Request Data, could be NULL.
> RequestDataSize must be zero, if RequestData
> is NULL.
> @@ -122,10 +125,12 @@ ClearOBF (
> **/
> EFI_STATUS
> KcsTransportWrite (
> - IN UINT8 NetFunction,
> - IN UINT8 Command,
> - IN UINT8 *RequestData OPTIONAL,
> - IN UINT32 RequestDataSize
> + IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader,
> + IN UINT16 TransmitHeaderSize,
> + IN MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer OPTIONAL,
> + IN UINT16 TransmitTrailerSize,
> + IN UINT8 *RequestData OPTIONAL,
> + IN UINT32 RequestDataSize
> )
> {
> EFI_STATUS Status;
> @@ -134,37 +139,63 @@ KcsTransportWrite (
> UINT8 *BufferPtr;
>
> // Validation on RequestData and RequestDataSize.
> - if ((RequestData == NULL && RequestDataSize != 0) ||
> - (RequestData != NULL && RequestDataSize == 0)
> - ) {
> + if (((RequestData == NULL) && (RequestDataSize != 0)) ||
> + ((RequestData != NULL) && (RequestDataSize == 0))
> + )
> + {
> DEBUG ((DEBUG_ERROR, "%a: Mismatched values of RequestData or
> RequestDataSize.\n", __FUNCTION__));
> return EFI_INVALID_PARAMETER;
> }
>
> - Length = sizeof (NetFunction) + sizeof (Command);
> + // Validation on TransmitHeader and TransmitHeaderSize.
> + if (((TransmitHeader == NULL) && (TransmitHeaderSize != 0)) ||
> + ((TransmitHeader != NULL) && (TransmitHeaderSize == 0))
> + )
> + {
> + DEBUG ((DEBUG_ERROR, "%a: Mismatched values of TransmitHeader or
> TransmitHeaderSize.\n", __FUNCTION__));
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + // Validation on TransmitHeader and TransmitHeaderSize.
> + if (((TransmitTrailer == NULL) && (TransmitTrailerSize != 0)) ||
> + ((TransmitTrailer != NULL) && (TransmitTrailerSize == 0))
> + )
> + {
> + DEBUG ((DEBUG_ERROR, "%a: Mismatched values of TransmitTrailer or
> TransmitTrailerSize.\n", __FUNCTION__));
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + Length = TransmitHeaderSize;
> if (RequestData != NULL) {
> Length = Length + RequestDataSize;
> }
>
> + if ((TransmitTrailer != NULL) && (TransmitTrailerSize != 0)) {
> + Length += TransmitTrailerSize;
> + }
> +
> Buffer = AllocateZeroPool (Length);
> if (Buffer == NULL) {
> return EFI_OUT_OF_RESOURCES;
> }
>
> //
> - // Buffer[0] = NetFunction
> - // Buffer[1] = Command
> - // Buffer [2..RequestDataSize] = RequestData
> + // Buffer[0..(TransmitHeaderSize - 1)] = TransmitHeader // Buffer
> + [TransmitHeader..(TransmitHeader + RequestDataSize - 1)] = RequestData
> + // Buffer [(TransmitHeader + RequestDataSize)..(TransmitHeader +
> + RequestDataSize + TransmitTrailerSize - 1)] = TransmitTrailer
> //
> BufferPtr = Buffer;
> - CopyMem (BufferPtr, &NetFunction, sizeof (NetFunction));
> - BufferPtr += sizeof (NetFunction);
> - CopyMem (BufferPtr, &Command, sizeof (Command));
> - BufferPtr += sizeof (Command);
> - if (Length > (sizeof (NetFunction) + sizeof (Command))) {
> + CopyMem ((VOID *)BufferPtr, (VOID *)TransmitHeader,
> + TransmitHeaderSize); BufferPtr += TransmitHeaderSize; if
> + (RequestData != NULL) {
> CopyMem (BufferPtr, RequestData, RequestDataSize);
> }
>
> + BufferPtr += RequestDataSize;
> + if (TransmitTrailer != NULL) {
> + CopyMem (BufferPtr, (VOID *)TransmitTrailer, TransmitTrailerSize);
> + }
> +
> BufferPtr = Buffer;
>
> // Step 1. wait for IBF to get clear
> @@ -293,10 +324,11 @@ KcsTransportRead (
> EFI_STATUS Status;
> UINT32 ReadLength;
>
> - if (DataByte == NULL || *Length == 0) {
> + if ((DataByte == NULL) || (*Length == 0)) {
> DEBUG ((DEBUG_ERROR, "%a: Either DataByte is NULL or Length is 0.\n",
> __FUNCTION__));
> return EFI_INVALID_PARAMETER;
> }
> +
> ReadLength = 0;
> while (ReadLength < *Length) {
> // Step 1. wait for IBF to get clear @@ -350,8 +382,10 @@ KcsTransportRead
> (
> /**
> This service communicates with BMC using KCS protocol.
>
> - @param[in] NetFunction Net function of the command.
> - @param[in] Command IPMI Command.
> + @param[in] TransmitHeader KCS packet header.
> + @param[in] TransmitHeaderSize KCS packet header size in byte.
> + @param[in] TransmitTrailer KCS packet trailer.
> + @param[in] TransmitTrailerSize KCS packet trailer size in byte.
> @param[in] RequestData Command Request Data.
> @param[in] RequestDataSize Size of Command Request Data.
> @param[out] ResponseData Command Response Data. The completion
> @@ -380,12 +414,14 @@ KcsTransportRead ( EFI_STATUS EFIAPI
> KcsTransportSendCommand (
> - IN UINT8 NetFunction,
> - IN UINT8 Command,
> - IN UINT8 *RequestData OPTIONAL,
> - IN UINT32 RequestDataSize,
> - OUT UINT8 *ResponseData OPTIONAL,
> - IN OUT UINT32 *ResponseDataSize OPTIONAL
> + IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader,
> + 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
> )
> {
> EFI_STATUS Status;
> @@ -393,30 +429,41 @@ KcsTransportSendCommand (
> IPMI_KCS_RESPONSE_HEADER RspHeader;
>
> if ((RequestData != NULL) && (RequestDataSize == 0)) {
> - DEBUG((DEBUG_ERROR, "%a: Mismatched values of RequestData and
> RequestDataSize\n", __FUNCTION__));
> + DEBUG ((DEBUG_ERROR, "%a: Mismatched values of RequestData and
> + RequestDataSize\n", __FUNCTION__));
> return EFI_INVALID_PARAMETER;
> }
>
> if ((ResponseData != NULL) && ((ResponseDataSize != NULL) &&
> (*ResponseDataSize == 0))) {
> - DEBUG((DEBUG_ERROR, "%a: Mismatched values of ResponseData and
> ResponseDataSize\n", __FUNCTION__));
> + DEBUG ((DEBUG_ERROR, "%a: Mismatched values of ResponseData and
> ResponseDataSize\n", __FUNCTION__));
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + if (TransmitHeader == NULL) {
> + DEBUG ((DEBUG_ERROR, "%a: TransmitHeader is NULL\n",
> + __FUNCTION__));
> return EFI_INVALID_PARAMETER;
> }
>
> + //
> + // Print out the request payloads.
> + HelperManageabilityDebugPrint ((VOID *)TransmitHeader,
> + TransmitHeaderSize, "KCS Transmit Header:\n"); if (RequestData != NULL) {
> + HelperManageabilityDebugPrint ((VOID *)RequestData,
> + RequestDataSize, "KCS Request Data:\n"); }
> +
> + if (TransmitTrailer != NULL) {
> + HelperManageabilityDebugPrint ((VOID *)TransmitTrailer,
> + TransmitTrailerSize, "KCS Transmit Trailer:\n"); }
> +
> Status = KcsTransportWrite (
> - (NetFunction << 2),
> - Command,
> + TransmitHeader,
> + TransmitHeaderSize,
> + TransmitTrailer,
> + TransmitTrailerSize,
> RequestData,
> RequestDataSize
> );
> if (EFI_ERROR (Status)) {
> - DEBUG ((
> - DEBUG_ERROR,
> - "IPMI KCS Write Failed with Status(%r) for NetFunction(0x%x)," \
> - " Command(0x%x).\n",
> - Status,
> - NetFunction,
> - Command
> - ));
> + DEBUG ((DEBUG_ERROR, "IPMI KCS Write Failed with Status(%r)",
> + Status));
> return Status;
> }
>
> @@ -429,7 +476,7 @@ KcsTransportSendCommand (
> DEBUG_ERROR,
> "IPMI KCS read response header failed Status(%r), " \
> "RspNetFunctionLun = 0x%x, " \
> - "Comamnd = 0x%x \n",
> + "Command = 0x%x \n",
> Status,
> RspHeader.NetFunc,
> RspHeader.Command
> @@ -437,16 +484,21 @@ KcsTransportSendCommand (
> return (Status);
> }
>
> - Status = KcsTransportRead ((UINT8 *)ResponseData, ResponseDataSize);
> - if (EFI_ERROR (Status)) {
> - DEBUG ((
> - DEBUG_ERROR,
> - "IPMI KCS response read Failed with Status(%r) for NetFunction(0x%x)," \
> - " Command(0x%x).\n",
> - Status,
> - NetFunction,
> - Command
> - ));
> + //
> + // Print out the response payloads.
> + HelperManageabilityDebugPrint ((VOID *)&RspHeader,
> + (UINT16)RspHeaderSize, "KCS Response Header:\n");
> +
> + if ((ResponseData != NULL) && (ResponseDataSize != NULL) &&
> (*ResponseDataSize != 0)) {
> + Status = KcsTransportRead ((UINT8 *)ResponseData, ResponseDataSize);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "IPMI KCS response read Failed with Status(%r)",
> Status));
> + }
> +
> + //
> + // Print out the response payloads.
> + HelperManageabilityDebugPrint ((VOID *)ResponseData,
> + *ResponseDataSize, "KCS Response Data:\n"); } else {
> + *ResponseDataSize = 0;
> }
>
> return Status;
> diff --git
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Mana
> geabilityTransportKcs.c
> b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Mana
> geabilityTransportKcs.c
> index 7d85378fc1..c236354605 100644
> ---
> a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Mana
> geabilityTransportKcs.c
> +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe
> +++ /ManageabilityTransportKcs.c
> @@ -218,23 +218,25 @@ KcsTransportTransmitReceive (
> IN MANAGEABILITY_TRANSFER_TOKEN *TransferToken
> )
> {
> - EFI_STATUS Status;
> - MANAGEABILITY_IPMI_TRANSPORT_HEADER *TransmitHeader;
> + EFI_STATUS Status;
>
> if ((TransportToken == NULL) || (TransferToken == NULL)) {
> DEBUG ((DEBUG_ERROR, "%a: Invalid transport token or transfer token.\n",
> __FUNCTION__));
> return;
> }
>
> - TransmitHeader = (MANAGEABILITY_IPMI_TRANSPORT_HEADER
> *)TransferToken->TransmitHeader;
> - if (TransmitHeader == NULL) {
> + // Transmit header is necessary for KCS transport, which could be //
> + NetFn, Command and etc.
> + if (TransferToken->TransmitHeader == NULL) {
> TransferToken->TransferStatus = EFI_INVALID_PARAMETER;
> return;
> }
>
> Status = KcsTransportSendCommand (
> - TransmitHeader->NetFn,
> - TransmitHeader->Command,
> + TransferToken->TransmitHeader,
> + TransferToken->TransmitHeaderSize,
> + TransferToken->TransmitTrailer,
> + TransferToken->TransmitTrailerSize,
> TransferToken->TransmitPackage.TransmitPayload,
> TransferToken->TransmitPackage.TransmitSizeInByte,
> TransferToken->ReceivePackage.ReceiveBuffer,
> diff --git
> a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC
> ommon.c
> b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC
> ommon.c
> index 82bae58292..b055bad7da 100644
> ---
> a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC
> ommon.c
> +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtoc
> +++ olCommon.c
> @@ -65,21 +65,23 @@ SetupIpmiTransportHardwareInformation (
> This functions setup the final header/body/trailer packets for
> the acquired transport interface.
>
> - @param[in] TransportToken The transport interface.
> - @param[in] NetFunction IPMI function.
> - @param[in] Command IPMI command.
> - @param[out] PacketHeader The pointer to receive header of request.
> - @param[in, out] PacketBody The request body.
> - When IN, it is the caller's request body.
> - When OUT and NULL, the request body is not
> - changed.
> - When OUT and non-NULL, the request body is
> - changed to conform the transport interface.
> - @param[in, out] PacketBodySize The request body size.
> - When OUT and non-zero, it is the new data
> - length of request body.
> - When OUT and zero, the request body is unchanged.
> - @param[out] PacketTrailer The pointer to receive trailer of request.
> + @param[in] TransportToken The transport interface.
> + @param[in] NetFunction IPMI function.
> + @param[in] Command IPMI command.
> + @param[out] PacketHeader The pointer to receive header of request.
> + @param[out] PacketHeaderSize Pinter to receive packet header size in
> byte.
> + @param[in, out] PacketBody The request body.
> + When IN, it is the caller's request body.
> + When OUT and NULL, the request body is not
> + changed.
> + Whee out and non-NULL, the request body is
> + changed to comfort the transport interface.
> + @param[in, out] PacketBodySize The request body size.
> + When IN and non-zero, it is the new data
> + length of request body.
> + When IN and zero, the request body is unchanged.
> + @param[out] PacketTrailer The pointer to receive trailer of request.
> + @param[out] PacketTrailerSize Pinter to receive packet trailer size in byte.
>
> @retval EFI_SUCCESS Request packet is returned.
> @retval EFI_UNSUPPORTED Request packet is not returned because
> @@ -91,9 +93,11 @@ SetupIpmiRequestTransportPacket (
> IN UINT8 NetFunction,
> IN UINT8 Command,
> OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader OPTIONAL,
> + OUT UINT16 *PacketHeaderSize,
> IN OUT UINT8 **PacketBody OPTIONAL,
> IN OUT UINT32 *PacketBodySize OPTIONAL,
> - OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL
> + OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL,
> + OUT UINT16 *PacketTrailerSize
> )
> {
> MANAGEABILITY_IPMI_TRANSPORT_HEADER *IpmiHeader; @@ -105,18
> +109,24 @@ SetupIpmiRequestTransportPacket (
> return EFI_OUT_OF_RESOURCES;
> }
>
> + *PacketHeaderSize = 0;
> + *PacketTrailerSize = 0;
> IpmiHeader->Command = Command;
> IpmiHeader->Lun = 0;
> IpmiHeader->NetFn = NetFunction;
> if (PacketHeader != NULL) {
> - *PacketHeader = (MANAGEABILITY_TRANSPORT_HEADER *)IpmiHeader;
> + *PacketHeader = (MANAGEABILITY_TRANSPORT_HEADER *)IpmiHeader;
> + *PacketHeaderSize = sizeof (MANAGEABILITY_IPMI_TRANSPORT_HEADER);
> }
> +
> if (PacketTrailer != NULL) {
> *PacketTrailer = NULL;
> }
> +
> if (PacketBody != NULL) {
> *PacketBody = NULL;
> }
> +
> if (PacketBodySize != NULL) {
> *PacketBodySize = 0;
> }
> @@ -124,6 +134,7 @@ SetupIpmiRequestTransportPacket (
> DEBUG ((DEBUG_ERROR, "%a: No implementation of building up packet.",
> __FUNCTION__));
> ASSERT (FALSE);
> }
> +
> return EFI_SUCCESS;
> }
>
> @@ -164,6 +175,8 @@ CommonIpmiSubmitCommand (
> MANAGEABILITY_TRANSPORT_HEADER IpmiTransportHeader;
> MANAGEABILITY_TRANSPORT_TRAILER IpmiTransportTrailer;
> MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS
> TransportAdditionalStatus;
> + UINT16 HeaderSize;
> + UINT16 TrailerSize;
>
> if (TransportToken == NULL) {
> DEBUG ((DEBUG_ERROR, "%a: No transport toke for IPMI\n",
> __FUNCTION__)); @@ -179,8 +192,8 @@ CommonIpmiSubmitCommand (
> return Status;
> }
>
> - ThisRequestData = RequestData;
> - ThisRequestDataSize = RequestDataSize;
> + ThisRequestData = RequestData;
> + ThisRequestDataSize = RequestDataSize;
> IpmiTransportHeader = NULL;
> IpmiTransportTrailer = NULL;
> Status = SetupIpmiRequestTransportPacket (
> @@ -188,9 +201,11 @@ CommonIpmiSubmitCommand (
> NetFunction,
> Command,
> &IpmiTransportHeader,
> + &HeaderSize,
> &ThisRequestData,
> &ThisRequestDataSize,
> - &IpmiTransportTrailer
> + &IpmiTransportTrailer,
> + &TrailerSize
> );
> if (EFI_ERROR (Status)) {
> DEBUG ((DEBUG_ERROR, "%a: Fail to build packets - (%r)\n", __FUNCTION__,
> Status)); @@ -198,12 +213,13 @@ CommonIpmiSubmitCommand (
> }
>
> ZeroMem (&TransferToken, sizeof (MANAGEABILITY_TRANSFER_TOKEN));
> - TransferToken.TransmitHeader = IpmiTransportHeader;
> - TransferToken.TransmitTrailer = IpmiTransportTrailer;
> + TransferToken.TransmitHeader = IpmiTransportHeader;
> + TransferToken.TransmitHeaderSize = HeaderSize;
> + TransferToken.TransmitTrailer = IpmiTransportTrailer;
> + TransferToken.TransmitTrailerSize = TrailerSize;
>
> // Transmit packet.
> if ((ThisRequestData == NULL) || (ThisRequestDataSize == 0)) {
> -
> // Transmit parameter were not changed by
> SetupIpmiRequestTransportPacket().
> TransferToken.TransmitPackage.TransmitPayload = RequestData;
> TransferToken.TransmitPackage.TransmitSizeInByte = RequestDataSize; @@
> -247,5 +263,6 @@ CommonIpmiSubmitCommand (
> if (ResponseDataSize != NULL) {
> *ResponseDataSize = TransferToken.ReceivePackage.ReceiveSizeInByte;
> }
> +
> return Status;
> }
> diff --git a/Features/ManageabilityPkg/Readme.md
> b/Features/ManageabilityPkg/Readme.md
> index 2ecee96313..81c9322b98 100644
> --- a/Features/ManageabilityPkg/Readme.md
> +++ b/Features/ManageabilityPkg/Readme.md
> @@ -99,7 +99,9 @@ library to compliant with the framework of
> ManageabilityPkg design.
> struct _MANAGEABILITY_TRANSFER_TOKEN {
> EFI_EVENT ReceiveEvent;
> MANAGEABILITY_TRANSPORT_HEADER TransmitHeader;
> + UINT16 TransmitHeaderSize;
> MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer;
> + UINT16 TransmitTrailerSize;
> MANAGEABILITY_TRANSMIT_PACKAGE TransmitPackage;
> MANAGEABILITY_RECEIVE_PACKAGE ReceivePackage;
> EFI_STATUS TransferStatus;
> @@ -124,6 +126,10 @@ library to compliant with the framework of
> ManageabilityPkg design.
> manageability transport library to make the transport implementation
> agnostic to the
> manageability protocol specification.
>
> +* ***TransmitHeaderSize***
> +
> + This indicates the size of TransmitHeader.
> +
> * ***TransmitTrailer***
>
> The transmit trailer may be different according to the disparate transport
> @@ -131,6 +137,10 @@ library to compliant with the framework of
> ManageabilityPkg design.
> manageability transport library to make the transport implementation
> agnostic to the
> manageability protocol specification.
>
> +* ***TransmitTrailerSize***
> +
> + This indicates the size of TransmitTrailer.
> +
> * ***TransmitPackage***
>
> The buffer of packet to transmit, this could be a value of NULL if the
> manageability
> --
> 2.37.1.windows.1
next prev parent reply other threads:[~2023-04-20 6:47 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 [this message]
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
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=MW4PR12MB7031E4754112C5F906AB1202D9639@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