From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109851+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109851+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806391; cv=none; d=zohomail.com; s=zohoarc; b=Pldx9kV2/E9wBaM75DC6nBCV8NrF9vsKE0E5zm8Aw///aueG/U/celRUvj/e/5FuYloo2n869WlIJXdQm2ZYuiRUReCydsIpU7gvmNjhyV47gBPnzKnXtNbt23nUsELgp54UYljIT3PeIrOpRwLdZHQsVUAbF+bvHSxa3xLumW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806391; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=SD2NmojrwMlKH6kaGHWe+E6LrEpds6HMRGIgXt+r90E=; b=M1O3m/9ezl/P9c5+K/PagG6WLmT6d2ayvsYeksVkAhYUcDILjqtvnG3LskxVFwuGLpl8m2Ohcs0PLJYMPm1JAIQ8cqrML9IigJX/0TansHM5uunXugZvPKOISty70WlSHv08WVb+dypu81l70KnhunSWzkbfIrNYE54lG/jMnlw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109851+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806391425246.10619015348266; Fri, 20 Oct 2023 05:53:11 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=L+LE9m2PuP4lTZp4Em3i2K3KemBR09dapbURsv48wOM=; 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=dJlB3cJ1EASH1n1ZuNQLEBjNdgdSlRajMV2lIF5BNuBpH7Hni8gmEHZoYDvAwBG4acZI/Y8r s4Y0WXO/Z5v+yZx/xQZgE+EE4/iPo181VydX3W4v2OvszXud+JB3L3//SoFPpVOuGzLaGl8J3+G NSjepAEPKb1DnNVkJpl0oh48= X-Received: by 127.0.0.2 with SMTP id 5W4bYY1788612xUcD42GPbqX; 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: BsM8gB2r847P7llR2jCj2vZpx1787277AA= 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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806392517100002 Content-Type: text/plain; charset="utf-8" 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. 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 =20 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; MCTP_TRANSPORT_HEADER *MctpTransportHeader; MCTP_MESSAGE_HEADER *MctpMessageHeader; - UINT8 *Pec; + MANAGEABILITY_MCTP_KCS_TRAILER *MctpKcsTrailer; UINT8 *ThisPackage; =20 if ((PacketHeader =3D=3D NULL) || (PacketHeaderSize =3D=3D NULL) || @@ -151,8 +151,8 @@ SetupMctpRequestTransportPacket ( return EFI_OUT_OF_RESOURCES; } =20 - Pec =3D (UINT8 *)AllocateZeroPool (sizeof (UINT8)); - if (Pec =3D=3D NULL) { + MctpKcsTrailer =3D (MANAGEABILITY_MCTP_KCS_TRAILER *)AllocateZeroPool = (sizeof (MANAGEABILITY_MCTP_KCS_TRAILER)); + if (MctpKcsTrailer =3D=3D 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 =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "%a: Not enough resource for package.\n", __fun= c__)); FreePool (MctpKcsHeader); - FreePool (Pec); + FreePool (MctpKcsTrailer); return EFI_OUT_OF_RESOURCES; } =20 @@ -193,14 +193,14 @@ SetupMctpRequestTransportPacket ( =20 // // Generate PEC follow SMBUS 2.0 specification. - *Pec =3D HelperManageabilityGenerateCrc8 (MCTP_KCS_PACKET_ERROR_CODE_P= OLY, 0, ThisPackage, MctpKcsHeader->ByteCount); + MctpKcsTrailer->Pec =3D HelperManageabilityGenerateCrc8 (MCTP_KCS_PACK= ET_ERROR_CODE_POLY, 0, ThisPackage, MctpKcsHeader->ByteCount); =20 *PacketBody =3D (UINT8 *)ThisPackage; *PacketBodySize =3D MctpKcsHeader->ByteCount; - *PacketTrailer =3D (MANAGEABILITY_TRANSPORT_TRAILER)Pec; + *PacketTrailer =3D (MANAGEABILITY_TRANSPORT_TRAILER)MctpKcsTrailer; *PacketHeader =3D (MANAGEABILITY_TRANSPORT_HEADER)MctpKcsHeader; *PacketHeaderSize =3D sizeof (MANAGEABILITY_MCTP_KCS_HEADER); - *PacketTrailerSize =3D 1; + *PacketTrailerSize =3D sizeof (MANAGEABILITY_MCTP_KCS_TRAILER); return EFI_SUCCESS; } else { DEBUG ((DEBUG_ERROR, "%a: No implementation of building up packet.", _= _func__)); --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- 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/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109852+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109852+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806392; cv=none; d=zohomail.com; s=zohoarc; b=KPLAj4+edl0x4w28EajMeTdCipVGxfjcrCyz7Bog+jEUATNv9ZSm2/a3zUE5A+jJWkgWbJMacEF6q3QiFB9m+U8t8WbA2hRWToqwcz9Hr7eUnhFQ8YSmYozOSr9SKmZgDiV13l+LK+9Yv4ABXLnohyKCGaZuy4NpZLt8OZL3uiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806392; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=kE1cDHICZv033rWKkG3+cIDd2KNTGJOnHDJSmQP60O0=; b=mcaeOqaBEwaKkNVPJYxLa/MPXKQD9sKfrbnKD4QQKCU/IeJfyqemSXqDpWJnqRXZt9g/ivWmXU7tnP7DgPXHsdM5HZfQBgQO+6bLgd+SpaB9ivIPHS6+4Bsx6wf8XcWJ4qs+PmjyenjqP4dWX6nYba1VOQRt00YkfHZAIapu/AI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109852+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806392044421.97945952696205; Fri, 20 Oct 2023 05:53:12 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=kXxk3oLypSzQ8FF33I34SrKNVuelss538MwGgp/YTxs=; 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=SFq1tQSwtieHe881zG1fri03PyyM2NjjTEvDRS+jdBVIXmwDqWJFm1q12WGPH6TsWZzx8YQa wDW4X1Wm7Eqvqkkt8IaHZbV8WayCNN/gbQRpCbVYkp9YMaGnqCy0iL+bxwX9O86a35HqOZDAFZL /mlGSN8W9i+0vTW0j8964Z9w= X-Received: by 127.0.0.2 with SMTP id xAAOYY1788612xKJkUVyf6kh; Fri, 20 Oct 2023 05:53:11 -0700 X-Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by mx.groups.io with SMTP id smtpd.web10.53374.1697806390965076050 for ; Fri, 20 Oct 2023 05:53:11 -0700 X-Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2c17de836fbso10948671fa.1 for ; Fri, 20 Oct 2023 05:53:10 -0700 (PDT) X-Gm-Message-State: fyEm7AaprqbSzDnKjg5U9Pk1x1787277AA= X-Google-Smtp-Source: AGHT+IEt+wgnbEL1km2gwNfDxlmpYEKMKazbtXN18sWjZEKxtwzr7J5K4W0Z6IUVT/KrsHLX0V1o6Q== X-Received: by 2002:a2e:8416:0:b0:2c5:1867:b0bc with SMTP id z22-20020a2e8416000000b002c51867b0bcmr1406135ljg.51.1697806388671; Fri, 20 Oct 2023 05:53:08 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:08 -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 02/15] ManageabilityPkg: Check MCTP EIDs for reserved values Date: Fri, 20 Oct 2023 15:52:49 +0300 Message-Id: <20231020125302.1459-3-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806392512100001 Content-Type: text/plain; charset="utf-8" MTCP base specification marks EIDs 1-7 as reserved. Therefore return EFI_INVALID_PARAMETER if such EIDs were provided to the MctpSubmitMessage function. Signed-off-by: Konstantin Aladyshev Signed-off-by: Abner Chang --- .../Universal/MctpProtocol/Dxe/MctpProtocol.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProto= col.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c index 88bfd9b7e7..d0f49a1abb 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c @@ -78,6 +78,23 @@ MctpSubmitMessage ( return EFI_INVALID_PARAMETER; } =20 + // + // Check source EID and destination EID + // + if ((MctpSourceEndpointId >=3D MCTP_RESERVED_ENDPOINT_START_ID) && + (MctpSourceEndpointId <=3D MCTP_RESERVED_ENDPOINT_END_ID) + ) { + DEBUG ((DEBUG_ERROR, "%a: The value of MCTP source EID (%x) is reserve= d.\n", __func__, MctpSourceEndpointId)); + return EFI_INVALID_PARAMETER; + } + + if ((MctpDestinationEndpointId >=3D MCTP_RESERVED_ENDPOINT_START_ID) && + (MctpDestinationEndpointId <=3D MCTP_RESERVED_ENDPOINT_END_ID) + ) { + DEBUG ((DEBUG_ERROR, "%a: The value of MCTP destination EID (%x) is re= served.\n", __func__, MctpDestinationEndpointId)); + return EFI_INVALID_PARAMETER; + } + Status =3D CommonMctpSubmitMessage ( mTransportToken, MctpType, --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109852): https://edk2.groups.io/g/devel/message/109852 Mute This Topic: https://groups.io/mt/102080229/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109853+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109853+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806394; cv=none; d=zohomail.com; s=zohoarc; b=VMXJfH1FtIPlC9J9SfpiQtjmxCtU/OMfpRWhdQRZ9OUt8zJNSfxGtZKVE6GVZD2PuC0DkgzCSTurli3KdCOKuMPn7c/vyd2RYx37PRGYJ/yFXwub5PCQyf08ovJ4Cyw9wslCHSmTwPG8zYMmh8A3IS0PbT+w4GnQg3OZ5JSE2xQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806394; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=O59L6MRVQWvU0seP7QqVhGeT0UXk3GA6ADYtRR7yAE0=; b=DdtuHF2NbUQmLAN8gaXfJUG2r10FpxJkptWuWyHb7IsUayFPN3PyHBM0rZnyTlUcEnUEIep6nwEIqWIRxzD95lx6rKg3oYyzfPkzkzsg9wNB3XNOrTSSt8tyTRKKYW0PubjfFDEhZAhIDNhlw+bb+yl8+5Jbo5i3jfy4fKOT1hs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109853+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806394637641.1525790262136; Fri, 20 Oct 2023 05:53:14 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=SFdpcMOlFMY1JmhKFxkVW+qlZOhI8cgketpCRS/ixzY=; 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=1697806394; v=1; b=evk+fMNPDRhRUowk08AoDEIXz6wSoBXdsAPaWh67mo2zhKuftF1rbjrfjHUwD6HmxzSzT8Gv xKXTOUjQFV9VxrKTgxBdnhN1gy6q+PqsvRSTUT/aQshr1KMe+NxpnuzC9BYFVE31h5RbVI6gDpz pNYW70bvQovItyKpJzPxy/0w= X-Received: by 127.0.0.2 with SMTP id Z7u6YY1788612xKT4VOaJzdx; Fri, 20 Oct 2023 05:53:14 -0700 X-Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mx.groups.io with SMTP id smtpd.web10.53377.1697806393331637006 for ; Fri, 20 Oct 2023 05:53:13 -0700 X-Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2c1807f3400so9474411fa.1 for ; Fri, 20 Oct 2023 05:53:13 -0700 (PDT) X-Gm-Message-State: DlUIxzWdyyhw3gWxWdlbHngLx1787277AA= X-Google-Smtp-Source: AGHT+IGeThtToX/9KhzE82n4mxl+IXDUr+G54uHP/tugMOS/56lkWOtM1NoyM7i7Cloz00sCD4Zghw== X-Received: by 2002:a05:651c:b29:b0:2c5:884:88a0 with SMTP id b41-20020a05651c0b2900b002c5088488a0mr1823328ljr.21.1697806390945; Fri, 20 Oct 2023 05:53:10 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:09 -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 03/15] ManageabilityPkg: Support both MCTP and IPMI in KCS tranport library Date: Fri, 20 Oct 2023 15:52:50 +0300 Message-Id: <20231020125302.1459-4-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806396527100003 Content-Type: text/plain; charset="utf-8" The Manageability KCS transport library needs to support requests both from MCTP and IPMI transports. Currently the code only handles IPMI case correctly. In the MCTP case the communication should be based on the MCTP-over-KCS specification (DSP0254). This specification defines a special KCS binding header and trailer structures that need to be present in every MCTP message. The header structure contains a length field, therefore response packet size is not needed to be known beforehand. The trailer structure contains a PEC checksum that can be used to check itegrity of the response message. Modify Manageability KCS transport library code to check which message is processed (IPMI or MCTP) and handle each case correctly based on its own specification. Tested: - The IPMI KCS communication is tested by Abner Chang, - The MCTP KCS communication is tested by Konstantin Aladyshev on the AMD EthanolX CRB. Signed-off-by: Konstantin Aladyshev Signed-off-by: Abner Chang --- .../Common/KcsCommon.c | 284 +++++++++++++++--- .../MctpProtocol/Common/MctpProtocolCommon.c | 14 +- 2 files changed, 260 insertions(+), 38 deletions(-) diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib= /Common/KcsCommon.c b/Features/ManageabilityPkg/Library/ManageabilityTransp= ortKcsLib/Common/KcsCommon.c index d5b54c04be..4f7e7d450f 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common= /KcsCommon.c +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common= /KcsCommon.c @@ -8,16 +8,19 @@ **/ #include #include +#include #include #include #include #include +#include #include #include =20 #include "ManageabilityTransportKcs.h" =20 extern MANAGEABILITY_TRANSPORT_KCS_HARDWARE_INFO mKcsHardwareInfo; +extern MANAGEABILITY_TRANSPORT_KCS *mSingleSessionToken; =20 /** This function waits for parameter Flag to set. @@ -379,6 +382,218 @@ KcsTransportRead ( return EFI_SUCCESS; } =20 +/** + This funciton checks the KCS response data according to + manageability protocol. + + @param[in] ResponseData Pointer to response data. + @param[in] ResponseDataSize Size of response data. + @param[out] AdditionalStatus Pointer to receive the additional st= atus. + + @retval EFI_SUCCESS KCS response header is checked witho= ut error + @retval EFI_DEVICE_ERROR KCS response header has problem. +**/ +EFI_STATUS +KcsCheckResponseData ( + IN UINT8 *ResponseData, + IN UINT32 ResponseDataSize, + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *AdditionalStatus + ) +{ + EFI_STATUS Status; + MANAGEABILITY_MCTP_KCS_TRAILER MctpKcsPec; + UINT32 PecSize; + UINT8 CalculatedPec; + CHAR16 *CompletionCodeStr; + + Status =3D EFI_SUCCESS; + *AdditionalStatus =3D MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NO_ERROR= S; + if (CompareGuid (&gManageabilityProtocolMctpGuid, mSingleSessionToken->T= oken.ManageabilityProtocolSpecification)) { + // + // For MCTP over KCS, check PEC + // + PecSize =3D sizeof (MANAGEABILITY_MCTP_KCS_TRAILER) + 1; // +1 to rea= d last dummy byte that finishes KCS transfer + Status =3D KcsTransportRead (&MctpKcsPec.Pec, &PecSize); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Failed to read PEC with Status(%r)\n", + __func__, + Status + )); + *AdditionalStatus =3D MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_ERRO= R; + return Status; + } + + if (PecSize !=3D sizeof (MctpKcsPec)) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Received PEC size is %d instead of %d\n", + __func__, + PecSize, + sizeof (MctpKcsPec) + )); + *AdditionalStatus =3D MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_ERRO= R; + return EFI_DEVICE_ERROR; + } + + HelperManageabilityDebugPrint ((VOID *)&MctpKcsPec.Pec, PecSize - 1, "= MCTP over KCS Response PEC:\n"); + CalculatedPec =3D HelperManageabilityGenerateCrc8 (MCTP_KCS_PACKET_ERR= OR_CODE_POLY, 0, ResponseData, ResponseDataSize); + if (CalculatedPec !=3D MctpKcsPec.Pec) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Received PEC is 0x%02x instead of 0x%02x\n", + __func__, + MctpKcsPec.Pec, + CalculatedPec + )); + Status =3D EFI_DEVICE_ERROR; + } + } else if (CompareGuid (&gManageabilityProtocolIpmiGuid, mSingleSessionT= oken->Token.ManageabilityProtocolSpecification)) { + // + // For IPMI over KCS + // Check and print Completion Code + // + Status =3D IpmiHelperCheckCompletionCode (*ResponseData, &CompletionCo= deStr, AdditionalStatus); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_MANAGEABILITY_INFO, "Cc: %02x %s.\n", *((UINT8 *)Respo= nseData), CompletionCodeStr)); + } else if (Status =3D=3D EFI_NOT_FOUND) { + DEBUG ((DEBUG_ERROR, "Cc: %02x not defined in IpmiCompletionCodeMapp= ing or invalid.\n", *((UINT8 *)ResponseData))); + } + } + + return Status; +} + +/** + This funciton reads the KCS response header according to + manageability protocol. Caller has to free the memory + allocated for response header. + + @param[in] ResponseHeader Pointer to receive the response h= eader. + @param[out] AdditionalStatus Pointer to receive the additional= status. + + @retval EFI_SUCCESS KCS response header is checked an= d returned + to caller. + @retval EFI_INVALID_PARAMETER One of the given parameter is inc= orrect. + @retval EFI_OUT_OF_RESOURCE Memory allocation is failed for R= esponseHeader. + @retval EFI_DEVICE_ERROR Incorrect response header. +**/ +EFI_STATUS +KcsReadResponseHeader ( + IN UINT8 **ResponseHeader, + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *AdditionalStatus + ) +{ + EFI_STATUS Status; + UINT32 RspHeaderSize; + UINT32 ExpectedHeaderSize; + UINT8 *RspHeader; + + if ((ResponseHeader =3D=3D NULL) || (AdditionalStatus =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + *ResponseHeader =3D NULL; + if (CompareGuid (&gManageabilityProtocolMctpGuid, mSingleSessionToken->T= oken.ManageabilityProtocolSpecification)) { + + // For MCTP over KCS + ExpectedHeaderSize =3D sizeof (MANAGEABILITY_MCTP_KCS_HEADER); + DEBUG (( + DEBUG_MANAGEABILITY_INFO, + "%a: Reading MCTP over KCS response header.\n", + __func__ + )); + } else if (CompareGuid (&gManageabilityProtocolIpmiGuid, mSingleSessionT= oken->Token.ManageabilityProtocolSpecification)) { + // For IPMI over KCS + + ExpectedHeaderSize =3D sizeof (IPMI_KCS_RESPONSE_HEADER); + DEBUG (( + DEBUG_MANAGEABILITY_INFO, + "%a: Reading IPMI over KCS response header.\n", + __func__ + )); + } else { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Unsupportted manageability protocol over KCS: %g.\n", + __func__, + mSingleSessionToken->Token.ManageabilityProtocolSpecification + )); + return EFI_INVALID_PARAMETER; + } + + RspHeader =3D (UINT8 *)AllocateZeroPool (ExpectedHeaderSize); + if (RspHeader =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "Memory allocation failed for KCS response header= !\n")); + return EFI_OUT_OF_RESOURCES; + } + + RspHeaderSize =3D ExpectedHeaderSize; + Status =3D KcsTransportRead (RspHeader, &RspHeaderSize); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Failed to read KCS response header Status(%r)\n", + __func__, + Status + )); + FreePool (RspHeader); + *AdditionalStatus =3D MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_ERROR; + return Status; + } + + if (RspHeaderSize !=3D 0) { + HelperManageabilityDebugPrint ((VOID *)RspHeader, RspHeaderSize, "KCS = Response Header:\n"); + } + + if (ExpectedHeaderSize !=3D RspHeaderSize) { + DEBUG (( + DEBUG_ERROR, + "The size (%d bytes) of returned resposne header is not the same as = expection (%d bytes)!\n", + RspHeaderSize, + ExpectedHeaderSize + )); + FreePool (RspHeader); + return EFI_DEVICE_ERROR; + } + + if (CompareGuid (&gManageabilityProtocolMctpGuid, mSingleSessionToken->T= oken.ManageabilityProtocolSpecification)) { + // + // MCTP over KCS + // + if (((MANAGEABILITY_MCTP_KCS_HEADER *)RspHeader)->NetFunc !=3D MCTP_KC= S_NETFN_LUN) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! MANAGEABILITY_MCTP_KCS_HEADER.NetFunc is equal 0x%02x = instead of 0x%02x\n", + __func__, + ((MANAGEABILITY_MCTP_KCS_HEADER *)RspHeader)->NetFunc, + MCTP_KCS_NETFN_LUN + )); + FreePool (RspHeader); + *AdditionalStatus =3D MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_ERRO= R; + return EFI_DEVICE_ERROR; + } + + if (((MANAGEABILITY_MCTP_KCS_HEADER *)RspHeader)->DefiningBody !=3D DE= FINING_BODY_DMTF_PRE_OS_WORKING_GROUP) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! MANAGEABILITY_MCTP_KCS_HEADER.DefiningBody is equal 0x= %02x instead of 0x%02x\n", + __func__, + ((MANAGEABILITY_MCTP_KCS_HEADER *)RspHeader)->DefiningBody, + DEFINING_BODY_DMTF_PRE_OS_WORKING_GROUP + )); + FreePool (RspHeader); + *AdditionalStatus =3D MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_ERRO= R; + return EFI_DEVICE_ERROR; + } + } + + *ResponseHeader =3D RspHeader; + *AdditionalStatus =3D MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NO_ERROR= S; + return EFI_SUCCESS; +} + /** This service communicates with BMC using KCS protocol. =20 @@ -423,11 +638,9 @@ KcsTransportSendCommand ( OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS *AdditionalStatus ) { - EFI_STATUS Status; - UINT32 RspHeaderSize; - IPMI_KCS_RESPONSE_HEADER RspHeader; - UINT32 ExpectedResponseDataSize; - CHAR16 *CompletionCodeStr; + EFI_STATUS Status; + UINT8 *RspHeader; + UINT32 ExpectedResponseDataSize; =20 if ((RequestData !=3D NULL) && (RequestDataSize =3D=3D 0)) { DEBUG ((DEBUG_ERROR, "%a: Mismatched values of RequestData and Request= DataSize\n", __func__)); @@ -467,56 +680,59 @@ KcsTransportSendCommand ( RequestDataSize ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "KCS Write Failed with Status(%r)", Status)); + DEBUG ((DEBUG_ERROR, "KCS Write Failed with Status(%r)\n", Status)); return Status; } + } =20 + if ((ResponseData !=3D NULL) && (ResponseDataSize !=3D NULL) && (*Respon= seDataSize !=3D 0)) { // // Read the response header - RspHeaderSize =3D sizeof (IPMI_KCS_RESPONSE_HEADER); - Status =3D KcsTransportRead ((UINT8 *)&RspHeader, &RspHeaderSiz= e); + // + Status =3D KcsReadResponseHeader (&RspHeader, AdditionalStatus); if (EFI_ERROR (Status)) { - DEBUG (( - DEBUG_ERROR, - "KCS read response header failed Status(%r), " \ - "RspNetFunctionLun =3D 0x%x, " \ - "Comamnd =3D 0x%x \n", - Status, - RspHeader.NetFunc, - RspHeader.Command - )); return (Status); } =20 // - // Print out the response payloads. - HelperManageabilityDebugPrint ((VOID *)&RspHeader, RspHeaderSize, "KCS= Response Header:\n"); - } + // Override ResposeDataSize if the manageability protocol is MCTP. + // + if (CompareGuid (&gManageabilityProtocolMctpGuid, mSingleSessionToken-= >Token.ManageabilityProtocolSpecification)) { + if (*ResponseDataSize < ((MANAGEABILITY_MCTP_KCS_HEADER *)RspHeader)= ->ByteCount) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! MANAGEABILITY_MCTP_KCS_HEADER.ByteCount (0x%02x) is = bigger than provided buffer (0x%02x)\n", + __func__, + ((MANAGEABILITY_MCTP_KCS_HEADER *)RspHeader)->ByteCount, + *ResponseDataSize + )); + return EFI_INVALID_PARAMETER; + } + + *ResponseDataSize =3D ((MANAGEABILITY_MCTP_KCS_HEADER *)RspHeader)->= ByteCount; + } + FreePool (RspHeader); =20 - if ((ResponseData !=3D NULL) && (ResponseDataSize !=3D NULL) && (*Respon= seDataSize !=3D 0)) { ExpectedResponseDataSize =3D *ResponseDataSize; - Status =3D KcsTransportRead ((UINT8 *)ResponseData, = ResponseDataSize); + Status =3D KcsTransportRead (ResponseData, ResponseD= ataSize); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "KCS response read Failed with Status(%r)", Sta= tus)); + DEBUG ((DEBUG_ERROR, "KCS response read Failed with Status(%r)\n", S= tatus)); } =20 - // // Print out the response payloads. if (*ResponseDataSize !=3D 0) { if (ExpectedResponseDataSize !=3D *ResponseDataSize) { - DEBUG ((DEBUG_ERROR, "Expected KCS response size : %d is not match= ed to returned size : %d.\n", ExpectedResponseDataSize, *ResponseDataSize)); - Status =3D EFI_DEVICE_ERROR; + DEBUG (( + DEBUG_ERROR, + "Expected KCS response size : %d is not matched to returned size= : %d.\n", + ExpectedResponseDataSize, + *ResponseDataSize + )); + return EFI_DEVICE_ERROR; } =20 HelperManageabilityDebugPrint ((VOID *)ResponseData, (UINT32)*Respon= seDataSize, "KCS Response Data:\n"); - - // Print Completion Code - Status =3D IpmiHelperCheckCompletionCode (*((UINT8 *)ResponseData), = &CompletionCodeStr, AdditionalStatus); - if (!EFI_ERROR (Status)) { - DEBUG ((DEBUG_MANAGEABILITY_INFO, "Cc: %02x %s.\n", *((UINT8 *)Res= ponseData), CompletionCodeStr)); - } else if (Status =3D=3D EFI_NOT_FOUND) { - DEBUG ((DEBUG_MANAGEABILITY_INFO, "Cc: %02x not defined in IpmiCom= pletionCodeMapping or invalid.\n", *((UINT8 *)ResponseData))); - } + Status =3D KcsCheckResponseData (ResponseData, *ResponseDataSize, Ad= ditionalStatus); } else { DEBUG ((DEBUG_ERROR, "No response, can't determine Completion Code.\= n")); } diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/Mc= tpProtocolCommon.c index 7576007f77..e560c638d5 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c @@ -267,6 +267,9 @@ CommonMctpSubmitMessage ( MANAGEABILITY_TRANSPORT_TRAILER MctpTransportTrailer; MANAGEABILITY_TRANSMISSION_MULTI_PACKAGES *MultiPackages; MANAGEABILITY_TRANSMISSION_PACKAGE_ATTR *ThisPackage; + UINT8 *ResponseBuffer; + MCTP_TRANSPORT_HEADER *MctpTransportResponseHeader; + MCTP_MESSAGE_HEADER *MctpMessageResponseHeader; =20 if (TransportToken =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "%a: No transport toke for MCTP\n", __func__)); @@ -435,11 +438,12 @@ CommonMctpSubmitMessage ( ThisPackage++; } =20 + ResponseBuffer =3D (UINT8 *)AllocatePool (*ResponseDataSize + sizeof (MC= TP_TRANSPORT_HEADER) + sizeof (MCTP_MESSAGE_HEADER)); // Receive packet. TransferToken.TransmitPackage.TransmitPayload =3D NULL; TransferToken.TransmitPackage.TransmitSizeInByte =3D 0; - TransferToken.ReceivePackage.ReceiveBuffer =3D ResponseDa= ta; - TransferToken.ReceivePackage.ReceiveSizeInByte =3D *ResponseD= ataSize; + TransferToken.ReceivePackage.ReceiveBuffer =3D ResponseBu= ffer; + TransferToken.ReceivePackage.ReceiveSizeInByte =3D *ResponseD= ataSize + sizeof (MCTP_TRANSPORT_HEADER) + sizeof (MCTP_MESSAGE_HEADER); TransferToken.TransmitHeader =3D NULL; TransferToken.TransmitHeaderSize =3D 0; TransferToken.TransmitTrailer =3D NULL; @@ -461,8 +465,10 @@ CommonMctpSubmitMessage ( // Return transfer status. // *AdditionalTransferError =3D TransferToken.TransportAdditionalStatus; - *ResponseDataSize =3D TransferToken.ReceivePackage.ReceiveSizeInB= yte; - Status =3D TransferToken.TransferStatus; + *ResponseDataSize =3D TransferToken.ReceivePackage.ReceiveSizeInB= yte - sizeof (MCTP_TRANSPORT_HEADER) - sizeof (MCTP_MESSAGE_HEADER); + CopyMem (ResponseData, ResponseBuffer + sizeof (MCTP_TRANSPORT_HEADER) += sizeof (MCTP_MESSAGE_HEADER), *ResponseDataSize); + FreePool (ResponseBuffer); + Status =3D TransferToken.TransferStatus; if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: Failed to send MCTP command over %s: %r\n", = __func__, mTransportName, Status)); return Status; --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109853): https://edk2.groups.io/g/devel/message/109853 Mute This Topic: https://groups.io/mt/102080230/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109854+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109854+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806395; cv=none; d=zohomail.com; s=zohoarc; b=B9ySR/B8K1xb0WcbwUhFArr+BWrkZMqOGCTtFpxatp8ShNxHa8RQ+4NXqvk6P+E5xPkSpteBM0BTobrCJBeRTUvszgGmQDPXpIXLtRy/MZo86W5IF8RamI3kV6dkgG12PpoPQ8cnP3VT5l4xfp/NyaLtL+3ZuK8Xk6ODY4rVcCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806395; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=4h+3lMI0ETw70CTdIpBLaBOQ+ezQt22hkrwxwx3TGJM=; b=Fg8O4uB4+55t5V3st4IaSxvNqc7WBWAXOKA4Yp0nNIE3ga0QN7kp75p/r2YwsaHHqCdCAK4MOosFooMOSQ+UZIbHKOeKTDQ25mJgJJovZwKMgPtg5yZSQMTIAj4kIOUNfpx+DMnfhC/Q/tVUvTRrcAHi0F9/G3SCrbf3N05tjmA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109854+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806395189157.34738761965514; Fri, 20 Oct 2023 05:53:15 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=gVoZt7Qt4E9XNSnJ+6CNtLwmGZlmtRcBAjP6rtG3AnA=; 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=1697806394; v=1; b=PBpI8QEr4hnEW7OIyQRdfMeiP/31P5OYeAAwWJz+D3cqf4qjB/tAbqiLZx5b7q5Km3oTkX2R FUYn4/NZwXsgKLAolbbZkgmnNzzkOa/DQtjw0s0XviSczWJQzyDKBf2/hhgqhmGSe0IiXH1afcx Nx+8SO2q8h6ONt/7kPD235wc= X-Received: by 127.0.0.2 with SMTP id JICHYY1788612xYEuCU27AA8; Fri, 20 Oct 2023 05:53:14 -0700 X-Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by mx.groups.io with SMTP id smtpd.web10.53378.1697806393923337168 for ; Fri, 20 Oct 2023 05:53:14 -0700 X-Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2c514cbbe7eso11185501fa.1 for ; Fri, 20 Oct 2023 05:53:13 -0700 (PDT) X-Gm-Message-State: ihHwQCCfMpkQpxuQMBPe5pcFx1787277AA= X-Google-Smtp-Source: AGHT+IEgQsb+QR+BT0sj5hKVfAwTKXhcJY/3dE+tBxfKBcO7EmrNIrpobbgSp2HGsppsxSgE0Jcceg== X-Received: by 2002:a05:651c:222c:b0:2c5:d3e:2f46 with SMTP id y44-20020a05651c222c00b002c50d3e2f46mr1303075ljq.11.1697806391849; Fri, 20 Oct 2023 05:53:11 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:11 -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 04/15] ManageabilityPkg: Check header fields in the MCTP response Date: Fri, 20 Oct 2023 15:52:51 +0300 Message-Id: <20231020125302.1459-5-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806396493100002 Content-Type: text/plain; charset="utf-8" Add checks for the MCTP header fields in the MCTP response. Signed-off-by: Konstantin Aladyshev --- .../MctpProtocol/Common/MctpProtocolCommon.c | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/Mc= tpProtocolCommon.c index e560c638d5..5844d54eb2 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c @@ -461,6 +461,88 @@ CommonMctpSubmitMessage ( &TransferToken ); =20 + MctpTransportResponseHeader =3D (MCTP_TRANSPORT_HEADER *)ResponseBuffer; + if (MctpTransportResponseHeader->Bits.HeaderVersion !=3D MCTP_KCS_HEADER= _VERSION) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Response HeaderVersion (0x%02x) doesn't match MCTP_KCS_H= EADER_VERSION (0x%02x)\n", + __func__, + MctpTransportResponseHeader->Bits.HeaderVersion, + MCTP_KCS_HEADER_VERSION + )); + FreePool (ResponseBuffer); + return EFI_DEVICE_ERROR; + } + if (MctpTransportResponseHeader->Bits.MessageTag !=3D MCTP_MESSAGE_TAG) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Response MessageTag (0x%02x) doesn't match MCTP_MESSAGE_= TAG (0x%02x)\n", + __func__, + MctpTransportResponseHeader->Bits.MessageTag, + MCTP_MESSAGE_TAG + )); + FreePool (ResponseBuffer); + return EFI_DEVICE_ERROR; + } + if (MctpTransportResponseHeader->Bits.TagOwner !=3D MCTP_MESSAGE_TAG_OWN= ER_RESPONSE) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Response TagOwner (0x%02x) doesn't match MCTP_MESSAGE_TA= G_OWNER_RESPONSE (0x%02x)\n", + __func__, + MctpTransportResponseHeader->Bits.TagOwner, + MCTP_MESSAGE_TAG_OWNER_RESPONSE + )); + FreePool (ResponseBuffer); + return EFI_DEVICE_ERROR; + } + if (MctpTransportResponseHeader->Bits.SourceEndpointId !=3D MctpDestinat= ionEndpointId) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Response SrcEID (0x%02x) doesn't match sent EID (0x%02x)= \n", + __func__, + MctpTransportResponseHeader->Bits.SourceEndpointId, + MctpDestinationEndpointId + )); + FreePool (ResponseBuffer); + return EFI_DEVICE_ERROR; + } + if (MctpTransportResponseHeader->Bits.DestinationEndpointId !=3D MctpSou= rceEndpointId) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Response DestEID (0x%02x) doesn't match local EID (0x%02= x)\n", + __func__, + MctpTransportResponseHeader->Bits.DestinationEndpointId, + MctpSourceEndpointId + )); + FreePool (ResponseBuffer); + return EFI_DEVICE_ERROR; + } + + MctpMessageResponseHeader =3D (MCTP_MESSAGE_HEADER *)(MctpTransportRespo= nseHeader + 1); + if (MctpMessageResponseHeader->Bits.MessageType !=3D MctpType) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Response MessageType (0x%02x) doesn't match sent Message= Type (0x%02x)\n", + __func__, + MctpMessageResponseHeader->Bits.MessageType, + MctpType + )); + FreePool (ResponseBuffer); + return EFI_DEVICE_ERROR; + } + + if (MctpMessageResponseHeader->Bits.IntegrityCheck !=3D (UINT8)RequestDa= taIntegrityCheck) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Response IntegrityCheck (%d) doesn't match sent Integrit= yCheck (%d)\n", + __func__, + MctpMessageResponseHeader->Bits.IntegrityCheck, + (UINT8)RequestDataIntegrityCheck + )); + FreePool (ResponseBuffer); + return EFI_DEVICE_ERROR; + } + // // Return transfer status. // --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109854): https://edk2.groups.io/g/devel/message/109854 Mute This Topic: https://groups.io/mt/102080231/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109855+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109855+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806396; cv=none; d=zohomail.com; s=zohoarc; b=HKudpwZhSCxRV3tk1hLV2K6a2pw6jFUJxbloiDsUOiBt8XGcjLtqa6VBLX5cozoMHKCCJC0vo0hihpGjAgFA31Zwaz/36tQjJW9Ya/Lp/LsRG3Jo+Q25tZSF3N/2jCoUy2Z+51MllwoXxiAoQwlhUuQlpc0EO21sbXSQd7r9vRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806396; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=RKcHscylmaLGv3qexTbxinkjD4GUhp24br7RbQGltXA=; b=HM8I1bYxQ5+ls/PkgsIpJcztdExZJwrkb/WZIzl7r0j8VtOVnwY8Z6xMazXKT9RWdflbaeieABQXRxEcrXzNvoivn9PIOjV2a6mSDVms+n/E2THYNNvwCfgtKuDFMJMsrjs13L4QMz6MpsPbfVWOSq5NL2qlFeuT4cMX1Q+hepA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109855+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806396079610.0503074036366; Fri, 20 Oct 2023 05:53:16 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=JqjBhccLy2mYrvICXJE9kSikXgVWUr/NdTjVh8u306Q=; 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=1697806395; v=1; b=BQPmG3nI112lFXNyr+5HlOHmABRPLyuWshQcRmiSYbCi0WMGiV89pvqfmQe9eaAT728Zho9a ex2b7FWDi7D5YrI7ahB3+xfNQxqepsGbqmdee4stzIXD6nOLZlsg5kauUVfSk1nCz1P3/OLD13T flp+b2Ba4jEINwqpB9v94Jig= X-Received: by 127.0.0.2 with SMTP id fIiFYY1788612xRdZKIc9d7L; Fri, 20 Oct 2023 05:53:15 -0700 X-Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mx.groups.io with SMTP id smtpd.web11.53588.1697806394965307856 for ; Fri, 20 Oct 2023 05:53:15 -0700 X-Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2c509f2c46cso11438061fa.1 for ; Fri, 20 Oct 2023 05:53:14 -0700 (PDT) X-Gm-Message-State: T941Rya7gacIugW00hnQCx8Ix1787277AA= X-Google-Smtp-Source: AGHT+IHPwEdmYTanVBEkq+Bm6Qiv1pKgVElI8nLE7FWiM3DKQpxCwAIr6qB+eDHP4HUUlA24wicxfA== X-Received: by 2002:a2e:9b97:0:b0:2c0:9bd:c6f with SMTP id z23-20020a2e9b97000000b002c009bd0c6fmr1359820lji.41.1697806392790; Fri, 20 Oct 2023 05:53:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:12 -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 05/15] ManageabilityPkg: Correct typo in MCTP destination EID field Date: Fri, 20 Oct 2023 15:52:52 +0300 Message-Id: <20231020125302.1459-6-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806396481100001 Content-Type: text/plain; charset="utf-8" Correct wrong structure member used for MCTP destination EID. Signed-off-by: Abner Chang Signed-off-by: Konstantin Aladyshev --- .../Universal/PldmProtocol/Common/PldmProtocolCommon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/Pl= dmProtocolCommon.c index ce1e2cba95..1c4506d87f 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c @@ -119,7 +119,7 @@ SetupPldmRequestTransportPacket ( } =20 MctpHeader->SourceEndpointId =3D PcdGet8 (PcdMctpSourceEnd= pointId); - MctpHeader->SourceEndpointId =3D PcdGet8 (PcdMctpDestinati= onEndpointId); + MctpHeader->DestinationEndpointId =3D PcdGet8 (PcdMctpDestinati= onEndpointId); MctpHeader->MessageHeader.IntegrityCheck =3D FALSE; MctpHeader->MessageHeader.MessageType =3D MCTP_MESSAGE_TYPE_PLDM; *PacketHeader =3D (MANAGEABILITY_TRANSPORT_= HEADER *)MctpHeader; --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109855): https://edk2.groups.io/g/devel/message/109855 Mute This Topic: https://groups.io/mt/102080232/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109856+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109856+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806397; cv=none; d=zohomail.com; s=zohoarc; b=J2L9fEr9r9sdtJbOjxrz4XV5MYUMC/fbZiZ6hjYUxZ7soR0NahgSY18s+N+3i+tjHsVJlwthMB69ZhWUI3vkqnjMZrkRpKSNFPcxH8n4GL7K84FGUzsyv7bnAoe5fCeLjPd4l1HPgV2onLzQndH7vb9aJ8O+1+LnmU9frcOw+bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806397; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=iTdVt++UraQHNeSrTSSyqcnMeqjRBWxtiFvl9OMWwO8=; b=EnEcBWyfI2urJT8NE2ue1hAMOSfSUVj6M0YlXjMUmttE8dC6J82j2BPSEOA2HTaR4NLcEvadhVB+5rT0P9qdRV1L3iZmSvLSojQjYekU/KXdumxybB+4fF6QxMvIDVAlUibmdN9NKCK8mjoWua6buqreqhvdhEIcfHonUF5aFWQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109856+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806397179662.6417478203725; Fri, 20 Oct 2023 05:53:17 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=un1dKMV0GrQ15OTaxAhHK1bGjZT7i08IWY7h3M23z/k=; 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=1697806396; v=1; b=sD/KoQaB70J9JfmAsH19Kggr4o1XJz9g5bl6CqtJaOSvFXvZax3ychsad+D1nB0B+9fFANwB 9ygLkU/v15+XCVeNVNRuYzbe+TskC2TqP0FFUBLv3ajn2RrvsB7TRRNNF6TQHQf3Iz0NWhhqFcp rU5yhccxiAZD95bTjGzsFtwQ= X-Received: by 127.0.0.2 with SMTP id sUjZYY1788612xLJWPPPLyf4; Fri, 20 Oct 2023 05:53:16 -0700 X-Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by mx.groups.io with SMTP id smtpd.web10.53380.1697806396061946068 for ; Fri, 20 Oct 2023 05:53:16 -0700 X-Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2bfed7c4e6dso11679831fa.1 for ; Fri, 20 Oct 2023 05:53:15 -0700 (PDT) X-Gm-Message-State: cgXlsKSeztFJUzR86xru9FGux1787277AA= X-Google-Smtp-Source: AGHT+IFLUkL2ZLTy1OKs7IRoQ0/AYlhW1uscmh6+ueAVyOmLWXMOV3c1tgK4PUwJF94tAa5DeZAb3g== X-Received: by 2002:a05:651c:22a:b0:2b6:df71:cff1 with SMTP id z10-20020a05651c022a00b002b6df71cff1mr1405768ljn.52.1697806393834; Fri, 20 Oct 2023 05:53:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:13 -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 06/15] ManageabilityPkg: Update the algorithm of using MCTP endpoint ID PCD Date: Fri, 20 Oct 2023 15:52:53 +0300 Message-Id: <20231020125302.1459-7-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806398568100013 Content-Type: text/plain; charset="utf-8" Although MtcpSubmit function receives source and destination MCTP EID arguments these value are not used in any way currently. Instead the code always uses EID values from the PCDs. To correct this issue modify function interface to receive source and destination MCTP EIDs via pointers and use PCD values only if the pointers are NULL. Signed-off-by: Konstantin Aladyshev Signed-off-by: Abner Chang --- .../Include/Protocol/MctpProtocol.h | 12 ++++-- .../Dxe/ManageabilityTransportMctp.c | 4 +- .../MctpProtocol/Common/MctpProtocolCommon.c | 4 +- .../Universal/MctpProtocol/Dxe/MctpProtocol.c | 42 ++++++++++++++----- 4 files changed, 44 insertions(+), 18 deletions(-) diff --git a/Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h b/Fe= atures/ManageabilityPkg/Include/Protocol/MctpProtocol.h index 85e42f157d..c96b986c44 100644 --- a/Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h +++ b/Features/ManageabilityPkg/Include/Protocol/MctpProtocol.h @@ -28,8 +28,12 @@ typedef struct _EDKII_MCTP_PROTOCOL EDKII_MCTP_PROTOCOL; =20 @param[in] This EDKII_MCTP_PROTOCOL instan= ce. @param[in] MctpType MCTP message type. - @param[in] MctpSourceEndpointId MCTP source endpoint ID. - @param[in] MctpDestinationEndpointId MCTP source endpoint ID. + @param[in] MctpSourceEndpointId Pointer of MCTP source end= point ID. + Set to NULL means use plat= form PCD value + (PcdMctpSourceEndpointId). + @param[in] MctpDestinationEndpointId Pointer of MCTP destinatio= n endpoint ID. + Set to NULL means use plat= form PCD value + (PcdMctpDestinationEndpoin= tId). @param[in] RequestDataIntegrityCheck Indicates whether MCTP mes= sage has integrity check byte. @param[in] RequestData Message Data. @@ -58,8 +62,8 @@ EFI_STATUS (EFIAPI *MCTP_SUBMIT_COMMAND)( IN EDKII_MCTP_PROTOCOL *This, IN UINT8 MctpType, - IN UINT8 MctpSourceEndpointId, - IN UINT8 MctpDestinationEndpointId, + IN UINT8 *MctpSourceEndpointId, + IN UINT8 *MctpDestinationEndpointId, IN BOOLEAN RequestDataIntegrityCheck, IN UINT8 *RequestData, IN UINT32 RequestDataSize, diff --git a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLi= b/Dxe/ManageabilityTransportMctp.c b/Features/ManageabilityPkg/Library/Mana= geabilityTransportMctpLib/Dxe/ManageabilityTransportMctp.c index c520e2302d..249104c873 100644 --- a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/M= anageabilityTransportMctp.c +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/M= anageabilityTransportMctp.c @@ -205,8 +205,8 @@ MctpTransportTransmitReceive ( Status =3D mMctpProtocol->Functions.Version1_0->MctpSubmitCommand ( mMctpProtocol, TransmitHeader->MessageH= eader.MessageType, - TransmitHeader->SourceEn= dpointId, - TransmitHeader->Destinat= ionEndpointId, + &TransmitHeader->SourceE= ndpointId, + &TransmitHeader->Destina= tionEndpointId, (BOOLEAN)TransmitHeader-= >MessageHeader.IntegrityCheck, TransferToken->TransmitP= ackage.TransmitPayload, TransferToken->TransmitP= ackage.TransmitSizeInByte, diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/Mc= tpProtocolCommon.c index 5844d54eb2..3128aadd15 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c @@ -175,8 +175,8 @@ SetupMctpRequestTransportPacket ( MctpTransportHeader =3D (MCTP_TRANSPORT_HE= ADER *)ThisPackage; MctpTransportHeader->Bits.Reserved =3D 0; MctpTransportHeader->Bits.HeaderVersion =3D MCTP_KCS_HEADER_VE= RSION; - MctpTransportHeader->Bits.DestinationEndpointId =3D PcdGet8 (PcdMctpDe= stinationEndpointId); - MctpTransportHeader->Bits.SourceEndpointIdId =3D PcdGet8 (PcdMctpSo= urceEndpointId); + MctpTransportHeader->Bits.DestinationEndpointId =3D MctpDestinationEnd= pointId; + MctpTransportHeader->Bits.SourceEndpointId =3D MctpSourceEndpoint= Id; MctpTransportHeader->Bits.MessageTag =3D MCTP_MESSAGE_TAG; MctpTransportHeader->Bits.TagOwner =3D MCTP_MESSAGE_TAG_O= WNER_REQUEST; MctpTransportHeader->Bits.PacketSequence =3D mMctpPacketSequenc= e & MCTP_PACKET_SEQUENCE_MASK; diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProto= col.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c index d0f49a1abb..73445bf816 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocol.c @@ -29,8 +29,12 @@ UINT32 mTransportMaximumPayload; =20 @param[in] This EDKII_MCTP_PROTOCOL instan= ce. @param[in] MctpType MCTP message type. - @param[in] MctpSourceEndpointId MCTP source endpoint ID. - @param[in] MctpDestinationEndpointId MCTP source endpoint ID. + @param[in] MctpSourceEndpointId Pointer of MCTP source end= point ID. + Set to NULL means use plat= form PCD value + (PcdMctpSourceEndpointId). + @param[in] MctpDestinationEndpointId Pointer of MCTP destinatio= n endpoint ID. + Set to NULL means use plat= form PCD value + (PcdMctpDestinationEndpoin= tId). @param[in] RequestDataIntegrityCheck Indicates whether MCTP mes= sage has integrity check byte. @param[in] RequestData Message Data. @@ -59,8 +63,8 @@ EFIAPI MctpSubmitMessage ( IN EDKII_MCTP_PROTOCOL *This, IN UINT8 MctpType, - IN UINT8 MctpSourceEndpointId, - IN UINT8 MctpDestinationEndpoin= tId, + IN UINT8 *MctpSourceEndpointId, + IN UINT8 *MctpDestinationEndpoi= ntId, IN BOOLEAN RequestDataIntegrityCh= eck, IN UINT8 *RequestData, IN UINT32 RequestDataSize, @@ -72,24 +76,42 @@ MctpSubmitMessage ( ) { EFI_STATUS Status; + UINT8 SourceEid; + UINT8 DestinationEid; =20 if ((RequestData =3D=3D NULL) && (ResponseData =3D=3D NULL)) { DEBUG ((DEBUG_ERROR, "%a: Both RequestData and ResponseData are NULL\n= ", __func__)); return EFI_INVALID_PARAMETER; } =20 + if (MctpSourceEndpointId =3D=3D NULL) { + SourceEid =3D PcdGet8 (PcdMctpSourceEndpointId); + DEBUG ((DEBUG_MANAGEABILITY, "%a: Use PcdMctpSourceEndpointId for MCTP= source EID: %x\n", __func__, SourceEid)); + } else { + SourceEid =3D *MctpSourceEndpointId; + DEBUG ((DEBUG_MANAGEABILITY, "%a: MCTP source EID: %x\n", __func__, So= urceEid)); + } + + if (MctpDestinationEndpointId =3D=3D NULL) { + DestinationEid =3D PcdGet8 (PcdMctpDestinationEndpointId); + DEBUG ((DEBUG_MANAGEABILITY, "%a: Use PcdMctpDestinationEndpointId for= MCTP destination EID: %x\n", __func__, DestinationEid)); + } else { + DestinationEid =3D *MctpDestinationEndpointId; + DEBUG ((DEBUG_MANAGEABILITY, "%a: MCTP destination EID: %x\n", __func_= _, DestinationEid)); + } + // // Check source EID and destination EID // - if ((MctpSourceEndpointId >=3D MCTP_RESERVED_ENDPOINT_START_ID) && - (MctpSourceEndpointId <=3D MCTP_RESERVED_ENDPOINT_END_ID) + if ((SourceEid >=3D MCTP_RESERVED_ENDPOINT_START_ID) && + (SourceEid <=3D MCTP_RESERVED_ENDPOINT_END_ID) ) { DEBUG ((DEBUG_ERROR, "%a: The value of MCTP source EID (%x) is reserve= d.\n", __func__, MctpSourceEndpointId)); return EFI_INVALID_PARAMETER; } =20 - if ((MctpDestinationEndpointId >=3D MCTP_RESERVED_ENDPOINT_START_ID) && - (MctpDestinationEndpointId <=3D MCTP_RESERVED_ENDPOINT_END_ID) + if ((DestinationEid >=3D MCTP_RESERVED_ENDPOINT_START_ID) && + (DestinationEid <=3D MCTP_RESERVED_ENDPOINT_END_ID) ) { DEBUG ((DEBUG_ERROR, "%a: The value of MCTP destination EID (%x) is re= served.\n", __func__, MctpDestinationEndpointId)); return EFI_INVALID_PARAMETER; @@ -98,8 +120,8 @@ MctpSubmitMessage ( Status =3D CommonMctpSubmitMessage ( mTransportToken, MctpType, - MctpSourceEndpointId, - MctpDestinationEndpointId, + SourceEid, + DestinationEid, RequestDataIntegrityCheck, RequestData, RequestDataSize, --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109856): https://edk2.groups.io/g/devel/message/109856 Mute This Topic: https://groups.io/mt/102080233/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109857+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109857+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806398; cv=none; d=zohomail.com; s=zohoarc; b=FRaHS0mOD3UssiJyHxSCbpgxyp2brS2Yl0y7xRya1Pnt69Owk6giPKal7narrFnGrl/XT2B6hgrWdIgM/5XXyk2y3ragBVsUQWbwhQaF9y2Xl9VxqeMqI+CZYpjgOi/kiQJASZEyXqOfgZ4rPie9ItRepmTCFKF4CyjYp1wraiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806398; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=uvRnZmXean0mOl32jJyKn+glS6U71w1PdyqUeKun5RA=; b=MNei1B7fvrEW5mNPBNZud5vyDbsGKWYQ6CeRnKEcNR5lhtXNn950wKL43VlcmMTzF4OuyZRncFGcRjclOku6Fs28Kw4+Xg/WTcAmRYemraCIuwM7XrplW4LlITa2rs0T4kAyqff+X5IzoPpRmbd5RwDUUjCuJjsgkoPGLLqcgHU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109857+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 169780639840656.68961238362772; Fri, 20 Oct 2023 05:53:18 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=6O29XSCeQLn5ZD0vVHyGZkSAw3M43poEJKofA0ff+dA=; 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=1697806398; v=1; b=jCBIiIV9c72uQGlVQAh4JM2Tn1/1ABFGHrmrL+VPOS/SD5DgYFk2eOn828uashFtpKaMPTkM Bs7UFBQguPqbRd+5b95nvqVGLjRVtX2AAE4v6gEgFE2N3nsJi2kyUnQBYIfL0mgOw176CHQsJBW yvJJ5xCML0njnb64XGlqwiAw= X-Received: by 127.0.0.2 with SMTP id RsyjYY1788612xfMvxyfZwKU; Fri, 20 Oct 2023 05:53:18 -0700 X-Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by mx.groups.io with SMTP id smtpd.web10.53382.1697806397222555695 for ; Fri, 20 Oct 2023 05:53:17 -0700 X-Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2b9d07a8d84so10793501fa.3 for ; Fri, 20 Oct 2023 05:53:16 -0700 (PDT) X-Gm-Message-State: 8QIXcjeS1t72QQMgxCRlRdUjx1787277AA= X-Google-Smtp-Source: AGHT+IF785Oa+ef1a3zGUQu2hVyfgfs++2XU6CPbkna1h77gHYa2Z3lhAvsB0baxiMuhVsXivfZCBg== X-Received: by 2002:a2e:a7c2:0:b0:2c5:72e:6ff9 with SMTP id x2-20020a2ea7c2000000b002c5072e6ff9mr1972894ljp.6.1697806395158; Fri, 20 Oct 2023 05:53:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:14 -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 07/15] ManageabilityPkg: Correct value for the MCTP TAG_OWNER response bit Date: Fri, 20 Oct 2023 15:52:54 +0300 Message-Id: <20231020125302.1459-8-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806400521100019 Content-Type: text/plain; charset="utf-8" Currently the MCTP TAG_OWNER bit is checked against 1 both in MTCP request and response. According to the MTCP Base specification in case of the MCTP response the TAG_OWNER bit should be equal to 0. Correct MCTP_MESSAGE_TAG_OWNER_RESPONSE flag value to fix the issue. Signed-off-by: Konstantin Aladyshev --- .../Include/Library/ManageabilityTransportMctpLib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Features/ManageabilityPkg/Include/Library/ManageabilityTranspo= rtMctpLib.h b/Features/ManageabilityPkg/Include/Library/ManageabilityTransp= ortMctpLib.h index 462e7436e6..a8dc8a8519 100644 --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpL= ib.h +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportMctpL= ib.h @@ -51,8 +51,8 @@ typedef struct { // is not defined by the specification. #define MCTP_MESSAGE_TAG 0x1 =20 -#define MCTP_MESSAGE_TAG_OWNER_REQUEST 0x01 -#define MCTP_MESSAGE_TAG_OWNER_RESPONSE 0x01 +#define MCTP_MESSAGE_TAG_OWNER_REQUEST 1 +#define MCTP_MESSAGE_TAG_OWNER_RESPONSE 0 =20 #define MCTP_PACKET_SEQUENCE_MASK 0x3 =20 --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109857): https://edk2.groups.io/g/devel/message/109857 Mute This Topic: https://groups.io/mt/102080235/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109858+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109858+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806399; cv=none; d=zohomail.com; s=zohoarc; b=X2MWf8c2AOe9Te9MFU/BSwtz3Ak+TpO0/mPVwGX/8A+IrolpAFKyefoQZIY9qoftWyWhMgbrYn1CZd/vxoSxlbl0E0RLk2QvY4MjfYwAl3WjyXRE5G7NEEhMAKrkREibcgLhKCquQAKViLI5Db4rOonlZV4w4P7qxpr9hA9M8Kg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806399; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=HasTvpt5Q5Q4L+lm22lsTQv+DhreLefgMXuhU0s95fc=; b=Y7e9aBPhm6VAAyIY8Z/W7ujzXd8uEL3oLW7SH6i5mZggSjv7Cg2tEcwif2vKpEbgRaNDE9AtBswVV4CON37J+Wbx0BXiw8vT/LA9CRk1hO2ncyKYttcz+oAH59L+SRtggf9p13z6lydIImq1XeMs1nTDbdp8xldKSJw3TuFQSgY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109858+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806399503451.2084419044553; Fri, 20 Oct 2023 05:53:19 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=p+Q+uA3/tVQhIMSBCW6NUO9W5rBeeQ4cQvyqTpZN2T4=; 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=1697806399; v=1; b=w3cIj1H396/KCz+zBIm7Nr/tOOM8Mcp+o6aDuXBeqPr5xb90LNKZoyr8tg9hn4JaGGu8zESF lg8W+6hDfXqh8446WcPn7xuv/6x1W+n/4kxMsrxSdWFdsiiFcUpmEFH65tiNiHA/oFcoruNpT68 CrdX1WfNxZm9PA/w02rG2osM= X-Received: by 127.0.0.2 with SMTP id B95VYY1788612xvnGX79rHLc; Fri, 20 Oct 2023 05:53:19 -0700 X-Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by mx.groups.io with SMTP id smtpd.web11.53590.1697806398338745651 for ; Fri, 20 Oct 2023 05:53:18 -0700 X-Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2c5056059e0so11684341fa.3 for ; Fri, 20 Oct 2023 05:53:18 -0700 (PDT) X-Gm-Message-State: X1Mx028zSiz3X3vl08q2dA2Cx1787277AA= X-Google-Smtp-Source: AGHT+IFgcylOpZjX+Ts68PSG/x+VDVLUhrOGwBrKjpXNi3tx27/EKUn7o13sP61BxNIt4dqEBVnXBw== X-Received: by 2002:a2e:b04b:0:b0:2c5:1b01:b67f with SMTP id d11-20020a2eb04b000000b002c51b01b67fmr1307951ljl.52.1697806396114; Fri, 20 Oct 2023 05:53:16 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:15 -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 08/15] ManageabilityPkg: Don't check MCTP header fields if transfer has failed Date: Fri, 20 Oct 2023 15:52:55 +0300 Message-Id: <20231020125302.1459-9-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806400550100020 Content-Type: text/plain; charset="utf-8" If MCTP KCS communication has failed we need to abort MCTP transfer function before checking any MCTP header data. Signed-off-by: Konstantin Aladyshev --- .../MctpProtocol/Common/MctpProtocolCommon.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/Mc= tpProtocolCommon.c index 3128aadd15..4aae4fcba9 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c @@ -461,6 +461,13 @@ CommonMctpSubmitMessage ( &TransferToken ); =20 + *AdditionalTransferError =3D TransferToken.TransportAdditionalStatus; + Status =3D TransferToken.TransferStatus; + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to send MCTP command over %s: %r\n", = __func__, mTransportName, Status)); + return Status; + } + MctpTransportResponseHeader =3D (MCTP_TRANSPORT_HEADER *)ResponseBuffer; if (MctpTransportResponseHeader->Bits.HeaderVersion !=3D MCTP_KCS_HEADER= _VERSION) { DEBUG (( @@ -543,18 +550,9 @@ CommonMctpSubmitMessage ( return EFI_DEVICE_ERROR; } =20 - // - // Return transfer status. - // - *AdditionalTransferError =3D TransferToken.TransportAdditionalStatus; *ResponseDataSize =3D TransferToken.ReceivePackage.ReceiveSizeInB= yte - sizeof (MCTP_TRANSPORT_HEADER) - sizeof (MCTP_MESSAGE_HEADER); CopyMem (ResponseData, ResponseBuffer + sizeof (MCTP_TRANSPORT_HEADER) += sizeof (MCTP_MESSAGE_HEADER), *ResponseDataSize); FreePool (ResponseBuffer); - Status =3D TransferToken.TransferStatus; - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Failed to send MCTP command over %s: %r\n", = __func__, mTransportName, Status)); - return Status; - } =20 return Status; } --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109858): https://edk2.groups.io/g/devel/message/109858 Mute This Topic: https://groups.io/mt/102080236/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109859+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109859+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806401; cv=none; d=zohomail.com; s=zohoarc; b=bSTaPyk9bwDTAgIC/lGzwRxuIRNhZSZ0jSygP+hId8iqCJPCJIEUb/6pOQFsgU6BCcbMkQdI+oOsTCASOUs9VhlS2YWW453rQiGARNh9pBUg9IBiPjBr7sSOg5RElpCUaMn4Z4lmOypo5dKhNNpfSIVUNO6NrL8/nU1NZr+uE5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806401; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=gyKBnuFPJdaOeNEDZ0wqKVYG3OfiZoVTTvA62tIYgfk=; b=KK28rM/GHZClU9FbXeJ+R6nSM1Pt1/sS5qDDPt2CJsHRhcSdVtZGg5OG0fAJzKjmV6i0lLtOI3KlECuR7eLKtwXqdDQwEWtrp3Yd31Cj2w6bYae9kJKbqn8i4o1OHrGSWyv9VcdpiCBLg2nlJexbP0sr4cNoI7samTVnBYBe4d0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109859+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 169780640105131.95795873890745; Fri, 20 Oct 2023 05:53:21 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=1JyO1G64TCigpb1rPmmFicyImDT+GBxshQDFF1zQNPU=; 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=1697806400; v=1; b=bLuwj+6irYL1H6YmCvgUMTIgQL40oA2c+UK6fryFsHdCk9UbQ+jHzbHTY8/OINRLD3ukGQ7B uQOWVeaHKvihpQChtoTg6MQG5Ez1JiJAqidPndjRAjRKhWk82xMLYK/RPDCsFQsPUt3ZLSHzPx9 gINmaOb7aROBPrcKSO6zXq6w= X-Received: by 127.0.0.2 with SMTP id ihdBYY1788612xjVCSODS94Y; Fri, 20 Oct 2023 05:53:20 -0700 X-Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mx.groups.io with SMTP id smtpd.web10.53387.1697806399854594534 for ; Fri, 20 Oct 2023 05:53:20 -0700 X-Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2c501bd6ff1so11037011fa.3 for ; Fri, 20 Oct 2023 05:53:19 -0700 (PDT) X-Gm-Message-State: 5hwti7oHewBdOzW0TM7REpnQx1787277AA= X-Google-Smtp-Source: AGHT+IFeuOQzBiw68p7OuC2l4dkauxbW3EEXAvW21hnP0SD6L/5IrIj9ONGQeSNM69YFDI3INxayTg== X-Received: by 2002:a05:651c:504:b0:2c5:72e:6ff7 with SMTP id o4-20020a05651c050400b002c5072e6ff7mr1384741ljp.24.1697806397743; Fri, 20 Oct 2023 05:53:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:16 -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 09/15] ManageabilityPkg: Use correct constants for PLDM header checks Date: Fri, 20 Oct 2023 15:52:56 +0300 Message-Id: <20231020125302.1459-10-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806402535100025 Content-Type: text/plain; charset="utf-8" Currently PldmProtocol code uses magic numbers in the PLDM header checks. Since PLDM headers have all the necessary definitions replace magic numbers with the appropriate defines. Signed-off-by: Konstantin Aladyshev --- .../Universal/PldmProtocol/Common/PldmProtocolCommon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/Pl= dmProtocolCommon.c index 1c4506d87f..4edfe05955 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c @@ -321,15 +321,15 @@ CommonPldmSubmitCommand ( // // Check the integrity of response. data. ResponseHeader =3D (PLDM_RESPONSE_HEADER *)FullPacketResponseData; - if ((ResponseHeader->PldmHeader.DatagramBit !=3D 0) || - (ResponseHeader->PldmHeader.RequestBit !=3D 0) || + if ((ResponseHeader->PldmHeader.DatagramBit !=3D (!PLDM_MESSAGE_HEADER_I= S_DATAGRAM)) || + (ResponseHeader->PldmHeader.RequestBit !=3D PLDM_MESSAGE_HEADER_IS_R= ESPONSE) || (ResponseHeader->PldmHeader.InstanceId !=3D mPldmRequestInstanceId) = || (ResponseHeader->PldmHeader.PldmType !=3D PldmType) || (ResponseHeader->PldmHeader.PldmTypeCommandCode !=3D PldmCommand)) { DEBUG ((DEBUG_ERROR, "PLDM integrity check of response data is failed.= \n")); - DEBUG ((DEBUG_ERROR, " Request bit =3D %d (Expected value: 0)\n")); - DEBUG ((DEBUG_ERROR, " Datagram =3D %d (Expected value: 0)\n")); + DEBUG ((DEBUG_ERROR, " Datagram =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.DatagramBit, (!PLDM_MESSAGE_HEADER_IS_DATAGRAM)= )); + DEBUG ((DEBUG_ERROR, " Request bit =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.RequestBit, PLDM_MESSAGE_HEADER_IS_RESPONSE)); DEBUG ((DEBUG_ERROR, " Instance ID =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.InstanceId, mPldmRequestInstanceId)); DEBUG ((DEBUG_ERROR, " Pldm Type =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.PldmType, PldmType)); DEBUG ((DEBUG_ERROR, " Pldm Command =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.PldmTypeCommandCode, PldmCommand)); --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109859): https://edk2.groups.io/g/devel/message/109859 Mute This Topic: https://groups.io/mt/102080238/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109860+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109860+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806405; cv=none; d=zohomail.com; s=zohoarc; b=cZDAF+nLgBcM+lwa8+cX4nQfkxvAa7TI1LoGhKhKBSQxj3GpT74GgClKEJo+whp4Nr0dEN23H7vbqE0F/UyDkg4FvHLTVr+mLb1jiKDHUNnn2uI69XHXQ48F9hqxvmFG8fN8XyHE3cS/mca+nqOufcruqAIsK+wQFhwB1KEqpLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806405; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=Kj1kzmSmnNC4NWxY9Yks1Ea0weOGCSJYW74wia9zJlY=; b=BiUqal5M1o/vNz1cHzfxcJC5qdd69Y23VSP+1U+B61rdko0+iBzzLhkUSHNWIF5qlBdjpkZRECQb5qztnaJV6tctQ2n/TD2QXD/FYZoHb7wKVjUfPXeB4HbxPHj6P+htIm9fNhBmvC91EsoW6k42QwpNqgDq/JdSFMmDa2OfiAs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109860+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806405871544.8250691320633; Fri, 20 Oct 2023 05:53:25 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=NQKu5eUWZnLl/LOdgzzATobRXYpcIfEmNk/kuqAraq8=; 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=1697806401; v=1; b=L4IVqnHIlrS/6WLHoxO/G6XOmmYoLpxpmKG+SgGgo+QCTKhlkSLXsV+QN8B5uAG0/kPzYijj aDAcmGWd80sYG944Izmi/ZuqZo8hJcBf0QfH79641bP6qvzhp94rVj5xz0uNVM4RD5tXA921bPV VAJhMcOqYjrtzOvvvr/n6IhI= X-Received: by 127.0.0.2 with SMTP id L9OUYY1788612xKjqtJ1Wep5; Fri, 20 Oct 2023 05:53:21 -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.53388.1697806400715499693 for ; Fri, 20 Oct 2023 05:53:21 -0700 X-Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2c5210a1515so12600531fa.0 for ; Fri, 20 Oct 2023 05:53:20 -0700 (PDT) X-Gm-Message-State: nZdFecHpR9zAXw4mU94hCINCx1787277AA= X-Google-Smtp-Source: AGHT+IEyjg9TuOoBbZL7VPu/bx2mtzfgGEc7Q681O+14Zh5hRq2atnl2N3ON8/HU3uMGy/GdJZcA5A== X-Received: by 2002:a2e:b78f:0:b0:2c5:2813:5534 with SMTP id n15-20020a2eb78f000000b002c528135534mr1490221ljo.51.1697806398640; Fri, 20 Oct 2023 05:53:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:18 -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 10/15] ManageabilityPkg: Return error on multiple-packet MCTP responses Date: Fri, 20 Oct 2023 15:52:57 +0300 Message-Id: <20231020125302.1459-11-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806406536100031 Content-Type: text/plain; charset="utf-8" Since the current driver doesn't yet support handling of multiple-packet MCTP responses, return EFI_UNSUPPORTED error in such cases. Signed-off-by: Konstantin Aladyshev --- .../MctpProtocol/Common/MctpProtocolCommon.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/Mc= tpProtocolCommon.c index 4aae4fcba9..3709ab16eb 100644 --- a/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/MctpProtocol/Common/MctpProtocolC= ommon.c @@ -524,6 +524,17 @@ CommonMctpSubmitMessage ( FreePool (ResponseBuffer); return EFI_DEVICE_ERROR; } + if ((MctpTransportResponseHeader->Bits.StartOfMessage !=3D 1) || + (MctpTransportResponseHeader->Bits.EndOfMessage !=3D 1) || + (MctpTransportResponseHeader->Bits.PacketSequence !=3D 0)) { + DEBUG (( + DEBUG_ERROR, + "%a: Error! Multiple-packet MCTP responses are not supported by the = current driver\n", + __func__ + )); + FreePool (ResponseBuffer); + return EFI_UNSUPPORTED; + } =20 MctpMessageResponseHeader =3D (MCTP_MESSAGE_HEADER *)(MctpTransportRespo= nseHeader + 1); if (MctpMessageResponseHeader->Bits.MessageType !=3D MctpType) { --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109860): https://edk2.groups.io/g/devel/message/109860 Mute This Topic: https://groups.io/mt/102080239/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109861+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109861+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806403; cv=none; d=zohomail.com; s=zohoarc; b=AGiWxtHy8lCgas6dscu79+uLvgPoiJKLgrWzqIlAxPNx9Q8MdFV7tRo1StnRsh4ikKFDCwek9IfxmWZAq4aAgNGv6sAXhWSXh0i7UtFYk4QhqB9cSbP6A+qbvJ1LNRjWn5tBRxNkLTN9pTwvPwHDUOX/tC88YU+7HTwJKNjxjbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806403; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=JyUuYznTptjXujPuxuDy4yxwQCAexc93Ysw+BbE1NUI=; b=LikEIhfGWYmXwRpDTxSJMdDnQF6deBO9W0Xg6MGjHdexJlNku7jHqaWRzep/2Uj+JvX4LY51c+GJI9ex8SIpOt0qTF1WOF9AcpLHIZx8Kuo2qrAfXYDR7UhEADL3+HtZjxwDdHZ8K8901Zf2TgJUzpl1Ya6JCh0uvYLa4UYCbUE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109861+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806403130440.3069664554189; Fri, 20 Oct 2023 05:53:23 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=p5Ub7cfNY76wmqXlppfB0TcAfcxAoZ9oqtv9S/+UvqE=; 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=1697806402; v=1; b=Iyglc1H1OLkXpCGtAqwQwU6c5zj/ftxvPzhUSc0QNNeEvcL0ejcfDH5YXjpQcJlXR+UBM582 72rOd5EiT4YTLuNR4wHtnfPLe+alLa4LNx4j++NJv5Jtz6E8sCZRUHpJZgDDyw1//MCEpaAU9dx c9ahLJnTH0A8v6RiqspJ1/cQ= X-Received: by 127.0.0.2 with SMTP id HFRYYY1788612xiGGuQhzxXm; Fri, 20 Oct 2023 05:53:22 -0700 X-Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) by mx.groups.io with SMTP id smtpd.web10.53392.1697806401915830116 for ; Fri, 20 Oct 2023 05:53:22 -0700 X-Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2c50305c5c4so11846691fa.1 for ; Fri, 20 Oct 2023 05:53:21 -0700 (PDT) X-Gm-Message-State: ox7TdJKDJawKC0rRRaexqZBsx1787277AA= X-Google-Smtp-Source: AGHT+IE/MOPqVvXIJjV+El/GvHiH94S6Y+P0PFN+ZAJadFnnxNX5N6dDEwVcIQd6Ap28O7rKRVxGsQ== X-Received: by 2002:a05:651c:1409:b0:2c5:1d11:5688 with SMTP id u9-20020a05651c140900b002c51d115688mr1286975lje.14.1697806399871; Fri, 20 Oct 2023 05:53:19 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:19 -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 11/15] ManageabilityPkg: Add PLDM terminus PCDs Date: Fri, 20 Oct 2023 15:52:58 +0300 Message-Id: <20231020125302.1459-12-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806404539100029 Content-Type: text/plain; charset="utf-8" From: Abner Chang Add PLDM source and destination terminus IDs for transmiting PLDM message. Signed-off-by: Abner Chang Signed-off-by: Konstantin Aladyshev --- Features/ManageabilityPkg/ManageabilityPkg.dec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/Mana= geabilityPkg/ManageabilityPkg.dec index 14fe0fd2e0..eb0ee67cba 100644 --- a/Features/ManageabilityPkg/ManageabilityPkg.dec +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec @@ -72,6 +72,12 @@ # @Prompt MCTP KCS (Memory mapped) I/O base address gManageabilityPkgTokenSpaceGuid.PcdMctpKcsBaseAddress|0xca2|UINT32|0x000= 00004 =20 + ## This value is the PLDM source and destination terminus ID for transmi= ting PLDM message. + # @Prompt PLDM source terminus ID + gManageabilityPkgTokenSpaceGuid.PcdPldmSourceTerminusId|0|UINT8|0x000000= 40 + # @Prompt PLDM destination terminus ID + gManageabilityPkgTokenSpaceGuid.PcdPldmDestinationEndpointId|0|UINT8|0x0= 0000041 + ## This is the value of SOL channels supported on platform. # @Prompt SOL channel number gManageabilityPkgTokenSpaceGuid.PcdMaxSolChannels|3|UINT8|0x00000100 --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109861): https://edk2.groups.io/g/devel/message/109861 Mute This Topic: https://groups.io/mt/102080241/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109862+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109862+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806406; cv=none; d=zohomail.com; s=zohoarc; b=Vf5ai/wKjyt7cinBan2s5o+jYkq+/y6tspUprAWFckb0L31xprtqVhe1Xe8l7CxWoEo+1X9Lrs/HQgrY9spphA5sP4LqIEcv1G2sH4totwmnByBRSlMv0h2SJXLFNbCspnQ9Dhrc0d9BRkAw878acSLtMmmZK+Xt2fpLaiKgPCY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806406; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=UpvdC9c+OuswBHS/XxBusiIakqaDPeyainItmXfEh/o=; b=b1p1krXCq2B5rl0/Ll4yskYMublujpICtdy1WKaouOtIslp4+gEHqG6XaqLLLwL+gRhqaDTxlQSrv25V2MZF6JMa/dObhTEsrHMsSQkGY0NbIO9npXzp95yvvi0+czfN7jVQydbSq+UPiiiHYVJZ4IGioC4YjcxYd46LDW6ym8E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109862+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806406902975.8215164068794; Fri, 20 Oct 2023 05:53:26 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=1RP6Sm8tbmbfiwVqACATLL/a8QX/zpiHksaxptDS6sg=; 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=1697806406; v=1; b=ifPzMh/Wou8/6upnJM3W3ydMtdWOWsRhaf/YUPvysgPRlIj2djdS7IRH2GokYzZTXUvt5Y46 k/DcNtYjYIgkJr/Z1sYa10PITI5j0TG4uHOENQHyeYYlA1NyCftuyF6KTcQX8TIIHXEAgkZ+fyZ Fkyw1cG07oS1yjv8WlWlfr0Y= X-Received: by 127.0.0.2 with SMTP id CsMsYY1788612xsbyzws52Ny; Fri, 20 Oct 2023 05:53:26 -0700 X-Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by mx.groups.io with SMTP id smtpd.web10.53394.1697806403459899925 for ; Fri, 20 Oct 2023 05:53:23 -0700 X-Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2c523ac38fbso11428991fa.0 for ; Fri, 20 Oct 2023 05:53:23 -0700 (PDT) X-Gm-Message-State: GaYUtYEKo2cRhyI1QHcIPSYux1787277AA= X-Google-Smtp-Source: AGHT+IFuo2Mc5kN0we8JuYfblcp3vmD2xJU7N5plFwbMldBKm1bVbrm5xuejPXBsAZN8p2PZgTtPkw== X-Received: by 2002:a2e:7d04:0:b0:2c0:d06:9e65 with SMTP id y4-20020a2e7d04000000b002c00d069e65mr1302995ljc.8.1697806401196; Fri, 20 Oct 2023 05:53:21 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:20 -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 12/15] PldmProtocolDxe: Correct TID argument usage Date: Fri, 20 Oct 2023 15:52:59 +0300 Message-Id: <20231020125302.1459-13-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806408628100035 Content-Type: text/plain; charset="utf-8" From: Abner Chang Currently the PLDM source/destination TID arguments for the PldmSubmit function are not actually used in any way in the underlying MCTP communication. The code just uses MCTP source/destination EID PCDs. So we have to restructure code to actually use provided PLDM TIDs. On the other case the PldmSubmitCommand function from the PldmProtocolLib doesn't even accept the source/destination TID arguments. To address both these facts correct TID argument usage in the following way: - by default the TID values are taken from the built-time PCDs, - user have an ability to provide custom TIDs either via PldmSubmit function arguments or by calling PldmSetTerminus API. Signed-off-by: Abner Chang Signed-off-by: Konstantin Aladyshev --- .../Include/Library/BasePldmProtocolLib.h | 16 ++++++ .../Include/Protocol/PldmProtocol.h | 18 +++--- .../PldmProtocolLibrary/Dxe/PldmProtocolLib.c | 49 +++++++++++++++- .../Dxe/PldmProtocolLib.inf | 6 +- .../PldmProtocol/Common/PldmProtocolCommon.c | 28 +++++++--- .../PldmProtocol/Common/PldmProtocolCommon.h | 22 +++++--- .../Universal/PldmProtocol/Dxe/PldmProtocol.c | 56 ++++++++++++++++--- .../PldmProtocol/Dxe/PldmProtocolDxe.inf | 4 -- 8 files changed, 162 insertions(+), 37 deletions(-) diff --git a/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.= h b/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h index 5523ac3a4d..a698197263 100644 --- a/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h +++ b/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h @@ -9,6 +9,22 @@ #ifndef EDKII_PLDM_PROTOCOL_LIB_H_ #define EDKII_PLDM_PROTOCOL_LIB_H_ =20 +/** + This function sets the PLDM source termius and destination terminus + ID for SMBIOS PLDM transfer. + + @param[in] SourceId PLDM source teminus ID. + @param[in] DestinationId PLDM destination teminus ID. + + @retval EFI_SUCCESS The terminus is set successfully. + @retval EFI_INVALID_PARAMETER The terminus is set unsuccessfully. +**/ +EFI_STATUS +PldmSetTerminus ( + IN UINT8 SourceId, + IN UINT8 DestinationId +); + /** This service enables submitting commands via EDKII PLDM protocol. =20 diff --git a/Features/ManageabilityPkg/Include/Protocol/PldmProtocol.h b/Fe= atures/ManageabilityPkg/Include/Protocol/PldmProtocol.h index 651997e1ad..02efb3015a 100644 --- a/Features/ManageabilityPkg/Include/Protocol/PldmProtocol.h +++ b/Features/ManageabilityPkg/Include/Protocol/PldmProtocol.h @@ -26,13 +26,15 @@ typedef struct _EDKII_PLDM_PROTOCOL EDKII_PLDM_PROTOCO= L; /** This service enables submitting commands via EDKII PLDM protocol. =20 - @param[in] This EDKII_PLDM_PROTOCOL instance. - @param[in] PldmType PLDM message type. - @param[in] Command PLDM Command of PLDM message type. - @param[in] RequestData Command Request Data. - @param[in] RequestDataSize Size of Command Request Data. - @param[out] ResponseData Command Response Data. The completi= on code is the first byte of response data. - @param[in, out] ResponseDataSize Size of Command Response Data. + @param[in] This EDKII_PLDM_PROTOCOL instan= ce. + @param[in] PldmType PLDM message type. + @param[in] Command PLDM Command of PLDM messa= ge type. + @param[in] PldmTerminusSourceId PLDM source teminus ID. + @param[in] PldmTerminusDestinationId PLDM destination teminus I= D. + @param[in] RequestData Command Request Data. + @param[in] RequestDataSize Size of Command Request Da= ta. + @param[out] ResponseData Command Response Data. The= completion code is the first byte of response data. + @param[in, out] ResponseDataSize Size of Command Response D= ata. =20 @retval EFI_SUCCESS The command byte stream was successfully = submit to the device and a response was successfully received. @retval EFI_NOT_FOUND The command was not successfully sent to = the device or a response was not successfully received from the device. @@ -49,6 +51,8 @@ EFI_STATUS IN EDKII_PLDM_PROTOCOL *This, IN UINT8 PldmType, IN UINT8 Command, + IN UINT8 PldmTerminusSourceId, + IN UINT8 PldmTerminusDestinationId, IN UINT8 *RequestData, IN UINT32 RequestDataSize, OUT UINT8 *ResponseData, diff --git a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/Pldm= ProtocolLib.c b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/P= ldmProtocolLib.c index 267bd8fbc1..37231b0756 100644 --- a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtoco= lLib.c +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtoco= lLib.c @@ -9,10 +9,34 @@ #include #include #include +#include #include #include =20 -EDKII_PLDM_PROTOCOL *mEdkiiPldmProtocol =3D NULL; +EDKII_PLDM_PROTOCOL *mEdkiiPldmProtocol =3D NULL; +UINT8 mSourcePldmTerminusId =3D 0; +UINT8 mDestinationPldmTerminusId =3D 0; + +/** + This function sets the PLDM source termius and destination terminus + ID for SMBIOS PLDM transfer. + + @param[in] SourceId PLDM source teminus ID. + @param[in] DestinationId PLDM destination teminus ID. + + @retval EFI_SUCCESS The terminus is set successfully. + @retval EFI_INVALID_PARAMETER The terminus is set unsuccessfully. +**/ +EFI_STATUS +PldmSetTerminus ( + IN UINT8 SourceId, + IN UINT8 DestinationId +) +{ + mSourcePldmTerminusId =3D SourceId; + mDestinationPldmTerminusId =3D DestinationId; + return EFI_SUCCESS; +} =20 /** This service enables submitting commands via EDKII PLDM protocol. @@ -69,6 +93,8 @@ PldmSubmitCommand ( mEdkiiPldmProtocol, PldmType, Command, + mSourcePldmTerminus= Id, + mDestinationPldmTer= minusId, RequestData, RequestDataSize, ResponseData, @@ -85,3 +111,24 @@ PldmSubmitCommand ( =20 return Status; } +/** + + Initialize mSourcePldmTerminusId and mDestinationPldmTerminusId. + + @param ImageHandle The image handle. + @param SystemTable The system table. + + @retval EFI_SUCCESS Protocol listener is registered successfully. + +**/ +EFI_STATUS +EFIAPI +PldmProtocolLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + + PldmSetTerminus (PcdGet8(PcdPldmSourceTerminusId), PcdGet8(PcdPldmDestin= ationEndpointId)); + return EFI_SUCCESS; +} diff --git a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/Pldm= ProtocolLib.inf b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe= /PldmProtocolLib.inf index 1233d76726..19c84840b6 100644 --- a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtoco= lLib.inf +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtoco= lLib.inf @@ -16,7 +16,7 @@ MODULE_TYPE =3D DXE_DRIVER VERSION_STRING =3D 1.0 LIBRARY_CLASS =3D PldmProtocolLib|DXE_RUNTIME_DRIVER DX= E_DRIVER DXE_CORE UEFI_DRIVER UEFI_APPLICATION - + CONSTRUCTOR =3D PldmProtocolLibConstructor # # VALID_ARCHITECTURES =3D IA32 X64 # @@ -40,3 +40,7 @@ [Protocols] gEdkiiPldmProtocolGuid ## ALWAYS_CONSUMES =20 +[FixedPcd] + gManageabilityPkgTokenSpaceGuid.PcdPldmSourceTerminusId + gManageabilityPkgTokenSpaceGuid.PcdPldmDestinationEndpointId + diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/Pl= dmProtocolCommon.c index 4edfe05955..ea3d4a22b2 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c @@ -64,6 +64,8 @@ GetFullPacketResponseSize ( @param[in] TransportToken The transport interface. @param[in] PldmType PLDM message type. @param[in] PldmCommand PLDM command of this PLDM type. + @param[in] SourceId PLDM source teminus ID. + @param[in] DestinationId PLDM destination teminus ID. @param[out] PacketHeader The pointer to receive header of r= equest. @param[out] PacketHeaderSize Packet header size in bytes. @param[in, out] PacketBody The request body. @@ -88,6 +90,8 @@ SetupPldmRequestTransportPacket ( IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, IN UINT8 PldmType, IN UINT8 PldmCommand, + IN UINT8 SourceId, + IN UINT8 DestinationId, OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader, OUT UINT16 *PacketHeaderSize, IN OUT UINT8 **PacketBody, @@ -118,8 +122,8 @@ SetupPldmRequestTransportPacket ( return EFI_OUT_OF_RESOURCES; } =20 - MctpHeader->SourceEndpointId =3D PcdGet8 (PcdMctpSourceEnd= pointId); - MctpHeader->DestinationEndpointId =3D PcdGet8 (PcdMctpDestinati= onEndpointId); + MctpHeader->SourceEndpointId =3D SourceId; + MctpHeader->DestinationEndpointId =3D DestinationId; MctpHeader->MessageHeader.IntegrityCheck =3D FALSE; MctpHeader->MessageHeader.MessageType =3D MCTP_MESSAGE_TYPE_PLDM; *PacketHeader =3D (MANAGEABILITY_TRANSPORT_= HEADER *)MctpHeader; @@ -161,13 +165,15 @@ SetupPldmRequestTransportPacket ( /** Common code to submit PLDM commands =20 - @param[in] TransportToken Transport token. - @param[in] PldmType PLDM message type. - @param[in] PldmCommand PLDM command of this PLDM type. - @param[in] RequestData Command Request Data. - @param[in] RequestDataSize Size of Command Request Data. - @param[out] ResponseData Command Response Data. The completi= on code is the first byte of response data. - @param[in, out] ResponseDataSize Size of Command Response Data. + @param[in] TransportToken Transport token. + @param[in] PldmType PLDM message type. + @param[in] PldmCommand PLDM command of this PLDM = type. + @param[in] PldmTerminusSourceId PLDM source teminus ID. + @param[in] PldmTerminusDestinationId PLDM destination teminus I= D. + @param[in] RequestData Command Request Data. + @param[in] RequestDataSize Size of Command Request Da= ta. + @param[out] ResponseData Command Response Data. The= completion code is the first byte of response data. + @param[in, out] ResponseDataSize Size of Command Response D= ata. =20 @retval EFI_SUCCESS The command byte stream was successfully = submit to the device and a response was successfully received. @retval EFI_NOT_FOUND The command was not successfully sent to = the device or a response was not successfully received from the device. @@ -182,6 +188,8 @@ CommonPldmSubmitCommand ( IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, IN UINT8 PldmType, IN UINT8 PldmCommand, + IN UINT8 PldmTerminusSourceId, + IN UINT8 PldmTerminusDestinationId, IN UINT8 *RequestData OPTIONAL, IN UINT32 RequestDataSize, OUT UINT8 *ResponseData OPTIONAL, @@ -225,6 +233,8 @@ CommonPldmSubmitCommand ( TransportToken, PldmType, PldmCommand, + PldmTerminusSourceId, + PldmTerminusDestinationId, &PldmTransportHeader, &HeaderSize, &ThisRequestData, diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmPr= otocolCommon.h b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/Pl= dmProtocolCommon.h index 231d6e802e..79431dd3b1 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.h +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.h @@ -44,6 +44,8 @@ SetupPldmTransportHardwareInformation ( @param[in] TransportToken The transport interface. @param[in] PldmType PLDM message type. @param[in] PldmCommand PLDM command of this PLDM type. + @param[in] SourceId PLDM source teminus ID. + @param[in] DestinationId PLDM destination teminus ID. @param[out] PacketHeader The pointer to receive header of r= equest. @param[out] PacketHeaderSize Packet header size in bytes. @param[in, out] PacketBody The request body. @@ -68,6 +70,8 @@ SetupPldmRequestTransportPacket ( IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, IN UINT8 PldmType, IN UINT8 PldmCommand, + IN UINT8 SourceId, + IN UINT8 DestinationId, OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader, OUT UINT16 *PacketHeaderSize, IN OUT UINT8 **PacketBody, @@ -79,13 +83,15 @@ SetupPldmRequestTransportPacket ( /** Common code to submit PLDM commands =20 - @param[in] TransportToken Transport token. - @param[in] PldmType PLDM message type. - @param[in] PldmCommand PLDM command of this PLDM type. - @param[in] RequestData Command Request Data. - @param[in] RequestDataSize Size of Command Request Data. - @param[out] ResponseData Command Response Data. The completi= on code is the first byte of response data. - @param[in, out] ResponseDataSize Size of Command Response Data. + @param[in] TransportToken Transport token. + @param[in] PldmType PLDM message type. + @param[in] PldmCommand PLDM command of this PLDM = type. + @param[in] PldmTerminusSourceId PLDM source teminus ID. + @param[in] PldmTerminusDestinationId PLDM destination teminus I= D. + @param[in] RequestData Command Request Data. + @param[in] RequestDataSize Size of Command Request Da= ta. + @param[out] ResponseData Command Response Data. The= completion code is the first byte of response data. + @param[in, out] ResponseDataSize Size of Command Response D= ata. =20 @retval EFI_SUCCESS The command byte stream was successfully = submit to the device and a response was successfully received. @retval EFI_NOT_FOUND The command was not successfully sent to = the device or a response was not successfully received from the device. @@ -100,6 +106,8 @@ CommonPldmSubmitCommand ( IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, IN UINT8 PldmType, IN UINT8 PldmCommand, + IN UINT8 PldmTerminusSourceId, + IN UINT8 PldmTerminusDestinationId, IN UINT8 *RequestData OPTIONAL, IN UINT32 RequestDataSize, OUT UINT8 *ResponseData OPTIONAL, diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProto= col.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c index b2ca69b05f..726747416c 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c @@ -25,13 +25,15 @@ UINT32 TransportMaximumPayload; /** This service enables submitting commands via EDKII PLDM protocol. =20 - @param[in] This EDKII_PLDM_PROTOCOL instance. - @param[in] PldmType PLDM message type. - @param[in] Command PLDM Command of PLDM message type. - @param[in] RequestData Command Request Data. - @param[in] RequestDataSize Size of Command Request Data. - @param[out] ResponseData Command Response Data. The completi= on code is the first byte of response data. - @param[in, out] ResponseDataSize Size of Command Response Data. + @param[in] This EDKII_PLDM_PROTOCOL instan= ce. + @param[in] PldmType PLDM message type. + @param[in] Command PLDM Command of PLDM messa= ge type. + @param[in] PldmTerminusSourceId PLDM source teminus ID. + @param[in] PldmTerminusDestinationId PLDM destination teminus I= D. + @param[in] RequestData Command Request Data. + @param[in] RequestDataSize Size of Command Request Da= ta. + @param[out] ResponseData Command Response Data. The= completion code is the first byte of response data. + @param[in, out] ResponseDataSize Size of Command Response D= ata. =20 @retval EFI_SUCCESS The command byte stream was successfully = submit to the device and a response was successfully received. @retval EFI_NOT_FOUND The command was not successfully sent to = the device or a response was not successfully received from the device. @@ -39,7 +41,7 @@ UINT32 TransportMaximumPayload; @retval EFI_DEVICE_ERROR PLDM transport interface Device hardware = error. @retval EFI_TIMEOUT The command time out. @retval EFI_UNSUPPORTED The command was not successfully sent to = the device. - @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resourc= e or data size error. + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource= or data size error. @retval EFI_INVALID_PARAMETER Both RequestData and ResponseData are NULL **/ EFI_STATUS @@ -48,6 +50,8 @@ PldmSubmitCommand ( IN EDKII_PLDM_PROTOCOL *This, IN UINT8 PldmType, IN UINT8 Command, + IN UINT8 PldmTerminusSourceId, + IN UINT8 PldmTerminusDestinationId, IN UINT8 *RequestData, IN UINT32 RequestDataSize, OUT UINT8 *ResponseData, @@ -61,10 +65,46 @@ PldmSubmitCommand ( return EFI_INVALID_PARAMETER; } =20 + if (RequestData !=3D NULL && RequestDataSize =3D=3D 0) { + DEBUG (( + DEBUG_ERROR, + "%a: RequestDataSize =3D=3D 0, however RequestData is not NULL for P= LDM type: 0x%x, Command: 0x%x.\n", + __func__, + PldmType, + Command + )); + return EFI_INVALID_PARAMETER; + } + + if (ResponseData =3D=3D NULL && *ResponseDataSize !=3D 0) { + DEBUG (( + DEBUG_ERROR, + "%a: *ResponseDataSize !=3D 0, however ResponseData is NULL for PLDM= type: 0x%x, Command: 0x%x.\n", + __func__, + PldmType, + Command + )); + return EFI_INVALID_PARAMETER; + } + + if (ResponseData !=3D NULL && *ResponseDataSize =3D=3D 0) { + DEBUG (( + DEBUG_ERROR, + "%a: *ResponseDataSize =3D=3D 0, however ResponseData is not NULL fo= r PLDM type: 0x%x, Command: 0x%x.\n", + __func__, + PldmType, + Command + )); + return EFI_INVALID_PARAMETER; + } + + DEBUG ((DEBUG_MANAGEABILITY, "%a: Source terminus ID: 0x%x, Destination = terminus ID: 0x%x.\n")); Status =3D CommonPldmSubmitCommand ( mTransportToken, PldmType, Command, + PldmTerminusSourceId, + PldmTerminusDestinationId, RequestData, RequestDataSize, ResponseData, diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProto= colDxe.inf b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProto= colDxe.inf index 006f77b09a..aef25f6438 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.= inf +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocolDxe.= inf @@ -42,9 +42,5 @@ [Protocols] gEdkiiPldmProtocolGuid =20 -[FixedPcd] - gManageabilityPkgTokenSpaceGuid.PcdMctpSourceEndpointId - gManageabilityPkgTokenSpaceGuid.PcdMctpDestinationEndpointId - [Depex] TRUE --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109862): https://edk2.groups.io/g/devel/message/109862 Mute This Topic: https://groups.io/mt/102080242/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109863+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109863+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806407; cv=none; d=zohomail.com; s=zohoarc; b=nzk7rQUWa3FC12GOa2Yu1SJ/bTuC9ykef7g92OFZgGPtD5PWbfzWHBYZ8RgKtmCaaMsFVoN3F70mrZkLFcU3oiNgb7EDtD3tJJuVKEKf9QZzfbZpYImfkYsHFQ3qnz8dMsJPxOg/Tp8b1yBjlnhUKZtH11lhRjsx9n05z4p6FFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806407; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=/SKQh2E0eLatb6ww04jqEyP9QQns0P/iI0imV8vn42Y=; b=HG3YNlgD+p2++YNLOiY2jgAIA9+9dLLvT1OWaDtnN3xokV/iM31qfglXrBCk98eh0vAz0M7+R+VllNrZUEjvmb91T7MDJzflXOTFaQfa+i9h74CpNZd1kLkwZ/K/SIoNki+ufBc/WcTGPEHHykpKV4v9bfOO3gyww1sfh/0P2hI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109863+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806407290644.4375958663953; Fri, 20 Oct 2023 05:53:27 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=jef1I+wlBey3K/V7anbLayg5n2BxLNgJEQqGaSlDIVk=; 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=1697806406; v=1; b=qJGmbhE65oQ3CenG0VpzIcyvcMT33n4q79oFYp2y0ESuM2vlgFKFQL9e0z0/zv/p8QHnr2L/ pHziylSw3tnf+BdBKZKWclV5BuZuq9vkSb7KKzLweApvsTOoP3nA5cI7PNn9NyzHD6Bs/jXhZee 6kwVpRJbhHlazAT0anObaUlU= X-Received: by 127.0.0.2 with SMTP id tmOYYY1788612xJ2UMC4w2EI; Fri, 20 Oct 2023 05:53:26 -0700 X-Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by mx.groups.io with SMTP id smtpd.web11.53593.1697806404478408462 for ; Fri, 20 Oct 2023 05:53:24 -0700 X-Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2c50cf61f6dso12233291fa.2 for ; Fri, 20 Oct 2023 05:53:24 -0700 (PDT) X-Gm-Message-State: RrcrsBOzpXgY8nK7farR1Mo3x1787277AA= X-Google-Smtp-Source: AGHT+IE38f9MLr9GpW86GHKPiYEAY3qlrrHSUBGpQ1d0Q0K5k4roieVw0UDUV3/Km4Mt9JloCw1yFA== X-Received: by 2002:a2e:9d02:0:b0:2c5:2133:a9fc with SMTP id t2-20020a2e9d02000000b002c52133a9fcmr1277450lji.40.1697806402343; Fri, 20 Oct 2023 05:53:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:21 -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 13/15] ManageabilityPkg/PldmProtocol: Remove PLDM command table Date: Fri, 20 Oct 2023 15:53:00 +0300 Message-Id: <20231020125302.1459-14-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806408655100036 Content-Type: text/plain; charset="utf-8" From: Abner Chang In case of the PLDM/MCTP communication response size doesn't have to be known beforehand, the caller just need to provide the buffer big enough to accomodate the response. Remove PLDM command table for retrieving the response payload size and correct the code to fix the response buffer size handling. Also update the message for error conditions. Signed-off-by: Abner Chang Signed-off-by: Konstantin Aladyshev --- .../PldmProtocol/Common/PldmProtocolCommon.c | 100 +++--------------- .../PldmProtocol/Common/PldmProtocolCommon.h | 3 + .../Universal/PldmProtocol/Dxe/PldmProtocol.c | 13 ++- 3 files changed, 31 insertions(+), 85 deletions(-) diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/Pl= dmProtocolCommon.c index ea3d4a22b2..bc72ce07b3 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c @@ -21,42 +21,6 @@ extern CHAR16 *mTransportName; extern UINT8 mPldmRequestInstanceId; =20 -PLDM_MESSAGE_PACKET_MAPPING PldmMessagePacketMappingTable[] =3D { - { PLDM_TYPE_SMBIOS, PLDM_GET_SMBIOS_STRUCTURE_TABLE_METADATA_COMMAND_COD= E, sizeof (PLDM_GET_SMBIOS_STRUCTURE_TABLE_METADATA_RESPONSE_FORMAT) }, - { PLDM_TYPE_SMBIOS, PLDM_SET_SMBIOS_STRUCTURE_TABLE_METADATA_COMMAND_COD= E, sizeof (PLDM_SET_SMBIOS_STRUCTURE_TABLE_METADATA_RESPONSE_FORMAT) }, - { PLDM_TYPE_SMBIOS, PLDM_SET_SMBIOS_STRUCTURE_TABLE_COMMAND_CODE, = sizeof (PLDM_SET_SMBIOS_STRUCTURE_TABLE_REQUEST_FORMAT) } -}; - -/** - This function returns the expected full size of PLDM response message. - - @param[in] PldmType PLDM message type. - @param[in] PldmCommand PLDM command of this PLDM type. - - @retval Zero No matched entry for this PldmType/PldmCommand. - @retval None-zero Size of full packet is returned. -**/ -UINT32 -GetFullPacketResponseSize ( - IN UINT8 PldmType, - IN UINT8 PldmCommand - ) -{ - INT16 Index; - PLDM_MESSAGE_PACKET_MAPPING *ThisEntry; - - ThisEntry =3D PldmMessagePacketMappingTable; - for (Index =3D 0; Index < (sizeof (PldmMessagePacketMappingTable)/ sizeo= f (PLDM_MESSAGE_PACKET_MAPPING)); Index++) { - if ((PldmType =3D=3D ThisEntry->PldmType) && (PldmCommand =3D=3D ThisE= ntry->PldmCommand)) { - return ThisEntry->ResponseSize; - } - - ThisEntry++; - } - - return 0; -} - /** This functions setup the final header/body/trailer packets for the acquired transport interface. @@ -267,10 +231,10 @@ CommonPldmSubmitCommand ( TransferToken.TransmitPackage.TransmitTimeoutInMillisecond =3D MANAGEABI= LITY_TRANSPORT_NO_TIMEOUT; =20 // Set receive packet. - FullPacketResponseDataSize =3D GetFullPacketResponseSize (PldmType, Pldm= Command); - if (FullPacketResponseDataSize =3D=3D 0) { - DEBUG ((DEBUG_ERROR, " No mapping entry in PldmMessagePacketMappingTa= ble for PLDM Type:%d Command %d\n", PldmType, PldmCommand)); - ASSERT (FALSE); + if (ResponseData =3D=3D NULL && *ResponseDataSize =3D=3D 0) { + FullPacketResponseDataSize =3D sizeof (PLDM_RESPONSE_HEADER); + } else { + FullPacketResponseDataSize =3D *ResponseDataSize + sizeof (PLDM_RESPON= SE_HEADER); } =20 FullPacketResponseData =3D (UINT8 *)AllocateZeroPool (FullPacketResponse= DataSize); @@ -306,6 +270,7 @@ CommonPldmSubmitCommand ( ); // // Check the response size. + // if (TransferToken.ReceivePackage.ReceiveSizeInByte < sizeof (PLDM_RESPON= SE_HEADER)) { DEBUG (( DEBUG_MANAGEABILITY_INFO, @@ -315,21 +280,13 @@ CommonPldmSubmitCommand ( TransferToken.ReceivePackage.ReceiveSizeInByte, FullPacketResponseDataSize )); - if (ResponseDataSize !=3D NULL) { - if (*ResponseDataSize > TransferToken.ReceivePackage.ReceiveSizeInBy= te) { - *ResponseDataSize =3D TransferToken.ReceivePackage.ReceiveSizeInBy= te; - } - } - - if (ResponseData !=3D NULL) { - CopyMem ((VOID *)ResponseData, (VOID *)FullPacketResponseData, *Resp= onseDataSize); - } - + HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, Transfe= rToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n"); goto ErrorExit; } =20 // // Check the integrity of response. data. + // ResponseHeader =3D (PLDM_RESPONSE_HEADER *)FullPacketResponseData; if ((ResponseHeader->PldmHeader.DatagramBit !=3D (!PLDM_MESSAGE_HEADER_I= S_DATAGRAM)) || (ResponseHeader->PldmHeader.RequestBit !=3D PLDM_MESSAGE_HEADER_IS_R= ESPONSE) || @@ -343,22 +300,16 @@ CommonPldmSubmitCommand ( DEBUG ((DEBUG_ERROR, " Instance ID =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.InstanceId, mPldmRequestInstanceId)); DEBUG ((DEBUG_ERROR, " Pldm Type =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.PldmType, PldmType)); DEBUG ((DEBUG_ERROR, " Pldm Command =3D %d (Expected value: %d)\n",= ResponseHeader->PldmHeader.PldmTypeCommandCode, PldmCommand)); - if (ResponseDataSize !=3D NULL) { - if (*ResponseDataSize > TransferToken.ReceivePackage.ReceiveSizeInBy= te) { - *ResponseDataSize =3D TransferToken.ReceivePackage.ReceiveSizeInBy= te; - } - } - - if (ResponseData !=3D NULL) { - CopyMem ((VOID *)ResponseData, (VOID *)FullPacketResponseData, *Resp= onseDataSize); - } + DEBUG ((DEBUG_ERROR, " Pldm Completion Code =3D 0x%x\n", ResponseHe= ader->PldmCompletionCode)); =20 + HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, Transfe= rToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n"); goto ErrorExit; } =20 // // Check the response size - if (TransferToken.ReceivePackage.ReceiveSizeInByte !=3D FullPacketRespon= seDataSize) { + // + if (TransferToken.ReceivePackage.ReceiveSizeInByte > FullPacketResponseD= ataSize) { DEBUG (( DEBUG_ERROR, "The response size is incorrect: Response size %d (Expected %d), Com= pletion code %d.\n", @@ -366,38 +317,21 @@ CommonPldmSubmitCommand ( FullPacketResponseDataSize, ResponseHeader->PldmCompletionCode )); - if (ResponseDataSize !=3D NULL) { - if (*ResponseDataSize > TransferToken.ReceivePackage.ReceiveSizeInBy= te) { - *ResponseDataSize =3D TransferToken.ReceivePackage.ReceiveSizeInBy= te; - } - } - - if (ResponseData !=3D NULL) { - CopyMem ((VOID *)ResponseData, (VOID *)FullPacketResponseData, *Resp= onseDataSize); - } =20 + HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, Transfe= rToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n"); goto ErrorExit; } =20 - if (*ResponseDataSize !=3D (TransferToken.ReceivePackage.ReceiveSizeInBy= te - sizeof (PLDM_RESPONSE_HEADER))) { + if (*ResponseDataSize < GET_PLDM_MESSAGE_PAYLOAD_SIZE(TransferToken.Rece= ivePackage.ReceiveSizeInByte)) { DEBUG ((DEBUG_ERROR, " The size of response is not matched to Request= DataSize assigned by caller.\n")); DEBUG (( DEBUG_ERROR, "Caller expects %d, the response size minus PLDM_RESPONSE_HEADER siz= e is %d, Completion Code %d.\n", *ResponseDataSize, - TransferToken.ReceivePackage.ReceiveSizeInByte - sizeof (PLDM_RESPON= SE_HEADER), + GET_PLDM_MESSAGE_PAYLOAD_SIZE(TransferToken.ReceivePackage.ReceiveSi= zeInByte), ResponseHeader->PldmCompletionCode )); - if (ResponseDataSize !=3D NULL) { - if (*ResponseDataSize > TransferToken.ReceivePackage.ReceiveSizeInBy= te) { - *ResponseDataSize =3D TransferToken.ReceivePackage.ReceiveSizeInBy= te; - } - } - - if (ResponseData !=3D NULL) { - CopyMem ((VOID *)ResponseData, (VOID *)FullPacketResponseData, *Resp= onseDataSize); - } - + HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, GET_PLD= M_MESSAGE_PAYLOAD_SIZE(TransferToken.ReceivePackage.ReceiveSizeInByte), "Fa= iled response payload\n"); goto ErrorExit; } =20 @@ -406,10 +340,10 @@ CommonPldmSubmitCommand ( =20 // Copy response data (without header) to caller's buffer. if ((ResponseData !=3D NULL) && (*ResponseDataSize !=3D 0)) { - *ResponseDataSize =3D FullPacketResponseDataSize - sizeof (PLDM_RESPON= SE_HEADER); + *ResponseDataSize =3D GET_PLDM_MESSAGE_PAYLOAD_SIZE(TransferToken.Rece= ivePackage.ReceiveSizeInByte); CopyMem ( (VOID *)ResponseData, - (VOID *)(FullPacketResponseData + sizeof (PLDM_RESPONSE_HEADER)), + GET_PLDM_MESSAGE_PAYLOAD_PTR(FullPacketResponseData), *ResponseDataSize ); } diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmPr= otocolCommon.h b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/Pl= dmProtocolCommon.h index 79431dd3b1..eb273c4f46 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.h +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.h @@ -12,6 +12,9 @@ #include #include =20 +#define GET_PLDM_MESSAGE_PAYLOAD_SIZE(PayloadSize) (PayloadSize - sizeof (= PLDM_RESPONSE_HEADER)) +#define GET_PLDM_MESSAGE_PAYLOAD_PTR(PayloadPtr) ((UINT8 *)PayloadPtr + si= zeof (PLDM_RESPONSE_HEADER)) + typedef struct { UINT8 PldmType; UINT8 PldmCommand; diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProto= col.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c index 726747416c..058f98e677 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Dxe/PldmProtocol.c @@ -60,8 +60,17 @@ PldmSubmitCommand ( { EFI_STATUS Status; =20 - if ((RequestData =3D=3D NULL) && (ResponseData =3D=3D NULL)) { - DEBUG ((DEBUG_ERROR, "%a: Both RequestData and ResponseData are NULL\n= ", __func__)); + // + // Check the given input parameters. + // + if (RequestData =3D=3D NULL && RequestDataSize !=3D 0) { + DEBUG (( + DEBUG_ERROR, + "%a: RequestDataSize !=3D 0, however RequestData is NULL for PLDM ty= pe: 0x%x, Command: 0x%x.\n", + __func__, + PldmType, + Command + )); return EFI_INVALID_PARAMETER; } =20 --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109863): https://edk2.groups.io/g/devel/message/109863 Mute This Topic: https://groups.io/mt/102080243/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109864+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109864+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806417; cv=none; d=zohomail.com; s=zohoarc; b=AbksEYyl0Z36X1lTVF/7r47Q+KNVg2nxz/qenBjfvi0WWhnziOtDXCV37AM1aIXdE08jGVsAC46cUcNEtSkcpHeXMWCsiCq2gYIWu1HurmXrV9gxFM1YXBFRbbngwDTLR4Z7HUXb1nNBbCcXhwVIC0ON/WwnsN8rjQYhOWkY/Ms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806417; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=o0SyuUKC4/AM22J2pYZFsWqc+GtGXybpWT4grpZadQQ=; b=Wq1sLd54d82aognUA9Iza993MJYR8CxNW2/0MKHp8g+iZnR7tw7gW2ssMcYhi1N+NO0UbXP0uJ8fatqzZr1ZS7OdKF0OV/1Pb+7aejScAmYcd6xnK9jfJAvqLCpGMe1ppZ6z7fJvtcfWxpRPausZ2VRK7xJMTloi9Lq0yR4lcPY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109864+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 169780641775996.28758670019681; Fri, 20 Oct 2023 05:53:37 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=80c7Eiwt2Mz23JBWTbGsouPu8L1tenayOt9BMfKEWNk=; 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=1697806408; v=1; b=peLdzCkYHIKraSMwsIpFtCOQBX74XT3t46cwdbqyo3ZE1OfgMBYWBvmKHE0tWa7l5dflDV6D JWD8T4OevdVQtwQF4kGhCEfu7G93u5UT3QmQctGYxTYhmoWDRmubSSPVPzWaLyo0afzmRbbEsju H4TDrtj+GLOR6beUYNnTmduU= X-Received: by 127.0.0.2 with SMTP id tpyGYY1788612x4hkJ2n3Hql; Fri, 20 Oct 2023 05:53:28 -0700 X-Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mx.groups.io with SMTP id smtpd.web10.53395.1697806405611441783 for ; Fri, 20 Oct 2023 05:53:25 -0700 X-Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2bb9a063f26so11141201fa.2 for ; Fri, 20 Oct 2023 05:53:25 -0700 (PDT) X-Gm-Message-State: 6dhuz6SboKxh540fQJOxSPiSx1787277AA= X-Google-Smtp-Source: AGHT+IH3U03e7v6A1SaDkFNkDUfIaM4WgyftbSeoQAMJ9CTREo4Pv8a0PgUOLeoUdyTEoDCL90Du9A== X-Received: by 2002:a2e:9658:0:b0:2c5:16c0:6239 with SMTP id z24-20020a2e9658000000b002c516c06239mr1254128ljh.51.1697806403453; Fri, 20 Oct 2023 05:53:23 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:22 -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 14/15] ManageabilityPkg: Return error on PLDM header check fails Date: Fri, 20 Oct 2023 15:53:01 +0300 Message-Id: <20231020125302.1459-15-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806418600100001 Content-Type: text/plain; charset="utf-8" Currently PldmSubmit command returns EFI_SUCCESS even if the response header checks have failed. Correct the code to return errors in such cases. Signed-off-by: Konstantin Aladyshev --- .../Universal/PldmProtocol/Common/PldmProtocolCommon.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmPr= otocolCommon.c b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/Pl= dmProtocolCommon.c index bc72ce07b3..04f250e57c 100644 --- a/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c +++ b/Features/ManageabilityPkg/Universal/PldmProtocol/Common/PldmProtocolC= ommon.c @@ -241,7 +241,7 @@ CommonPldmSubmitCommand ( if (FullPacketResponseData =3D=3D NULL) { DEBUG ((DEBUG_ERROR, " Not enough memory for FullPacketResponseDataSi= ze.\n")); Status =3D EFI_OUT_OF_RESOURCES; - goto ErrorExit2; + goto ErrorExit; } =20 // Print out PLDM packet. @@ -281,6 +281,7 @@ CommonPldmSubmitCommand ( FullPacketResponseDataSize )); HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, Transfe= rToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n"); + Status =3D EFI_DEVICE_ERROR; goto ErrorExit; } =20 @@ -303,6 +304,7 @@ CommonPldmSubmitCommand ( DEBUG ((DEBUG_ERROR, " Pldm Completion Code =3D 0x%x\n", ResponseHe= ader->PldmCompletionCode)); =20 HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, Transfe= rToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n"); + Status =3D EFI_DEVICE_ERROR; goto ErrorExit; } =20 @@ -319,6 +321,7 @@ CommonPldmSubmitCommand ( )); =20 HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, Transfe= rToken.ReceivePackage.ReceiveSizeInByte, "Failed response payload\n"); + Status =3D EFI_DEVICE_ERROR; goto ErrorExit; } =20 @@ -332,6 +335,7 @@ CommonPldmSubmitCommand ( ResponseHeader->PldmCompletionCode )); HelperManageabilityDebugPrint ((VOID *)FullPacketResponseData, GET_PLD= M_MESSAGE_PAYLOAD_SIZE(TransferToken.ReceivePackage.ReceiveSizeInByte), "Fa= iled response payload\n"); + Status =3D EFI_DEVICE_ERROR; goto ErrorExit; } =20 @@ -350,13 +354,12 @@ CommonPldmSubmitCommand ( =20 // Return transfer status. // -ErrorExit: Status =3D TransferToken.TransferStatus; if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: Failed to send PLDM command over %s\n", __fu= nc__, mTransportName)); } =20 -ErrorExit2: +ErrorExit: if (PldmTransportHeader !=3D NULL) { FreePool ((VOID *)PldmTransportHeader); } --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109864): https://edk2.groups.io/g/devel/message/109864 Mute This Topic: https://groups.io/mt/102080244/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 04:21:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109865+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109865+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697806410; cv=none; d=zohomail.com; s=zohoarc; b=DCifUw6eAXqcyshrI9WA3dErJRFBtByYTNGwKXKWOBrlHBtZzvrtDNL7PvaKGrxTN9Yd7Jqd4UGbOsvtIniqp8G5SMnmcNgD8SXLRI8p9rgWaEx5AxtIct1Qd6rGMzvRXNxI6+8/UGULSFvrPv+araOKNfM1UcqvmaPTC1RXc8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697806410; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=bZyGk3kuYzrdgJd8DUxoXRknUnHfbl65H4xeWNHAxF4=; b=U23zRqff97pERsosLsFZ0h6mn2ZoQd0bpOYfubuoDthjFHVReuArs2620vibJuZFa8phux3PAlZRkvx15NX2MHZxuAjfI1bRB/41fVWWOreQ/kkTcPRt4Q/nF4nglrxYY6rBXD+UA0OM4CW8kCl4s4NSU0ET8HlsH9wP9fPZXXw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109865+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697806410449447.65821622531416; Fri, 20 Oct 2023 05:53:30 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=Ua5Gv1YRMAeKdkoPHVPjTwHcHCkIoJn2QmrVe8rnN6g=; 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=1697806410; v=1; b=UVw2zsGYyHfNXZ6SZjSmKhzwQ11ccdmh/MRvVQmkUVIYyjZicIODccz9k5kk+bHwrfy+4ciS saIxMASp8VDQCUZeW/5jJU1qj5CsUWzURyej9gD/deJFDlsXjmCrlCGn1bHDdrwZ5tGqPTh2YVT 00L8j4VIjM25SvWENSi3Mtvk= X-Received: by 127.0.0.2 with SMTP id zXahYY1788612xs4CpJdCO8r; Fri, 20 Oct 2023 05:53:30 -0700 X-Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by mx.groups.io with SMTP id smtpd.web10.53396.1697806406991173499 for ; Fri, 20 Oct 2023 05:53:27 -0700 X-Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2c50fbc218bso11069871fa.3 for ; Fri, 20 Oct 2023 05:53:26 -0700 (PDT) X-Gm-Message-State: t9gFT8oboQlS7xYkZws8BEKEx1787277AA= X-Google-Smtp-Source: AGHT+IHCJqZapHSlUdAfgS5pD+yAV16zfYJ/IYJiAsTre5J5LltvcfQpag8nt9XMwUZHRBdbVnLQ/w== X-Received: by 2002:a2e:a9a7:0:b0:2c5:18ed:180a with SMTP id x39-20020a2ea9a7000000b002c518ed180amr1523659ljq.33.1697806404792; Fri, 20 Oct 2023 05:53:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:53:23 -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 15/15] PldmSmbiosTransferDxe: Implement Set PLDM terminus ID API Date: Fri, 20 Oct 2023 15:53:02 +0300 Message-Id: <20231020125302.1459-16-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697806412634100044 Content-Type: text/plain; charset="utf-8" From: Abner Chang Currently all PLDM functions inside the PLDM_SMBIOS_TRANSFER_PROTOCOL use PLDM terminus PCDs for the MCTP addressing. Add additional function to the protocol API to provide user a way to use custom TIDs. Signed-off-by: Abner Chang Signed-off-by: Konstantin Aladyshev --- .../Protocol/PldmSmbiosTransferProtocol.h | 26 +++++++++++++++++ .../PldmSmbiosTransferDxe.c | 28 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferP= rotocol.h b/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferPr= otocol.h index 7903e12726..8b23d39682 100644 --- a/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol= .h +++ b/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol= .h @@ -23,6 +23,31 @@ typedef struct _EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL EDK= II_PLDM_SMBIOS_TRANSFER_ #define EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_VERSION ((EDKII_PLDM_SM= BIOS_TRANSFER_PROTOCOL_VERSION_MAJOR << 8) |\ EDKII_PLDM_SMBIOS_T= RANSFER_PROTOCOL_VERSION_MINOR) =20 +/** + This function sets PLDM SMBIOS transfer source and destination + PLDM terminus ID. + + @param [in] This EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL instanc= e. + @param [in] SourceId PLDM source teminus ID. + Set to PLDM_TERMINUS_ID_UNASSIGNED means use + platform default PLDM terminus ID. + (gManageabilityPkgTokenSpaceGuid.PcdPldmSou= rceTerminusId) + @param [in] DestinationId PLDM destination teminus ID. + Set to PLDM_TERMINUS_ID_UNASSIGNED means use + platform default PLDM terminus ID. + (gManageabilityPkgTokenSpaceGuid.PcdPldmDes= tinationEndpointId) + + @retval EFI_SUCCESS Get SMBIOS table metadata Successfu= lly. + @retval EFI_INVALID_PARAMETER Invalid value of source or destinat= ion + PLDM terminus ID. +**/ +typedef +EFI_STATUS +(EFIAPI *PLDM_GET_SMBIOS_TRANSFER_TERMINUS_ID)( + IN UINT8 SourceId, + IN UINT8 DestinationId + ); + /** This function gets SMBIOS table metadata. =20 @@ -151,6 +176,7 @@ EFI_STATUS // EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL // typedef struct { + PLDM_GET_SMBIOS_TRANSFER_TERMINUS_ID SetPldmSmbiosTransferTerminu= sId; PLDM_GET_SMBIOS_STRUCTURE_TABLE_METADATA GetSmbiosStructureTableMetaD= ata; PLDM_SET_SMBIOS_STRUCTURE_TABLE_METADATA SetSmbiosStructureTableMetaD= ata; PLDM_GET_SMBIOS_STRUCTURE_TABLE GetSmbiosStructureTable; diff --git a/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/Pldm= SmbiosTransferDxe.c b/Features/ManageabilityPkg/Universal/PldmSmbiosTransfe= rDxe/PldmSmbiosTransferDxe.c index fdf033f0b1..357a7d49e4 100644 --- a/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosT= ransferDxe.c +++ b/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosT= ransferDxe.c @@ -25,6 +25,33 @@ =20 UINT32 SetSmbiosStructureTableHandle; =20 +/** + This function sets PLDM SMBIOS transfer source and destination + PLDM terminus ID. + + @param [in] This EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL instanc= e. + @param [in] SourceId PLDM source teminus ID. + Set to PLDM_TERMINUS_ID_UNASSIGNED means use + platform default PLDM terminus ID. + (gManageabilityPkgTokenSpaceGuid.PcdPldmSou= rceTerminusId) + @param [in] DestinationId PLDM destination teminus ID. + Set to PLDM_TERMINUS_ID_UNASSIGNED means use + platform default PLDM terminus ID. + (gManageabilityPkgTokenSpaceGuid.PcdPldmDes= tinationEndpointId) + + @retval EFI_SUCCESS Get SMBIOS table metadata Successfu= lly. + @retval EFI_INVALID_PARAMETER Invalid value of source or destinat= ion + PLDM terminus ID. +**/ +EFI_STATUS +SetPldmSmbiosTransferTerminusId ( + IN UINT8 SourceId, + IN UINT8 DestinationId + ) +{ + return PldmSetTerminus(SourceId, DestinationId); +} + /** Get the full size of SMBIOS structure including optional strings that fo= llow the formatted structure. =20 @@ -457,6 +484,7 @@ GetSmbiosStructureByHandle ( } =20 EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_V1_0 mPldmSmbiosTransferProtocolV10 = =3D { + SetPldmSmbiosTransferTerminusId, GetSmbiosStructureTableMetaData, SetSmbiosStructureTableMetaData, GetSmbiosStructureTable, --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109865): https://edk2.groups.io/g/devel/message/109865 Mute This Topic: https://groups.io/mt/102080245/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-