| 1 |
|
| 2 |
#ifndef RMODULE_H |
| 3 |
#define RMODULE_H |
| 4 |
|
| 5 |
#include <stdint.h> |
| 6 |
#include <stddef.h> |
| 7 |
#include <commonlib/rmodule-defs.h> |
| 8 |
|
| 9 |
enum { |
| 10 |
RMODULE_TYPE_SMM, |
| 11 |
RMODULE_TYPE_SIPI_VECTOR, |
| 12 |
RMODULE_TYPE_STAGE, |
| 13 |
RMODULE_TYPE_VBOOT, |
| 14 |
}; |
| 15 |
|
| 16 |
struct rmodule; |
| 17 |
|
| 18 |
|
| 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 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
int rmodule_calc_region(unsigned int region_alignment, size_t rmodule_size, |
| 34 |
size_t *region_size, int *load_offset); |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
struct prog; |
| 40 |
|
| 41 |
struct rmod_stage_load { |
| 42 |
uint32_t cbmem_id; |
| 43 |
struct prog *prog; |
| 44 |
void *params; |
| 45 |
}; |
| 46 |
|
| 47 |
|
| 48 |
int rmodule_stage_load(struct rmod_stage_load *rsl); |
| 49 |
|
| 50 |
struct rmodule { |
| 51 |
void *location; |
| 52 |
struct rmodule_header *header; |
| 53 |
const void *payload; |
| 54 |
int payload_size; |
| 55 |
void *relocations; |
| 56 |
}; |
| 57 |
|
| 58 |
#if CONFIG(RELOCATABLE_MODULES) |
| 59 |
|
| 60 |
#define RMODULE_ENTRY(entry_) \ |
| 61 |
void _start(void *) __attribute__((alias(STRINGIFY(entry_)))) |
| 62 |
#else |
| 63 |
#define RMODULE_ENTRY(entry_) |
| 64 |
#endif |
| 65 |
|
| 66 |
#endif |