vboot: introduce vbnv_init()

Add vbnv_init() which is responsible for doing any vbnv initialization
and reading the vbnv contents. Having this function allows for
putting vbnv backing store specific support in the main vboot logic
path.

BUG=b:63054105

Change-Id: Id8f0344e5de5338417ae2e353ae473d6909c860a
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/21550
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Aaron Durbin 2017-09-15 11:15:07 -06:00
parent 9fde0d780d
commit 118a84f8f5
3 changed files with 9 additions and 2 deletions

View File

@ -146,3 +146,8 @@ int vboot_wants_oprom(void)
vbnv_setup(); vbnv_setup();
return (vbnv_data(BOOT_OFFSET) & BOOT_OPROM_NEEDED) ? 1 : 0; return (vbnv_data(BOOT_OFFSET) & BOOT_OPROM_NEEDED) ? 1 : 0;
} }
void vbnv_init(uint8_t *vbnv_copy)
{
read_vbnv(vbnv_copy);
}

View File

@ -26,6 +26,8 @@ void regen_vbnv_crc(uint8_t *vbnv_copy);
int get_recovery_mode_from_vbnv(void); int get_recovery_mode_from_vbnv(void);
void set_recovery_mode_into_vbnv(int recovery_reason); void set_recovery_mode_into_vbnv(int recovery_reason);
int vboot_wants_oprom(void); int vboot_wants_oprom(void);
/* Initialize and read vbnv. This is used in the main vboot logic path. */
void vbnv_init(uint8_t *vbnv_copy);
/* CMOS backend */ /* CMOS backend */
void read_vbnv_cmos(uint8_t *vbnv_copy); void read_vbnv_cmos(uint8_t *vbnv_copy);

View File

@ -310,8 +310,8 @@ void verstage_main(void)
/* Set up context and work buffer */ /* Set up context and work buffer */
vb2_init_work_context(&ctx); vb2_init_work_context(&ctx);
/* Read nvdata from a non-volatile storage. */ /* Initialize and read nvdata from non-volatile storage. */
read_vbnv(ctx.nvdata); vbnv_init(ctx.nvdata);
/* Set S3 resume flag if vboot should behave differently when selecting /* Set S3 resume flag if vboot should behave differently when selecting
* which slot to boot. This is only relevant to vboot if the platform * which slot to boot. This is only relevant to vboot if the platform