blob: 12b939986b772dc1d6bb84f3a78bf364764bb27d [file] [log] [blame]
Duncan Laurie88b28ad2016-01-25 17:13:27 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2016 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
Furquan Shaikh2a12e2e2016-07-25 11:48:03 -070016#ifndef __VBOOT_VBNV_H__
17#define __VBOOT_VBNV_H__
Duncan Laurie88b28ad2016-01-25 17:13:27 -080018
19#include <types.h>
20
21/* Generic functions */
Furquan Shaikhbe87f732016-06-29 11:26:27 -070022void read_vbnv(uint8_t *vbnv_copy);
Duncan Laurie88b28ad2016-01-25 17:13:27 -080023void save_vbnv(const uint8_t *vbnv_copy);
24int verify_vbnv(uint8_t *vbnv_copy);
Hung-Te Linfe2fc832016-12-29 20:59:37 +080025void regen_vbnv_crc(uint8_t *vbnv_copy);
Furquan Shaikh37c721d2018-04-25 18:13:03 -070026
27/* Read the USB Device Controller(UDC) enable flag from VBNV. */
28int vbnv_udc_enable_flag(void);
29
Aaron Durbin118a84f2017-09-15 11:15:07 -060030/* Initialize and read vbnv. This is used in the main vboot logic path. */
31void vbnv_init(uint8_t *vbnv_copy);
Aaron Durbinfe265a12017-09-15 11:17:38 -060032/* Reset vbnv snapshot to a known state. */
33void vbnv_reset(uint8_t *vbnv_copy);
Duncan Laurie88b28ad2016-01-25 17:13:27 -080034
35/* CMOS backend */
Elyes HAOUAS2119d0b2020-02-16 10:01:33 +010036/* Initialize the vbnv CMOS backing store. The vbnv_copy pointer is used for
Aaron Durbin0990fbf2017-09-15 15:23:04 -060037 optional temporary storage in the init function. */
38void vbnv_init_cmos(uint8_t *vbnv_copy);
Elyes HAOUAS2119d0b2020-02-16 10:01:33 +010039/* Return non-zero if CMOS power was lost. */
Aaron Durbin0990fbf2017-09-15 15:23:04 -060040int vbnv_cmos_failed(void);
Duncan Laurie88b28ad2016-01-25 17:13:27 -080041void read_vbnv_cmos(uint8_t *vbnv_copy);
42void save_vbnv_cmos(const uint8_t *vbnv_copy);
Duncan Laurie88b28ad2016-01-25 17:13:27 -080043
44/* Flash backend */
45void read_vbnv_flash(uint8_t *vbnv_copy);
46void save_vbnv_flash(const uint8_t *vbnv_copy);
47
48/* EC backend */
49void read_vbnv_ec(uint8_t *vbnv_copy);
50void save_vbnv_ec(const uint8_t *vbnv_copy);
51
Furquan Shaikh2a12e2e2016-07-25 11:48:03 -070052#endif /* __VBOOT_VBNV_H__ */