diff options
Diffstat (limited to 'src/mainboard/emulation/qemu-i440fx/bootmode.c')
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/bootmode.c | 29 |
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 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; +} |