fw_update: Create FirmwareInventory entries per component
Previously, only a single firmware inventory entry was created per
device (with component identifier 0 and image set version). This didn't
properly represent devices with multiple firmware components in the
Redfish FirmwareInventory collection.
Fix is to create individual FirmwareInventory entry for each firmware
component, with:
- Individual component version strings
- Component-specific naming (Device_Name_Component_<ID>)
This allows proper representation of multi-component firmware devices
in Redfish, where each component appears as a separate updatable
firmware resource.
Tested: Verified all firmware components appear in FirmwareInventory and
each component shows its individual version on B40:
'''
curl -k https://root:0penBmc@localhost/redfish/v1/UpdateService/FirmwareInventory
{
"Members": [
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/PLDM_Device_Firmware_Device_12_Component_65282_1913"
},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/PLDM_Device_Firmware_Device_13_Component_49152_73"
},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/PLDM_Device_Firmware_Device_13_Component_49168_8233"
}
],
"Members@odata.count": 4
}
curl -k https://root:0penBmc@localhost/redfish/v1/UpdateService/FirmwareInventory/PLDM_Device_Firmware_Device_13_Component_49152_73
{
"@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
"Id": "PLDM_Device_Firmware_Device_13_Component_49152_73",
...
"Version": "98.02.90.00.00"
}
'''
Change-Id: I5c91de3a886a4335e7357f4498db787624f330d1
Signed-off-by: Rajeev Ranjan <ranjan.rajeev1609@gmail.com>
diff --git a/fw-update/inventory_manager.cpp b/fw-update/inventory_manager.cpp
index 6ad9f39..7975f7a 100644
--- a/fw-update/inventory_manager.cpp
+++ b/fw-update/inventory_manager.cpp
@@ -671,25 +671,30 @@
componentInfo.emplace(
std::make_pair(compClassification, compIdentifier),
compEntry.comp_classification_index);
+
+ if (firmwareDeviceNameMap.contains(eid) and descriptorMap.contains(eid))
+ {
+ auto componentName = firmwareDeviceNameMap.at(eid) + "_Component_" +
+ std::to_string(compIdentifier);
+
+ firmwareInventoryManager.createFirmwareEntry(
+ SoftwareIdentifier(eid, compIdentifier), componentName,
+ utils::toString(activeCompVerStr), descriptorMap.at(eid),
+ componentInfo);
+ }
+ else
+ {
+ error(
+ "Firmware device name or descriptor map not found for endpoint ID {EID}",
+ "EID", eid);
+ }
+
compParamPtr += sizeof(pldm_component_parameter_entry) +
activeCompVerStr.length + pendingCompVerStr.length;
compParamTableLen -= sizeof(pldm_component_parameter_entry) +
activeCompVerStr.length + pendingCompVerStr.length;
}
- if (firmwareDeviceNameMap.contains(eid))
- {
- firmwareInventoryManager.createFirmwareEntry(
- SoftwareIdentifier(eid, 0), firmwareDeviceNameMap.at(eid),
- utils::toString(activeCompImageSetVerStr), descriptorMap[eid],
- componentInfo);
- }
- else
- {
- error("Firmware device name not found for endpoint ID {EID}", "EID",
- eid);
- }
-
componentInfoMap.insert_or_assign(eid, std::move(componentInfo));
}