diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainboard/emulation/qemu-riscv/Kconfig | 1 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-riscv/cbmem.c | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/mainboard/emulation/qemu-riscv/Kconfig b/src/mainboard/emulation/qemu-riscv/Kconfig index 94f9e56c5a..27b1b58127 100644 --- a/src/mainboard/emulation/qemu-riscv/Kconfig +++ b/src/mainboard/emulation/qemu-riscv/Kconfig @@ -23,6 +23,7 @@ if BOARD_EMULATION_QEMU_RISCV config BOARD_SPECIFIC_OPTIONS def_bool y select BOARD_ROMSIZE_KB_32768 + select FLATTENED_DEVICE_TREE select MISSING_BOARD_RESET select DRIVERS_UART_8250MEM select RISCV_HAS_OPENSBI diff --git a/src/mainboard/emulation/qemu-riscv/cbmem.c b/src/mainboard/emulation/qemu-riscv/cbmem.c index e4d21ccb80..8c37957dd8 100644 --- a/src/mainboard/emulation/qemu-riscv/cbmem.c +++ b/src/mainboard/emulation/qemu-riscv/cbmem.c @@ -3,10 +3,17 @@ #include <cbmem.h> #include <symbols.h> #include <ramdetect.h> +#include <device_tree.h> +#include <mcall.h> uintptr_t cbmem_top_chipset(void) { - //TODO get memory range from QEMUs FDT + uint64_t top; + + top = fdt_get_memory_top((void *)HLS()->fdt); + if (top) + return MIN(top, (uint64_t)4 * GiB - 1); + size_t dram_mb_detected = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB); return (uintptr_t)_dram + dram_mb_detected * MiB; } |