|
10 | 10 | #include <stddef.h>
|
11 | 11 |
|
12 | 12 | /** Constant used to check if an Nordic IronSide SE boot report has been written. */
|
13 |
| -#define IRONSIDE_BOOT_REPORT_MAGIC (0x4d69546fUL) |
| 13 | +#define IRONSIDE_BOOT_REPORT_MAGIC (0x4d69546fUL) |
| 14 | + |
| 15 | +/** UICR had no errors. */ |
| 16 | +#define IRONSIDE_UICR_SUCCESS 0 |
| 17 | +/** There was an unexpected error processing the UICR. */ |
| 18 | +#define IRONSIDE_UICR_ERROR_UNEXPECTED 1 |
| 19 | +/** The UICR integrity check failed. */ |
| 20 | +#define IRONSIDE_UICR_ERROR_INTEGRITY 2 |
| 21 | +/** The UICR content check failed. */ |
| 22 | +#define IRONSIDE_UICR_ERROR_CONTENT 3 |
| 23 | +/** Failed to configure system based on UICR. */ |
| 24 | +#define IRONSIDE_UICR_ERROR_CONFIG 4 |
| 25 | +/** Unsupported UICR format version. */ |
| 26 | +#define IRONSIDE_UICR_ERROR_FORMAT 5 |
| 27 | + |
| 28 | +/** Error found in UICR.PROTECTEDMEM. */ |
| 29 | +#define IRONSIDE_UICR_REGID_PROTECTEDMEM 36 |
| 30 | +/** Error found in UICR.SECURESTORAGE. */ |
| 31 | +#define IRONSIDE_UICR_REGID_SECURESTORAGE 64 |
| 32 | +/** Error found in UICR.PERIPHCONF. */ |
| 33 | +#define IRONSIDE_UICR_REGID_PERIPHCONF 104 |
| 34 | +/** Error found in UICR.MPCCONF. */ |
| 35 | +#define IRONSIDE_UICR_REGID_MPCCONF 116 |
| 36 | +/** Error found in UICR.SECONDARY.ADDRESS/SIZE4KB */ |
| 37 | +#define IRONSIDE_UICR_REGID_SECONDARY 128 |
| 38 | +/** Error found in UICR.SECONDARY.PROTECTEDMEM. */ |
| 39 | +#define IRONSIDE_UICR_REGID_SECONDARY_PROTECTEDMEM 152 |
| 40 | +/** Error found in UICR.SECONDARY.PERIPHCONF. */ |
| 41 | +#define IRONSIDE_UICR_REGID_SECONDARY_PERIPHCONF 172 |
| 42 | +/** Error found in UICR.SECONDARY.MPCCONF. */ |
| 43 | +#define IRONSIDE_UICR_REGID_SECONDARY_MPCCONF 184 |
| 44 | + |
| 45 | +/** Failed to mount a CRYPTO secure storage partition in MRAM. */ |
| 46 | +#define IRONSIDE_UICR_SECURESTORAGE_ERROR_MOUNT_CRYPTO_FAILED 1 |
| 47 | +/** Failed to mount an ITS secure storage partition in MRAM. */ |
| 48 | +#define IRONSIDE_UICR_SECURESTORAGE_ERROR_MOUNT_ITS_FAILED 2 |
| 49 | +/** The start address and total size of all ITS partitions are not aligned to 4 KB. */ |
| 50 | +#define IRONSIDE_UICR_SECURESTORAGE_ERROR_MISALIGNED 3 |
| 51 | + |
| 52 | +/** There was an unexpected error processing UICR.PERIPHCONF. */ |
| 53 | +#define IRONSIDE_UICR_PERIPHCONF_ERROR_UNEXPECTED 1 |
| 54 | +/** The address contained in a UICR.PERIPHCONF array entry is not permitted. */ |
| 55 | +#define IRONSIDE_UICR_PERIPHCONF_ERROR_NOT_PERMITTED 2 |
| 56 | +/** The readback of the value for a UICR.PERIPHCONF array entry did not match. */ |
| 57 | +#define IRONSIDE_UICR_PERIPHCONF_ERROR_READBACK_MISMATCH 3 |
| 58 | + |
| 59 | +/** Booted in secondary mode. */ |
| 60 | +#define IRONSIDE_BOOT_MODE_FLAGS_SECONDARY_MASK 0x1 |
| 61 | + |
| 62 | +/** Booted normally by IronSide SE.*/ |
| 63 | +#define IRONSIDE_BOOT_REASON_DEFAULT 0 |
| 64 | +/** Booted because of a cpuconf service call by a different core. */ |
| 65 | +#define IRONSIDE_BOOT_REASON_CPUCONF_CALL 1 |
| 66 | +/** Booted in secondary mode because of a bootmode service call. */ |
| 67 | +#define IRONSIDE_BOOT_REASON_BOOTMODE_SECONDARY_CALL 2 |
| 68 | +/** Booted in secondary mode because of a boot error in the primary mode. */ |
| 69 | +#define IRONSIDE_BOOT_REASON_BOOTERROR 3 |
| 70 | +/** Booted in secondary mode because of local domain reset reason trigger. */ |
| 71 | +#define IRONSIDE_BOOT_REASON_TRIGGER_RESETREAS 4 |
| 72 | +/** Booted in secondary mode via the CTRL-AP. */ |
| 73 | +#define IRONSIDE_BOOT_REASON_CTRLAP_SECONDARYMODE 5 |
| 74 | + |
| 75 | +/** The boot had no errors. */ |
| 76 | +#define IRONSIDE_BOOT_ERROR_SUCCESS 0x0 |
| 77 | +/** The reset vector for the application firmware was not programmed. */ |
| 78 | +#define IRONSIDE_BOOT_ERROR_NO_APPLICATION_FIRMWARE 0x1 |
| 79 | +/** The IronSide SE was unable to parse the SysCtrl ROM report. */ |
| 80 | +#define IRONSIDE_BOOT_ERROR_ROM_REPORT_INVALID 0x2 |
| 81 | +/** The SysCtrl ROM booted the system in current limited mode due to an issue in the BICR. */ |
| 82 | +#define IRONSIDE_BOOT_ERROR_ROM_REPORT_CURRENT_LIMITED 0x3 |
| 83 | +/** The IronSide SE detected an issue with the HFXO configuration in the BICR. */ |
| 84 | +#define IRONSIDE_BOOT_ERROR_BICR_HFXO_INVALID 0x4 |
| 85 | +/** The IronSide SE detected an issue with the LFXO configuration in the BICR. */ |
| 86 | +#define IRONSIDE_BOOT_ERROR_BICR_LFXO_INVALID 0x5 |
| 87 | +/** The IronSide SE failed to boot the SysCtrl Firmware. */ |
| 88 | +#define IRONSIDE_BOOT_ERROR_SYSCTRL_START_FAILED 0x6 |
| 89 | +/** The UICR integrity check failed. */ |
| 90 | +#define IRONSIDE_BOOT_ERROR_UICR_INTEGRITY_FAILED 0x7 |
| 91 | +/** The UICR content is not valid */ |
| 92 | +#define IRONSIDE_BOOT_ERROR_UICR_CONTENT_INVALID 0x8 |
| 93 | +/** Integrity check of PROTECTEDMEM failed. */ |
| 94 | +#define IRONSIDE_BOOT_ERROR_UICR_PROTECTEDMEM_INTEGRITY_FAILED 0x9 |
| 95 | +/** Failed to configure system based on UICR. */ |
| 96 | +#define IRONSIDE_BOOT_ERROR_UICR_CONFIG_FAILED 0xA |
| 97 | +/** The IronSide SE failed to mount its own storage. */ |
| 98 | +#define IRONSIDE_BOOT_ERROR_SECDOM_STORAGE_MOUNT_FAILED 0xB |
| 99 | +/** Failed to initialize DVFS service */ |
| 100 | +#define IRONSIDE_BOOT_ERROR_DVFS_INIT_FAILED 0xC |
| 101 | +/** Failed to boot secondary application firmware; configuration missing from UICR. */ |
| 102 | +#define IRONSIDE_BOOT_ERROR_NO_SECONDARY_APPLICATION_FIRMWARE 0xD |
| 103 | +/** Integrity check of secondary PROTECTEDMEM failed. */ |
| 104 | +#define IRONSIDE_BOOT_ERROR_UICR_SECONDARY_PROTECTEDMEM_INTEGRITY_FAILED 0xE |
| 105 | +/** Unsupported UICR format version. */ |
| 106 | +#define IRONSIDE_BOOT_ERROR_UICR_FORMAT_UNSUPPORTED 0xF |
| 107 | +/** Value reserved for conditions that should never happen. */ |
| 108 | +#define IRONSIDE_BOOT_ERROR_UNEXPECTED 0xff |
| 109 | + |
| 110 | +/** Index for RESETREAS.DOMAIN[NRF_DOMAIN_APPLICATION]. */ |
| 111 | +#define IRONSIDE_SECONDARY_RESETREAS_APPLICATION 0 |
| 112 | +/** Index for RESETREAS.DOMAIN[NRF_DOMAIN_RADIOCORE]. */ |
| 113 | +#define IRONSIDE_SECONDARY_RESETREAS_RADIOCORE 1 |
| 114 | + |
14 | 115 | /** Length of the local domain context buffer in bytes. */
|
15 | 116 | #define IRONSIDE_BOOT_REPORT_LOCAL_DOMAIN_CONTEXT_SIZE (16UL)
|
16 | 117 | /** Length of the random data buffer in bytes. */
|
17 |
| -#define IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE (32UL) |
18 |
| - |
19 |
| -/** @brief IronSide version structure. */ |
20 |
| -struct ironside_version { |
21 |
| - /** Wrapping sequence number ranging from 1-126, incremented for each release. */ |
22 |
| - uint8_t seqnum; |
23 |
| - /** Path version. */ |
24 |
| - uint8_t patch; |
25 |
| - /** Minor version. */ |
26 |
| - uint8_t minor; |
27 |
| - /** Major version. */ |
28 |
| - uint8_t major; |
29 |
| - /** Human readable extraversion string. */ |
30 |
| - char extraversion[12]; |
31 |
| -}; |
| 118 | +#define IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE (32UL) |
32 | 119 |
|
33 |
| -/** @brief UICR error description contained in the boot report. */ |
34 |
| -struct ironside_boot_report_uicr_error { |
35 |
| - /** The type of error. A value of 0 indicates no error */ |
36 |
| - uint32_t error_type; |
37 |
| - /** Error descriptions specific to each type of UICR error */ |
| 120 | +/** @brief Initialization/boot status description contained in the boot report. */ |
| 121 | +struct ironside_boot_report_init_status { |
| 122 | + /** Reserved for Future Use. */ |
| 123 | + uint8_t rfu1[3]; |
| 124 | + /** Boot error for the current boot (same as reported in BOOTSTATUS)*/ |
| 125 | + uint8_t boot_error; |
| 126 | + /** Overall UICR status. */ |
| 127 | + uint8_t uicr_status; |
| 128 | + /** Reserved for Future Use. */ |
| 129 | + uint8_t rfu2; |
| 130 | + /** ID of the register that caused the error. |
| 131 | + * Only relevant for IRONSIDE_UICR_ERROR_CONTENT and IRONSIDE_UICR_ERROR_CONFIG. |
| 132 | + */ |
| 133 | + uint16_t uicr_regid; |
| 134 | + /** Additional description for IRONSIDE_UICR_ERROR_CONFIG. */ |
38 | 135 | union {
|
39 |
| - /** RFU */ |
| 136 | + /** UICR.SECURESTORAGE error description. */ |
40 | 137 | struct {
|
41 |
| - uint32_t rfu[4]; |
42 |
| - } rfu; |
43 |
| - } description; |
| 138 | + /** Reason that UICR.SECURESTORAGE configuration failed. */ |
| 139 | + uint16_t status; |
| 140 | + /** Owner ID of the failing secure storage partition. |
| 141 | + * Only relevant for IRONSIDE_UICR_SECURESTORAGE_ERROR_MOUNT_CRYPTO_FAILED |
| 142 | + * and IRONSIDE_UICR_SECURESTORAGE_ERROR_MOUNT_ITS_FAILED. |
| 143 | + */ |
| 144 | + uint16_t owner_id; |
| 145 | + } securestorage; |
| 146 | + /** UICR.PERIPHCONF error description. */ |
| 147 | + struct { |
| 148 | + /** Reason that UICR.PERIPHCONF configuration failed. */ |
| 149 | + uint16_t status; |
| 150 | + /** Index of the failing entry in the UICR.PERIPHCONF array. */ |
| 151 | + uint16_t index; |
| 152 | + } periphconf; |
| 153 | + } uicr_detail; |
| 154 | +}; |
| 155 | + |
| 156 | +/** @brief Initialization/boot context description contained in the boot report. */ |
| 157 | +struct ironside_boot_report_init_context { |
| 158 | + /** Reserved for Future Use */ |
| 159 | + uint8_t rfu[3]; |
| 160 | + /** Reason the processor was started. */ |
| 161 | + uint8_t boot_reason; |
| 162 | + |
| 163 | + union { |
| 164 | + /** Data passed from booting local domain to local domain being booted. |
| 165 | + * |
| 166 | + * Valid if the boot reason is one of the following: |
| 167 | + * - IRONSIDE_BOOT_REASON_CPUCONF_CALL |
| 168 | + * - IRONSIDE_BOOT_REASON_BOOTMODE_SECONDARY_CALL |
| 169 | + */ |
| 170 | + uint8_t local_domain_context[IRONSIDE_BOOT_REPORT_LOCAL_DOMAIN_CONTEXT_SIZE]; |
| 171 | + |
| 172 | + /** Initialiation error that triggered the boot. |
| 173 | + * |
| 174 | + * Valid if the boot reason is IRONSIDE_BOOT_REASON_BOOTERROR. |
| 175 | + */ |
| 176 | + struct ironside_boot_report_init_status trigger_init_status; |
| 177 | + |
| 178 | + /** RESETREAS.DOMAIN that triggered the boot. |
| 179 | + * |
| 180 | + * Valid if the boot reason is IRONSIDE_BOOT_REASON_TRIGGER_RESETREAS. |
| 181 | + */ |
| 182 | + uint32_t trigger_resetreas[4]; |
| 183 | + }; |
44 | 184 | };
|
45 | 185 |
|
46 | 186 | /** @brief IronSide boot report. */
|
47 | 187 | struct ironside_boot_report {
|
48 | 188 | /** Magic value used to identify valid boot report */
|
49 | 189 | uint32_t magic;
|
50 |
| - /** Firmware version of IronSide SE. */ |
51 |
| - struct ironside_version ironside_se_version; |
52 |
| - /** Firmware version of IronSide SE recovery firmware. */ |
53 |
| - struct ironside_version ironside_se_recovery_version; |
| 190 | + /** Firmware version of IronSide SE. 8bit MAJOR.MINOR.PATCH.SEQNUM */ |
| 191 | + uint32_t ironside_se_version_int; |
| 192 | + /** Human readable extraversion of IronSide SE */ |
| 193 | + char ironside_se_extraversion[12]; |
| 194 | + /** Firmware version of IronSide SE recovery firmware. 8bit MAJOR.MINOR.PATCH.SEQNUM */ |
| 195 | + uint32_t ironside_se_recovery_version_int; |
| 196 | + /** Human readable extraversion of IronSide SE recovery firmware */ |
| 197 | + char ironside_se_recovery_extraversion[12]; |
54 | 198 | /** Copy of SICR.UROT.UPDATE.STATUS.*/
|
55 | 199 | uint32_t ironside_update_status;
|
56 |
| - /** See @ref ironside_boot_report_uicr_error */ |
57 |
| - struct ironside_boot_report_uicr_error uicr_error_description; |
58 |
| - /** Data passed from booting local domain to local domain being booted */ |
59 |
| - uint8_t local_domain_context[IRONSIDE_BOOT_REPORT_LOCAL_DOMAIN_CONTEXT_SIZE]; |
| 200 | + /** Initialization/boot status. */ |
| 201 | + struct ironside_boot_report_init_status init_status; |
| 202 | + /** Reserved for Future Use */ |
| 203 | + uint16_t rfu1; |
| 204 | + /** Flags describing the current boot mode. */ |
| 205 | + uint16_t boot_mode_flags; |
| 206 | + /** Data describing the context under which the CPU was booted. */ |
| 207 | + struct ironside_boot_report_init_context init_context; |
60 | 208 | /** CSPRNG data */
|
61 | 209 | uint8_t random_data[IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE];
|
62 | 210 | /** Reserved for Future Use */
|
63 |
| - uint32_t rfu[64]; |
| 211 | + uint32_t rfu2[64]; |
64 | 212 | };
|
65 | 213 |
|
66 | 214 | /**
|
|
0 commit comments