1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef FWU_MDATA_H
9 #define FWU_MDATA_H
10 
11 #include <efi.h>
12 
13 /*!
14  * \brief firmware image information
15  *
16  * \details The structure contains image specific fields which are
17  * used to identify the image and to specify the image's
18  * acceptance status
19  */
20 struct fwu_image_bank_info {
21     /*! Guid value of the image in this bank */
22     efi_guid_t  image_uuid;
23 
24     /*! Acceptance status of the image */
25     uint32_t accepted;
26 
27     /*! Reserved */
28     uint32_t reserved;
29 } __attribute__((__packed__));
30 
31 /*!
32  * \brief information for a particular type of image
33  *
34  * \details This structure contains information on various types of updatable
35  * firmware images. Each image type then contains an array of image
36  * information per bank.
37  */
38 struct fwu_image_entry {
39     /*! Guid value for identifying the image type */
40     efi_guid_t image_type_uuid;
41 
42     /*! Guid of the storage volume where the image is located */
43     efi_guid_t location_uuid;
44 
45     /*! Array containing properties of images */
46     struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS];
47 } __attribute__((__packed__));
48 
49 /*!
50  * \brief FWU metadata structure for multi-bank updates
51  *
52  * \details This structure is used to store all the needed information for
53  * performing multi bank updates on the platform. This contains info on the
54  * bank being used to boot along with the information needed for
55  * identification of individual images.
56  */
57 struct fwu_mdata {
58     /*! crc32 value for the FWU metadata */
59     uint32_t crc32;
60 
61     /*! FWU metadata version */
62     uint32_t version;
63 
64     /*! Index of the bank currently used for booting images */
65     uint32_t active_index;
66 
67     /*! Index of the bank used before the current bank being used for booting */
68     uint32_t previous_active_index;
69 
70     /*! Array of information on various firmware images that can be updated */
71     struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK];
72 } __attribute__((__packed__));
73 
74 #endif /* FWU_MDATA_H */
75