blob: cb264dacc9f0d0698c14f250863775412008b2d4 [file] [log] [blame]
Julian Hall536afb12022-10-12 11:25:55 +01001/*
2 * Copyright (c) 2022-2023, 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_PROTO_METADATA_V1_H
12#define FWU_PROTO_METADATA_V1_H
13
14#include <stdint.h>
Gyorgy Szing3c446242023-03-31 01:53:15 +020015
Julian Hall536afb12022-10-12 11:25:55 +010016#include "metadata.h"
Gyorgy Szing3c446242023-03-31 01:53:15 +020017#include "protocols/common/osf/uuid.h"
Julian Hall536afb12022-10-12 11:25:55 +010018
19/**
20 * FWU metadata version corresponding to these structure definitions.
21 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020022#define FWU_METADATA_VERSION (1)
Julian Hall536afb12022-10-12 11:25:55 +010023
24/**
25 * The number of image entries in the metadata structure.
26 */
27#ifndef FWU_METADATA_NUM_IMAGE_ENTRIES
Gyorgy Szing3c446242023-03-31 01:53:15 +020028#define FWU_METADATA_NUM_IMAGE_ENTRIES (1)
Julian Hall536afb12022-10-12 11:25:55 +010029#endif
30
31/* Properties of image in a bank */
Gyorgy Szing3c446242023-03-31 01:53:15 +020032struct __attribute__((__packed__)) fwu_image_properties {
Julian Hall536afb12022-10-12 11:25:55 +010033 /* UUID of the image in this bank */
34 uint8_t img_uuid[OSF_UUID_OCTET_LEN];
35
36 /* [0]: bit describing the image acceptance status –
37 * 1 means the image is accepted
38 * [31:1]: MBZ
39 */
40 uint32_t accepted;
41
42 /* reserved (MBZ) */
43 uint32_t reserved;
Julian Hall536afb12022-10-12 11:25:55 +010044};
45
46/* Image entry information */
Gyorgy Szing3c446242023-03-31 01:53:15 +020047struct __attribute__((__packed__)) fwu_image_entry {
Julian Hall536afb12022-10-12 11:25:55 +010048 /* UUID identifying the image type */
49 uint8_t img_type_uuid[OSF_UUID_OCTET_LEN];
50
51 /* UUID of the storage volume where the image is located */
52 uint8_t location_uuid[OSF_UUID_OCTET_LEN];
53
54 /* Properties of images with img_type_uuid in the different FW banks */
55 struct fwu_image_properties img_props[FWU_METADATA_NUM_BANKS];
Julian Hall536afb12022-10-12 11:25:55 +010056};
57
58/*
59 * FWU metadata filled by the updater and consumed by TF-A for
60 * various purposes as below:
61 * 1. Get active FW bank.
62 * 2. Rollback to previous working FW bank.
63 * 3. Get properties of all images present in all banks.
64 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020065struct __attribute__((__packed__)) fwu_metadata {
Julian Hall536afb12022-10-12 11:25:55 +010066 /* Metadata CRC value */
67 uint32_t crc_32;
68
69 /* Metadata version */
70 uint32_t version;
71
72 /* Bank index with which device boots */
73 uint32_t active_index;
74
75 /* Previous bank index with which device booted successfully */
76 uint32_t previous_active_index;
77
78 /* Image entry information */
79 struct fwu_image_entry img_entry[FWU_METADATA_NUM_IMAGE_ENTRIES];
Julian Hall536afb12022-10-12 11:25:55 +010080};
81
82#endif /* FWU_PROTO_METADATA_V1_H */