Xtensa: ADSP: bootloader: use proper struct field access
Replace byte-counting with proper structure field access. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
c2400a47ab
commit
33dbbfb3d6
2 changed files with 7 additions and 13 deletions
|
@ -99,12 +99,12 @@ static void parse_module(struct sof_man_fw_header *hdr,
|
|||
switch (mod->segment[i].flags.r.type) {
|
||||
case SOF_MAN_SEGMENT_TEXT:
|
||||
case SOF_MAN_SEGMENT_DATA:
|
||||
bias = (mod->segment[i].file_offset -
|
||||
SOF_MAN_ELF_TEXT_OFFSET);
|
||||
bias = mod->segment[i].file_offset -
|
||||
SOF_MAN_ELF_TEXT_OFFSET;
|
||||
|
||||
/* copy from IMR to SRAM */
|
||||
bmemcpy((void *)mod->segment[i].v_base_addr,
|
||||
(void *)((int)hdr + bias),
|
||||
(uint8_t *)hdr + bias,
|
||||
mod->segment[i].flags.r.length *
|
||||
HOST_PAGE_SIZE);
|
||||
break;
|
||||
|
@ -140,8 +140,8 @@ static uint32_t get_fw_size_in_use(void)
|
|||
|
||||
/* Calculate fw size passed in BASEFW module in MANIFEST */
|
||||
for (i = MAN_SKIP_ENTRIES; i < hdr->num_module_entries; i++) {
|
||||
mod = (struct sof_man_module *)((char *)desc +
|
||||
SOF_MAN_MODULE_OFFSET(i));
|
||||
mod = desc->man_module + i;
|
||||
|
||||
if (strcmp((char *)mod->name, "BASEFW"))
|
||||
continue;
|
||||
for (i = 0; i < MANIFEST_SEGMENT_COUNT; i++) {
|
||||
|
@ -172,8 +172,8 @@ static void parse_manifest(void)
|
|||
|
||||
/* copy module to SRAM - skip bootloader module */
|
||||
for (i = MAN_SKIP_ENTRIES; i < hdr->num_module_entries; i++) {
|
||||
mod = desc->man_module + i;
|
||||
|
||||
mod = (void *)((uintptr_t)desc + SOF_MAN_MODULE_OFFSET(i));
|
||||
z_xtensa_cache_inv(mod, sizeof(*mod));
|
||||
parse_module(hdr, mod);
|
||||
}
|
||||
|
|
|
@ -156,6 +156,7 @@ struct sof_man_fw_desc {
|
|||
* struct sof_man_mod_config mod_config[];
|
||||
*/
|
||||
|
||||
struct sof_man_module man_module[];
|
||||
} __attribute__((packed));
|
||||
|
||||
/*
|
||||
|
@ -189,11 +190,4 @@ struct sof_man_module_manifest {
|
|||
uint32_t text_size;
|
||||
};
|
||||
|
||||
/*
|
||||
* Module offset in manifest.
|
||||
*/
|
||||
#define SOF_MAN_MODULE_OFFSET(index) \
|
||||
(sizeof(struct sof_man_fw_header) + \
|
||||
(index) * sizeof(struct sof_man_module))
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue