There's an occasional issue on machines which use CMOS for their vbnv storage. The machine that just powers up from complete G3 would have had their RTC rail not held up. The contents of vbnv in CMOS could pass the crc8 though the values could be bad. In order to fix this introduce two functions: 1. vbnv_init_cmos() 2. vbnv_cmos_failed() At the start of vboot the CMOS is queried for failure. If there is a failure indicated then the vbnv data is restored from flash backup or reset to known values when there is no flash backup. BUG=b:63054105 Change-Id: I8bd6f28f64a116b84a08ce4779cd4dc73c0f2f3d Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/21560 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
52 lines
1.7 KiB
C
52 lines
1.7 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright (C) 2016 Google Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#ifndef __VBOOT_VBNV_H__
|
|
#define __VBOOT_VBNV_H__
|
|
|
|
#include <types.h>
|
|
|
|
/* Generic functions */
|
|
void read_vbnv(uint8_t *vbnv_copy);
|
|
void save_vbnv(const uint8_t *vbnv_copy);
|
|
int verify_vbnv(uint8_t *vbnv_copy);
|
|
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);
|
|
/* 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. */
|
|
void vbnv_reset(uint8_t *vbnv_copy);
|
|
|
|
/* CMOS backend */
|
|
/* Initialize the vbnv cmos backing store. The vbnv_copy pointer is used for
|
|
optional temporary storage in the init function. */
|
|
void vbnv_init_cmos(uint8_t *vbnv_copy);
|
|
/* Return non-zero if cmos power was lost. */
|
|
int vbnv_cmos_failed(void);
|
|
void read_vbnv_cmos(uint8_t *vbnv_copy);
|
|
void save_vbnv_cmos(const uint8_t *vbnv_copy);
|
|
|
|
/* Flash backend */
|
|
void read_vbnv_flash(uint8_t *vbnv_copy);
|
|
void save_vbnv_flash(const uint8_t *vbnv_copy);
|
|
|
|
/* EC backend */
|
|
void read_vbnv_ec(uint8_t *vbnv_copy);
|
|
void save_vbnv_ec(const uint8_t *vbnv_copy);
|
|
|
|
#endif /* __VBOOT_VBNV_H__ */
|