diff options
author | Thaminda Edirisooriya <thaminda@google.com> | 2015-08-26 14:54:31 -0700 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2015-09-10 17:26:38 +0000 |
commit | 95ba4c87f5f4802e2afaeae38003db5e7235864a (patch) | |
tree | 5e1c146e873afc58695ee22a056f5546b6cc8bed /src/arch/riscv/include/spike_util.h | |
parent | b094583c6fd9d330be28ed6feb1c1140de07ff37 (diff) |
riscv-trap-handling: Add implementation for trap calls in riscv
RISCV requires the bios/bootloader to set up an interface by which it
can get information about memory, talk to host devices, etc. Put
implementation for spike in
src/mainboard/emulation/spike-riscv/spike_util.c, and
src/arch/riscv/trap_handler.c
Change-Id: Ie1d5f361595e48fa6cc1fac25485ad623ecdc717
Signed-off-by: Thaminda Edirisooriya <thaminda@google.com>
Reviewed-on: http://review.coreboot.org/11368
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/arch/riscv/include/spike_util.h')
-rw-r--r-- | src/arch/riscv/include/spike_util.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/arch/riscv/include/spike_util.h b/src/arch/riscv/include/spike_util.h index a9d14cccf1..e9c0300aaa 100644 --- a/src/arch/riscv/include/spike_util.h +++ b/src/arch/riscv/include/spike_util.h @@ -40,6 +40,12 @@ #define FROMHOST_DATA(fromhost_value) ((uint64_t)(fromhost_value) << 16 >> 16) typedef struct { + unsigned long base; + unsigned long size; + unsigned long node_id; +} memory_block_info; + +typedef struct { unsigned long dev; unsigned long cmd; unsigned long data; @@ -63,11 +69,22 @@ typedef struct { // hart-local storage, at top of stack #define HLS() ((hls_t*)(MACHINE_STACK_TOP() - HLS_SIZE)) +#define OTHER_HLS(id) ((hls_t*)((void*)HLS() + RISCV_PGSIZE * ((id) - HLS()->hart_id))) #define MACHINE_STACK_SIZE RISCV_PGSIZE +uintptr_t translate_address(uintptr_t vAddr); +uintptr_t mcall_query_memory(uintptr_t id, memory_block_info *p); +uintptr_t mcall_hart_id(void); uintptr_t htif_interrupt(uintptr_t mcause, uintptr_t* regs); uintptr_t mcall_console_putchar(uint8_t ch); void testPrint(void); +uintptr_t mcall_dev_req(sbi_device_message *m); +uintptr_t mcall_dev_resp(void); +uintptr_t mcall_set_timer(unsigned long long when); +uintptr_t mcall_clear_ipi(void); +uintptr_t mcall_send_ipi(uintptr_t recipient); +uintptr_t mcall_shutdown(void); +void hls_init(uint32_t hart_id); // need to call this before launching linux #endif |