Skip to content

Commit

Permalink
Audio: basefw: Implement ipc4 modules info get
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gbernatxintel committed Apr 17, 2024
1 parent 11d6c47 commit 4744f21
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/audio/base_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <ipc4/pipeline.h>
#include <ipc4/logging.h>
#include <sof_versions.h>
#include <sof/platform.h>
#include <sof/lib_manager.h>
#include <sof/lib/cpu-clk-manager.h>
#include <sof/lib/cpu.h>
#include <rtos/init.h>
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions src/include/ipc4/base_fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#ifndef __SOF_IPC4_BASE_FW_H__
#define __SOF_IPC4_BASE_FW_H__

#ifdef CONFIG_INTEL
#include <rimage/sof/user/manifest.h>
#endif

/* Three clk src states :low power XTAL, low power ring
* and high power ring oscillator
*/
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4744f21

Please sign in to comment.