feat(ti): add TI-SCI query firmware capabilities command support
This TISCI API is used to retrieve the firmware capabilities of the
currently running system-firmware.
Signed-off-by: Andrew Davis <afd@ti.com>
Change-Id: I55402dcf876e997eb21bb1f31c725e167c507c47
diff --git a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c
index 495f0c7..3f22bfd 100644
--- a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c
+++ b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c
@@ -211,6 +211,42 @@
}
/**
+ * ti_sci_query_fw_caps() - Get the FW/SoC capabilities
+ * @handle: Pointer to TI SCI handle
+ * @fw_caps: Each bit in fw_caps indicating one FW/SOC capability
+ *
+ * Return: 0 if all went well, else returns appropriate error value.
+ */
+int ti_sci_query_fw_caps(uint64_t *fw_caps)
+{
+ struct ti_sci_msg_hdr req;
+ struct ti_sci_msg_resp_query_fw_caps resp;
+
+ struct ti_sci_xfer xfer;
+ int ret;
+
+ ret = ti_sci_setup_one_xfer(TI_SCI_MSG_QUERY_FW_CAPS, 0,
+ &req, sizeof(req),
+ &resp, sizeof(resp),
+ &xfer);
+ if (ret != 0U) {
+ ERROR("Message alloc failed (%d)\n", ret);
+ return ret;
+ }
+
+ ret = ti_sci_do_xfer(&xfer);
+ if (ret != 0U) {
+ ERROR("Transfer send failed (%d)\n", ret);
+ return ret;
+ }
+
+ if (fw_caps)
+ *fw_caps = resp.fw_caps;
+
+ return 0;
+}
+
+/**
* ti_sci_device_set_state() - Set device state
*
* @id: Device identifier