From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.40]) by mx.groups.io with SMTP id smtpd.web11.73098.1680534332943131218 for ; Mon, 03 Apr 2023 08:05:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=2C7ylB/9; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.236.40, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AN7ZKfcqEdtG4/Ab6J5E25L1K9U41ZQ4kuIf7bvm2yuCuXNDtDt7IXNpG+Yg7l3FR7nEK8D1q6z2bhSe13iRo0ddXPLEHaZppqk8scGb4czvhYHpjIv/MSdjd9mHKYmtx/aqsuqIwk1pXgfYZkeztITxdXA7AELK158XVidyGRjXWTrwUNoABBAQViYdON732gdVT/Z3kC3bf5aECx6sQDqDtU04dxA4bue7RxabZVRGK4wuMfMKqWJlDSnAo9fLUkVHR7FdDvSHreQjbaa5q6om6EQVSVJVh4q1iEExL8PzjWEPTMnssCVwR9a9OkrYDLzREQDRvFiNDKWVIuwFdw== 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=KWh8lPapdn0i8TLp+kRi1h+wX4buNxAELVsDpkXQXhk=; b=GJXfEQY9IviTtSyDtySopq9v9qQ1T5SWhNVEyr+/Ha7K1V+rKrawPeW4tKxXWfP144NVKoEBMiwDhKqds2fcey1GRMisATAwuUEuzlZ+7vU54FL2+4GT9vuNhEwZ2UWRSsV8ppZh1cb/F+sSSyMFYuxK6RJ7MLftMOLK6gWpHLDUvVBkmwY6PZkkRWphuqaNmUJg42wPVH2VkiTwCDQhWlKWZB86dtrF1EcNpRSFn4oJn5Q02+Ob/yKZKHHq0iXP3mY+Lav5mKSeRy/PJX/94I3WmP3TUlIOKe3YyQ4HcN5JaT7OKoQn8LE7gjLRawwDamy6lJz4VfDD8puX6/AH9g== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KWh8lPapdn0i8TLp+kRi1h+wX4buNxAELVsDpkXQXhk=; b=2C7ylB/9SFU2ldxqN2VM/3V9Io7s7YIDx3I3IZ+zFubQqyHvSDh5SiuIAgt1XcQz35shunw4ntfoguKh0o9X+lKK17H1dya6NjkY/tGJvJMxcdLWVnG+6yGQGg3a52Frt9x2j4qpJ4/bnJn7beO2eQCLTD/vaaRy3bGUdA49NAM= Received: from DM6PR12CA0025.namprd12.prod.outlook.com (2603:10b6:5:1c0::38) by DS7PR12MB8323.namprd12.prod.outlook.com (2603:10b6:8:ec::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.30; Mon, 3 Apr 2023 15:05:29 +0000 Received: from DM6NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1c0:cafe::55) by DM6PR12CA0025.outlook.office365.com (2603:10b6:5:1c0::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22 via Frontend Transport; Mon, 3 Apr 2023 15:05:29 +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 (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 Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT066.mail.protection.outlook.com (10.13.173.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6277.16 via Frontend Transport; Mon, 3 Apr 2023 15:05:28 +0000 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; Mon, 3 Apr 2023 10:05:26 -0500 From: "Chang, Abner" To: CC: Isaac Oram , Abdul Lateef Attar , Nickle Wang , Igor Kulchytskyy Subject: [edk2-platforms][PATCH 05/14] ManageabilityPkg: Add PldmProtocolLib Date: Mon, 3 Apr 2023 23:04:50 +0800 Message-ID: <20230403150459.925-6-abner.chang@amd.com> X-Mailer: git-send-email 2.37.1.windows.1 In-Reply-To: <20230403150459.925-1-abner.chang@amd.com> References: <20230403150459.925-1-abner.chang@amd.com> MIME-Version: 1.0 Return-Path: Abner.Chang@amd.com X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT066:EE_|DS7PR12MB8323:EE_ X-MS-Office365-Filtering-Correlation-Id: ef65d8f8-c253-4f16-b8d0-08db3454dcc2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4EZZIJARHfOis2nRIEvTxeYSLMPviasJGjbHJCywK1fmx0bH9uqehScvPCvmJGA/mrP9qvgAlAkfCWA1YYnC5lfhjfvYt2F678e1HwTaoZQbnoKoS/nE9LOkm6dn2M3GYLx3e6ldtD8VsqiNl3BxBKVlQGNE3Ss9Wewlp79VLSlm6ePEJjB73fLd7NhxQhrmmSy13H2dgtuMHYsCXGuwGOgpNbcjh7oye0AVhJuYtH3xabKrw/iQypXyU9jFyVrOOyUhs5Pl+h/aRdUhr9tX/JC80viWxV7LpNJtghJifRpB1ydILZpqNEgrfk4UaE1AD9ANHvgraV6V1zx9rMgRwHWT8VXCNkFJriGtXvCswvmNkoGdU4TixzU9qu2KGsquawbSgo5MMlmlMyHMVHfp57ox9WbmCYkTTOzfoSmsWFeSPcJG4HYvUdHpTVT8otgbFE/qfzVwoe49ucXGvZdqeKGfrLPNca9OHXR3Au1pDvbB/KuIou/qXF6xGd5T0TGntrgN7WfMH77C0OVMau2/xlKJaxEmxepki5tOw38cN+hvdI9/zsjE66C8WGhvPxbsnHnX/J0iIUSRqHLoEmqxvbc9wEbDbqKdqArUU8GTZ8D26o3hSWQSI0FDHgBugHlJQIbJN3SjusxX9mgJ2mRkxWKgEIwijogcvjEr2CIZHUG3Z528g20QLaBuJSy9vOmHnGtlZchxQDe++tkhetIIHClfdsBu/biI9gJDrBZFcXEPbmfFxyzW2Y/m39kR1FK3fMPtyCn8VS8EGcLVwB+uAw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199021)(46966006)(36840700001)(40470700004)(82740400003)(82310400005)(356005)(81166007)(40460700003)(2876002)(86362001)(40480700001)(36756003)(7696005)(6666004)(2906002)(186003)(16526019)(1076003)(4326008)(26005)(6916009)(70586007)(70206006)(8936002)(5660300002)(41300700001)(478600001)(8676002)(316002)(54906003)(30864003)(36860700001)(336012)(426003)(83380400001)(47076005)(2616005)(156123004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2023 15:05:28.7921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef65d8f8-c253-4f16-b8d0-08db3454dcc2 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: DM6NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8323 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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 --- .../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 9a930d3e4b..1e9245c8dc 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 0d868fdf4a..59549eb39a 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 NUL= L +**/ +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..ac6225ed92 --- /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", = Status)); + return EFI_NOT_FOUND; + } + } + + DEBUG ((DEBUG_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_INFO, "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