risc-v/mpfs: Add error handling for PMP conf

Check return value of mpfs_board_pmp_setup() and
jump to mpfs_board_pmp_error() in case of error.

Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
This commit is contained in:
Jani Paalijarvi 2024-06-05 12:20:53 +03:00 committed by Alan Carvalho de Assis
parent 072890c1bf
commit b32a1dfd3d
2 changed files with 3 additions and 1 deletions

View File

@ -52,7 +52,8 @@ config MPFS_BOARD_PMP
default n
---help---
If true, the board must provide "mpfs_board_pmp_setup" for PMP
configuration. If false, set ALL memory accessible for every
configuration and "mpfs_board_pmp_error" for PMP error handling.
If false, set ALL memory accessible for every
configured HART. Only the bootloader should do this.
config MPFS_OPENSBI

View File

@ -107,6 +107,7 @@ void mpfs_jump_to_app(void)
"la sp, g_mpfs_boot_stacks\n" /* Stack area base */
"add sp, sp, t0\n" /* Set stack pointer */
"call mpfs_board_pmp_setup\n" /* Run PMP configuration */
"bne a0, x0, mpfs_board_pmp_error\n" /* If ret != 0, jump to errhan */
"csrr a0, mhartid\n" /* Restore hartid */
#else
"li t0, -1\n" /* Open the whole SoC */