1 /*
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:
7  * https://developer.arm.com/documentation/den0118/a/
8  *
9  */
10 
11 #ifndef FWU_METADATA_H
12 #define FWU_METADATA_H
13 
14 #include <stdint.h>
15 #include <tools_share/uuid.h>
16 
17 /* Properties of image in a bank */
18 struct fwu_image_properties {
19 
20 	/* UUID of the image in this bank */
21 	uuid_t img_uuid;
22 
23 	/* [0]: bit describing the image acceptance status –
24 	 *      1 means the image is accepted
25 	 * [31:1]: MBZ
26 	 */
27 	uint32_t accepted;
28 
29 	/* reserved (MBZ) */
30 	uint32_t reserved;
31 
32 } __packed;
33 
34 /* Image entry information */
35 struct fwu_image_entry {
36 
37 	/* UUID identifying the image type */
38 	uuid_t img_type_uuid;
39 
40 	/* UUID of the storage volume where the image is located */
41 	uuid_t location_uuid;
42 
43 	/* Properties of images with img_type_uuid in the different FW banks */
44 	struct fwu_image_properties img_props[NR_OF_FW_BANKS];
45 
46 } __packed;
47 
48 /*
49  * FWU metadata filled by the updater and consumed by TF-A for
50  * various purposes as below:
51  * 1. Get active FW bank.
52  * 2. Rollback to previous working FW bank.
53  * 3. Get properties of all images present in all banks.
54  */
55 struct fwu_metadata {
56 
57 	/* Metadata CRC value */
58 	uint32_t crc_32;
59 
60 	/* Metadata version */
61 	uint32_t version;
62 
63 	/* Bank index with which device boots */
64 	uint32_t active_index;
65 
66 	/* Previous bank index with which device booted successfully */
67 	uint32_t previous_active_index;
68 
69 	/* Image entry information */
70 	struct fwu_image_entry img_entry[NR_OF_IMAGES_IN_FW_BANK];
71 
72 } __packed;
73 
74 #endif /* FWU_METADATA_H */
75