From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id AAB5BAC1184 for ; Mon, 16 Oct 2023 13:18:28 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=GCDVlq2PwIrO5/BpcX2BRDn1mwknbUt5IOkWjma9LmQ=; 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=1697462307; v=1; b=e8EzIRlNrwQTIAMvmShIEoe5G7XqonL1gemDFaG0XCp1brhqcM45XyV99hPWVXsIPoVXoD41 smkXNvvFTi2OKn605Fbny29UnukILXVFQlAw7uUIHQ6IBTZ4VSKF6p4bN96NvYqzQjaXwnFCyVm yF2A0M7YbkH9Xv0LEMgb7WEs= X-Received: by 127.0.0.2 with SMTP id K2ipYY7687511xKTgTKYbLvh; Mon, 16 Oct 2023 06:18:27 -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: JPB4JsjXoctcmpYDFUxSTIBex7686176AA= 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-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=e8EzIRlN; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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; =0D @param[in] This EDKII_MCTP_PROTOCOL instan= ce.=0D @param[in] MctpType MCTP message type.=0D - @param[in] MctpSourceEndpointId MCTP source endpoint ID.=0D - @param[in] MctpDestinationEndpointId MCTP source endpoint ID.=0D + @param[in] MctpSourceEndpointId Pointer of MCTP source end= point ID.=0D + Set to NULL means use plat= form PCD value=0D + (PcdMctpSourceEndpointId).= =0D + @param[in] MctpDestinationEndpointId Pointer of MCTP destinatio= n endpoint ID.=0D + Set to NULL means use plat= form PCD value=0D + (PcdMctpDestinationEndpoin= tId).=0D @param[in] RequestDataIntegrityCheck Indicates whether MCTP mes= sage has=0D integrity check byte.=0D @param[in] RequestData Message Data.=0D @@ -58,8 +62,8 @@ EFI_STATUS (EFIAPI *MCTP_SUBMIT_COMMAND)(=0D IN EDKII_MCTP_PROTOCOL *This,=0D IN UINT8 MctpType,=0D - IN UINT8 MctpSourceEndpointId,=0D - IN UINT8 MctpDestinationEndpointId,=0D + IN UINT8 *MctpSourceEndpointId,=0D + IN UINT8 *MctpDestinationEndpointId,=0D IN BOOLEAN RequestDataIntegrityCheck,=0D IN UINT8 *RequestData,=0D IN UINT32 RequestDataSize,=0D 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 (=0D mMctpProtocol,=0D TransmitHeader->MessageH= eader.MessageType,=0D - TransmitHeader->SourceEn= dpointId,=0D - TransmitHeader->Destinat= ionEndpointId,=0D + &TransmitHeader->SourceE= ndpointId,=0D + &TransmitHeader->Destina= tionEndpointId,=0D (BOOLEAN)TransmitHeader-= >MessageHeader.IntegrityCheck,=0D TransferToken->TransmitP= ackage.TransmitPayload,=0D TransferToken->TransmitP= ackage.TransmitSizeInByte,=0D 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;=0D MctpTransportHeader->Bits.Reserved =3D 0;=0D MctpTransportHeader->Bits.HeaderVersion =3D MCTP_KCS_HEADER_VE= RSION;=0D - MctpTransportHeader->Bits.DestinationEndpointId =3D PcdGet8 (PcdMctpDe= stinationEndpointId);=0D - MctpTransportHeader->Bits.SourceEndpointIdId =3D PcdGet8 (PcdMctpSo= urceEndpointId);=0D + MctpTransportHeader->Bits.DestinationEndpointId =3D MctpDestinationEnd= pointId;=0D + MctpTransportHeader->Bits.SourceEndpointId =3D MctpSourceEndpoint= Id;=0D MctpTransportHeader->Bits.MessageTag =3D MCTP_MESSAGE_TAG;= =0D MctpTransportHeader->Bits.TagOwner =3D MCTP_MESSAGE_TAG_O= WNER_REQUEST;=0D MctpTransportHeader->Bits.PacketSequence =3D mMctpPacketSequenc= e & MCTP_PACKET_SEQUENCE_MASK;=0D 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; =0D @param[in] This EDKII_MCTP_PROTOCOL instan= ce.=0D @param[in] MctpType MCTP message type.=0D - @param[in] MctpSourceEndpointId MCTP source endpoint ID.=0D - @param[in] MctpDestinationEndpointId MCTP source endpoint ID.=0D + @param[in] MctpSourceEndpointId Pointer of MCTP source end= point ID.=0D + Set to NULL means use plat= form PCD value=0D + (PcdMctpSourceEndpointId).= =0D + @param[in] MctpDestinationEndpointId Pointer of MCTP destinatio= n endpoint ID.=0D + Set to NULL means use plat= form PCD value=0D + (PcdMctpDestinationEndpoin= tId).=0D @param[in] RequestDataIntegrityCheck Indicates whether MCTP mes= sage has=0D integrity check byte.=0D @param[in] RequestData Message Data.=0D @@ -59,8 +63,8 @@ EFIAPI MctpSubmitMessage (=0D IN EDKII_MCTP_PROTOCOL *This,=0D IN UINT8 MctpType,=0D - IN UINT8 MctpSourceEndpointId,= =0D - IN UINT8 MctpDestinationEndpoin= tId,=0D + IN UINT8 *MctpSourceEndpointId,= =0D + IN UINT8 *MctpDestinationEndpoi= ntId,=0D IN BOOLEAN RequestDataIntegrityCh= eck,=0D IN UINT8 *RequestData,=0D IN UINT32 RequestDataSize,=0D @@ -72,24 +76,42 @@ MctpSubmitMessage ( )=0D {=0D EFI_STATUS Status;=0D + UINT8 SourceEid;=0D + UINT8 DestinationEid;=0D =0D if ((RequestData =3D=3D NULL) && (ResponseData =3D=3D NULL)) {=0D DEBUG ((DEBUG_ERROR, "%a: Both RequestData and ResponseData are NULL\n= ", __func__));=0D return EFI_INVALID_PARAMETER;=0D }=0D =0D + if (MctpSourceEndpointId =3D=3D NULL) {=0D + SourceEid =3D PcdGet8 (PcdMctpSourceEndpointId);=0D + DEBUG ((DEBUG_MANAGEABILITY, "%a: Use PcdMctpSourceEndpointId for MCTP= source EID: %x\n", __func__, SourceEid));=0D + } else {=0D + SourceEid =3D *MctpSourceEndpointId;=0D + DEBUG ((DEBUG_MANAGEABILITY, "%a: MCTP source EID: %x\n", __func__, So= urceEid));=0D + }=0D +=0D + if (MctpDestinationEndpointId =3D=3D NULL) {=0D + DestinationEid =3D PcdGet8 (PcdMctpDestinationEndpointId);=0D + DEBUG ((DEBUG_MANAGEABILITY, "%a: Use PcdMctpDestinationEndpointId for= MCTP destination EID: %x\n", __func__, DestinationEid));=0D + } else {=0D + DestinationEid =3D *MctpDestinationEndpointId;=0D + DEBUG ((DEBUG_MANAGEABILITY, "%a: MCTP destination EID: %x\n", __func_= _, DestinationEid));=0D + }=0D +=0D //=0D // Check source EID and destination EID=0D //=0D - if ((MctpSourceEndpointId >=3D MCTP_RESERVED_ENDPOINT_START_ID) &&=0D - (MctpSourceEndpointId <=3D MCTP_RESERVED_ENDPOINT_END_ID)=0D + if ((SourceEid >=3D MCTP_RESERVED_ENDPOINT_START_ID) &&=0D + (SourceEid <=3D MCTP_RESERVED_ENDPOINT_END_ID)=0D ) {=0D DEBUG ((DEBUG_ERROR, "%a: The value of MCTP source EID (%x) is reserve= d.\n", __func__, MctpSourceEndpointId));=0D return EFI_INVALID_PARAMETER;=0D }=0D =0D - if ((MctpDestinationEndpointId >=3D MCTP_RESERVED_ENDPOINT_START_ID) &&= =0D - (MctpDestinationEndpointId <=3D MCTP_RESERVED_ENDPOINT_END_ID)=0D + if ((DestinationEid >=3D MCTP_RESERVED_ENDPOINT_START_ID) &&=0D + (DestinationEid <=3D MCTP_RESERVED_ENDPOINT_END_ID)=0D ) {=0D DEBUG ((DEBUG_ERROR, "%a: The value of MCTP destination EID (%x) is re= served.\n", __func__, MctpDestinationEndpointId));=0D return EFI_INVALID_PARAMETER;=0D @@ -98,8 +120,8 @@ MctpSubmitMessage ( Status =3D CommonMctpSubmitMessage (=0D mTransportToken,=0D MctpType,=0D - MctpSourceEndpointId,=0D - MctpDestinationEndpointId,=0D + SourceEid,=0D + DestinationEid,=0D RequestDataIntegrityCheck,=0D RequestData,=0D RequestDataSize,=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- 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/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-