blob: b441300e414f245b5ab542ec88cab313c75ed055 [file] [log] [blame]
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +00001/*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * FWU metadata information as per the specification section 4.1:
Sughosh Ganuf01e1e72024-02-01 12:25:09 +05307 * https://developer.arm.com/documentation/den0118/latest/
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +00008 *
9 */
10
11#ifndef FWU_METADATA_H
12#define FWU_METADATA_H
13
14#include <stdint.h>
15#include <tools_share/uuid.h>
16
Sughosh Ganu9a480a32024-02-01 12:47:13 +053017#define NR_OF_MAX_FW_BANKS 4
18
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +000019/* Properties of image in a bank */
Sughosh Ganu52794a32024-02-02 15:35:18 +053020struct fwu_image_bank_info {
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +000021
Sughosh Ganu52794a32024-02-02 15:35:18 +053022 /* GUID of the image in this bank */
23 struct efi_guid img_guid;
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +000024
25 /* [0]: bit describing the image acceptance status –
26 * 1 means the image is accepted
27 * [31:1]: MBZ
28 */
29 uint32_t accepted;
30
31 /* reserved (MBZ) */
32 uint32_t reserved;
33
34} __packed;
35
36/* Image entry information */
37struct fwu_image_entry {
38
Sughosh Ganu52794a32024-02-02 15:35:18 +053039 /* GUID identifying the image type */
40 struct efi_guid img_type_guid;
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +000041
Sughosh Ganu52794a32024-02-02 15:35:18 +053042 /* GUID of the storage volume where the image is located */
43 struct efi_guid location_guid;
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +000044
Sughosh Ganu52794a32024-02-02 15:35:18 +053045 /* Properties of images with img_type_guid in the different FW banks */
46 struct fwu_image_bank_info img_bank_info[NR_OF_FW_BANKS];
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +000047
48} __packed;
49
Sughosh Ganu9a480a32024-02-01 12:47:13 +053050/* Firmware Image descriptor */
51struct fwu_fw_store_descriptor {
52
53 /* Number of Banks */
54 uint8_t num_banks;
55
56 /* Reserved */
57 uint8_t reserved;
58
59 /* Number of images per bank */
60 uint16_t num_images;
61
62 /* Size of image_entry(all banks) in bytes */
63 uint16_t img_entry_size;
64
65 /* Size of image bank info structure in bytes */
66 uint16_t bank_info_entry_size;
67
68 /* Array of fwu_image_entry structs */
69 struct fwu_image_entry img_entry[NR_OF_IMAGES_IN_FW_BANK];
70
71} __packed;
72
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +000073/*
74 * FWU metadata filled by the updater and consumed by TF-A for
75 * various purposes as below:
76 * 1. Get active FW bank.
77 * 2. Rollback to previous working FW bank.
78 * 3. Get properties of all images present in all banks.
79 */
80struct fwu_metadata {
81
82 /* Metadata CRC value */
83 uint32_t crc_32;
84
85 /* Metadata version */
86 uint32_t version;
87
88 /* Bank index with which device boots */
89 uint32_t active_index;
90
91 /* Previous bank index with which device booted successfully */
92 uint32_t previous_active_index;
93
Sughosh Ganu9a480a32024-02-01 12:47:13 +053094 /* Size of the entire metadata in bytes */
95 uint32_t metadata_size;
96
97 /* Offset of the image descriptor structure */
98 uint16_t desc_offset;
99
100 /* Reserved */
101 uint16_t reserved1;
102
103 /* Bank state */
104 uint8_t bank_state[NR_OF_MAX_FW_BANKS];
105
106 /* Reserved */
107 uint32_t reserved2;
108
109#if PSA_FWU_METADATA_FW_STORE_DESC
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +0000110 /* Image entry information */
Sughosh Ganu9a480a32024-02-01 12:47:13 +0530111 struct fwu_fw_store_descriptor fw_desc;
112#endif
Manish V Badarkhe2bb45ff2021-03-16 10:01:27 +0000113
114} __packed;
115
116#endif /* FWU_METADATA_H */