From nobody Mon Feb 9 22:20:15 2026 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+109639+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+109639+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697462306; cv=none; d=zohomail.com; s=zohoarc; b=S3pLO+KzDUSIol/Nb8EEuCV3nDEZRSpXZF8aqgHNwUYfnQZEvaZYAZCeavzHncXL7Y6gfdXz2B118YSF7Fnjud9wuu5cJnQY7Xwd8Zwj2SIeZMTqI1VwzIFihajW2/RMAlCjxhpuf7C4+btryFdkOhl9CZUdprLkL5eqJLSof+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697462306; 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=An2HmFzl36hp8P24/vq5ubaPbxNpBCT8xCdWND8MYOI=; b=eKM1WkgUgzzjgrAWmTkkuB+e/AcWmVm8KpiftyirHX3zQyt8jyiyxqXuJeLYO6yfYrQUtIkuwtf5aTsfdJ2XuvYq2w648l4PoryH55bImnVP+km38KUrDoMCS73Snqi03Y2Su7KMJKvHz2IJAS+CVj+B6P+PklK4HkBdg+O05Do= 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+109639+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 1697462306868505.80088604303796; Mon, 16 Oct 2023 06:18:26 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=U4A7AsRhYzZ/bVsnRXzhtZJ9U2i4Ib1tcr5GBtSt82Y=; 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=1697462306; v=1; b=NalJ3zhvtKBU5SykWW1Z1lO+n48EGMCnzN2Bjm/2Uw358/kxHWnRFSyfabuK/qrcEGbjCMEh qojf3W+1qGPj/YcGCXDDEhRJRUXasG4imL7ufsgZ5/kPH0ppVXlJQ61xcEBOiQ8Fw5q8yQXbFhM JNNoDuoXEWSzXCDM4Xg8RVm0= X-Received: by 127.0.0.2 with SMTP id U9vuYY1788612xwYlAz7ibrR; Mon, 16 Oct 2023 06:18: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.web11.123862.1697462305591294158 for ; Mon, 16 Oct 2023 06:18:25 -0700 X-Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2c503da4fd6so41779721fa.1 for ; Mon, 16 Oct 2023 06:18:25 -0700 (PDT) X-Gm-Message-State: yQyJO6zmtxOnwZ3YTaL6Icgzx1787277AA= X-Google-Smtp-Source: AGHT+IEbpMG2D1uj75u89kvw43Ns6y2mPXeoIVyztazVztH/G6XEaxkm3hvx4SbZ2SKZ8uxmL47yDg== X-Received: by 2002:a05:651c:c9:b0:2b6:a3a0:5f7 with SMTP id 9-20020a05651c00c900b002b6a3a005f7mr31680334ljr.9.1697462303478; Mon, 16 Oct 2023 06:18:23 -0700 (PDT) X-Received: from PC10319.67 ([82.97.198.254]) by smtp.googlemail.com with ESMTPSA id 9-20020a2e1449000000b002ba586d27a2sm1362545lju.26.2023.10.16.06.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 06:18: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 06/10] ManageabilityPkg: Update the algorithm of using MCTP endpoint ID PCD Date: Mon, 16 Oct 2023 16:18:12 +0300 Message-Id: <20231016131816.6634-7-aladyshev22@gmail.com> In-Reply-To: <20231016131816.6634-1-aladyshev22@gmail.com> References: <20231016131816.6634-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: 1697462307469100021 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 (#109639): https://edk2.groups.io/g/devel/message/109639 Mute This Topic: https://groups.io/mt/101994944/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-