2 * Thunderbolt control channel messages
4 * Copyright (C) 2014 Andreas Noever <andreas.noever@gmail.com>
5 * Copyright (C) 2017, Intel Corporation
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
15 #include <linux/types.h>
17 enum tb_cfg_pkg_type {
21 TB_CFG_PKG_NOTIFY_ACK = 4,
23 TB_CFG_PKG_XDOMAIN_REQ = 6,
24 TB_CFG_PKG_XDOMAIN_RESP = 7,
25 TB_CFG_PKG_OVERRIDE = 8,
27 TB_CFG_PKG_PREPARE_TO_SLEEP = 0xd,
39 TB_CFG_ERROR_PORT_NOT_CONNECTED = 0,
40 TB_CFG_ERROR_LINK_ERROR = 1,
41 TB_CFG_ERROR_INVALID_CONFIG_SPACE = 2,
42 TB_CFG_ERROR_NO_SUCH_PORT = 4,
43 TB_CFG_ERROR_ACK_PLUG_EVENT = 7, /* send as reply to TB_CFG_PKG_EVENT */
44 TB_CFG_ERROR_LOOP = 8,
45 TB_CFG_ERROR_HEC_ERROR_DETECTED = 12,
46 TB_CFG_ERROR_FLOW_CONTROL_ERROR = 13,
50 struct tb_cfg_header {
52 u32 unknown:10; /* highest order bit is set on replies */
56 /* additional header for read/write packets */
57 struct tb_cfg_address {
58 u32 offset:13; /* in dwords */
59 u32 length:6; /* in dwords */
61 enum tb_cfg_space space:2;
62 u32 seq:2; /* sequence number */
66 /* TB_CFG_PKG_READ, response for TB_CFG_PKG_WRITE */
68 struct tb_cfg_header header;
69 struct tb_cfg_address addr;
72 /* TB_CFG_PKG_WRITE, response for TB_CFG_PKG_READ */
73 struct cfg_write_pkg {
74 struct tb_cfg_header header;
75 struct tb_cfg_address addr;
76 u32 data[64]; /* maximum size, tb_cfg_address.length has 6 bits */
79 /* TB_CFG_PKG_ERROR */
80 struct cfg_error_pkg {
81 struct tb_cfg_header header;
82 enum tb_cfg_error error:4;
85 u32 zero2:2; /* Both should be zero, still they are different fields. */
89 /* TB_CFG_PKG_EVENT */
90 struct cfg_event_pkg {
91 struct tb_cfg_header header;
97 /* TB_CFG_PKG_RESET */
98 struct cfg_reset_pkg {
99 struct tb_cfg_header header;
102 /* TB_CFG_PKG_PREPARE_TO_SLEEP */
104 struct tb_cfg_header header;