Angel Pons | 986d50e | 2020-04-02 23:48:53 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Duncan Laurie | 88b28ad | 2016-01-25 17:13:27 -0800 | [diff] [blame] | 2 | |
Furquan Shaikh | 2a12e2e | 2016-07-25 11:48:03 -0700 | [diff] [blame] | 3 | #ifndef __VBOOT_VBNV_H__ |
| 4 | #define __VBOOT_VBNV_H__ |
Duncan Laurie | 88b28ad | 2016-01-25 17:13:27 -0800 | [diff] [blame] | 5 | |
| 6 | #include <types.h> |
| 7 | |
| 8 | /* Generic functions */ |
Furquan Shaikh | be87f73 | 2016-06-29 11:26:27 -0700 | [diff] [blame] | 9 | void read_vbnv(uint8_t *vbnv_copy); |
Duncan Laurie | 88b28ad | 2016-01-25 17:13:27 -0800 | [diff] [blame] | 10 | void save_vbnv(const uint8_t *vbnv_copy); |
| 11 | int verify_vbnv(uint8_t *vbnv_copy); |
Hung-Te Lin | fe2fc83 | 2016-12-29 20:59:37 +0800 | [diff] [blame] | 12 | void regen_vbnv_crc(uint8_t *vbnv_copy); |
Furquan Shaikh | 37c721d | 2018-04-25 18:13:03 -0700 | [diff] [blame] | 13 | |
| 14 | /* Read the USB Device Controller(UDC) enable flag from VBNV. */ |
| 15 | int vbnv_udc_enable_flag(void); |
| 16 | |
Aaron Durbin | 118a84f | 2017-09-15 11:15:07 -0600 | [diff] [blame] | 17 | /* Initialize and read vbnv. This is used in the main vboot logic path. */ |
| 18 | void vbnv_init(uint8_t *vbnv_copy); |
Aaron Durbin | fe265a1 | 2017-09-15 11:17:38 -0600 | [diff] [blame] | 19 | /* Reset vbnv snapshot to a known state. */ |
| 20 | void vbnv_reset(uint8_t *vbnv_copy); |
Duncan Laurie | 88b28ad | 2016-01-25 17:13:27 -0800 | [diff] [blame] | 21 | |
| 22 | /* CMOS backend */ |
Elyes HAOUAS | 2119d0b | 2020-02-16 10:01:33 +0100 | [diff] [blame] | 23 | /* Initialize the vbnv CMOS backing store. The vbnv_copy pointer is used for |
Aaron Durbin | 0990fbf | 2017-09-15 15:23:04 -0600 | [diff] [blame] | 24 | optional temporary storage in the init function. */ |
| 25 | void vbnv_init_cmos(uint8_t *vbnv_copy); |
Elyes HAOUAS | 2119d0b | 2020-02-16 10:01:33 +0100 | [diff] [blame] | 26 | /* Return non-zero if CMOS power was lost. */ |
Aaron Durbin | 0990fbf | 2017-09-15 15:23:04 -0600 | [diff] [blame] | 27 | int vbnv_cmos_failed(void); |
Duncan Laurie | 88b28ad | 2016-01-25 17:13:27 -0800 | [diff] [blame] | 28 | void read_vbnv_cmos(uint8_t *vbnv_copy); |
| 29 | void save_vbnv_cmos(const uint8_t *vbnv_copy); |
Duncan Laurie | 88b28ad | 2016-01-25 17:13:27 -0800 | [diff] [blame] | 30 | |
| 31 | /* Flash backend */ |
| 32 | void read_vbnv_flash(uint8_t *vbnv_copy); |
| 33 | void save_vbnv_flash(const uint8_t *vbnv_copy); |
| 34 | |
| 35 | /* EC backend */ |
| 36 | void read_vbnv_ec(uint8_t *vbnv_copy); |
| 37 | void save_vbnv_ec(const uint8_t *vbnv_copy); |
| 38 | |
Furquan Shaikh | 2a12e2e | 2016-07-25 11:48:03 -0700 | [diff] [blame] | 39 | #endif /* __VBOOT_VBNV_H__ */ |