Skip to content

Commit 4a5217b

Browse files
committed
Audio: basefw: Implemented ipc4 libraries info get
Added support for ipc4 query no 16. This makes it possible to get information about the current basefw library. Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
1 parent 9737e12 commit 4a5217b

File tree

6 files changed

+108
-1
lines changed

6 files changed

+108
-1
lines changed

src/audio/base_fw.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <sof_versions.h>
1414
#include <sof/lib/cpu-clk-manager.h>
1515
#include <sof/lib/cpu.h>
16+
#include <sof/platform.h>
17+
#include <sof/lib_manager.h>
1618
#include <rtos/init.h>
1719
#include <platform/lib/clk.h>
1820
#if defined(CONFIG_SOC_SERIES_INTEL_ADSP_ACE)
@@ -426,6 +428,57 @@ static int basefw_power_state_info_get(uint32_t *data_offset, char *data)
426428
return 0;
427429
}
428430

431+
static int basefw_libraries_info_get(uint32_t *data_offset, char *data)
432+
{
433+
if (sizeof(struct ipc4_libraries_info) +
434+
LIB_MANAGER_MAX_LIBS * sizeof(struct ipc4_library_props) >
435+
SOF_IPC_MSG_MAX_SIZE) {
436+
tr_err(&basefw_comp_tr, "Error with message size");
437+
return -ENOMEM;
438+
}
439+
440+
struct ipc4_libraries_info *const libs_info = (struct ipc4_libraries_info *)data;
441+
const struct sof_man_fw_desc *desc;
442+
int lib_counter = 0;
443+
444+
for (int lib_id = 0; lib_id < LIB_MANAGER_MAX_LIBS; ++lib_id) {
445+
if (lib_id == 0) {
446+
desc = platform_base_fw_get_manifest();
447+
} else {
448+
#if CONFIG_LIBRARY_MANAGER
449+
desc = (struct sof_man_fw_desc *)lib_manager_get_library_manifest(lib_id);
450+
#else
451+
desc = NULL;
452+
#endif
453+
}
454+
455+
if (!desc)
456+
continue;
457+
458+
libs_info->libraries[lib_id].id = lib_id;
459+
memcpy_s(libs_info->libraries[lib_counter].name,
460+
SOF_MAN_FW_HDR_FW_NAME_LEN, desc->header.name, sizeof(desc->header.name));
461+
libs_info->libraries[lib_counter].major_version =
462+
desc->header.major_version;
463+
libs_info->libraries[lib_counter].minor_version =
464+
desc->header.minor_version;
465+
libs_info->libraries[lib_counter].hotfix_version =
466+
desc->header.hotfix_version;
467+
libs_info->libraries[lib_counter].build_version =
468+
desc->header.build_version;
469+
libs_info->libraries[lib_counter].num_module_entries =
470+
desc->header.num_module_entries;
471+
472+
lib_counter++;
473+
}
474+
475+
libs_info->library_count = lib_counter;
476+
*data_offset =
477+
sizeof(libs_info) + libs_info->library_count * sizeof(libs_info->libraries[0]);
478+
479+
return 0;
480+
}
481+
429482
static int fw_config_set_force_l1_exit(const struct sof_tlv *tlv)
430483
{
431484
#if defined(CONFIG_SOC_SERIES_INTEL_ADSP_ACE)
@@ -605,7 +658,9 @@ static int basefw_get_large_config(struct comp_dev *dev,
605658
case IPC4_MODULES_INFO_GET:
606659
case IPC4_PIPELINE_PROPS_GET:
607660
case IPC4_GATEWAYS_INFO_GET:
661+
break;
608662
case IPC4_LIBRARIES_INFO_GET:
663+
return basefw_libraries_info_get(data_offset, data);
609664
case IPC4_PERF_MEASUREMENTS_STATE:
610665
case IPC4_GLOBAL_PERF_DATA:
611666
COMPILER_FALLTHROUGH;

src/include/ipc4/base_fw.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,31 @@ enum ipc4_alh_version {
637637
IPC4_ALH_CAVS_1_8 = 0x10000,
638638
};
639639

640+
struct ipc4_library_props {
641+
/* Library run-time identifier, depends on order of loading. */
642+
/* Base FW is always reported with id 0. */
643+
uint32_t id;
644+
/* Name of the library. */
645+
uint8_t name[8];
646+
/* Major version of the library. */
647+
uint16_t major_version;
648+
/* Minor version of the library. */
649+
uint16_t minor_version;
650+
/* Hotfix version of the library. */
651+
uint16_t hotfix_version;
652+
/* Build version of the library. */
653+
uint16_t build_version;
654+
/* Number of modules packed into the library. */
655+
uint32_t num_module_entries;
656+
} __packed __aligned(4);
657+
658+
struct ipc4_libraries_info {
659+
/* Specifies number of items in libraries array. */
660+
uint32_t library_count;
661+
/* Array of libraries properties. */
662+
struct ipc4_library_props libraries[0];
663+
} __packed __aligned(4);
664+
640665
struct ipc4_log_state_info {
641666
/*
642667
* Specifies how frequently FW sends Log Buffer Status

src/include/ipc4/base_fw_platform.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@
2222
*/
2323
int platform_basefw_hw_config(uint32_t *data_offset, char *data);
2424

25-
#endif
25+
/**
26+
* \brief Platform specific routine which return the pointer to
27+
* the boot base manifest.
28+
* \return pointer to struct if successful, null otherwise.
29+
*/
30+
struct sof_man_fw_desc *platform_base_fw_get_manifest(void);
31+
32+
#endif /* __SOF_IPC4_BASE_FW_PLATFORM_H__ */

src/include/sof/lib_manager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ static inline struct lib_manager_mod_ctx *lib_manager_get_mod_ctx(int module_id)
118118
uint32_t lib_id = LIB_MANAGER_GET_LIB_ID(module_id);
119119
struct ext_library *_ext_lib = ext_lib_get();
120120

121+
if (!_ext_lib)
122+
return NULL;
123+
121124
return _ext_lib->desc[lib_id];
122125
}
123126

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,12 @@ int platform_basefw_hw_config(uint32_t *data_offset, char *data)
3030

3131
return 0;
3232
}
33+
34+
struct sof_man_fw_desc *platform_base_fw_get_manifest(void)
35+
{
36+
struct sof_man_fw_desc *desc;
37+
38+
desc = (struct sof_man_fw_desc *)IMR_BOOT_LDR_MANIFEST_BASE;
39+
40+
return desc;
41+
}

src/platform/posix/base_fw_platform.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Author: Kai Vehmanen <kai.vehmanen@linux.intel.com>
66

77
#include <stdint.h>
8+
#include <stddef.h>
89
#include <ipc4/base_fw_platform.h>
910

1011
int platform_basefw_hw_config(uint32_t *data_offset, char *data)
@@ -13,3 +14,10 @@ int platform_basefw_hw_config(uint32_t *data_offset, char *data)
1314

1415
return 0;
1516
}
17+
18+
struct sof_man_fw_desc *platform_base_fw_get_manifest(void)
19+
{
20+
struct sof_man_fw_desc *desc = NULL;
21+
22+
return desc;
23+
}

0 commit comments

Comments
 (0)