mirror of https://github.com/thesofproject/sof.git
rimage: adsp_config: Create new memory_config structure.
Moved mem_zone field from adsp structure to the new memory_config structure Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
This commit is contained in:
parent
d20916066e
commit
b9ecb0072d
|
@ -67,11 +67,11 @@ static void dump_adsp(const struct adsp *adsp)
|
|||
DUMP_KEY("name", "'%s'", adsp->name);
|
||||
DUMP_KEY("image_size", "0x%x", adsp->image_size);
|
||||
DUMP_KEY("exec_boot_ldr", "%d", adsp->exec_boot_ldr);
|
||||
for (i = 0; i < ARRAY_SIZE(adsp->mem_zones); ++i) {
|
||||
for (i = 0; i < ARRAY_SIZE(adsp->mem.zones); ++i) {
|
||||
DUMP_KEY("mem_zone.idx", "%d", i);
|
||||
DUMP_KEY("mem_zone.size", "0x%x", adsp->mem_zones[i].size);
|
||||
DUMP_KEY("mem_zone.base", "0x%x", adsp->mem_zones[i].base);
|
||||
DUMP_KEY("mem_zone.host_offset", "0x%x", adsp->mem_zones[i].host_offset);
|
||||
DUMP_KEY("mem_zone.size", "0x%x", adsp->mem.zones[i].size);
|
||||
DUMP_KEY("mem_zone.base", "0x%x", adsp->mem.zones[i].base);
|
||||
DUMP_KEY("mem_zone.host_offset", "0x%x", adsp->mem.zones[i].host_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ static int parse_adsp(const toml_table_t *toml, struct parse_ctx *pctx, struct a
|
|||
bool verbose)
|
||||
{
|
||||
toml_array_t *mem_zone_array, *alias_array;
|
||||
struct mem_zone *zone;
|
||||
struct memory_zone *zone;
|
||||
struct parse_ctx ctx;
|
||||
toml_table_t *adsp;
|
||||
toml_raw_t raw;
|
||||
|
@ -164,7 +164,7 @@ static int parse_adsp(const toml_table_t *toml, struct parse_ctx *pctx, struct a
|
|||
}
|
||||
|
||||
/* look for entry array */
|
||||
memset(out->mem_zones, 0, sizeof(out->mem_zones));
|
||||
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");
|
||||
|
@ -196,7 +196,7 @@ static int parse_adsp(const toml_table_t *toml, struct parse_ctx *pctx, struct a
|
|||
if (zone_idx < 0)
|
||||
return err_key_parse("mem_zone.name", "unknown zone '%s'", zone_name);
|
||||
|
||||
zone = &out->mem_zones[zone_idx];
|
||||
zone = &out->mem.zones[zone_idx];
|
||||
zone->base = parse_uint32_hex_key(mem_zone, &ctx, "base", -1, &ret);
|
||||
if (ret < 0)
|
||||
return err_key_parse("mem_zone", NULL);
|
||||
|
|
|
@ -28,8 +28,8 @@ static int elf_read_sections(struct image *image, struct module *module,
|
|||
size_t count;
|
||||
int i, ret;
|
||||
uint32_t valid = (SHF_WRITE | SHF_ALLOC | SHF_EXECINSTR);
|
||||
unsigned long rom_base = image->adsp->mem_zones[SOF_FW_BLK_TYPE_ROM].base;
|
||||
size_t rom_size = image->adsp->mem_zones[SOF_FW_BLK_TYPE_ROM].size;
|
||||
unsigned long rom_base = image->adsp->mem.zones[SOF_FW_BLK_TYPE_ROM].base;
|
||||
size_t rom_size = image->adsp->mem.zones[SOF_FW_BLK_TYPE_ROM].size;
|
||||
|
||||
/* read in section header */
|
||||
ret = fseek(module->fd, hdr->shoff, SEEK_SET);
|
||||
|
@ -256,8 +256,8 @@ int elf_is_rom(struct image *image, Elf32_Shdr *section)
|
|||
start = section->vaddr;
|
||||
end = section->vaddr + section->size;
|
||||
|
||||
base = image->adsp->mem_zones[SOF_FW_BLK_TYPE_ROM].base;
|
||||
size = image->adsp->mem_zones[SOF_FW_BLK_TYPE_ROM].size;
|
||||
base = image->adsp->mem.zones[SOF_FW_BLK_TYPE_ROM].base;
|
||||
size = image->adsp->mem.zones[SOF_FW_BLK_TYPE_ROM].size;
|
||||
|
||||
if (start < base || start > base + size)
|
||||
return 0;
|
||||
|
|
|
@ -12,9 +12,8 @@
|
|||
#include <rimage/manifest.h>
|
||||
#include <rimage/file_utils.h>
|
||||
|
||||
static int get_mem_zone_type(struct image *image, Elf32_Shdr *section)
|
||||
static int get_mem_zone_type(const struct memory_config *memory, Elf32_Shdr *section)
|
||||
{
|
||||
const struct adsp *adsp = image->adsp;
|
||||
uint32_t start, end, base, size;
|
||||
int i;
|
||||
|
||||
|
@ -22,8 +21,8 @@ static int get_mem_zone_type(struct image *image, Elf32_Shdr *section)
|
|||
end = section->vaddr + section->size;
|
||||
|
||||
for (i = SOF_FW_BLK_TYPE_START; i < SOF_FW_BLK_TYPE_NUM; i++) {
|
||||
base = adsp->mem_zones[i].base;
|
||||
size = adsp->mem_zones[i].size;
|
||||
base = memory->zones[i].base;
|
||||
size = memory->zones[i].size;
|
||||
|
||||
if (start < base)
|
||||
continue;
|
||||
|
@ -55,11 +54,11 @@ static int write_block(struct image *image, struct module *module,
|
|||
block.size += padding;
|
||||
}
|
||||
|
||||
ret = get_mem_zone_type(image, section);
|
||||
ret = get_mem_zone_type(&image->adsp->mem, section);
|
||||
if (ret != SOF_FW_BLK_TYPE_INVALID) {
|
||||
block.type = ret;
|
||||
block.offset = section->vaddr - adsp->mem_zones[ret].base
|
||||
+ adsp->mem_zones[ret].host_offset;
|
||||
block.offset = section->vaddr - adsp->mem.zones[ret].base
|
||||
+ adsp->mem.zones[ret].host_offset;
|
||||
} else {
|
||||
fprintf(stderr, "error: invalid block address/size 0x%x/0x%x\n",
|
||||
section->vaddr, section->size);
|
||||
|
|
|
@ -110,12 +110,16 @@ struct image {
|
|||
uint32_t imr_type;
|
||||
};
|
||||
|
||||
struct mem_zone {
|
||||
struct memory_zone {
|
||||
uint32_t base;
|
||||
uint32_t size;
|
||||
uint32_t host_offset;
|
||||
};
|
||||
|
||||
struct memory_config {
|
||||
struct memory_zone zones[SOF_FW_BLK_TYPE_NUM];
|
||||
};
|
||||
|
||||
struct fw_image_ext_mod_config {
|
||||
struct fw_ext_mod_config_header header;
|
||||
struct mod_scheduling_caps sched_caps;
|
||||
|
@ -143,7 +147,7 @@ struct fw_image_manifest_module {
|
|||
*/
|
||||
struct adsp {
|
||||
const char *name;
|
||||
struct mem_zone mem_zones[SOF_FW_BLK_TYPE_NUM];
|
||||
struct memory_config mem;
|
||||
|
||||
uint32_t image_size;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ static int man_open_rom_file(struct image *image)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
size = image->adsp->mem_zones[SOF_FW_BLK_TYPE_ROM].size;
|
||||
size = image->adsp->mem.zones[SOF_FW_BLK_TYPE_ROM].size;
|
||||
|
||||
/* allocate ROM image */
|
||||
image->rom_image = calloc(size, 1);
|
||||
|
|
Loading…
Reference in New Issue