Depending on how firmware image was passed to QEMU, it may behave as: - ROM - memory mapped reads, writes are ignored (FW image mounted with '-bios'); - RAM - memory mapped reads and writes (FW image mounted with e.g. '-device loader'); - flash - memory mapped reads, write and erase possible through commands. Contrary to physical flash devices erase is not required before writing, but it also doesn't hurt. Flash may be split into read-only and read-write parts, like OVMF_CODE.fd and OVMF_VARS.fd. Combined size of system firmware must not exceed 8 MiB by default (FW image(s) mounted with '-drive if=pflash'). This function detects which of the above applies and fills region_device_ops accordingly. Tested by starting QEMU with firmware passed as '-drive if=pflash', '-drive if=pflash,readonly=on' and '-bios'. When started with firmware passed through '-device loader', coreboot complains about corrupted FMAP, but this is the same behavior as without this change: [ERROR] Invalid FMAP at 0x40000 [EMERG] Cannot locate primary CBFS Writable pflash support was added about 17 years ago, so it should be supported by all QEMU versions currently in use. Since QEMU 5.0.0 it is possible to change the limit of firmware size with `max-fw-size` machine configuration option, up to 16 MiB, as bigger sizes would overlap with default IO APIC memory range. Change-Id: I3ab9f22c6165064a769881d4be5eab13a0a2f519 Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/82555 Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
91 lines
2.0 KiB
Plaintext
91 lines
2.0 KiB
Plaintext
## SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
if BOARD_EMULATION_QEMU_X86_I440FX
|
|
|
|
config BOARD_SPECIFIC_OPTIONS
|
|
def_bool y
|
|
select CPU_QEMU_X86
|
|
select NO_ECAM_MMCONF_SUPPORT
|
|
select SOUTHBRIDGE_INTEL_I82371EB
|
|
select HAVE_OPTION_TABLE
|
|
select HAVE_CMOS_DEFAULT
|
|
select HAVE_PIRQ_TABLE
|
|
select HAVE_ACPI_TABLES
|
|
select BOARD_ROMSIZE_KB_4096 if !VBOOT
|
|
select BOARD_ROMSIZE_KB_16384 if VBOOT
|
|
select MAINBOARD_HAS_NATIVE_VGA_INIT
|
|
select MAINBOARD_FORCE_NATIVE_VGA_INIT
|
|
select HAVE_ASAN_IN_ROMSTAGE
|
|
select NO_SMM
|
|
select BOOT_DEVICE_NOT_SPI_FLASH
|
|
select BOOT_DEVICE_MEMORY_MAPPED
|
|
select BOOT_DEVICE_SUPPORTS_WRITES
|
|
|
|
config VBOOT
|
|
select VBOOT_MUST_REQUEST_DISPLAY
|
|
select VBOOT_STARTS_IN_BOOTBLOCK
|
|
select VBOOT_VBNV_CMOS
|
|
select GBB_FLAG_DISABLE_LID_SHUTDOWN
|
|
select GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC
|
|
select GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC
|
|
select GBB_FLAG_DISABLE_FWMP
|
|
|
|
if ARCH_BOOTBLOCK_X86_64
|
|
|
|
config PAGE_TABLES_IN_CBFS
|
|
bool
|
|
default y
|
|
|
|
# Need to install page tables in DRAM as the virtual MMU has problems translating paging
|
|
# request when the page table resides in emulated ROM. This causes undefined behaviour
|
|
# when handling data requests, as well as fetching and decoding instructions
|
|
# Real hardware didn't show any problems until now.
|
|
config ARCH_X86_64_PGTBL_LOC
|
|
default 0x8000
|
|
endif
|
|
|
|
if VBOOT
|
|
|
|
config VBOOT_SLOTS_RW_A
|
|
default y
|
|
|
|
endif
|
|
|
|
config FMDFILE
|
|
default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/vboot-rwa-16M.fmd" if VBOOT_SLOTS_RW_A
|
|
|
|
config VBOOT_VBNV_OFFSET
|
|
hex
|
|
default 0x2c
|
|
|
|
config MAINBOARD_DIR
|
|
default "emulation/qemu-i440fx"
|
|
|
|
config MAINBOARD_PART_NUMBER
|
|
default "QEMU x86 i440fx/piix4"
|
|
|
|
config IRQ_SLOT_COUNT
|
|
int
|
|
default 6
|
|
|
|
# Skip the first 64KiB as coreboot table pointer is installed
|
|
# at address 0
|
|
config DCACHE_RAM_BASE
|
|
hex
|
|
default 0x10000
|
|
|
|
# Memory at 0xa0000 decodes to VGA
|
|
config DCACHE_RAM_SIZE
|
|
hex
|
|
default 0x90000
|
|
|
|
config C_ENV_BOOTBLOCK_SIZE
|
|
hex
|
|
default 0x10000
|
|
|
|
config DCACHE_BSP_STACK_SIZE
|
|
hex
|
|
default 0x4000
|
|
|
|
endif # BOARD_EMULATION_QEMU_X86_I440FX
|