Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178357004
D49452.1796568169.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D49452.1796568169.diff
View Options
diff --git a/sys/dev/thunderbolt/nhi.c b/sys/dev/thunderbolt/nhi.c
--- a/sys/dev/thunderbolt/nhi.c
+++ b/sys/dev/thunderbolt/nhi.c
@@ -238,8 +238,9 @@
int
nhi_attach(struct nhi_softc *sc)
{
- uint32_t val;
- int error = 0;
+ uint32_t val;
+ struct nhi_host_caps caps;
+ int error = 0;
if ((error = nhi_setup_sysctl(sc)) != 0)
return (error);
@@ -247,13 +248,25 @@
mtx_init(&sc->nhi_mtx, "nhimtx", "NHI Control Mutex", MTX_DEF);
/*
- * Get the number of TX/RX paths. This sizes some of the register
- * arrays during allocation and initialization. USB4 spec says that
- * the max is 21.
+ * Get the host interface version and number of TX/RX paths. This
+ * sizes some of the register arrays during allocation and
+ * initialization. USB4 spec says that the max is 21.
*/
- val = GET_HOST_CAPS_PATHS(nhi_read_reg(sc, NHI_HOST_CAPS));
- tb_debug(sc, DBG_INIT|DBG_NOISY, "Total Paths= %d\n", val);
- if (val == 0 || val > 21) {
+ val = nhi_read_reg(sc, NHI_HOST_CAPS);
+ caps = *(struct nhi_host_caps *)&val;
+ if (caps.version_major == 0 && caps.version_minor == 0) {
+ tb_printf(sc, "Host interface is version 1.0\n");
+ sc->ver = NHI_VER_1_0;
+ } else if (caps.version_major == 2 && caps.version_minor == 0) {
+ tb_printf(sc, "Host interface is version 2.0\n");
+ sc->ver = NHI_VER_2_0;
+ } else {
+ tb_printf(sc, "WARN: unexpected host interface version %d.%d -"
+ " assuming 1.0\n", caps.version_major, caps.version_minor);
+ sc->ver = NHI_VER_1_0;
+ }
+ tb_debug(sc, DBG_INIT|DBG_NOISY, "Total Paths= %d\n", caps.total_paths);
+ if (caps.total_paths == 0 || caps.total_paths > 21) {
tb_printf(sc, "WARN: unexpected number of paths: %d\n", val);
/* return (ENXIO); */
}
diff --git a/sys/dev/thunderbolt/nhi_reg.h b/sys/dev/thunderbolt/nhi_reg.h
--- a/sys/dev/thunderbolt/nhi_reg.h
+++ b/sys/dev/thunderbolt/nhi_reg.h
@@ -176,7 +176,15 @@
/* Native Host Interface Control registers */
#define NHI_HOST_CAPS 0x39640
-#define GET_HOST_CAPS_PATHS(val) ((val) & 0x3f)
+
+/* Host Interface Capabilities, 12.6.3.1.1 */
+struct nhi_host_caps {
+ uint32_t total_paths:11;
+ uint8_t reserved1:5;
+ uint8_t version_major:3;
+ uint8_t version_minor:5;
+ uint8_t reserved0:8;
+} __packed;
/*
* This definition comes from the Linux driver. In the USB4 spec, this
diff --git a/sys/dev/thunderbolt/nhi_var.h b/sys/dev/thunderbolt/nhi_var.h
--- a/sys/dev/thunderbolt/nhi_var.h
+++ b/sys/dev/thunderbolt/nhi_var.h
@@ -186,6 +186,11 @@
uint8_t uuid[16];
uint8_t lc_uuid[16];
+
+ enum {
+ NHI_VER_1_0,
+ NHI_VER_2_0,
+ } ver;
};
struct nhi_dispatch {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 6, 2:42 PM (13 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42258932
Default Alt Text
D49452.1796568169.diff (2 KB)
Attached To
Mode
D49452: USB4 host reset (& writing to router config space)
Attached
Detach File
Event Timeline