Handle FRU records from host
- Get FRU record table from host and traverse the entity structure
from the FRU record set PDR, and create D-Bus object.
- When the FRU field type is a PLDM_OEM_FRU_FIELD_TYPE_LOCATION_CODE
, the location code is used to populate the
xyz.openbmc_project.Inventory.Decorator.LocationCode D-Bus
interface for the corresponding FRU.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I482c4d371f76b4881109ef420dfd9543e1aa810b
diff --git a/libpldmresponder/pdr_utils.hpp b/libpldmresponder/pdr_utils.hpp
index 739058e..b44120a 100644
--- a/libpldmresponder/pdr_utils.hpp
+++ b/libpldmresponder/pdr_utils.hpp
@@ -38,6 +38,22 @@
PLDM_SENSOR_ID
};
+struct FruTLV
+{
+ uint8_t fruFieldType;
+ uint8_t fruFieldLen;
+ std::vector<uint8_t> fruFieldValue;
+};
+
+struct FruRecordDataFormat
+{
+ uint16_t fruRSI;
+ uint8_t fruRecType;
+ uint8_t fruNum;
+ uint8_t fruEncodeType;
+ std::vector<FruTLV> fruTLV;
+};
+
/** @struct PdrEntry
* PDR entry structure that acts as a PDR record structure in the PDR
* repository to handle PDR APIs.
@@ -214,6 +230,18 @@
pldm::pdr::SensorInfo>
parseStateSensorPDR(const std::vector<uint8_t>& stateSensorPdr);
+/** @brief Parse FRU record table and return the vector of the FRU record data
+ * format structure
+ *
+ * @param[in] fruData - fru data
+ * @param[in] fruLen - fru len
+ *
+ * @return std::vector<FruRecordDataFormat> - the vector of the FRU record data
+ * format structure
+ */
+std::vector<FruRecordDataFormat> parseFruRecordTable(const uint8_t* fruData,
+ size_t fruLen);
+
} // namespace pdr_utils
} // namespace responder
} // namespace pldm