aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/file2alias.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2017-10-02 06:38:34 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-02 14:24:41 -0400
commitd1ff70241a275133e1a0258b7c23588b122276c8 (patch)
tree6a17afeb8c80542e7444d7e1530fd856dc7d0fc8 /scripts/mod/file2alias.c
parente69b71f8458b78a2ef44e3d07374a8f46e45123d (diff)
thunderbolt: Add support for XDomain discovery protocol
When two hosts are connected over a Thunderbolt cable, there is a protocol they can use to communicate capabilities supported by the host. The discovery protocol uses automatically configured control channel (ring 0) and is build on top of request/response transactions using special XDomain primitives provided by the Thunderbolt base protocol. The capabilities consists of a root directory block of basic properties used for identification of the host, and then there can be zero or more directories each describing a Thunderbolt service and its capabilities. Once both sides have discovered what is supported the two hosts can setup high-speed DMA paths and transfer data to the other side using whatever protocol was agreed based on the properties. The software protocol used to communicate which DMA paths to enable is service specific. This patch adds support for the XDomain discovery protocol to the Thunderbolt bus. We model each remote host connection as a Linux XDomain device. For each Thunderbolt service found supported on the XDomain device, we create Linux Thunderbolt service device which Thunderbolt service drivers can then bind to based on the protocol identification information retrieved from the property directory describing the service. This code is based on the work done by Amir Levy and Michael Jamet. Signed-off-by: Michael Jamet <michael.jamet@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.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>
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r--scripts/mod/file2alias.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 29d6699d5a06..6ef6e63f96fd 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1301,6 +1301,31 @@ static int do_fsl_mc_entry(const char *filename, void *symval,
1301} 1301}
1302ADD_TO_DEVTABLE("fslmc", fsl_mc_device_id, do_fsl_mc_entry); 1302ADD_TO_DEVTABLE("fslmc", fsl_mc_device_id, do_fsl_mc_entry);
1303 1303
1304/* Looks like: tbsvc:kSpNvNrN */
1305static int do_tbsvc_entry(const char *filename, void *symval, char *alias)
1306{
1307 DEF_FIELD(symval, tb_service_id, match_flags);
1308 DEF_FIELD_ADDR(symval, tb_service_id, protocol_key);
1309 DEF_FIELD(symval, tb_service_id, protocol_id);
1310 DEF_FIELD(symval, tb_service_id, protocol_version);
1311 DEF_FIELD(symval, tb_service_id, protocol_revision);
1312
1313 strcpy(alias, "tbsvc:");
1314 if (match_flags & TBSVC_MATCH_PROTOCOL_KEY)
1315 sprintf(alias + strlen(alias), "k%s", *protocol_key);
1316 else
1317 strcat(alias + strlen(alias), "k*");
1318 ADD(alias, "p", match_flags & TBSVC_MATCH_PROTOCOL_ID, protocol_id);
1319 ADD(alias, "v", match_flags & TBSVC_MATCH_PROTOCOL_VERSION,
1320 protocol_version);
1321 ADD(alias, "r", match_flags & TBSVC_MATCH_PROTOCOL_REVISION,
1322 protocol_revision);
1323
1324 add_wildcard(alias);
1325 return 1;
1326}
1327ADD_TO_DEVTABLE("tbsvc", tb_service_id, do_tbsvc_entry);
1328
1304/* Does namelen bytes of name exactly match the symbol? */ 1329/* Does namelen bytes of name exactly match the symbol? */
1305static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1330static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1306{ 1331{