From nobody Sun Jul 3 22:21:27 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 1B51A8AABA4; Sun, 3 Jul 2022 22:21:28 +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 4Lbk1N06jJz4WPK; Sun, 3 Jul 2022 22:21:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656886888; 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=Mu07j7JkhUBmZKaiT6YpxQc2BntnblDJkOyaRoj/wQ8=; b=WPx17WfU2R+hqpkPV0bp3QUyg2RAYztvKcf4OW9tMNUyQCeHPryY49yy6/6TX0Ezo6hQyv VOD26TLalsjrERsFwhAj8nP5V2GsxhifZHUQlhMYNGlXt86KxXxZ7cOBflbaBpIyTpUP8s wLGBvu/8X3zXgMu8vFsoIesb2A5gIM8KXZPcr0ome+s8wZ24O1h4GgTBD/CxQFvpvTgXMc bePEQCDmQgNqvfrs8pnXksm6d+AJuw3F0sr0X9YYX4KsG4T08dQq8XJXOYSCjXSFbgBR0s Zsn9tn865Gq6nqH3m7kSt8ZkM/WP6imU5HDhkidTyN3ylMDUV2IrH6YTO5Bv8w== 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 CD7AA2C947; Sun, 3 Jul 2022 22:21:27 +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 263MLRvl060481; Sun, 3 Jul 2022 22:21:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 263MLRGf060480; Sun, 3 Jul 2022 22:21:27 GMT (envelope-from git) Date: Sun, 3 Jul 2022 22:21:27 GMT Message-Id: <202207032221.263MLRGf060480@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 11a7d5e5d906 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 11a7d5e5d906f691558e06d4bb93b892de31b446 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656886888; 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=Mu07j7JkhUBmZKaiT6YpxQc2BntnblDJkOyaRoj/wQ8=; b=awK2Uvgan0BV6y81BC3yuprisqu2hzocycC6SMbZN9jTfXbQVhaTaL8+nmChoJeQdyAtjl TF8FIorSqgZnYxCTBHASGfvXj1nVFAkzPIrvu6ySuz+TNS1gq/I7DS4FfBLxATfmgCqStz 71UVdLASAYPsKkXN/UwWRV7k/BYP7v1+V8DiOZJCV3JA9eUGYdZ33gEvi+3gulyMb5DtKx WyloBOyksd6VoLwOucZsSJyjlUun6yQ8aQ/OimBnHtor8yXJ4s9yPKBuofCDa+s0J7X0G7 Q9lbbvFXNOBAW6lPwAdcSJyakMExkkfqWGkUhhcCEi9F5zYydaUM+P7DORm45w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656886888; a=rsa-sha256; cv=none; b=Ifq1ZxWzuQaa+KmGFEAvQu0VqIO61VX0VK6dCFZE+mqs9m60tatS0ZDvDCVNGjTfKzWrQY 8OBcA3EYalj+yHTK+v6ushZUbj2Mt+iUP2rpupkXQl5+xObB7ROq3jX0/CeVNapZFng/Lt 28Dzc8nZ8dAXHBRnEVYhMjCut419PsMIwm5rAnzyGEq1gBtrdVR81iq1mDK6dk2Yjk5XJc K6wTIQL6vIDQdD3hUZA9X0Il+w1yS0MVaLjJeylZhAqZZb0SMZkAD0h8CAgmb5mLdyteLa 3ysSJUKccfuX/xFzCXS7WoOt+/X282SEWKTrw5qmHS60CNARugkKOekQADTH6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=11a7d5e5d906f691558e06d4bb93b892de31b446 commit 11a7d5e5d906f691558e06d4bb93b892de31b446 Author: Bjoern A. Zeeb AuthorDate: 2022-07-02 21:10:00 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-07-03 22:19:40 +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 MFC after: 2 weeks Reviewed by: mw Differential Revision: https://reviews.freebsd.org/D35700 --- 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 4b5109291cc4..da64512af647 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 @@ -384,10 +395,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); }