Julian Hall | 536afb1 | 2022-10-12 11:25:55 +0100 | [diff] [blame] | 1 | /* |
| 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> |
| 15 | #include <protocols/common/osf/uuid.h> |
| 16 | #include "metadata.h" |
| 17 | |
| 18 | /** |
| 19 | * FWU metadata version corresponding to these structure definitions. |
| 20 | */ |
| 21 | #define FWU_METADATA_VERSION (1) |
| 22 | |
| 23 | /** |
| 24 | * The number of image entries in the metadata structure. |
| 25 | */ |
| 26 | #ifndef FWU_METADATA_NUM_IMAGE_ENTRIES |
| 27 | #define FWU_METADATA_NUM_IMAGE_ENTRIES (1) |
| 28 | #endif |
| 29 | |
| 30 | /* Properties of image in a bank */ |
| 31 | struct __attribute__ ((__packed__)) fwu_image_properties { |
| 32 | |
| 33 | /* 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; |
| 44 | |
| 45 | }; |
| 46 | |
| 47 | /* Image entry information */ |
| 48 | struct __attribute__ ((__packed__)) fwu_image_entry { |
| 49 | |
| 50 | /* UUID identifying the image type */ |
| 51 | uint8_t img_type_uuid[OSF_UUID_OCTET_LEN]; |
| 52 | |
| 53 | /* UUID of the storage volume where the image is located */ |
| 54 | uint8_t location_uuid[OSF_UUID_OCTET_LEN]; |
| 55 | |
| 56 | /* Properties of images with img_type_uuid in the different FW banks */ |
| 57 | struct fwu_image_properties img_props[FWU_METADATA_NUM_BANKS]; |
| 58 | |
| 59 | }; |
| 60 | |
| 61 | /* |
| 62 | * FWU metadata filled by the updater and consumed by TF-A for |
| 63 | * various purposes as below: |
| 64 | * 1. Get active FW bank. |
| 65 | * 2. Rollback to previous working FW bank. |
| 66 | * 3. Get properties of all images present in all banks. |
| 67 | */ |
| 68 | struct __attribute__ ((__packed__)) fwu_metadata { |
| 69 | |
| 70 | /* Metadata CRC value */ |
| 71 | uint32_t crc_32; |
| 72 | |
| 73 | /* Metadata version */ |
| 74 | uint32_t version; |
| 75 | |
| 76 | /* Bank index with which device boots */ |
| 77 | uint32_t active_index; |
| 78 | |
| 79 | /* Previous bank index with which device booted successfully */ |
| 80 | uint32_t previous_active_index; |
| 81 | |
| 82 | /* Image entry information */ |
| 83 | struct fwu_image_entry img_entry[FWU_METADATA_NUM_IMAGE_ENTRIES]; |
| 84 | |
| 85 | }; |
| 86 | |
| 87 | #endif /* FWU_PROTO_METADATA_V1_H */ |