riscv: Show hart id in trap handler

Also show hart id in trap information for easier debugging.

Change-Id: I20acf86e1af111600c158295ae03b2167838d127
Signed-off-by: Philipp Hug <philipp@hug.cx>
Reviewed-on: https://review.coreboot.org/c/31201
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: ron minnich <rminnich@gmail.com>
This commit is contained in:
Philipp Hug 2018-10-26 13:00:26 +02:00 committed by ron minnich
parent 820dcfceb3
commit 909be6a7d8
1 changed files with 2 additions and 0 deletions

View File

@ -57,6 +57,7 @@ static void print_trap_information(const trapframe *tf)
{ {
const char *previous_mode; const char *previous_mode;
bool mprv = !!(tf->status & MSTATUS_MPRV); bool mprv = !!(tf->status & MSTATUS_MPRV);
int hart_id = read_csr(mhartid);
/* Leave some space around the trap message */ /* Leave some space around the trap message */
printk(BIOS_DEBUG, "\n"); printk(BIOS_DEBUG, "\n");
@ -69,6 +70,7 @@ static void print_trap_information(const trapframe *tf)
(void *)tf->cause); (void *)tf->cause);
previous_mode = mstatus_to_previous_mode(read_csr(mstatus)); previous_mode = mstatus_to_previous_mode(read_csr(mstatus));
printk(BIOS_DEBUG, "Hart ID: %d\n", hart_id);
printk(BIOS_DEBUG, "Previous mode: %s%s\n", printk(BIOS_DEBUG, "Previous mode: %s%s\n",
previous_mode, mprv? " (MPRV)":""); previous_mode, mprv? " (MPRV)":"");
printk(BIOS_DEBUG, "Bad instruction pc: %p\n", (void *)tf->epc); printk(BIOS_DEBUG, "Bad instruction pc: %p\n", (void *)tf->epc);