From 344e86bb3baff8f89c1335c190dbee050176e058 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Wed, 20 Nov 2019 19:47:10 +0100 Subject: security/vboot: Drop CAR_GLOBAL_MIGRATION support Change-Id: I9dee03da028b9111b685e325368815a86e444a47 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/37028 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/security/vboot/vbnv.c | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'src/security/vboot/vbnv.c') diff --git a/src/security/vboot/vbnv.c b/src/security/vboot/vbnv.c index eccd743012..be598acb18 100644 --- a/src/security/vboot/vbnv.c +++ b/src/security/vboot/vbnv.c @@ -13,32 +13,13 @@ * GNU General Public License for more details. */ -#include #include #include #include #include -static int vbnv_initialized CAR_GLOBAL; -static uint8_t vbnv[VBOOT_VBNV_BLOCK_SIZE] CAR_GLOBAL; - -/* Wrappers for accessing the variables marked as CAR_GLOBAL. */ -static inline int is_vbnv_initialized(void) -{ - return car_get_var(vbnv_initialized); -} - -static inline uint8_t *vbnv_data_addr(int index) -{ - uint8_t *vbnv_arr = car_get_var_ptr(vbnv); - - return &vbnv_arr[index]; -} - -static inline uint8_t vbnv_data(int index) -{ - return *vbnv_data_addr(index); -} +static int vbnv_initialized; +static uint8_t vbnv[VBOOT_VBNV_BLOCK_SIZE]; /* Return CRC-8 of the data, using x^8 + x^2 + x + 1 polynomial. */ static uint8_t crc8_vbnv(const uint8_t *data, int len) @@ -66,9 +47,9 @@ void vbnv_reset(uint8_t *vbnv_copy) /* Read VBNV data into cache. */ static void vbnv_setup(void) { - if (!is_vbnv_initialized()) { - read_vbnv(vbnv_data_addr(0)); - car_set_var(vbnv_initialized, 1); + if (!vbnv_initialized) { + read_vbnv(vbnv); + vbnv_initialized = 1; } } @@ -117,7 +98,7 @@ void save_vbnv(const uint8_t *vbnv_copy) save_vbnv_flash(vbnv_copy); /* Clear initialized flag to force cached data to be updated */ - car_set_var(vbnv_initialized, 0); + vbnv_initialized = 0; } /* Save a recovery reason into VBNV. */ @@ -137,14 +118,14 @@ void set_recovery_mode_into_vbnv(int recovery_reason) int get_recovery_mode_from_vbnv(void) { vbnv_setup(); - return vbnv_data(RECOVERY_OFFSET); + return vbnv[RECOVERY_OFFSET]; } /* Read the USB Device Controller(UDC) enable flag from VBNV. */ int vbnv_udc_enable_flag(void) { vbnv_setup(); - return (vbnv_data(DEV_FLAGS_OFFSET) & DEV_ENABLE_UDC) ? 1 : 0; + return (vbnv[DEV_FLAGS_OFFSET] & DEV_ENABLE_UDC) ? 1 : 0; } void vbnv_init(uint8_t *vbnv_copy) -- cgit v1.2.3