summaryrefslogtreecommitdiff
path: root/src/vboot
diff options
context:
space:
mode:
Diffstat (limited to 'src/vboot')
-rw-r--r--src/vboot/Makefile.inc16
-rw-r--r--src/vboot/bootmode.c (renamed from src/vboot/recovery.c)25
-rw-r--r--src/vboot/vboot_common.h4
3 files changed, 39 insertions, 6 deletions
diff --git a/src/vboot/Makefile.inc b/src/vboot/Makefile.inc
index c43af72d04..82b4ac2e9e 100644
--- a/src/vboot/Makefile.inc
+++ b/src/vboot/Makefile.inc
@@ -13,6 +13,14 @@
## GNU General Public License for more details.
##
+bootblock-y += bootmode.c
+romstage-y += bootmode.c
+ramstage-y += bootmode.c
+verstage-y += bootmode.c
+postcar-y += bootmode.c
+
+ifeq ($(CONFIG_VBOOT),y)
+
libverstage-generic-ccopts += -D__PRE_RAM__ -D__VERSTAGE__
verstage-generic-ccopts += -D__PRE_RAM__ -D__VERSTAGE__
@@ -53,12 +61,6 @@ romstage-y += vboot_common.c
ramstage-y += vboot_common.c
postcar-y += vboot_common.c
-bootblock-y += recovery.c
-romstage-y += recovery.c
-ramstage-y += recovery.c
-verstage-y += recovery.c
-postcar-y += recovery.c
-
bootblock-y += common.c
libverstage-y += vboot_logic.c
verstage-y += common.c
@@ -141,3 +143,5 @@ regions-for-file = $(subst $(spc),$(comma),$(sort \
font.bin \
vbgfx.bin \
,$(1)),COREBOOT,COREBOOT FW_MAIN_A FW_MAIN_B)))
+
+endif # CONFIG_VBOOT
diff --git a/src/vboot/recovery.c b/src/vboot/bootmode.c
index 6e6eb0e159..12a4dc0c8d 100644
--- a/src/vboot/recovery.c
+++ b/src/vboot/bootmode.c
@@ -89,6 +89,9 @@ static int cbmem_possibly_online(void)
*/
static int vboot_possibly_executed(void)
{
+ if (!IS_ENABLED(CONFIG_VBOOT))
+ return 0;
+
if (IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK)) {
if (ENV_BOOTBLOCK && IS_ENABLED(CONFIG_SEPARATE_VERSTAGE))
return 0;
@@ -150,3 +153,25 @@ int vboot_check_recovery_request(void)
return 0;
}
+
+int vboot_recovery_mode_enabled(void)
+{
+ if (!IS_ENABLED(CONFIG_VBOOT))
+ return 0;
+
+ return !!vboot_check_recovery_request();
+}
+
+int vboot_developer_mode_enabled(void)
+{
+ if (!IS_ENABLED(CONFIG_VBOOT))
+ return 0;
+
+ if (get_developer_mode_switch())
+ return 1;
+
+ if (cbmem_possibly_online() && vboot_handoff_check_developer_flag())
+ return 1;
+
+ return 0;
+}
diff --git a/src/vboot/vboot_common.h b/src/vboot/vboot_common.h
index 684a66b2e2..d64b5bb007 100644
--- a/src/vboot/vboot_common.h
+++ b/src/vboot/vboot_common.h
@@ -101,4 +101,8 @@ void verstage_main(void);
void verstage(void);
void verstage_mainboard_init(void);
+/* Check boot modes */
+int vboot_developer_mode_enabled(void);
+int vboot_recovery_mode_enabled(void);
+
#endif /* __VBOOT_VBOOT_COMMON_H__ */