summaryrefslogtreecommitdiff
path: root/drivers/misc/issei/hw_msg.h
blob: 28fd3775f64ca35400b275ff06f3600dfabb2040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2023-2026 Intel Corporation */
#ifndef _ISSEI_HW_MSG_H_
#define _ISSEI_HW_MSG_H_

#include <linux/types.h>
#include <linux/uuid.h>

#define HAM_CB_MESSAGE_ID_REQ	0x8086cafe
#define HAM_CB_MESSAGE_ID_RES	0xcafe8086
#define HAM_CB_MESSAGE_VER	0x1

/**
 * struct ham_setup_shared_memory_req - shared memory setup request
 * @msg_id: message id, should be %HAM_CB_MESSAGE_ID_REQ
 * @ver: message version (%HAM_CB_MESSAGE_VER)
 * @reserved: reserved
 * @buffer_physical_address: physical address of DMA buffer
 * @host_to_fw_section_length: memory size for host to fw communication
 * @fw_to_host_section_length: memory size for fw to host communication
 * @control_length: memory size for control buffer
 */
struct ham_setup_shared_memory_req {
	u32 msg_id;
	u16 ver;
	u16 reserved;
	u64 buffer_physical_address;
	u32 host_to_fw_section_length;
	u32 fw_to_host_section_length;
	u32 control_length;
} __packed __aligned(4);

/**
 * struct ham_setup_shared_memory_res - shared memory setup response
 * @msg_id: message id, should be %HAM_CB_MESSAGE_ID_RES
 * @status: operation status
 */
struct ham_setup_shared_memory_res {
	u32 msg_id;
	u32 status;
};

/**
 * struct control_buffer - control buffer structure
 * @h2f_counter_wr: write counter host to fw
 * @h2f_counter_rd: read counter host to fw
 * @f2h_counter_wr: write counter fw to host
 * @f2h_counter_rd: read counter fw to host
 */
struct control_buffer {
	u32 h2f_counter_wr;
	u32 h2f_counter_rd;
	u32 f2h_counter_wr;
	u32 f2h_counter_rd;
};

/* HAM messages over DMA */

/**
 * struct ham_message_header - message header over DMA
 * @length: message length (payload only, not including header)
 * @fw_id: firmware client id (0 means Bus Message)
 * @host_id: host client id (0 means Bus Message)
 * @flags: message flags
 * @status: operation status
 * @reserved: reserved
 */
struct ham_message_header {
	u32 length;
	u16 fw_id;
	u16 host_id;
	u32 flags;
	u32 status;
	u32 reserved;
};

/* Bus Commands */
#define HAM_BUS_CMD_START_REQ 0x00
#define HAM_BUS_CMD_START_RSP 0x80
#define HAM_BUS_CMD_CLIENT_REQ 0x01
#define HAM_BUS_CMD_CLIENT_RSP 0x81

/**
 * struct ham_bus_message - bus message header
 * @cmd: command code
 */
struct ham_bus_message {
	u32 cmd;
};

#define HAM_SUPPORTED_VERSION 0x01

/**
 * struct ham_start_message_req - start message
 * @header: bus message header (%HAM_BUS_CMD_START_REQ)
 * @supported_version: supported protocol version
 * @heci_capabilities_length: protocol capabilities length in bytes
 * @heci_capabilities: protocol capabilities data
 */
struct ham_start_message_req {
	struct ham_bus_message header;
	u16 supported_version;
	u8 heci_capabilities_length;
	u8 heci_capabilities[] __counted_by(heci_capabilities_length);
} __packed;

/**
 * struct ham_start_message_res - start message response
 * @header: bus message header (%HAM_BUS_CMD_START_RSP)
 * @fw_version: firmware version (four u16 blocks)
 * @supported_version: supported protocol version
 * @heci_capabilities_length: protocol capabilities length in bytes
 * @heci_capabilities: protocol capabilities data
 */
struct ham_start_message_res {
	struct ham_bus_message header;
	u16 fw_version[4];
	u16 supported_version;
	u8 heci_capabilities_length;
	u8 heci_capabilities[] __counted_by(heci_capabilities_length);
} __packed;

/**
 * struct ham_get_clients_req - clients list request
 * @header: bus message header (%HAM_BUS_CMD_CLIENT_REQ)
 */
struct ham_get_clients_req {
	struct ham_bus_message header;
};

/**
 * struct ham_client_properties - single client properties
 * @client_number: client id in firmware
 * @protocol_ver: client protocol version
 * @reserved: reserved
 * @client_uuid: protocol name (UUID)
 * @client_mtu: max message length supported by client
 * @flags: client flags
 */
struct ham_client_properties {
	u16 client_number;
	u8 protocol_ver;
	u8 reserved;
	uuid_t client_uuid;
	u32 client_mtu;
	u32 flags;
};

/**
 * struct ham_get_clients_res - client properties response
 * @header: bus message header (%HAM_BUS_CMD_CLIENT_RSP)
 * @client_count: number of clients in firmware
 * @reserved: reserved
 * @clients_props: list of client properties
 */
struct ham_get_clients_res {
	struct ham_bus_message header;
	u16 client_count;
	u16 reserved;
	struct ham_client_properties clients_props[] __counted_by(client_count);
};

#endif /* _ISSEI_HW_MSG_H_ */