From 857e33e27f1feeec328ae8be5ad61ee51b75e4ec Mon Sep 17 00:00:00 2001 From: Jonathan Neuschäfer Date: Mon, 22 Aug 2016 19:37:16 +0200 Subject: arch/riscv: Implement the SBI again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not all SBI calls are implemented, but it's enough to see a couple dozen lines of Linux boot output. It should also be noted that the SBI is still in flux: https://groups.google.com/a/groups.riscv.org/forum/#!topic/sw-dev/6oNhlW0OFKM Change-Id: I80e4fe508336d6428ca7136bc388fbc3cda4f1e4 Signed-off-by: Jonathan Neuschäfer Reviewed-on: https://review.coreboot.org/16119 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/mainboard/emulation/spike-riscv/spike_util.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/mainboard/emulation/spike-riscv') diff --git a/src/mainboard/emulation/spike-riscv/spike_util.c b/src/mainboard/emulation/spike-riscv/spike_util.c index f0f5301814..7ddf16ba2c 100644 --- a/src/mainboard/emulation/spike-riscv/spike_util.c +++ b/src/mainboard/emulation/spike-riscv/spike_util.c @@ -25,12 +25,13 @@ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -#include #include #include #include -#include #include +#include +#include +#include uintptr_t translate_address(uintptr_t vAddr) { // TODO: implement the page table translation algorithm @@ -41,13 +42,13 @@ uintptr_t translate_address(uintptr_t vAddr) { return translationResult; } -uintptr_t mcall_query_memory(uintptr_t id, memory_block_info *p) +uintptr_t mcall_query_memory(uintptr_t id, memory_block_info *info) { - uintptr_t physicalAddr = translate_address((uintptr_t) p); - memory_block_info *info = (memory_block_info*) physicalAddr; if (id == 0) { - info->base = 0x1000000; // hard coded for now, but we can put these values somewhere later - info->size = 0x7F000000 - info->base; + mprv_write_ulong(&info->base, 2U*GiB); + + /* TODO: Return the correct value */ + mprv_write_ulong(&info->size, 1*GiB); return 0; } @@ -79,7 +80,7 @@ uintptr_t mcall_shutdown(void) uintptr_t mcall_set_timer(unsigned long long when) { - die("mcall_set_timer is currently not implemented"); + printk(BIOS_DEBUG, "mcall_set_timer is currently not implemented, ignoring\n"); return 0; } @@ -95,11 +96,6 @@ uintptr_t mcall_dev_resp(void) return 0; } -uintptr_t mcall_hart_id(void) -{ - return HLS()->hart_id; -} - void hls_init(uint32_t hart_id) { memset(HLS(), 0, sizeof(*HLS())); -- cgit v1.2.3