.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
---|
1 | 2 | /* |
---|
2 | | - * |
---|
| 3 | + * Copyright (c) 2003-2020, Intel Corporation. All rights reserved |
---|
3 | 4 | * 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 | 5 | */ |
---|
16 | 6 | |
---|
17 | 7 | #ifndef _MEI_HW_TYPES_H_ |
---|
.. | .. |
---|
35 | 25 | /* |
---|
36 | 26 | * MEI Version |
---|
37 | 27 | */ |
---|
38 | | -#define HBM_MINOR_VERSION 0 |
---|
| 28 | +#define HBM_MINOR_VERSION 2 |
---|
39 | 29 | #define HBM_MAJOR_VERSION 2 |
---|
40 | 30 | |
---|
41 | 31 | /* |
---|
.. | .. |
---|
86 | 76 | #define HBM_MINOR_VERSION_DR 1 |
---|
87 | 77 | #define HBM_MAJOR_VERSION_DR 2 |
---|
88 | 78 | |
---|
| 79 | +/* |
---|
| 80 | + * MEI version with vm tag support |
---|
| 81 | + */ |
---|
| 82 | +#define HBM_MINOR_VERSION_VT 2 |
---|
| 83 | +#define HBM_MAJOR_VERSION_VT 2 |
---|
| 84 | + |
---|
| 85 | +/* |
---|
| 86 | + * MEI version with capabilities message support |
---|
| 87 | + */ |
---|
| 88 | +#define HBM_MINOR_VERSION_CAP 2 |
---|
| 89 | +#define HBM_MAJOR_VERSION_CAP 2 |
---|
| 90 | + |
---|
89 | 91 | /* Host bus message command opcode */ |
---|
90 | 92 | #define MEI_HBM_CMD_OP_MSK 0x7f |
---|
91 | 93 | /* Host bus message command RESPONSE */ |
---|
.. | .. |
---|
130 | 132 | |
---|
131 | 133 | #define MEI_HBM_DMA_SETUP_REQ_CMD 0x12 |
---|
132 | 134 | #define MEI_HBM_DMA_SETUP_RES_CMD 0x92 |
---|
| 135 | + |
---|
| 136 | +#define MEI_HBM_CAPABILITIES_REQ_CMD 0x13 |
---|
| 137 | +#define MEI_HBM_CAPABILITIES_RES_CMD 0x93 |
---|
133 | 138 | |
---|
134 | 139 | /* |
---|
135 | 140 | * MEI Stop Reason |
---|
.. | .. |
---|
192 | 197 | /* |
---|
193 | 198 | * Client Disconnect Status |
---|
194 | 199 | */ |
---|
195 | | -enum mei_cl_disconnect_status { |
---|
| 200 | +enum mei_cl_disconnect_status { |
---|
196 | 201 | MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS |
---|
197 | 202 | }; |
---|
| 203 | + |
---|
| 204 | +/** |
---|
| 205 | + * enum mei_ext_hdr_type - extended header type used in |
---|
| 206 | + * extended header TLV |
---|
| 207 | + * |
---|
| 208 | + * @MEI_EXT_HDR_NONE: sentinel |
---|
| 209 | + * @MEI_EXT_HDR_VTAG: vtag header |
---|
| 210 | + */ |
---|
| 211 | +enum mei_ext_hdr_type { |
---|
| 212 | + MEI_EXT_HDR_NONE = 0, |
---|
| 213 | + MEI_EXT_HDR_VTAG = 1, |
---|
| 214 | +}; |
---|
| 215 | + |
---|
| 216 | +/** |
---|
| 217 | + * struct mei_ext_hdr - extend header descriptor (TLV) |
---|
| 218 | + * @type: enum mei_ext_hdr_type |
---|
| 219 | + * @length: length excluding descriptor |
---|
| 220 | + * @ext_payload: payload of the specific extended header |
---|
| 221 | + * @hdr: place holder for actual header |
---|
| 222 | + */ |
---|
| 223 | +struct mei_ext_hdr { |
---|
| 224 | + u8 type; |
---|
| 225 | + u8 length; |
---|
| 226 | + u8 ext_payload[2]; |
---|
| 227 | + u8 hdr[]; |
---|
| 228 | +}; |
---|
| 229 | + |
---|
| 230 | +/** |
---|
| 231 | + * struct mei_ext_meta_hdr - extend header meta data |
---|
| 232 | + * @count: number of headers |
---|
| 233 | + * @size: total size of the extended header list excluding meta header |
---|
| 234 | + * @reserved: reserved |
---|
| 235 | + * @hdrs: extended headers TLV list |
---|
| 236 | + */ |
---|
| 237 | +struct mei_ext_meta_hdr { |
---|
| 238 | + u8 count; |
---|
| 239 | + u8 size; |
---|
| 240 | + u8 reserved[2]; |
---|
| 241 | + struct mei_ext_hdr hdrs[]; |
---|
| 242 | +}; |
---|
| 243 | + |
---|
| 244 | +/* |
---|
| 245 | + * Extended header iterator functions |
---|
| 246 | + */ |
---|
| 247 | +/** |
---|
| 248 | + * mei_ext_hdr - extended header iterator begin |
---|
| 249 | + * |
---|
| 250 | + * @meta: meta header of the extended header list |
---|
| 251 | + * |
---|
| 252 | + * Return: |
---|
| 253 | + * The first extended header |
---|
| 254 | + */ |
---|
| 255 | +static inline struct mei_ext_hdr *mei_ext_begin(struct mei_ext_meta_hdr *meta) |
---|
| 256 | +{ |
---|
| 257 | + return meta->hdrs; |
---|
| 258 | +} |
---|
| 259 | + |
---|
| 260 | +/** |
---|
| 261 | + * mei_ext_last - check if the ext is the last one in the TLV list |
---|
| 262 | + * |
---|
| 263 | + * @meta: meta header of the extended header list |
---|
| 264 | + * @ext: a meta header on the list |
---|
| 265 | + * |
---|
| 266 | + * Return: true if ext is the last header on the list |
---|
| 267 | + */ |
---|
| 268 | +static inline bool mei_ext_last(struct mei_ext_meta_hdr *meta, |
---|
| 269 | + struct mei_ext_hdr *ext) |
---|
| 270 | +{ |
---|
| 271 | + return (u8 *)ext >= (u8 *)meta + sizeof(*meta) + (meta->size * 4); |
---|
| 272 | +} |
---|
| 273 | + |
---|
| 274 | +/** |
---|
| 275 | + *mei_ext_next - following extended header on the TLV list |
---|
| 276 | + * |
---|
| 277 | + * @ext: current extend header |
---|
| 278 | + * |
---|
| 279 | + * Context: The function does not check for the overflows, |
---|
| 280 | + * one should call mei_ext_last before. |
---|
| 281 | + * |
---|
| 282 | + * Return: The following extend header after @ext |
---|
| 283 | + */ |
---|
| 284 | +static inline struct mei_ext_hdr *mei_ext_next(struct mei_ext_hdr *ext) |
---|
| 285 | +{ |
---|
| 286 | + return (struct mei_ext_hdr *)(ext->hdr + (ext->length * 4)); |
---|
| 287 | +} |
---|
198 | 288 | |
---|
199 | 289 | /** |
---|
200 | 290 | * struct mei_msg_hdr - MEI BUS Interface Section |
---|
.. | .. |
---|
203 | 293 | * @host_addr: host address |
---|
204 | 294 | * @length: message length |
---|
205 | 295 | * @reserved: reserved |
---|
| 296 | + * @extended: message has extended header |
---|
206 | 297 | * @dma_ring: message is on dma ring |
---|
207 | 298 | * @internal: message is internal |
---|
208 | 299 | * @msg_complete: last packet of the message |
---|
| 300 | + * @extension: extension of the header |
---|
209 | 301 | */ |
---|
210 | 302 | struct mei_msg_hdr { |
---|
211 | 303 | u32 me_addr:8; |
---|
212 | 304 | u32 host_addr:8; |
---|
213 | 305 | u32 length:9; |
---|
214 | | - u32 reserved:4; |
---|
| 306 | + u32 reserved:3; |
---|
| 307 | + u32 extended:1; |
---|
215 | 308 | u32 dma_ring:1; |
---|
216 | 309 | u32 internal:1; |
---|
217 | 310 | u32 msg_complete:1; |
---|
| 311 | + u32 extension[]; |
---|
218 | 312 | } __packed; |
---|
| 313 | + |
---|
| 314 | +/* The length is up to 9 bits */ |
---|
| 315 | +#define MEI_MSG_MAX_LEN_MASK GENMASK(9, 0) |
---|
219 | 316 | |
---|
220 | 317 | struct mei_bus_message { |
---|
221 | 318 | u8 hbm_cmd; |
---|
222 | | - u8 data[0]; |
---|
| 319 | + u8 data[]; |
---|
223 | 320 | } __packed; |
---|
224 | 321 | |
---|
225 | 322 | /** |
---|
.. | .. |
---|
302 | 399 | u8 valid_addresses[32]; |
---|
303 | 400 | } __packed; |
---|
304 | 401 | |
---|
| 402 | +/** |
---|
| 403 | + * struct mei_client_properties - mei client properties |
---|
| 404 | + * |
---|
| 405 | + * @protocol_name: guid of the client |
---|
| 406 | + * @protocol_version: client protocol version |
---|
| 407 | + * @max_number_of_connections: number of possible connections. |
---|
| 408 | + * @fixed_address: fixed me address (0 if the client is dynamic) |
---|
| 409 | + * @single_recv_buf: 1 if all connections share a single receive buffer. |
---|
| 410 | + * @vt_supported: the client support vtag |
---|
| 411 | + * @reserved: reserved |
---|
| 412 | + * @max_msg_length: MTU of the client |
---|
| 413 | + */ |
---|
305 | 414 | struct mei_client_properties { |
---|
306 | 415 | uuid_le protocol_name; |
---|
307 | 416 | u8 protocol_version; |
---|
308 | 417 | u8 max_number_of_connections; |
---|
309 | 418 | u8 fixed_address; |
---|
310 | | - u8 single_recv_buf; |
---|
| 419 | + u8 single_recv_buf:1; |
---|
| 420 | + u8 vt_supported:1; |
---|
| 421 | + u8 reserved:6; |
---|
311 | 422 | u32 max_msg_length; |
---|
312 | 423 | } __packed; |
---|
313 | 424 | |
---|
.. | .. |
---|
321 | 432 | u8 hbm_cmd; |
---|
322 | 433 | u8 me_addr; |
---|
323 | 434 | u8 status; |
---|
324 | | - u8 reserved[1]; |
---|
| 435 | + u8 reserved; |
---|
325 | 436 | struct mei_client_properties client_properties; |
---|
326 | 437 | } __packed; |
---|
327 | 438 | |
---|
.. | .. |
---|
354 | 465 | u8 hbm_cmd; |
---|
355 | 466 | u8 me_addr; |
---|
356 | 467 | u8 status; |
---|
357 | | - u8 reserved[1]; |
---|
| 468 | + u8 reserved; |
---|
358 | 469 | } __packed; |
---|
359 | 470 | |
---|
360 | 471 | /** |
---|
.. | .. |
---|
463 | 574 | u8 hbm_cmd; |
---|
464 | 575 | u8 me_addr; |
---|
465 | 576 | u8 host_addr; |
---|
466 | | - u8 reserved[1]; |
---|
| 577 | + u8 reserved; |
---|
467 | 578 | } __packed; |
---|
468 | 579 | |
---|
469 | 580 | /** |
---|
.. | .. |
---|
512 | 623 | u8 reserved[2]; |
---|
513 | 624 | } __packed; |
---|
514 | 625 | |
---|
| 626 | +/** |
---|
| 627 | + * struct mei_dma_ring_ctrl - dma ring control block |
---|
| 628 | + * |
---|
| 629 | + * @hbuf_wr_idx: host circular buffer write index in slots |
---|
| 630 | + * @reserved1: reserved for alignment |
---|
| 631 | + * @hbuf_rd_idx: host circular buffer read index in slots |
---|
| 632 | + * @reserved2: reserved for alignment |
---|
| 633 | + * @dbuf_wr_idx: device circular buffer write index in slots |
---|
| 634 | + * @reserved3: reserved for alignment |
---|
| 635 | + * @dbuf_rd_idx: device circular buffer read index in slots |
---|
| 636 | + * @reserved4: reserved for alignment |
---|
| 637 | + */ |
---|
| 638 | +struct hbm_dma_ring_ctrl { |
---|
| 639 | + u32 hbuf_wr_idx; |
---|
| 640 | + u32 reserved1; |
---|
| 641 | + u32 hbuf_rd_idx; |
---|
| 642 | + u32 reserved2; |
---|
| 643 | + u32 dbuf_wr_idx; |
---|
| 644 | + u32 reserved3; |
---|
| 645 | + u32 dbuf_rd_idx; |
---|
| 646 | + u32 reserved4; |
---|
| 647 | +} __packed; |
---|
| 648 | + |
---|
| 649 | +/* virtual tag supported */ |
---|
| 650 | +#define HBM_CAP_VT BIT(0) |
---|
| 651 | + |
---|
| 652 | +/** |
---|
| 653 | + * struct hbm_capability_request - capability request from host to fw |
---|
| 654 | + * |
---|
| 655 | + * @hbm_cmd : bus message command header |
---|
| 656 | + * @capability_requested: bitmask of capabilities requested by host |
---|
| 657 | + */ |
---|
| 658 | +struct hbm_capability_request { |
---|
| 659 | + u8 hbm_cmd; |
---|
| 660 | + u8 capability_requested[3]; |
---|
| 661 | +} __packed; |
---|
| 662 | + |
---|
| 663 | +/** |
---|
| 664 | + * struct hbm_capability_response - capability response from fw to host |
---|
| 665 | + * |
---|
| 666 | + * @hbm_cmd : bus message command header |
---|
| 667 | + * @capability_granted: bitmask of capabilities granted by FW |
---|
| 668 | + */ |
---|
| 669 | +struct hbm_capability_response { |
---|
| 670 | + u8 hbm_cmd; |
---|
| 671 | + u8 capability_granted[3]; |
---|
| 672 | +} __packed; |
---|
| 673 | + |
---|
515 | 674 | #endif |
---|