summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/riscv/include/arch/sbi.h11
-rw-r--r--src/arch/riscv/include/mcall.h14
-rw-r--r--src/arch/riscv/mcall.c12
-rw-r--r--src/arch/riscv/sbi.S14
-rw-r--r--src/arch/riscv/trap_handler.c24
5 files changed, 29 insertions, 46 deletions
diff --git a/src/arch/riscv/include/arch/sbi.h b/src/arch/riscv/include/arch/sbi.h
index df7f6cc70e..4f0552193c 100644
--- a/src/arch/riscv/include/arch/sbi.h
+++ b/src/arch/riscv/include/arch/sbi.h
@@ -17,17 +17,6 @@
#ifndef _ARCH_SBI_H
#define _ARCH_SBI_H
-#define SBI_ECALL_HART_ID 0
-#define SBI_ECALL_CONSOLE_PUT 1
-#define SBI_ECALL_SEND_DEVICE_REQUEST 2
-#define SBI_ECALL_RECEIVE_DEVICE_RESPONSE 3
-#define SBI_ECALL_SEND_IPI 4
-#define SBI_ECALL_CLEAR_IPI 5
-#define SBI_ECALL_SHUTDOWN 6
-#define SBI_ECALL_SET_TIMER 7
-#define SBI_ECALL_QUERY_MEMORY 8
-#define SBI_ECALL_NUM_HARTS 9
-
#ifndef __ASSEMBLY__
struct opaque;
extern struct opaque sbi_page;
diff --git a/src/arch/riscv/include/mcall.h b/src/arch/riscv/include/mcall.h
index e303d0d28d..1e74ed345d 100644
--- a/src/arch/riscv/include/mcall.h
+++ b/src/arch/riscv/include/mcall.h
@@ -23,6 +23,20 @@
/* We save 37 registers, currently. */
#define MENTRY_FRAME_SIZE (HLS_SIZE + 37 * 8)
+#define MCALL_HART_ID 0
+#define MCALL_NUM_HARTS 1
+#define MCALL_QUERY_MEMORY 2
+#define MCALL_CONSOLE_PUTCHAR 3
+#define MCALL_CONSOLE_GETCHAR 4
+#define MCALL_SEND_IPI 6
+#define MCALL_CLEAR_IPI 7
+#define MCALL_SHUTDOWN 8
+#define MCALL_SET_TIMER 9
+#define MCALL_REMOTE_SFENCE_VM 10
+#define MCALL_REMOTE_FENCE_I 11
+#define MCALL_CONFIG_STRING_BASE 12
+#define MCALL_CONFIG_STRING_SIZE 13
+
#ifndef __ASSEMBLER__
#include <arch/encoding.h>
diff --git a/src/arch/riscv/mcall.c b/src/arch/riscv/mcall.c
index 37a9366821..7728fbac5d 100644
--- a/src/arch/riscv/mcall.c
+++ b/src/arch/riscv/mcall.c
@@ -90,18 +90,6 @@ uintptr_t mcall_set_timer(uint64_t when)
return 0;
}
-uintptr_t mcall_dev_req(sbi_device_message *m)
-{
- die("mcall_dev_req is currently not implemented");
- return 0;
-}
-
-uintptr_t mcall_dev_resp(void)
-{
- die("mcall_dev_resp is currently not implemented");
- return 0;
-}
-
void hls_init(uint32_t hart_id)
{
query_result res;
diff --git a/src/arch/riscv/sbi.S b/src/arch/riscv/sbi.S
index 528e4ca048..0ff7c3b47d 100644
--- a/src/arch/riscv/sbi.S
+++ b/src/arch/riscv/sbi.S
@@ -16,7 +16,7 @@
#define __ASSEMBLY__
#include <arch/encoding.h>
-#include <arch/sbi.h>
+#include <mcall.h>
.section ".text.sbi", "ax", %progbits
@@ -33,26 +33,26 @@ sbi_page:
.skip 0x800
/* -2048: size_t sbi_hart_id(void); */
- li a7, SBI_ECALL_HART_ID
+ li a7, MCALL_HART_ID
ecall
jr ra
.align 4
/* -2032: size_t sbi_num_harts(void); */
- li a7, SBI_ECALL_NUM_HARTS
+ li a7, MCALL_NUM_HARTS
ecall
jr ra
.align 4
/* -2016: unsigned long sbi_query_memory(unsigned long id,
memory_block_info *p); */
- li a7, SBI_ECALL_QUERY_MEMORY
+ li a7, MCALL_QUERY_MEMORY
ecall
jr ra
.align 4
/* -2000: int sbi_console_putchar(uint8_t ch); */
- li a7, SBI_ECALL_CONSOLE_PUT
+ li a7, MCALL_CONSOLE_PUTCHAR
ecall
jr ra
.align 4
@@ -80,13 +80,13 @@ sbi_page:
.align 4
/* -1904: void sbi_shutdown(void); */
- li a7, SBI_ECALL_SHUTDOWN
+ li a7, MCALL_SHUTDOWN
ecall
jr ra
.align 4
/* -1888: void sbi_set_timer(unsigned long long stime_value); */
- li a7, SBI_ECALL_SET_TIMER
+ li a7, MCALL_SET_TIMER
ecall
jr ra
.align 4
diff --git a/src/arch/riscv/trap_handler.c b/src/arch/riscv/trap_handler.c
index 9a8947c990..4dd3d5bed2 100644
--- a/src/arch/riscv/trap_handler.c
+++ b/src/arch/riscv/trap_handler.c
@@ -31,42 +31,34 @@ void handle_supervisor_call(trapframe *tf) {
uintptr_t arg1 = tf->gpr[11]; /* a1 */
uintptr_t returnValue;
switch(call) {
- case SBI_ECALL_HART_ID:
+ case MCALL_HART_ID:
printk(BIOS_DEBUG, "Getting hart id...\n");
returnValue = read_csr(0xf14);//mhartid);
break;
- case SBI_ECALL_NUM_HARTS:
+ case MCALL_NUM_HARTS:
/* TODO: parse the hardware-supplied config string and
return the correct value */
returnValue = 1;
break;
- case SBI_ECALL_CONSOLE_PUT:
+ case MCALL_CONSOLE_PUTCHAR:
returnValue = mcall_console_putchar(arg0);
break;
- case SBI_ECALL_SEND_DEVICE_REQUEST:
- printk(BIOS_DEBUG, "Sending device request...\n");
- returnValue = mcall_dev_req((sbi_device_message*) arg0);
- break;
- case SBI_ECALL_RECEIVE_DEVICE_RESPONSE:
- printk(BIOS_DEBUG, "Getting device response...\n");
- returnValue = mcall_dev_resp();
- break;
- case SBI_ECALL_SEND_IPI:
+ case MCALL_SEND_IPI:
printk(BIOS_DEBUG, "Sending IPI...\n");
returnValue = mcall_send_ipi(arg0);
break;
- case SBI_ECALL_CLEAR_IPI:
+ case MCALL_CLEAR_IPI:
printk(BIOS_DEBUG, "Clearing IPI...\n");
returnValue = mcall_clear_ipi();
break;
- case SBI_ECALL_SHUTDOWN:
+ case MCALL_SHUTDOWN:
printk(BIOS_DEBUG, "Shutting down...\n");
returnValue = mcall_shutdown();
break;
- case SBI_ECALL_SET_TIMER:
+ case MCALL_SET_TIMER:
returnValue = mcall_set_timer(arg0);
break;
- case SBI_ECALL_QUERY_MEMORY:
+ case MCALL_QUERY_MEMORY:
printk(BIOS_DEBUG, "Querying memory, CPU #%lld...\n", arg0);
returnValue = mcall_query_memory(arg0, (memory_block_info*) arg1);
break;