diff --git a/src/audio/base_fw.c b/src/audio/base_fw.c index daeaf7927ee0..520cd083a959 100644 --- a/src/audio/base_fw.c +++ b/src/audio/base_fw.c @@ -436,7 +436,7 @@ static int basefw_libraries_info_get(uint32_t *data_offset, char *data) tr_err(&basefw_comp_tr, "Error with message size"); return -ENOMEM; } - + // test struct ipc4_libraries_info *const libs_info = (struct ipc4_libraries_info *)data; const struct sof_man_fw_desc *desc; int lib_counter = 0; @@ -479,6 +479,11 @@ static int basefw_libraries_info_get(uint32_t *data_offset, char *data) return 0; } +static int basefw_modules_info_get(uint32_t *data_offset, char *data) +{ + return platform_basefw_modules_info_get(data_offset, data); +} + static int fw_config_set_force_l1_exit(const struct sof_tlv *tlv) { #if defined(CONFIG_SOC_SERIES_INTEL_ADSP_ACE) @@ -655,7 +660,9 @@ static int basefw_get_large_config(struct comp_dev *dev, /* TODO: add more support */ case IPC4_DSP_RESOURCE_STATE: case IPC4_NOTIFICATION_MASK: + break; case IPC4_MODULES_INFO_GET: + return basefw_modules_info_get(data_offset, data); case IPC4_PIPELINE_PROPS_GET: case IPC4_GATEWAYS_INFO_GET: break; diff --git a/src/include/ipc4/base_fw_platform.h b/src/include/ipc4/base_fw_platform.h index d653b1997d50..6d145cdc0787 100644 --- a/src/include/ipc4/base_fw_platform.h +++ b/src/include/ipc4/base_fw_platform.h @@ -29,4 +29,13 @@ int platform_basefw_hw_config(uint32_t *data_offset, char *data); */ struct sof_man_fw_desc *platform_base_fw_get_manifest(void); +/** + * \brief Platform specific routine to get information about modules. + * Function add information and sent to host via IPC. + * \param[out] data_offset data offset after structure added + * \param[in] data pointer where to add new entries + * \return 0 if successful, error code otherwise. + */ +int platform_basefw_modules_info_get(uint32_t *data_offset, char *data); + #endif /* __SOF_IPC4_BASE_FW_PLATFORM_H__ */ diff --git a/src/platform/intel/ace/lib/base_fw_platform.c b/src/platform/intel/ace/lib/base_fw_platform.c index 47dd97b809e3..4aeff187a7c6 100644 --- a/src/platform/intel/ace/lib/base_fw_platform.c +++ b/src/platform/intel/ace/lib/base_fw_platform.c @@ -8,6 +8,12 @@ #include #include #include +#include + +struct ipc4_modules_info { + uint32_t modules_count; + struct sof_man_module modules[0]; +} __packed __aligned(4); int platform_basefw_hw_config(uint32_t *data_offset, char *data) { @@ -39,3 +45,25 @@ struct sof_man_fw_desc *platform_base_fw_get_manifest(void) return desc; } + +int platform_basefw_modules_info_get(uint32_t *data_offset, char *data) +{ + struct ipc4_modules_info *const module_info = (struct ipc4_modules_info *)data; + struct sof_man_fw_desc *desc = platform_base_fw_get_manifest(); + + if (!desc) + return -EINVAL; + + module_info->modules_count = desc->header.num_module_entries; + + for (int idx = 0; idx < module_info->modules_count; ++idx) { + struct sof_man_module *module_entry = + (struct sof_man_module *)((char *)desc + SOF_MAN_MODULE_OFFSET(idx)); + memcpy_s(&module_info->modules[idx], sizeof(module_info->modules[idx]), + module_entry, sizeof(struct sof_man_module)); + } + + *data_offset = sizeof(module_info) + + module_info->modules_count * sizeof(module_info->modules[0]); + return 0; +} diff --git a/src/platform/posix/base_fw_platform.c b/src/platform/posix/base_fw_platform.c index 16981e6ff2a7..350aa6f03859 100644 --- a/src/platform/posix/base_fw_platform.c +++ b/src/platform/posix/base_fw_platform.c @@ -21,3 +21,10 @@ struct sof_man_fw_desc *platform_base_fw_get_manifest(void) return desc; } + +int platform_basefw_modules_info_get(uint32_t *data_offset, char *data) +{ + *data_offset = 0; + + return 0; +}