Declare recovery and developer modes outside ChromeOS
Move the implementation for recovery and developer modes from vendorcode/google/chromes to lib/. Change-Id: I33335fb282de2c7bc613dc58d6912c47f3b5c06c Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/4308 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
@ -26,6 +26,7 @@ config CHROMEOS
|
||||
bool "Build for ChromeOS"
|
||||
default y
|
||||
select TPM
|
||||
select BOOTMODE_STRAPS
|
||||
help
|
||||
Enable ChromeOS specific features like the GPIO sub table in
|
||||
the coreboot table. NOTE: Enabling this option on an unsupported
|
||||
|
@ -27,7 +27,9 @@
|
||||
#include <console/console.h>
|
||||
|
||||
#if CONFIG_VBOOT_VERIFY_FIRMWARE
|
||||
static int vboot_enable_developer(void)
|
||||
#include <payload_loader.h>
|
||||
|
||||
int vboot_enable_developer(void)
|
||||
{
|
||||
struct vboot_handoff *vbho;
|
||||
|
||||
@ -42,7 +44,7 @@ static int vboot_enable_developer(void)
|
||||
return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_DEVELOPER);
|
||||
}
|
||||
|
||||
static int vboot_enable_recovery(void)
|
||||
int vboot_enable_recovery(void)
|
||||
{
|
||||
struct vboot_handoff *vbho;
|
||||
|
||||
@ -53,36 +55,6 @@ static int vboot_enable_recovery(void)
|
||||
|
||||
return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_RECOVERY);
|
||||
}
|
||||
#else
|
||||
static inline int vboot_enable_developer(void) { return 0; }
|
||||
static inline int vboot_enable_recovery(void) { return 0; }
|
||||
#endif
|
||||
|
||||
int developer_mode_enabled(void)
|
||||
{
|
||||
return get_developer_mode_switch() || vboot_enable_developer();
|
||||
}
|
||||
|
||||
int recovery_mode_enabled(void)
|
||||
{
|
||||
/*
|
||||
* This is called in multiple places and has to detect
|
||||
* recovery mode triggered from the EC and via shared
|
||||
* recovery reason set with crossystem.
|
||||
*
|
||||
* If shared recovery reason is set:
|
||||
* - before VbInit then get_recovery_mode_from_vbnv() is true
|
||||
* - after VbInit then vboot_enable_recovery() is true
|
||||
*
|
||||
* Otherwise the mainboard handler for get_recovery_mode_switch()
|
||||
* will detect recovery mode initiated by the EC.
|
||||
*/
|
||||
return get_recovery_mode_switch() || get_recovery_mode_from_vbnv() ||
|
||||
vboot_enable_recovery();
|
||||
}
|
||||
|
||||
#if CONFIG_VBOOT_VERIFY_FIRMWARE
|
||||
#include <payload_loader.h>
|
||||
|
||||
static void *vboot_get_payload(size_t *len)
|
||||
{
|
||||
|
@ -22,10 +22,9 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <bootmode.h>
|
||||
|
||||
/* functions implemented per mainboard: */
|
||||
int get_developer_mode_switch(void);
|
||||
int get_recovery_mode_switch(void);
|
||||
int get_write_protect_state(void);
|
||||
#ifdef __PRE_RAM__
|
||||
void save_chromeos_gpios(void);
|
||||
@ -39,16 +38,14 @@ extern int oprom_is_loaded;
|
||||
void read_vbnv(uint8_t *vbnv_copy);
|
||||
void save_vbnv(const uint8_t *vbnv_copy);
|
||||
|
||||
/* functions implemented in chromeos.c: */
|
||||
int developer_mode_enabled(void);
|
||||
int recovery_mode_enabled(void);
|
||||
|
||||
/* functions implemented in vboot.c */
|
||||
void init_chromeos(int bootmode);
|
||||
|
||||
#if CONFIG_VBOOT_VERIFY_FIRMWARE
|
||||
/* Returns 0 on success < 0 on error. */
|
||||
int vboot_get_handoff_info(void **addr, uint32_t *size);
|
||||
int vboot_enable_developer(void);
|
||||
int vboot_enable_recovery(void);
|
||||
#endif
|
||||
|
||||
#include "gnvs.h"
|
||||
|
Reference in New Issue
Block a user