aboutsummaryrefslogtreecommitdiff
path: root/src/arch/riscv/trap_handler.c
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2017-11-20 00:57:32 +0100
committerMartin Roth <martinroth@google.com>2017-12-02 05:24:32 +0000
commit3ca8b598ed4ea16fd55d0d8108749c1da537a036 (patch)
tree36f54ae9d8b69088e60c51331ca02d98b0b96ece /src/arch/riscv/trap_handler.c
parentb0de851ebb032bd1517790b1c07d408d84e82f94 (diff)
arch/riscv: Remove the current SBI implementation
This Supervisor Binary Interface, which is based on a page of code that's provided to operating systems by the M-mode software, has been superseded by a different (currently not really documented) SBI, which is based on directly executing ECALLs instructions. Thus some of our code becomes obsolete. Just rip it out until we implement the new SBI. Change-Id: Iec9c20b750f39a2b8f1553e25865bbf150605a6d Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/22593 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/arch/riscv/trap_handler.c')
-rw-r--r--src/arch/riscv/trap_handler.c54
1 files changed, 1 insertions, 53 deletions
diff --git a/src/arch/riscv/trap_handler.c b/src/arch/riscv/trap_handler.c
index aea9b4d88b..b64505cc87 100644
--- a/src/arch/riscv/trap_handler.c
+++ b/src/arch/riscv/trap_handler.c
@@ -15,9 +15,7 @@
*/
#include <arch/exception.h>
-#include <arch/sbi.h>
#include <console/console.h>
-#include <mcall.h>
#include <string.h>
#include <vm.h>
#include <commonlib/configstring.h>
@@ -25,52 +23,6 @@
static uint64_t *time;
static uint64_t *timecmp;
-void handle_supervisor_call(trapframe *tf) {
- uintptr_t call = tf->gpr[17]; /* a7 */
- uintptr_t arg0 = tf->gpr[10]; /* a0 */
- uintptr_t arg1 = tf->gpr[11]; /* a1 */
- uintptr_t returnValue;
- switch(call) {
- case MCALL_HART_ID:
- printk(BIOS_DEBUG, "Getting hart id...\n");
- returnValue = read_csr(0xf14);//mhartid);
- break;
- case MCALL_NUM_HARTS:
- /* TODO: parse the hardware-supplied config string and
- return the correct value */
- returnValue = 1;
- break;
- case MCALL_CONSOLE_PUTCHAR:
- returnValue = mcall_console_putchar(arg0);
- break;
- case MCALL_SEND_IPI:
- printk(BIOS_DEBUG, "Sending IPI...\n");
- returnValue = mcall_send_ipi(arg0);
- break;
- case MCALL_CLEAR_IPI:
- printk(BIOS_DEBUG, "Clearing IPI...\n");
- returnValue = mcall_clear_ipi();
- break;
- case MCALL_SHUTDOWN:
- printk(BIOS_DEBUG, "Shutting down...\n");
- returnValue = mcall_shutdown();
- break;
- case MCALL_SET_TIMER:
- returnValue = mcall_set_timer(arg0);
- break;
- case MCALL_QUERY_MEMORY:
- printk(BIOS_DEBUG, "Querying memory, CPU #%lld...\n", arg0);
- returnValue = mcall_query_memory(arg0, (memory_block_info*) arg1);
- break;
- default:
- printk(BIOS_DEBUG, "ERROR! Unrecognized SBI call\n");
- returnValue = 0;
- break; // note: system call we do not know how to handle
- }
- tf->gpr[10] = returnValue;
- write_csr(mepc, read_csr(mepc) + 4);
-}
-
static const char *const exception_names[] = {
"Instruction address misaligned",
"Instruction access fault",
@@ -204,6 +156,7 @@ void trap_handler(trapframe *tf)
case CAUSE_FAULT_LOAD:
case CAUSE_FAULT_STORE:
case CAUSE_USER_ECALL:
+ case CAUSE_SUPERVISOR_ECALL:
case CAUSE_HYPERVISOR_ECALL:
case CAUSE_MACHINE_ECALL:
print_trap_information(tf);
@@ -216,11 +169,6 @@ void trap_handler(trapframe *tf)
print_trap_information(tf);
handle_misaligned_store(tf);
return;
- case CAUSE_SUPERVISOR_ECALL:
- /* Don't print so we make console putchar calls look
- the way they should */
- handle_supervisor_call(tf);
- return;
default:
printk(BIOS_EMERG, "================================\n");
printk(BIOS_EMERG, "coreboot: can not handle a trap:\n");