diff options
author | Yaroslav Kurlaev <yaroslav.kurlaev@3mdeb.com> | 2021-07-06 22:30:28 +0700 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-02-11 20:16:44 +0000 |
commit | bcbcdf73943d8bc81f2e35c4a67eebcbde716eda (patch) | |
tree | 9958c911919286264c3662bfcb964823b45edc1c /src/mainboard/emulation | |
parent | e985d211fb1d975bbb5bee0ed2597c24ee05bd1e (diff) |
src/mainboard/emulation/qemu-power9: add RAM detection
Change-Id: Ie333294c7a311f6d47bdfbd1fc3cec0128cf63e7
Signed-off-by: Yaroslav Kurlaev <yaroslav.kurlaev@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57081
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Diffstat (limited to 'src/mainboard/emulation')
-rw-r--r-- | src/mainboard/emulation/qemu-power9/cbmem.c | 6 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-power9/mainboard.c | 1 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-power9/memlayout.ld | 16 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-power9/romstage.c | 2 |
4 files changed, 13 insertions, 12 deletions
diff --git a/src/mainboard/emulation/qemu-power9/cbmem.c b/src/mainboard/emulation/qemu-power9/cbmem.c index c1c5e94c5c..1b7b690883 100644 --- a/src/mainboard/emulation/qemu-power9/cbmem.c +++ b/src/mainboard/emulation/qemu-power9/cbmem.c @@ -1,11 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include <cbmem.h> +#include <ramdetect.h> void *cbmem_top_chipset(void) { - /* Top of cbmem is at lowest usable DRAM address below 4GiB. */ - /* For now, last 1M of 4G */ - void *ptr = (void *) (4ULL * GiB - 1 * MiB); - return ptr; + return (void *)(probe_ramsize(0, CONFIG_DRAM_SIZE_MB) * MiB); } diff --git a/src/mainboard/emulation/qemu-power9/mainboard.c b/src/mainboard/emulation/qemu-power9/mainboard.c index a1a35f0833..6c178af4ab 100644 --- a/src/mainboard/emulation/qemu-power9/mainboard.c +++ b/src/mainboard/emulation/qemu-power9/mainboard.c @@ -8,6 +8,7 @@ static void mainboard_enable(struct device *dev) { if (!dev) die("No dev0; die\n"); + ram_resource(dev, 0, 0, (unsigned long)cbmem_top() / KiB); } struct chip_operations mainboard_ops = { diff --git a/src/mainboard/emulation/qemu-power9/memlayout.ld b/src/mainboard/emulation/qemu-power9/memlayout.ld index ebac3c4a24..42e388951f 100644 --- a/src/mainboard/emulation/qemu-power9/memlayout.ld +++ b/src/mainboard/emulation/qemu-power9/memlayout.ld @@ -10,14 +10,14 @@ SECTIONS BOOTBLOCK(0, 32K) - STACK(0x8000, 32K) + ROMSTAGE(0xf00000, 1M) + STACK(0x1000000, 32K) + RAMSTAGE(0x1008000, 1M) - PRERAM_CBMEM_CONSOLE(0x10000, 128K) - FMAP_CACHE(0x30000, 4K) - CBFS_MCACHE(0x31000, 8K) - TIMESTAMP(0x33000, 4K) - CBFS_CACHE(0x34000, 512K) - ROMSTAGE(0x100000, 1M) + FMAP_CACHE(0x1108000, 4K) + CBFS_MCACHE(0x1109000, 8K) + TIMESTAMP(0x110b000, 4K) + CBFS_CACHE(0x110c000, 512K) + PRERAM_CBMEM_CONSOLE(0x118c000, 128K) - RAMSTAGE(0x300000, 5M) } diff --git a/src/mainboard/emulation/qemu-power9/romstage.c b/src/mainboard/emulation/qemu-power9/romstage.c index c412315255..4a3ed8304c 100644 --- a/src/mainboard/emulation/qemu-power9/romstage.c +++ b/src/mainboard/emulation/qemu-power9/romstage.c @@ -1,10 +1,12 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <cbmem.h> #include <console/console.h> #include <program_loading.h> void main(void) { console_init(); + cbmem_initialize_empty(); run_ramstage(); } |