mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
firmware: ti_sci: Use struct ti_sci_resource_desc in get_range ops
Use the ti_sci_resource_desc directly and update it's start and num members directly instead of requiring individual parameters for them. This will allow easy extension of the RM parameters without changing API. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
This commit is contained in:
parent
1c552e08b2
commit
967a020bd3
2 changed files with 31 additions and 33 deletions
|
@ -1703,14 +1703,14 @@ fail:
|
||||||
* @subtype: Resource assignment subtype that is being requested
|
* @subtype: Resource assignment subtype that is being requested
|
||||||
* from the given device.
|
* from the given device.
|
||||||
* @s_host: Host processor ID to which the resources are allocated
|
* @s_host: Host processor ID to which the resources are allocated
|
||||||
* @range_start: Start index of the resource range
|
* @desc: Pointer to ti_sci_resource_desc to be updated with the
|
||||||
* @range_num: Number of resources in the range
|
* resource range start index and number of resources
|
||||||
*
|
*
|
||||||
* Return: 0 if all went fine, else return appropriate error.
|
* Return: 0 if all went fine, else return appropriate error.
|
||||||
*/
|
*/
|
||||||
static int ti_sci_get_resource_range(const struct ti_sci_handle *handle,
|
static int ti_sci_get_resource_range(const struct ti_sci_handle *handle,
|
||||||
u32 dev_id, u8 subtype, u8 s_host,
|
u32 dev_id, u8 subtype, u8 s_host,
|
||||||
u16 *range_start, u16 *range_num)
|
struct ti_sci_resource_desc *desc)
|
||||||
{
|
{
|
||||||
struct ti_sci_msg_resp_get_resource_range *resp;
|
struct ti_sci_msg_resp_get_resource_range *resp;
|
||||||
struct ti_sci_msg_req_get_resource_range *req;
|
struct ti_sci_msg_req_get_resource_range *req;
|
||||||
|
@ -1721,7 +1721,7 @@ static int ti_sci_get_resource_range(const struct ti_sci_handle *handle,
|
||||||
|
|
||||||
if (IS_ERR(handle))
|
if (IS_ERR(handle))
|
||||||
return PTR_ERR(handle);
|
return PTR_ERR(handle);
|
||||||
if (!handle)
|
if (!handle || !desc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
info = handle_to_ti_sci_info(handle);
|
info = handle_to_ti_sci_info(handle);
|
||||||
|
@ -1754,8 +1754,8 @@ static int ti_sci_get_resource_range(const struct ti_sci_handle *handle,
|
||||||
} else if (!resp->range_start && !resp->range_num) {
|
} else if (!resp->range_start && !resp->range_num) {
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
} else {
|
} else {
|
||||||
*range_start = resp->range_start;
|
desc->start = resp->range_start;
|
||||||
*range_num = resp->range_num;
|
desc->num = resp->range_num;
|
||||||
};
|
};
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
@ -1771,18 +1771,18 @@ fail:
|
||||||
* @dev_id: TISCI device ID.
|
* @dev_id: TISCI device ID.
|
||||||
* @subtype: Resource assignment subtype that is being requested
|
* @subtype: Resource assignment subtype that is being requested
|
||||||
* from the given device.
|
* from the given device.
|
||||||
* @range_start: Start index of the resource range
|
* @desc: Pointer to ti_sci_resource_desc to be updated with the
|
||||||
* @range_num: Number of resources in the range
|
* resource range start index and number of resources
|
||||||
*
|
*
|
||||||
* Return: 0 if all went fine, else return appropriate error.
|
* Return: 0 if all went fine, else return appropriate error.
|
||||||
*/
|
*/
|
||||||
static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle,
|
static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle,
|
||||||
u32 dev_id, u8 subtype,
|
u32 dev_id, u8 subtype,
|
||||||
u16 *range_start, u16 *range_num)
|
struct ti_sci_resource_desc *desc)
|
||||||
{
|
{
|
||||||
return ti_sci_get_resource_range(handle, dev_id, subtype,
|
return ti_sci_get_resource_range(handle, dev_id, subtype,
|
||||||
TI_SCI_IRQ_SECONDARY_HOST_INVALID,
|
TI_SCI_IRQ_SECONDARY_HOST_INVALID,
|
||||||
range_start, range_num);
|
desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1793,18 +1793,17 @@ static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle,
|
||||||
* @subtype: Resource assignment subtype that is being requested
|
* @subtype: Resource assignment subtype that is being requested
|
||||||
* from the given device.
|
* from the given device.
|
||||||
* @s_host: Host processor ID to which the resources are allocated
|
* @s_host: Host processor ID to which the resources are allocated
|
||||||
* @range_start: Start index of the resource range
|
* @desc: Pointer to ti_sci_resource_desc to be updated with the
|
||||||
* @range_num: Number of resources in the range
|
* resource range start index and number of resources
|
||||||
*
|
*
|
||||||
* Return: 0 if all went fine, else return appropriate error.
|
* Return: 0 if all went fine, else return appropriate error.
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle,
|
int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle,
|
||||||
u32 dev_id, u8 subtype, u8 s_host,
|
u32 dev_id, u8 subtype, u8 s_host,
|
||||||
u16 *range_start, u16 *range_num)
|
struct ti_sci_resource_desc *desc)
|
||||||
{
|
{
|
||||||
return ti_sci_get_resource_range(handle, dev_id, subtype, s_host,
|
return ti_sci_get_resource_range(handle, dev_id, subtype, s_host, desc);
|
||||||
range_start, range_num);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3243,8 +3242,7 @@ devm_ti_sci_get_resource_sets(const struct ti_sci_handle *handle,
|
||||||
for (i = 0; i < res->sets; i++) {
|
for (i = 0; i < res->sets; i++) {
|
||||||
ret = handle->ops.rm_core_ops.get_range(handle, dev_id,
|
ret = handle->ops.rm_core_ops.get_range(handle, dev_id,
|
||||||
sub_types[i],
|
sub_types[i],
|
||||||
&res->desc[i].start,
|
&res->desc[i]);
|
||||||
&res->desc[i].num);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_dbg(dev, "dev = %d subtype %d not allocated for this host\n",
|
dev_dbg(dev, "dev = %d subtype %d not allocated for this host\n",
|
||||||
dev_id, sub_types[i]);
|
dev_id, sub_types[i]);
|
||||||
|
|
|
@ -195,6 +195,18 @@ struct ti_sci_clk_ops {
|
||||||
u64 *current_freq);
|
u64 *current_freq);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct ti_sci_resource_desc - Description of TI SCI resource instance range.
|
||||||
|
* @start: Start index of the resource.
|
||||||
|
* @num: Number of resources.
|
||||||
|
* @res_map: Bitmap to manage the allocation of these resources.
|
||||||
|
*/
|
||||||
|
struct ti_sci_resource_desc {
|
||||||
|
u16 start;
|
||||||
|
u16 num;
|
||||||
|
unsigned long *res_map;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct ti_sci_rm_core_ops - Resource management core operations
|
* struct ti_sci_rm_core_ops - Resource management core operations
|
||||||
* @get_range: Get a range of resources belonging to ti sci host.
|
* @get_range: Get a range of resources belonging to ti sci host.
|
||||||
|
@ -209,15 +221,15 @@ struct ti_sci_clk_ops {
|
||||||
* - dev_id: TISCI device ID.
|
* - dev_id: TISCI device ID.
|
||||||
* - subtype: Resource assignment subtype that is being requested
|
* - subtype: Resource assignment subtype that is being requested
|
||||||
* from the given device.
|
* from the given device.
|
||||||
* - range_start: Start index of the resource range
|
* - desc: Pointer to ti_sci_resource_desc to be updated with the resource
|
||||||
* - range_end: Number of resources in the range
|
* range start index and number of resources
|
||||||
*/
|
*/
|
||||||
struct ti_sci_rm_core_ops {
|
struct ti_sci_rm_core_ops {
|
||||||
int (*get_range)(const struct ti_sci_handle *handle, u32 dev_id,
|
int (*get_range)(const struct ti_sci_handle *handle, u32 dev_id,
|
||||||
u8 subtype, u16 *range_start, u16 *range_num);
|
u8 subtype, struct ti_sci_resource_desc *desc);
|
||||||
int (*get_range_from_shost)(const struct ti_sci_handle *handle,
|
int (*get_range_from_shost)(const struct ti_sci_handle *handle,
|
||||||
u32 dev_id, u8 subtype, u8 s_host,
|
u32 dev_id, u8 subtype, u8 s_host,
|
||||||
u16 *range_start, u16 *range_num);
|
struct ti_sci_resource_desc *desc);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TI_SCI_RESASG_SUBTYPE_IR_OUTPUT 0
|
#define TI_SCI_RESASG_SUBTYPE_IR_OUTPUT 0
|
||||||
|
@ -522,18 +534,6 @@ struct ti_sci_handle {
|
||||||
|
|
||||||
#define TI_SCI_RESOURCE_NULL 0xffff
|
#define TI_SCI_RESOURCE_NULL 0xffff
|
||||||
|
|
||||||
/**
|
|
||||||
* struct ti_sci_resource_desc - Description of TI SCI resource instance range.
|
|
||||||
* @start: Start index of the resource.
|
|
||||||
* @num: Number of resources.
|
|
||||||
* @res_map: Bitmap to manage the allocation of these resources.
|
|
||||||
*/
|
|
||||||
struct ti_sci_resource_desc {
|
|
||||||
u16 start;
|
|
||||||
u16 num;
|
|
||||||
unsigned long *res_map;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct ti_sci_resource - Structure representing a resource assigned
|
* struct ti_sci_resource - Structure representing a resource assigned
|
||||||
* to a device.
|
* to a device.
|
||||||
|
|
Loading…
Add table
Reference in a new issue