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 +#include 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 #include #include void main(void) { console_init(); + cbmem_initialize_empty(); run_ramstage(); }