From nobody Sun Dec 01 04:57:04 2024 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 4Y1F5F0V6kz5gD2l; Sun, 01 Dec 2024 04:57:05 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y1F5D3hfPz48t7; Sun, 1 Dec 2024 04:57:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029024; 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=W81ObUly8W3133ouCAKa4odihvVmsaaXHoyIdzAnIqg=; b=mlybm/Yy355kWmqnklfQWmRdt0vdQQoPvyabi8GfTj9h/7KLEcWGVPsXpyZWX+2gNHVZuE 7oQtB2jxb6PlwWPOmdahyFAZ5nt9Mzglv5u4r9MyONEscY+ebqnvBrV+cooNszT9xwNhqU bWXOVqqa0pwXwr+WkJEb9HXpFBvIZjfcThZn9ppkba1bMCfMYiSuJLKv/IjHKHNZ5Gnq7B lEI7Fr7YSMIa6jmOLJR2iWMl0x9MrPfFVKUk7T3WCpLnN8G5WaTIfWuNhjQEtoTzPdcSQw O619xyP47KSE5ix6291XxTRECi9CGUGWzq0vnwft3h4g1lRcdPyTFgx0BFUgbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029024; 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=W81ObUly8W3133ouCAKa4odihvVmsaaXHoyIdzAnIqg=; b=cINYm5CgKv4GIH/ZD1oqtgiNr7nQyQwpwhei3bbgvv+D+i3kj1b5F+O9JIIFwOOmrpaALZ BPVjxHhohidKMXrCY5jf5vV97mGgeoyabHtQLbrbJFzBhuhT+7BowFe//JRxjcJqqX/Nk5 2j8tuKrBmlkpaiCRhdvoiwN3MMLuVfl9unEkYmQVQUDtkU4daX7SDv5YV8PTezRa1PG7n/ EhS7Nl/tyaYn6IXxEhjXRqJFokLaESOngJ6JjpvKarMMTzjuRUeWajsvMBinUdCoWAkGWN z49xfSs0TkljLKudWcErB90UWK4k/6K+BRyTspZNSCFbIi2Cjy65A/Vq+/cXcA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733029024; a=rsa-sha256; cv=none; b=GQXy5601S0fWp0S8rDfVk71MptNCZJ7xDOzIhQQO70LSJfqoHTKJF69GFcnVYHI4Hl4kDx bTzzE/vlfTBwS85SrZCvjD70U2rsunwJECXZkYGJscNJkPjiSAhAQSlYn6cTSjjut3W2JD dI9JfVsfoXEEPpNm2Q2R0ROnHokYl0cjwz2Jr3hhEah1p65jY3Cut9YDfuYijrdnLY8sPM vpFXiWwnuNzjvNqjldVDhpznRqx2hPkGXxbOhDmHXch1F7TpEXCsO0Qk6+p5LigfdfjaZf ER8/kwa1rO28NPowxB36ijp4C40DFYBBbeKIRNvYzDqgxUs2RytlSYIehP1nLw== 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 4Y1F5D2Rhvzdkh; Sun, 1 Dec 2024 04:57:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B14v4c9094847; Sun, 1 Dec 2024 04:57:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B14v4EA094844; Sun, 1 Dec 2024 04:57:04 GMT (envelope-from git) Date: Sun, 1 Dec 2024 04:57:04 GMT Message-Id: <202412010457.4B14v4EA094844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: b8b100db9fcb - stable/14 - csa: Use pci_find_device to simplify clkrun_hack 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b8b100db9fcbcdf7944ac88557820930fbc7603c Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b8b100db9fcbcdf7944ac88557820930fbc7603c commit b8b100db9fcbcdf7944ac88557820930fbc7603c Author: John Baldwin AuthorDate: 2024-10-24 14:18:53 +0000 Commit: John Baldwin CommitDate: 2024-12-01 02:46:05 +0000 csa: Use pci_find_device to simplify clkrun_hack Reviewed by: christos, imp Differential Revision: https://reviews.freebsd.org/D47222 (cherry picked from commit f0bc751d6fb4f7fe46fdaa1486b0ae20b04bb544) --- sys/dev/sound/pci/csa.c | 47 +++++++++++++---------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/sys/dev/sound/pci/csa.c b/sys/dev/sound/pci/csa.c index 662f0de80188..f293a8fc8af8 100644 --- a/sys/dev/sound/pci/csa.c +++ b/sys/dev/sound/pci/csa.c @@ -109,46 +109,25 @@ static int clkrun_hack(int run) { #ifdef __i386__ - devclass_t pci_devclass; - device_t *pci_devices, *pci_children, *busp, *childp; - int pci_count = 0, pci_childcount = 0; - int i, j, port; + device_t child; + int port; u_int16_t control; bus_space_tag_t btag; - if ((pci_devclass = devclass_find("pci")) == NULL) { - return ENXIO; - } + child = pci_find_device(0x8086, 0x7113); + if (child == NULL) + return (ENXIO); - devclass_get_devices(pci_devclass, &pci_devices, &pci_count); - - for (i = 0, busp = pci_devices; i < pci_count; i++, busp++) { - pci_childcount = 0; - if (device_get_children(*busp, &pci_children, &pci_childcount)) - continue; - for (j = 0, childp = pci_children; j < pci_childcount; j++, childp++) { - if (pci_get_vendor(*childp) == 0x8086 && pci_get_device(*childp) == 0x7113) { - port = (pci_read_config(*childp, 0x41, 1) << 8) + 0x10; - /* XXX */ - btag = X86_BUS_SPACE_IO; - - control = bus_space_read_2(btag, 0x0, port); - control &= ~0x2000; - control |= run? 0 : 0x2000; - bus_space_write_2(btag, 0x0, port, control); - free(pci_devices, M_TEMP); - free(pci_children, M_TEMP); - return 0; - } - } - free(pci_children, M_TEMP); - } + port = (pci_read_config(child, 0x41, 1) << 8) + 0x10; + /* XXX */ + btag = X86_BUS_SPACE_IO; - free(pci_devices, M_TEMP); - return ENXIO; -#else - return 0; + control = bus_space_read_2(btag, 0x0, port); + control &= ~0x2000; + control |= run? 0 : 0x2000; + bus_space_write_2(btag, 0x0, port, control); #endif + return (0); } static struct csa_card cards_4610[] = {