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 information about the current loaded modules.

Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
  • Loading branch information
gbernatxintel committed Apr 25, 2024
1 parent a554d50 commit ffcbe66
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 1 deletion.
43 changes: 43 additions & 0 deletions src/audio/base_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,47 @@ 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)
const uint32_t force = tlv->value[0];

if (force) {
tr_info(&basefw_comp_tr, "FW config set force dmi l0 state");
intel_adsp_force_dmi_l0_state();
} else {
tr_info(&basefw_comp_tr, "FW config set allow dmi l1 state");
intel_adsp_allow_dmi_l1_state();
}

return 0;
#else
return IPC4_UNAVAILABLE;
#endif
}

static int basefw_set_fw_config(bool first_block,
bool last_block,
uint32_t data_offset,
const char *data)
{
const struct sof_tlv *tlv = (const struct sof_tlv *)data;

switch (tlv->type) {
case IPC4_DMI_FORCE_L1_EXIT:
return fw_config_set_force_l1_exit(tlv);
default:
break;
}
tr_warn(&basefw_comp_tr, "returning success for Set FW_CONFIG without handling it");
return 0;
}

int schedulers_info_get(uint32_t *data_off_size,
char *data,
uint32_t core_id)
Expand Down Expand Up @@ -461,7 +502,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;
Expand Down
9 changes: 9 additions & 0 deletions src/include/ipc4/base_fw_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ 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);

/**
* \brief Implement platform specific parameter for basefw module.
* This function is called for parameters not handled by
Expand Down
2 changes: 1 addition & 1 deletion src/include/kernel/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/** \brief SOF ABI version major, minor and patch numbers */
#define SOF_ABI_MAJOR 3
#define SOF_ABI_MINOR 30
#define SOF_ABI_MINOR 29
#define SOF_ABI_PATCH 0

/** \brief SOF ABI version number. Format within 32bit word is MMmmmppp */
Expand Down
28 changes: 28 additions & 0 deletions src/platform/intel/ace/lib/base_fw_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
#endif

#include <ipc4/base_fw.h>
#include <rimage/sof/user/manifest.h>

struct ipc4_modules_info {
uint32_t modules_count;
struct sof_man_module modules[0];
} __packed __aligned(4);

LOG_MODULE_REGISTER(basefw_platform, CONFIG_SOF_LOG_LEVEL);

Expand Down Expand Up @@ -72,6 +78,28 @@ 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;
}

/* There are two types of sram memory : high power mode sram and
* low power mode sram. This function retures memory size in page
* , memory bank power and usage status of each sram to host driver
Expand Down
7 changes: 7 additions & 0 deletions src/platform/posix/base_fw_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ 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;
}

int platform_basefw_get_large_config(struct comp_dev *dev,
uint32_t param_id,
bool first_block,
Expand Down

0 comments on commit ffcbe66

Please sign in to comment.