blob: 6cd691accdbe857ff14ea8f173be879f9f747c9b [file] [log] [blame]
Julian Hall536afb12022-10-12 11:25:55 +01001/*
2 * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef FWU_PROTO_H
8#define FWU_PROTO_H
9
10#include <stdint.h>
Gyorgy Szing3c446242023-03-31 01:53:15 +020011
Julian Hall536afb12022-10-12 11:25:55 +010012#include "opcodes.h"
Gyorgy Szing3c446242023-03-31 01:53:15 +020013#include "protocols/common/osf/uuid.h"
Julian Hall536afb12022-10-12 11:25:55 +010014#include "status.h"
15
16/**
17 * The major version number of the FWU-A access protocol. It will be incremented
18 * on significant updates that may include breaking changes.
19 */
20#define FWU_PROTOCOL_VERSION_MAJOR 2
21
22/**
23 * The minor version number It will be incremented in
24 * small updates that are unlikely to include breaking changes.
25 */
26#define FWU_PROTOCOL_VERSION_MINOR 0
27
28/**
29 * Protocol GUIDs defined in FWU-A specification
30 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020031#define FWU_UPDATE_AGENT_CANONICAL_UUID "6823a838-1b06-470e-9774-0cce8bfb53fd"
32#define FWU_DIRECTORY_CANONICAL_UUID "deee58d9-5147-4ad3-a290-77666e2341a5"
33#define FWU_METADATA_CANONICAL_UUID "8a7a84a0-8387-40f6-ab41-a8b9a5a60d23"
Julian Hall536afb12022-10-12 11:25:55 +010034
35/**
36 * Image directory
37 */
Gyorgy Szing3c446242023-03-31 01:53:15 +020038#define FWU_READ_PERM (1u << 1)
39#define FWU_WRITE_PERM (1u << 0)
Julian Hall536afb12022-10-12 11:25:55 +010040
Gyorgy Szing3c446242023-03-31 01:53:15 +020041struct __attribute__((__packed__)) ts_fwu_image_info_entry {
42 uint8_t img_type_uuid[OSF_UUID_OCTET_LEN];
Julian Hall536afb12022-10-12 11:25:55 +010043 uint32_t client_permissions;
44 uint32_t img_max_size;
45 uint32_t lowest_accepted_version;
46 uint32_t img_version;
47 uint32_t accepted;
48 uint32_t reserved;
49};
50
Gyorgy Szing3c446242023-03-31 01:53:15 +020051struct __attribute__((__packed__)) ts_fwu_image_directory {
Julian Hall536afb12022-10-12 11:25:55 +010052 uint32_t directory_version;
53 uint32_t img_info_offset;
54 uint32_t num_images;
55 uint32_t correct_boot;
56 uint32_t img_info_size;
57 uint32_t reserved;
58 struct ts_fwu_image_info_entry img_info_entry[];
59};
60
61/**
62 * Message parameters
63 */
64
Gyorgy Szing3c446242023-03-31 01:53:15 +020065struct __attribute__((__packed__)) ts_fwu_discover_out {
66 uint8_t version_major;
67 uint8_t version_minor;
Julian Hall536afb12022-10-12 11:25:55 +010068 uint16_t num_func;
Gyorgy Szing3c446242023-03-31 01:53:15 +020069 uint8_t function_presence[];
Julian Hall536afb12022-10-12 11:25:55 +010070};
71
Gyorgy Szing3c446242023-03-31 01:53:15 +020072struct __attribute__((__packed__)) ts_fwu_open_in {
73 uint8_t image_type_uuid[OSF_UUID_OCTET_LEN];
Julian Hall536afb12022-10-12 11:25:55 +010074};
75
Gyorgy Szing3c446242023-03-31 01:53:15 +020076struct __attribute__((__packed__)) ts_fwu_open_out {
Julian Hall536afb12022-10-12 11:25:55 +010077 uint32_t handle;
78};
79
Gyorgy Szing3c446242023-03-31 01:53:15 +020080struct __attribute__((__packed__)) ts_fwu_write_stream_in {
Julian Hall536afb12022-10-12 11:25:55 +010081 uint32_t handle;
82 uint32_t data_len;
Gyorgy Szing3c446242023-03-31 01:53:15 +020083 uint8_t payload[];
Julian Hall536afb12022-10-12 11:25:55 +010084};
85
Gyorgy Szing3c446242023-03-31 01:53:15 +020086struct __attribute__((__packed__)) ts_fwu_read_stream_in {
Julian Hall536afb12022-10-12 11:25:55 +010087 uint32_t handle;
88};
89
Gyorgy Szing3c446242023-03-31 01:53:15 +020090struct __attribute__((__packed__)) ts_fwu_read_stream_out {
Julian Hall536afb12022-10-12 11:25:55 +010091 uint32_t read_bytes;
92 uint32_t total_bytes;
Gyorgy Szing3c446242023-03-31 01:53:15 +020093 uint8_t payload[];
Julian Hall536afb12022-10-12 11:25:55 +010094};
95
Gyorgy Szing3c446242023-03-31 01:53:15 +020096struct __attribute__((__packed__)) ts_fwu_commit_in {
Julian Hall536afb12022-10-12 11:25:55 +010097 uint32_t handle;
98 uint32_t acceptance_req;
99 uint32_t max_atomic_len;
100};
101
Gyorgy Szing3c446242023-03-31 01:53:15 +0200102struct __attribute__((__packed__)) ts_fwu_commit_out {
Julian Hall536afb12022-10-12 11:25:55 +0100103 uint32_t progress;
104 uint32_t total_work;
105};
106
Gyorgy Szing3c446242023-03-31 01:53:15 +0200107struct __attribute__((__packed__)) ts_fwu_accept_image_in {
Julian Hall536afb12022-10-12 11:25:55 +0100108 uint32_t reserved;
Gyorgy Szing3c446242023-03-31 01:53:15 +0200109 uint8_t image_type_uuid[OSF_UUID_OCTET_LEN];
Julian Hall536afb12022-10-12 11:25:55 +0100110};
111
112#endif /* FWU_PROTO_H */