aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2017-10-02 06:38:32 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-02 14:24:41 -0400
commit9e99b9f4d5c36340dabda6d14053195b2a43796b (patch)
tree1e9ee5171932197a6c2836911a5dce15cf28d48b
parenteaf8ff35a345449207ad116e2574c19780ec9a98 (diff)
thunderbolt: Move thunderbolt domain structure to thunderbolt.h
These are needed by Thunderbolt services so move them to thunderbolt.h to make sure they are available outside of drivers/thunderbolt. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Michael Jamet <michael.jamet@intel.com> Reviewed-by: Yehezkel Bernat <yehezkel.bernat@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/thunderbolt/tb.h42
-rw-r--r--include/linux/thunderbolt.h45
2 files changed, 45 insertions, 42 deletions
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index e0deee4f1eb0..2fefe76621ca 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -39,20 +39,6 @@ struct tb_switch_nvm {
39 bool authenticating; 39 bool authenticating;
40}; 40};
41 41
42/**
43 * enum tb_security_level - Thunderbolt security level
44 * @TB_SECURITY_NONE: No security, legacy mode
45 * @TB_SECURITY_USER: User approval required at minimum
46 * @TB_SECURITY_SECURE: One time saved key required at minimum
47 * @TB_SECURITY_DPONLY: Only tunnel Display port (and USB)
48 */
49enum tb_security_level {
50 TB_SECURITY_NONE,
51 TB_SECURITY_USER,
52 TB_SECURITY_SECURE,
53 TB_SECURITY_DPONLY,
54};
55
56#define TB_SWITCH_KEY_SIZE 32 42#define TB_SWITCH_KEY_SIZE 32
57/* Each physical port contains 2 links on modern controllers */ 43/* Each physical port contains 2 links on modern controllers */
58#define TB_SWITCH_LINKS_PER_PHY_PORT 2 44#define TB_SWITCH_LINKS_PER_PHY_PORT 2
@@ -223,33 +209,6 @@ struct tb_cm_ops {
223 int (*disconnect_pcie_paths)(struct tb *tb); 209 int (*disconnect_pcie_paths)(struct tb *tb);
224}; 210};
225 211
226/**
227 * struct tb - main thunderbolt bus structure
228 * @dev: Domain device
229 * @lock: Big lock. Must be held when accessing any struct
230 * tb_switch / struct tb_port.
231 * @nhi: Pointer to the NHI structure
232 * @ctl: Control channel for this domain
233 * @wq: Ordered workqueue for all domain specific work
234 * @root_switch: Root switch of this domain
235 * @cm_ops: Connection manager specific operations vector
236 * @index: Linux assigned domain number
237 * @security_level: Current security level
238 * @privdata: Private connection manager specific data
239 */
240struct tb {
241 struct device dev;
242 struct mutex lock;
243 struct tb_nhi *nhi;
244 struct tb_ctl *ctl;
245 struct workqueue_struct *wq;
246 struct tb_switch *root_switch;
247 const struct tb_cm_ops *cm_ops;
248 int index;
249 enum tb_security_level security_level;
250 unsigned long privdata[0];
251};
252
253static inline void *tb_priv(struct tb *tb) 212static inline void *tb_priv(struct tb *tb)
254{ 213{
255 return (void *)tb->privdata; 214 return (void *)tb->privdata;
@@ -368,7 +327,6 @@ static inline int tb_port_write(struct tb_port *port, const void *buffer,
368struct tb *icm_probe(struct tb_nhi *nhi); 327struct tb *icm_probe(struct tb_nhi *nhi);
369struct tb *tb_probe(struct tb_nhi *nhi); 328struct tb *tb_probe(struct tb_nhi *nhi);
370 329
371extern struct bus_type tb_bus_type;
372extern struct device_type tb_domain_type; 330extern struct device_type tb_domain_type;
373extern struct device_type tb_switch_type; 331extern struct device_type tb_switch_type;
374 332
diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h
index b512b1e2b4f2..910b1bf92112 100644
--- a/include/linux/thunderbolt.h
+++ b/include/linux/thunderbolt.h
@@ -14,7 +14,9 @@
14#ifndef THUNDERBOLT_H_ 14#ifndef THUNDERBOLT_H_
15#define THUNDERBOLT_H_ 15#define THUNDERBOLT_H_
16 16
17#include <linux/device.h>
17#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/mutex.h>
18#include <linux/uuid.h> 20#include <linux/uuid.h>
19 21
20enum tb_cfg_pkg_type { 22enum tb_cfg_pkg_type {
@@ -34,6 +36,49 @@ enum tb_cfg_pkg_type {
34}; 36};
35 37
36/** 38/**
39 * enum tb_security_level - Thunderbolt security level
40 * @TB_SECURITY_NONE: No security, legacy mode
41 * @TB_SECURITY_USER: User approval required at minimum
42 * @TB_SECURITY_SECURE: One time saved key required at minimum
43 * @TB_SECURITY_DPONLY: Only tunnel Display port (and USB)
44 */
45enum tb_security_level {
46 TB_SECURITY_NONE,
47 TB_SECURITY_USER,
48 TB_SECURITY_SECURE,
49 TB_SECURITY_DPONLY,
50};
51
52/**
53 * struct tb - main thunderbolt bus structure
54 * @dev: Domain device
55 * @lock: Big lock. Must be held when accessing any struct
56 * tb_switch / struct tb_port.
57 * @nhi: Pointer to the NHI structure
58 * @ctl: Control channel for this domain
59 * @wq: Ordered workqueue for all domain specific work
60 * @root_switch: Root switch of this domain
61 * @cm_ops: Connection manager specific operations vector
62 * @index: Linux assigned domain number
63 * @security_level: Current security level
64 * @privdata: Private connection manager specific data
65 */
66struct tb {
67 struct device dev;
68 struct mutex lock;
69 struct tb_nhi *nhi;
70 struct tb_ctl *ctl;
71 struct workqueue_struct *wq;
72 struct tb_switch *root_switch;
73 const struct tb_cm_ops *cm_ops;
74 int index;
75 enum tb_security_level security_level;
76 unsigned long privdata[0];
77};
78
79extern struct bus_type tb_bus_type;
80
81/**
37 * struct tb_property_dir - XDomain property directory 82 * struct tb_property_dir - XDomain property directory
38 * @uuid: Directory UUID or %NULL if root directory 83 * @uuid: Directory UUID or %NULL if root directory
39 * @properties: List of properties in this directory 84 * @properties: List of properties in this directory