From nobody Sun Dec 01 04:57:54 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 4Y1F6B5TFmz5gDSV; Sun, 01 Dec 2024 04:57:54 +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 4Y1F6B2h9kz4CYd; Sun, 1 Dec 2024 04:57:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029074; 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=CLKQHaX9Z1ZvOM1Z/6JLVV+zUUrKUEYFR6fZxWTXd4c=; b=S164n4mBwtZuF74xl/g08QWYw5xrj8AO9lo7x2BWYcDGtIx/O8PeGsqarZ145vcCIn8Ujc 3Fir39ZDZcLiHMefSPsqC1TnQUae8Jx392Ua+Zc/gDwB1RjC2jx0iXNiD+TJLkyh5vFJCx FXAz019OvZWyuDUCr2LP93LcQM5Nf3pI9INwcqlQC5it2Pk0x2coNk+H0cHGnC1fIo+q1f oxznQBXn1MNLEjKNxlNOKUXcTI15aEBjDHXFdzZ+c66J1LzcL88SEbJpM2as/LdsmMzHSl AFqFy79dv63buZ44MaMnG+yd73NAW9jc1uJdEm95GlL/Q1W+tUhTAykeSvYMFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029074; 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=CLKQHaX9Z1ZvOM1Z/6JLVV+zUUrKUEYFR6fZxWTXd4c=; b=MpZ8KGnxPTlF5EQNDAVINU4xzXj3RBR+E69S/jznUs7ydgrL/+rlFhhXyFmtrxGxQCSSnB y3XNcQ94hl15R6e/K3oQ9Oc689ZCes6h9cLOtI9srPEYzzCfbzwM52BDtH1L836ItCPs8i s3gc9kANbTrDHHTySnhloL7a6Dv1SGYvFBaoO9g763Y420h9aikus7weDRzMlx901BLK7C EwoRZowdY2c4p54BSt99f6FTacAH89aKe9ZWkPrHABHoOgKJWZpi/ZpbEL+wT43OovARut vbupjyD9pyP5effBJXqB+jLSDzNsAoPM8eqNB8Zh8Bs/AR5HK38ELpcmusIjNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733029074; a=rsa-sha256; cv=none; b=CYlsazyXDkKjc78Jf+nQi4OcCAFFU/uOfMCfDhQeuLfD267HHlXEzd1c9G6LmIIIrijjHm 5MWFe3dmV0j41v+T64fmFerd3WEWI5QVSljVUZAIb1JPPcGktMcGNZXsFldtL74eVciQ6C Wpl8ikBKFLfn9e10MI1kdn0FPC/zq7EHeGJCjbTFgeLE2cTkNVLji5ggG94jHuq9iqL0g9 VJOSzfZNFioD5occPHZMYGb9xtwI6FTQniWzy4dKHv0VYbKNe8nmDW5nlBxh4P2kmltrny ACWbOg2h26ALiHXJlcDVHXLFthkBGVdx1aV/FYYZZq/3SkePlsfJBqwAeJLxrA== 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 4Y1F6B1tdCzfJF; Sun, 1 Dec 2024 04:57:54 +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 4B14vsZq097257; Sun, 1 Dec 2024 04:57:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B14vseD097254; Sun, 1 Dec 2024 04:57:54 GMT (envelope-from git) Date: Sun, 1 Dec 2024 04:57:54 GMT Message-Id: <202412010457.4B14vseD097254@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: 11592af90f0d - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 11592af90f0d902c979097df3a583b07ba5a419d Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=11592af90f0d902c979097df3a583b07ba5a419d commit 11592af90f0d902c979097df3a583b07ba5a419d Author: John Baldwin AuthorDate: 2024-10-24 14:18:53 +0000 Commit: John Baldwin CommitDate: 2024-11-30 21:38:58 +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 d84d2a1e9310..caba61d31def 100644 --- a/sys/dev/sound/pci/csa.c +++ b/sys/dev/sound/pci/csa.c @@ -114,46 +114,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[] = {