[PATCH 3/6] firmware: ti_sci.c: Add a function to query DM firmware's capability

Neha Malcom Francis n-francis at ti.com
Tue Jun 3 08:16:15 CEST 2025


On 28/05/25 13:35, Moteen Shah wrote:
> Add a new function to query the capabilities of the DM firmware, using
> TI SCI protocol to retrieve a 64-bit firmware capability, where each bit
> represents a specific capability supported by the firmware.
> 
> Signed-off-by: Moteen Shah <m-shah at ti.com>
> ---
>  drivers/firmware/ti_sci.c | 45 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
> 
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index 54d6689ce78..bb9738efa81 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -278,6 +278,48 @@ static int ti_sci_do_xfer(struct ti_sci_info *info,
>  	return ret;
>  }
>  
> +/**
> + * ti_sci_cmd_query_dm_cap() - Command to query DM firmware's capabilities
> + * @handle:	Pointer to TI SCI handle
> + * @fw_caps:	Pointer to firmware capabilities
> + *
> + * Return: 0 if all went fine, else return appropriate error.
> + */
> +static int ti_sci_cmd_query_dm_cap(struct ti_sci_handle *handle, u64 *fw_caps)
> +{
> +	struct ti_sci_query_fw_caps_resp *cap_info;
> +	struct ti_sci_msg_hdr hdr;
> +	struct ti_sci_info *info;
> +	struct ti_sci_xfer *xfer;
> +	int ret;
> +
> +	if (IS_ERR(handle))
> +		return PTR_ERR(handle);
> +	if (!handle)
> +		return -EINVAL;
> +
> +	info = handle_to_ti_sci_info(handle);
> +
> +	xfer = ti_sci_setup_one_xfer(info, TI_SCI_MSG_QUERY_FW_CAPS,
> +				     TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
> +				     (u32 *)&hdr, sizeof(struct ti_sci_msg_hdr),
> +				     sizeof(*cap_info));
> +	if (IS_ERR(xfer)) {
> +		ret = PTR_ERR(xfer);
> +		return ret;
> +	}
> +
> +	ret = ti_sci_do_xfer(info, xfer);
> +	if (ret)
> +		return ret;
> +
> +	cap_info = (struct ti_sci_query_fw_caps_resp *)xfer->tx_message.buf;
> +
> +	*fw_caps = cap_info->fw_caps;
> +
> +	return 0;
> +}
> +
>  /**
>   * ti_sci_cmd_get_revision() - command to get the revision of the SCI entity
>   * @handle:	pointer to TI SCI handle
> @@ -2624,6 +2666,7 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
>  	struct ti_sci_dev_ops *dops = &ops->dev_ops;
>  	struct ti_sci_clk_ops *cops = &ops->clk_ops;
>  	struct ti_sci_core_ops *core_ops = &ops->core_ops;
> +	struct ti_sci_firmware_ops *fw_ops = &ops->fw_ops;
>  	struct ti_sci_rm_core_ops *rm_core_ops = &ops->rm_core_ops;
>  	struct ti_sci_proc_ops *pops = &ops->proc_ops;
>  	struct ti_sci_rm_ringacc_ops *rops = &ops->rm_ring_ops;
> @@ -2694,6 +2737,8 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
>  	fwl_ops->set_fwl_region = ti_sci_cmd_set_fwl_region;
>  	fwl_ops->get_fwl_region = ti_sci_cmd_get_fwl_region;
>  	fwl_ops->change_fwl_owner = ti_sci_cmd_change_fwl_owner;
> +
> +	fw_ops->query_dm_cap = ti_sci_cmd_query_dm_cap;
>  }
>  
>  /**

Reviewed-by: Neha Malcom Francis <n-francis at ti.com>

-- 
Thanking You
Neha Malcom Francis


More information about the U-Boot mailing list