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.56]) by mx.groups.io with SMTP id smtpd.web11.2226.1681973425459141330 for ; Wed, 19 Apr 2023 23:50:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=rl1tAIP/; 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.56, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QsYp7TXJR89K3BKf7L+KanSoOzbqt1pVP+dpMIOMyMjzu3smsw9fZ4On6J3rldGQRY/GiqEFch7rYYMhx1zGqS3phn8AGlYeEDf+2mjoOiK12rYI08fxKdb/R3PmA5RIRnHlbNOj5IAhE0L33dCxfT1tB8tfd2I141L4F7n9vLshVfDPhxZG9v31yD4BjPlhO3pu4oNHYYt1CUVxX6PN+zjctuaeWhwA72o5VyJwWoQkc4iJEOunhzPmdpMmk+q6sUWTPEYkn/CewZcxCGL9tyr47nVe9/7UtKukcCoafdQnOzntaMehdDQqvk6adew7wx/FGDRxD7vfVsjFNanzfg== 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=GOiUDEG/UrONORc6IkMrmfLM4+7OnDuwHmL2m7TM0H8=; b=gzkx4CmL9n75nwxDk7+kpu1INopmFPnPCxZmUWB2fp/Mg05Eb4UQDvGEA5l8KhVqy/guZXFnG0oQwfS5H+i33Ec+mRK1aMUNIDgSKT6Fk0HLi4Ioi/OWp2U4Uzvds9b2MDX7Zdv+KzZFmLXK8/h10nLVBnw5timBVabRtndJ0Rev90yPFNbrFg0OYKLIUUpdPaoyzqoE+TYExZ180syrM3i6y4ArkoA2qn3FMG5wqP0VYYCyJcQGJ/TXJbE8PKars+p1jK8tO93i4N6Bp6the2rcz5GTwttLhZF/YDvEw1J/hKdnnKWGhl4QHnqSnXeyMq8SQCty3cEQpOP4tG/zyg== 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=GOiUDEG/UrONORc6IkMrmfLM4+7OnDuwHmL2m7TM0H8=; b=rl1tAIP/i6w4LE41VmUI7kdM3kq8CGtWIJuTZFmDY5Z/r1mHuk86NZcZjB5P7NCVZtDacrp4I0DZ6g02FCu6S3ryUUvNK5mKVtux+iCV9HaoA5Svx1yGTDM956LM4L5/VyqL7QMHm/711gz5OG2Iuj/pXbbaMyKoRmS56uvvRW3k0K9evrVyHN0wqdbswOyGoWvdDvFxEMgcx1ih6oOlXU2t0oQnihumzfI2nB4Nnosl3z2JAgigjcWPFS1MVkXkv4oDbuu4JwUSTS7w5BLC6BJQqZqAgbZaiktHl0NMFvk+m2yX0lec0OOMq0HjaAhqkl7jrl9eY22fNbhz07gCcg== 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:50:22 +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:50:22 +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 04/14] ManageabilityPkg: Add PldmProtocolLib Thread-Topic: [edk2-platforms][PATCH V2 04/14] ManageabilityPkg: Add PldmProtocolLib Thread-Index: AQHZccWtz9UxIi6isUOW78FdvAiISK8zxMhg Date: Thu, 20 Apr 2023 06:50:22 +0000 Message-ID: References: <20230418071543.1951-1-abner.chang@amd.com> <20230418071543.1951-5-abner.chang@amd.com> In-Reply-To: <20230418071543.1951-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_|PH7PR12MB7819:EE_ x-ms-office365-filtering-correlation-id: 115acac7-40a9-4d7e-409f-08db416b8395 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: apEEObcnnk6NyUGRGpTglKfARZcsME8uloKBzELU9fkSspPtOoFgfxDCWiW7P1JsoKNhg6xuRejP/u0TStjcxk45bZ7l1UQRvb2V79X1s3bZAs+Pa0nNZouFHNXppP8j9VmDz4iIkd9qqCmJ0dKGD3TCGuvR2TSRCXnEL/cgfWvxfo6CyOjhergylWPO0jlTYBiKuDah/adYFdJSBRpgAqhPzFli83MsP8QW/32/zrQPowrZbjSygFwTdwCzXofnhqzYJAfNdUbObddUTtkovcQKRFiLlDDyIhCRFuNX/kE4l08lN+4EGfcy0tFdoK3Mi+pDD96m89meuFlJSzE+9XqIVJI2IV1qJTCmqw/kOPSkHeRAOnv9o+18SG30CZJEwI0eJfJfSvP84zCRRP3r/KeN6YljaVB+7Znj5y6rDtH4CKJIbToTryAx+pvt+TRHGnoDVXolIEWw3+rCPhQ26jaacfo30mnDRCpMUieZ+ghJGAyKcvjTvcy6Q2htnsvdg8+lz1ZVuz1BWBbSduPO7hdVXlOBfwywLuIsJ2zDy/fZQystzUnLuOXd1kui3iZN8mKmyso8V9A5LhzWin5OjII357k6VG1hIX9AXPdUUHe8Gv9vypTu9kPnlNq4tDA5wxmf8EwjOryeDP/t/O7MgA== 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)(156123004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?3ty0pKPkrXrwulo8n/eTsTHyCpD021CoB5+iiB2MXLZ6X+p5qOZAOr47IUd3?= =?us-ascii?Q?g9Tfaw3rbKM//kppOP3GHZGnwyhpGrI7oEKGYO07DryXtgOhPPnCTS3kiA4/?= =?us-ascii?Q?0eEHoab3E51kB4daIwHTGa4ZbSDOtbqS7ZcJM14K/jOH43Kz0GHVzbJ5Obn0?= =?us-ascii?Q?AWDn57pDqShksYg/ihvcRvqzArT8ZI0tX4adFZBD6LMDidtLEj5zE0T+DcNs?= =?us-ascii?Q?Uo49Gttw9cRDj0VJYEXrP8zqKEd/alksMCielzEKfnPHUwryJU2Pg9RyM9+G?= =?us-ascii?Q?58sM5EdxNI5LT7AceJogc34B36BP3kNcziUtlxmJ7kkO6hPvd2L49T18stCd?= =?us-ascii?Q?cH9Eiw26OQKzLDA0AusFq2U4eQH3TKwo0u7fumVpRmr8jkS+fYpXBrAdOkG1?= =?us-ascii?Q?ZiLoSZccOd+ezj8GUjPJ5+T0v8bgHwxtStebx+i5/v7nlYnUSuvqhGiIbHRP?= =?us-ascii?Q?cASfyIsYMyS2rtjIxSQ2KUgohMjxGE2Ik6Ia5pOxoKYD+FC6ZvexoMRqt99x?= =?us-ascii?Q?pGzOf5rFtIMu8+nvdIls8MWmYMuh3xMuTgcBUc+MkySI8SDGz7rarx5NsuML?= =?us-ascii?Q?kcE//+zCFG7Tf+YMsiG0Fva/vDQsDH2+jP1F7rPxe1+FTrKM+UFhQX0PMRa7?= =?us-ascii?Q?L0NKJAs+GaQFCuFURGHFNiKZHvngHGl3X2HizuF0YkGY9tbyRl79uoQIiTU7?= =?us-ascii?Q?YZhU/rJNTIb6nKppy6O7HrGm1AfGnMGq5bOgYdkXk/L/GA+KvPDXhjuV6NMm?= =?us-ascii?Q?82hxOMZ81YIBkSB8WRU2sKA/X6hV/FnXzdUzqG60PZep3RvdfZsHGgvEQ5bh?= =?us-ascii?Q?EaX7d/h/124EWaPAxTxbblxvZjHfe+oaLrnTLWkxmlnSIbQ4lxAaYI0HAYDP?= =?us-ascii?Q?4fNHId/Ipg9D0DD9ODUaOwcv6TmJwisrLn4ybsIAEIsdUaqFGWzDEfCLb4+b?= =?us-ascii?Q?nOBlK5I1Nm1W4kdi/BEuMHhPnmn0Cnpi9ZaC96ffvrml//pzq7r15v7PfgXF?= =?us-ascii?Q?t5XUa2G3afqx4G/+QN71QJ+rk5a+jeaJozXpvgJ/3UsuYFlM43fxLW+1Duls?= =?us-ascii?Q?RCrrOVKNdDXi1roP8nGWkwWotNl3NJdBK2VuXlokXh0/pMFJsgxpdgNO7qtv?= =?us-ascii?Q?UM66nW+AIE1CywHa4sz+3+3yMBqFpfasl6yon9Z8a2EHycFVnMTYuvXywfDl?= =?us-ascii?Q?OjrLcZaMdhuyrQSgI15RnauKUa07AMT4ZL/5HZfBTuyEp3Y72hq87Do3nLUX?= =?us-ascii?Q?vdeAPkG8JgRw4jBdGm5gA/ykvO8J7lI82plqdAZ2fZPk5vW4cDg/LD1XrGPP?= =?us-ascii?Q?d9udHUMXBtV7HVV/SBDsaB1b1wgeqH2azcfVg1rx3Tu6kn/cBxKVEC1ZFHS+?= =?us-ascii?Q?MjjwzXR1eMs/9Eb8Bzm+yBcH8CVKq67p9rlPnbpTcSnvBbCLcrmbKsfvOFd/?= =?us-ascii?Q?ZY7InCgJvcXbdOq4hUICuRQPUsIuxbOhZW7V6f2RxRXotAYE0AMmkGjhpF6g?= =?us-ascii?Q?0EXXidyNZzDVThuoQJvbfHPA9qfuIlGyD0iTSDGbfWTo7WWKjdW4WLeOSqM0?= =?us-ascii?Q?vfCtSQnkmDtabo0qbz4=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: 115acac7-40a9-4d7e-409f-08db416b8395 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2023 06:50:22.7568 (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: 5y3FgKEskZeZaaIo4yNPjGE8/b8enJnodthXxiGMZJ/K0HbxjAPYE2scIpRMvZ7ZrbdVNoOLP1lk5eAbP+RtPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7819 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Please find my comment inline 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 04/14] ManageabilityPkg: Add > PldmProtocolLib >=20 > External email: Use caution opening links or attachments >=20 >=20 > From: Abner Chang >=20 > PldmProtocolLib provides the library > function to PLDM protocol. >=20 > Signed-off-by: Abner Chang > Cc: Isaac Oram > Cc: Abdul Lateef Attar > Cc: Nickle Wang > Cc: Igor Kulchytskyy > --- > .../ManageabilityPkg/ManageabilityPkg.dec | 3 + > .../Include/Dsc/Manageability.dsc | 3 + > .../ManageabilityPkg/ManageabilityPkg.dsc | 1 + > .../Dxe/PldmProtocolLib.inf | 42 +++++++++ > .../Include/Library/BasePldmProtocolLib.h | 41 +++++++++ > .../Include/Protocol/PldmProtocol.h | 87 +++++++++++++++++++ > .../PldmProtocolLibrary/Dxe/PldmProtocolLib.c | 87 +++++++++++++++++++ > .../Dxe/PldmProtocolLib.uni | 18 ++++ > 8 files changed, 282 insertions(+) > create mode 100644 > Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib= .i > nf > create mode 100644 > Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h > create mode 100644 > Features/ManageabilityPkg/Include/Protocol/PldmProtocol.h > create mode 100644 > Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib= .c > create mode 100644 > Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib= . > uni >=20 > diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec > b/Features/ManageabilityPkg/ManageabilityPkg.dec > index 3d279ef033..e4d147fede 100644 > --- a/Features/ManageabilityPkg/ManageabilityPkg.dec > +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec > @@ -48,3 +48,6 @@ > 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 } } > + > +[Protocols] > + gEdkiiPldmProtocolGuid =3D { 0x60997616, 0xDB70, 0x4B5F= , { 0x86, > 0xA4, 0x09, 0x58, 0xA3, 0x71, 0x47, 0xB4 } } > diff --git a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc > b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc > index 7f8d8df3f0..eda1a36bb9 100644 > --- a/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc > +++ b/Features/ManageabilityPkg/Include/Dsc/Manageability.dsc > @@ -8,6 +8,9 @@ > [LibraryClasses] >=20 > ManageabilityTransportHelperLib|ManageabilityPkg/Library/BaseManageabilit= y > TransportHelperLib/BaseManageabilityTransportHelper.inf >=20 > +[LibraryClasses.common.DXE_DRIVER] > + > +PldmProtocolLib|ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmPr > +otocolLib.inf > + > [LibraryClasses.ARM, LibraryClasses.AARCH64] > # > # This library provides the instrinsic functions generated by a given = compiler. > diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc > b/Features/ManageabilityPkg/ManageabilityPkg.dsc > index 6a083385fd..412029ef6c 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/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf >=20 > [LibraryClasses] >=20 > ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTrans= p > ortNullLib/BaseManageabilityTransportNull.inf > diff --git > a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolL= i > b.inf > b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolL= i > b.inf > new file mode 100644 > index 0000000000..1233d76726 > --- /dev/null > +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProt > +++ ocolLib.inf > @@ -0,0 +1,42 @@ > +## @file > +# Instance of PLDM Protocol Library in DXE phase. > +# > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > +reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # # ## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D PldmProtocolLib > + MODULE_UNI_FILE =3D PldmProtocolLib.uni > + FILE_GUID =3D 5B1173E8-6A5A-468B-BDA4-02303530C55= C > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D PldmProtocolLib|DXE_RUNTIME_DRIVER > DXE_DRIVER DXE_CORE UEFI_DRIVER UEFI_APPLICATION > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +[Sources] > + PldmProtocolLib.c > + > +[Packages] > + ManageabilityPkg/ManageabilityPkg.dec > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + > +[LibraryClasses] > + DebugLib > + ManageabilityTransportHelperLib > + UefiBootServicesTableLib > + > +[Guids] > + gManageabilityProtocolPldmGuid > + > +[Protocols] > + gEdkiiPldmProtocolGuid ## ALWAYS_CONSUMES > + > diff --git a/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLi= b.h > b/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h > new file mode 100644 > index 0000000000..5523ac3a4d > --- /dev/null > +++ b/Features/ManageabilityPkg/Include/Library/BasePldmProtocolLib.h > @@ -0,0 +1,41 @@ > +/** @file > + > + This file defines EDKII Pldm Protocol library and functions. > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > +reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#ifndef EDKII_PLDM_PROTOCOL_LIB_H_ > +#define EDKII_PLDM_PROTOCOL_LIB_H_ > + > +/** > + This service enables submitting commands via EDKII PLDM protocol. > + > + @param[in] PldmType PLDM message type. > + @param[in] Command PLDM Command of PLDM message type= . > + @param[in] RequestData Command Request Data. > + @param[in] RequestDataSize Size of Command Request Data. > + @param[out] ResponseData Command Response Data. The > completion code is the first byte of response data. > + @param[in, out] ResponseDataSize Size of Command Response Data. > + > + @retval EFI_SUCCESS PLDM message was successfully sent to t= ransport > interface > + and a response was successfully receive= d. > + @retval EFI_NOT_FOUND Transport interface is not found. > + @retval EFI_NOT_READY Transport interface is not ready for PL= DM > message. > + @retval EFI_DEVICE_ERROR Transport interface has an hardware err= or. > + @retval EFI_TIMEOUT Send PLDM message got a timeout. > + @retval EFI_UNSUPPORTED PLDM message is unsupported. > + @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resou= rce > or data size error. > +**/ > +EFI_STATUS > +PldmSubmitCommand ( > + IN UINT8 PldmType, > + IN UINT8 Command, > + IN UINT8 *RequestData, > + IN UINT32 RequestDataSize, > + OUT UINT8 *ResponseData, > + IN OUT UINT32 *ResponseDataSize > + ); > + > +#endif > diff --git a/Features/ManageabilityPkg/Include/Protocol/PldmProtocol.h > b/Features/ManageabilityPkg/Include/Protocol/PldmProtocol.h > new file mode 100644 > index 0000000000..651997e1ad > --- /dev/null > +++ b/Features/ManageabilityPkg/Include/Protocol/PldmProtocol.h > @@ -0,0 +1,87 @@ > +/** @file > + Protocol of EDKII PLDM Protocol. > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > + reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef EDKII_PLDM_PROTOCOL_H_ > +#define EDKII_PLDM_PROTOCOL_H_ > + > +#include > + > +typedef struct _EDKII_PLDM_PROTOCOL EDKII_PLDM_PROTOCOL; > + > +#define EDKII_PLDM_PROTOCOL_GUID \ > + { \ > + 0x60997616, 0xDB70, 0x4B5F, 0x86, 0xA4, 0x09, 0x58, 0xA3, 0x71, > +0x47, 0xB4 \ > + } > + > +#define EDKII_PLDM_PROTOCOL_VERSION_MAJOR 1 #define > +EDKII_PLDM_PROTOCOL_VERSION_MINOR 0 > +#define EDKII_PLDM_PROTOCOL_VERSION > ((EDKII_PLDM_PROTOCOL_VERSION_MAJOR << 8) |\ > + > +EDKII_PLDM_PROTOCOL_VERSION_MINOR) > + > +/** > + This service enables submitting commands via EDKII PLDM protocol. > + > + @param[in] This EDKII_PLDM_PROTOCOL instance. > + @param[in] PldmType PLDM message type. > + @param[in] Command PLDM Command of PLDM message type= . > + @param[in] RequestData Command Request Data. > + @param[in] RequestDataSize Size of Command Request Data. > + @param[out] ResponseData Command Response Data. The > completion code is the first byte of response data. > + @param[in, out] ResponseDataSize Size of Command Response Data. > + > + @retval EFI_SUCCESS The command byte stream was successfull= y > submit to the device and a response was successfully received. > + @retval EFI_NOT_FOUND The command was not successfully sent t= o the > device or a response was not successfully received from the device. > + @retval EFI_NOT_READY PLDM transport interface is not ready f= or PLDM > command access. > + @retval EFI_DEVICE_ERROR PLDM transport interface Device hardwar= e > error. > + @retval EFI_TIMEOUT The command time out. > + @retval EFI_UNSUPPORTED The command was not successfully sent t= o > the device. > + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resour= ce > or data size error. > + @retval EFI_INVALID_PARAMETER Both RequestData and ResponseData are > +NULL **/ typedef EFI_STATUS (EFIAPI *PLDM_SUBMIT_COMMAND)( > + IN EDKII_PLDM_PROTOCOL *This, > + IN UINT8 PldmType, > + IN UINT8 Command, > + IN UINT8 *RequestData, > + IN UINT32 RequestDataSize, > + OUT UINT8 *ResponseData, > + IN OUT UINT32 *ResponseDataSize > + ); > + > +// > +// EDKII_PLDM_PROTOCOL Version 1.0 > +// > +typedef struct { > + PLDM_SUBMIT_COMMAND PldmSubmitCommand; > +} EDKII_PLDM_PROTOCOL_V1_0; > + > +/// > +/// Definitions of EDKII_PLDM_PROTOCOL. > +/// This is a union that can accommodate the new functionalities > +defined /// in PLDM Base specification in the future. > +/// The new added function must has its own EDKII_PLDM_PROTOCOL /// > +structure with the incremental version number. > +/// e.g., EDKII_PLDM_PROTOCOL_V1_1. > +/// > +/// The new function must be added base on the last version of /// > +EDKII_PLDM_PROTOCOL to keep the backward compatability. > +/// > +typedef union { > + EDKII_PLDM_PROTOCOL_V1_0 *Version1_0; > +} EDKII_PLDM_PROTOCOL_FUNCTION; > + > +struct _EDKII_PLDM_PROTOCOL { > + UINT16 ProtocolVersion; > + EDKII_PLDM_PROTOCOL_FUNCTION Functions; > +}; > + > +extern EFI_GUID gEdkiiPldmProtocolGuid; > + > +#endif // EDKII_PLDM_PROTOCOL_H_ > diff --git > a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolL= i > b.c > b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolL= i > b.c > new file mode 100644 > index 0000000000..76d09696b0 > --- /dev/null > +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProt > +++ ocolLib.c > @@ -0,0 +1,87 @@ > +/** @file > + Instance of EDKII PLDM Protocol Library in DXE phase > + > + Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > + reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > + > +EDKII_PLDM_PROTOCOL *mEdkiiPldmProtocol =3D NULL; > + > +/** > + This service enables submitting commands via EDKII PLDM protocol. > + > + @param[in] PldmType PLDM message type. > + @param[in] Command PLDM Command of PLDM message type= . > + @param[in] RequestData Command Request Data. > + @param[in] RequestDataSize Size of Command Request Data. > + @param[out] ResponseData Command Response Data. The > completion code is the first byte of response data. > + @param[in, out] ResponseDataSize Size of Command Response Data. > + > + @retval EFI_SUCCESS PLDM message was successfully sent to t= ransport > interface > + and a response was successfully receive= d. > + @retval EFI_NOT_FOUND Transport interface is not found. > + @retval EFI_NOT_READY Transport interface is not ready for PL= DM > message. > + @retval EFI_DEVICE_ERROR Transport interface has an hardware err= or. > + @retval EFI_TIMEOUT Send PLDM message got a timeout. > + @retval EFI_UNSUPPORTED PLDM message is unsupported. > + @retval EFI_OUT_OF_RESOURCES The resource allocation is out of resou= rce > or data size error. > +**/ > +EFI_STATUS > +PldmSubmitCommand ( > + IN UINT8 PldmType, > + IN UINT8 Command, > + IN UINT8 *RequestData, > + IN UINT32 RequestDataSize, > + OUT UINT8 *ResponseData, > + IN OUT UINT32 *ResponseDataSize > + ) > +{ > + EFI_STATUS Status; > + > + if (mEdkiiPldmProtocol =3D=3D NULL) { > + Status =3D gBS->LocateProtocol ( > + &gEdkiiPldmProtocolGuid, > + NULL, > + (VOID **)&mEdkiiPldmProtocol > + ); > + if (EFI_ERROR (Status)) { > + // > + // Dxe PLDM Protocol is not installed. So, PLDM device is not pres= ent. > + // > + DEBUG ((DEBUG_ERROR, "%a: EDKII PLDM protocol is not found - %r\n"= , > Status)); "__func__ is missing in DEBUG macro" Nickle > + return EFI_NOT_FOUND; > + } > + } > + > + DEBUG ((DEBUG_MANAGEABILITY_INFO, "%a: PLDM Type: 0x%x, Command: > + 0x%x\n", __FUNCTION__, PldmType, Command)); if ((RequestData !=3D NULL= ) > && (RequestDataSize !=3D 0)) { > + HelperManageabilityDebugPrint ((VOID *)RequestData, > + RequestDataSize, "PLDM PLDM application layer Type/Command specific > + request payload\n"); } > + > + Status =3D mEdkiiPldmProtocol->Functions.Version1_0->PldmSubmitCommand= ( > + mEdkiiPldmProtoco= l, > + PldmType, > + Command, > + RequestData, > + RequestDataSize, > + ResponseData, > + ResponseDataSize > + ); if > + (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Fails to send PLDM package - %r\n", Status)); > + return Status; > + } > + > + if ((ResponseData !=3D NULL) && (*ResponseDataSize !=3D 0)) { > + HelperManageabilityDebugPrint ((VOID *)ResponseData, > + *ResponseDataSize, "PLDM application layer response payload\n"); } > + > + return Status; > +} > diff --git > a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolL= i > b.uni > b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolL= i > b.uni > new file mode 100644 > index 0000000000..b58a2ac146 > --- /dev/null > +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProt > +++ ocolLib.uni > @@ -0,0 +1,18 @@ > +// /** @file > +// Instance of PLDM Protocol Library in DXE phase. > +// > +// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights > +reserved.
// // SPDX-License-Identifier: BSD-2-Clause-Patent // // > +**/ > + > +#string STR_MODULE_ABSTRACT > +#language en-US > +"Instance of PLDM Protocol Library in DXE phase." > + > +#string STR_MODULE_DESCRIPTION > +#language en-US > +"Instance of PLDM Protocol Library in DXE phase." > + > + > -- > 2.37.1.windows.1