From 622c504a714bc65a80fae035bc7dbe5286f0c1e9 Mon Sep 17 00:00:00 2001 From: Ziang Wang Date: Thu, 25 Sep 2025 17:04:35 +0800 Subject: [PATCH] mb/emulation/qemu-riscv: Select DRIVERS_EMULATION_QEMU_FW_CFG This patch also provides valid 'io_port_mmio_base', which is the addr of VIRT_FW_CFG device @0x1010_0000 used to convey ACPI & SMBIOS info. TEST=build and run successfully on QEMU rvvirt machine. Change-Id: I3cfd3020f1edacbc647188ab232c0a35dbd71f74 Signed-off-by: Ziang Wang Signed-off-by: Dong Wei Reviewed-on: https://review.coreboot.org/c/coreboot/+/89344 Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune --- src/mainboard/emulation/qemu-riscv/Kconfig | 1 + src/mainboard/emulation/qemu-riscv/Makefile.mk | 3 +++ .../emulation/qemu-riscv/include/mainboard/addressmap.h | 1 + src/mainboard/emulation/qemu-riscv/mmio.c | 6 ++++++ 4 files changed, 11 insertions(+) create mode 100644 src/mainboard/emulation/qemu-riscv/mmio.c diff --git a/src/mainboard/emulation/qemu-riscv/Kconfig b/src/mainboard/emulation/qemu-riscv/Kconfig index 18eaaf081d..c6ff42bdb2 100644 --- a/src/mainboard/emulation/qemu-riscv/Kconfig +++ b/src/mainboard/emulation/qemu-riscv/Kconfig @@ -37,6 +37,7 @@ config BOARD_SPECIFIC_OPTIONS select ARCH_RAMSTAGE_RISCV select RISCV_USE_ARCH_TIMER select FLATTENED_DEVICE_TREE + select DRIVERS_EMULATION_QEMU_FW_CFG config MEMLAYOUT_LD_FILE string diff --git a/src/mainboard/emulation/qemu-riscv/Makefile.mk b/src/mainboard/emulation/qemu-riscv/Makefile.mk index 0f240aacd1..90e5023feb 100644 --- a/src/mainboard/emulation/qemu-riscv/Makefile.mk +++ b/src/mainboard/emulation/qemu-riscv/Makefile.mk @@ -5,6 +5,7 @@ bootblock-y += uart.c bootblock-y += rom_media.c bootblock-y += clint.c bootblock-y += smp.c +bootblock-y += mmio.c romstage-y += cbmem.c romstage-y += romstage.c @@ -12,6 +13,7 @@ romstage-y += uart.c romstage-y += rom_media.c romstage-y += clint.c romstage-y += smp.c +romstage-y += mmio.c ramstage-y += mainboard.c ramstage-y += uart.c @@ -20,5 +22,6 @@ ramstage-y += clint.c ramstage-y += cbmem.c ramstage-y += chip.c ramstage-y += smp.c +ramstage-y += mmio.c CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include diff --git a/src/mainboard/emulation/qemu-riscv/include/mainboard/addressmap.h b/src/mainboard/emulation/qemu-riscv/include/mainboard/addressmap.h index 542e39592b..eb0e9f3440 100644 --- a/src/mainboard/emulation/qemu-riscv/include/mainboard/addressmap.h +++ b/src/mainboard/emulation/qemu-riscv/include/mainboard/addressmap.h @@ -4,5 +4,6 @@ #define QEMU_VIRT_PLIC 0x0c000000 #define QEMU_VIRT_UART0 0x10000000 #define QEMU_VIRT_VIRTIO 0x10001000 +#define QEMU_VIRT_FW_CFG 0x10100000 #define QEMU_VIRT_FLASH 0x20000000 #define QEMU_VIRT_DRAM 0x80000000 diff --git a/src/mainboard/emulation/qemu-riscv/mmio.c b/src/mainboard/emulation/qemu-riscv/mmio.c new file mode 100644 index 0000000000..86fc626d14 --- /dev/null +++ b/src/mainboard/emulation/qemu-riscv/mmio.c @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include + +uintptr_t io_port_mmio_base = QEMU_VIRT_FW_CFG;