diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-11-03 06:02:57 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-11-09 14:55:01 +0000 |
commit | 085fdd85592715c77cc35585f9155c25d2344e1a (patch) | |
tree | 6609b2eb32257254f35a10b01b453a8ad8873cbb | |
parent | a7648f2b27a7be37916ab7e62169e6841ab4caad (diff) |
emulation/qemu-i440fx,q35: Split chromeos.c
This drops VBOOT_NO_BOARD_SUPPORT.
There is little impact of always having recovery_mode_switch()
implemented in bootmode.c. A weak write_protect_state() is not
necessary as there is no BOOT_DEVICE_SPI_FLASH with the emulation.
Call to fill_lb_gpios() is already guarded with CONFIG(CHROMEOS)
so the weak implementation would not be referenced.
Change-Id: I3c00b30c5233ae3556b7622f97c3166668c8ab12
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58946
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/Kconfig | 1 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/Makefile.inc | 6 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/bootmode.c | 29 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-q35/Kconfig | 1 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-q35/Makefile.inc | 8 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-q35/chromeos.c | 31 |
6 files changed, 35 insertions, 41 deletions
diff --git a/src/mainboard/emulation/qemu-i440fx/Kconfig b/src/mainboard/emulation/qemu-i440fx/Kconfig index 1b9edf04b9..8728e4e9f5 100644 --- a/src/mainboard/emulation/qemu-i440fx/Kconfig +++ b/src/mainboard/emulation/qemu-i440fx/Kconfig @@ -21,7 +21,6 @@ config VBOOT select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_VBNV_CMOS - select VBOOT_NO_BOARD_SUPPORT select GBB_FLAG_DISABLE_LID_SHUTDOWN select GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC select GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC diff --git a/src/mainboard/emulation/qemu-i440fx/Makefile.inc b/src/mainboard/emulation/qemu-i440fx/Makefile.inc index cac74ee435..7bd1c02121 100644 --- a/src/mainboard/emulation/qemu-i440fx/Makefile.inc +++ b/src/mainboard/emulation/qemu-i440fx/Makefile.inc @@ -1,10 +1,10 @@ -romstage-y += fw_cfg.c romstage-y += memmap.c -postcar-y += fw_cfg.c postcar-y += memmap.c postcar-y += exit_car.S -ramstage-y += fw_cfg.c 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 new file mode 100644 index 0000000000..12990b2552 --- /dev/null +++ b/src/mainboard/emulation/qemu-i440fx/bootmode.c @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <bootmode.h> +#include <console/console.h> +#include "fw_cfg.h" + +/* + * Enable recovery mode with fw_cfg option to qemu: + * -fw_cfg name=opt/cros/recovery,string=1 + */ +int get_recovery_mode_switch(void) +{ + FWCfgFile f; + + if (!fw_cfg_check_file(&f, "opt/cros/recovery")) { + uint8_t rec_mode; + if (f.size != 1) { + printk(BIOS_ERR, "opt/cros/recovery invalid size %d\n", f.size); + return 0; + } + fw_cfg_get(f.select, &rec_mode, f.size); + if (rec_mode == '1') { + printk(BIOS_INFO, "Recovery is enabled.\n"); + return 1; + } + } + + return 0; +} diff --git a/src/mainboard/emulation/qemu-q35/Kconfig b/src/mainboard/emulation/qemu-q35/Kconfig index 04dce28261..e078aa9770 100644 --- a/src/mainboard/emulation/qemu-q35/Kconfig +++ b/src/mainboard/emulation/qemu-q35/Kconfig @@ -21,7 +21,6 @@ config VBOOT select VBOOT_MUST_REQUEST_DISPLAY select VBOOT_STARTS_IN_BOOTBLOCK select VBOOT_VBNV_CMOS - select VBOOT_NO_BOARD_SUPPORT if !CHROMEOS select GBB_FLAG_DISABLE_LID_SHUTDOWN select GBB_FLAG_DISABLE_PD_SOFTWARE_SYNC select GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC diff --git a/src/mainboard/emulation/qemu-q35/Makefile.inc b/src/mainboard/emulation/qemu-q35/Makefile.inc index 6d5c29e7fd..dc4e794368 100644 --- a/src/mainboard/emulation/qemu-q35/Makefile.inc +++ b/src/mainboard/emulation/qemu-q35/Makefile.inc @@ -1,23 +1,21 @@ bootblock-y += bootblock.c bootblock-y += memmap.c -romstage-y += ../qemu-i440fx/fw_cfg.c romstage-y += ../qemu-i440fx/memmap.c romstage-y += memmap.c -postcar-y += ../qemu-i440fx/fw_cfg.c postcar-y += ../qemu-i440fx/memmap.c postcar-y += ../qemu-i440fx/exit_car.S postcar-y += memmap.c -ramstage-y += ../qemu-i440fx/fw_cfg.c ramstage-y += ../qemu-i440fx/memmap.c ramstage-y += ../qemu-i440fx/northbridge.c ramstage-y += memmap.c ramstage-y += cpu.c -verstage-$(CONFIG_CHROMEOS) += chromeos.c -verstage-$(CONFIG_CHROMEOS) += ../qemu-i440fx/fw_cfg.c +all-y += ../qemu-i440fx/fw_cfg.c +all-y += ../qemu-i440fx/bootmode.c + ramstage-$(CONFIG_CHROMEOS) += chromeos.c smm-y += smi.c diff --git a/src/mainboard/emulation/qemu-q35/chromeos.c b/src/mainboard/emulation/qemu-q35/chromeos.c index 630874c8e8..bb0ffeea95 100644 --- a/src/mainboard/emulation/qemu-q35/chromeos.c +++ b/src/mainboard/emulation/qemu-q35/chromeos.c @@ -2,9 +2,7 @@ #include <bootmode.h> #include <boot/coreboot_tables.h> -#include <console/console.h> #include <vendorcode/google/chromeos/chromeos.h> -#include "../qemu-i440fx/fw_cfg.h" void fill_lb_gpios(struct lb_gpios *gpios) { @@ -17,35 +15,6 @@ void fill_lb_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); } -int get_write_protect_state(void) -{ - return 0; -} - -/* - * Enable recovery mode with fw_cfg option to qemu: - * -fw_cfg name=opt/cros/recovery,string=1 - */ -int get_recovery_mode_switch(void) -{ - FWCfgFile f; - - if (!fw_cfg_check_file(&f, "opt/cros/recovery")) { - uint8_t rec_mode; - if (f.size != 1) { - printk(BIOS_ERR, "opt/cros/recovery invalid size %d\n", f.size); - return 0; - } - fw_cfg_get(f.select, &rec_mode, f.size); - if (rec_mode == '1') { - printk(BIOS_INFO, "Recovery is enabled.\n"); - return 1; - } - } - - return 0; -} - static const struct cros_gpio cros_gpios[] = { CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, "QEMU"), }; |