Simon Glass | fdacd50 | 2025-01-15 18:27:03 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Verified Boot for Embedded (VBE) common functions |
| 4 | * |
| 5 | * Copyright 2024 Google LLC |
| 6 | * Written by Simon Glass <sjg@chromium.org> |
| 7 | */ |
| 8 | |
| 9 | #ifndef __VBE_COMMON_H |
| 10 | #define __VBE_COMMON_H |
| 11 | |
| 12 | #include <linux/types.h> |
| 13 | |
| 14 | struct udevice; |
| 15 | |
| 16 | enum { |
| 17 | MAX_VERSION_LEN = 256, |
| 18 | |
| 19 | NVD_HDR_VER_SHIFT = 0, |
| 20 | NVD_HDR_VER_MASK = 0xf, |
| 21 | NVD_HDR_SIZE_SHIFT = 4, |
| 22 | NVD_HDR_SIZE_MASK = 0xf << NVD_HDR_SIZE_SHIFT, |
| 23 | |
| 24 | /* Firmware key-version is in the top 16 bits of fw_ver */ |
| 25 | FWVER_KEY_SHIFT = 16, |
| 26 | FWVER_FW_MASK = 0xffff, |
| 27 | |
| 28 | NVD_HDR_VER_CUR = 1, /* current version */ |
| 29 | }; |
| 30 | |
| 31 | /** |
| 32 | * struct vbe_nvdata - basic storage format for non-volatile data |
| 33 | * |
| 34 | * This is used for all VBE methods |
| 35 | * |
| 36 | * @crc8: crc8 for the entire record except @crc8 field itself |
| 37 | * @hdr: header size and version (NVD_HDR_...) |
| 38 | * @spare1: unused, must be 0 |
| 39 | * @fw_vernum: version and key version (FWVER_...) |
| 40 | * @flags: Flags controlling operation (enum vbe_flags) |
| 41 | */ |
| 42 | struct vbe_nvdata { |
| 43 | u8 crc8; |
| 44 | u8 hdr; |
| 45 | u16 spare1; |
| 46 | u32 fw_vernum; |
| 47 | u32 flags; |
| 48 | u8 spare2[0x34]; |
| 49 | }; |
| 50 | |
| 51 | #endif /* __VBE_ABREC_H */ |