Home | History | Annotate | Download | only in include
      1 /* Copyright 2015 The Chromium OS Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file.
      4  *
      5  * Non-volatile storage bitfields
      6  */
      7 
      8 #ifndef VBOOT_REFERENCE_VBOOT_2NVSTORAGE_FIELDS_H_
      9 #define VBOOT_REFERENCE_VBOOT_2NVSTORAGE_FIELDS_H_
     10 
     11 /*
     12  * Constants for NV storage.  We use this rather than structs and bitfields so
     13  * the data format is consistent across platforms and compilers.  Total NV
     14  * storage size is VB2_NVDATA_SIZE = 16 bytes.
     15  *
     16  * These constants must match the equivalent constants in
     17  * lib/vboot_nvstorage.c.  (We currently don't share a common header file
     18  * because we're tring to keep the two libs independent, and we hope to
     19  * deprecate that one.)
     20  */
     21 
     22 enum vb2_nv_offset {
     23 	VB2_NV_OFFS_HEADER = 0,
     24 	VB2_NV_OFFS_BOOT = 1,
     25 	VB2_NV_OFFS_RECOVERY = 2,
     26 	VB2_NV_OFFS_LOCALIZATION = 3,
     27 	VB2_NV_OFFS_DEV = 4,
     28 	VB2_NV_OFFS_TPM = 5,
     29 	VB2_NV_OFFS_RECOVERY_SUBCODE = 6,
     30 	VB2_NV_OFFS_BOOT2 = 7,
     31 	/* Offsets 8-10 are currently unused */
     32 	VB2_NV_OFFS_KERNEL = 11, /* 11-14; field is 32 bits */
     33 	/* CRC must be last field */
     34 	VB2_NV_OFFS_CRC = 15
     35 };
     36 
     37 /* Fields in VB2_NV_OFFS_HEADER (unused = 0x0f) */
     38 #define VB2_NV_HEADER_KERNEL_SETTINGS_RESET    0x10
     39 #define VB2_NV_HEADER_FW_SETTINGS_RESET        0x20
     40 #define VB2_NV_HEADER_SIGNATURE                0x40
     41 #define VB2_NV_HEADER_MASK                     0xc0
     42 
     43 /* Fields in VB2_NV_OFFS_BOOT */
     44 #define VB2_NV_BOOT_TRY_COUNT_MASK             0x0f
     45 #define VB2_NV_BOOT_BACKUP_NVRAM               0x10
     46 #define VB2_NV_BOOT_OPROM_NEEDED               0x20
     47 #define VB2_NV_BOOT_DISABLE_DEV                0x40
     48 #define VB2_NV_BOOT_DEBUG_RESET                0x80
     49 
     50 /* Fields in VB2_NV_OFFS_BOOT2 (unused = 0x80) */
     51 #define VB2_NV_BOOT2_RESULT_MASK               0x03
     52 #define VB2_NV_BOOT2_TRIED                     0x04
     53 #define VB2_NV_BOOT2_TRY_NEXT                  0x08
     54 #define VB2_NV_BOOT2_PREV_RESULT_MASK          0x30
     55 #define VB2_NV_BOOT2_PREV_RESULT_SHIFT 4  /* Number of bits to shift result */
     56 #define VB2_NV_BOOT2_PREV_TRIED                0x40
     57 
     58 /* Fields in VB2_NV_OFFS_DEV (unused = 0xf8) */
     59 #define VB2_NV_DEV_FLAG_USB                    0x01
     60 #define VB2_NV_DEV_FLAG_SIGNED_ONLY            0x02
     61 #define VB2_NV_DEV_FLAG_LEGACY                 0x04
     62 
     63 /* Fields in VB2_NV_OFFS_TPM (unused = 0xfc) */
     64 #define VB2_NV_TPM_CLEAR_OWNER_REQUEST         0x01
     65 #define VB2_NV_TPM_CLEAR_OWNER_DONE            0x02
     66 
     67 #endif  /* VBOOT_REFERENCE_VBOOT_2NVSTORAGE_FIELDS_H_ */
     68