diff --git a/src/audio/base_fw.c b/src/audio/base_fw.c index 85827ab6eadc..96cb433b12da 100644 --- a/src/audio/base_fw.c +++ b/src/audio/base_fw.c @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include #include @@ -431,6 +433,35 @@ static int basefw_power_state_info_get(uint32_t *data_offset, char *data) return 0; } +static int basefw_modules_info_get(uint32_t *data_offset, char *data) +{ +#ifdef CONFIG_INTEL + struct ipc4_modules_info *const module_info = (struct ipc4_modules_info *)data; +#ifdef ZEPHYR_SOC_INTEL_ADSP_MEMORY_H_ + struct sof_man_fw_desc *desc = (struct sof_man_fw_desc *)IMR_BOOT_LDR_MANIFEST_BASE; + + if (!desc) + return -EINVAL; +#else + return -EINVAL; +#endif + 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->modules_count) + + module_info->modules_count * sizeof(module_info->modules[0]); + return 0; +#else + return -EINVAL; +#endif +} + static int fw_config_set_force_l1_exit(const struct sof_tlv *tlv) { #if defined(CONFIG_SOC_SERIES_INTEL_ADSP_ACE) @@ -580,7 +611,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_LIST_INFO_GET: case IPC4_PIPELINE_PROPS_GET: case IPC4_GATEWAYS_INFO_GET: diff --git a/src/include/ipc4/base_fw.h b/src/include/ipc4/base_fw.h index 1d1648d73cd0..580f27b9b215 100644 --- a/src/include/ipc4/base_fw.h +++ b/src/include/ipc4/base_fw.h @@ -17,6 +17,10 @@ #ifndef __SOF_IPC4_BASE_FW_H__ #define __SOF_IPC4_BASE_FW_H__ +#ifdef CONFIG_INTEL +#include +#endif + /* Three clk src states :low power XTAL, low power ring * and high power ring oscillator */ @@ -637,6 +641,13 @@ enum ipc4_alh_version { IPC4_ALH_CAVS_1_8 = 0x10000, }; +#ifdef CONFIG_INTEL +struct ipc4_modules_info { + uint32_t modules_count; + struct sof_man_module modules[1]; +} __packed __aligned(4); +#endif + struct ipc4_log_state_info { /* * Specifies how frequently FW sends Log Buffer Status