Alper Nebi Yasak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/80368?usp=email )
Change subject: mb/qemu/fw_cfg: Move fw_cfg driver to drivers/emulation/qemu ......................................................................
mb/qemu/fw_cfg: Move fw_cfg driver to drivers/emulation/qemu
x86 QEMU mainboards use QEMU's firmware configuration device to set up ACPI and SMBIOS tables. The driver itself is located in the qemu-i440fx mainboard directory presumably because it was the only one using the device. Later on the qemu-q95 board was added, which references the files in the qemu-i440fx directory instead of moving them to a common scope.
The device is not specific to any architecture, so keeping the code under an x86 board is not exactly appropriate. Move the fw_cfg driver to drivers/emulation/qemu, with a dependency on the CPU_QEMU_X86 config option like the graphics drivers because it relies on x86 port IO. Move its header files into src/include and update any #include directives.
Change-Id: I0348bb2fa3a4cc1ef6561206a5dd02feb16ae869 Signed-off-by: Alper Nebi Yasak alpernebiyasak@gmail.com --- M src/drivers/emulation/qemu/Kconfig M src/drivers/emulation/qemu/Makefile.mk R src/drivers/emulation/qemu/fw_cfg.c R src/include/fw_cfg.h R src/include/fw_cfg_if.h M src/mainboard/emulation/qemu-i440fx/Kconfig M src/mainboard/emulation/qemu-i440fx/Makefile.mk M src/mainboard/emulation/qemu-i440fx/bootmode.c M src/mainboard/emulation/qemu-i440fx/memmap.c M src/mainboard/emulation/qemu-i440fx/northbridge.c M src/mainboard/emulation/qemu-q35/Kconfig M src/mainboard/emulation/qemu-q35/Makefile.mk M src/mainboard/emulation/qemu-q35/acpi_tables.c M src/mainboard/emulation/qemu-q35/cpu.c M src/mainboard/emulation/qemu-q35/memmap.c 15 files changed, 24 insertions(+), 14 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/68/80368/1
diff --git a/src/drivers/emulation/qemu/Kconfig b/src/drivers/emulation/qemu/Kconfig index c271825..31f5389 100644 --- a/src/drivers/emulation/qemu/Kconfig +++ b/src/drivers/emulation/qemu/Kconfig @@ -24,3 +24,11 @@ default 600 depends on LINEAR_FRAMEBUFFER depends on DRIVERS_EMULATION_QEMU_BOCHS + +config DRIVERS_EMULATION_QEMU_FW_CFG + bool "QEMU firmware configuration driver" + depends on CPU_QEMU_X86 + help + Driver for QEMU-specific device that passes various config + information to the firmware including e.g. ACPI and SMBIOS + tables. diff --git a/src/drivers/emulation/qemu/Makefile.mk b/src/drivers/emulation/qemu/Makefile.mk index 6f5ff3a..1793914 100644 --- a/src/drivers/emulation/qemu/Makefile.mk +++ b/src/drivers/emulation/qemu/Makefile.mk @@ -8,3 +8,8 @@ ramstage-$(CONFIG_DRIVERS_EMULATION_QEMU_BOCHS) += bochs.c ramstage-$(CONFIG_DRIVERS_EMULATION_QEMU_BOCHS) += cirrus.c ramstage-$(CONFIG_DRIVERS_EMULATION_QEMU_BOCHS) += ../../pc80/vga/vga_io.c + +bootblock-$(CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG) += fw_cfg.c +romstage-$(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 diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c b/src/drivers/emulation/qemu/fw_cfg.c similarity index 99% rename from src/mainboard/emulation/qemu-i440fx/fw_cfg.c rename to src/drivers/emulation/qemu/fw_cfg.c index ad664a6..5457fb6 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c +++ b/src/drivers/emulation/qemu/fw_cfg.c @@ -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 <fw_cfg.h> +#include <fw_cfg_if.h>
#define FW_CFG_PORT_CTL 0x0510 #define FW_CFG_PORT_DATA 0x0511 diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.h b/src/include/fw_cfg.h similarity index 100% rename from src/mainboard/emulation/qemu-i440fx/fw_cfg.h rename to src/include/fw_cfg.h diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h b/src/include/fw_cfg_if.h similarity index 100% rename from src/mainboard/emulation/qemu-i440fx/fw_cfg_if.h rename to src/include/fw_cfg_if.h diff --git a/src/mainboard/emulation/qemu-i440fx/Kconfig b/src/mainboard/emulation/qemu-i440fx/Kconfig index f02c92d..a2c8fc1 100644 --- a/src/mainboard/emulation/qemu-i440fx/Kconfig +++ b/src/mainboard/emulation/qemu-i440fx/Kconfig @@ -17,6 +17,7 @@ select NO_SMM select BOOT_DEVICE_NOT_SPI_FLASH select BOOT_DEVICE_MEMORY_MAPPED + select DRIVERS_EMULATION_QEMU_FW_CFG
config VBOOT select VBOOT_MUST_REQUEST_DISPLAY diff --git a/src/mainboard/emulation/qemu-i440fx/Makefile.mk b/src/mainboard/emulation/qemu-i440fx/Makefile.mk index 7d6041b..1946a67 100644 --- a/src/mainboard/emulation/qemu-i440fx/Makefile.mk +++ b/src/mainboard/emulation/qemu-i440fx/Makefile.mk @@ -8,5 +8,4 @@ ramstage-y += memmap.c ramstage-y += northbridge.c
-all-y += fw_cfg.c all-y += bootmode.c diff --git a/src/mainboard/emulation/qemu-i440fx/bootmode.c b/src/mainboard/emulation/qemu-i440fx/bootmode.c index 12990b2..12b21b5 100644 --- a/src/mainboard/emulation/qemu-i440fx/bootmode.c +++ b/src/mainboard/emulation/qemu-i440fx/bootmode.c @@ -2,7 +2,7 @@
#include <bootmode.h> #include <console/console.h> -#include "fw_cfg.h" +#include <fw_cfg.h>
/* * Enable recovery mode with fw_cfg option to qemu: diff --git a/src/mainboard/emulation/qemu-i440fx/memmap.c b/src/mainboard/emulation/qemu-i440fx/memmap.c index be730b7..a3c0efe 100644 --- a/src/mainboard/emulation/qemu-i440fx/memmap.c +++ b/src/mainboard/emulation/qemu-i440fx/memmap.c @@ -5,8 +5,8 @@ #include <arch/romstage.h> #include <console/console.h> #include <cpu/x86/smm.h> +#include <fw_cfg.h> #include "memory.h" -#include "fw_cfg.h"
#define CMOS_ADDR_PORT 0x70 #define CMOS_DATA_PORT 0x71 diff --git a/src/mainboard/emulation/qemu-i440fx/northbridge.c b/src/mainboard/emulation/qemu-i440fx/northbridge.c index 609e389..7b05075 100644 --- a/src/mainboard/emulation/qemu-i440fx/northbridge.c +++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c @@ -9,15 +9,13 @@ #include <device/pci_def.h> #include <device/pci_ops.h> #include <device/device.h> +#include <fw_cfg.h> +#include <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, diff --git a/src/mainboard/emulation/qemu-q35/Kconfig b/src/mainboard/emulation/qemu-q35/Kconfig index 489fd07..effcd21 100644 --- a/src/mainboard/emulation/qemu-q35/Kconfig +++ b/src/mainboard/emulation/qemu-q35/Kconfig @@ -15,6 +15,7 @@ select MAINBOARD_HAS_CHROMEOS select BOOT_DEVICE_NOT_SPI_FLASH select BOOT_DEVICE_MEMORY_MAPPED + select DRIVERS_EMULATION_QEMU_FW_CFG
config VBOOT select VBOOT_MUST_REQUEST_DISPLAY diff --git a/src/mainboard/emulation/qemu-q35/Makefile.mk b/src/mainboard/emulation/qemu-q35/Makefile.mk index bc73edc..877b807 100644 --- a/src/mainboard/emulation/qemu-q35/Makefile.mk +++ b/src/mainboard/emulation/qemu-q35/Makefile.mk @@ -15,7 +15,6 @@ 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 diff --git a/src/mainboard/emulation/qemu-q35/acpi_tables.c b/src/mainboard/emulation/qemu-q35/acpi_tables.c index e85ce65..c454454 100644 --- a/src/mainboard/emulation/qemu-q35/acpi_tables.c +++ b/src/mainboard/emulation/qemu-q35/acpi_tables.c @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h> +#include <fw_cfg.h>
-#include "../qemu-i440fx/fw_cfg.h" #include "../qemu-i440fx/acpi.h"
void mainboard_fill_fadt(acpi_fadt_t *fadt) diff --git a/src/mainboard/emulation/qemu-q35/cpu.c b/src/mainboard/emulation/qemu-q35/cpu.c index c57ec50..1e0a2ce 100644 --- a/src/mainboard/emulation/qemu-q35/cpu.c +++ b/src/mainboard/emulation/qemu-q35/cpu.c @@ -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 <fw_cfg.h> #include <stddef.h> #include <stdint.h>
diff --git a/src/mainboard/emulation/qemu-q35/memmap.c b/src/mainboard/emulation/qemu-q35/memmap.c index 150ea11..288e3f3 100644 --- a/src/mainboard/emulation/qemu-q35/memmap.c +++ b/src/mainboard/emulation/qemu-q35/memmap.c @@ -7,7 +7,7 @@ #include <cpu/x86/smm.h> #include <device/pci_ops.h> #include <mainboard/emulation/qemu-i440fx/memory.h> -#include <mainboard/emulation/qemu-i440fx/fw_cfg.h> +#include <fw_cfg.h> #include <cpu/intel/smm_reloc.h>
#include "q35.h"