summaryrefslogtreecommitdiffstats
path: root/src/mainboard/emulation/qemu-i440fx/bootmode.c
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-11-03 06:02:57 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-11-09 14:55:01 +0000
commit085fdd85592715c77cc35585f9155c25d2344e1a (patch)
tree6609b2eb32257254f35a10b01b453a8ad8873cbb /src/mainboard/emulation/qemu-i440fx/bootmode.c
parenta7648f2b27a7be37916ab7e62169e6841ab4caad (diff)
downloadcoreboot-085fdd85592715c77cc35585f9155c25d2344e1a.tar.gz
coreboot-085fdd85592715c77cc35585f9155c25d2344e1a.tar.bz2
coreboot-085fdd85592715c77cc35585f9155c25d2344e1a.zip
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>
Diffstat (limited to 'src/mainboard/emulation/qemu-i440fx/bootmode.c')
-rw-r--r--src/mainboard/emulation/qemu-i440fx/bootmode.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mainboard/emulation/qemu-i440fx/bootmode.c b/src/mainboard/emulation/qemu-i440fx/bootmode.c
new file mode 100644
index 000000000000..12990b2552ac
--- /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;
+}