From nobody Fri Dec 5 10:18:56 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dN6mK1B6Sz6Kmc7 for ; Fri, 05 Dec 2025 10:18:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dN6mJ6RqRz49qF for ; Fri, 05 Dec 2025 10:18:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764929936; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7nJmXp/9TpJkPf0By7k/rar4VmPRQDYgGgKpaAZ2S8w=; b=Unbbc1CqQ+sxI8V5b/BE0lElQzFBiGg7JH4eXovfbJrBFQYMloMNBoAFOdEFCQQpzMMOij hZLbUeSReZ3R0hCG9Fvbss7jvWyM92Ih46HElwlv7IMR38wAp9DU5up91FCqHxNx4u2Bc0 JV6qA+25SVgS4eLMZRpNjQmVGXmsjHC/0X4InO4bwEUV+n1J0IC9WOGinzbJA5zi+CpAs/ 4yu6hAgbhH2oJQfGXXOomVxKqyAdONQ6qvh8zXjxCZX27wldC6g5qi2pY15K/WU6UuGwmv 0UcdipPjRd7W36AssQFQTShgVs9UZCxip/goHyvceK1stkKwREauZ60udJiwBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764929936; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7nJmXp/9TpJkPf0By7k/rar4VmPRQDYgGgKpaAZ2S8w=; b=G+BySgrOQu+Nz76ok4CeWIG5iHGMDNEXw/a8SKQn5714ilTDdD8qkaha7QvUtktO+Xxyl6 tgZdN5EJ9XnPgYk9ZPr5K6a9AhdSrA3zJnp8uP5Nsa5REhqFerk80kxJ0n71GhmsTqAPAJ YYQEN564WY6ys2J7/olyeT3PJABz+eTQJFz3Fm7rVvM9rd9skoAEJpahJRpYImxvI2Ys9b FWOt7Wjzl6Scp3d2SpL5LUPkS6kJCzzKNLvd8JDefNDhSyRvn/AYyE6zNNCStEvF1gZtpi lkD2LPScwYEYKhFeJaKkwU2ZRT85hRYLNUfIadVw/7hQe0fHAM/inUKJwk5n8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764929936; a=rsa-sha256; cv=none; b=shgl7w3bEMLaEQTW5cGEZJqsi+UEZpma2fM/X0kNyIx36kk8gB4jLM4qrJRroXeDZApimA lxB5Ust0xinOEy+3xTtmWSW0CvwDwIE7/bB7D+LMeGkH6fWpBzFHIKP2mNy5ASxhYZwGst paOfHPMhU5Wv6PcYFzQTCHO0cQYLQRFOYzjn1XDUzqWzwIWJBkqrcTqjH8F3lkzA3UvlpU ak2wCqRoRZZZI3Vd04/ZfEdXkwF0ff5yOx4sgN9YPlUAMkHITMkLuXCSzkPPRfgm7RRY7Q xuzv6OEjlzpY4q6UvXegAxx+/YvE5aHFfgDxA2G3ZnhqK6WAUiM3hLA19YnqIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dN6mJ63Hxz15FY for ; Fri, 05 Dec 2025 10:18:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 357ad by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 05 Dec 2025 10:18:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tom Jones Subject: git: a0dd6022391a - main - xhci: Add header values for Debug Capability (DbC) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: thj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a0dd6022391aa33b035962d69965ef506cc46a20 Auto-Submitted: auto-generated Date: Fri, 05 Dec 2025 10:18:56 +0000 Message-Id: <6932b190.357ad.1b27ce4@gitrepo.freebsd.org> The branch main has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=a0dd6022391aa33b035962d69965ef506cc46a20 commit a0dd6022391aa33b035962d69965ef506cc46a20 Author: Tom Jones AuthorDate: 2025-12-05 10:09:30 +0000 Commit: Tom Jones CommitDate: 2025-12-05 10:18:02 +0000 xhci: Add header values for Debug Capability (DbC) Add header values for xHCI debug capability. These values are defined in section 7.6 of xHCI Specification 1.2b (April 2023). Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D53897 --- sys/dev/usb/controller/xhcireg.h | 121 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/sys/dev/usb/controller/xhcireg.h b/sys/dev/usb/controller/xhcireg.h index 3e3ad278bcba..c4f62586a0d0 100644 --- a/sys/dev/usb/controller/xhcireg.h +++ b/sys/dev/usb/controller/xhcireg.h @@ -211,6 +211,127 @@ #define XHCI_ID_EXT_MSI 0x0011 #define XHCI_ID_USB3_TUN 0x0012 +/* + * XHCI Debug Capability + * From Section 7.6 of xHCI April 2023 Revision 1.2b. + */ +#define XHCI_DCID 0x0000 + +#define XHCI_DCDB 0x0004 /* Doorbell */ +#define XHCI_DCDB_OUT 0x00000000 +#define XHCI_DCDB_IN 0x00000100 +#define XHCI_DCDB_INVAL 0x0000FE00 + +#define XHCI_DCERSTSZ 0x0008 /* Event Ring Segment Table size */ +#define XHCI_DCERSTBA_LO 0x0010 +#define XHCI_DCERSTBA_HI 0x0014 +#define XHCI_DCERDP_LO 0x0018 +#define XHCI_DCERDP_HI 0x001C + +#define XHCI_DCCTRL 0x0020 /* Debug Control */ +#define XHCI_DCCTRL_DCR 0x00000001 +#define XHCI_DCCTRL_DCR_GET(x) (((x) ) & 0x01) +#define XHCI_DCCTRL_LSE 0x00000002 +#define XHCI_DCCTRL_LSE_GET(x) (((x) >> 1) & 0x01) +#define XHCI_DCCTRL_HOT 0x00000004 +#define XHCI_DCCTRL_HOT_GET(x) (((x) >> 2) & 0x01) +#define XHCI_DCCTRL_HIT 0x00000008 +#define XHCI_DCCTRL_HIT_GET(x) (((x) >> 3) & 0x01) +#define XHCI_DCCTRL_DRC 0x00000010 +#define XHCI_DCCTRL_DRC_GET(x) (((x) >> 4) & 0x01) +#define XHCI_DCCTRL_MBS_GET(x) (((x) >> 16) & 0xFF) +#define XHCI_DCCTRL_ADDR_GET(x) (((x) >> 24) & 0x7F) +#define XHCI_DCCTRL_DCE 0x80000000 +#define XHCI_DCCTRL_DCE_GET(x) (((x) >> 31) & 0x01) + +#define XHCI_DCST 0x0024 /* Status */ +#define XHCI_DCST_ER 0x00000001 +#define XHCI_DCST_ER_GET(x) (((x) ) & 0x01) +#define XHCI_DCST_SBR 0x00000002 +#define XHCI_DCST_SBR_GET(x) (((x) >> 1) & 0x01) +#define XHCI_DCST_PORT_GET(x) (((x) >> 24) & 0xFF) + +#define XHCI_DCPORTSC 0x0028 /* Port Control */ +#define XHCI_DCPORTSC_CCS 0x00000001 +#define XHCI_DCPORTSC_CCS_GET(x) (((x) ) & 0x01) +#define XHCI_DCPORTSC_PED 0x00000002 +#define XHCI_DCPORTSC_PED_GET(x) (((x) >> 1) & 0x01) +#define XHCI_DCPORTSC_PR 0x00000010 +#define XHCI_DCPORTSC_PR_GET(x) (((x) >> 4) & 0x01) +#define XHCI_DCPORTSC_PLS_GET(x) (((x) >> 5) & 0x0F) +#define XHCI_DCPORTSC_PLS_U0 0x00 +#define XHCI_DCPORTSC_PLS_U1 0x01 +#define XHCI_DCPORTSC_PLS_U2 0x02 +#define XHCI_DCPORTSC_PLS_U3 0x03 +#define XHCI_DCPORTSC_PLS_DISABLED 0x04 +#define XHCI_DCPORTSC_PLS_RXDETECTED 0x05 +#define XHCI_DCPORTSC_PLS_INACTIVE 0x06 +#define XHCI_DCPORTSC_PLS_POLLING 0x07 +#define XHCI_DCPORTSC_PLS_RECOVERY 0x08 +#define XHCI_DCPORTSC_PLS_HOTRESET 0x09 +#define XHCI_DCPORTSC_SPEED_GET(x) (((x) >> 10) & 0x0F) +#define XHCI_DCPORTSC_CSC 0x00020000 +#define XHCI_DCPORTSC_CSC_GET(x) (((x) >> 17) & 0x01) +#define XHCI_DCPORTSC_PRC 0x00200000 +#define XHCI_DCPORTSC_PRC_GET(x) (((x) >> 21) & 0x01) +#define XHCI_DCPORTSC_PLC 0x00400000 +#define XHCI_DCPORTSC_PLC_GET(x) (((x) >> 22) & 0x01) +#define XHCI_DCPORTSC_CEC 0x00800000 +#define XHCI_DCPORTSC_CEC_GET(x) (((x) >> 23) & 0x01) +#define XHCI_DCCP_LO 0x0030 /* Context Pointer */ +#define XHCI_DCCP_HI 0x0034 +#define XHCI_DCDDI1 0x0038 /* Device Descriptor Info */ +#define XHCI_DCDDI2 0x003C /* Device Descriptor Info */ + +/* DbC CIC offset in uint32 */ +#define XHCI_DCDBCIC_STR0DESC_LO 0x0000 +#define XHCI_DCDBCIC_STR0DESC_HI 0x0001 +#define XHCI_DCDBCIC_MANUDESC_LO 0x0002 +#define XHCI_DCDBCIC_MANUDESC_HI 0x0003 +#define XHCI_DCDBCIC_PRODDESC_LO 0x0004 +#define XHCI_DCDBCIC_PRODDESC_HI 0x0005 +#define XHCI_DCDBCIC_SERIALDESC_LO 0x0006 +#define XHCI_DCDBCIC_SERIALDESC_HI 0x0007 +#define XHCI_DCDBCIC_DESCLEN 0x0008 +#define XHCI_DCDBCIC_STR0DESC_LEN_GET(x) (((x) >> 0) & 0xff) +#define XHCI_DCDBCIC_STR0DESC_LEN_SET(x) (((x) & 0xff) << 0) +#define XHCI_DCDBCIC_MANUDESC_LEN_GET(x) (((x) >> 8) & 0xff) +#define XHCI_DCDBCIC_MANUDESC_LEN_SET(x) (((x) & 0xff) << 8) +#define XHCI_DCDBCIC_PRODDESC_LEN_GET(x) (((x) >> 16) & 0xff) +#define XHCI_DCDBCIC_PRODDESC_LEN_SET(x) (((x) & 0xff) << 16) +#define XHCI_DCDBCIC_SERIALDESC_LEN_GET(x) (((x) >> 24) & 0xff) +#define XHCI_DCDBCIC_SERIALDESC_LEN_SET(x) (((x) & 0xff) << 24) + +#define XHCI_DCSTATUS(ctrl, portsc) \ + (XHCI_DCCTRL_DCE_GET(ctrl) << 4 | \ + XHCI_DCPORTSC_CCS_GET(portsc) << 3 | \ + XHCI_DCPORTSC_PED_GET(portsc) << 2 | \ + XHCI_DCPORTSC_PR_GET(portsc) << 1 | \ + XHCI_DCCTRL_DCR_GET(ctrl)) +#define XHCI_DCPORTSC_ACK_MASK \ + (XHCI_DCPORTSC_PED | \ + XHCI_DCPORTSC_CSC | XHCI_DCPORTSC_PRC | \ + XHCI_DCPORTSC_PLC | XHCI_DCPORTSC_CEC) + +#define XHCI_DCPORT_ST_OFF 0x00 +#define XHCI_DCPORT_ST_DISCONNECTED 0x10 /* DCE only */ +#define XHCI_DCPORT_ST_DISCONNECTED_RUNNING 0x11 /* XXX: DCE + DCR */ +#define XHCI_DCPORT_ST_DISABLED 0x18 /* DCE + CCS */ +#define XHCI_DCPORT_ST_RESETTING 0x1a /* DCE + CCS + PR */ +#define XHCI_DCPORT_ST_ENABLED 0x1c /* DCE + CCS + PED */ +#define XHCI_DCPORT_ST_CONFIGURED 0x1d /* DCE + CCS + PED + DCR */ + +#define XHCI_DC_MAXPACKETLEN 1024 +/* + * While Sec 7.6.3.2 describes Endpoint IDs should be 0 or 1, + * Intel chips use Device Context Index (Sec 4.5.1) instead. + */ +#define XHCI_DC_EPID_OUT 0 +#define XHCI_DC_EPID_IN 1 +#define XHCI_DC_EPID_OUT_INTEL 2 +#define XHCI_DC_EPID_IN_INTEL 3 +#define XHCI_DC_SLOT 1 + /* XHCI register R/W wrappers */ #define XREAD1(sc, what, a) \ bus_space_read_1((sc)->sc_io_tag, (sc)->sc_io_hdl, \