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