forked from Mirrors/opensbi
lib: Print interrupt and exception delegation in boot prints
We print MIDELEG and MEDELEG CSRs as part of boot prints so that boot log shows the interrupts and exceptions delegated to S-mode. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
@@ -20,6 +20,7 @@ void *sbi_hart_get_trap_info(struct sbi_scratch *scratch);
|
|||||||
|
|
||||||
void sbi_hart_set_trap_info(struct sbi_scratch *scratch, void *data);
|
void sbi_hart_set_trap_info(struct sbi_scratch *scratch, void *data);
|
||||||
|
|
||||||
|
void sbi_hart_delegation_dump(struct sbi_scratch *scratch);
|
||||||
void sbi_hart_pmp_dump(struct sbi_scratch *scratch);
|
void sbi_hart_pmp_dump(struct sbi_scratch *scratch);
|
||||||
|
|
||||||
void __attribute__((noreturn)) sbi_hart_hang(void);
|
void __attribute__((noreturn)) sbi_hart_hang(void);
|
||||||
|
@@ -107,6 +107,17 @@ static int delegate_traps(struct sbi_scratch *scratch, u32 hartid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sbi_hart_delegation_dump(struct sbi_scratch *scratch)
|
||||||
|
{
|
||||||
|
#if __riscv_xlen == 32
|
||||||
|
sbi_printf("MIDELEG : 0x%08lx\n", csr_read(CSR_MIDELEG));
|
||||||
|
sbi_printf("MEDELEG : 0x%08lx\n", csr_read(CSR_MEDELEG));
|
||||||
|
#else
|
||||||
|
sbi_printf("MIDELEG : 0x%016lx\n", csr_read(CSR_MIDELEG));
|
||||||
|
sbi_printf("MEDELEG : 0x%016lx\n", csr_read(CSR_MEDELEG));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
unsigned long log2roundup(unsigned long x)
|
unsigned long log2roundup(unsigned long x)
|
||||||
{
|
{
|
||||||
unsigned long ret = 0;
|
unsigned long ret = 0;
|
||||||
|
@@ -68,6 +68,7 @@ static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid)
|
|||||||
sbi_ecall_version_major(), sbi_ecall_version_minor());
|
sbi_ecall_version_major(), sbi_ecall_version_minor());
|
||||||
sbi_printf("\n");
|
sbi_printf("\n");
|
||||||
|
|
||||||
|
sbi_hart_delegation_dump(scratch);
|
||||||
sbi_hart_pmp_dump(scratch);
|
sbi_hart_pmp_dump(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user