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 781D9D8004C for ; Fri, 20 Oct 2023 12:53:12 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=LsxVg0lOULvtj7jphiSwIEEtDYZLxDQaY6J6Oo83M4A=; 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=1697806391; v=1; b=WDvutllcIqrosApqLgHdR+qHr4i64IvgPzbg6IBOSs6QSjsHm2y15fw6SEZof3HiWLsFwWmv 7uzcVro/5LvkhdKcNcB8zuzfIlg5tHnFSfWTULwTa3ebWwFfCUznL7VZymgiyqg0YCo0dY2LYZt SNTcEnY7GvDvc3k4OUOj/ZOY= X-Received: by 127.0.0.2 with SMTP id nVWZYY7687511xLwqfFQSmMx; Fri, 20 Oct 2023 05:53:11 -0700 X-Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by mx.groups.io with SMTP id smtpd.web10.53373.1697806390324307821 for ; Fri, 20 Oct 2023 05:53:10 -0700 X-Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2c509f2c46cso11436751fa.1 for ; Fri, 20 Oct 2023 05:53:10 -0700 (PDT) X-Gm-Message-State: utNgNdZ295EbDWfHPGFH3pg9x7686176AA= X-Google-Smtp-Source: AGHT+IFBKpuFCiEQ/kv6xTVzvYC9EkBSkghuWSSg1MbsY/AZhRggPjfk4hRydTt7yaHj7miKVXgUgg== X-Received: by 2002:a05:651c:555:b0:2c0:32a1:71dd with SMTP id q21-20020a05651c055500b002c032a171ddmr1496710ljp.28.1697806387984; Fri, 20 Oct 2023 05:53:07 -0700 (PDT) X-Received: from PC10319.67 ([82.97.198.254]) by smtp.googlemail.com with ESMTPSA id x22-20020a05651c105600b002b9e5fe86dasm350853ljm.81.2023.10.20.05.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:07 -0700 (PDT) From: "Konstantin Aladyshev" To: devel@edk2.groups.io Cc: abner.chang@amd.com, isaac.w.oram@intel.com, AbdulLateef.Attar@amd.com, nicklew@nvidia.com, Konstantin Aladyshev Subject: [edk2-devel] [PATCH edk2-platforms v2 01/15] ManageabilityPkg: Add definition for the MCTP KCS TRAILER structure Date: Fri, 20 Oct 2023 15:52:48 +0300 Message-Id: <20231020125302.1459-2-aladyshev22@gmail.com> In-Reply-To: <20231020125302.1459-1-aladyshev22@gmail.com> References: <20231020125302.1459-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=WDvutllc; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) 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 (#109851): https://edk2.groups.io/g/devel/message/109851 Mute This Topic: https://groups.io/mt/102080228/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-