|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 Nordic Semiconductor ASA |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
| 6 | +#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ |
| 7 | +#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ |
| 8 | + |
| 9 | +#include <stdint.h> |
| 10 | +#include <stddef.h> |
| 11 | + |
| 12 | +/** Constant used to check if an Nordic IRONside SE boot report has been written. */ |
| 13 | +#define IRONSIDE_BOOT_REPORT_MAGIC (0x4d69546fUL) |
| 14 | +/** Length of the local domain context buffer in bytes. */ |
| 15 | +#define IRONSIDE_BOOT_REPORT_LOCAL_DOMAIN_CONTEXT_SIZE (16UL) |
| 16 | +/** 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 | +}; |
| 32 | + |
| 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 */ |
| 38 | + union { |
| 39 | + /** RFU */ |
| 40 | + struct { |
| 41 | + uint32_t rfu[4]; |
| 42 | + } rfu; |
| 43 | + } description; |
| 44 | +}; |
| 45 | + |
| 46 | +/** @brief IRONside boot report. */ |
| 47 | +struct ironside_boot_report { |
| 48 | + /** Magic value used to identify valid boot report */ |
| 49 | + 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; |
| 54 | + /** Copy of SICR.UROT.UPDATE.STATUS.*/ |
| 55 | + 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]; |
| 60 | + /** CSPRNG data */ |
| 61 | + uint8_t random_data[IRONSIDE_BOOT_REPORT_RANDOM_DATA_SIZE]; |
| 62 | + /** Reserved for Future Use */ |
| 63 | + uint32_t rfu[64]; |
| 64 | +}; |
| 65 | + |
| 66 | +/** |
| 67 | + * @brief Get a pointer to the IRONside boot report. |
| 68 | + * |
| 69 | + * @param[out] report Will be set to point to the IRONside boot report. |
| 70 | + * |
| 71 | + * @retval 0 if successful. |
| 72 | + * @retval -EFAULT if the magic field in the report is incorrect. |
| 73 | + * @retval -EINVAL if @p report is NULL. |
| 74 | + */ |
| 75 | +int ironside_boot_report_get(const struct ironside_boot_report **report); |
| 76 | + |
| 77 | +#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_BOOT_REPORT_H_ */ |
0 commit comments