platform-mc: discovery FRU data from terminus
As [1], `pldmd` will host Fru D-Bus inventory object path and Fru
`xyz.openbmc_project.Inventory.Decorator.*` D-Bus interfaces of one PLDM
terminus.
[1] https://github.com/openbmc/docs/blob/master/designs/pldm-stack.md#processing-pldm-fru-information-sent-down-by-the-host-firmware
Support getting FRU data from terminus in the terminus discovery phase
and expose FRU data to the Fru D-Bus properties in
`xyz.openbmc_project.Inventory.Decorator.Asset`,
`xyz.openbmc_project.Inventory.Decorator.AssetTag`,
`xyz.openbmc_project.Inventory.Decorator.Compatible` and
`xyz.openbmc_project.Inventory.Decorator.Revision` interfaces of
`xyz/openbmc_project/FruPldm/<Terminus_Name>` D-Bus object path which is
created by `xyz.openbmc_project.PLDM` D-Bus service. The object path
will be available until the endpoint EID is removed from the MCTP
D-Bus.
```
busctl introspect xyz.openbmc_project.PLDM /xyz/openbmc_project/inventory/system/board/S0
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.DBus.Introspectable interface - - -
.Introspect method - s -
org.freedesktop.DBus.Peer interface - - -
.GetMachineId method - s -
.Ping method - - -
org.freedesktop.DBus.Properties interface - - -
.Get method ss v -
.GetAll method s a{sv} -
.Set method ssv - -
.PropertiesChanged signal sa{sv}as - -
xyz.openbmc_project.Inventory.Decorator.Asset interface - - -
.BuildDate property s "" emits-change writable
.Manufacturer property s "" emits-change writable
.Model property s "00014003" emits-change writable
.PartNumber property s "" emits-change writable
.SerialNumber property s "000000218" emits-change writable
.SparePartNumber property s "" emits-change writable
.SubModel property s "" emits-change writable
xyz.openbmc_project.Inventory.Decorator.AssetTag interface - - -
.AssetTag property s "" emits-change writable
xyz.openbmc_project.Inventory.Decorator.Compatible interface - - -
.Names property as 0 emits-change writable
xyz.openbmc_project.Inventory.Decorator.Revision interface - - -
.Version property s "x.x.00008.004" emits-change writable
xyz.openbmc_project.Inventory.Item.Board interface - - -
```
Signed-off-by: Dung Cao <dung@os.amperecomputing.com>
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: I4f8869f8fee0fc0f8a5a5670d9a42fc7f48cc798
diff --git a/platform-mc/platform_manager.hpp b/platform-mc/platform_manager.hpp
index 549a4e7..d16af75 100644
--- a/platform-mc/platform_manager.hpp
+++ b/platform-mc/platform_manager.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "libpldm/fru.h"
#include "libpldm/platform.h"
#include "libpldm/pldm.h"
@@ -138,6 +139,49 @@
bitfield8_t& synchronyConfigurationSupported,
uint8_t& numerEventClassReturned, std::vector<uint8_t>& eventClass);
+ /** @brief Get FRU Record Tables from remote MCTP Endpoint
+ *
+ * @param[in] tid - Destination TID
+ * @param[in] total - Total number of record in table
+ * @param[out] fruData - Returned fru record table data
+ */
+ exec::task<int> getFRURecordTables(pldm_tid_t tid, const uint16_t& total,
+ std::vector<uint8_t>& fruData);
+
+ /** @brief Fetch FRU Record Data from terminus
+ *
+ * @param[in] tid - Destination TID
+ * @param[in] dataTransferHndl - Data transfer handle
+ * @param[in] transferOpFlag - Transfer Operation Flag
+ * @param[out] nextDataTransferHndl - Next data transfer handle
+ * @param[out] transferFlag - Transfer flag
+ * @param[out] responseCnt - Response count of record data
+ * @param[out] recordData - Returned record data
+ *
+ * @return coroutine return_value - PLDM completion code
+ */
+ exec::task<int> getFRURecordTable(
+ pldm_tid_t tid, const uint32_t dataTransferHndl,
+ const uint8_t transferOpFlag, uint32_t* nextDataTransferHndl,
+ uint8_t* transferFlag, size_t* responseCnt,
+ std::vector<uint8_t>& recordData);
+
+ /** @brief Get FRU Record Table Metadata from remote MCTP Endpoint
+ *
+ * @param[in] tid - Destination TID
+ * @param[out] total - Total number of record in table
+ */
+ exec::task<int> getFRURecordTableMetadata(pldm_tid_t tid, uint16_t* total);
+
+ /** @brief Parse record data from FRU table
+ *
+ * @param[in] tid - Destination TID
+ * @param[in] fruData - pointer to FRU record table
+ * @param[in] fruLen - FRU table length
+ */
+ void updateInventoryWithFru(pldm_tid_t tid, const uint8_t* fruData,
+ const size_t fruLen);
+
/** reference of TerminusManager for sending PLDM request to terminus*/
TerminusManager& terminusManager;