diff --git a/lib/include/openamp/elf_loader.h b/lib/include/openamp/elf_loader.h index bc36b5c..e7dda74 100644 --- a/lib/include/openamp/elf_loader.h +++ b/lib/include/openamp/elf_loader.h @@ -308,7 +308,7 @@ struct elf64_info { #define ELF_STATE_MASK 0xFF00L #define ELF_NEXT_SEGMENT_MASK 0x00FFL -extern struct loader_ops elf_ops; +extern const struct loader_ops elf_ops; /** * elf_identify - check if it is an ELF file diff --git a/lib/include/openamp/remoteproc.h b/lib/include/openamp/remoteproc.h index b19b2e5..41f5d57 100644 --- a/lib/include/openamp/remoteproc.h +++ b/lib/include/openamp/remoteproc.h @@ -371,9 +371,9 @@ struct remoteproc { struct metal_list mems; struct metal_list vdevs; unsigned long bitmap; - struct remoteproc_ops *ops; + const struct remoteproc_ops *ops; metal_phys_addr_t bootaddr; - struct loader_ops *loader; + const struct loader_ops *loader; unsigned int state; void *priv; }; @@ -399,7 +399,7 @@ struct remoteproc { */ struct remoteproc_ops { struct remoteproc *(*init)(struct remoteproc *rproc, - struct remoteproc_ops *ops, void *arg); + const struct remoteproc_ops *ops, void *arg); void (*remove)(struct remoteproc *rproc); void *(*mmap)(struct remoteproc *rproc, metal_phys_addr_t *pa, metal_phys_addr_t *da, @@ -504,7 +504,8 @@ enum remoteproc_state { * @returns created remoteproc pointer */ struct remoteproc *remoteproc_init(struct remoteproc *rproc, - struct remoteproc_ops *ops, void *priv); + const struct remoteproc_ops *ops, + void *priv); /** * remoteproc_remove @@ -721,7 +722,7 @@ int remoteproc_shutdown(struct remoteproc *rproc); * return 0 for success and negative value for failure */ int remoteproc_load(struct remoteproc *rproc, const char *path, - void *store, struct image_store_ops *store_ops, + void *store, const struct image_store_ops *store_ops, void **img_info); /** diff --git a/lib/remoteproc/elf_loader.c b/lib/remoteproc/elf_loader.c index 057f465..c90b8d4 100644 --- a/lib/remoteproc/elf_loader.c +++ b/lib/remoteproc/elf_loader.c @@ -697,7 +697,7 @@ int elf_get_load_state(void *img_info) return *load_state; } -struct loader_ops elf_ops = { +const struct loader_ops elf_ops = { .load_header = elf_load_header, .load_data = elf_load, .locate_rsc_table = elf_locate_rsc_table, diff --git a/lib/remoteproc/remoteproc.c b/lib/remoteproc/remoteproc.c index 8ae4bb8..9a0cf3e 100644 --- a/lib/remoteproc/remoteproc.c +++ b/lib/remoteproc/remoteproc.c @@ -18,7 +18,7 @@ /****************************************************************************** * static functions *****************************************************************************/ -static struct loader_ops * +static const struct loader_ops * remoteproc_check_fw_format(const void *img_data, size_t img_len) { if (img_len <= 0) @@ -100,7 +100,7 @@ remoteproc_patoda(struct remoteproc_mem *mem, metal_phys_addr_t pa) static void *remoteproc_get_rsc_table(struct remoteproc *rproc, void *store, - struct image_store_ops *store_ops, + const struct image_store_ops *store_ops, size_t offset, size_t len) { @@ -166,7 +166,7 @@ int remoteproc_set_rsc_table(struct remoteproc *rproc, } struct remoteproc *remoteproc_init(struct remoteproc *rproc, - struct remoteproc_ops *ops, void *priv) + const struct remoteproc_ops *ops, void *priv) { if (rproc) { memset(rproc, 0, sizeof(*rproc)); @@ -389,11 +389,11 @@ void *remoteproc_mmap(struct remoteproc *rproc, } int remoteproc_load(struct remoteproc *rproc, const char *path, - void *store, struct image_store_ops *store_ops, + void *store, const struct image_store_ops *store_ops, void **img_info) { int ret; - struct loader_ops *loader; + const struct loader_ops *loader; const void *img_data; void *limg_info = NULL; size_t offset, noffset; @@ -667,7 +667,7 @@ int remoteproc_load_noblock(struct remoteproc *rproc, size_t *nmlen, unsigned char *padding) { int ret; - struct loader_ops *loader; + const struct loader_ops *loader; void *limg_info = NULL; int last_load_state; metal_phys_addr_t da, rsc_da;