blob: 56189e2f40a9e6ad51965b0a8324469dce96e28a [file] [log] [blame]
Sughosh Ganu0f9399a2022-10-21 18:15:55 +05301/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (c) 2022, Linaro Limited
4 */
5
6#if !defined _FWU_MDATA_H_
7#define _FWU_MDATA_H_
8
Rui Miguel Silva46b74412023-06-12 09:09:15 +01009#include <linux/compiler_attributes.h>
Sughosh Ganu0f9399a2022-10-21 18:15:55 +053010#include <efi.h>
11
12/**
13 * struct fwu_image_bank_info - firmware image information
14 * @image_uuid: Guid value of the image in this bank
15 * @accepted: Acceptance status of the image
16 * @reserved: Reserved
17 *
18 * The structure contains image specific fields which are
19 * used to identify the image and to specify the image's
20 * acceptance status
21 */
22struct fwu_image_bank_info {
23 efi_guid_t image_uuid;
24 uint32_t accepted;
25 uint32_t reserved;
Rui Miguel Silva46b74412023-06-12 09:09:15 +010026} __packed;
Sughosh Ganu0f9399a2022-10-21 18:15:55 +053027
28/**
29 * struct fwu_image_entry - information for a particular type of image
30 * @image_type_uuid: Guid value for identifying the image type
31 * @location_uuid: Guid of the storage volume where the image is located
32 * @img_bank_info: Array containing properties of images
33 *
34 * 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 */
38struct fwu_image_entry {
39 efi_guid_t image_type_uuid;
40 efi_guid_t location_uuid;
41 struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS];
Rui Miguel Silva46b74412023-06-12 09:09:15 +010042} __packed;
Sughosh Ganu0f9399a2022-10-21 18:15:55 +053043
44/**
45 * struct fwu_mdata - FWU metadata structure for multi-bank updates
46 * @crc32: crc32 value for the FWU metadata
47 * @version: FWU metadata version
48 * @active_index: Index of the bank currently used for booting images
49 * @previous_active_inde: Index of the bank used before the current bank
50 * being used for booting
51 * @img_entry: Array of information on various firmware images that can
52 * be updated
53 *
54 * This structure is used to store all the needed information for performing
55 * multi bank updates on the platform. This contains info on the bank being
56 * used to boot along with the information needed for identification of
57 * individual images
58 */
59struct fwu_mdata {
60 uint32_t crc32;
61 uint32_t version;
62 uint32_t active_index;
63 uint32_t previous_active_index;
64
65 struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK];
Rui Miguel Silva46b74412023-06-12 09:09:15 +010066} __packed;
Sughosh Ganu0f9399a2022-10-21 18:15:55 +053067
68#endif /* _FWU_MDATA_H_ */