blob: 30a7b1c2ccc3fcace870f759eb798d8b3f6dc542 [file] [log] [blame]
Tamas Bana9de4a62018-09-18 08:09:45 +01001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __TFM_BOOT_STATUS_H__
9#define __TFM_BOOT_STATUS_H__
10
11#include <stdint.h>
12#include <stddef.h>
13
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/* Major numbers to identify the consumer of shared data in runtime SW */
20#define TLV_MAJOR_CORE 0x0
21#define TLV_MAJOR_IAS 0x1
22
23/* PSA Root of Trust */
24#define TLV_MINOR_IAS_PRoT_SHA256 0x00
25#define TLV_MINOR_IAS_PRoT_SW_VERSION 0x01
26#define TLV_MINOR_IAS_PRoT_EPOCH 0x02
27
28/* Application Root of Trust */
29#define TLV_MINOR_IAS_ARoT_SHA256 0x03
30#define TLV_MINOR_IAS_ARoT_SW_VERSION 0x04
31#define TLV_MINOR_IAS_ARoT_EPOCH 0x05
32
33/* Non-secure processing environment: single non-secure image */
34#define TLV_MINOR_IAS_NSPE_SHA256 0x06
35#define TLV_MINOR_IAS_NSPE_SW_VERSION 0x07
36#define TLV_MINOR_IAS_NSPE_EPOCH 0x08
37
38/* ARoT + PRoT: single secure image */
39#define TLV_MINOR_IAS_S_SHA256 0x09
40#define TLV_MINOR_IAS_S_SW_VERSION 0x0a
41#define TLV_MINOR_IAS_S_EPOCH 0x0b
42
43/* S + NS: combined secure and non-secure image */
44#define TLV_MINOR_IAS_S_NS_SHA256 0x0c
45#define TLV_MINOR_IAS_S_NS_SW_VERSION 0x0d
46#define TLV_MINOR_IAS_S_NS_EPOCH 0x0e
47
48#define SHARED_DATA_TLV_INFO_MAGIC 0x2016
49
50/**
51 * Shared data TLV header. All fields in little endian.
52 *
53 * ---------------------------
54 * | tlv_magic | tlv_tot_len |
55 * ---------------------------
56 */
57struct shared_data_tlv_header {
58 uint16_t tlv_magic;
59 uint16_t tlv_tot_len; /* size of whole TLV area (including this header) */
60};
61
62#define SHARED_DATA_HEADER_SIZE sizeof(struct shared_data_tlv_header)
63
64/**
65 * Shared data TLV entry header format. All fields in little endian.
66 *
67 * ---------------------------------------------
68 * | tlv_major_type | tlv_minor_type | tlv_len |
69 * ---------------------------------------------
70 * | Raw data |
71 * ---------------------------------------------
72 */
73struct shared_data_tlv_entry {
74 uint8_t tlv_major_type;
75 uint8_t tlv_minor_type;
76 uint16_t tlv_len; /* size of single TLV entry (including this header). */
77};
78
79#define SHARED_DATA_ENTRY_HEADER_SIZE sizeof(struct shared_data_tlv_entry)
80#define SHARED_DATA_ENTRY_SIZE(size) (size + SHARED_DATA_ENTRY_HEADER_SIZE)
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif /* __TFM_BOOT_STATUS_H__ */