diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-02-18 11:53:52 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-02-19 09:58:48 +0530 |
commit | 24c3082ea496d39d406601ee4243b724f4d31aec (patch) | |
tree | cabd8d91dbe18267e1c61afba08ab16c5a86efbc | |
parent | bc874e34cecbd1e024ae7be4ec2f34d9cb1fbecb (diff) |
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>
-rw-r--r-- | include/sbi/sbi_hart.h | 1 | ||||
-rw-r--r-- | lib/sbi/sbi_hart.c | 15 | ||||
-rw-r--r-- | lib/sbi/sbi_init.c | 1 |
3 files changed, 15 insertions, 2 deletions
diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index 0762f95..065cb0c 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -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_delegation_dump(struct sbi_scratch *scratch); void sbi_hart_pmp_dump(struct sbi_scratch *scratch); void __attribute__((noreturn)) sbi_hart_hang(void); diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index d83008f..1d62862 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -107,6 +107,17 @@ static int delegate_traps(struct sbi_scratch *scratch, u32 hartid) 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 ret = 0; @@ -138,9 +149,9 @@ void sbi_hart_pmp_dump(struct sbi_scratch *scratch) else size = 0; #if __riscv_xlen == 32 - sbi_printf("PMP%d: 0x%08lx-0x%08lx (A", + sbi_printf("PMP%d : 0x%08lx-0x%08lx (A", #else - sbi_printf("PMP%d: 0x%016lx-0x%016lx (A", + sbi_printf("PMP%d : 0x%016lx-0x%016lx (A", #endif i, addr, addr + size - 1); if (prot & PMP_L) diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index 8baaed4..48bc653 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -68,6 +68,7 @@ static void sbi_boot_prints(struct sbi_scratch *scratch, u32 hartid) sbi_ecall_version_major(), sbi_ecall_version_minor()); sbi_printf("\n"); + sbi_hart_delegation_dump(scratch); sbi_hart_pmp_dump(scratch); } |