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