Skip to content

Commit 43dcb83

Browse files
committed
ipc4: base_fw: send info about modules IDs
The MODULES_INFO_GET property of LargeConfigGet IPC4 msg has slightly different format than module info encoded into the binary manifest. In the binary manifest struct_id has always the same value while LargeConfigGet message structure requires sending module ID instead. This change fixes this issue by generating module IDs in a loop while handling the IPC4 message. Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
1 parent f2c132f commit 43dcb83

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

src/audio/base_fw_intel.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct ipc4_modules_info {
4040

4141
/* Sanity check because a subtraction of those sizes is performed later on */
4242
STATIC_ASSERT(sizeof(struct ipc4_modules_info) < SOF_IPC_MSG_MAX_SIZE,
43-
invalid_modules_info_struct_size);
43+
invalid_modules_info_struct_size);
4444
/*
4545
* TODO: default to value of ACE1.x platforms. This is defined
4646
* in multiple places in Zephyr, mm_drv_intel_adsp.h and
@@ -143,6 +143,7 @@ __cold int basefw_vendor_modules_info_get(uint32_t *data_offset, char *data)
143143

144144
struct ipc4_modules_info *const module_info = (struct ipc4_modules_info *)data;
145145
const struct sof_man_fw_desc *desc;
146+
struct sof_man_runtime_info *rt_info;
146147
uint32_t curr_mod_cnt, curr_cpy_size, total_mod_cnt = 0;
147148
uint32_t total_size_left = SOF_IPC_MSG_MAX_SIZE - sizeof(struct ipc4_modules_info);
148149
int ret;
@@ -171,6 +172,14 @@ __cold int basefw_vendor_modules_info_get(uint32_t *data_offset, char *data)
171172
return IPC4_OUT_OF_MEMORY;
172173
}
173174

175+
/* replace structure id ("$AME" tag) with runtime info */
176+
for(uint32_t idx = 0; idx < curr_mod_cnt; ++idx) {
177+
rt_info = &module_info->modules[total_mod_cnt + idx].runtime_info;
178+
rt_info->module_id = LIB_MANAGER_PACK_MODULE_ID(lib_id, idx);
179+
/* TODO: set bit[0] for modules loaded into ADSP memory */
180+
rt_info->state_flags = 0x0;
181+
}
182+
174183
total_mod_cnt += curr_mod_cnt;
175184
total_size_left -= curr_cpy_size;
176185
}

src/include/sof/lib_manager.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@
7777

7878
#define LIB_MANAGER_GET_LIB_ID(module_id) (((module_id) & 0xF000) >> LIB_MANAGER_LIB_ID_SHIFT)
7979
#define LIB_MANAGER_GET_MODULE_INDEX(module_id) ((module_id) & 0xFFF)
80-
#define LIB_MANAGER_PACK_LIB_ID(lib_index) (((lib_index) << LIB_MANAGER_LIB_ID_SHIFT) & 0xF000)
80+
#define LIB_MANAGER_PACK_MODULE_ID(lib_index, module_index) (((module_index) & 0xFFF) | \
81+
(((lib_index) << LIB_MANAGER_LIB_ID_SHIFT) & 0xF000))
82+
#define LIB_MANAGER_PACK_LIB_ID(lib_index) LIB_MANAGER_PACK_MODULE_ID(lib_index, 0x0)
8183

8284
#ifdef CONFIG_LIBRARY_MANAGER
8385
struct ipc_lib_msg {

tools/rimage/src/include/rimage/sof/user/manifest.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,19 @@ struct sof_man_uuid {
103103
uint8_t d[8];
104104
};
105105

106+
struct sof_man_runtime_info {
107+
uint16_t module_id;
108+
uint16_t state_flags;
109+
};
110+
106111
/*
107112
* Each module has an entry in the FW header. Used by ROM - Immutable.
108113
*/
109114
struct sof_man_module {
110-
uint8_t struct_id[SOF_MAN_MOD_ID_LEN]; /* SOF_MAN_MOD_ID */
115+
union {
116+
uint8_t struct_id[SOF_MAN_MOD_ID_LEN]; /* SOF_MAN_MOD_ID */
117+
struct sof_man_runtime_info runtime_info;
118+
};
111119
uint8_t name[SOF_MAN_MOD_NAME_LEN];
112120
struct sof_man_uuid uuid;
113121
struct sof_man_module_type type;

0 commit comments

Comments
 (0)