blob: eb435e2e58d39e3704595815eb1c78b21b635dae [file] [log] [blame]
Angel Pons986d50e2020-04-02 23:48:53 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Duncan Laurie88b28ad2016-01-25 17:13:27 -08002
Furquan Shaikh2a12e2e2016-07-25 11:48:03 -07003#ifndef __VBOOT_VBNV_H__
4#define __VBOOT_VBNV_H__
Duncan Laurie88b28ad2016-01-25 17:13:27 -08005
6#include <types.h>
7
8/* Generic functions */
Furquan Shaikhbe87f732016-06-29 11:26:27 -07009void read_vbnv(uint8_t *vbnv_copy);
Duncan Laurie88b28ad2016-01-25 17:13:27 -080010void save_vbnv(const uint8_t *vbnv_copy);
11int verify_vbnv(uint8_t *vbnv_copy);
Hung-Te Linfe2fc832016-12-29 20:59:37 +080012void regen_vbnv_crc(uint8_t *vbnv_copy);
Furquan Shaikh37c721d2018-04-25 18:13:03 -070013
14/* Read the USB Device Controller(UDC) enable flag from VBNV. */
15int vbnv_udc_enable_flag(void);
16
Aaron Durbin118a84f2017-09-15 11:15:07 -060017/* Initialize and read vbnv. This is used in the main vboot logic path. */
18void vbnv_init(uint8_t *vbnv_copy);
Aaron Durbinfe265a12017-09-15 11:17:38 -060019/* Reset vbnv snapshot to a known state. */
20void vbnv_reset(uint8_t *vbnv_copy);
Duncan Laurie88b28ad2016-01-25 17:13:27 -080021
22/* CMOS backend */
Elyes HAOUAS2119d0b2020-02-16 10:01:33 +010023/* Initialize the vbnv CMOS backing store. The vbnv_copy pointer is used for
Aaron Durbin0990fbf2017-09-15 15:23:04 -060024 optional temporary storage in the init function. */
25void vbnv_init_cmos(uint8_t *vbnv_copy);
Elyes HAOUAS2119d0b2020-02-16 10:01:33 +010026/* Return non-zero if CMOS power was lost. */
Aaron Durbin0990fbf2017-09-15 15:23:04 -060027int vbnv_cmos_failed(void);
Duncan Laurie88b28ad2016-01-25 17:13:27 -080028void read_vbnv_cmos(uint8_t *vbnv_copy);
29void save_vbnv_cmos(const uint8_t *vbnv_copy);
Duncan Laurie88b28ad2016-01-25 17:13:27 -080030
31/* Flash backend */
32void read_vbnv_flash(uint8_t *vbnv_copy);
33void save_vbnv_flash(const uint8_t *vbnv_copy);
34
35/* EC backend */
36void read_vbnv_ec(uint8_t *vbnv_copy);
37void save_vbnv_ec(const uint8_t *vbnv_copy);
38
Furquan Shaikh2a12e2e2016-07-25 11:48:03 -070039#endif /* __VBOOT_VBNV_H__ */