risc-v/mpfs: mpfs_opensbi: fix fw_size calculation

fw_start and fw_size were miscalculated. What was needed
was the pointed values of the offsets __mpfs_nuttx_start
and __mpfs_nuttx_end, not the values they had in place.

Also add the next_arg1 initialization.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
This commit is contained in:
Eero Nurkkala 2022-01-14 09:38:16 +02:00 committed by Petro Karashchenko
parent c67a1a4de1
commit 09bf8a5f89

View File

@ -453,8 +453,11 @@ static void mpfs_opensbi_scratch_setup(uint32_t hartid)
* them so that OpenSBI has no chance override then.
*/
g_scratches[hartid].scratch.fw_start = __mpfs_nuttx_start;
g_scratches[hartid].scratch.fw_size = __mpfs_nuttx_end;
g_scratches[hartid].scratch.fw_start = (unsigned long)&__mpfs_nuttx_start;
g_scratches[hartid].scratch.fw_size = (unsigned long)&__mpfs_nuttx_end -
(unsigned long)&__mpfs_nuttx_start;
DEBUGASSERT(g_scratches[hartid].scratch.fw_size > 0);
}
/****************************************************************************
@ -516,6 +519,7 @@ void __attribute__((noreturn)) mpfs_opensbi_setup(void)
csr_write(mscratch, &g_scratches[hartid].scratch);
g_scratches[hartid].scratch.next_mode = PRV_S;
g_scratches[hartid].scratch.next_addr = UBOOT_LOAD_ADDR;
g_scratches[hartid].scratch.next_arg1 = 0;
sbi_init(&g_scratches[hartid].scratch);