From nobody Mon Jul 18 09:50:13 2022 X-Original-To: dev-commits-src-all@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 4Lmcdd4Qsxz4WtHM; Mon, 18 Jul 2022 09:50:13 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lmcdd3KR3z3DL9; Mon, 18 Jul 2022 09:50:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658137813; 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=7Uu15PKZXwuoyhg8P0eXJzpVZOG/tYi3gChFuT9GH8g=; b=ApKWX0VcTC+L1l39ka6XycqQx31HOPp3kWZ54/ye/y5yuGx17buYRV2XBC2+PuLcLmhJWH rYJosEgDnfOQDz47kdOoFqh5KVoN9qqiAjCAGtSc4SZKsdlTT8SNjpnx3ilptGXs+HVbCQ LmhEkJmQVSuVMkJGsWMOv+2Hk6hdtl1PCcD+cW0ICcJ6499Ak8ZQUtKGlU6n11i3mpYZy3 0lvd88YcOeOZF3EHIgTyLiH3Bzxn//cPAPYj7FRwcqs+B3wjN109ElA2TVKyJ+6TY4f/bn stazi1a3pWl97zhYh5VIR9SW95nXoUGeNcK9O1ALR37jfuXzUK/Zn6nkY2pYuA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Lmcdd2Q65zb2R; Mon, 18 Jul 2022 09:50:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26I9oDYd035485; Mon, 18 Jul 2022 09:50:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26I9oD88035477; Mon, 18 Jul 2022 09:50:13 GMT (envelope-from git) Date: Mon, 18 Jul 2022 09:50:13 GMT Message-Id: <202207180950.26I9oD88035477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ae33d74d47ef - stable/13 - dwc3: improve debugging List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ae33d74d47ef014ebbd4f07d49b3bd81dfac2707 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658137813; 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=7Uu15PKZXwuoyhg8P0eXJzpVZOG/tYi3gChFuT9GH8g=; b=Z+nH4UBLHp9gdZVLg/yvyjrw85NptaFVrU0GBXBsZy6ElovRYEBhpHqKwE6MrS3xMMrBck jQvqR0gclKCvHra++v7kGYycJIArMIfFFq2lFUnZexpz/mbfMo1fTh5zEJ06hw/q4Biqr/ 4G5Yte2OXBHPeEha+oeBhIFlIlo11Y2OFnaA5nkhUpBnamQ3LFVspAAJftX5op7tZwRwFG PUtYgwIu6lgHaeBJpJabl/myCc801isAXRYDiifH3SKL6dqFwROAdWw/uvHdHplGZ5+WO+ MV/dCBMy9/Ofwvfcev/QB9jfJv70Y6DPpoVp/BYQ3Qk020bjatauQRYufOa1Yw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658137813; a=rsa-sha256; cv=none; b=WHJrJqLJTjz0uXbUnzfIrM78eN521GudYL7XBLwMgNlGbuqRarOyFIxAIYyCHRcvYfHP96 YVss/tb6T3e6vCNsLFR5y8BLL9omBnhsFEXNYkyAZcHMc4nRfkGGBGqAVN+3wF7OzLp3Qg E6haIMe92p0GBTP7axUQQB80apdabrJWRaNTURFoLRgFqe1sw5gPEb79ClDvBVh/jNu8hm 0JMo6KbyBBgTu6qEf1Oy/3kuInprMhRroS9ZJZ5oL12J/GSJxjdaGyjiIYbVVDFgBpdSeA RJtOdyhIwjK46OshVeC6mTS/Wcr2VjE/7TXhvVG0IqzahZ7OL7m0I5Gfw3NPSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ae33d74d47ef014ebbd4f07d49b3bd81dfac2707 commit ae33d74d47ef014ebbd4f07d49b3bd81dfac2707 Author: Bjoern A. Zeeb AuthorDate: 2022-07-02 21:10:00 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-07-18 01:00:21 +0000 dwc3: improve debugging Rather than hiding behind #if 0, hide the debugging behind DWC3_DEBUG so it can be turned on with a single define. Require bootverbose to print anything so we can still avoid spamming the console if DWC3_DEBUG is on. Harmonize the format string in snsp_dwc3_dump_regs() to always print the full register and also print the XHCI quirks. Call snsp_dwc3_dump_regs() twice, before and after generic XHCI attachment and initialisation as this may have an effect on the confirgumation state. Obtained from: an old debug patch Reviewed by: mw Differential Revision: https://reviews.freebsd.org/D35700 (cherry picked from commit 11a7d5e5d906f691558e06d4bb93b892de31b446) --- sys/dev/usb/controller/dwc3.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/sys/dev/usb/controller/dwc3.c b/sys/dev/usb/controller/dwc3.c index 596fcb19ce1a..cf51de36f354 100644 --- a/sys/dev/usb/controller/dwc3.c +++ b/sys/dev/usb/controller/dwc3.c @@ -147,22 +147,33 @@ snps_dwc3_attach_xhci(device_t dev) return (0); } -#if 0 +#ifdef DWC3_DEBUG static void -snsp_dwc3_dump_regs(struct snps_dwc3_softc *sc) +snsp_dwc3_dump_regs(struct snps_dwc3_softc *sc, const char *msg) { + struct xhci_softc *xsc; uint32_t reg; + if (!bootverbose) + return; + + device_printf(sc->dev, "%s: %s:\n", __func__, msg ? msg : ""); + reg = DWC3_READ(sc, DWC3_GCTL); - device_printf(sc->dev, "GCTL: %x\n", reg); + device_printf(sc->dev, "GCTL: %#012x\n", reg); + reg = DWC3_READ(sc, DWC3_GUCTL); + device_printf(sc->dev, "GUCTL: %#012x\n", reg); reg = DWC3_READ(sc, DWC3_GUCTL1); - device_printf(sc->dev, "GUCTL1: %x\n", reg); + device_printf(sc->dev, "GUCTL1: %#012x\n", reg); reg = DWC3_READ(sc, DWC3_GUSB2PHYCFG0); - device_printf(sc->dev, "GUSB2PHYCFG0: %x\n", reg); + device_printf(sc->dev, "GUSB2PHYCFG0: %#012x\n", reg); reg = DWC3_READ(sc, DWC3_GUSB3PIPECTL0); - device_printf(sc->dev, "GUSB3PIPECTL0: %x\n", reg); + device_printf(sc->dev, "GUSB3PIPECTL0: %#012x\n", reg); reg = DWC3_READ(sc, DWC3_DCFG); - device_printf(sc->dev, "DCFG: %x\n", reg); + device_printf(sc->dev, "DCFG: %#012x\n", reg); + + xsc = &sc->sc; + device_printf(sc->dev, "xhci quirks: %#012x\n", xsc->sc_quirks); } #endif @@ -385,10 +396,14 @@ snps_dwc3_attach(device_t dev) snps_dwc3_configure_host(sc); snps_dwc3_configure_phy(sc); snps_dwc3_do_quirks(sc); -#if 0 - snsp_dwc3_dump_regs(sc); + +#ifdef DWC3_DEBUG + snsp_dwc3_dump_regs(sc, "Pre XHCI init"); #endif snps_dwc3_attach_xhci(dev); +#ifdef DWC3_DEBUG + snsp_dwc3_dump_regs(sc, "Post XHCI init"); +#endif return (0); }