Skip to content

Commit 4744f21

Browse files
committed
Audio: basefw: Implement ipc4 modules info get
Added support for ipc4 query no 9. This make it possible to get infromation about the current loaded modules. Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
1 parent 11d6c47 commit 4744f21

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/audio/base_fw.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <ipc4/pipeline.h>
1010
#include <ipc4/logging.h>
1111
#include <sof_versions.h>
12+
#include <sof/platform.h>
13+
#include <sof/lib_manager.h>
1214
#include <sof/lib/cpu-clk-manager.h>
1315
#include <sof/lib/cpu.h>
1416
#include <rtos/init.h>
@@ -431,6 +433,35 @@ static int basefw_power_state_info_get(uint32_t *data_offset, char *data)
431433
return 0;
432434
}
433435

436+
static int basefw_modules_info_get(uint32_t *data_offset, char *data)
437+
{
438+
#ifdef CONFIG_INTEL
439+
struct ipc4_modules_info *const module_info = (struct ipc4_modules_info *)data;
440+
#ifdef ZEPHYR_SOC_INTEL_ADSP_MEMORY_H_
441+
struct sof_man_fw_desc *desc = (struct sof_man_fw_desc *)IMR_BOOT_LDR_MANIFEST_BASE;
442+
443+
if (!desc)
444+
return -EINVAL;
445+
#else
446+
return -EINVAL;
447+
#endif
448+
module_info->modules_count = desc->header.num_module_entries;
449+
450+
for (int idx = 0; idx < module_info->modules_count; ++idx) {
451+
struct sof_man_module *module_entry =
452+
(struct sof_man_module *)((char *)desc + SOF_MAN_MODULE_OFFSET(idx));
453+
memcpy_s(&module_info->modules[idx], sizeof(module_info->modules[idx]),
454+
module_entry, sizeof(struct sof_man_module));
455+
}
456+
457+
*data_offset = sizeof(module_info->modules_count) +
458+
module_info->modules_count * sizeof(module_info->modules[0]);
459+
return 0;
460+
#else
461+
return -EINVAL;
462+
#endif
463+
}
464+
434465
static int fw_config_set_force_l1_exit(const struct sof_tlv *tlv)
435466
{
436467
#if defined(CONFIG_SOC_SERIES_INTEL_ADSP_ACE)
@@ -580,7 +611,9 @@ static int basefw_get_large_config(struct comp_dev *dev,
580611
/* TODO: add more support */
581612
case IPC4_DSP_RESOURCE_STATE:
582613
case IPC4_NOTIFICATION_MASK:
614+
break;
583615
case IPC4_MODULES_INFO_GET:
616+
return basefw_modules_info_get(data_offset, data);
584617
case IPC4_PIPELINE_LIST_INFO_GET:
585618
case IPC4_PIPELINE_PROPS_GET:
586619
case IPC4_GATEWAYS_INFO_GET:

src/include/ipc4/base_fw.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#ifndef __SOF_IPC4_BASE_FW_H__
1818
#define __SOF_IPC4_BASE_FW_H__
1919

20+
#ifdef CONFIG_INTEL
21+
#include <rimage/sof/user/manifest.h>
22+
#endif
23+
2024
/* Three clk src states :low power XTAL, low power ring
2125
* and high power ring oscillator
2226
*/
@@ -637,6 +641,13 @@ enum ipc4_alh_version {
637641
IPC4_ALH_CAVS_1_8 = 0x10000,
638642
};
639643

644+
#ifdef CONFIG_INTEL
645+
struct ipc4_modules_info {
646+
uint32_t modules_count;
647+
struct sof_man_module modules[1];
648+
} __packed __aligned(4);
649+
#endif
650+
640651
struct ipc4_log_state_info {
641652
/*
642653
* Specifies how frequently FW sends Log Buffer Status

0 commit comments

Comments
 (0)