@@ -110,3 +110,39 @@ int pldm_fru_get_record_by_option(uint16_t fru_table_handle,
field_type,
fru_structure_data);
}
+
+int pldm_fru_dt_add_bmc_version(void)
+{
+ struct pldm_fru_record_data_format *record_data;
+ struct variable_field fru_structure_data;
+ struct pldm_fru_record_tlv *record_tlv;
+ struct dt_node *dt_fw_version;
+ int rc;
+
+ dt_fw_version = dt_find_by_name(dt_root, "ibm,firmware-versions");
+ if (!dt_fw_version)
+ return OPAL_SUCCESS;
+
+ /* retrieve the bmc information with
+ * "FRU Field Type": Version
+ * "FRU Record Set Identifier": 1,
+ * "FRU Record Type": "General(1)"
+ */
+ rc = get_fru_record_by_option_req(0,
+ 1,
+ PLDM_FRU_RECORD_TYPE_GENERAL,
+ PLDM_FRU_FIELD_TYPE_VERSION,
+ &fru_structure_data);
+ if (rc)
+ return rc;
+
+ record_data = (struct pldm_fru_record_data_format *)fru_structure_data.ptr;
+ record_tlv = (struct pldm_fru_record_tlv *)record_data->tlvs;
+ prlog(PR_DEBUG, "%s - value: %s\n", __func__, record_tlv->value);
+
+ dt_add_property_string(dt_fw_version,
+ "bmc-firmware-version",
+ record_tlv->value);
+
+ return OPAL_SUCCESS;
+}
@@ -20,4 +20,9 @@ int pldm_platform_power_off(void);
*/
int pldm_platform_restart(void);
+/**
+ * Update the firmware version device-tree field
+ */
+int pldm_fru_dt_add_bmc_version(void);
+
#endif /* __PLDM_H__ */
Use the GetFruRecordByOptionReq command to retrieve the bmc information with: "FRU Field Type": Version "FRU Record Set Identifier": 1, "FRU Record Type": "General(1)" and update the "bmc-firmware-version" device-tree field. Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com> --- core/pldm/pldm-fru-requests.c | 36 +++++++++++++++++++++++++++++++++++ include/pldm.h | 5 +++++ 2 files changed, 41 insertions(+)