Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib_manager: llext_manager: Add const to variables and function parameters cleanup #8898

Merged
merged 7 commits into from
Mar 13, 2024
6 changes: 3 additions & 3 deletions src/include/sof/lib_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ void lib_manager_init(void);
/*
* \brief Register module on driver list
*
* param[in] desc - library manifest descriptor
* param[in] module_id - used to get manifest offset for module
* param[in] component_id - component id coming from ipc config. This function reguires valid
* lib_id and module_id fields of component id.
*
* Creates new comp_driver_info and initialize it for module from library
* Adds new module to sof_get()->comp_drivers list
*/
int lib_manager_register_module(struct sof_man_fw_desc *desc, int module_id);
int lib_manager_register_module(const uint32_t component_id);
softwarecki marked this conversation as resolved.
Show resolved Hide resolved

/*
* \brief Get library module manifest descriptor
Expand Down
2 changes: 1 addition & 1 deletion src/ipc/ipc4/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ const struct comp_driver *ipc4_get_comp_drv(int module_id)
#if CONFIG_LIBRARY_MANAGER
if (!drv) {
/* New module not registered yet. */
lib_manager_register_module(desc, module_id);
lib_manager_register_module(module_id);
softwarecki marked this conversation as resolved.
Show resolved Hide resolved
drv = ipc4_get_drv(mod->uuid);
}
#endif
Expand Down
23 changes: 18 additions & 5 deletions src/library_manager/lib_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,28 @@ static void lib_manager_update_sof_ctx(void *base_addr, uint32_t lib_id)
}

#if CONFIG_INTEL_MODULES
int lib_manager_register_module(struct sof_man_fw_desc *desc, int module_id)
int lib_manager_register_module(const uint32_t component_id)
softwarecki marked this conversation as resolved.
Show resolved Hide resolved
{
uint32_t entry_index = LIB_MANAGER_GET_MODULE_INDEX(module_id);
/* allocate new comp_driver_info */
const struct lib_manager_mod_ctx *const ctx = lib_manager_get_mod_ctx(component_id);
const uint32_t entry_index = LIB_MANAGER_GET_MODULE_INDEX(component_id);
const struct sof_man_fw_desc *desc;
struct comp_driver_info *new_drv_info;
struct comp_driver *drv = NULL;
struct sof_man_module *mod;
int ret;

/* Get library manifest based on component_id */
if (!ctx || !ctx->base_addr)
return -ENOENT;

desc = (const struct sof_man_fw_desc *)((const char *)ctx->base_addr +
SOF_MAN_ELF_TEXT_OFFSET);
softwarecki marked this conversation as resolved.
Show resolved Hide resolved
if (entry_index >= desc->header.num_module_entries) {
tr_err(&lib_manager_tr, "Entry index %d out of bounds.", entry_index);
return -ENOENT;
}

/* allocate new comp_driver_info */
new_drv_info = rmalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0,
SOF_MEM_CAPS_RAM | SOF_MEM_FLAG_COHERENT,
sizeof(struct comp_driver_info));
Expand All @@ -520,7 +533,7 @@ int lib_manager_register_module(struct sof_man_fw_desc *desc, int module_id)
/* Fill the new_drv_info structure with already known parameters */
/* Check already registered components */
mod = (struct sof_man_module *)((uint8_t *)desc + SOF_MAN_MODULE_OFFSET(entry_index));
struct sof_uuid *uid = (struct sof_uuid *)&mod->uuid[0];
const struct sof_uuid *uid = (struct sof_uuid *)&mod->uuid[0];

declare_dynamic_module_adapter(drv, SOF_COMP_MODULE_ADAPTER, uid, &lib_manager_tr);

Expand All @@ -539,7 +552,7 @@ int lib_manager_register_module(struct sof_man_fw_desc *desc, int module_id)
}

#else /* CONFIG_INTEL_MODULES */
int lib_manager_register_module(struct sof_man_fw_desc *desc, int module_id)
int lib_manager_register_module(const uint32_t component_id)
{
tr_err(&lib_manager_tr,
"lib_manager_register_module(): Dynamic module loading is not supported");
Expand Down