coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
bootmode.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3
#include <
bootmode.h
>
4
#include <
console/console.h
>
5
#include "
fw_cfg.h
"
6
7
/*
8
* Enable recovery mode with fw_cfg option to qemu:
9
* -fw_cfg name=opt/cros/recovery,string=1
10
*/
11
int
get_recovery_mode_switch
(
void
)
12
{
13
FWCfgFile
f;
14
15
if
(!
fw_cfg_check_file
(&f,
"opt/cros/recovery"
)) {
16
uint8_t
rec_mode;
17
if
(f.
size
!= 1) {
18
printk
(
BIOS_ERR
,
"opt/cros/recovery invalid size %d\n"
, f.
size
);
19
return
0;
20
}
21
fw_cfg_get
(f.
select
, &rec_mode, f.
size
);
22
if
(rec_mode ==
'1'
) {
23
printk
(
BIOS_INFO
,
"Recovery is enabled.\n"
);
24
return
1;
25
}
26
}
27
28
return
0;
29
}
bootmode.h
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
fw_cfg_get
void fw_cfg_get(uint16_t entry, void *dst, int dstlen)
Definition:
fw_cfg.c:58
fw_cfg_check_file
int fw_cfg_check_file(FWCfgFile *file, const char *name)
Definition:
fw_cfg.c:85
fw_cfg.h
BIOS_INFO
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition:
loglevel.h:113
BIOS_ERR
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition:
loglevel.h:72
get_recovery_mode_switch
int get_recovery_mode_switch(void)
HACK: Use Fn-Key as recovery mode switch.
Definition:
bootmode.c:11
uint8_t
unsigned char uint8_t
Definition:
stdint.h:8
FWCfgFile
Definition:
fw_cfg_if.h:67
FWCfgFile::select
uint16_t select
Definition:
fw_cfg_if.h:69
FWCfgFile::size
uint32_t size
Definition:
fw_cfg_if.h:68
src
mainboard
emulation
qemu-i440fx
bootmode.c
Generated by
1.9.1