Arthur Heymans has uploaded this change for review.

View Change

emulation/riscv: Don't probe for total DRAM

Trying accessing memory that is not there causes an exception.

Change-Id: Ic4d9fbb727f41436798783a357b3cfb7b64d3edb
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
M src/mainboard/emulation/qemu-riscv/Kconfig
M src/mainboard/emulation/qemu-riscv/mainboard.c
M src/soc/ucb/riscv/cbmem.c
3 files changed, 4 insertions(+), 5 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/36445/1
diff --git a/src/mainboard/emulation/qemu-riscv/Kconfig b/src/mainboard/emulation/qemu-riscv/Kconfig
index fa6dccc..c3136c1 100644
--- a/src/mainboard/emulation/qemu-riscv/Kconfig
+++ b/src/mainboard/emulation/qemu-riscv/Kconfig
@@ -55,8 +55,8 @@
default 1

config DRAM_SIZE_MB
- int
- default 32768
+ int "size of DRAM. Run qemu with the argument -m ***M"
+ default 1024

config OPENSBI_PLATFORM
string
diff --git a/src/mainboard/emulation/qemu-riscv/mainboard.c b/src/mainboard/emulation/qemu-riscv/mainboard.c
index 88898087..eda43c9 100644
--- a/src/mainboard/emulation/qemu-riscv/mainboard.c
+++ b/src/mainboard/emulation/qemu-riscv/mainboard.c
@@ -27,7 +27,7 @@
die("No dev0; die\n");
}

- dram_mb_detected = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB);
+ dram_mb_detected = CONFIG_DRAM_SIZE_MB - CONFIG_ROM_SIZE;
ram_resource(dev, 0, (uintptr_t)_dram / KiB, dram_mb_detected * MiB / KiB);

cbmem_recovery(0);
diff --git a/src/soc/ucb/riscv/cbmem.c b/src/soc/ucb/riscv/cbmem.c
index 542e08d..9872760 100644
--- a/src/soc/ucb/riscv/cbmem.c
+++ b/src/soc/ucb/riscv/cbmem.c
@@ -13,9 +13,8 @@

#include <cbmem.h>
#include <symbols.h>
-#include <ramdetect.h>

void *cbmem_top(void)
{
- return _dram + (probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB) * MiB);
+ return _dram + CONFIG_DRAM_SIZE_MB * MiB - CONFIG_ROM_SIZE;
}

To view, visit change 36445. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ic4d9fbb727f41436798783a357b3cfb7b64d3edb
Gerrit-Change-Number: 36445
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-MessageType: newchange