1 /* SPDX-License-Identifier: GPL-2.0-only */
7 #include <commonlib/rmodule-defs.h>
11 RMODULE_TYPE_SIPI_VECTOR
,
18 /* Public API for loading rmodules. */
19 int rmodule_parse(void *ptr
, struct rmodule
*m
);
20 void *rmodule_parameters(const struct rmodule
*m
);
21 void *rmodule_entry(const struct rmodule
*m
);
22 int rmodule_entry_offset(const struct rmodule
*m
);
23 int rmodule_memory_size(const struct rmodule
*m
);
24 int rmodule_load(void *loc
, struct rmodule
*m
);
25 int rmodule_load_alignment(const struct rmodule
*m
);
26 /* rmodule_calc_region() calculates the region size, offset to place an
27 * rmodule in memory, and load address offset based off of a region allocator
28 * with an alignment of region_alignment. This function helps place an rmodule
29 * in the same location in RAM it will run from. The offset to place the
30 * rmodule into the region allocated of size region_size is returned. The
31 * load_offset is the address to load and relocate the rmodule.
32 * region_alignment must be a power of 2. */
33 int rmodule_calc_region(unsigned int region_alignment
, size_t rmodule_size
,
34 size_t *region_size
, int *load_offset
);
36 /* Support for loading rmodule stages. This API is only available when
37 * using dynamic cbmem because it uses the dynamic cbmem API to obtain
38 * the backing store region for the stage. */
41 struct rmod_stage_load
{
47 /* Both of the following functions return 0 on success, -1 on error. */
48 int rmodule_stage_load(struct rmod_stage_load
*rsl
);
52 struct rmodule_header
*header
;
58 #if CONFIG(RELOCATABLE_MODULES)
59 /* Rmodules have an entry point of named _start. */
60 #define RMODULE_ENTRY(entry_) \
61 void _start(void *) __attribute__((alias(STRINGIFY(entry_))))
63 #define RMODULE_ENTRY(entry_)
66 #endif /* RMODULE_H */