Skip to content

Commit

Permalink
include: ipc4: module: fix component ID macros
Browse files Browse the repository at this point in the history
The existing component ID is composed with
'module_id << 16 | instance_id', it doesn't
comply to the initial instance IPC structure:

struct {
    uint32_t module_id   : 16;
    uint32_t instance_id : 8;
    ...
};

When the ID is logged through mtrace, it is
hard to use the ID to find the related linux
kernel message.

This patch fixes component ID composition macros,
thus helps to eliminate component ID inconsistency
between firmware and linux kernel.

Link: #8051

Signed-off-by: Chao Song <[email protected]>
  • Loading branch information
Chao Song authored and lgirdwood committed Aug 30, 2023
1 parent 434466e commit 45ca3d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/include/ipc4/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,10 @@ struct ipc4_module_load_library {
} data;
} __packed __aligned(4);

#define IPC4_COMP_ID(x, y) ((x) << 16 | (y))
#define IPC4_MOD_ID(x) ((x) >> 16)
#define IPC4_INST_ID(x) ((x) & 0xffff)
#define IPC4_SRC_QUEUE_ID(x) (((x) >> 16) & 0xffff)
#define IPC4_SINK_QUEUE_ID(x) ((x) & 0xffff)
#define IPC4_COMP_ID(x, y) ((y) << 16 | (x))
#define IPC4_MOD_ID(x) ((x) & 0xffff)
#define IPC4_INST_ID(x) ((x) >> 16)
#define IPC4_SRC_QUEUE_ID(x) ((x) & 0xffff)
#define IPC4_SINK_QUEUE_ID(x) (((x) >> 16) & 0xffff)

#endif
2 changes: 0 additions & 2 deletions src/ipc/ipc4/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@

LOG_MODULE_DECLARE(ipc, CONFIG_SOF_LOG_LEVEL);

#define IPC4_MOD_ID(x) ((x) >> 16)

extern struct tr_ctx comp_tr;

void ipc_build_stream_posn(struct sof_ipc_stream_posn *posn, uint32_t type,
Expand Down

0 comments on commit 45ca3d4

Please sign in to comment.