Currently there is only a definition for the MCTP KCS HEADER structure. Add definition for the MCTP KCS TRAILER structure as well.
Signed-off-by: Konstantin Aladyshev <aladyshe...@gmail.com> Signed-off-by: Abner Chang <abner.ch...@amd.com> --- .../Library/ManageabilityTransportMctpLib.h | 5 +++++ .../MctpProtocol/Common/MctpProtocolCommon.c | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h index 43bd142f4c..462e7436e6 100644 --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpLib.h @@ -39,6 +39,11 @@ typedef struct { UINT8 DefiningBody; ///< Message type. UINT8 ByteCount; ///< Byte count of payload. } MANAGEABILITY_MCTP_KCS_HEADER; + +typedef struct { + UINT8 Pec; ///< MCTP over KCS Packet Error Code. +} MANAGEABILITY_MCTP_KCS_TRAILER; + #define MCTP_KCS_NETFN_LUN 0xb0 #define DEFINING_BODY_DMTF_PRE_OS_WORKING_GROUP 0x01 diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c index 1ad48efdc7..7576007f77 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolCommon.c @@ -132,7 +132,7 @@ SetupMctpRequestTransportPacket ( MANAGEABILITY_MCTP_KCS_HEADER *MctpKcsHeader; MCTP_TRANSPORT_HEADER *MctpTransportHeader; MCTP_MESSAGE_HEADER *MctpMessageHeader; - UINT8 *Pec; + MANAGEABILITY_MCTP_KCS_TRAILER *MctpKcsTrailer; UINT8 *ThisPackage; if ((PacketHeader == NULL) || (PacketHeaderSize == NULL) || @@ -151,8 +151,8 @@ SetupMctpRequestTransportPacket ( return EFI_OUT_OF_RESOURCES; } - Pec = (UINT8 *)AllocateZeroPool (sizeof (UINT8)); - if (Pec == NULL) { + MctpKcsTrailer = (MANAGEABILITY_MCTP_KCS_TRAILER *)AllocateZeroPool (sizeof (MANAGEABILITY_MCTP_KCS_TRAILER)); + if (MctpKcsTrailer == NULL) { DEBUG ((DEBUG_ERROR, "%a: Not enough resource for PEC.\n", __func__)); FreePool (MctpKcsHeader); return EFI_OUT_OF_RESOURCES; @@ -167,7 +167,7 @@ SetupMctpRequestTransportPacket ( if (ThisPackage == NULL) { DEBUG ((DEBUG_ERROR, "%a: Not enough resource for package.\n", __func__)); FreePool (MctpKcsHeader); - FreePool (Pec); + FreePool (MctpKcsTrailer); return EFI_OUT_OF_RESOURCES; } @@ -193,14 +193,14 @@ SetupMctpRequestTransportPacket ( // // Generate PEC follow SMBUS 2.0 specification. - *Pec = HelperManageabilityGenerateCrc8 (MCTP_KCS_PACKET_ERROR_CODE_POLY, 0, ThisPackage, MctpKcsHeader->ByteCount); + MctpKcsTrailer->Pec = HelperManageabilityGenerateCrc8 (MCTP_KCS_PACKET_ERROR_CODE_POLY, 0, ThisPackage, MctpKcsHeader->ByteCount); *PacketBody = (UINT8 *)ThisPackage; *PacketBodySize = MctpKcsHeader->ByteCount; - *PacketTrailer = (MANAGEABILITY_TRANSPORT_TRAILER)Pec; + *PacketTrailer = (MANAGEABILITY_TRANSPORT_TRAILER)MctpKcsTrailer; *PacketHeader = (MANAGEABILITY_TRANSPORT_HEADER)MctpKcsHeader; *PacketHeaderSize = sizeof (MANAGEABILITY_MCTP_KCS_HEADER); - *PacketTrailerSize = 1; + *PacketTrailerSize = sizeof (MANAGEABILITY_MCTP_KCS_TRAILER); return EFI_SUCCESS; } else { DEBUG ((DEBUG_ERROR, "%a: No implementation of building up packet.", __func__)); -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109634): https://edk2.groups.io/g/devel/message/109634 Mute This Topic: https://groups.io/mt/101994938/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-