From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.78]) by mx.groups.io with SMTP id smtpd.web11.2332.1681974246218949065 for ; Thu, 20 Apr 2023 00:04:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=BH5wXfl/; 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.94.78, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kQ09KIw8x/Bgw6D4bJXk0qCSbNHufOs6z6aZZZZEThewGh0YIZKyqcbemLU9UhamaTMjn4tCY3aG0Tx8TRCyfU0hEFBiAyD/SPDBEBjLBKU5Ui4dFtbWrn4bjbbNN7OEjsXqi9MnPBRLwD2w5DFnAjyH4hv59uGbJTtJ1uqymr9hCRTF8MkDL56nulRVDmbWjF7kRJHFu2BByMAPqGowKfQKZtx8ji/rTXvIoUQeAtpFYZZsL838zvKnBFNF4a4ACqP/M0rUmi1DbARAHiCp6h/rFj528YTVVHthYY1DvxzyLhe1xolAcfvGa489aC+UJcn0nPTcDdsoIA6hBKh5Sg== 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=RIcZqC5klMxkGt/IQYY3CJRpwer6d6ZbbTTnibG8TUw=; b=GBqzJnueHGdPOKh8Np0QLYBUrmc216mqEyQvQL0vtf1wCt2I+meIg6TQR74/ewsuG/GgSDFhO4qZjSGjUtr4ny+630Aaz2zgDPysfIEOtChKJkdNcIASk0MSl41Jk2Cs0Kj4JmdehGGXZT/CnV9UhbUjOEdBPd2jAAoi3/C/C1JPVrKpx5k51eYu9UtY/uB0pKRJHiMT2/SgKdovxe2imuS8xxkGOoaFuJR5IUWWdFOKrCi1g24JWEkaPSmRt6+Xnxi1UYDXsHQK1V2E5nNPtG4SdMFvlS7b7iYCRf9VowbDBnwW6RhrD++QL3Mw0B9THvHbSpFV9uPnlk5D7lYjNw== 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=RIcZqC5klMxkGt/IQYY3CJRpwer6d6ZbbTTnibG8TUw=; b=BH5wXfl/blsGqP1PqR1x7esA42keeoVBO+sjDy+H8yMSK+YJB2ugQpfTiz3lMGWnmICp+rNqXSt1T5/WzoBt3nnBR60pj8niEA7t4JWuLSv92ZdttUOU9QKDEXoIX9tSv+eZLs6Optdz38YKJPbowxDVx//v2grzDyndG9B0zAaUUpP9QnY7Zd23cDVm+UQWvCf9cOFRAgvZYFPXQV9t1GKUgxU9oPCdqsJDflecnPkzpJ4U954tTZLiG4+kXH30iwIbSZ/FCxztxEHJoCxlNZ1jv/BtrUSBUpKqdntL1+hIuhhL1/i/GtsAw9Yc9CrJnrsp2rAUN2Gi8wP2bRWZmw== Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by PH0PR12MB7789.namprd12.prod.outlook.com (2603:10b6:510:283::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Thu, 20 Apr 2023 07:04:03 +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 07:04:03 +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 10/14] ManageabilityPkg: Add MCTP transport interface Thread-Topic: [edk2-platforms][PATCH V2 10/14] ManageabilityPkg: Add MCTP transport interface Thread-Index: AQHZccW09EALiOrNhk2PKGPJG3zR5K8zyEuw Date: Thu, 20 Apr 2023 07:04:03 +0000 Message-ID: References: <20230418071543.1951-1-abner.chang@amd.com> <20230418071543.1951-11-abner.chang@amd.com> In-Reply-To: <20230418071543.1951-11-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_|PH0PR12MB7789:EE_ x-ms-office365-filtering-correlation-id: 5074fb64-58cd-40a0-f20f-08db416d6c91 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JnUL7rmeRazDNrIWnyjG5mKDbZQBQPSQ5p/Ca7GgUKVSj5OodA35LIVz+YQo+xEvRAgKAznBNwS8pJlft17z9WWVyb3yPsDvz/5APClpTpkVlErJOpT7tbFp46OodmrKKalNVyt2lJU1MbD1ealWR0Mytn4OuupjPI7SLck9qjqF9+a8MQz2Zanr/RhaJCEQ1BU4GucEo9MF3VMRqlPlTJMbiOnM+2nn9FDDcK1AKExYYZngaXF3IS6QVcBQTeJR7cw252jhdm6+ixL8JP5+23N6rAG3s+j0ylKqg7B82FJj3VvA0+mtwdW+G4qD/YG5TNB//Aq4wug7SPCKN0Na0MCzu5ddZ7DJ/nHdJOjyLhFIFYWfw5Zivd3PRN4K82aw/87B1NtQZHDxAqqC/IsQZUXmQpL19hmYtC23QQTH2bDqT05q1VZJJzOsp5S0MSuxsmzwpNM6hfHdZmYH6aIF7Ax5wAe6A9mI/YnsE62AIRPdxC5TiXIE/ZM9Np2NYshH1//98Pw3Iy9UwcspyU+SNaykiavZs/Zv/Ax3XeS8tbm2l9PGezFKzauLk4IdTC/Ex7avUQzT5+Q679CVc4rmTE/dCsqU1giQdfrRjiAwovEy2iLFMR/6yyQTuGjmf0BVRpkTWYeQ2pDykp0OWoQY5w== 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)(136003)(376002)(346002)(39860400002)(396003)(366004)(451199021)(66946007)(64756008)(66556008)(2906002)(30864003)(66446008)(66476007)(86362001)(4326008)(5660300002)(52536014)(8936002)(41300700001)(55016003)(76116006)(54906003)(478600001)(33656002)(110136005)(316002)(71200400001)(7696005)(26005)(9686003)(186003)(122000001)(6506007)(83380400001)(53546011)(8676002)(38070700005)(38100700002)(579004)(44824005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?zBiun6k4biZ7ExVLNEYZY6R1btH4bHf/s7bE3QhZZPW/DHScJ16cwoUSDaOZ?= =?us-ascii?Q?qyUke1ILBVKp0AvDA+Wq9BkkpY8tEYwTbV9ltLS+KLePSbLMyrdY39tkXjT/?= =?us-ascii?Q?n1KSpygLcIot4gqCmK8p5QF+OY5UJbQMmW5LD4iXcFMVSiuoDaHaLFa4Pq4f?= =?us-ascii?Q?oeK8h5PvydAKH0suFYCyrw4yaorcN5tZ9ZQaKyuLK2nYqZndYNAlcKlgGASa?= =?us-ascii?Q?yTD7anMSB67hjsroVX7p6ulhykkQzh/bnGrLgkxY/NItxLTpRcse0t4iJzXI?= =?us-ascii?Q?5k9paAczdwUkP8qkFWTpGefHAZZm3mH4XzHSyMT7A1ktteW754WHJ9wfkfdC?= =?us-ascii?Q?UyQGlg+9+NH0C+32nifav4osLV22Wa311QsNvFJAtjLantOYo2I3FaxzWBJ2?= =?us-ascii?Q?PYWmHhSPHDp1PXjRqJMOuJFQ5wW+DX5Og7Bl/y4Tazwve4RADjM9qARBhMwK?= =?us-ascii?Q?OuHa01golN4rQqg1G1CgjkxVbWjnRGQTclHteS2QXm6uWFqzm7NCz9T6cp58?= =?us-ascii?Q?j6ggwnPkxrp+h5RrA/OIFmt2okHcEmTtUTH3J3tmBB+7/b84xB3+BbLpl+Zz?= =?us-ascii?Q?qY/FBhiaH/dAQsbl6JeAW1THacHNoB1asmPIOtmtIHswFhsLAAdvDGmsxkGB?= =?us-ascii?Q?mp4ckUt/m4VrF+AJJ4lXHEhiDtp09wCD9WPsoeAbCp64ObEATt+3/shlsivg?= =?us-ascii?Q?UP4pJpye+bm8rkpk01vn2HFf4hlN6E17b5zx3607F8nj57hUuuczHFSrGgmL?= =?us-ascii?Q?1fSdRR2DZk6ijL0karB0ImFQU15oEeOGhgxvSNG3NU7bv61dhoX1eMlI+lvv?= =?us-ascii?Q?1xTU2j799/YcQ34J/1c51ECFTuY3wf9ld+ydebVOeq71BZMZNQ0lWtWh0BIm?= =?us-ascii?Q?9/XBBuwA13m6fVIRhSvSLoUCuX1slIvrIVU9XgyAioRZyaCUSjXanV5By99l?= =?us-ascii?Q?Wo5G1ketOU30TN/O+vuJhZj6L9aDPvDfP45+x+8ACtUW3Wfw6x/bcvgQGjI9?= =?us-ascii?Q?n0vM1DccGhhq//wuJEcZwJk+jDDJu+i5BzptNdXzBoTXZxRLMtGAGew2GUxi?= =?us-ascii?Q?uJt0xYX4VmLJTJ4MslcpzqThFVLCGWZgWEIl+/k/BNMdfTKSxkJrwptN6wep?= =?us-ascii?Q?4cKo+GUR2W1MJd2Mz5d9vrpwODAmxpiVD1Kqqc4VjNNqt69ANkgxwlNkN4zI?= =?us-ascii?Q?kl8ezYVCUYH3bW5SnWHS46I4QQm5F2njpe7lw7x1fcYqUW+1onPPNJWBd3qU?= =?us-ascii?Q?MYWjZKWYlFo/BxHh0X9H20E2i9K0Q4Z3wP5l0tZ4cVuEWkWtXI8KRwidFd2U?= =?us-ascii?Q?kqEJQ6lDgLbkm7HjkNYB3C284yHv7ZsIoXE1dfbU0h7n89ZDs+upm//BJOad?= =?us-ascii?Q?dl33QRTpJiApmM50w6bLs3Udyv31johTufHiDczTlF+2LN45bLH57pw6j0UL?= =?us-ascii?Q?WYfahFG5RaBEM3DzYr2LCVQEyfGdFp7ism9gLaW97Epl1v61U9bFUVTIlkH4?= =?us-ascii?Q?r8t4vQhOzkxlSj7Nh2uJ3xi2zHwMuTYTqUc2fSVfvqsWth71Ci0wd0c93dSk?= =?us-ascii?Q?Bozw7qU5TU8nUZ9xFTM=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: 5074fb64-58cd-40a0-f20f-08db416d6c91 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2023 07:04:03.1642 (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: ukUjMUv3C2kP6N02m7F0zYnJ1vcnpaS2PwuQVuX25N7upAvrkPnqj2y738FTWXqWdItDHPChh1SfKwMRmLAQ6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7789 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Please find my comments below. 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 10/14] ManageabilityPkg: Add MCTP > transport interface >=20 > External email: Use caution opening links or attachments >=20 >=20 > From: Abner Chang >=20 > Add MCTP manageability transport interface library. >=20 > The functionality is verified by checking the binary debug output of payl= oad. >=20 > Signed-off-by: Abner Chang > Cc: Isaac Oram > Cc: Abdul Lateef Attar > Cc: Nickle Wang > Cc: Igor Kulchytskyy > --- > .../ManageabilityPkg/ManageabilityPkg.dsc | 1 + > .../Dxe/DxeManageabilityTransportMctp.inf | 44 +++ > .../Dxe/ManageabilityTransportMctp.h | 26 ++ > .../Dxe/ManageabilityTransportMctp.c | 367 ++++++++++++++++++ > .../Dxe/ManageabilityTransportMctp.uni | 13 + > 5 files changed, 451 insertions(+) > create mode 100644 > Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeM > anageabilityTransportMctp.inf > create mode 100644 > Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Mana > geabilityTransportMctp.h > create mode 100644 > Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Mana > geabilityTransportMctp.c > create mode 100644 > Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Mana > geabilityTransportMctp.uni >=20 > diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc > b/Features/ManageabilityPkg/ManageabilityPkg.dsc > index 412029ef6c..959b3eabd2 100644 > --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc > +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc > @@ -37,6 +37,7 @@ >=20 > [Components] >=20 > ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageabilit= y > TransportKcs.inf > + > + > ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageab > + ilityTransportMctp.inf > ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf >=20 > [LibraryClasses] > diff --git > a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Dxe > ManageabilityTransportMctp.inf > b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Dxe > ManageabilityTransportMctp.inf > new file mode 100644 > index 0000000000..22ea37c516 > --- /dev/null > +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx > +++ e/DxeManageabilityTransportMctp.inf > @@ -0,0 +1,44 @@ > +## @file > +# MCTP instance of Manageability Transport Library # # Copyright (C) > +2023 Advanced Micro Devices, Inc. All rights reserved.
# > +SPDX-License-Identifier: BSD-2-Clause-Patent # ## > + > +[Defines] > + INF_VERSION =3D 0x0001001B > + BASE_NAME =3D DxeManageabilityTransportMctp > + MODULE_UNI_FILE =3D ManageabilityTransportMctp.uni > + FILE_GUID =3D 7770FA0F-4808-47BD-89F4-71718533248= 6 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D ManageabilityTransportLib > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 > +# > + > +[Sources] > + ManageabilityTransportMctp.c > + ManageabilityTransportMctp.h > + > +[Packages] > + ManageabilityPkg/ManageabilityPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + DebugLib > + MemoryAllocationLib > + UefiBootServicesTableLib > + > +[Protocols] > + gEdkiiMctpProtocolGuid > + > +[Guids] > + gManageabilityProtocolPldmGuid > + gManageabilityTransportMctpGuid > + > +[Depex] > + gEdkiiMctpProtocolGuid ## ALWAYS_CONSUMES > + > diff --git > a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma > nageabilityTransportMctp.h > b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma > nageabilityTransportMctp.h > new file mode 100644 > index 0000000000..1ce0d3a8bc > --- /dev/null > +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx > +++ e/ManageabilityTransportMctp.h > @@ -0,0 +1,26 @@ > +/** @file > + > + Manageability transport MCTP internal used definitions. > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > +reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#ifndef MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_ > +#define MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_ > + > +#include > + > +#define MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE SIGNATURE_32 > ('M', 'T', > +'M', 'C') > + > +/// > +/// Manageability transport KCS internal data structure. > +/// > +typedef struct { > + UINTN Signature; > + MANAGEABILITY_TRANSPORT_TOKEN Token; > +} MANAGEABILITY_TRANSPORT_MCTP; > + > +#define MANAGEABILITY_TRANSPORT_MCTP_FROM_LINK(a) CR (a, > +MANAGEABILITY_TRANSPORT_MCTP, Token, > +MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE) > + > +#endif // MANAGEABILITY_TRANSPORT_MCTP_LIB_INTERNAL_H_ > diff --git > a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma > nageabilityTransportMctp.c > b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma > nageabilityTransportMctp.c > new file mode 100644 > index 0000000000..5b186e53f3 > --- /dev/null > +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx > +++ e/ManageabilityTransportMctp.c > @@ -0,0 +1,367 @@ > +/** @file > + > + MCTP instance of Manageability Transport Library > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > + reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +*/ > + > +#include > +#include > +#include > +#include #include > + > +#include > +#include > +#include > +#include > + > +#include "ManageabilityTransportMctp.h" > + > +MANAGEABILITY_TRANSPORT_MCTP *mSingleSessionToken =3D NULL; > +EDKII_MCTP_PROTOCOL *mMctpProtocol =3D NULL; > + > +EFI_GUID *SupportedManageabilityProtocol[] =3D { > + &gManageabilityProtocolPldmGuid > +}; This is global variable and I think we need 'm' prefix for it. > + > +UINT8 NumberOfSupportedProtocol =3D (sizeof > +(SupportedManageabilityProtocol)/sizeof (EFI_GUID *)); > + This is global variable and I think we need 'm' prefix for it. > +/** > + This function initializes the transport interface. > + > + @param [in] TransportToken The transport token acquired thr= ough > + AcquireTransportSession function= . > + @param [in] HardwareInfo The hardware information > + assigned to MCTP transport inter= face. > + > + @retval EFI_SUCCESS Transport interface is initializ= ed > + successfully. > + @retval EFI_INVALID_PARAMETER The invalid transport token. > + @retval EFI_NOT_READY The transport interface works fi= ne but > + @retval is not ready. > + @retval EFI_DEVICE_ERROR The transport interface has prob= lems. > + @retval EFI_ALREADY_STARTED Teh protocol interface has alrea= dy > initialized. > + @retval Otherwise Other errors. > + > +**/ > +EFI_STATUS > +EFIAPI > +MctpTransportInit ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, > + IN MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInfo > +OPTIONAL > + ) > +{ > + return EFI_SUCCESS; > +} > + > +/** > + This function returns the transport interface status. > + The generic EFI_STATUS is returned to caller directly, The additional > + information of transport interface could be optionally returned in > + TransportAdditionalStatus to describes the status that can't be > + described obviously through EFI_STATUS. > + See the definition of MANAGEABILITY_TRANSPORT_STATUS. > + > + @param [in] TransportToken The transport token acquired = through > + AcquireTransportSession funct= ion. > + @param [out] TransportAdditionalStatus The additional status of tran= sport > + interface. > + NULL means no additional stat= us of this > + transport interface. > + > + @retval EFI_SUCCESS Transport interface status is re= turned. > + @retval EFI_INVALID_PARAMETER The invalid transport token. > + @retval EFI_DEVICE_ERROR The transport interface has prob= lems to > return > + @retval EFI_UNSUPPORTED The transport interface doesn't = have > status report. > + Otherwise Other errors. > + > +**/ > +EFI_STATUS > +EFIAPI > +MctpTransportStatus ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, > + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS > +*TransportAdditionalStatus OPTIONAL > + ) > +{ > + if (TransportToken =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Invalid transport token.\n", __FUNCTION__)= ); > + return EFI_INVALID_PARAMETER; > + } > + > + if (TransportAdditionalStatus !=3D NULL) { > + *TransportAdditionalStatus =3D > + MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NO_ERRORS; > + } > + > + return EFI_SUCCESS; > +} > + > +/** > + This function resets the transport interface. > + The generic EFI_STATUS is returned to caller directly after reseting > +transport > + interface. The additional information of transport interface could be > +optionally > + returned in TransportAdditionalStatus to describes the status that > +can't be > + described obviously through EFI_STATUS. > + See the definition of MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS. > + > + @param [in] TransportToken The transport token acquired = through > + AcquireTransportSession funct= ion. > + @param [out] TransportAdditionalStatus The additional status of spec= ific > transport > + interface after the reset. > + NULL means no additional stat= us of this > + transport interface. > + > + @retval EFI_SUCCESS Transport interface status is re= turned. > + @retval EFI_INVALID_PARAMETER The invalid transport token. > + @retval EFI_TIMEOUT The reset process is time out. > + @retval EFI_DEVICE_ERROR The transport interface has prob= lems to > return > + status. > + Otherwise Other errors. > + > +**/ > +EFI_STATUS > +EFIAPI > +MctpTransportReset ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, > + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS > +*TransportAdditionalStatus OPTIONAL > + ) > +{ > + if (TransportAdditionalStatus !=3D NULL) { > + *TransportAdditionalStatus =3D > +MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NOT_AVAILABLE; > + } > + > + return EFI_UNSUPPORTED; > +} > + > +/** > + This function transmit the request over target transport interface. > + The generic EFI_STATUS is returned to caller directly after reseting > +transport > + interface. The additional information of transport interface could be > +optionally > + returned in TransportAdditionalStatus to describes the status that > +can't be > + described obviously through EFI_STATUS. > + See the definition of MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS. > + > + @param [in] TransportToken The transport token acquired thr= ough > + AcquireTransportSession function= . > + @param [in] TransferToken The transfer token, see the defi= nition of > + MANAGEABILITY_TRANSFER_TOKEN. > + > + @retval The EFI status is returned in MANAGEABILITY_TRANSFER_TOKE= N. > + > +**/ > +VOID > +EFIAPI > +MctpTransportTransmitReceive ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, > + IN MANAGEABILITY_TRANSFER_TOKEN *TransferToken > + ) > +{ > + EFI_STATUS Status; > + MANAGEABILITY_MCTP_TRANSPORT_HEADER *TransmitHeader; > + > + if (TransportToken =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Invalid transport token.\n", __FUNCTION__)= ); > + TransferToken->TransportAdditionalStatus =3D > MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NOT_AVAILABLE; > + return; > + } > + > + TransmitHeader =3D (MANAGEABILITY_MCTP_TRANSPORT_HEADER > + *)TransferToken->TransmitHeader; if (TransmitHeader =3D=3D NULL) { > + TransferToken->TransferStatus =3D EFI_INVALID_PARAMETER; > + TransferToken->TransportAdditionalStatus =3D > MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS_NOT_AVAILABLE; > + return; > + } > + > + if (mMctpProtocol =3D=3D NULL) { > + Status =3D gBS->LocateProtocol ( > + &gEdkiiMctpProtocolGuid, > + NULL, > + (VOID **)&mMctpProtocol > + ); > + if (EFI_ERROR (Status)) { > + // > + // Dxe MCTP Protocol is not installed. > + // > + DEBUG ((DEBUG_ERROR, "%a: EDKII MCTP protocol is not found - %r\n"= , > Status)); "__func__" is missing in debug macro. Nickle > + return; > + } > + } > + > + DEBUG (( > + DEBUG_MANAGEABILITY_INFO, > + "%a: MCTP message type: 0x%x, SourceEndpointId: 0x%x, > DestinationEndpointId: 0x%x\n", > + __FUNCTION__, > + TransmitHeader->MessageHeader.MessageType, > + TransmitHeader->SourceEndpointId, > + TransmitHeader->DestinationEndpointId > + )); > + DEBUG (( > + DEBUG_MANAGEABILITY_INFO, > + " - Request message size: 0x%x, Response message size: %x\n", > + TransferToken->TransmitPackage.TransmitSizeInByte, > + TransferToken->ReceivePackage.ReceiveSizeInByte > + )); > + Status =3D mMctpProtocol->Functions.Version1_0->MctpSubmitCommand ( > + mMctpProtocol, > + TransmitHeader->Messag= eHeader.MessageType, > + TransmitHeader->Source= EndpointId, > + TransmitHeader->Destin= ationEndpointId, > + (BOOLEAN)TransmitHeade= r- > >MessageHeader.IntegrityCheck, > + TransferToken->Transmi= tPackage.TransmitPayload, > + TransferToken- > >TransmitPackage.TransmitSizeInByte, > + TransferToken- > >TransmitPackage.TransmitTimeoutInMillisecond, > + TransferToken->Receive= Package.ReceiveBuffer, > + &TransferToken- > >ReceivePackage.ReceiveSizeInByte, > + TransferToken- > >ReceivePackage.TransmitTimeoutInMillisecond, > + &TransferToken->Transp= ortAdditionalStatus > + ); > + TransferToken->TransferStatus =3D Status; } > + > +/** > + This function acquires to create a transport session to transmit > +manageability > + packet. A transport token is returned to caller for the follow up oper= ations. > + > + @param [in] ManageabilityProtocolSpec The protocol spec the transpo= rt > interface is acquired. > + @param [out] TransportToken The pointer to receive the tr= ansport > token created by > + the target transport interfac= e library. > + @retval EFI_SUCCESS Token is created successfully= . > + @retval EFI_OUT_OF_RESOURCES Out of resource to create a n= ew > transport session. > + @retval EFI_UNSUPPORTED Protocol is not supported on = this > transport interface. > + @retval Otherwise Other errors. > + > +**/ > +EFI_STATUS > +AcquireTransportSession ( > + IN EFI_GUID *ManageabilityProtocolSpec, > + OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken > + ) > +{ > + EFI_STATUS Status; > + MANAGEABILITY_TRANSPORT_MCTP *MctpTransportToken; > + > + if (ManageabilityProtocolSpec =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: No Manageability protocol specification > specified.\n", __FUNCTION__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D HelperManageabilityCheckSupportedSpec ( > + &gManageabilityTransportMctpGuid, > + SupportedManageabilityProtocol, > + NumberOfSupportedProtocol, > + ManageabilityProtocolSpec > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Protocol is not supported on this transpor= t > interface.\n", __FUNCTION__)); > + return EFI_UNSUPPORTED; > + } > + > + if (mSingleSessionToken !=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: This manageability transport library only > supports one session transport token.\n", __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + MctpTransportToken =3D (MANAGEABILITY_TRANSPORT_MCTP > *)AllocateZeroPool > + (sizeof (MANAGEABILITY_TRANSPORT_MCTP)); if (MctpTransportToken =3D=3D > NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for > MANAGEABILITY_TRANSPORT_MCTP\n", __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + MctpTransportToken->Token.Transport =3D AllocateZeroPool (sizeof > + (MANAGEABILITY_TRANSPORT)); if (MctpTransportToken->Token.Transport > =3D=3D NULL) { > + FreePool (MctpTransportToken); > + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for > MANAGEABILITY_TRANSPORT\n", __FUNCTION__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + MctpTransportToken->Signature = =3D > MANAGEABILITY_TRANSPORT_MCTP_SIGNATURE; > + MctpTransportToken->Token.ManageabilityProtocolSpecification = =3D > ManageabilityProtocolSpec; > + MctpTransportToken->Token.Transport->TransportVersion = =3D > MANAGEABILITY_TRANSPORT_TOKEN_VERSION; > + MctpTransportToken->Token.Transport- > >ManageabilityTransportSpecification =3D &gManageabilityTransportMctpGuid= ; > + MctpTransportToken->Token.Transport->TransportName = =3D > L"MCTP"; > + MctpTransportToken->Token.Transport->Function.Version1_0 = =3D > AllocateZeroPool (sizeof (MANAGEABILITY_TRANSPORT_FUNCTION_V1_0)); > + if (MctpTransportToken->Token.Transport->Function.Version1_0 =3D=3D NU= LL) { > + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for > MANAGEABILITY_TRANSPORT_FUNCTION_V1_0\n", __FUNCTION__)); > + FreePool (MctpTransportToken); > + FreePool (MctpTransportToken->Token.Transport); > + return EFI_OUT_OF_RESOURCES; > + } > + > + MctpTransportToken->Token.Transport->Function.Version1_0->TransportIni= t > =3D MctpTransportInit; > + MctpTransportToken->Token.Transport->Function.Version1_0- > >TransportReset =3D MctpTransportReset; > + MctpTransportToken->Token.Transport->Function.Version1_0- > >TransportStatus =3D MctpTransportStatus; > + > + MctpTransportToken->Token.Transport->Function.Version1_0->TransportTra > + nsmitReceive =3D MctpTransportTransmitReceive; > + > + mSingleSessionToken =3D MctpTransportToken; > + *TransportToken =3D &MctpTransportToken->Token; > + return EFI_SUCCESS; > +} > + > +/** > + This function returns the transport capabilities according to > + the manageability protocol. > + > + @param [in] TransportToken Transport token acquired from > manageability > + transport library. > + @param [out] TransportFeature Pointer to receive transport = capabilities. > + See the definitions of > + MANAGEABILITY_TRANSPORT_CAPAB= ILITY. > + @retval EFI_SUCCESS TransportCapability is return= ed successfully. > + @retval EFI_INVALID_PARAMETER TransportToken is not a valid= token. > +**/ > +EFI_STATUS > +GetTransportCapability ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, > + OUT MANAGEABILITY_TRANSPORT_CAPABILITY *TransportCapability > + ) > +{ > + if ((TransportToken =3D=3D NULL) || (TransportCapability =3D=3D NULL))= { > + return EFI_INVALID_PARAMETER; > + } > + > + *TransportCapability =3D 0; > + return EFI_SUCCESS; > +} > + > +/** > + This function releases the manageability session. > + > + @param [in] TransportToken The transport token acquired throu= gh > + AcquireTransportSession. > + @retval EFI_SUCCESS Token is released successfully. > + @retval EFI_INVALID_PARAMETER Invalid TransportToken. > + @retval Otherwise Other errors. > + > +**/ > +EFI_STATUS > +ReleaseTransportSession ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken > + ) > +{ > + EFI_STATUS Status; > + MANAGEABILITY_TRANSPORT_MCTP *MctpTransportToken; > + > + if (TransportToken =3D=3D NULL) { > + Status =3D EFI_INVALID_PARAMETER; > + } > + > + MctpTransportToken =3D MANAGEABILITY_TRANSPORT_MCTP_FROM_LINK > + (TransportToken); if (mSingleSessionToken !=3D MctpTransportToken) { > + Status =3D EFI_INVALID_PARAMETER; > + } > + > + if (MctpTransportToken !=3D NULL) { > + FreePool (MctpTransportToken->Token.Transport->Function.Version1_0); > + FreePool (MctpTransportToken->Token.Transport); > + FreePool (MctpTransportToken); > + mSingleSessionToken =3D NULL; > + Status =3D EFI_SUCCESS; > + } > + > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Fail to release MCTP transport token > + (%r).\n", __FUNCTION__, Status)); } > + > + return Status; > +} > diff --git > a/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma > nageabilityTransportMctp.uni > b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/Ma > nageabilityTransportMctp.uni > new file mode 100644 > index 0000000000..ca8125a4a7 > --- /dev/null > +++ b/Features/ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dx > +++ e/ManageabilityTransportMctp.uni > @@ -0,0 +1,13 @@ > +// /** @file > +// MCTP instance of Manageability Transport Library // // Copyright (C) > +2023 Advanced Micro Devices, Inc. All rights reserved.
// // > +SPDX-License-Identifier: BSD-2-Clause-Patent // // **/ > + > +#string STR_MODULE_ABSTRACT #language en-US "MCTP instance o= f > Manageability Transport Library" > + > +#string STR_MODULE_DESCRIPTION #language en-US "MCTP > Manageability Transport library implementation." > + > -- > 2.37.1.windows.1