From nobody Sun Feb 8 02:08:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+103358+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1682054608922326.7538594467935; Thu, 20 Apr 2023 22:23:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id t8W0YY1788612xPt98OzzwKz; Thu, 20 Apr 2023 22:23:28 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.43]) by mx.groups.io with SMTP id smtpd.web11.5090.1682054607766451781 for ; Thu, 20 Apr 2023 22:23:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lb/CpDmoLfkOOW+A+xsHRrw9OP6cYxynx9unRcRaqzsCLokHh0FR2X1RDqol3DeV4bBIkDXKl/tC8K7p4oob+1tBX5ZyOSoXK1zw/SJPiUaSK/uf36SdH9eFs/JB2BZjPOM1/7ZKjPdnuwsRfB/agonU4t0Hh/r8yUOWx/wXBlM/WXA50dfZVAhgNug6zz8eATczHKbaNDmYvgiHQRHdqpx2HOodq8ORW8CSWJ7p9+Uh1QxIEYERPYm7uDp1jkr7dNmXqGZeFgqjLNP7v7TRtfECQY+f7I9Y2kQN6P/C4EVCVSywB16M+tJ4NpoanNq7GnJkdbreJxUBhQRYtmuXdQ== 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=JCsVnmMZNQrhaKXBD5gs0y1NRfOpnEDQUSzyI8pjY8s=; b=DeKGhjTS+ahHwdVZ44rGQDuVDBvOWafDxVMkip1Tu7xi+5XZBjlbE/SMVvttYeJSWvgSmxZunJ1AA7lrtwfr+qQraAfSrDbSs0TINhjXVALkZZJk1EKh8GGX8bzQz03es1gOkWOyFNM8YH9pFeFY0FAyRj4VVANY+LD7jt6yljP26ntR+iIa+72P10X4OsAUqzKyH7wD8USCJW350X5WuS5d+M+4QwFRH1IYUcm/sTF5ZecW/SFCc2LnGKyefZGnL6Kmjy62IlkZAQy1o9FS0yjvB54bRn+uDf8/dF1Riw5jRddKbQKqXcZwF8BuP8u54TEIzcx/DEezDgecBGUv7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none X-Received: from DM6PR04CA0030.namprd04.prod.outlook.com (2603:10b6:5:334::35) by DM4PR12MB6112.namprd12.prod.outlook.com (2603:10b6:8:aa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Fri, 21 Apr 2023 05:23:23 +0000 X-Received: from DS1PEPF0000B07A.namprd05.prod.outlook.com (2603:10b6:5:334:cafe::b6) by DM6PR04CA0030.outlook.office365.com (2603:10b6:5:334::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.24 via Frontend Transport; Fri, 21 Apr 2023 05:23:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+103358+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C X-Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF0000B07A.mail.protection.outlook.com (10.167.17.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6319.17 via Frontend Transport; Fri, 21 Apr 2023 05:23:23 +0000 X-Received: from TPE-L1-ABNCHANG.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 21 Apr 2023 00:23:21 -0500 From: "Chang, Abner via groups.io" To: CC: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Igor Kulchytskyy Subject: [edk2-devel] [edk2-platforms][PATCH V3 04/14] ManageabilityPkg: Add PldmProtocolLib Date: Fri, 21 Apr 2023 13:22:37 +0800 Message-ID: <20230421052247.1520-5-abner.chang@amd.com> In-Reply-To: <20230421052247.1520-1-abner.chang@amd.com> References: <20230421052247.1520-1-abner.chang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000B07A:EE_|DM4PR12MB6112:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e4b6b3d-1862-43f1-6088-08db4228871a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 5oa9peqwphsQ0U+J4qZQJF3AfyItDkTYcBMTlsRl84ecilYUKS6qpa1n2GIj7T09AwUDoO24zuuqu59CZQoA73aZC+neUWxrpUhc1gIkbY3mXof0GN4/pJ83b08H3Gyu38sQWK47bHfXH+12idImTukKiV/vRPuQH1vhtLzzIHof+OhP3YfAbvR1b/EJA3PtzzXZt9n+MIyeqeNu4+z+IZ67OixUGmxTfvRlF9a6wPI0RprsSY6tMoQjqhW9qy50BRfeunkzUYnWGP2qbPYelMUSQUnVU8fZVk3qzmFhTvyXzVUtNzx47ZuKqZJtJ+OeOqX3WrQE+nPlQmTdtEkhjWzHCXEzHmdNNJ6k3c4HG3F8q/DfFjP9oXq1Q5FdcJk36HoCZp20/VjnL5lB4gpiqHGd0bxLgacrOW1Qt8gRYfvtTqbaXarU2hkw/cThzEBmFRaXv40nK1sv9lucGbZz1ulet+4xMqg/Ufc6wAGYga9NUeCwJMyw1iCz2S8e2fnLrYT1SbUexNi03ofQv80VB26HK2JGjyyBSzW4xx8izpjh94IPXmMHn4Fqq8PO1cEWZKUuoZ9Lk9FreV2GoZNoLB7w7VKTEjJ+3syauRNqMJ4xMPqYbhsLPlWD/zdqPL3CrTnMOLJ87GRybVbOdYNNVaDh57JiEJUBvYU1nEDAKtq3ktO69yMNihRQxFt+i5PqVUTsWnewHeTk4orIVb7p8Cx5v7DN+z5HPvQYMf4B0klAWL6y+BNIfq+Duu/k346T8fg5Ifv5NjflyFC91WOn3A== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2023 05:23:23.5053 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e4b6b3d-1862-43f1-6088-08db4228871a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000B07A.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6112 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@amd.com X-Gm-Message-State: EXoWNgnPBDCHFAWcnWx6XQGBx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1682054608; bh=jLJQh04il/60tiA8s3fBlUXfSLHjNoNrqmk0Xq9+1lI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=M5dLxn1a0Awr0pCpoJJo0UQqF257zy0ZaeOomRrObKj2yUQwILv6Q70ZyTQ7uH2OyZ1 DbuZm+HM4MtluLHA10GXhaITuSmEl7xk4y3Hjmha9AjqITEiS1fTfmHYG0Sc5zV+AibR5 Oh94RXdoBbUqGSwtGBtYnItA/PYVK13xI4Q= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1682054609767100001 Content-Type: text/plain; charset="utf-8" From: Abner Chang PldmProtocolLib provides the library function to PLDM protocol. Signed-off-by: Abner Chang Cc: Isaac Oram Cc: Abdul Lateef Attar Cc: Nickle Wang Cc: Igor Kulchytskyy Reviewed-by: Abdul Lateef Attar --- .../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/D= xe/PldmProtocolLib.inf create mode 100644 Features/ManageabilityPkg/Include/Library/BasePldmProto= colLib.h create mode 100644 Features/ManageabilityPkg/Include/Protocol/PldmProtocol= .h create mode 100644 Features/ManageabilityPkg/Library/PldmProtocolLibrary/D= xe/PldmProtocolLib.c create mode 100644 Features/ManageabilityPkg/Library/PldmProtocolLibrary/D= xe/PldmProtocolLib.uni diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/Mana= geabilityPkg/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, { 0x= A3, 0x1A, 0x38, 0x0F, 0x54, 0xF1, 0xA1, 0x8A } } # Manageability Protocol PLDM gManageabilityProtocolPldmGuid =3D { 0x3958090D, 0x69DD, 0x4868, { 0x= 9C, 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/Feat= ures/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] ManageabilityTransportHelperLib|ManageabilityPkg/Library/BaseManageabili= tyTransportHelperLib/BaseManageabilityTransportHelper.inf =20 +[LibraryClasses.common.DXE_DRIVER] + PldmProtocolLib|ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmPro= tocolLib.inf + [LibraryClasses.ARM, LibraryClasses.AARCH64] # # This library provides the instrinsic functions generated by a given co= mpiler. diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc b/Features/Mana= geabilityPkg/ManageabilityPkg.dsc index 6a083385fd..412029ef6c 100644 --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc @@ -37,6 +37,7 @@ =20 [Components] ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageabili= tyTransportKcs.inf + ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf =20 [LibraryClasses] ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTran= sportNullLib/BaseManageabilityTransportNull.inf diff --git a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/Pldm= ProtocolLib.inf b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe= /PldmProtocolLib.inf new file mode 100644 index 0000000000..1233d76726 --- /dev/null +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtoco= lLib.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-02303530C55C + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PldmProtocolLib|DXE_RUNTIME_DRIVER DX= E_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/BasePldmProtocolLib.= 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 completi= on 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 tra= nsport interface + and a response was successfully received. + @retval EFI_NOT_FOUND Transport interface is not found. + @retval EFI_NOT_READY Transport interface is not ready for PLDM= message. + @retval EFI_DEVICE_ERROR Transport interface has an hardware error. + @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 resourc= e 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/Fe= atures/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_M= AJOR << 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 completi= on 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 successfully = submit to the device and a response was successfully received. + @retval EFI_NOT_FOUND The command was not successfully sent to = the device or a response was not successfully received from the device. + @retval EFI_NOT_READY PLDM transport interface is not ready for= PLDM command access. + @retval EFI_DEVICE_ERROR PLDM transport interface Device hardware = error. + @retval EFI_TIMEOUT The command time out. + @retval EFI_UNSUPPORTED The command was not successfully sent to = the device. + @retval EFI_OUT_OF_RESOURCES The resource allcation is out of resource= 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/Pldm= ProtocolLib.c b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/P= ldmProtocolLib.c new file mode 100644 index 0000000000..96727054ce --- /dev/null +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtoco= lLib.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 completi= on 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 tra= nsport interface + and a response was successfully received. + @retval EFI_NOT_FOUND Transport interface is not found. + @retval EFI_NOT_READY Transport interface is not ready for PLDM= message. + @retval EFI_DEVICE_ERROR Transport interface has an hardware error. + @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 resourc= e 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 presen= t. + // + DEBUG ((DEBUG_ERROR, "%a: EDKII PLDM protocol is not found - %r\n", = __FUNCTION__, Status)); + 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 ( + mEdkiiPldmProtocol, + 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/Pldm= ProtocolLib.uni b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe= /PldmProtocolLib.uni new file mode 100644 index 0000000000..b58a2ac146 --- /dev/null +++ b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtoco= lLib.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." + + --=20 2.37.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#103358): https://edk2.groups.io/g/devel/message/103358 Mute This Topic: https://groups.io/mt/98404949/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-