2nvstorage_fields.h 3.0 KB

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