Skip to content

Commit ffcbe66

Browse files
committed
Audio: basefw: Implement ipc4 modules info get
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>
1 parent a554d50 commit ffcbe66

File tree

5 files changed

+88
-1
lines changed

5 files changed

+88
-1
lines changed

src/audio/base_fw.c

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,47 @@ static int basefw_libraries_info_get(uint32_t *data_offset, char *data)
334334
return 0;
335335
}
336336

337+
static int basefw_modules_info_get(uint32_t *data_offset, char *data)
338+
{
339+
return platform_basefw_modules_info_get(data_offset, data);
340+
}
341+
342+
static int fw_config_set_force_l1_exit(const struct sof_tlv *tlv)
343+
{
344+
#if defined(CONFIG_SOC_SERIES_INTEL_ADSP_ACE)
345+
const uint32_t force = tlv->value[0];
346+
347+
if (force) {
348+
tr_info(&basefw_comp_tr, "FW config set force dmi l0 state");
349+
intel_adsp_force_dmi_l0_state();
350+
} else {
351+
tr_info(&basefw_comp_tr, "FW config set allow dmi l1 state");
352+
intel_adsp_allow_dmi_l1_state();
353+
}
354+
355+
return 0;
356+
#else
357+
return IPC4_UNAVAILABLE;
358+
#endif
359+
}
360+
361+
static int basefw_set_fw_config(bool first_block,
362+
bool last_block,
363+
uint32_t data_offset,
364+
const char *data)
365+
{
366+
const struct sof_tlv *tlv = (const struct sof_tlv *)data;
367+
368+
switch (tlv->type) {
369+
case IPC4_DMI_FORCE_L1_EXIT:
370+
return fw_config_set_force_l1_exit(tlv);
371+
default:
372+
break;
373+
}
374+
tr_warn(&basefw_comp_tr, "returning success for Set FW_CONFIG without handling it");
375+
return 0;
376+
}
377+
337378
int schedulers_info_get(uint32_t *data_off_size,
338379
char *data,
339380
uint32_t core_id)
@@ -461,7 +502,9 @@ static int basefw_get_large_config(struct comp_dev *dev,
461502
/* TODO: add more support */
462503
case IPC4_DSP_RESOURCE_STATE:
463504
case IPC4_NOTIFICATION_MASK:
505+
break;
464506
case IPC4_MODULES_INFO_GET:
507+
return basefw_modules_info_get(data_offset, data);
465508
case IPC4_PIPELINE_PROPS_GET:
466509
case IPC4_GATEWAYS_INFO_GET:
467510
break;

src/include/ipc4/base_fw_platform.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ int platform_basefw_hw_config(uint32_t *data_offset, char *data);
4444
*/
4545
struct sof_man_fw_desc *platform_base_fw_get_manifest(void);
4646

47+
/**
48+
* \brief Platform specific routine to get information about modules.
49+
* Function add information and sent to host via IPC.
50+
* \param[out] data_offset data offset after structure added
51+
* \param[in] data pointer where to add new entries
52+
* \return 0 if successful, error code otherwise.
53+
*/
54+
int platform_basefw_modules_info_get(uint32_t *data_offset, char *data);
55+
4756
/**
4857
* \brief Implement platform specific parameter for basefw module.
4958
* This function is called for parameters not handled by

src/include/kernel/abi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
/** \brief SOF ABI version major, minor and patch numbers */
3131
#define SOF_ABI_MAJOR 3
32-
#define SOF_ABI_MINOR 30
32+
#define SOF_ABI_MINOR 29
3333
#define SOF_ABI_PATCH 0
3434

3535
/** \brief SOF ABI version number. Format within 32bit word is MMmmmppp */

src/platform/intel/ace/lib/base_fw_platform.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
#endif
2121

2222
#include <ipc4/base_fw.h>
23+
#include <rimage/sof/user/manifest.h>
24+
25+
struct ipc4_modules_info {
26+
uint32_t modules_count;
27+
struct sof_man_module modules[0];
28+
} __packed __aligned(4);
2329

2430
LOG_MODULE_REGISTER(basefw_platform, CONFIG_SOF_LOG_LEVEL);
2531

@@ -72,6 +78,28 @@ struct sof_man_fw_desc *platform_base_fw_get_manifest(void)
7278
return desc;
7379
}
7480

81+
int platform_basefw_modules_info_get(uint32_t *data_offset, char *data)
82+
{
83+
struct ipc4_modules_info *const module_info = (struct ipc4_modules_info *)data;
84+
struct sof_man_fw_desc *desc = platform_base_fw_get_manifest();
85+
86+
if (!desc)
87+
return -EINVAL;
88+
89+
module_info->modules_count = desc->header.num_module_entries;
90+
91+
for (int idx = 0; idx < module_info->modules_count; ++idx) {
92+
struct sof_man_module *module_entry =
93+
(struct sof_man_module *)((char *)desc + SOF_MAN_MODULE_OFFSET(idx));
94+
memcpy_s(&module_info->modules[idx], sizeof(module_info->modules[idx]),
95+
module_entry, sizeof(struct sof_man_module));
96+
}
97+
98+
*data_offset = sizeof(module_info) +
99+
module_info->modules_count * sizeof(module_info->modules[0]);
100+
return 0;
101+
}
102+
75103
/* There are two types of sram memory : high power mode sram and
76104
* low power mode sram. This function retures memory size in page
77105
* , memory bank power and usage status of each sram to host driver

src/platform/posix/base_fw_platform.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ struct sof_man_fw_desc *platform_base_fw_get_manifest(void)
3030
return desc;
3131
}
3232

33+
int platform_basefw_modules_info_get(uint32_t *data_offset, char *data)
34+
{
35+
*data_offset = 0;
36+
37+
return 0;
38+
}
39+
3340
int platform_basefw_get_large_config(struct comp_dev *dev,
3441
uint32_t param_id,
3542
bool first_block,

0 commit comments

Comments
 (0)