From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.67]) by mx.groups.io with SMTP id smtpd.web11.2202.1681973274654599149 for ; Wed, 19 Apr 2023 23:47:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=tOKKld08; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.212.67, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RuVq1FTWlTH39FBvOVOONcWqvmIP+ZGiUrOvqiEXg7CueZ2WNTw3Vmq1bZZDkyDil1Z/2KH81k7WVe8LsIuMT4VsDA0U6S5t8tjY1t32FyjZiaaTt6NgW7lMWQXJmljfKKVJbfvhmh04Bmy3SumMKOOQSz2nV+mpWVJhD8UDOQSTmelTRclQ65IFd9jn263tHA51fPhGlUXI0KhaXkVZpK7jH99YVO8osKGGOvC18rkVi6zD/3s5BfDK89FrQ2uT22PTPv9Ho3NlRlhZbEH3vnCVhH3xZExET2GzhpuyPFk1ZzteNgx4XpcgFpln3199rbeXJD2PW8lduw1hb68gVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q7E/tfaa7M2xmKaje1y+K7mv7Vi3fX/vU+H8ydZ7P3s=; b=jQRNKQKFiYCyNgnIUAMyysP3Mp3T3zfPcoPTnza+CTMdzMatM+r/6TfPAE4DI4EUx0nKkBuMdNf3H+nU9HX3nqzmCX0Ar7xWV11xSwqup7srcvb08tg/VCxjigMv5cwBAVl9jN4sP6NOGZbXcLewKr0AQ8m1idUibzyQZCq1fRc2GraMJnimuI/6Bz4IukjAMiBv8sZuPsoRcsdKiAXbz6fpXedAdCZKSsEmop5XefCRBYsTMr6gSNkvX2GHcqWbya2GTCZj44j4jyzgODQaW8fl9hl2tAQqQhAk5DGdCl1heoKwmNqUIJW2t9gAjs3jj7dDrCT7NL/FIzRMmcm94g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q7E/tfaa7M2xmKaje1y+K7mv7Vi3fX/vU+H8ydZ7P3s=; b=tOKKld082HMTJNrSm4XAbVR1v6TUFRirCjN6559a3GVnLiPFzkJqivxty3YK1zD6wGTJs70wWnTn2KNwahstIq7KHN2atovBNn2kS9qRXLrhXbSZTTZTmNw+yOG140qJLYXS3Tf8EEA6e6zZLljKuK6hSHvzO4Hi88wSCg8Qb9N3bFEDC2nLLm93D9jpQJLrCP98g7n7WY/sRrT5HX1voTKCJwjqmmXYeXU7evAOThxzSi5Pij8XepuVGyxnUtDgVODPCYJgotp+5oOMzsFv5i81cDyP8QM3ee5Nn2Rl1tJZoVMYU99OD+uh7QZ2x1qSaf6yzE1WZoTlmcj2FRIU+Q== Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by PH7PR12MB7819.namprd12.prod.outlook.com (2603:10b6:510:27f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 06:47:51 +0000 Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::d9df:b45b:2cc1:f017]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::d9df:b45b:2cc1:f017%5]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 06:47:50 +0000 From: "Nickle Wang" To: "abner.chang@amd.com" , "devel@edk2.groups.io" CC: Isaac Oram , Abdul Lateef Attar , Igor Kulchytskyy Subject: Re: [edk2-platforms][PATCH V2 03/14] ManageabilityPkg: Add HeaderSize and TrailerSize Thread-Topic: [edk2-platforms][PATCH V2 03/14] ManageabilityPkg: Add HeaderSize and TrailerSize Thread-Index: AQHZccWrkrU/huU7NEKiRkCyeJKnXK8zxG/Q Date: Thu, 20 Apr 2023 06:47:50 +0000 Message-ID: References: <20230418071543.1951-1-abner.chang@amd.com> <20230418071543.1951-4-abner.chang@amd.com> In-Reply-To: <20230418071543.1951-4-abner.chang@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB7031:EE_|PH7PR12MB7819:EE_ x-ms-office365-filtering-correlation-id: a1db1732-6c45-43e7-c20d-08db416b28e7 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vSCAhvugz2v8SPvTGUp8GazWZ4WTZ9iISZ8mPpDO71XyGeAa9/M8WCs/GGGJXP2M5q4RvYyocBFwAy6I6oA2ivThJTPEZS37B+Iv6OtXjwgXeaaZjAeE/7UCm9MIYF9b/FFtP2HDDmVF1gVi5QCCjhJLQdEeuqfLiPwkPsoUBqT6cZ2KF1nnqhIpWN5B7I/hTR8f+Qn2q5vlEh4stlkZKalInsd0FgLSEq8yfwH+KNgmAO36EwR/NmuZfN6GkYsYtdueLfRUHIbttU+ZoEtbbvm/4DvZZGRRW6sYkUmOhjqiwoGF3uS39QbHhJ/y30TmBVyzWdPpKNTe6cDv7lvaEs9JzLu/e1hlW3FEDLmdYl/hSROAJHQuPY0TGad9QIH/qG2f2apDpxRCJ1CTZotRrlfffMDdWdshkabX/s+3pRVvFkJ12HGfO6w8VNVE047V4RV62zYdKu0ro0+QZUHXNEFWwkSkOxW5dOkNr8BONx/rye1gSdjpks0m12Mce2wd2TXh6tQj7FXSxUf0s+ukTyxj7jeDQZu/Tw6GczBaULpuMBPnWYD/xkrSdZhEzgzeUew1R8SXwK5KkP01ib7gOH2InAm8pRlm0gICuMg32T5iWlmtdWuUy5lwRX9Pig4I x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR12MB7031.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(396003)(136003)(366004)(39860400002)(451199021)(54906003)(110136005)(4326008)(316002)(64756008)(66476007)(76116006)(66946007)(66556008)(66446008)(478600001)(7696005)(71200400001)(55016003)(8936002)(5660300002)(41300700001)(8676002)(52536014)(30864003)(122000001)(2906002)(86362001)(38070700005)(33656002)(38100700002)(9686003)(6506007)(26005)(53546011)(186003)(83380400001)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?XGkhPkKN2gTrPCjeb2rVLy8L4lZO5OVKnHJI6Uh1ZoQ+UDK2X2n+DwGwPN8e?= =?us-ascii?Q?/B+xcnnQIrvDoisEzT8VKlJk+OkaZPpsVY8ktWOlYNYDzwa6tR4YMVd2KV6j?= =?us-ascii?Q?evlBDhWO2JgbDAA2HjrEQJ1CkIHIBFfgn1bDVjHRbWULURiaQ6H2Sed/PCXF?= =?us-ascii?Q?1veL4juFAy+OfBuvFGMFIlo9jleeEaRhg0h2wx8zCt/eOuGRDZ/7s4AculBy?= =?us-ascii?Q?4qXV6PJCh8LCEyTg9UuY2fwd7ICfNj3PQK9TUvdRkKT3m7ZnaM0OejnPD7h5?= =?us-ascii?Q?ms1p8Rx4+6EdHARk9Lk5lX1yiq2u441SQY5jcRDT4NhoZj5FwGiBKi+07ZYx?= =?us-ascii?Q?P0V0PHviSPxoAaocZGL7Q5LpHe1H5jl1gk5XOT9djwgzEsS1jyEgqBxIYkbr?= =?us-ascii?Q?PUrUtOx1v7OrJj6oW2LsvW5c0a9jgoStFJx5Uy9+mWLRzRlLP6SB5zTtlx7D?= =?us-ascii?Q?uczcT6B3BRn6v7G7GOGCYpyw/r6ln+at7W2o0t49TtkE8nwxmCWtm0MKs164?= =?us-ascii?Q?SgiO0W5ABEbZLDvBxMHt+9apQgRPpyfE+pARETHmf5niQAhH6vIziQ7KYjQg?= =?us-ascii?Q?S2ryrh+7IxlUdrAKUTWjcLYnVSd41FbiF5RySn4gHf4cH/w3pwv0tzgw/aeC?= =?us-ascii?Q?ab+YdJtOzIKqWQzs9wN00i1pGm5heYdL+13azX9gm89oVcTORs66Nznjfm2+?= =?us-ascii?Q?w9UHR6pAXkWzJB5tmEbMwDNRFtHe+pSjO7n2WwxRmEmyqrQe5gAVvKmwyrxc?= =?us-ascii?Q?JVUSRXmtNUsnnblvj/wsEGBPJDOjuWR+nO51ZKZT7g9kl5IgAEdaR7ZSVpOn?= =?us-ascii?Q?869bC/09lyNBq6oVHkWBEXuC+7xnA0GVxu8wgyWj/35HM81I1H5MgCSsJIn/?= =?us-ascii?Q?V9QmDgeQ+mvAFa9UAoUW5WuKHHUif9EzHQFGgc9cab+vl3g/vCK0B32Pfy5P?= =?us-ascii?Q?s/F9vw/IJMGUGa6HD/P6+9/+xgAJMTkPtmonKNO4c7RUp0nOOkaL66bBIUCl?= =?us-ascii?Q?PT/UeocyZjSwZnZN+pDQEgmyCHYn75m1XXL4KjKYyJwFEszlYoFglh2ezC9X?= =?us-ascii?Q?fsOM9Kyc/rRWJXDaM+5hOTlrlElcxdGpKxwZEvxDCUBUg1REm0tl8DErw3vV?= =?us-ascii?Q?etI2sRdChe1Exj3n5B30ho848m0qZ89QfbAV+qnspwOFTcEI3sKsIrYESPz6?= =?us-ascii?Q?u95cjL09uLsB+QgRHEfI2rJrUKQL1q91e6gSmCtl2xeReN4nGSmgRqw009vE?= =?us-ascii?Q?/by5wvSnLkcv40l1XlJ3oNZROp5Jp8VaTMugMgXdc6kTKS1qAFwoKXP8k1y4?= =?us-ascii?Q?WL5Nl4IHaq/gj9a/zilHeE3Wq3kTNQR8MgyU2IEs8/yVOrW9b3vmWJszlbaZ?= =?us-ascii?Q?NfWMFtk8K9rulHMZNV0bKtpo4mEEo7qOiU1IVB/GpBHBw75sjdwpnQJi7sHY?= =?us-ascii?Q?E9CxJWeEJZ9RzkolwbOCPweugG+FKEOO7kWR7W80WLwJMD9o4AOhpiTF628g?= =?us-ascii?Q?faa7g2scDVYAHZBmjMrZk30BgsbplbPmSJAubiQTuAPVIE/VYEfCNaADvq13?= =?us-ascii?Q?NHMsybH7lkBt+qcfsVc=3D?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB7031.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1db1732-6c45-43e7-c20d-08db416b28e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2023 06:47:50.6590 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SQZsYlfbGrXZSzeziN8+HTPYSVyvo0HBB6QJ7Chs3kY9br/8+GAinVUMM6stke4wfxVsxprzgcnyYLit4c+p3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7819 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nickle Wang Regards, Nickle > -----Original Message----- > From: abner.chang@amd.com > Sent: Tuesday, April 18, 2023 3:16 PM > To: devel@edk2.groups.io > Cc: Isaac Oram ; Abdul Lateef Attar > ; Nickle Wang ; Igor Kulchytskyy > > Subject: [edk2-platforms][PATCH V2 03/14] ManageabilityPkg: Add HeaderSiz= e > and TrailerSize >=20 > External email: Use caution opening links or attachments >=20 >=20 > From: Abner Chang >=20 > Add HeaderSize and TrailerSize in > MANAGEABILITY_TRANSFER_TOKEN structure. > Manageability transport interface may used by multiple protocols which ha= ve > different header and trailer of payload. (e.g. MCTP over KCS and IPMI ove= r KCS). >=20 > Signed-off-by: Abner Chang > Cc: Isaac Oram > Cc: Abdul Lateef Attar > Cc: Nickle Wang > Cc: Igor Kulchytskyy > --- > .../Library/ManageabilityTransportLib.h | 2 + > .../Common/ManageabilityTransportKcs.h | 20 ++- > .../IpmiProtocol/Common/IpmiProtocolCommon.h | 36 +++-- > .../Common/KcsCommon.c | 152 ++++++++++++------ > .../Dxe/ManageabilityTransportKcs.c | 14 +- > .../IpmiProtocol/Common/IpmiProtocolCommon.c | 63 +++++--- > Features/ManageabilityPkg/Readme.md | 10 ++ > 7 files changed, 194 insertions(+), 103 deletions(-) >=20 > diff --git > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h > b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib.h > index d86d0d87d5..04072aee89 100644 > --- a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLib= .h > +++ b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportLi > +++ b.h > @@ -168,10 +168,12 @@ struct _MANAGEABILITY_TRANSFER_TOKEN { > = ///< which is sent discretely of payload. > = ///< This field can be NULL if the > transport > = ///< doesn't require this. > + UINT16 TransmitHeaderSize; = ///< Transmit header > size in byte. > MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer; = ///< This > is the transport-specific trailer > = ///< which is sent discretely of payload. > = ///< This field can be NULL if the > transport > = ///< doesn't require this. > + UINT16 TransmitTrailerSize; = ///< Transmit trailer size > in byte. > MANAGEABILITY_TRANSMIT_PACKAGE TransmitPackage; = ///< > The payload sent to transport interface. > MANAGEABILITY_RECEIVE_PACKAGE ReceivePackage; = ///< The > buffer to receive the response. > EFI_STATUS TransferStatus; = ///< The EFI Status of the > transfer. > diff --git > a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ > ManageabilityTransportKcs.h > b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ > ManageabilityTransportKcs.h > index 2cdf60ba7e..d6685c165e 100644 > --- > a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ > ManageabilityTransportKcs.h > +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com > +++ mon/ManageabilityTransportKcs.h > @@ -41,8 +41,10 @@ typedef struct { > /** > This service communicates with BMC using KCS protocol. >=20 > - @param[in] NetFunction Net function of the command. > - @param[in] Command IPMI Command. > + @param[in] TransmitHeader KCS packet header. > + @param[in] TransmitHeaderSize KCS packet header size in byte. > + @param[in] TransmitTrailer KCS packet trailer. > + @param[in] TransmitTrailerSize KCS packet trailer size in byte. > @param[in] RequestData Command Request Data. > @param[in] RequestDataSize Size of Command Request Data. > @param[out] ResponseData Command Response Data. The compl= etion > @@ -69,12 +71,14 @@ typedef struct { > EFI_STATUS > EFIAPI > KcsTransportSendCommand ( > - IN UINT8 NetFunction, > - IN UINT8 Command, > - IN UINT8 *RequestData OPTIONAL, > - IN UINT32 RequestDataSize, > - OUT UINT8 *ResponseData OPTIONAL, > - IN OUT UINT32 *ResponseDataSize OPTIONAL > + IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader, > + IN UINT16 TransmitHeaderSize, > + IN MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer OPTIONAL, > + IN UINT16 TransmitTrailerSize, > + IN UINT8 *RequestData OPTIONAL, > + IN UINT32 RequestDataSize, > + OUT UINT8 *ResponseData OPTIONAL, > + IN OUT UINT32 *ResponseDataSize OPTIONAL > ); >=20 > /** > diff --git > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC > ommon.h > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC > ommon.h > index 5a7236e9a6..8bf16e6277 100644 > --- > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC > ommon.h > +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtoc > +++ olCommon.h > @@ -44,21 +44,23 @@ SetupIpmiTransportHardwareInformation ( > This functions setup the final header/body/trailer packets for > the acquired transport interface. >=20 > - @param[in] TransportToken The transport interface. > - @param[in] NetFunction IPMI function. > - @param[in] Command IPMI command. > - @param[out] PacketHeader The pointer to receive header of re= quest. > - @param[in, out] PacketBody The request body. > - When IN, it is the caller's request= body. > - When OUT and NULL, the request body= is not > - changed. > - Whee out and non-NULL, the request = body is > - changed to comfort the transport in= terface. > - @param[in, out] PacketBodySize The request body size. > - When IN and non-zero, it is the new= data > - length of request body. > - When IN and zero, the request body = is unchanged. > - @param[out] PacketTrailer The pointer to receive trailer of r= equest. > + @param[in] TransportToken The transport interface. > + @param[in] NetFunction IPMI function. > + @param[in] Command IPMI command. > + @param[out] PacketHeader The pointer to receive header of= request. > + @param[out] PacketHeaderSize Pinter to receive packet header = size in > byte. > + @param[in, out] PacketBody The request body. > + When IN, it is the caller's requ= est body. > + When OUT and NULL, the request b= ody is not > + changed. > + Whee out and non-NULL, the reque= st body is > + changed to comfort the transport= interface. > + @param[in, out] PacketBodySize The request body size. > + When IN and non-zero, it is the = new data > + length of request body. > + When IN and zero, the request bo= dy is unchanged. > + @param[out] PacketTrailer The pointer to receive trailer o= f request. > + @param[out] PacketTrailerSize Pinter to receive packet trailer= size in byte. >=20 > @retval EFI_SUCCESS Request packet is returned. > @retval EFI_UNSUPPORTED Request packet is not returned because > @@ -70,9 +72,11 @@ SetupIpmiRequestTransportPacket ( > IN UINT8 NetFunction, > IN UINT8 Command, > OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader OPTIONAL, > + OUT UINT16 *PacketHeaderSize, > IN OUT UINT8 **PacketBody OPTIONAL, > IN OUT UINT32 *PacketBodySize OPTIONAL, > - OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL > + OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL, > + OUT UINT16 *PacketTrailerSize > ); >=20 > /** > diff --git > a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ > KcsCommon.c > b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ > KcsCommon.c > index 17e2b8f231..14a7047447 100644 > --- > a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Common/ > KcsCommon.c > +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Com > +++ mon/KcsCommon.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include #include >=20 > @@ -98,8 +99,10 @@ ClearOBF ( > Algorithm is based on flow chart provided in IPMI spec 2.0 > Figure 9-6, KCS Interface BMC to SMS Write Transfer Flow Chart >=20 > - @param[in] NetFunction Net function of the command. > - @param[in] Command IPMI Command. > + @param[in] TransmitHeader KCS packet header. > + @param[in] TransmitHeaderSize KCS packet header size in byte. > + @param[in] TransmitTrailer KCS packet trailer. > + @param[in] TransmitTrailerSize KCS packet trailer size in byte. > @param[in] RequestData Command Request Data, could be NULL. > RequestDataSize must be zero, if Req= uestData > is NULL. > @@ -122,10 +125,12 @@ ClearOBF ( > **/ > EFI_STATUS > KcsTransportWrite ( > - IN UINT8 NetFunction, > - IN UINT8 Command, > - IN UINT8 *RequestData OPTIONAL, > - IN UINT32 RequestDataSize > + IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader, > + IN UINT16 TransmitHeaderSize, > + IN MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer OPTIONAL, > + IN UINT16 TransmitTrailerSize, > + IN UINT8 *RequestData OPTIONAL, > + IN UINT32 RequestDataSize > ) > { > EFI_STATUS Status; > @@ -134,37 +139,63 @@ KcsTransportWrite ( > UINT8 *BufferPtr; >=20 > // Validation on RequestData and RequestDataSize. > - if ((RequestData =3D=3D NULL && RequestDataSize !=3D 0) || > - (RequestData !=3D NULL && RequestDataSize =3D=3D 0) > - ) { > + if (((RequestData =3D=3D NULL) && (RequestDataSize !=3D 0)) || > + ((RequestData !=3D NULL) && (RequestDataSize =3D=3D 0)) > + ) > + { > DEBUG ((DEBUG_ERROR, "%a: Mismatched values of RequestData or > RequestDataSize.\n", __FUNCTION__)); > return EFI_INVALID_PARAMETER; > } >=20 > - Length =3D sizeof (NetFunction) + sizeof (Command); > + // Validation on TransmitHeader and TransmitHeaderSize. > + if (((TransmitHeader =3D=3D NULL) && (TransmitHeaderSize !=3D 0)) || > + ((TransmitHeader !=3D NULL) && (TransmitHeaderSize =3D=3D 0)) > + ) > + { > + DEBUG ((DEBUG_ERROR, "%a: Mismatched values of TransmitHeader or > TransmitHeaderSize.\n", __FUNCTION__)); > + return EFI_INVALID_PARAMETER; > + } > + > + // Validation on TransmitHeader and TransmitHeaderSize. > + if (((TransmitTrailer =3D=3D NULL) && (TransmitTrailerSize !=3D 0)) || > + ((TransmitTrailer !=3D NULL) && (TransmitTrailerSize =3D=3D 0)) > + ) > + { > + DEBUG ((DEBUG_ERROR, "%a: Mismatched values of TransmitTrailer or > TransmitTrailerSize.\n", __FUNCTION__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Length =3D TransmitHeaderSize; > if (RequestData !=3D NULL) { > Length =3D Length + RequestDataSize; > } >=20 > + if ((TransmitTrailer !=3D NULL) && (TransmitTrailerSize !=3D 0)) { > + Length +=3D TransmitTrailerSize; > + } > + > Buffer =3D AllocateZeroPool (Length); > if (Buffer =3D=3D NULL) { > return EFI_OUT_OF_RESOURCES; > } >=20 > // > - // Buffer[0] =3D NetFunction > - // Buffer[1] =3D Command > - // Buffer [2..RequestDataSize] =3D RequestData > + // Buffer[0..(TransmitHeaderSize - 1)] =3D TransmitHeader // Buffer > + [TransmitHeader..(TransmitHeader + RequestDataSize - 1)] =3D RequestDat= a > + // Buffer [(TransmitHeader + RequestDataSize)..(TransmitHeader + > + RequestDataSize + TransmitTrailerSize - 1)] =3D TransmitTrailer > // > BufferPtr =3D Buffer; > - CopyMem (BufferPtr, &NetFunction, sizeof (NetFunction)); > - BufferPtr +=3D sizeof (NetFunction); > - CopyMem (BufferPtr, &Command, sizeof (Command)); > - BufferPtr +=3D sizeof (Command); > - if (Length > (sizeof (NetFunction) + sizeof (Command))) { > + CopyMem ((VOID *)BufferPtr, (VOID *)TransmitHeader, > + TransmitHeaderSize); BufferPtr +=3D TransmitHeaderSize; if > + (RequestData !=3D NULL) { > CopyMem (BufferPtr, RequestData, RequestDataSize); > } >=20 > + BufferPtr +=3D RequestDataSize; > + if (TransmitTrailer !=3D NULL) { > + CopyMem (BufferPtr, (VOID *)TransmitTrailer, TransmitTrailerSize); > + } > + > BufferPtr =3D Buffer; >=20 > // Step 1. wait for IBF to get clear > @@ -293,10 +324,11 @@ KcsTransportRead ( > EFI_STATUS Status; > UINT32 ReadLength; >=20 > - if (DataByte =3D=3D NULL || *Length =3D=3D 0) { > + if ((DataByte =3D=3D NULL) || (*Length =3D=3D 0)) { > DEBUG ((DEBUG_ERROR, "%a: Either DataByte is NULL or Length is 0.\n"= , > __FUNCTION__)); > return EFI_INVALID_PARAMETER; > } > + > ReadLength =3D 0; > while (ReadLength < *Length) { > // Step 1. wait for IBF to get clear @@ -350,8 +382,10 @@ KcsTranspo= rtRead > ( > /** > This service communicates with BMC using KCS protocol. >=20 > - @param[in] NetFunction Net function of the command. > - @param[in] Command IPMI Command. > + @param[in] TransmitHeader KCS packet header. > + @param[in] TransmitHeaderSize KCS packet header size in byte. > + @param[in] TransmitTrailer KCS packet trailer. > + @param[in] TransmitTrailerSize KCS packet trailer size in byte. > @param[in] RequestData Command Request Data. > @param[in] RequestDataSize Size of Command Request Data. > @param[out] ResponseData Command Response Data. The compl= etion > @@ -380,12 +414,14 @@ KcsTransportRead ( EFI_STATUS EFIAPI > KcsTransportSendCommand ( > - IN UINT8 NetFunction, > - IN UINT8 Command, > - IN UINT8 *RequestData OPTIONAL, > - IN UINT32 RequestDataSize, > - OUT UINT8 *ResponseData OPTIONAL, > - IN OUT UINT32 *ResponseDataSize OPTIONAL > + IN MANAGEABILITY_TRANSPORT_HEADER TransmitHeader, > + IN UINT16 TransmitHeaderSize, > + IN MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer OPTIONAL, > + IN UINT16 TransmitTrailerSize, > + IN UINT8 *RequestData OPTIONAL, > + IN UINT32 RequestDataSize, > + OUT UINT8 *ResponseData OPTIONAL, > + IN OUT UINT32 *ResponseDataSize OPTIONAL > ) > { > EFI_STATUS Status; > @@ -393,30 +429,41 @@ KcsTransportSendCommand ( > IPMI_KCS_RESPONSE_HEADER RspHeader; >=20 > if ((RequestData !=3D NULL) && (RequestDataSize =3D=3D 0)) { > - DEBUG((DEBUG_ERROR, "%a: Mismatched values of RequestData and > RequestDataSize\n", __FUNCTION__)); > + DEBUG ((DEBUG_ERROR, "%a: Mismatched values of RequestData and > + RequestDataSize\n", __FUNCTION__)); > return EFI_INVALID_PARAMETER; > } >=20 > if ((ResponseData !=3D NULL) && ((ResponseDataSize !=3D NULL) && > (*ResponseDataSize =3D=3D 0))) { > - DEBUG((DEBUG_ERROR, "%a: Mismatched values of ResponseData and > ResponseDataSize\n", __FUNCTION__)); > + DEBUG ((DEBUG_ERROR, "%a: Mismatched values of ResponseData and > ResponseDataSize\n", __FUNCTION__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (TransmitHeader =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: TransmitHeader is NULL\n", > + __FUNCTION__)); > return EFI_INVALID_PARAMETER; > } >=20 > + // > + // Print out the request payloads. > + HelperManageabilityDebugPrint ((VOID *)TransmitHeader, > + TransmitHeaderSize, "KCS Transmit Header:\n"); if (RequestData !=3D NU= LL) { > + HelperManageabilityDebugPrint ((VOID *)RequestData, > + RequestDataSize, "KCS Request Data:\n"); } > + > + if (TransmitTrailer !=3D NULL) { > + HelperManageabilityDebugPrint ((VOID *)TransmitTrailer, > + TransmitTrailerSize, "KCS Transmit Trailer:\n"); } > + > Status =3D KcsTransportWrite ( > - (NetFunction << 2), > - Command, > + TransmitHeader, > + TransmitHeaderSize, > + TransmitTrailer, > + TransmitTrailerSize, > RequestData, > RequestDataSize > ); > if (EFI_ERROR (Status)) { > - DEBUG (( > - DEBUG_ERROR, > - "IPMI KCS Write Failed with Status(%r) for NetFunction(0x%x)," \ > - " Command(0x%x).\n", > - Status, > - NetFunction, > - Command > - )); > + DEBUG ((DEBUG_ERROR, "IPMI KCS Write Failed with Status(%r)", > + Status)); > return Status; > } >=20 > @@ -429,7 +476,7 @@ KcsTransportSendCommand ( > DEBUG_ERROR, > "IPMI KCS read response header failed Status(%r), " \ > "RspNetFunctionLun =3D 0x%x, " \ > - "Comamnd =3D 0x%x \n", > + "Command =3D 0x%x \n", > Status, > RspHeader.NetFunc, > RspHeader.Command > @@ -437,16 +484,21 @@ KcsTransportSendCommand ( > return (Status); > } >=20 > - Status =3D KcsTransportRead ((UINT8 *)ResponseData, ResponseDataSize); > - if (EFI_ERROR (Status)) { > - DEBUG (( > - DEBUG_ERROR, > - "IPMI KCS response read Failed with Status(%r) for NetFunction(0x%= x)," \ > - " Command(0x%x).\n", > - Status, > - NetFunction, > - Command > - )); > + // > + // Print out the response payloads. > + HelperManageabilityDebugPrint ((VOID *)&RspHeader, > + (UINT16)RspHeaderSize, "KCS Response Header:\n"); > + > + if ((ResponseData !=3D NULL) && (ResponseDataSize !=3D NULL) && > (*ResponseDataSize !=3D 0)) { > + Status =3D KcsTransportRead ((UINT8 *)ResponseData, ResponseDataSize= ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "IPMI KCS response read Failed with Status(%r= )", > Status)); > + } > + > + // > + // Print out the response payloads. > + HelperManageabilityDebugPrint ((VOID *)ResponseData, > + *ResponseDataSize, "KCS Response Data:\n"); } else { > + *ResponseDataSize =3D 0; > } >=20 > return Status; > diff --git > a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Mana > geabilityTransportKcs.c > b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Mana > geabilityTransportKcs.c > index 7d85378fc1..c236354605 100644 > --- > a/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/Mana > geabilityTransportKcs.c > +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe > +++ /ManageabilityTransportKcs.c > @@ -218,23 +218,25 @@ KcsTransportTransmitReceive ( > IN MANAGEABILITY_TRANSFER_TOKEN *TransferToken > ) > { > - EFI_STATUS Status; > - MANAGEABILITY_IPMI_TRANSPORT_HEADER *TransmitHeader; > + EFI_STATUS Status; >=20 > if ((TransportToken =3D=3D NULL) || (TransferToken =3D=3D NULL)) { > DEBUG ((DEBUG_ERROR, "%a: Invalid transport token or transfer token.= \n", > __FUNCTION__)); > return; > } >=20 > - TransmitHeader =3D (MANAGEABILITY_IPMI_TRANSPORT_HEADER > *)TransferToken->TransmitHeader; > - if (TransmitHeader =3D=3D NULL) { > + // Transmit header is necessary for KCS transport, which could be // > + NetFn, Command and etc. > + if (TransferToken->TransmitHeader =3D=3D NULL) { > TransferToken->TransferStatus =3D EFI_INVALID_PARAMETER; > return; > } >=20 > Status =3D KcsTransportSendCommand ( > - TransmitHeader->NetFn, > - TransmitHeader->Command, > + TransferToken->TransmitHeader, > + TransferToken->TransmitHeaderSize, > + TransferToken->TransmitTrailer, > + TransferToken->TransmitTrailerSize, > TransferToken->TransmitPackage.TransmitPayload, > TransferToken->TransmitPackage.TransmitSizeInByte, > TransferToken->ReceivePackage.ReceiveBuffer, > diff --git > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC > ommon.c > b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC > ommon.c > index 82bae58292..b055bad7da 100644 > --- > a/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtocolC > ommon.c > +++ b/Features/ManageabilityPkg/Universal/IpmiProtocol/Common/IpmiProtoc > +++ olCommon.c > @@ -65,21 +65,23 @@ SetupIpmiTransportHardwareInformation ( > This functions setup the final header/body/trailer packets for > the acquired transport interface. >=20 > - @param[in] TransportToken The transport interface. > - @param[in] NetFunction IPMI function. > - @param[in] Command IPMI command. > - @param[out] PacketHeader The pointer to receive header of re= quest. > - @param[in, out] PacketBody The request body. > - When IN, it is the caller's request= body. > - When OUT and NULL, the request body= is not > - changed. > - When OUT and non-NULL, the request = body is > - changed to conform the transport in= terface. > - @param[in, out] PacketBodySize The request body size. > - When OUT and non-zero, it is the ne= w data > - length of request body. > - When OUT and zero, the request body= is unchanged. > - @param[out] PacketTrailer The pointer to receive trailer of r= equest. > + @param[in] TransportToken The transport interface. > + @param[in] NetFunction IPMI function. > + @param[in] Command IPMI command. > + @param[out] PacketHeader The pointer to receive header of= request. > + @param[out] PacketHeaderSize Pinter to receive packet header = size in > byte. > + @param[in, out] PacketBody The request body. > + When IN, it is the caller's requ= est body. > + When OUT and NULL, the request b= ody is not > + changed. > + Whee out and non-NULL, the reque= st body is > + changed to comfort the transport= interface. > + @param[in, out] PacketBodySize The request body size. > + When IN and non-zero, it is the = new data > + length of request body. > + When IN and zero, the request bo= dy is unchanged. > + @param[out] PacketTrailer The pointer to receive trailer o= f request. > + @param[out] PacketTrailerSize Pinter to receive packet trailer= size in byte. >=20 > @retval EFI_SUCCESS Request packet is returned. > @retval EFI_UNSUPPORTED Request packet is not returned because > @@ -91,9 +93,11 @@ SetupIpmiRequestTransportPacket ( > IN UINT8 NetFunction, > IN UINT8 Command, > OUT MANAGEABILITY_TRANSPORT_HEADER *PacketHeader OPTIONAL, > + OUT UINT16 *PacketHeaderSize, > IN OUT UINT8 **PacketBody OPTIONAL, > IN OUT UINT32 *PacketBodySize OPTIONAL, > - OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL > + OUT MANAGEABILITY_TRANSPORT_TRAILER *PacketTrailer OPTIONAL, > + OUT UINT16 *PacketTrailerSize > ) > { > MANAGEABILITY_IPMI_TRANSPORT_HEADER *IpmiHeader; @@ -105,18 > +109,24 @@ SetupIpmiRequestTransportPacket ( > return EFI_OUT_OF_RESOURCES; > } >=20 > + *PacketHeaderSize =3D 0; > + *PacketTrailerSize =3D 0; > IpmiHeader->Command =3D Command; > IpmiHeader->Lun =3D 0; > IpmiHeader->NetFn =3D NetFunction; > if (PacketHeader !=3D NULL) { > - *PacketHeader =3D (MANAGEABILITY_TRANSPORT_HEADER *)IpmiHeader; > + *PacketHeader =3D (MANAGEABILITY_TRANSPORT_HEADER *)IpmiHeader= ; > + *PacketHeaderSize =3D sizeof (MANAGEABILITY_IPMI_TRANSPORT_HEADER)= ; > } > + > if (PacketTrailer !=3D NULL) { > *PacketTrailer =3D NULL; > } > + > if (PacketBody !=3D NULL) { > *PacketBody =3D NULL; > } > + > if (PacketBodySize !=3D NULL) { > *PacketBodySize =3D 0; > } > @@ -124,6 +134,7 @@ SetupIpmiRequestTransportPacket ( > DEBUG ((DEBUG_ERROR, "%a: No implementation of building up packet.", > __FUNCTION__)); > ASSERT (FALSE); > } > + > return EFI_SUCCESS; > } >=20 > @@ -164,6 +175,8 @@ CommonIpmiSubmitCommand ( > MANAGEABILITY_TRANSPORT_HEADER IpmiTransportHeader; > MANAGEABILITY_TRANSPORT_TRAILER IpmiTransportTrailer; > MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS > TransportAdditionalStatus; > + UINT16 HeaderSize; > + UINT16 TrailerSize; >=20 > if (TransportToken =3D=3D NULL) { > DEBUG ((DEBUG_ERROR, "%a: No transport toke for IPMI\n", > __FUNCTION__)); @@ -179,8 +192,8 @@ CommonIpmiSubmitCommand ( > return Status; > } >=20 > - ThisRequestData =3D RequestData; > - ThisRequestDataSize =3D RequestDataSize; > + ThisRequestData =3D RequestData; > + ThisRequestDataSize =3D RequestDataSize; > IpmiTransportHeader =3D NULL; > IpmiTransportTrailer =3D NULL; > Status =3D SetupIpmiRequestTransportPacket ( > @@ -188,9 +201,11 @@ CommonIpmiSubmitCommand ( > NetFunction, > Command, > &IpmiTransportHeader, > + &HeaderSize, > &ThisRequestData, > &ThisRequestDataSize, > - &IpmiTransportTrailer > + &IpmiTransportTrailer, > + &TrailerSize > ); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: Fail to build packets - (%r)\n", __FUNCTIO= N__, > Status)); @@ -198,12 +213,13 @@ CommonIpmiSubmitCommand ( > } >=20 > ZeroMem (&TransferToken, sizeof (MANAGEABILITY_TRANSFER_TOKEN)); > - TransferToken.TransmitHeader =3D IpmiTransportHeader; > - TransferToken.TransmitTrailer =3D IpmiTransportTrailer; > + TransferToken.TransmitHeader =3D IpmiTransportHeader; > + TransferToken.TransmitHeaderSize =3D HeaderSize; > + TransferToken.TransmitTrailer =3D IpmiTransportTrailer; > + TransferToken.TransmitTrailerSize =3D TrailerSize; >=20 > // Transmit packet. > if ((ThisRequestData =3D=3D NULL) || (ThisRequestDataSize =3D=3D 0)) { > - > // Transmit parameter were not changed by > SetupIpmiRequestTransportPacket(). > TransferToken.TransmitPackage.TransmitPayload =3D RequestData; > TransferToken.TransmitPackage.TransmitSizeInByte =3D RequestDataSize= ; @@ > -247,5 +263,6 @@ CommonIpmiSubmitCommand ( > if (ResponseDataSize !=3D NULL) { > *ResponseDataSize =3D TransferToken.ReceivePackage.ReceiveSizeInByte= ; > } > + > return Status; > } > diff --git a/Features/ManageabilityPkg/Readme.md > b/Features/ManageabilityPkg/Readme.md > index 2ecee96313..81c9322b98 100644 > --- a/Features/ManageabilityPkg/Readme.md > +++ b/Features/ManageabilityPkg/Readme.md > @@ -99,7 +99,9 @@ library to compliant with the framework of > ManageabilityPkg design. > struct _MANAGEABILITY_TRANSFER_TOKEN { > EFI_EVENT ReceiveEvent; > MANAGEABILITY_TRANSPORT_HEADER TransmitHeader; > + UINT16 TransmitHeaderSize; > MANAGEABILITY_TRANSPORT_TRAILER TransmitTrailer; > + UINT16 TransmitTrailerSize; > MANAGEABILITY_TRANSMIT_PACKAGE TransmitPackage; > MANAGEABILITY_RECEIVE_PACKAGE ReceivePackage; > EFI_STATUS TransferStatus; > @@ -124,6 +126,10 @@ library to compliant with the framework of > ManageabilityPkg design. > manageability transport library to make the transport implementation > agnostic to the > manageability protocol specification. >=20 > +* ***TransmitHeaderSize*** > + > + This indicates the size of TransmitHeader. > + > * ***TransmitTrailer*** >=20 > The transmit trailer may be different according to the disparate tra= nsport > @@ -131,6 +137,10 @@ library to compliant with the framework of > ManageabilityPkg design. > manageability transport library to make the transport implementation > agnostic to the > manageability protocol specification. >=20 > +* ***TransmitTrailerSize*** > + > + This indicates the size of TransmitTrailer. > + > * ***TransmitPackage*** >=20 > The buffer of packet to transmit, this could be a value of NULL if t= he > manageability > -- > 2.37.1.windows.1