diff options
author | Ronald G. Minnich <rminnich@gmail.com> | 2017-01-15 17:40:51 +0100 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2017-01-16 00:26:08 +0100 |
commit | 6f3a53b6f61126f05db950e1c0a2c0b4f1552e5f (patch) | |
tree | d2d9e98c7abed0b671d3d7d57f1d129f59256f6e /src/arch/riscv/include | |
parent | a19d44d2764be4dba55cad96abea12d92c8e1f0d (diff) | |
download | coreboot-6f3a53b6f61126f05db950e1c0a2c0b4f1552e5f.tar.xz |
riscv: get SBI calls to work
SBI calls, as it turned out, were never right.
They did not set the stack correctly on traps.
They were not correctly setting the MIP instead of the SIP
(although this was not really well documented).
On Harvey, we were trying to avoid using them,
and due to a bug in SPIKE, our avoidance worked.
Once SPIKE was fixed, our avoidance broke.
This set of changes is tested and working with Harvey
which, for the first time, is making SBI calls.
It's not pretty and we're going to want to rework
trap_util.S in coming days.
Change-Id: Ibef530adcc58d33e2c44ff758e0b7d2acbdc5e99
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-on: https://review.coreboot.org/18097
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/arch/riscv/include')
-rw-r--r-- | src/arch/riscv/include/mcall.h | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/arch/riscv/include/mcall.h b/src/arch/riscv/include/mcall.h index a43b9cf49b..e303d0d28d 100644 --- a/src/arch/riscv/include/mcall.h +++ b/src/arch/riscv/include/mcall.h @@ -16,35 +16,43 @@ #ifndef _MCALL_H #define _MCALL_H +// NOTE: this is the size of hls_t below. A static_assert would be +// nice to have. +#define HLS_SIZE 64 + +/* We save 37 registers, currently. */ +#define MENTRY_FRAME_SIZE (HLS_SIZE + 37 * 8) + +#ifndef __ASSEMBLER__ + #include <arch/encoding.h> #include <atomic.h> #include <stdint.h> -#define HLS_SIZE 64 -#define MENTRY_FRAME_SIZE HLS_SIZE - typedef struct { - unsigned long base; - unsigned long size; - unsigned long node_id; + unsigned long base; + unsigned long size; + unsigned long node_id; } memory_block_info; typedef struct { - unsigned long dev; - unsigned long cmd; - unsigned long data; - unsigned long sbi_private_data; + unsigned long dev; + unsigned long cmd; + unsigned long data; + unsigned long sbi_private_data; } sbi_device_message; typedef struct { - sbi_device_message* device_request_queue_head; - unsigned long device_request_queue_size; - sbi_device_message* device_response_queue_head; - sbi_device_message* device_response_queue_tail; + sbi_device_message *device_request_queue_head; + unsigned long device_request_queue_size; + sbi_device_message *device_response_queue_head; + sbi_device_message *device_response_queue_tail; - int hart_id; - int ipi_pending; + int hart_id; + int ipi_pending; + uint64_t *timecmp; + uint64_t *time; } hls_t; #define MACHINE_STACK_TOP() ({ \ @@ -67,4 +75,6 @@ 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 // __ASSEMBLER__ + #endif |