1 /* 2 * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _CC_OTP_DEFS_H 8 #define _CC_OTP_DEFS_H 9 10 /*! 11 @file 12 @brief This file contains general OTP definitions and memory layout. 13 */ 14 15 16 #ifdef __cplusplus 17 extern "C" 18 { 19 #endif 20 21 22 /* NVM definitions */ 23 #define CC_OTP_BASE_ADDR 0x2000UL 24 #define CC_OTP_START_OFFSET 0x00UL 25 #define CC_OTP_LAST_OFFSET 0x7FFUL 26 27 /* [0x00-0x07] Device root key (HUK) */ 28 #define CC_OTP_HUK_OFFSET 0x00UL 29 #define CC_OTP_HUK_SIZE_IN_WORDS 8 30 31 /* [0x08-0x0B] ICV provisioning secret (KPICV) */ 32 #define CC_OTP_KPICV_OFFSET 0x08UL 33 #define CC_OTP_KPICV_SIZE_IN_WORDS 4 34 35 /* [0x0C-0x0F] ICV Code encryption key (KCEICV) */ 36 #define CC_OTP_KCEICV_OFFSET 0x0CUL 37 #define CC_OTP_KCEICV_SIZE_IN_WORDS 4 38 39 /* [0x10] Manufacturer-programmed flags */ 40 #define CC_OTP_MANUFACTURE_FLAG_OFFSET 0x10UL 41 42 /* [0x11-0x18] Root-of-Trust Public Key. 43 * May be used in one of the following configurations: 44 * - A single 256-bit SHA256 digest of the Secure Boot public key (HBK). : 45 * - Two 128-bit truncated SHA256 digests of Secure Boot public keys 0 and 1 (HBK0, HBK1) */ 46 #define CC_OTP_HBK_OFFSET 0x11UL 47 #define CC_OTP_HBK_SIZE_IN_WORDS 8 48 #define CC_OTP_HBK0_OFFSET 0x11UL 49 #define CC_OTP_HBK0_SIZE_IN_WORDS 4 50 #define CC_OTP_HBK1_OFFSET 0x15UL 51 #define CC_OTP_HBK1_SIZE_IN_WORDS 4 52 53 /* [0x19-0x1C] OEM provisioning secret (Kcp) */ 54 #define CC_OTP_KCP_OFFSET 0x19UL 55 #define CC_OTP_KCP_SIZE_IN_WORDS 4 56 57 /* OEM Code encryption key (KCE) */ 58 #define CC_OTP_KCE_OFFSET 0x1DUL 59 #define CC_OTP_KCE_SIZE_IN_WORDS 4 60 61 /* OEM-programmed flags */ 62 #define CC_OTP_OEM_FLAG_OFFSET 0x21UL 63 64 /* HBK Trusted Firmware minimum version (anti-rollback counter) */ 65 #define CC_OTP_HBK_MIN_VERSION_OFFSET 0x22UL 66 #define CC_OTP_HBK_MIN_VERSION_SIZE_IN_WORDS 5 67 68 /* HBK0 Trusted Firmware minimum version (anti-rollback counter) */ 69 #define CC_OTP_HBK0_MIN_VERSION_OFFSET 0x22UL 70 #define CC_OTP_HBK0_MIN_VERSION_SIZE_IN_WORDS 2 71 72 /* HBK1 Trusted Firmware minimum version (anti-rollback counter) */ 73 #define CC_OTP_HBK1_MIN_VERSION_OFFSET 0x24UL 74 #define CC_OTP_HBK1_MIN_VERSION_SIZE_IN_WORDS 3 75 76 /* General purpose configuration flags */ 77 #define CC_OTP_ICV_GENERAL_PURPOSE_FLAG_OFFSET 0x27UL 78 #define CC_OTP_ICV_GENERAL_PURPOSE_FLAG_SIZE_IN_WORDS 1 79 80 /* OTP DCU lock mask */ 81 #define CC_OTP_DCU_OFFSET 0x28UL 82 #define CC_OTP_DCU_SIZE_IN_WORDS 4 83 84 /* First stage secure boot loader code and data sections (optional) */ 85 #define CC_OTP_SB_LOADER_CODE_OFFSET 0x2CUL 86 87 88 /* Manufacturer-programmed flags */ 89 90 /* [7:0] Number of "0" bits in HUK */ 91 #define CC_OTP_MANUFACTURE_FLAG_HUK_ZERO_BITS_BIT_SHIFT 0 92 #define CC_OTP_MANUFACTURE_FLAG_HUK_ZERO_BITS_BIT_SIZE 8 93 94 /* [14:8] Number of "0" bits in KPICV (128 bit) */ 95 #define CC_OTP_MANUFACTURE_FLAG_KPICV_ZERO_BITS_BIT_SHIFT 8 96 #define CC_OTP_MANUFACTURE_FLAG_KPICV_ZERO_BITS_BIT_SIZE 7 97 98 /* [15:15] KPICV "Not In Use" bit */ 99 #define CC_OTP_MANUFACTURE_FLAG_KPICV_NOT_IN_USE_BIT_SHIFT 15 100 #define CC_OTP_MANUFACTURE_FLAG_KPICV_NOT_IN_USE_BIT_SIZE 1 101 102 /* [22:16] Number of "0" bits in KCEICV */ 103 #define CC_OTP_MANUFACTURE_FLAG_KCEICV_ZERO_BITS_BIT_SHIFT 16 104 #define CC_OTP_MANUFACTURE_FLAG_KCEICV_ZERO_BITS_BIT_SIZE 7 105 106 /* [23:23] KCEICV "Not In Use" bit */ 107 #define CC_OTP_MANUFACTURE_FLAG_KCEICV_NOT_IN_USE_BIT_SHIFT 23 108 #define CC_OTP_MANUFACTURE_FLAG_KCEICV_NOT_IN_USE_BIT_SIZE 1 109 110 /* [30:24] Number of "0" bits in HBK0 (in case it is used as 4 words of the ICV) */ 111 #define CC_OTP_MANUFACTURE_FLAG_HBK0_ZERO_BITS_BIT_SHIFT 24 112 #define CC_OTP_MANUFACTURE_FLAG_HBK0_ZERO_BITS_BIT_SIZE 7 113 114 /* [31:31] HBK0 "Not In Use" bit */ 115 #define CC_OTP_MANUFACTURE_FLAG_HBK0_NOT_IN_USE_BIT_SHIFT 31 116 #define CC_OTP_MANUFACTURE_FLAG_HBK0_NOT_IN_USE_BIT_SIZE 1 117 118 119 /* OEM-programmed flags */ 120 121 /* [7:0] Number of "0" bits in HBK1/HBK (128/256 bits public key) */ 122 #define CC_OTP_OEM_FLAG_HBK_ZERO_BITS_BIT_SHIFT 0 123 #define CC_OTP_OEM_FLAG_HBK_ZERO_BITS_BIT_SIZE 8 124 #define CC_OTP_OEM_FLAG_HBK1_ZERO_BITS_BIT_SHIFT 0 125 #define CC_OTP_OEM_FLAG_HBK1_ZERO_BITS_BIT_SIZE 8 126 127 /* [14:8] Number of "0" bits in KCP (128 bit) */ 128 #define CC_OTP_OEM_FLAG_KCP_ZERO_BITS_BIT_SHIFT 8 129 #define CC_OTP_OEM_FLAG_KCP_ZERO_BITS_BIT_SIZE 7 130 131 /* [15:15] KCP "Not In Use" bit */ 132 #define CC_OTP_OEM_FLAG_KCP_NOT_IN_USE_BIT_SHIFT 15 133 #define CC_OTP_OEM_FLAG_KCP_NOT_IN_USE_BIT_SIZE 1 134 135 /* [22:16] Number of "0" bits in KCE */ 136 #define CC_OTP_OEM_FLAG_KCE_ZERO_BITS_BIT_SHIFT 16 137 #define CC_OTP_OEM_FLAG_KCE_ZERO_BITS_BIT_SIZE 7 138 139 /* [23:23] KCE "Not In Use" bit */ 140 #define CC_OTP_OEM_FLAG_KCE_NOT_IN_USE_BIT_SHIFT 23 141 #define CC_OTP_OEM_FLAG_KCE_NOT_IN_USE_BIT_SIZE 1 142 143 /* [29:24] Reserved */ 144 145 /* [30:30] OEM RMA mode flag */ 146 #define CC_OTP_OEM_FLAG_OEM_RMA_MODE_BIT_SHIFT 30 147 #define CC_OTP_OEM_FLAG_OEM_RMA_MODE_BIT_SIZE 1 148 149 /* [31:31] ICV RMA mode flag */ 150 #define CC_OTP_OEM_FLAG_ICV_RMA_MODE_BIT_SHIFT 31 151 #define CC_OTP_OEM_FLAG_ICV_RMA_MODE_BIT_SIZE 1 152 153 154 #ifdef __cplusplus 155 } 156 #endif 157 158 #endif 159 160 161 162