Skip to content

Commit

Permalink
firmware: arm_ffa: Move the function ffa_features() earlier
Browse files Browse the repository at this point in the history
We need to use ffa_features() in ffa_partition_probe() to detect if
the newer FFA_PARTITION_INFO_GET_REGS API is supported in the platform
or not. To avoid unnecessary forward declaration within the file, let
us just move this ffa_features() earlier.

No funtional change.

Message-Id: <20240820-ffa_v1-2-v2-3-18c0c5f3c65e@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
  • Loading branch information
sudeep-holla committed Aug 20, 2024
1 parent 7c432a1 commit d37fff9
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions drivers/firmware/arm_ffa/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,32 @@ static int ffa_rxtx_unmap(u16 vm_id)
return 0;
}

static int ffa_features(u32 func_feat_id, u32 input_props,
u32 *if_props_1, u32 *if_props_2)
{
ffa_value_t id;

if (!ARM_SMCCC_IS_FAST_CALL(func_feat_id) && input_props) {
pr_err("%s: Invalid Parameters: %x, %x", __func__,
func_feat_id, input_props);
return ffa_to_linux_errno(FFA_RET_INVALID_PARAMETERS);
}

invoke_ffa_fn((ffa_value_t){
.a0 = FFA_FEATURES, .a1 = func_feat_id, .a2 = input_props,
}, &id);

if (id.a0 == FFA_ERROR)
return ffa_to_linux_errno((int)id.a2);

if (if_props_1)
*if_props_1 = id.a2;
if (if_props_2)
*if_props_2 = id.a3;

return 0;
}

#define PARTITION_INFO_GET_RETURN_COUNT_ONLY BIT(0)

/* buffer must be sizeof(struct ffa_partition_info) * num_partitions */
Expand Down Expand Up @@ -598,32 +624,6 @@ static int ffa_memory_reclaim(u64 g_handle, u32 flags)
return 0;
}

static int ffa_features(u32 func_feat_id, u32 input_props,
u32 *if_props_1, u32 *if_props_2)
{
ffa_value_t id;

if (!ARM_SMCCC_IS_FAST_CALL(func_feat_id) && input_props) {
pr_err("%s: Invalid Parameters: %x, %x", __func__,
func_feat_id, input_props);
return ffa_to_linux_errno(FFA_RET_INVALID_PARAMETERS);
}

invoke_ffa_fn((ffa_value_t){
.a0 = FFA_FEATURES, .a1 = func_feat_id, .a2 = input_props,
}, &id);

if (id.a0 == FFA_ERROR)
return ffa_to_linux_errno((int)id.a2);

if (if_props_1)
*if_props_1 = id.a2;
if (if_props_2)
*if_props_2 = id.a3;

return 0;
}

static int ffa_notification_bitmap_create(void)
{
ffa_value_t ret;
Expand Down

0 comments on commit d37fff9

Please sign in to comment.