lib: add const for remoteproc_ops, image_store_ops and laoder_ops

to avoid load the constant data to ram in XIP mode

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2022-01-25 12:46:50 +08:00
committed by Arnaud Pouliquen
parent 79749b1a86
commit 6f03c1e952
4 changed files with 14 additions and 13 deletions

View File

@@ -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

View File

@@ -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);
/**

View File

@@ -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,

View File

@@ -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;