Skip to content

Commit e61dbc6

Browse files
committed
Audio: basefw: Implement ipc4 modules info get
Add support to handle IPC4_MODULES_INFO_GET message. This make it possible to get information about the current loaded modules. Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
1 parent a5c0fa6 commit e61dbc6

File tree

4 files changed

+53
-4
lines changed

4 files changed

+53
-4
lines changed

src/audio/base_fw.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ static int basefw_libraries_info_get(uint32_t *data_offset, char *data)
334334
return 0;
335335
}
336336

337+
static int basefw_modules_info_get(uint32_t *data_offset, char *data)
338+
{
339+
return platform_basefw_modules_info_get(data_offset, data);
340+
}
341+
337342
int schedulers_info_get(uint32_t *data_off_size,
338343
char *data,
339344
uint32_t core_id)
@@ -458,15 +463,15 @@ static int basefw_get_large_config(struct comp_dev *dev,
458463
extended_param_id.part.parameter_instance);
459464
case IPC4_PIPELINE_LIST_INFO_GET:
460465
return basefw_pipeline_list_info_get(data_offset, data);
466+
case IPC4_MODULES_INFO_GET:
467+
return basefw_modules_info_get(data_offset, data);
468+
case IPC4_LIBRARIES_INFO_GET:
469+
return basefw_libraries_info_get(data_offset, data);
461470
/* TODO: add more support */
462471
case IPC4_DSP_RESOURCE_STATE:
463472
case IPC4_NOTIFICATION_MASK:
464-
case IPC4_MODULES_INFO_GET:
465473
case IPC4_PIPELINE_PROPS_GET:
466474
case IPC4_GATEWAYS_INFO_GET:
467-
break;
468-
case IPC4_LIBRARIES_INFO_GET:
469-
return basefw_libraries_info_get(data_offset, data);
470475
case IPC4_PERF_MEASUREMENTS_STATE:
471476
case IPC4_GLOBAL_PERF_DATA:
472477
COMPILER_FALLTHROUGH;

src/include/ipc4/base_fw_platform.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ int platform_basefw_hw_config(uint32_t *data_offset, char *data);
4444
*/
4545
struct sof_man_fw_desc *platform_base_fw_get_manifest(void);
4646

47+
/**
48+
* \brief Platform specific routine to get information about modules.
49+
* Function add information and sent to host via IPC.
50+
* \param[out] data_offset data offset after structure added
51+
* \param[in] data pointer where to add new entries
52+
* \return 0 if successful, error code otherwise.
53+
*/
54+
int platform_basefw_modules_info_get(uint32_t *data_offset, char *data);
55+
4756
/**
4857
* \brief Implement platform specific parameter for basefw module.
4958
* This function is called for parameters not handled by

src/platform/intel/ace/lib/base_fw_platform.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
#endif
2121

2222
#include <ipc4/base_fw.h>
23+
#include <rimage/sof/user/manifest.h>
24+
25+
struct ipc4_modules_info {
26+
uint32_t modules_count;
27+
struct sof_man_module modules[0];
28+
} __packed __aligned(4);
2329

2430
LOG_MODULE_REGISTER(basefw_platform, CONFIG_SOF_LOG_LEVEL);
2531

@@ -72,6 +78,28 @@ struct sof_man_fw_desc *platform_base_fw_get_manifest(void)
7278
return desc;
7379
}
7480

81+
int platform_basefw_modules_info_get(uint32_t *data_offset, char *data)
82+
{
83+
struct ipc4_modules_info *const module_info = (struct ipc4_modules_info *)data;
84+
struct sof_man_fw_desc *desc = platform_base_fw_get_manifest();
85+
86+
if (!desc)
87+
return -EINVAL;
88+
89+
module_info->modules_count = desc->header.num_module_entries;
90+
91+
for (int idx = 0; idx < module_info->modules_count; ++idx) {
92+
struct sof_man_module *module_entry =
93+
(struct sof_man_module *)((char *)desc + SOF_MAN_MODULE_OFFSET(idx));
94+
memcpy_s(&module_info->modules[idx], sizeof(module_info->modules[idx]),
95+
module_entry, sizeof(struct sof_man_module));
96+
}
97+
98+
*data_offset = sizeof(module_info) +
99+
module_info->modules_count * sizeof(module_info->modules[0]);
100+
return 0;
101+
}
102+
75103
/* There are two types of sram memory : high power mode sram and
76104
* low power mode sram. This function retures memory size in page
77105
* , memory bank power and usage status of each sram to host driver

src/platform/posix/base_fw_platform.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ struct sof_man_fw_desc *platform_base_fw_get_manifest(void)
3030
return desc;
3131
}
3232

33+
int platform_basefw_modules_info_get(uint32_t *data_offset, char *data)
34+
{
35+
*data_offset = 0;
36+
37+
return 0;
38+
}
39+
3340
int platform_basefw_get_large_config(struct comp_dev *dev,
3441
uint32_t param_id,
3542
bool first_block,

0 commit comments

Comments
 (0)