rimage: Moved memory alias configuration to a new struct

A new memory_alias structure containing memory address alias configurations
has been created. It was placed in the memory_config structure.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
This commit is contained in:
Adrian Warecki 2023-03-29 16:24:08 +02:00 committed by Liam Girdwood
parent b9ecb0072d
commit 9ecae53e28
3 changed files with 15 additions and 11 deletions

View File

@ -118,7 +118,8 @@ static int parse_adsp(const toml_table_t *toml, struct parse_ctx *pctx, struct a
if (ret < 0)
return ret;
out->alias_mask = parse_uint32_hex_key(adsp, &ctx, "alias_mask", -ENODATA, &ret);
memset(&out->mem, 0, sizeof(out->mem));
out->mem.alias.mask = parse_uint32_hex_key(adsp, &ctx, "alias_mask", -ENODATA, &ret);
alias_found = !ret;
/* check everything parsed, 1 or 2 tables should be present */
@ -153,18 +154,18 @@ static int parse_adsp(const toml_table_t *toml, struct parse_ctx *pctx, struct a
base = parse_uint32_hex_key(alias, &ctx, "base", -1, &ret);
if (!strncmp("cached", alias_name, sizeof("cached")))
out->alias_cached = base & out->alias_mask;
out->mem.alias.cached = base & out->mem.alias.mask;
else if (!strncmp("uncached", alias_name, sizeof("uncached")))
out->alias_uncached = base & out->alias_mask;
out->mem.alias.uncached = base & out->mem.alias.mask;
}
} else {
/* Make uncache_to_cache() an identity transform */
out->alias_cached = 0;
out->alias_mask = 0;
out->mem.alias.uncached = 0;
out->mem.alias.cached = 0;
out->mem.alias.mask = 0;
}
/* look for entry array */
memset(&out->mem, 0, sizeof(out->mem));
mem_zone_array = toml_array_in(adsp, "mem_zone");
if (!mem_zone_array)
return err_key_not_found("mem_zone");

View File

@ -17,7 +17,7 @@
static unsigned long uncache_to_cache(const struct image *image, unsigned long address)
{
return (address & ~image->adsp->alias_mask) | image->adsp->alias_cached;
return (address & ~image->adsp->mem.alias.mask) | image->adsp->mem.alias.cached;
}
static int elf_read_sections(struct image *image, struct module *module,

View File

@ -116,8 +116,15 @@ struct memory_zone {
uint32_t host_offset;
};
struct memory_alias {
uint32_t mask;
uint32_t cached;
uint32_t uncached;
};
struct memory_config {
struct memory_zone zones[SOF_FW_BLK_TYPE_NUM];
struct memory_alias alias;
};
struct fw_image_ext_mod_config {
@ -151,10 +158,6 @@ struct adsp {
uint32_t image_size;
uint32_t alias_cached;
uint32_t alias_uncached;
uint32_t alias_mask;
int (*write_firmware_ext_man)(struct image *image);
int (*write_firmware)(struct image *image);
int (*write_firmware_meu)(struct image *image);