From: "Nickle Wang" <nicklew@nvidia.com>
To: "abner.chang@amd.com" <abner.chang@amd.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Isaac Oram <isaac.w.oram@intel.com>,
Abdul Lateef Attar <abdattar@amd.com>,
Igor Kulchytskyy <igork@ami.com>
Subject: Re: [edk2-platforms][PATCH 05/14] ManageabilityPkg: Add PldmProtocolLib
Date: Tue, 11 Apr 2023 13:41:16 +0000 [thread overview]
Message-ID: <MW4PR12MB7031380587C7C0D7D5A9912ED99A9@MW4PR12MB7031.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20230403150459.925-6-abner.chang@amd.com>
Hi Abner,
It seems to me that some of protocol GUIDs are defined in [Guids] section instead of [Protocol] section in Features/ManageabilityPkg/ManageabilityPkg.dec file. Could you please address this together?
Thanks,
Nickle
> -----Original Message-----
> From: abner.chang@amd.com <abner.chang@amd.com>
> Sent: Monday, April 3, 2023 11:05 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram <isaac.w.oram@intel.com>; Abdul Lateef Attar
> <abdattar@amd.com>; Nickle Wang <nicklew@nvidia.com>; Igor Kulchytskyy
> <igork@ami.com>
> Subject: [edk2-platforms][PATCH 05/14] ManageabilityPkg: Add
> PldmProtocolLib
>
> External email: Use caution opening links or attachments
>
>
> From: Abner Chang <abner.chang@amd.com>
>
> PldmProtocolLib provides the library
> function to PLDM protocol.
>
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Isaac Oram <isaac.w.oram@intel.com>
> Cc: Abdul Lateef Attar <abdattar@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> ---
> .../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
>
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec
> b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 9a930d3e4b..1e9245c8dc 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -48,3 +48,6 @@
> gManageabilityProtocolMctpGuid = { 0x76FED8F1, 0x0BE5, 0x4269, { 0xA3,
> 0x1A, 0x38, 0x0F, 0x54, 0xF1, 0xA1, 0x8A } }
> # Manageability Protocol PLDM
> gManageabilityProtocolPldmGuid = { 0x3958090D, 0x69DD, 0x4868, { 0x9C,
> 0x41, 0xC9, 0xAC, 0x31, 0xB5, 0x25, 0xC5 } }
> +
> +[Protocols]
> + gEdkiiPldmProtocolGuid = { 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 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/BaseManageability
> TransportHelperLib/BaseManageabilityTransportHelper.inf
>
> +[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 @@
>
> [Components]
>
> ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageability
> TransportKcs.inf
> + ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf
>
> [LibraryClasses]
>
> ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransp
> ortNullLib/BaseManageabilityTransportNull.inf
> diff --git
> a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLi
> b.inf
> b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLi
> 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.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # # ##
> +
> +[Defines]
> + INF_VERSION = 0x00010005
> + BASE_NAME = PldmProtocolLib
> + MODULE_UNI_FILE = PldmProtocolLib.uni
> + FILE_GUID = 5B1173E8-6A5A-468B-BDA4-02303530C55C
> + MODULE_TYPE = DXE_DRIVER
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = PldmProtocolLib|DXE_RUNTIME_DRIVER
> DXE_DRIVER DXE_CORE UEFI_DRIVER UEFI_APPLICATION
> +
> +#
> +# VALID_ARCHITECTURES = 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.<BR>
> + 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 transport
> 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 resource
> 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.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EDKII_PLDM_PROTOCOL_H_
> +#define EDKII_PLDM_PROTOCOL_H_
> +
> +#include <IndustryStandard/Pldm.h>
> +
> +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 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/PldmProtocolLi
> b.c
> b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLi
> b.c
> new file mode 100644
> index 0000000000..ac6225ed92
> --- /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.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <PiDxe.h>
> +#include <Protocol/PldmProtocol.h>
> +#include <Library/DebugLib.h>
> +#include <Library/ManageabilityTransportHelperLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +
> +EDKII_PLDM_PROTOCOL *mEdkiiPldmProtocol = 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 transport
> 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 resource
> 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 == NULL) {
> + Status = gBS->LocateProtocol (
> + &gEdkiiPldmProtocolGuid,
> + NULL,
> + (VOID **)&mEdkiiPldmProtocol
> + );
> + if (EFI_ERROR (Status)) {
> + //
> + // Dxe PLDM Protocol is not installed. So, PLDM device is not present.
> + //
> + 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 != NULL) &&
> (RequestDataSize != 0)) {
> + HelperManageabilityDebugPrint ((VOID *)RequestData,
> + RequestDataSize, "PLDM PLDM application layer Type/Command specific
> + request payload\n"); }
> +
> + Status = 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 != NULL) && (*ResponseDataSize != 0)) {
> + HelperManageabilityDebugPrint ((VOID *)ResponseData,
> + *ResponseDataSize, "PLDM application layer response payload\n"); }
> +
> + return Status;
> +}
> diff --git
> a/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLi
> b.uni
> b/Features/ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLi
> 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.<BR> // // 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
next prev parent reply other threads:[~2023-04-11 13:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 15:04 [edk2-platforms][PATCH 00/14] ManageabilityPkg part II Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 01/14] ManageabilityPkg: Add more helper functions Chang, Abner
2023-04-10 17:23 ` [edk2-devel] " Tinh Nguyen
2023-04-11 5:29 ` Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 02/14] ManageabilityPkg: Support Maximum Transfer Unit Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 03/14] ManageabilityPkg: Fix Uncrustify errors Chang, Abner
2023-04-10 17:25 ` [edk2-devel] " Tinh Nguyen
2023-04-11 5:31 ` Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 04/14] ManageabilityPkg: Add HeaderSize and TrailerSize Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 05/14] ManageabilityPkg: Add PldmProtocolLib Chang, Abner
2023-04-11 13:41 ` Nickle Wang [this message]
2023-04-03 15:04 ` [edk2-platforms][PATCH 06/14] ManageabilityPkg: Add PldmSmbiosTransferDxe driver Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 07/14] ManageabilityPkg/KCS: KCS transport interface Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 08/14] ManageabilityPkg: Add definitions of MCTP Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 09/14] ManageabilityPkg/MctpProtocol: Add MctpProtocol Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 10/14] ManageabilityPkg: Add MCTP transport interface Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 11/14] ManageabilityPkg/PldmProtocol: Add PLDM protocol Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 12/14] ManageabilityPkg: Add Manageability PCDs Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 13/14] ManageabilityPkg: Relocate Manageability.dsc Chang, Abner
2023-04-10 17:27 ` Tinh Nguyen
2023-04-11 5:55 ` Chang, Abner
2023-04-03 15:04 ` [edk2-platforms][PATCH 14/14] ManageabilityPkg: Add Manageability FDFs Chang, Abner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MW4PR12MB7031380587C7C0D7D5A9912ED99A9@MW4PR12MB7031.namprd12.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox