From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.69]) by mx.groups.io with SMTP id smtpd.web10.97060.1679649638931167595 for ; Fri, 24 Mar 2023 02:20:39 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=XTLc0tIF; 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.243.69, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MSUwf20UK5ugJZf18Qd6vpMlPdtavwReHCZlANFN0Ny9SQXJ2Fcrojdx95WR/K4UvXfr3NL6g+6h+4yVVhlefaZfV2OBRAA1ltDfdJg1+u6Up22Ik5aahqMEGybLC5MNca6jBT1D8XbBa+KuBY+1nVn5SITtazPna1/ZxEd9GsELpRrWxEgZp6/KgvwUAeYMOKF86QvYUuXYJH0q69/fGHaHvC6lg/1dYv9e+MI4zJ+W5JD5qbiZyJh5ddt5N2XRqTMShow0j/JrTpTH1NkuPfzxom/MlSJHoAqUnaGIspZtQ28j//0OP0ttihMyBCU6XVMOm3nGGiXRKczGXZzyug== 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=2lMiyt0RdC8539J36jXQxuW+UU7N9K97QygDXBvfTFU=; b=gFphHfA5Y2Nu571hjocd4sz6oM8WnD5UfZM/x2JebijveuPBtuMq64g/2GGNOPEE1Tw0QVHoxxkLKKofGat84nmOSSghU+Da7h9rFNlyQkcYP4Zreq0+9sY0+DfOHDKwflHrlbW2DAC9kOi8oad/fj46i56jGBObi6oNUskYCZQc37bKWihaHAHZ7N4tzqAKHAjBueMQctgFiIkiVfoQuNuI0Lutt11P7BTF7ezEOOAdHr6quqJgtBniz9olnY8JQ8qaOTQwMPeQbneRPYHl4Uwwku4lvJmTKLuRwrVFaQhNqJ8YSXTcnbEmd72qz6gGJXDyliq95YDQudOsog/srA== 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=2lMiyt0RdC8539J36jXQxuW+UU7N9K97QygDXBvfTFU=; b=XTLc0tIFZuMOGapsC8RGb8wak3d8UZBfKCqdBxcGyivzx2vOm8HM9/OTdnigF24Zkgxoa4ylgvMFPxq+g9iBcZ3iPdKc5fQvWkCMyGuwgy8aA0NTi/cPAv7421CV5fCz9SukIIzdJtstbECZaBqwQPQC2aAc8/KKNN22Np+IRNQs4xWLdISZxkkFo+bV0lkvdZHUM91OiEpUENX3aKBufSlQ/UmyjCNFzN2WEzHkefV85TWeY3xn5cc98yqUI9OJjQtwRpKhorEk9fpMr3S8I3GJOUd/u6szLgTtgvb4mUAvYFWic2zqoXdNECVVUK2BNZQIebuEQi4Vn4YIa323sg== Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by MN2PR12MB4334.namprd12.prod.outlook.com (2603:10b6:208:1d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Fri, 24 Mar 2023 09:20:36 +0000 Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::c27a:fa4b:66ea:d266]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::c27a:fa4b:66ea:d266%5]) with mapi id 15.20.6178.037; Fri, 24 Mar 2023 09:20:36 +0000 From: "Nickle Wang" To: "abner.chang@amd.com" , "devel@edk2.groups.io" CC: Liming Gao , Isaac Oram , Nate DeSimone , Igor Kulchytskyy , Abdul Lateef Attar Subject: Re: [PATCH v4 5/9] ManageabilityPkg: Add ManageabilityTransportHelperLib Thread-Topic: [PATCH v4 5/9] ManageabilityPkg: Add ManageabilityTransportHelperLib Thread-Index: AQHZXGjn/w00SNtn5UyVCPQrZZTjLq8Jqqaw Date: Fri, 24 Mar 2023 09:20:35 +0000 Message-ID: References: <20230322024840.1629-1-abner.chang@amd.com> <20230322024840.1629-5-abner.chang@amd.com> In-Reply-To: <20230322024840.1629-5-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_|MN2PR12MB4334:EE_ x-ms-office365-filtering-correlation-id: cbb8cb31-9d32-4d09-956a-08db2c4906bd x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8U2Jj0YBiJdmHqDeyACyH4JEX7iKpEShEPgJo/Mw4pVENoDfSOJUKL35rCPYAlXDj4+R4xn4GqPcn4uwuWFo37zBomcQ2MmyVB4Q9ahC/NaYQ9BrFsN42gnzXTSs8T+wFtFs3zLqSft7wjpg/6WICzOt22CMP28WsrHhRts03Y1P/0CIngcfci5qyuIF9mGhHDQ/HmXqjXIFRAPowV5L6JIQGSCE2Uu6yRlJ2aS1z7q1L5sOuLFmcniqqPyKkI9YK1udlIt+Na/YHppvtyNDCiU+9LOcgyShNFWZDONG2aU5Nscl4A7xyMjxtN2p2CmYdf8IT1iE7ZbIXjTv2JjZ9C0FWtiAoekBzabI35fCOVV9nlxFmhscmBA0ZhFvjASEvriy5wlgj7ZqTuiRFLvA6zT5yL24gH6WZs7jtY9+ihCoT5IShs4B7pfKbMBgP5gV2NcH5hav4c4953ON17+a1qog8oPab7bcARQVuK1JZPDJsVoygkIAgMWkm9i9sjZ7UotosYDgNbfIIzp+n5Iq30yhonUAIB/Z2FAOCWWM7NJ9GngqdQ9+SgE3uYRR/XqDs/1xcfzIYdBoTat3yYApV/Opk5Dx4Fzfg6kz+o4i7512WGwbANdLCNFae0Q2nDoxyKAknHANeCM9eb7D0ECo6xyRhFQ8TXwB6fLhUMPdfPc+Upavqsk2W0Sf9QecLzKY+w8dvrCqyEK87gC2AhIhXzlMN8nFnaTgDiiv5TLOYaQ= 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:(13230025)(4636009)(366004)(396003)(346002)(136003)(376002)(39860400002)(451199018)(2906002)(5660300002)(41300700001)(55016003)(33656002)(8936002)(76116006)(66446008)(30864003)(64756008)(66476007)(66946007)(66556008)(52536014)(8676002)(4326008)(19627235002)(316002)(110136005)(54906003)(71200400001)(7696005)(478600001)(53546011)(9686003)(186003)(6506007)(86362001)(83380400001)(38100700002)(26005)(38070700005)(122000001)(579004)(44824005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QTWh69sFhDd13vPR27vUPJFcImFnkgQYl9BLjfhDSZo1X8AJ67ozVto6CsRd?= =?us-ascii?Q?x+VUmALl7INQKlkPWObyuKO6XaIYasg/DEO10V65YRTkSOOC/1MRvG7WJQd+?= =?us-ascii?Q?U/+SlfaX9ZzvJnNoz5dhBMqdqy1+r3Z/WkhwarEhnr1JmcAuUPwGo4bcU721?= =?us-ascii?Q?ZrtY+2mYJDhNICq2yo7fkvuUW1JqzcYTAsiagylOx2v8KkEpdXoYpObC3PaT?= =?us-ascii?Q?bKWmgigtyQMiq/ns4+0MkjRtug1kXxxMRR4MEQQGRcY1qiTftFPqIonb49cy?= =?us-ascii?Q?LBYJBwPapwqODgiQJYUEqc1pxrT5TjDYn+FeP67ataXIFhxIDz9Rh/i402TS?= =?us-ascii?Q?apbungtvQUQ7wJE4GeSdXXB4Gc/jJ51jMQnTSL41Khf1FrrgzxxKRmAyvtob?= =?us-ascii?Q?plhwGugjY9+lDK6A5jpAm9kFGVZvaTHIa5/VlxSXK5rCl7vq/ayW/y9AZYqV?= =?us-ascii?Q?MlOnD/+F+4OXjZehKRGflyAaJVgXJT2zkP0aqzxxkcf7NFbmuAcaDaqrMffT?= =?us-ascii?Q?/a00RHSk9isYKeoArByIMQ89XnrIdl2v3JmLk5wzTNRzQiy+PwGuahybCcV0?= =?us-ascii?Q?QaPokd3Wvh1SWRdbu2g/UB11vaO4QRHfi2XWSAoCeDd+izEegbdv/jFScg2r?= =?us-ascii?Q?W3jrYabWsk5HGdYWDk98G3utccNpbYAqU6F6QTRoZkVSRkayQXCwgKN70HZ1?= =?us-ascii?Q?RQ56mKQGuztJO6AC7Pes0j/r3JomVY/+40Z73IcB+deBBbtTu1Z3uL0/0rnD?= =?us-ascii?Q?IUEDUch92LIaP8sFNQS85lQbRJlu0RINGfTlOwXdFBsdYTATMxPC83XjmaQc?= =?us-ascii?Q?icWul/FbNA27fJXk6f8+P3wHf4a2pjsgLJVdATyp3IHYw/ZMdCvTyb0N3JIo?= =?us-ascii?Q?j9CLoDB1V5oHcQQCr4S+Xllocp3eLhq4MN/5kH4YR024nRP66kY22i+vEsxL?= =?us-ascii?Q?ghB6zpCzNdUxiauy7EEBRMS//bEoOp+NS1a4fS5Q1Uq3+5tSyNGiUfdEgvG6?= =?us-ascii?Q?fmdKZMUhDbsUGFZ1k63ecxCi/+03FAg7xR4MqEz1xp0kog/x80PBPdfJcSb8?= =?us-ascii?Q?lG4vzZR1z8OE3SWxGUARdwlKYZ9jV7KK+yxt4hSDaNCpQDOBKXpIJDDoqQsc?= =?us-ascii?Q?2v+lfcFPV1usN40AxlMg+T6sR2NDW7dq/vPSuNyso19Az+onjfEpX/sMc8D5?= =?us-ascii?Q?tOjn9YiVfIOoTbLVARh7xi0+18oSAD6+KkuopUHBcTnFJEOPAdEPzaKjGyT5?= =?us-ascii?Q?xr+vKwxYovg1PGrYLAGnJvBQY5a2t9ea91yKVTS/R0HvyE0EMykAE7ckFray?= =?us-ascii?Q?geoDUSgmVGTKwmkn6/8n+1wf75o+rDzTv7AKinYBAkimWqPGIFYAzAFXqwlt?= =?us-ascii?Q?NUlxEe8bINamRJV+T1DD08VYUrVp5os7gomR7n9+wDBEtjF9epnOrZrexYQT?= =?us-ascii?Q?OdqnbSHftBXPlsiEiS2HGciChxxzuA4DVB11JQC1RrYgVg+pblW69eqmDsjf?= =?us-ascii?Q?CiX1jWTDA8wYOSI86IAULmdCbA6MszwTqJ55E0T3+lVkTdPTFVKmlK8aoh2p?= =?us-ascii?Q?VIODBhHD9kgvUNVr+9A=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: cbb8cb31-9d32-4d09-956a-08db2c4906bd X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Mar 2023 09:20:36.0067 (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: 7D96xNNK9g2WPgmH4yZRrUzBfI8hwaLTTaxL5ETL2cP9avQgeNZxxoDn9uhmo42XgQ8F4Zl+ORZtzfF8KLgXKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4334 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: Wednesday, March 22, 2023 10:49 AM > To: devel@edk2.groups.io > Cc: Liming Gao ; Isaac Oram > ; Nate DeSimone ; > Nickle Wang ; Igor Kulchytskyy ; Abdul > Lateef Attar > Subject: [PATCH v4 5/9] ManageabilityPkg: Add > ManageabilityTransportHelperLib >=20 > External email: Use caution opening links or attachments >=20 >=20 > From: Abner Chang >=20 > The helper functions library facilitates reducing > duplicated code in the manageability transport > library instances. >=20 > Signed-off-by: Abner Chang > Cc: Liming Gao > Cc: Isaac Oram > Cc: Nate DeSimone > Cc: Nickle Wang > Cc: Igor Kulchytskyy > Cc: Abdul Lateef Attar > --- > .../ManageabilityPkg/ManageabilityPkg.dec | 24 +- > .../Include/Dsc/Manageability.dsc | 2 + > .../BaseManageabilityTransportHelper.inf | 41 +++ > .../Library/ManageabilityTransportHelperLib.h | 93 +++++++ > .../BaseManageabilityTransportHelper.c | 261 ++++++++++++++++++ > .../BaseManageabilityTransportHelper.uni | 13 + > 6 files changed, 433 insertions(+), 1 deletion(-) > create mode 100644 > Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/Bas= e > ManageabilityTransportHelper.inf > create mode 100644 > Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperLib= .h > create mode 100644 > Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/Bas= e > ManageabilityTransportHelper.c > create mode 100644 > Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/Bas= e > ManageabilityTransportHelper.uni >=20 > diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec > b/Features/ManageabilityPkg/ManageabilityPkg.dec > index 92ba4538c0..ebbb04dc0e 100644 > --- a/Features/ManageabilityPkg/ManageabilityPkg.dec > +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec > @@ -22,5 +22,27 @@ > # Manageability Transport Library definitions > ManageabilityTransportLib|Include/Library/ManageabilityTransportLib.h >=20 > + ## @libraryclass Manageability Transport Helper Library > + # Provide the help functions to use ManageabilityTransportLib > + > ManageabilityTransportHelperLib|Include/Library/ManageabilityTransportHel= pe > rLib.h > + > [Guids] > - gManageabilityPkgTokenSpaceGuid =3D { 0xBDEFFF48, 0x1C31, 0x49CD, { 0x= A7, > 0x6D, 0x92, 0x9E, 0x60, 0xDB, 0xB9, 0xF8 } } > + gManageabilityPkgTokenSpaceGuid =3D { 0xBDEFFF48, 0x1C31, 0x49CD, { = 0xA7, > 0x6D, 0x92, 0x9E, 0x60, 0xDB, 0xB9, 0xF8 } } > + > + # Manageability Transport Interface type > + # > + # Manageability Transport KCS > + gManageabilityTransportKcsGuid =3D { 0x5A6E64E9, 0xFD47, 0x4086, { = 0xAA, > 0xB0, 0x7A, 0x5F, 0xD7, 0x6B, 0x02, 0x2E } } > + # Manageability Transport I2C > + gManageabilityTransportI2CGuid =3D { 0x5B174658, 0x8263, 0x4CB8, { = 0xA0, > 0x0F, 0xD6, 0x82, 0xE6, 0xBC, 0x74, 0x93 } } > + # Manageability Transport PCI VDM > + gManageabilityTransportPciVdmGuid =3D { 0x388021A7, 0xFB59, 0x4811, { = 0x9D, > 0xA7, 0xD5, 0x63, 0x7D, 0x04, 0xA7, 0x2F } } > + > + # Manageability Protocol Specification > + # > + # Manageability Protocol IPMI > + gManageabilityProtocolIpmiGuid =3D { 0x36ACA47C, 0xCC80, 0x473B, { = 0xAB, > 0xEC, 0xF3, 0x98, 0xFF, 0x87, 0x74, 0x5B } } > + # Manageability Protocol MCTP > + gManageabilityProtocolMctpGuid =3D { 0x76FED8F1, 0x0BE5, 0x4269, { = 0xA3, > 0x1A, 0x38, 0x0F, 0x54, 0xF1, 0xA1, 0x8A } } > + # Manageability Protocol PLDM > + gManageabilityProtocolPldmGuid =3D { 0x3958090D, 0x69DD, 0x4868, { = 0x9C, > 0x41, 0xC9, 0xAC, 0x31, 0xB5, 0x25, 0xC5 } } > diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc > b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc > index 2cb63c1ca6..994c93f17c 100644 > --- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc > +++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc > @@ -5,6 +5,8 @@ > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > ## > +[LibraryClasses] > + > ManageabilityTransportHelperLib|ManageabilityPkg/Library/BaseManageabilit= y > TransportHelperLib/BaseManageabilityTransportHelper.inf >=20 > [LibraryClasses.ARM, LibraryClasses.AARCH64] > # > diff --git > a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/B= a > seManageabilityTransportHelper.inf > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/B= a > seManageabilityTransportHelper.inf > new file mode 100644 > index 0000000000..95c3362ddb > --- /dev/null > +++ > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/B= a > seManageabilityTransportHelper.inf > @@ -0,0 +1,41 @@ > +## @file > +# Null instance of Manageability Transport Helper 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 BaseManageabilityTransportHelper > + MODULE_UNI_FILE =3D BaseManageabilityTransportHelper.un= i > + FILE_GUID =3D 52F2DE11-A8FC-4A06-B8C6-10DCF4A7397= C > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D ManageabilityTransportHelperLib > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 > +# > + > +[Sources] > + BaseManageabilityTransportHelper.c > + > +[LibraryClasses] > + BaseMemoryLib > + DebugLib > + > +[Packages] > + ManageabilityPkg/ManageabilityPkg.dec > + MdePkg/MdePkg.dec > + > +[Guids] > + gManageabilityTransportKcsGuid > + gManageabilityTransportI2CGuid > + gManageabilityTransportPciVdmGuid > + gManageabilityTransportMctpGuid > + gManageabilityProtocolIpmiGuid > + gManageabilityProtocolMctpGuid > + gManageabilityProtocolPldmGuid > + > diff --git > a/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperL= ib > .h > b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperL= ib > .h > new file mode 100644 > index 0000000000..718ac34a1f > --- /dev/null > +++ > b/Features/ManageabilityPkg/Include/Library/ManageabilityTransportHelperL= ib > .h > @@ -0,0 +1,93 @@ > +/** @file > + > + This file defines the manageability transport interface library and fu= nctions. > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#ifndef MANAGEABILITY_TRANSPORT_HELPER_LIB_H_ > +#define MANAGEABILITY_TRANSPORT_HELPER_LIB_H_ > + > +#include > + > +typedef struct _MANAGEABILITY_PROTOCOL_NAME > MANAGEABILITY_PROTOCOL_NAME; > + > +/** > + Helper function returns the human readable name of Manageability > specification. > + > + @param[out] SpecificationGuid The Manageability specification= GUID > + > + @retval !NULL Human readable name is returned; > + @retval NULL No string found, the given Manageability specifica= tion is > + not supported. > +**/ > +CHAR16 * > +HelperManageabilitySpecName ( > + IN EFI_GUID *SpecificationGuid > + ); > + > +/** > + Helper function to check if the Manageability specification is support= ed > + by transport interface or not. > + > + @param[in] TransportGuid GUID of the transpor= t interface. > + @param[in] SupportedManageabilityProtocolArray The Manageability > protocols supported > + by the transport int= erface. > + @param[in] NumberOfSupportedProtocolInArray Number of protocols = in > the array. > + @param[in] ManageabilityProtocolToCheck The Manageability > specification to check. > + > + @retval EFI_SUCCESS Token is created successfully. > + @retval EFI_INVALID_PARAMETER Either > NumberOfSupportedProtocolInArray =3D 0 or > + SupportedManageabilityProtocolArra= y =3D NULL. > + @retval EFI_UNSUPPORTED Out of resource to create a new tr= ansport > session. > + Otherwise Other errors. > +**/ > +EFI_STATUS > +HelperManageabilityCheckSupportedSpec ( > + IN EFI_GUID *TransportGuid, > + IN EFI_GUID **SupportedManageabilityProtocolArray, > + IN UINT8 NumberOfSupportedProtocolInArray, > + IN EFI_GUID *ManageabilityProtocolToCheck > + ); > + > +/** > + Helper function to acquire the Manageability transport token. > + > + @param[in] ManageabilityProtocolSpec The Manageability protocol > specification. > + @param[out] TransportToken Pointer to receive Manageabili= ty > transport > + token. > + > + @retval EFI_SUCCESS Token is created successfully. > + @retval EFI_OUT_OF_RESOURCES Out of resource to create a new > transport session. > + @retval EFI_UNSUPPORTED Token is created successfully. > + @retval EFI_DEVICE_ERROR The transport interface has proble= ms > + @retval EFI_INVALID_PARAMETER INput parameter is not valid. > + Otherwise Other errors. > +**/ > +EFI_STATUS > +HelperAcquireManageabilityTransport ( > + IN EFI_GUID *ManageabilityProtocolSpec, > + OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken > + ); > + > +/** > + Helper function to initial the transport interface. > + > + @param[in] TransportToken Transport token. > + @param[in] HardwareInfo Optional hardware information = of > transport interface. > + @param[out] TransportAdditionalStatus Transport additional status. > + > + @retval EFI_SUCCESS Transport interface is initiated s= uccessfully. > + @retval EFI_DEVICE_ERROR The transport interface has proble= ms > + @retval EFI_INVALID_PARAMETER INput parameter is not valid. > + Otherwise Other errors. > +**/ > +EFI_STATUS > +HelperInitManageabilityTransport ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, > + IN MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInfo > OPTIONAL, > + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS > *TransportAdditionalStatus OPTIONAL > + ); > + > +#endif > diff --git > a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/B= a > seManageabilityTransportHelper.c > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/B= a > seManageabilityTransportHelper.c > new file mode 100644 > index 0000000000..81da209764 > --- /dev/null > +++ > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/B= a > seManageabilityTransportHelper.c > @@ -0,0 +1,261 @@ > +/** @file > + Null instance of Manageability Transport Helper Library > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#include > +#include > +#include > +#include > + > +// > +// BaseManageabilityTransportHelper is used by PEI, DXE and SMM. > +// Make sure the global variables added here should be unchangable. > +// > +MANAGEABILITY_SPECIFICATION_NAME ManageabilitySpecNameTable[] =3D { > + { &gManageabilityTransportKcsGuid, L"KCS" }, > + { &gManageabilityTransportI2CGuid, L"I2C" }, > + { &gManageabilityTransportPciVdmGuid, L"PCI VDM" }, > + { &gManageabilityTransportMctpGuid, L"MCTP" }, > + { &gManageabilityProtocolIpmiGuid, L"IPMI" }, > + { &gManageabilityProtocolMctpGuid, L"MCTP" }, > + { &gManageabilityProtocolPldmGuid, L"PLDM" } > +}; > + > +UINT16 mManageabilitySpecNum =3D sizeof (ManageabilitySpecNameTable)/ > sizeof (MANAGEABILITY_SPECIFICATION_NAME); > + > +/** > + Helper function returns the human readable name of Manageability > specification. > + > + @param[in] SpecificationGuid The Manageability specification = GUID > + > + @retval !NULL Human readable name is returned; > + @retval NULL No string found, the given Manageability specifica= tion is > + not supported. > +**/ > +CHAR16 * > +HelperManageabilitySpecName ( > + IN EFI_GUID *SpecificationGuid > + ) > +{ > + UINT16 Index; > + MANAGEABILITY_SPECIFICATION_NAME *ThisSpec; > + > + if (mManageabilitySpecNum =3D=3D 0) { > + return NULL; > + } > + > + if (SpecificationGuid =3D=3D NULL || IsZeroGuid (SpecificationGuid)) { > + DEBUG((DEBUG_ERROR, "%a: Improper input GUIDs, could be NULL or zero > GUID.\n", __FUNCTION__)); > + return NULL; > + } > + > + ThisSpec =3D ManageabilitySpecNameTable; > + for (Index =3D 0; Index < mManageabilitySpecNum; Index++) { > + if (CompareGuid ( > + SpecificationGuid, > + ThisSpec->SpecificationGuid > + )) > + { > + return ThisSpec->SpecificationName; > + } > + > + ThisSpec++; > + } > + > + return NULL; > +} > + > +/** > + Helper function to check if the Manageability specification is support= ed > + by transport interface or not. > + > + @param[in] TransportGuid GUID of the transpor= t interface. > + @param[in] SupportedManageabilityProtocolArray The Manageability > protocols supported > + by the transport int= erface. > + @param[in] NumberOfSupportedProtocolInArray Number of protocols = in > the array. > + @param[in] ManageabilityProtocolToCheck The Manageability > specification to check. > + > + @retval EFI_SUCCESS Token is created successfully. > + @retval EFI_INVALID_PARAMETER Either > NumberOfSupportedProtocolInArray =3D 0 or > + SupportedManageabilityProtocolArra= y =3D NULL. > + @retval EFI_UNSUPPORTED Out of resource to create a new tr= ansport > session. > + Otherwise Other errors. > +**/ > +EFI_STATUS > +HelperManageabilityCheckSupportedSpec ( > + IN EFI_GUID *TransportGuid, > + IN EFI_GUID **SupportedManageabilityProtocolArray, > + IN UINT8 NumberOfSupportedProtocolInArray, > + IN EFI_GUID *ManageabilityProtocolToCheck > + ) > +{ > + UINT16 Index; > + EFI_GUID **ThisSpecGuid; > + > + if ((NumberOfSupportedProtocolInArray =3D=3D 0) || > (SupportedManageabilityProtocolArray =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + if (TransportGuid =3D=3D NULL || > + IsZeroGuid (TransportGuid) || > + ManageabilityProtocolToCheck =3D=3D NULL || > + IsZeroGuid (ManageabilityProtocolToCheck) > + ) { > + DEBUG((DEBUG_ERROR, "%a: Improper input GUIDs, could be NULL or ze= ro > GUID.\n", __FUNCTION__)); > + return EFI_INVALID_PARAMETER; > + } > + > + ThisSpecGuid =3D SupportedManageabilityProtocolArray; > + for (Index =3D 0; Index < NumberOfSupportedProtocolInArray; Index++) { > + if (CompareGuid ( > + *ThisSpecGuid, > + ManageabilityProtocolToCheck > + )) > + { > + DEBUG (( > + DEBUG_VERBOSE, > + "%a: Transport interface %s supports %s manageability specificat= ion.\n", > + __FUNCTION__, > + HelperManageabilitySpecName (TransportGuid), > + HelperManageabilitySpecName (ManageabilityProtocolToCheck) > + )); > + return EFI_SUCCESS; > + } > + > + ThisSpecGuid++; > + } > + > + DEBUG (( > + DEBUG_ERROR, > + "%a: Transport interface %s doesn't support %s manageability > specification.\n", > + __FUNCTION__, > + HelperManageabilitySpecName (TransportGuid), > + HelperManageabilitySpecName (ManageabilityProtocolToCheck) > + )); > + return EFI_UNSUPPORTED; > +} > + > +/** > + Helper function to acquire the Manageability transport token. > + > + @param[in] ManageabilityProtocolSpec The Manageability protocol > specification. > + @param[out] TransportToken Pointer to receive Manageabili= ty > transport > + token. > + > + @retval EFI_SUCCESS Token is created successfully. > + @retval EFI_OUT_OF_RESOURCES Out of resource to create a new > transport session. > + @retval EFI_UNSUPPORTED Token is created successfully. > + @retval EFI_INVALID_PARAMETER Input parameter is not valid. > + Otherwise Other errors. > +**/ > +EFI_STATUS > +HelperAcquireManageabilityTransport ( > + IN EFI_GUID *ManageabilityProtocolSpec, > + OUT MANAGEABILITY_TRANSPORT_TOKEN **TransportToken > + ) > +{ > + EFI_STATUS Status; > + CHAR16 *ManageabilityProtocolName; > + CHAR16 *ManageabilityTransportName; > + > + DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__)); > + if ((TransportToken =3D=3D NULL) || (ManageabilityProtocolSpec =3D=3D = NULL)) { > + DEBUG ((DEBUG_ERROR, "%a: One of the required input parameters is > NULL.\n", __FUNCTION__)); > + return EFI_INVALID_PARAMETER; > + } > + > + *TransportToken =3D NULL; > + ManageabilityProtocolName =3D HelperManageabilitySpecName > (ManageabilityProtocolSpec); > + if (ManageabilityProtocolName =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Unsupported Manageability Protocol > Specification.\n", __FUNCTION__)); > + return EFI_UNSUPPORTED; > + } > + > + DEBUG ((DEBUG_INFO, " Manageability protocol %s is going to acquire > transport interface token...\n", ManageabilityProtocolName)); > + > + Status =3D AcquireTransportSession (ManageabilityProtocolSpec, > TransportToken); > + if (Status =3D=3D EFI_UNSUPPORTED) { > + DEBUG ((DEBUG_ERROR, "%a: No supported transport interface for %s > packet.\n", __FUNCTION__, ManageabilityProtocolName)); > + return Status; > + } > + > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "%a: Fail to acquire Manageability transport token for %s (%r).\n"= , > + __FUNCTION__, > + ManageabilityProtocolName, > + Status > + )); > + return Status; > + } > + > + ManageabilityTransportName =3D HelperManageabilitySpecName > ((*TransportToken)->Transport->ManageabilityTransportSpecification); > + if (ManageabilityTransportName =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: Unsupported Manageability Transport > Interface Specification\n", __FUNCTION__)); > + return EFI_UNSUPPORTED; > + } > + > + DEBUG ((DEBUG_INFO, "%a: This is the transfer session for %s over %s\n= ", > __FUNCTION__, ManageabilityProtocolName, ManageabilityTransportName)); > + return Status; > +} > + > +/** > + Helper function to initial the transport interface. > + > + @param[in] TransportToken Transport token. > + @param[in] HardwareInfo Optional hardware information = of > transport interface. > + @param[out] TransportAdditionalStatus Transport additional status. > + > + @retval EFI_SUCCESS Transport interface is initiated s= uccessfully. > + @retval EFI_DEVICE_ERROR The transport interface has proble= ms > + @retval EFI_INVALID_PARAMETER INput parameter is not valid. > + Otherwise Other errors. > +**/ > +EFI_STATUS > +HelperInitManageabilityTransport ( > + IN MANAGEABILITY_TRANSPORT_TOKEN *TransportToken, > + IN MANAGEABILITY_TRANSPORT_HARDWARE_INFORMATION HardwareInfo > OPTIONAL, > + OUT MANAGEABILITY_TRANSPORT_ADDITIONAL_STATUS > *TransportAdditionalStatus OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + > + if (TransportToken =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: TransportToken is invalid.\n", > __FUNCTION__)); > + return EFI_INVALID_PARAMETER; > + } > + > + // Initial transport interface. > + Status =3D TransportToken->Transport->Function.Version1_0->TransportIn= it > (TransportToken, HardwareInfo); > + if ((Status !=3D EFI_SUCCESS) && (Status !=3D EFI_ALREADY_STARTED)) { > + if (Status =3D=3D EFI_DEVICE_ERROR) { > + // Try to reset the transport and initialize it again. > + Status =3D TransportToken->Transport->Function.Version1_0- > >TransportReset ( > + Transpo= rtToken, > + Transpo= rtAdditionalStatus > + ); > + if (EFI_ERROR (Status)) { > + if (Status =3D=3D EFI_UNSUPPORTED) { > + DEBUG ((DEBUG_ERROR, "%a: Transport interface doesn't have res= et > capability.\n", __FUNCTION__)); > + } else { > + DEBUG ((DEBUG_ERROR, "%a: Fail to reset transport interface (%= r).\n", > __FUNCTION__, Status)); > + } > + > + Status =3D EFI_DEVICE_ERROR; > + } else { > + Status =3D TransportToken->Transport->Function.Version1_0->Trans= portInit > (TransportToken, HardwareInfo); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: Transport interface is not able to u= se after > the reset (%r).\n", __FUNCTION__, Status)); > + } > + } > + } else { > + DEBUG ((DEBUG_ERROR, "%a: Transport interface is not able to use > (%r).\n", __FUNCTION__, Status)); > + } > + } > + > + return Status; > +} > diff --git > a/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/B= a > seManageabilityTransportHelper.uni > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/B= a > seManageabilityTransportHelper.uni > new file mode 100644 > index 0000000000..dfb6051aeb > --- /dev/null > +++ > b/Features/ManageabilityPkg/Library/BaseManageabilityTransportHelperLib/B= a > seManageabilityTransportHelper.uni > @@ -0,0 +1,13 @@ > +// /** @file > +// Null instance of Manageability Transport Helper Library > +// > +// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<= BR> > +// > +// SPDX-License-Identifier: BSD-2-Clause-Patent > +// > +// **/ > + > +#string STR_MODULE_ABSTRACT #language en-US "Manageability > Transport Helper Library" > + > +#string STR_MODULE_DESCRIPTION #language en-US "Manageability > Transport Helper Functions." > + > -- > 2.37.1.windows.1