FROMLIST: firmware: arm_ffa: Move the ffa_to_linux definition to the ffa header

Keep the ffa_to_linux error map in the header and move it away
from the arm ffa driver to make it accessible for other components.

Bug: 269285339
Bug: 278749606
Change-Id: I9f26e956738907a13e4e42b06defe1cd1ce90d68
Link: https://lore.kernel.org/all/20250326113901.3308804-3-sebastianene@google.com/
Signed-off-by: Sebastian Ene <sebastianene@google.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
Sebastian Ene
2025-02-27 18:03:47 +00:00
parent 15958ea62a
commit b2fde9f68b
2 changed files with 27 additions and 26 deletions
-26
View File
@@ -61,30 +61,6 @@
static ffa_fn *invoke_ffa_fn;
static const int ffa_linux_errmap[] = {
/* better than switch case as long as return value is continuous */
0, /* FFA_RET_SUCCESS */
-EOPNOTSUPP, /* FFA_RET_NOT_SUPPORTED */
-EINVAL, /* FFA_RET_INVALID_PARAMETERS */
-ENOMEM, /* FFA_RET_NO_MEMORY */
-EBUSY, /* FFA_RET_BUSY */
-EINTR, /* FFA_RET_INTERRUPTED */
-EACCES, /* FFA_RET_DENIED */
-EAGAIN, /* FFA_RET_RETRY */
-ECANCELED, /* FFA_RET_ABORTED */
-ENODATA, /* FFA_RET_NO_DATA */
-EAGAIN, /* FFA_RET_NOT_READY */
};
static inline int ffa_to_linux_errno(int errno)
{
int err_idx = -errno;
if (err_idx >= 0 && err_idx < ARRAY_SIZE(ffa_linux_errmap))
return ffa_linux_errmap[err_idx];
return -EINVAL;
}
struct ffa_pcpu_irq {
struct ffa_drv_info *info;
};
@@ -238,8 +214,6 @@ static int ffa_features(u32 func_feat_id, u32 input_props,
return 0;
}
#define PARTITION_INFO_GET_RETURN_COUNT_ONLY BIT(0)
/* buffer must be sizeof(struct ffa_partition_info) * num_partitions */
static int
__ffa_partition_info_get(u32 uuid0, u32 uuid1, u32 uuid2, u32 uuid3,
+27
View File
@@ -223,6 +223,9 @@ extern const struct bus_type ffa_bus_type;
/* The FF-A 1.0 partition structure lacks the uuid[4] */
#define FFA_1_0_PARTITON_INFO_SZ (8)
/* Return the count of partitions deployed in the system */
#define PARTITION_INFO_GET_RETURN_COUNT_ONLY BIT(0)
/* FFA transport related */
struct ffa_partition_info {
u16 id;
@@ -475,4 +478,28 @@ struct ffa_ops {
const struct ffa_notifier_ops *notifier_ops;
};
static const int ffa_linux_errmap[] = {
/* better than switch case as long as return value is continuous */
0, /* FFA_RET_SUCCESS */
-EOPNOTSUPP, /* FFA_RET_NOT_SUPPORTED */
-EINVAL, /* FFA_RET_INVALID_PARAMETERS */
-ENOMEM, /* FFA_RET_NO_MEMORY */
-EBUSY, /* FFA_RET_BUSY */
-EINTR, /* FFA_RET_INTERRUPTED */
-EACCES, /* FFA_RET_DENIED */
-EAGAIN, /* FFA_RET_RETRY */
-ECANCELED, /* FFA_RET_ABORTED */
-ENODATA, /* FFA_RET_NO_DATA */
-EAGAIN, /* FFA_RET_NOT_READY */
};
static inline int ffa_to_linux_errno(int errno)
{
int err_idx = -errno;
if (err_idx >= 0 && err_idx < ARRAY_SIZE(ffa_linux_errmap))
return ffa_linux_errmap[err_idx];
return -EINVAL;
}
#endif /* _LINUX_ARM_FFA_H */