security/vboot: Add function to read UDC enable flag

This change adds a helper function to read USB Device Controller (UDC)
enable flag from VBNV.

BUG=b:78577893
BRANCH=poppy

Change-Id: Ifd1e9b0781ffee242d695b72287632bc944a50c7
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/25846
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Furquan Shaikh 2018-04-25 18:13:03 -07:00
parent 557b9bbdf2
commit 37c721d786
3 changed files with 12 additions and 0 deletions

View File

@ -147,6 +147,13 @@ int vboot_wants_oprom(void)
return (vbnv_data(BOOT_OFFSET) & BOOT_OPROM_NEEDED) ? 1 : 0;
}
/* Read the USB Device Controller(UDC) enable flag from VBNV. */
int vbnv_udc_enable_flag(void)
{
vbnv_setup();
return (vbnv_data(DEV_FLAGS_OFFSET) & DEV_ENABLE_UDC) ? 1 : 0;
}
void vbnv_init(uint8_t *vbnv_copy)
{
if (IS_ENABLED(CONFIG_VBOOT_VBNV_CMOS))

View File

@ -26,6 +26,10 @@ void regen_vbnv_crc(uint8_t *vbnv_copy);
int get_recovery_mode_from_vbnv(void);
void set_recovery_mode_into_vbnv(int recovery_reason);
int vboot_wants_oprom(void);
/* Read the USB Device Controller(UDC) enable flag from VBNV. */
int vbnv_udc_enable_flag(void);
/* Initialize and read vbnv. This is used in the main vboot logic path. */
void vbnv_init(uint8_t *vbnv_copy);
/* Reset vbnv snapshot to a known state. */

View File

@ -40,6 +40,7 @@
#define DEV_FLAGS_OFFSET 4
#define DEV_BOOT_USB_MASK 0x01
#define DEV_BOOT_SIGNED_ONLY_MASK 0x02
#define DEV_ENABLE_UDC 0x40
#define MISC_FLAGS_OFFSET 8
#define MISC_FLAGS_BATTERY_CUTOFF_MASK 0x08