uuid: use a pointer instead of casting it to an integer

UUID objects are represented by struct sof_uuid_entry instances in SOF.
Instead of casting pointers to them to integers for passing around,
carry them as pointers until they have to be cast to integers for
packing into data structures. This also fixes printing UUID, using a
"%pU" format.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2020-09-03 14:07:28 +02:00 committed by Liam Girdwood
parent 63fe935dce
commit 047f08f20e
16 changed files with 35 additions and 31 deletions

View File

@ -107,7 +107,7 @@ struct timestamp_ops {
struct dai_driver {
uint32_t type; /**< type, one of SOF_DAI_... */
uint32_t uid;
const struct sof_uuid_entry *uid;
struct tr_ctx *tctx;
uint32_t dma_caps;
uint32_t dma_dev;

View File

@ -132,7 +132,7 @@ struct sof_uuid_entry {
* \param uuid_name UUID symbol name declared with DECLARE_SOF_UUID() or
* DECLARE_SOF_RT_UUID().
*/
#define SOF_UUID(uuid_name) ((uintptr_t)&(uuid_name ## _ldc))
#define SOF_UUID(uuid_name) (&(uuid_name ## _ldc))
/** \brief Dereference unique 32-bit representation of UUID structure in runtime.
*

View File

@ -24,7 +24,7 @@ struct edf_task_pdata {
int scheduler_init_edf(void);
int schedule_task_init_edf(struct task *task, uint32_t uid,
int schedule_task_init_edf(struct task *task, const struct sof_uuid_entry *uid,
const struct task_ops *ops,
void *data, uint16_t core, uint32_t flags);

View File

@ -35,8 +35,8 @@ struct ll_task_pdata {
int scheduler_init_ll(struct ll_schedule_domain *domain);
int schedule_task_init_ll(struct task *task,
uint32_t uid, uint16_t type, uint16_t priority,
enum task_state (*run)(void *data), void *data,
uint16_t core, uint32_t flags);
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags);
#endif /* __SOF_SCHEDULE_LL_SCHEDULE_H__ */

View File

@ -307,9 +307,9 @@ static inline void schedule_free(void)
* @return 0 if succeeded, error code otherwise.
*/
int schedule_task_init(struct task *task,
uint32_t uid, uint16_t type, uint16_t priority,
enum task_state (*run)(void *data), void *data,
uint16_t core, uint32_t flags);
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags);
/**
* Initializes scheduler

View File

@ -54,7 +54,7 @@ struct task_ops {
/** \brief Task used by schedulers. */
struct task {
uint64_t start; /**< start time in [ms] since now (LL only) */
uint32_t uid; /**< Uuid */
const struct sof_uuid_entry *uid; /**< Uuid */
uint16_t type; /**< type of the task (LL or EDF) */
uint16_t priority; /**< priority of the task (used by LL) */
uint16_t core; /**< execution core */

View File

@ -281,8 +281,8 @@ static inline void trace_init(struct sof *sof) { }
* Trace context.
*/
struct tr_ctx {
uintptr_t uuid_p; /**< UUID pointer, use SOF_UUID() to init */
uint32_t level; /**< Default log level */
const struct sof_uuid_entry *uuid_p; /**< UUID pointer, use SOF_UUID() to init */
uint32_t level; /**< Default log level */
};
#if defined(UNIT_TEST)

View File

@ -131,7 +131,7 @@ static int schedule_edf_task(void *data, struct task *task, uint64_t start,
return 0;
}
int schedule_task_init_edf(struct task *task, uint32_t uid,
int schedule_task_init_edf(struct task *task, const struct sof_uuid_entry *uid,
const struct task_ops *ops,
void *data, uint16_t core, uint32_t flags)
{

View File

@ -379,9 +379,9 @@ out:
}
int schedule_task_init_ll(struct task *task,
uint32_t uid, uint16_t type, uint16_t priority,
enum task_state (*run)(void *data), void *data,
uint16_t core, uint32_t flags)
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
struct ll_task_pdata *ll_pdata;
int ret = 0;

View File

@ -22,9 +22,9 @@ DECLARE_SOF_UUID("schedule", sch_uuid, 0x3dee06de, 0xf25a, 0x4e10,
DECLARE_TR_CTX(sch_tr, SOF_UUID(sch_uuid), LOG_LEVEL_INFO);
int schedule_task_init(struct task *task,
uint32_t uid, uint16_t type, uint16_t priority,
enum task_state (*run)(void *data), void *data,
uint16_t core, uint32_t flags)
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
if (type >= SOF_SCHEDULE_COUNT) {
tr_err(&sch_tr, "schedule_task_init(): invalid task type");

View File

@ -44,7 +44,7 @@ struct trace {
#define TRACE_ID_MASK ((1 << TRACE_ID_LENGTH) - 1)
static void put_header(uint32_t *dst, uint32_t id_0,
static void put_header(uint32_t *dst, const struct sof_uuid_entry *uid,
uint32_t id_1, uint32_t id_2,
uint32_t entry, uint64_t timestamp)
{
@ -52,7 +52,7 @@ static void put_header(uint32_t *dst, uint32_t id_0,
struct log_entry_header header;
int ret;
header.uid = id_0;
header.uid = (uintptr_t)uid;
header.id_0 = id_1 & TRACE_ID_MASK;
header.id_1 = id_2 & TRACE_ID_MASK;
header.core_id = cpu_get_id();

View File

@ -30,7 +30,8 @@ void platform_dai_timestamp(struct comp_dev *dai,
(void)posn;
}
int schedule_task_init(struct task *task, uint32_t uid, uint16_t type,
int schedule_task_init(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
@ -46,7 +47,8 @@ int schedule_task_init(struct task *task, uint32_t uid, uint16_t type,
return 0;
}
int schedule_task_init_ll(struct task *task, uint32_t uid, uint16_t type,
int schedule_task_init_ll(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{

View File

@ -53,7 +53,7 @@ static int schedule_edf_task(void *data, struct task *task, uint64_t start,
return 0;
}
int schedule_task_init_edf(struct task *task, uint32_t uid,
int schedule_task_init_edf(struct task *task, const struct sof_uuid_entry *uid,
const struct task_ops *ops, void *data,
uint16_t core, uint32_t flags)
{

View File

@ -7,10 +7,10 @@
#include <sof/schedule/ll_schedule.h>
#include <sof/schedule/schedule.h>
int schedule_task_init_ll(struct task *task, uint32_t uid, uint16_t type,
uint16_t priority,
enum task_state (*run)(void *data), void *data,
uint16_t core, uint32_t flags)
int schedule_task_init_ll(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{
return schedule_task_init(task, uid, type, priority, run, data, core,
flags);

View File

@ -20,7 +20,8 @@ struct schedulers **arch_schedulers_get(void)
return &testbench_schedulers_ptr;
}
int schedule_task_init(struct task *task, uint32_t uid, uint16_t type,
int schedule_task_init(struct task *task,
const struct sof_uuid_entry *uid, uint16_t type,
uint16_t priority, enum task_state (*run)(void *data),
void *data, uint16_t core, uint32_t flags)
{

View File

@ -104,7 +104,7 @@ int scheduler_init_edf(void)
return 0;
}
int schedule_task_init_edf(struct task *task, uint32_t uid,
int schedule_task_init_edf(struct task *task, const struct sof_uuid_entry *uid,
const struct task_ops *ops,
void *data, uint16_t core, uint32_t flags)
{
@ -122,7 +122,8 @@ int schedule_task_init_edf(struct task *task, uint32_t uid,
return 0;
}
int schedule_task_init_edf_with_budget(struct task *task, uint32_t uid,
int schedule_task_init_edf_with_budget(struct task *task,
const struct sof_uuid_entry *uid,
const struct task_ops *ops,
void *data, uint16_t core,
uint32_t flags, uint32_t cycles_budget)