From: Abner Chang <abner.ch...@amd.com>

Currently all PLDM functions inside the PLDM_SMBIOS_TRANSFER_PROTOCOL
use PLDM terminus PCDs for the MCTP addressing.
Add additional function to the protocol API to provide user a way to
use custom TIDs.

Signed-off-by: Abner Chang <abner.ch...@amd.com>
Signed-off-by: Konstantin Aladyshev <aladyshe...@gmail.com>
---
 .../Protocol/PldmSmbiosTransferProtocol.h     | 26 +++++++++++++++++
 .../PldmSmbiosTransferDxe.c                   | 28 +++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git 
a/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h 
b/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h
index 7903e12726..8b23d39682 100644
--- a/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h
+++ b/Features/ManageabilityPkg/Include/Protocol/PldmSmbiosTransferProtocol.h
@@ -23,6 +23,31 @@ typedef struct  _EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL 
EDKII_PLDM_SMBIOS_TRANSFER_
 #define EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_VERSION        
((EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_VERSION_MAJOR << 8) |\
                                                        
EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_VERSION_MINOR)
 
+/**
+  This function sets PLDM SMBIOS transfer source and destination
+  PLDM terminus ID.
+
+  @param [in]   This           EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL instance.
+  @param [in]   SourceId       PLDM source teminus ID.
+                               Set to PLDM_TERMINUS_ID_UNASSIGNED means use
+                               platform default PLDM terminus ID.
+                               
(gManageabilityPkgTokenSpaceGuid.PcdPldmSourceTerminusId)
+  @param [in]   DestinationId  PLDM destination teminus ID.
+                               Set to PLDM_TERMINUS_ID_UNASSIGNED means use
+                               platform default PLDM terminus ID.
+                               
(gManageabilityPkgTokenSpaceGuid.PcdPldmDestinationEndpointId)
+
+  @retval       EFI_SUCCESS            Get SMBIOS table metadata Successfully.
+  @retval       EFI_INVALID_PARAMETER  Invalid value of source or destination
+                                       PLDM terminus ID.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PLDM_GET_SMBIOS_TRANSFER_TERMINUS_ID)(
+  IN  UINT8  SourceId,
+  IN  UINT8  DestinationId
+  );
+
 /**
   This function gets SMBIOS table metadata.
 
@@ -151,6 +176,7 @@ EFI_STATUS
 // EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL
 //
 typedef struct {
+  PLDM_GET_SMBIOS_TRANSFER_TERMINUS_ID        SetPldmSmbiosTransferTerminusId;
   PLDM_GET_SMBIOS_STRUCTURE_TABLE_METADATA    GetSmbiosStructureTableMetaData;
   PLDM_SET_SMBIOS_STRUCTURE_TABLE_METADATA    SetSmbiosStructureTableMetaData;
   PLDM_GET_SMBIOS_STRUCTURE_TABLE             GetSmbiosStructureTable;
diff --git 
a/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.c
 
b/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.c
index fdf033f0b1..357a7d49e4 100644
--- 
a/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.c
+++ 
b/Features/ManageabilityPkg/Universal/PldmSmbiosTransferDxe/PldmSmbiosTransferDxe.c
@@ -25,6 +25,33 @@
 
 UINT32  SetSmbiosStructureTableHandle;
 
+/**
+  This function sets PLDM SMBIOS transfer source and destination
+  PLDM terminus ID.
+
+  @param [in]   This           EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL instance.
+  @param [in]   SourceId       PLDM source teminus ID.
+                               Set to PLDM_TERMINUS_ID_UNASSIGNED means use
+                               platform default PLDM terminus ID.
+                               
(gManageabilityPkgTokenSpaceGuid.PcdPldmSourceTerminusId)
+  @param [in]   DestinationId  PLDM destination teminus ID.
+                               Set to PLDM_TERMINUS_ID_UNASSIGNED means use
+                               platform default PLDM terminus ID.
+                               
(gManageabilityPkgTokenSpaceGuid.PcdPldmDestinationEndpointId)
+
+  @retval       EFI_SUCCESS            Get SMBIOS table metadata Successfully.
+  @retval       EFI_INVALID_PARAMETER  Invalid value of source or destination
+                                       PLDM terminus ID.
+**/
+EFI_STATUS
+SetPldmSmbiosTransferTerminusId (
+  IN  UINT8  SourceId,
+  IN  UINT8  DestinationId
+  )
+{
+  return PldmSetTerminus(SourceId, DestinationId);
+}
+
 /**
   Get the full size of SMBIOS structure including optional strings that follow 
the formatted structure.
 
@@ -457,6 +484,7 @@ GetSmbiosStructureByHandle (
 }
 
 EDKII_PLDM_SMBIOS_TRANSFER_PROTOCOL_V1_0  mPldmSmbiosTransferProtocolV10 = {
+  SetPldmSmbiosTransferTerminusId,
   GetSmbiosStructureTableMetaData,
   SetSmbiosStructureTableMetaData,
   GetSmbiosStructureTable,
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109865): https://edk2.groups.io/g/devel/message/109865
Mute This Topic: https://groups.io/mt/102080245/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to