mb/qemu-i440fx: refactor fw_cfg logic as separate driver

The fw_cfg device can be used by other qemu boards outside i440fx (and
q35, which manually includes the code). Factor out the fw_cfg code as a
separate driver that qemu mainboards can enable.

Change-Id: I8c5c4cb5f5478abd21aab8e8d0b503db41d81d40
Signed-off-by: Carlos López <carlos.lopez@openchip.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85673
Reviewed-by: Nicholas Chin <nic.c3.14@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Carlos López 2024-12-16 13:36:44 +01:00 committed by Matt DeVillier
commit 54d6c6b2ab
15 changed files with 23 additions and 13 deletions

View file

@ -35,3 +35,9 @@ config DRIVERS_EMULATION_QEMU_YRES
default 600
depends on LINEAR_FRAMEBUFFER
depends on DRIVERS_EMULATION_QEMU_BOCHS || DRIVERS_EMULATION_QEMU_CIRRUS
config DRIVERS_EMULATION_QEMU_FW_CFG
bool "qemu fw_cfg"
default n
help
qemu fw_cfg driver

View file

@ -7,3 +7,9 @@ ramstage-$(CONFIG_CONSOLE_QEMU_DEBUGCON) += qemu_debugcon.c
ramstage-$(CONFIG_DRIVERS_EMULATION_QEMU_BOCHS) += bochs.c
ramstage-$(CONFIG_DRIVERS_EMULATION_QEMU_CIRRUS) += cirrus.c
bootblock-$(CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG) += fw_cfg.c
romstage-$(CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG) += fw_cfg.c
verstage-$(CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG) += fw_cfg.c
postcar-$(CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG) += fw_cfg.c
ramstage-$(CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG) += fw_cfg.c

View file

@ -8,9 +8,8 @@
#include <arch/io.h>
#include <acpi/acpi.h>
#include <commonlib/endian.h>
#include "fw_cfg.h"
#include "fw_cfg_if.h"
#include <device/fw_cfg.h>
#include <device/fw_cfg_if.h>
#define FW_CFG_PORT_CTL 0x0510
#define FW_CFG_PORT_DATA 0x0511

View file

@ -20,6 +20,7 @@ config BOARD_SPECIFIC_OPTIONS
select BOOT_DEVICE_NOT_SPI_FLASH
select BOOT_DEVICE_MEMORY_MAPPED
select BOOT_DEVICE_SUPPORTS_WRITES
select DRIVERS_EMULATION_QEMU_FW_CFG
config VBOOT
select VBOOT_MUST_REQUEST_DISPLAY

View file

@ -9,5 +9,4 @@ ramstage-y += memmap.c
ramstage-y += northbridge.c
ramstage-y += rom_media.c
all-y += fw_cfg.c
all-y += bootmode.c

View file

@ -2,7 +2,7 @@
#include <bootmode.h>
#include <console/console.h>
#include "fw_cfg.h"
#include <device/fw_cfg.h>
/*
* Enable recovery mode with fw_cfg option to qemu:

View file

@ -5,8 +5,8 @@
#include <arch/romstage.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
#include <device/fw_cfg.h>
#include "memory.h"
#include "fw_cfg.h"
#define CMOS_ADDR_PORT 0x70
#define CMOS_DATA_PORT 0x71

View file

@ -9,15 +9,14 @@
#include <device/pci_def.h>
#include <device/pci_ops.h>
#include <device/device.h>
#include <device/fw_cfg.h>
#include <device/fw_cfg_if.h>
#include <identity.h>
#include <stdlib.h>
#include <smbios.h>
#include <types.h>
#include "memory.h"
#include "fw_cfg.h"
#include "fw_cfg_if.h"
#include "acpi.h"
static void qemu_reserve_ports(struct device *dev, unsigned int idx,

View file

@ -18,6 +18,7 @@ config BOARD_SPECIFIC_OPTIONS
select BOOT_DEVICE_NOT_SPI_FLASH
select BOOT_DEVICE_MEMORY_MAPPED
select BOOT_DEVICE_SUPPORTS_WRITES
select DRIVERS_EMULATION_QEMU_FW_CFG
config VBOOT
select VBOOT_MUST_REQUEST_DISPLAY

View file

@ -16,7 +16,6 @@ ramstage-y += ../qemu-i440fx/rom_media.c
ramstage-y += memmap.c
ramstage-y += cpu.c
all-y += ../qemu-i440fx/fw_cfg.c
all-y += ../qemu-i440fx/bootmode.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c

View file

@ -1,8 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
#include <device/fw_cfg.h>
#include "../qemu-i440fx/fw_cfg.h"
#include "../qemu-i440fx/acpi.h"
void mainboard_fill_fadt(acpi_fadt_t *fadt)

View file

@ -7,7 +7,7 @@
#include <cpu/x86/legacy_save_state.h>
#include <cpu/x86/mp.h>
#include <cpu/x86/smm.h>
#include <mainboard/emulation/qemu-i440fx/fw_cfg.h>
#include <device/fw_cfg.h>
#include <stddef.h>
#include <stdint.h>

View file

@ -5,9 +5,9 @@
#include <assert.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
#include <device/fw_cfg.h>
#include <device/pci_ops.h>
#include <mainboard/emulation/qemu-i440fx/memory.h>
#include <mainboard/emulation/qemu-i440fx/fw_cfg.h>
#include <cpu/intel/smm_reloc.h>
#include "q35.h"