fw_update: InventoryManager: Add Downstream Devices Support
In DSP0267_1.1.0, a Firmware Device can supports one or more
Downstream Devices to perform get firmware version or firmware
update. Add discovery of Downstream Devices, query the Downstream
Devices Descriptor if the Firmware Device support it.
The code is developed based on DSP0267_1.1.0 Section 10.3
QueryDownstreamDevices command format, Section 10.4
QueryDownstreamIdentifiers command format.
Tested: Add unit tests for the new command handlers.
Change-Id: Iad28b898b5a0799b2b145d38958bba78e9719f4e
Signed-off-by: Unive Tien <unive.tien.wiwynn@gmail.com>
diff --git a/fw-update/inventory_manager.hpp b/fw-update/inventory_manager.hpp
index 953d7a4..ade1fcd 100644
--- a/fw-update/inventory_manager.hpp
+++ b/fw-update/inventory_manager.hpp
@@ -34,15 +34,21 @@
* @param[in] instanceIdDb - Managing instance ID for PLDM requests
* @param[out] descriptorMap - Populate the firmware identifiers for the
* FDs managed by the BMC.
+ * @param[out] downstreamDescriptorMap - Populate the downstream
+ * identifiers for the FDs managed
+ * by the BMC.
* @param[out] componentInfoMap - Populate the component info for the FDs
* managed by the BMC.
*/
explicit InventoryManager(
pldm::requester::Handler<pldm::requester::Request>& handler,
InstanceIdDb& instanceIdDb, DescriptorMap& descriptorMap,
+ DownstreamDescriptorMap& downstreamDescriptorMap,
ComponentInfoMap& componentInfoMap) :
handler(handler), instanceIdDb(instanceIdDb),
- descriptorMap(descriptorMap), componentInfoMap(componentInfoMap)
+ descriptorMap(descriptorMap),
+ downstreamDescriptorMap(downstreamDescriptorMap),
+ componentInfoMap(componentInfoMap)
{}
/** @brief Discover the firmware identifiers and component details of FDs
@@ -68,6 +74,33 @@
void queryDeviceIdentifiers(mctp_eid_t eid, const pldm_msg* response,
size_t respMsgLen);
+ /** @brief Handler for QueryDownstreamDevices command response
+ *
+ * @param[in] eid - Remote MCTP endpoint
+ * @param[in] response - PLDM response message
+ * @param[in] respMsgLen - Response message length
+ */
+ void queryDownstreamDevices(mctp_eid_t eid, const pldm_msg* response,
+ size_t respMsgLen);
+
+ /** @brief Handler for QueryDownstreamIdentifiers command response
+ *
+ * @param[in] eid - Remote MCTP endpoint
+ * @param[in] response - PLDM response message
+ * @param[in] respMsgLen - Response message length
+ */
+ void queryDownstreamIdentifiers(mctp_eid_t eid, const pldm_msg* response,
+ size_t respMsgLen);
+
+ /** @brief Handler for GetDownstreamFirmwareParameters command response
+ *
+ * @param[in] eid - Remote MCTP endpoint
+ * @param[in] response - PLDM response message
+ * @param[in] respMsgLen - Response message length
+ */
+ void getDownstreamFirmwareParameters(
+ mctp_eid_t eid, const pldm_msg* response, size_t respMsgLen);
+
/** @brief Handler for GetFirmwareParameters command response
*
* Handling the response of GetFirmwareParameters command and create
@@ -81,6 +114,45 @@
size_t respMsgLen);
private:
+ /**
+ * @brief Sends QueryDeviceIdentifiers request
+ *
+ * @param[in] eid - Remote MCTP endpoint
+ */
+ void sendQueryDeviceIdentifiersRequest(mctp_eid_t eid);
+
+ /**
+ * @brief Sends QueryDownstreamDevices request
+ *
+ * @param[in] eid - Remote MCTP endpoint
+ */
+ void sendQueryDownstreamDevicesRequest(mctp_eid_t eid);
+
+ /**
+ * @brief Sends QueryDownstreamIdentifiers request
+ *
+ * The request format is defined at Table 16 – QueryDownstreamIdentifiers
+ * command format in DSP0267_1.1.0
+ *
+ * @param[in] eid - Remote MCTP endpoint
+ * @param[in] dataTransferHandle - Data transfer handle
+ * @param[in] transferOperationFlag - Transfer operation flag
+ */
+ void sendQueryDownstreamIdentifiersRequest(
+ mctp_eid_t eid, uint32_t dataTransferHandle,
+ enum transfer_op_flag transferOperationFlag);
+
+ /**
+ * @brief Sends QueryDownstreamFirmwareParameters request
+ *
+ * @param[in] eid - Remote MCTP endpoint
+ * @param[in] dataTransferHandle - Data transfer handle
+ * @param[in] transferOperationFlag - Transfer operation flag
+ */
+ void sendGetDownstreamFirmwareParametersRequest(
+ mctp_eid_t eid, uint32_t dataTransferHandle,
+ const enum transfer_op_flag transferOperationFlag);
+
/** @brief Send GetFirmwareParameters command request
*
* @param[in] eid - Remote MCTP endpoint
@@ -96,6 +168,9 @@
/** @brief Device identifiers of the managed FDs */
DescriptorMap& descriptorMap;
+ /** @brief Downstream Device identifiers of the managed FDs */
+ DownstreamDescriptorMap& downstreamDescriptorMap;
+
/** @brief Component information needed for the update of the managed FDs */
ComponentInfoMap& componentInfoMap;
};