blob: 25374449afb92cc0a37d923daff28a850904546a [file] [log] [blame]
Julian Hall536afb12022-10-12 11:25:55 +01001/*
Imre Kis18b387d2024-07-02 13:51:07 +02002 * Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved.
Julian Hall536afb12022-10-12 11:25:55 +01003 *
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 */
Imre Kis18b387d2024-07-02 13:51:07 +020020#define FWU_PROTOCOL_VERSION_MAJOR 1
Julian Hall536afb12022-10-12 11:25:55 +010021
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
Imre Kis18b387d2024-07-02 13:51:07 +020035#define FWU_OPEN_OP_TYPE_READ (0)
36#define FWU_OPEN_OP_TYPE_WRITE (1)
37
Julian Hall536afb12022-10-12 11:25:55 +010038/**
39 * Image directory
40 */
Imre Kis18b387d2024-07-02 13:51:07 +020041#define FWU_IMAGE_DIRECTORY_VERSION (2)
Julian Hall536afb12022-10-12 11:25:55 +010042
Gyorgy Szing3c446242023-03-31 01:53:15 +020043struct __attribute__((__packed__)) ts_fwu_image_info_entry {
44 uint8_t img_type_uuid[OSF_UUID_OCTET_LEN];
Julian Hall536afb12022-10-12 11:25:55 +010045 uint32_t client_permissions;
46 uint32_t img_max_size;
47 uint32_t lowest_accepted_version;
48 uint32_t img_version;
49 uint32_t accepted;
50 uint32_t reserved;
51};
52
Gyorgy Szing3c446242023-03-31 01:53:15 +020053struct __attribute__((__packed__)) ts_fwu_image_directory {
Julian Hall536afb12022-10-12 11:25:55 +010054 uint32_t directory_version;
55 uint32_t img_info_offset;
56 uint32_t num_images;
57 uint32_t correct_boot;
58 uint32_t img_info_size;
59 uint32_t reserved;
60 struct ts_fwu_image_info_entry img_info_entry[];
61};
62
63/**
64 * Message parameters
65 */
66
Gyorgy Szing3c446242023-03-31 01:53:15 +020067struct __attribute__((__packed__)) ts_fwu_discover_out {
Imre Kis18b387d2024-07-02 13:51:07 +020068 int16_t service_status;
Gyorgy Szing3c446242023-03-31 01:53:15 +020069 uint8_t version_major;
70 uint8_t version_minor;
Imre Kis18b387d2024-07-02 13:51:07 +020071 uint16_t off_function_presence;
Julian Hall536afb12022-10-12 11:25:55 +010072 uint16_t num_func;
Imre Kis18b387d2024-07-02 13:51:07 +020073 uint64_t max_payload_size;
74 uint32_t flags;
75 uint32_t vendor_specific_flags;
Gyorgy Szing3c446242023-03-31 01:53:15 +020076 uint8_t function_presence[];
Julian Hall536afb12022-10-12 11:25:55 +010077};
78
Imre Kis18b387d2024-07-02 13:51:07 +020079struct __attribute__((__packed__)) ts_fwu_begin_staging_in {
80 uint32_t reserved;
81 uint32_t vendor_flags;
82 uint32_t partial_update_count;
83 uint8_t update_guid[];
84};
85
Gyorgy Szing3c446242023-03-31 01:53:15 +020086struct __attribute__((__packed__)) ts_fwu_open_in {
87 uint8_t image_type_uuid[OSF_UUID_OCTET_LEN];
Imre Kis18b387d2024-07-02 13:51:07 +020088 uint8_t op_type;
Julian Hall536afb12022-10-12 11:25:55 +010089};
90
Gyorgy Szing3c446242023-03-31 01:53:15 +020091struct __attribute__((__packed__)) ts_fwu_open_out {
Julian Hall536afb12022-10-12 11:25:55 +010092 uint32_t handle;
93};
94
Gyorgy Szing3c446242023-03-31 01:53:15 +020095struct __attribute__((__packed__)) ts_fwu_write_stream_in {
Julian Hall536afb12022-10-12 11:25:55 +010096 uint32_t handle;
97 uint32_t data_len;
Gyorgy Szing3c446242023-03-31 01:53:15 +020098 uint8_t payload[];
Julian Hall536afb12022-10-12 11:25:55 +010099};
100
Gyorgy Szing3c446242023-03-31 01:53:15 +0200101struct __attribute__((__packed__)) ts_fwu_read_stream_in {
Julian Hall536afb12022-10-12 11:25:55 +0100102 uint32_t handle;
103};
104
Gyorgy Szing3c446242023-03-31 01:53:15 +0200105struct __attribute__((__packed__)) ts_fwu_read_stream_out {
Julian Hall536afb12022-10-12 11:25:55 +0100106 uint32_t read_bytes;
107 uint32_t total_bytes;
Gyorgy Szing3c446242023-03-31 01:53:15 +0200108 uint8_t payload[];
Julian Hall536afb12022-10-12 11:25:55 +0100109};
110
Gyorgy Szing3c446242023-03-31 01:53:15 +0200111struct __attribute__((__packed__)) ts_fwu_commit_in {
Julian Hall536afb12022-10-12 11:25:55 +0100112 uint32_t handle;
113 uint32_t acceptance_req;
114 uint32_t max_atomic_len;
115};
116
Gyorgy Szing3c446242023-03-31 01:53:15 +0200117struct __attribute__((__packed__)) ts_fwu_commit_out {
Julian Hall536afb12022-10-12 11:25:55 +0100118 uint32_t progress;
119 uint32_t total_work;
120};
121
Gyorgy Szing3c446242023-03-31 01:53:15 +0200122struct __attribute__((__packed__)) ts_fwu_accept_image_in {
Julian Hall536afb12022-10-12 11:25:55 +0100123 uint32_t reserved;
Gyorgy Szing3c446242023-03-31 01:53:15 +0200124 uint8_t image_type_uuid[OSF_UUID_OCTET_LEN];
Julian Hall536afb12022-10-12 11:25:55 +0100125};
126
127#endif /* FWU_PROTO_H */