Linux Audio

Check our new training course

Loading...
v4.6
 
  1/*
  2 *
  3 * Intel Management Engine Interface (Intel MEI) Linux driver
  4 * Copyright (c) 2003-2012, Intel Corporation.
  5 *
  6 * This program is free software; you can redistribute it and/or modify it
  7 * under the terms and conditions of the GNU General Public License,
  8 * version 2, as published by the Free Software Foundation.
  9 *
 10 * This program is distributed in the hope it will be useful, but WITHOUT
 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 13 * more details.
 14 *
 15 */
 16
 17#ifndef _MEI_HW_TYPES_H_
 18#define _MEI_HW_TYPES_H_
 19
 20#include <linux/uuid.h>
 21
 22/*
 23 * Timeouts in Seconds
 24 */
 25#define MEI_HW_READY_TIMEOUT        2  /* Timeout on ready message */
 26#define MEI_CONNECT_TIMEOUT         3  /* HPS: at least 2 seconds */
 27
 28#define MEI_CL_CONNECT_TIMEOUT     15  /* HPS: Client Connect Timeout */
 29#define MEI_CLIENTS_INIT_TIMEOUT   15  /* HPS: Clients Enumeration Timeout */
 30
 31#define MEI_IAMTHIF_STALL_TIMER    12  /* HPS */
 32
 33#define MEI_PGI_TIMEOUT             1  /* PG Isolation time response 1 sec */
 34#define MEI_D0I3_TIMEOUT            5  /* D0i3 set/unset max response time */
 35#define MEI_HBM_TIMEOUT             1  /* 1 second */
 36
 37/*
 38 * MEI Version
 39 */
 40#define HBM_MINOR_VERSION                   0
 41#define HBM_MAJOR_VERSION                   2
 42
 43/*
 44 * MEI version with PGI support
 45 */
 46#define HBM_MINOR_VERSION_PGI               1
 47#define HBM_MAJOR_VERSION_PGI               1
 48
 49/*
 50 * MEI version with Dynamic clients support
 51 */
 52#define HBM_MINOR_VERSION_DC               0
 53#define HBM_MAJOR_VERSION_DC               2
 54
 55/*
 56 * MEI version with immediate reply to enum request support
 57 */
 58#define HBM_MINOR_VERSION_IE               0
 59#define HBM_MAJOR_VERSION_IE               2
 60
 61/*
 62 * MEI version with disconnect on connection timeout support
 63 */
 64#define HBM_MINOR_VERSION_DOT              0
 65#define HBM_MAJOR_VERSION_DOT              2
 66
 67/*
 68 * MEI version with notifcation support
 69 */
 70#define HBM_MINOR_VERSION_EV               0
 71#define HBM_MAJOR_VERSION_EV               2
 72
 73/*
 74 * MEI version with fixed address client support
 75 */
 76#define HBM_MINOR_VERSION_FA               0
 77#define HBM_MAJOR_VERSION_FA               2
 78
 
 
 
 
 
 
 
 
 
 
 
 
 79/* Host bus message command opcode */
 80#define MEI_HBM_CMD_OP_MSK                  0x7f
 81/* Host bus message command RESPONSE */
 82#define MEI_HBM_CMD_RES_MSK                 0x80
 83
 84/*
 85 * MEI Bus Message Command IDs
 86 */
 87#define HOST_START_REQ_CMD                  0x01
 88#define HOST_START_RES_CMD                  0x81
 89
 90#define HOST_STOP_REQ_CMD                   0x02
 91#define HOST_STOP_RES_CMD                   0x82
 92
 93#define ME_STOP_REQ_CMD                     0x03
 94
 95#define HOST_ENUM_REQ_CMD                   0x04
 96#define HOST_ENUM_RES_CMD                   0x84
 97
 98#define HOST_CLIENT_PROPERTIES_REQ_CMD      0x05
 99#define HOST_CLIENT_PROPERTIES_RES_CMD      0x85
100
101#define CLIENT_CONNECT_REQ_CMD              0x06
102#define CLIENT_CONNECT_RES_CMD              0x86
103
104#define CLIENT_DISCONNECT_REQ_CMD           0x07
105#define CLIENT_DISCONNECT_RES_CMD           0x87
106
107#define MEI_FLOW_CONTROL_CMD                0x08
108
109#define MEI_PG_ISOLATION_ENTRY_REQ_CMD      0x0a
110#define MEI_PG_ISOLATION_ENTRY_RES_CMD      0x8a
111#define MEI_PG_ISOLATION_EXIT_REQ_CMD       0x0b
112#define MEI_PG_ISOLATION_EXIT_RES_CMD       0x8b
113
114#define MEI_HBM_ADD_CLIENT_REQ_CMD          0x0f
115#define MEI_HBM_ADD_CLIENT_RES_CMD          0x8f
116
117#define MEI_HBM_NOTIFY_REQ_CMD              0x10
118#define MEI_HBM_NOTIFY_RES_CMD              0x90
119#define MEI_HBM_NOTIFICATION_CMD            0x11
120
 
 
 
121/*
122 * MEI Stop Reason
123 * used by hbm_host_stop_request.reason
124 */
125enum mei_stop_reason_types {
126	DRIVER_STOP_REQUEST = 0x00,
127	DEVICE_D1_ENTRY = 0x01,
128	DEVICE_D2_ENTRY = 0x02,
129	DEVICE_D3_ENTRY = 0x03,
130	SYSTEM_S1_ENTRY = 0x04,
131	SYSTEM_S2_ENTRY = 0x05,
132	SYSTEM_S3_ENTRY = 0x06,
133	SYSTEM_S4_ENTRY = 0x07,
134	SYSTEM_S5_ENTRY = 0x08
135};
136
137
138/**
139 * enum mei_hbm_status  - mei host bus messages return values
140 *
141 * @MEI_HBMS_SUCCESS           : status success
142 * @MEI_HBMS_CLIENT_NOT_FOUND  : client not found
143 * @MEI_HBMS_ALREADY_EXISTS    : connection already established
144 * @MEI_HBMS_REJECTED          : connection is rejected
145 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
146 * @MEI_HBMS_NOT_ALLOWED       : operation not allowed
147 * @MEI_HBMS_ALREADY_STARTED   : system is already started
148 * @MEI_HBMS_NOT_STARTED       : system not started
149 *
150 * @MEI_HBMS_MAX               : sentinel
151 */
152enum mei_hbm_status {
153	MEI_HBMS_SUCCESS           = 0,
154	MEI_HBMS_CLIENT_NOT_FOUND  = 1,
155	MEI_HBMS_ALREADY_EXISTS    = 2,
156	MEI_HBMS_REJECTED          = 3,
157	MEI_HBMS_INVALID_PARAMETER = 4,
158	MEI_HBMS_NOT_ALLOWED       = 5,
159	MEI_HBMS_ALREADY_STARTED   = 6,
160	MEI_HBMS_NOT_STARTED       = 7,
161
162	MEI_HBMS_MAX
163};
164
165
166/*
167 * Client Connect Status
168 * used by hbm_client_connect_response.status
169 */
170enum mei_cl_connect_status {
171	MEI_CL_CONN_SUCCESS          = MEI_HBMS_SUCCESS,
172	MEI_CL_CONN_NOT_FOUND        = MEI_HBMS_CLIENT_NOT_FOUND,
173	MEI_CL_CONN_ALREADY_STARTED  = MEI_HBMS_ALREADY_EXISTS,
174	MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
175	MEI_CL_CONN_MESSAGE_SMALL    = MEI_HBMS_INVALID_PARAMETER,
176	MEI_CL_CONN_NOT_ALLOWED      = MEI_HBMS_NOT_ALLOWED,
177};
178
179/*
180 * Client Disconnect Status
181 */
182enum  mei_cl_disconnect_status {
183	MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
184};
185
186/*
187 *  MEI BUS Interface Section
 
 
 
 
 
 
 
 
 
188 */
189struct mei_msg_hdr {
190	u32 me_addr:8;
191	u32 host_addr:8;
192	u32 length:9;
193	u32 reserved:5;
 
194	u32 internal:1;
195	u32 msg_complete:1;
 
196} __packed;
197
 
198
199struct mei_bus_message {
200	u8 hbm_cmd;
201	u8 data[0];
202} __packed;
203
204/**
205 * struct hbm_cl_cmd - client specific host bus command
206 *	CONNECT, DISCONNECT, and FlOW CONTROL
207 *
208 * @hbm_cmd: bus message command header
209 * @me_addr: address of the client in ME
210 * @host_addr: address of the client in the driver
211 * @data: generic data
212 */
213struct mei_hbm_cl_cmd {
214	u8 hbm_cmd;
215	u8 me_addr;
216	u8 host_addr;
217	u8 data;
218};
219
220struct hbm_version {
221	u8 minor_version;
222	u8 major_version;
223} __packed;
224
225struct hbm_host_version_request {
226	u8 hbm_cmd;
227	u8 reserved;
228	struct hbm_version host_version;
229} __packed;
230
231struct hbm_host_version_response {
232	u8 hbm_cmd;
233	u8 host_version_supported;
234	struct hbm_version me_max_version;
235} __packed;
236
237struct hbm_host_stop_request {
238	u8 hbm_cmd;
239	u8 reason;
240	u8 reserved[2];
241} __packed;
242
243struct hbm_host_stop_response {
244	u8 hbm_cmd;
245	u8 reserved[3];
246} __packed;
247
248struct hbm_me_stop_request {
249	u8 hbm_cmd;
250	u8 reason;
251	u8 reserved[2];
252} __packed;
253
254/**
255 * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0)
256 *
257 * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add
258 * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately
259 */
260enum hbm_host_enum_flags {
261	MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
262	MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
263};
264
265/**
266 * struct hbm_host_enum_request - enumeration request from host to fw
267 *
268 * @hbm_cmd : bus message command header
269 * @flags   : request flags
270 * @reserved: reserved
271 */
272struct hbm_host_enum_request {
273	u8 hbm_cmd;
274	u8 flags;
275	u8 reserved[2];
276} __packed;
277
278struct hbm_host_enum_response {
279	u8 hbm_cmd;
280	u8 reserved[3];
281	u8 valid_addresses[32];
282} __packed;
283
284struct mei_client_properties {
285	uuid_le protocol_name;
286	u8 protocol_version;
287	u8 max_number_of_connections;
288	u8 fixed_address;
289	u8 single_recv_buf;
 
290	u32 max_msg_length;
291} __packed;
292
293struct hbm_props_request {
294	u8 hbm_cmd;
295	u8 me_addr;
296	u8 reserved[2];
297} __packed;
298
299struct hbm_props_response {
300	u8 hbm_cmd;
301	u8 me_addr;
302	u8 status;
303	u8 reserved[1];
304	struct mei_client_properties client_properties;
305} __packed;
306
307/**
308 * struct hbm_add_client_request - request to add a client
309 *     might be sent by fw after enumeration has already completed
310 *
311 * @hbm_cmd: bus message command header
312 * @me_addr: address of the client in ME
313 * @reserved: reserved
314 * @client_properties: client properties
315 */
316struct hbm_add_client_request {
317	u8 hbm_cmd;
318	u8 me_addr;
319	u8 reserved[2];
320	struct mei_client_properties client_properties;
321} __packed;
322
323/**
324 * struct hbm_add_client_response - response to add a client
325 *     sent by the host to report client addition status to fw
326 *
327 * @hbm_cmd: bus message command header
328 * @me_addr: address of the client in ME
329 * @status: if HBMS_SUCCESS then the client can now accept connections.
330 * @reserved: reserved
331 */
332struct hbm_add_client_response {
333	u8 hbm_cmd;
334	u8 me_addr;
335	u8 status;
336	u8 reserved[1];
337} __packed;
338
339/**
340 * struct hbm_power_gate - power gate request/response
341 *
342 * @hbm_cmd: bus message command header
343 * @reserved: reserved
344 */
345struct hbm_power_gate {
346	u8 hbm_cmd;
347	u8 reserved[3];
348} __packed;
349
350/**
351 * struct hbm_client_connect_request - connect/disconnect request
352 *
353 * @hbm_cmd: bus message command header
354 * @me_addr: address of the client in ME
355 * @host_addr: address of the client in the driver
356 * @reserved: reserved
357 */
358struct hbm_client_connect_request {
359	u8 hbm_cmd;
360	u8 me_addr;
361	u8 host_addr;
362	u8 reserved;
363} __packed;
364
365/**
366 * struct hbm_client_connect_response - connect/disconnect response
367 *
368 * @hbm_cmd: bus message command header
369 * @me_addr: address of the client in ME
370 * @host_addr: address of the client in the driver
371 * @status: status of the request
372 */
373struct hbm_client_connect_response {
374	u8 hbm_cmd;
375	u8 me_addr;
376	u8 host_addr;
377	u8 status;
378} __packed;
379
380
381#define MEI_FC_MESSAGE_RESERVED_LENGTH           5
382
383struct hbm_flow_control {
384	u8 hbm_cmd;
385	u8 me_addr;
386	u8 host_addr;
387	u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
388} __packed;
389
390#define MEI_HBM_NOTIFICATION_START 1
391#define MEI_HBM_NOTIFICATION_STOP  0
392/**
393 * struct hbm_notification_request - start/stop notification request
394 *
395 * @hbm_cmd: bus message command header
396 * @me_addr: address of the client in ME
397 * @host_addr: address of the client in the driver
398 * @start:  start = 1 or stop = 0 asynchronous notifications
399 */
400struct hbm_notification_request {
401	u8 hbm_cmd;
402	u8 me_addr;
403	u8 host_addr;
404	u8 start;
405} __packed;
406
407/**
408 * struct hbm_notification_response - start/stop notification response
409 *
410 * @hbm_cmd: bus message command header
411 * @me_addr: address of the client in ME
412 * @host_addr: - address of the client in the driver
413 * @status: (mei_hbm_status) response status for the request
414 *  - MEI_HBMS_SUCCESS: successful stop/start
415 *  - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
416 *  - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
417 *                         started notification.
418 *  - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
419 *                         asynchronous notifications are currently disabled.
420 *
421 * @start:  start = 1 or stop = 0 asynchronous notifications
422 * @reserved: reserved
423 */
424struct hbm_notification_response {
425	u8 hbm_cmd;
426	u8 me_addr;
427	u8 host_addr;
428	u8 status;
429	u8 start;
430	u8 reserved[3];
431} __packed;
432
433/**
434 * struct hbm_notification - notification event
435 *
436 * @hbm_cmd: bus message command header
437 * @me_addr:  address of the client in ME
438 * @host_addr:  address of the client in the driver
439 * @reserved: reserved for alignment
440 */
441struct hbm_notification {
442	u8 hbm_cmd;
443	u8 me_addr;
444	u8 host_addr;
445	u8 reserved[1];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446} __packed;
447
448#endif
v5.4
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Copyright (c) 2003-2018, Intel Corporation. All rights reserved
  4 * Intel Management Engine Interface (Intel MEI) Linux driver
 
 
 
 
 
 
 
 
 
 
 
  5 */
  6
  7#ifndef _MEI_HW_TYPES_H_
  8#define _MEI_HW_TYPES_H_
  9
 10#include <linux/uuid.h>
 11
 12/*
 13 * Timeouts in Seconds
 14 */
 15#define MEI_HW_READY_TIMEOUT        2  /* Timeout on ready message */
 16#define MEI_CONNECT_TIMEOUT         3  /* HPS: at least 2 seconds */
 17
 18#define MEI_CL_CONNECT_TIMEOUT     15  /* HPS: Client Connect Timeout */
 19#define MEI_CLIENTS_INIT_TIMEOUT   15  /* HPS: Clients Enumeration Timeout */
 20
 
 
 21#define MEI_PGI_TIMEOUT             1  /* PG Isolation time response 1 sec */
 22#define MEI_D0I3_TIMEOUT            5  /* D0i3 set/unset max response time */
 23#define MEI_HBM_TIMEOUT             1  /* 1 second */
 24
 25/*
 26 * MEI Version
 27 */
 28#define HBM_MINOR_VERSION                   1
 29#define HBM_MAJOR_VERSION                   2
 30
 31/*
 32 * MEI version with PGI support
 33 */
 34#define HBM_MINOR_VERSION_PGI               1
 35#define HBM_MAJOR_VERSION_PGI               1
 36
 37/*
 38 * MEI version with Dynamic clients support
 39 */
 40#define HBM_MINOR_VERSION_DC               0
 41#define HBM_MAJOR_VERSION_DC               2
 42
 43/*
 44 * MEI version with immediate reply to enum request support
 45 */
 46#define HBM_MINOR_VERSION_IE               0
 47#define HBM_MAJOR_VERSION_IE               2
 48
 49/*
 50 * MEI version with disconnect on connection timeout support
 51 */
 52#define HBM_MINOR_VERSION_DOT              0
 53#define HBM_MAJOR_VERSION_DOT              2
 54
 55/*
 56 * MEI version with notification support
 57 */
 58#define HBM_MINOR_VERSION_EV               0
 59#define HBM_MAJOR_VERSION_EV               2
 60
 61/*
 62 * MEI version with fixed address client support
 63 */
 64#define HBM_MINOR_VERSION_FA               0
 65#define HBM_MAJOR_VERSION_FA               2
 66
 67/*
 68 * MEI version with OS ver message support
 69 */
 70#define HBM_MINOR_VERSION_OS               0
 71#define HBM_MAJOR_VERSION_OS               2
 72
 73/*
 74 * MEI version with dma ring support
 75 */
 76#define HBM_MINOR_VERSION_DR               1
 77#define HBM_MAJOR_VERSION_DR               2
 78
 79/* Host bus message command opcode */
 80#define MEI_HBM_CMD_OP_MSK                  0x7f
 81/* Host bus message command RESPONSE */
 82#define MEI_HBM_CMD_RES_MSK                 0x80
 83
 84/*
 85 * MEI Bus Message Command IDs
 86 */
 87#define HOST_START_REQ_CMD                  0x01
 88#define HOST_START_RES_CMD                  0x81
 89
 90#define HOST_STOP_REQ_CMD                   0x02
 91#define HOST_STOP_RES_CMD                   0x82
 92
 93#define ME_STOP_REQ_CMD                     0x03
 94
 95#define HOST_ENUM_REQ_CMD                   0x04
 96#define HOST_ENUM_RES_CMD                   0x84
 97
 98#define HOST_CLIENT_PROPERTIES_REQ_CMD      0x05
 99#define HOST_CLIENT_PROPERTIES_RES_CMD      0x85
100
101#define CLIENT_CONNECT_REQ_CMD              0x06
102#define CLIENT_CONNECT_RES_CMD              0x86
103
104#define CLIENT_DISCONNECT_REQ_CMD           0x07
105#define CLIENT_DISCONNECT_RES_CMD           0x87
106
107#define MEI_FLOW_CONTROL_CMD                0x08
108
109#define MEI_PG_ISOLATION_ENTRY_REQ_CMD      0x0a
110#define MEI_PG_ISOLATION_ENTRY_RES_CMD      0x8a
111#define MEI_PG_ISOLATION_EXIT_REQ_CMD       0x0b
112#define MEI_PG_ISOLATION_EXIT_RES_CMD       0x8b
113
114#define MEI_HBM_ADD_CLIENT_REQ_CMD          0x0f
115#define MEI_HBM_ADD_CLIENT_RES_CMD          0x8f
116
117#define MEI_HBM_NOTIFY_REQ_CMD              0x10
118#define MEI_HBM_NOTIFY_RES_CMD              0x90
119#define MEI_HBM_NOTIFICATION_CMD            0x11
120
121#define MEI_HBM_DMA_SETUP_REQ_CMD           0x12
122#define MEI_HBM_DMA_SETUP_RES_CMD           0x92
123
124/*
125 * MEI Stop Reason
126 * used by hbm_host_stop_request.reason
127 */
128enum mei_stop_reason_types {
129	DRIVER_STOP_REQUEST = 0x00,
130	DEVICE_D1_ENTRY = 0x01,
131	DEVICE_D2_ENTRY = 0x02,
132	DEVICE_D3_ENTRY = 0x03,
133	SYSTEM_S1_ENTRY = 0x04,
134	SYSTEM_S2_ENTRY = 0x05,
135	SYSTEM_S3_ENTRY = 0x06,
136	SYSTEM_S4_ENTRY = 0x07,
137	SYSTEM_S5_ENTRY = 0x08
138};
139
140
141/**
142 * enum mei_hbm_status  - mei host bus messages return values
143 *
144 * @MEI_HBMS_SUCCESS           : status success
145 * @MEI_HBMS_CLIENT_NOT_FOUND  : client not found
146 * @MEI_HBMS_ALREADY_EXISTS    : connection already established
147 * @MEI_HBMS_REJECTED          : connection is rejected
148 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
149 * @MEI_HBMS_NOT_ALLOWED       : operation not allowed
150 * @MEI_HBMS_ALREADY_STARTED   : system is already started
151 * @MEI_HBMS_NOT_STARTED       : system not started
152 *
153 * @MEI_HBMS_MAX               : sentinel
154 */
155enum mei_hbm_status {
156	MEI_HBMS_SUCCESS           = 0,
157	MEI_HBMS_CLIENT_NOT_FOUND  = 1,
158	MEI_HBMS_ALREADY_EXISTS    = 2,
159	MEI_HBMS_REJECTED          = 3,
160	MEI_HBMS_INVALID_PARAMETER = 4,
161	MEI_HBMS_NOT_ALLOWED       = 5,
162	MEI_HBMS_ALREADY_STARTED   = 6,
163	MEI_HBMS_NOT_STARTED       = 7,
164
165	MEI_HBMS_MAX
166};
167
168
169/*
170 * Client Connect Status
171 * used by hbm_client_connect_response.status
172 */
173enum mei_cl_connect_status {
174	MEI_CL_CONN_SUCCESS          = MEI_HBMS_SUCCESS,
175	MEI_CL_CONN_NOT_FOUND        = MEI_HBMS_CLIENT_NOT_FOUND,
176	MEI_CL_CONN_ALREADY_STARTED  = MEI_HBMS_ALREADY_EXISTS,
177	MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
178	MEI_CL_CONN_MESSAGE_SMALL    = MEI_HBMS_INVALID_PARAMETER,
179	MEI_CL_CONN_NOT_ALLOWED      = MEI_HBMS_NOT_ALLOWED,
180};
181
182/*
183 * Client Disconnect Status
184 */
185enum  mei_cl_disconnect_status {
186	MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
187};
188
189/**
190 * struct mei_msg_hdr - MEI BUS Interface Section
191 *
192 * @me_addr: device address
193 * @host_addr: host address
194 * @length: message length
195 * @reserved: reserved
196 * @dma_ring: message is on dma ring
197 * @internal: message is internal
198 * @msg_complete: last packet of the message
199 * @extension: extension of the header
200 */
201struct mei_msg_hdr {
202	u32 me_addr:8;
203	u32 host_addr:8;
204	u32 length:9;
205	u32 reserved:4;
206	u32 dma_ring:1;
207	u32 internal:1;
208	u32 msg_complete:1;
209	u32 extension[0];
210} __packed;
211
212#define MEI_MSG_HDR_MAX 2
213
214struct mei_bus_message {
215	u8 hbm_cmd;
216	u8 data[0];
217} __packed;
218
219/**
220 * struct hbm_cl_cmd - client specific host bus command
221 *	CONNECT, DISCONNECT, and FlOW CONTROL
222 *
223 * @hbm_cmd: bus message command header
224 * @me_addr: address of the client in ME
225 * @host_addr: address of the client in the driver
226 * @data: generic data
227 */
228struct mei_hbm_cl_cmd {
229	u8 hbm_cmd;
230	u8 me_addr;
231	u8 host_addr;
232	u8 data;
233};
234
235struct hbm_version {
236	u8 minor_version;
237	u8 major_version;
238} __packed;
239
240struct hbm_host_version_request {
241	u8 hbm_cmd;
242	u8 reserved;
243	struct hbm_version host_version;
244} __packed;
245
246struct hbm_host_version_response {
247	u8 hbm_cmd;
248	u8 host_version_supported;
249	struct hbm_version me_max_version;
250} __packed;
251
252struct hbm_host_stop_request {
253	u8 hbm_cmd;
254	u8 reason;
255	u8 reserved[2];
256} __packed;
257
258struct hbm_host_stop_response {
259	u8 hbm_cmd;
260	u8 reserved[3];
261} __packed;
262
263struct hbm_me_stop_request {
264	u8 hbm_cmd;
265	u8 reason;
266	u8 reserved[2];
267} __packed;
268
269/**
270 * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0)
271 *
272 * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add
273 * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately
274 */
275enum hbm_host_enum_flags {
276	MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0),
277	MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1),
278};
279
280/**
281 * struct hbm_host_enum_request - enumeration request from host to fw
282 *
283 * @hbm_cmd : bus message command header
284 * @flags   : request flags
285 * @reserved: reserved
286 */
287struct hbm_host_enum_request {
288	u8 hbm_cmd;
289	u8 flags;
290	u8 reserved[2];
291} __packed;
292
293struct hbm_host_enum_response {
294	u8 hbm_cmd;
295	u8 reserved[3];
296	u8 valid_addresses[32];
297} __packed;
298
299struct mei_client_properties {
300	uuid_le protocol_name;
301	u8 protocol_version;
302	u8 max_number_of_connections;
303	u8 fixed_address;
304	u8 single_recv_buf:1;
305	u8 reserved:7;
306	u32 max_msg_length;
307} __packed;
308
309struct hbm_props_request {
310	u8 hbm_cmd;
311	u8 me_addr;
312	u8 reserved[2];
313} __packed;
314
315struct hbm_props_response {
316	u8 hbm_cmd;
317	u8 me_addr;
318	u8 status;
319	u8 reserved[1];
320	struct mei_client_properties client_properties;
321} __packed;
322
323/**
324 * struct hbm_add_client_request - request to add a client
325 *     might be sent by fw after enumeration has already completed
326 *
327 * @hbm_cmd: bus message command header
328 * @me_addr: address of the client in ME
329 * @reserved: reserved
330 * @client_properties: client properties
331 */
332struct hbm_add_client_request {
333	u8 hbm_cmd;
334	u8 me_addr;
335	u8 reserved[2];
336	struct mei_client_properties client_properties;
337} __packed;
338
339/**
340 * struct hbm_add_client_response - response to add a client
341 *     sent by the host to report client addition status to fw
342 *
343 * @hbm_cmd: bus message command header
344 * @me_addr: address of the client in ME
345 * @status: if HBMS_SUCCESS then the client can now accept connections.
346 * @reserved: reserved
347 */
348struct hbm_add_client_response {
349	u8 hbm_cmd;
350	u8 me_addr;
351	u8 status;
352	u8 reserved[1];
353} __packed;
354
355/**
356 * struct hbm_power_gate - power gate request/response
357 *
358 * @hbm_cmd: bus message command header
359 * @reserved: reserved
360 */
361struct hbm_power_gate {
362	u8 hbm_cmd;
363	u8 reserved[3];
364} __packed;
365
366/**
367 * struct hbm_client_connect_request - connect/disconnect request
368 *
369 * @hbm_cmd: bus message command header
370 * @me_addr: address of the client in ME
371 * @host_addr: address of the client in the driver
372 * @reserved: reserved
373 */
374struct hbm_client_connect_request {
375	u8 hbm_cmd;
376	u8 me_addr;
377	u8 host_addr;
378	u8 reserved;
379} __packed;
380
381/**
382 * struct hbm_client_connect_response - connect/disconnect response
383 *
384 * @hbm_cmd: bus message command header
385 * @me_addr: address of the client in ME
386 * @host_addr: address of the client in the driver
387 * @status: status of the request
388 */
389struct hbm_client_connect_response {
390	u8 hbm_cmd;
391	u8 me_addr;
392	u8 host_addr;
393	u8 status;
394} __packed;
395
396
397#define MEI_FC_MESSAGE_RESERVED_LENGTH           5
398
399struct hbm_flow_control {
400	u8 hbm_cmd;
401	u8 me_addr;
402	u8 host_addr;
403	u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
404} __packed;
405
406#define MEI_HBM_NOTIFICATION_START 1
407#define MEI_HBM_NOTIFICATION_STOP  0
408/**
409 * struct hbm_notification_request - start/stop notification request
410 *
411 * @hbm_cmd: bus message command header
412 * @me_addr: address of the client in ME
413 * @host_addr: address of the client in the driver
414 * @start:  start = 1 or stop = 0 asynchronous notifications
415 */
416struct hbm_notification_request {
417	u8 hbm_cmd;
418	u8 me_addr;
419	u8 host_addr;
420	u8 start;
421} __packed;
422
423/**
424 * struct hbm_notification_response - start/stop notification response
425 *
426 * @hbm_cmd: bus message command header
427 * @me_addr: address of the client in ME
428 * @host_addr: - address of the client in the driver
429 * @status: (mei_hbm_status) response status for the request
430 *  - MEI_HBMS_SUCCESS: successful stop/start
431 *  - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found.
432 *  - MEI_HBMS_ALREADY_STARTED: for start requests for a previously
433 *                         started notification.
434 *  - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom
435 *                         asynchronous notifications are currently disabled.
436 *
437 * @start:  start = 1 or stop = 0 asynchronous notifications
438 * @reserved: reserved
439 */
440struct hbm_notification_response {
441	u8 hbm_cmd;
442	u8 me_addr;
443	u8 host_addr;
444	u8 status;
445	u8 start;
446	u8 reserved[3];
447} __packed;
448
449/**
450 * struct hbm_notification - notification event
451 *
452 * @hbm_cmd: bus message command header
453 * @me_addr:  address of the client in ME
454 * @host_addr:  address of the client in the driver
455 * @reserved: reserved for alignment
456 */
457struct hbm_notification {
458	u8 hbm_cmd;
459	u8 me_addr;
460	u8 host_addr;
461	u8 reserved[1];
462} __packed;
463
464/**
465 * struct hbm_dma_mem_dscr - dma ring
466 *
467 * @addr_hi: the high 32bits of 64 bit address
468 * @addr_lo: the low  32bits of 64 bit address
469 * @size   : size in bytes (must be power of 2)
470 */
471struct hbm_dma_mem_dscr {
472	u32 addr_hi;
473	u32 addr_lo;
474	u32 size;
475} __packed;
476
477enum {
478	DMA_DSCR_HOST = 0,
479	DMA_DSCR_DEVICE = 1,
480	DMA_DSCR_CTRL = 2,
481	DMA_DSCR_NUM,
482};
483
484/**
485 * struct hbm_dma_setup_request - dma setup request
486 *
487 * @hbm_cmd: bus message command header
488 * @reserved: reserved for alignment
489 * @dma_dscr: dma descriptor for HOST, DEVICE, and CTRL
490 */
491struct hbm_dma_setup_request {
492	u8 hbm_cmd;
493	u8 reserved[3];
494	struct hbm_dma_mem_dscr dma_dscr[DMA_DSCR_NUM];
495} __packed;
496
497/**
498 * struct hbm_dma_setup_response - dma setup response
499 *
500 * @hbm_cmd: bus message command header
501 * @status: 0 on success; otherwise DMA setup failed.
502 * @reserved: reserved for alignment
503 */
504struct hbm_dma_setup_response {
505	u8 hbm_cmd;
506	u8 status;
507	u8 reserved[2];
508} __packed;
509
510/**
511 * struct mei_dma_ring_ctrl - dma ring control block
512 *
513 * @hbuf_wr_idx: host circular buffer write index in slots
514 * @reserved1: reserved for alignment
515 * @hbuf_rd_idx: host circular buffer read index in slots
516 * @reserved2: reserved for alignment
517 * @dbuf_wr_idx: device circular buffer write index in slots
518 * @reserved3: reserved for alignment
519 * @dbuf_rd_idx: device circular buffer read index in slots
520 * @reserved4: reserved for alignment
521 */
522struct hbm_dma_ring_ctrl {
523	u32 hbuf_wr_idx;
524	u32 reserved1;
525	u32 hbuf_rd_idx;
526	u32 reserved2;
527	u32 dbuf_wr_idx;
528	u32 reserved3;
529	u32 dbuf_rd_idx;
530	u32 reserved4;
531} __packed;
532
533#endif