From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id EA38294147E for ; Mon, 23 Oct 2023 13:05:20 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=XHLIsyhrHT8jU714T5tVUPPAx2IJsOe3dDcEHkeEl18=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1698066319; v=1; b=NE+bcpBlOj9aTL9JewhUOpHf3k+/t3rNevnyclAZoPUx929ozMa18oTvZugjXeu7qGcHPofB xLMU++RQPwPisAXvChjKi2RpHEvMTdfnjjjDQlOdsuyhvQ/60Az6qBjWkK5Uq4tuvxRLYZm1uFa cOZTr3G9Sj3HxLn96+xZTFqM= X-Received: by 127.0.0.2 with SMTP id PDU9YY7687511xJffhirZuu4; Mon, 23 Oct 2023 06:05:19 -0700 X-Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by mx.groups.io with SMTP id smtpd.web10.119841.1698066318779968361 for ; Mon, 23 Oct 2023 06:05:19 -0700 X-Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2c51f5a1ecdso48699301fa.0 for ; Mon, 23 Oct 2023 06:05:18 -0700 (PDT) X-Gm-Message-State: E9ZgbeER3r9mZ2PlJtP8uX31x7686176AA= X-Google-Smtp-Source: AGHT+IHeDX/0YqDtJg9LZ1ejvWNItMsC0VD+sofvNTifYlahLCfCYARiKTjXqasDsEaxwH+dHCK/TQ== X-Received: by 2002:a2e:a7ca:0:b0:2c0:1b06:c2c7 with SMTP id x10-20020a2ea7ca000000b002c01b06c2c7mr3874614ljp.20.1698066316459; Mon, 23 Oct 2023 06:05:16 -0700 (PDT) X-Received: from PC10319.67 ([82.97.198.254]) by smtp.googlemail.com with ESMTPSA id r11-20020a2e994b000000b002b9e0d19644sm1550081ljj.106.2023.10.23.06.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 06:05:16 -0700 (PDT) From: "Konstantin Aladyshev" To: devel@edk2.groups.io Cc: abner.chang@amd.com, AbdulLateef.Attar@amd.com, nicklew@nvidia.com, Konstantin Aladyshev Subject: [edk2-devel] [PATCH edk2-platforms v3 01/16] ManageabilityPkg: Add definition for the MCTP KCS TRAILER structure Date: Mon, 23 Oct 2023 16:04:56 +0300 Message-Id: <20231023130511.4521-2-aladyshev22@gmail.com> In-Reply-To: <20231023130511.4521-1-aladyshev22@gmail.com> References: <20231023130511.4521-1-aladyshev22@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,aladyshev22@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=NE+bcpBl; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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 Signed-off-by: Abner Chang --- .../Library/ManageabilityTransportMctpLib.h | 5 +++++ .../MctpProtocol/Common/MctpProtocolCommon.c | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Features/ManageabilityPkg/Include/Library/ManageabilityTranspo= rtMctpLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransp= ortMctpLib.h index 43bd142f4c..462e7436e6 100644 --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpL= ib.h +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpL= ib.h @@ -39,6 +39,11 @@ typedef struct { UINT8 DefiningBody; ///< Message type.=0D UINT8 ByteCount; ///< Byte count of payload.=0D } MANAGEABILITY_MCTP_KCS_HEADER;=0D +=0D +typedef struct {=0D + UINT8 Pec; ///< MCTP over KCS Packet Error Code.=0D +} MANAGEABILITY_MCTP_KCS_TRAILER;=0D +=0D #define MCTP_KCS_NETFN_LUN 0xb0=0D #define DEFINING_BODY_DMTF_PRE_OS_WORKING_GROUP 0x01=0D =0D diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/Mc= tpProtocolCommon.c index 1ad48efdc7..7576007f77 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c @@ -132,7 +132,7 @@ SetupMctpRequestTransportPacket ( MANAGEABILITY_MCTP_KCS_HEADER *MctpKcsHeader;=0D MCTP_TRANSPORT_HEADER *MctpTransportHeader;=0D MCTP_MESSAGE_HEADER *MctpMessageHeader;=0D - UINT8 *Pec;=0D + MANAGEABILITY_MCTP_KCS_TRAILER *MctpKcsTrailer;=0D UINT8 *ThisPackage;=0D =0D if ((PacketHeader =3D=3D NULL) || (PacketHeaderSize =3D=3D NULL) ||=0D @@ -151,8 +151,8 @@ SetupMctpRequestTransportPacket ( return EFI_OUT_OF_RESOURCES;=0D }=0D =0D - Pec =3D (UINT8 *)AllocateZeroPool (sizeof (UINT8));=0D - if (Pec =3D=3D NULL) {=0D + MctpKcsTrailer =3D (MANAGEABILITY_MCTP_KCS_TRAILER *)AllocateZeroPool = (sizeof (MANAGEABILITY_MCTP_KCS_TRAILER));=0D + if (MctpKcsTrailer =3D=3D NULL) {=0D DEBUG ((DEBUG_ERROR, "%a: Not enough resource for PEC.\n", __func__)= );=0D FreePool (MctpKcsHeader);=0D return EFI_OUT_OF_RESOURCES;=0D @@ -167,7 +167,7 @@ SetupMctpRequestTransportPacket ( if (ThisPackage =3D=3D NULL) {=0D DEBUG ((DEBUG_ERROR, "%a: Not enough resource for package.\n", __fun= c__));=0D FreePool (MctpKcsHeader);=0D - FreePool (Pec);=0D + FreePool (MctpKcsTrailer);=0D return EFI_OUT_OF_RESOURCES;=0D }=0D =0D @@ -193,14 +193,14 @@ SetupMctpRequestTransportPacket ( =0D //=0D // Generate PEC follow SMBUS 2.0 specification.=0D - *Pec =3D HelperManageabilityGenerateCrc8 (MCTP_KCS_PACKET_ERROR_CODE_P= OLY, 0, ThisPackage, MctpKcsHeader->ByteCount);=0D + MctpKcsTrailer->Pec =3D HelperManageabilityGenerateCrc8 (MCTP_KCS_PACK= ET_ERROR_CODE_POLY, 0, ThisPackage, MctpKcsHeader->ByteCount);=0D =0D *PacketBody =3D (UINT8 *)ThisPackage;=0D *PacketBodySize =3D MctpKcsHeader->ByteCount;=0D - *PacketTrailer =3D (MANAGEABILITY_TRANSPORT_TRAILER)Pec;=0D + *PacketTrailer =3D (MANAGEABILITY_TRANSPORT_TRAILER)MctpKcsTrailer= ;=0D *PacketHeader =3D (MANAGEABILITY_TRANSPORT_HEADER)MctpKcsHeader;= =0D *PacketHeaderSize =3D sizeof (MANAGEABILITY_MCTP_KCS_HEADER);=0D - *PacketTrailerSize =3D 1;=0D + *PacketTrailerSize =3D sizeof (MANAGEABILITY_MCTP_KCS_TRAILER);=0D return EFI_SUCCESS;=0D } else {=0D DEBUG ((DEBUG_ERROR, "%a: No implementation of building up packet.", _= _func__));=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109909): https://edk2.groups.io/g/devel/message/109909 Mute This Topic: https://groups.io/mt/102134647/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-