Repository navigation
Expand file tree
/
Copy pathllext_manager.h
More file actions
91 lines (75 loc) · 2.79 KB
/
Copy pathllext_manager.h
File metadata and controls
91 lines (75 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2024 Intel Corporation. All rights reserved.
*/
#ifndef __SOF_LLEXT_MANAGER_H__
#define __SOF_LLEXT_MANAGER_H__
#include <stdbool.h>
#include <stdint.h>
#if CONFIG_LLEXT
#include <rimage/sof/user/manifest.h>
struct comp_dev;
struct comp_driver;
struct comp_ipc_config;
struct k_mem_domain;
static inline bool module_is_llext(const struct sof_man_module *mod)
{
return mod->type.load_type == SOF_MAN_MOD_TYPE_LLEXT ||
mod->type.load_type == SOF_MAN_MOD_TYPE_LLEXT_AUX;
}
uintptr_t llext_manager_allocate_module(const struct comp_ipc_config *ipc_config,
const void *ipc_specific_config);
int llext_manager_free_module(const uint32_t component_id);
/**
* \brief Add and register an external LLEXT library with the runtime loader.
*
* \param[in] module_id Packed library ID returned by the library manager.
*
* \return 0 on success, negative error code on failure.
*/
int llext_manager_add_library(uint32_t module_id);
/**
* \brief Unload an idle LLEXT library and release its virtual memory/metadata.
*
* \param[in] module_id Packed library ID returned by the library manager.
*
* \return 0 on success, -EBUSY if any module or dependent is still active,
* or negative error code on failure.
*/
int llext_manager_remove_library(uint32_t module_id);
struct lib_manager_mod_ctx;
struct sof_man_fw_desc;
/**
* \brief Scan loaded LLEXT ELF modules for ".sof_codec_info" and register items.
*
* \param[in] ctx Library module context array for the loaded library.
* \param[in] desc Manifest header describing the library image layout in memory.
*/
void llext_manager_register_lib_codecs(const struct lib_manager_mod_ctx *ctx,
const struct sof_man_fw_desc *desc);
/**
* \brief Remove all runtime codec capability items owned by an LLEXT library.
*
* \param[in] ctx Library module context array for the library being unloaded.
*/
void llext_manager_unregister_lib_codecs(const struct lib_manager_mod_ctx *ctx);
int llext_manager_add_domain(const uint32_t component_id, struct k_mem_domain *domain);
int llext_manager_rm_domain(const uint32_t component_id, struct k_mem_domain *domain);
bool comp_is_llext(struct comp_dev *comp);
#else
#define module_is_llext(mod) false
#define llext_manager_allocate_module(ipc_config, ipc_specific_config) 0
#define llext_manager_free_module(component_id) 0
#define llext_manager_add_library(module_id) 0
#define llext_manager_remove_library(module_id) 0
#define llext_manager_add_domain(component_id, domain) 0
#define comp_is_llext(comp) false
#endif
#if CONFIG_LLEXT_EXPERIMENTAL && !CONFIG_ADSP_IMR_CONTEXT_SAVE
int llext_manager_store_to_dram(void);
int llext_manager_restore_from_dram(void);
#else
#define llext_manager_store_to_dram() 0
#define llext_manager_restore_from_dram() -ENOSYS
#endif
#endif