From nobody Fri Apr 17 19:37:41 2026 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 4fy4sf0sl1z6Wwd3 for ; Fri, 17 Apr 2026 19:37:42 +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" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fy4sd6Y9tz44vY for ; Fri, 17 Apr 2026 19:37:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776454661; 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=3U6CoLrszPyIdHYby0T0+akxN4kmuiWx/oIDIIiQ0Kw=; b=q32TtQSzPBMviqEtdc80eSvkpA4N72/hbAsQ7/0+HYJLEARZaNGoa7DRoWU/GiaASo2yje 6TR36Xn1wWIMRw2uWtDWttjbZMykWxbT7wq5L9p/5vOgogyLGn/eSNlbMKDxNSsQcnC8Dt ovkGijD7ijYTMvxb2imbB1npTh4a/Z6zwNHSlVCZNOHe4WM+nipINfmKgLyKLeYdzxKW0V xk3N9LtyzBeB/zUQ/LaClh1GsW5t7zAyLu8HmFCtJ+0aF8EhPro1iymgapPlBg+dMHVR1u gOnROsEQwFtonhUqtHyZwq6lfMEq+gISneSgyalF2q1dxHapkL1xP/RQ0g7bBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776454661; a=rsa-sha256; cv=none; b=vUPcZYZ0wFlTLwzlTnWFYSoCIXOly7dqtXP/mN92fy9xAPpYjkVjs3hBjbG26Z3ugpqJHg oSKsQHEZedzhDsrgFd/SKop1YVomz9Ynb9S5dIvqgi9IjaKTmKcHGOPL50kMqUweGUrfEe SHbe+sHHIdL/qYfrhInaZOdz9YUnNYf5PdV9sRS0PL+gFXMkQ3PhKgHdmKU3ukTZW/2S8n xJyAhbwDk9lg0hVU6XbOjaRFFjuvM5JVOnsfm6zIs+DW6aqPeqpvU96xHje0c/acSlQQho iurIwzR1qnxEYCT9NPJuENa9fpohX2ez5NA+LbU0SaWJhAx0Bm0oFfmgZMUktw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776454661; 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=3U6CoLrszPyIdHYby0T0+akxN4kmuiWx/oIDIIiQ0Kw=; b=QyAxsnaSvyEJTfS0Y0p/C/SnNWhgb5TnFfX3dUa4gJa0RPK/MTwb1Ow1lqrNfE6XyjSQ6k TeYcHuoQ7u5/oRZu3uCAJAm3Y9sqIrnms+sWhBXJyVSjN9Atl8EbZbtsT3qT+fzWYRyWgQ INKZz8D5YQAVGTT9D7kzHE2CtRP+qfYNy5DhkBPJEEFrrGZyrhVZ4Nq3K2JgH/0haDTkap OzD6urFhsP4NtYlAvNPANNXAjTDlR5tVJT7uLYY57iKpTlViMCgpLAVe4T6IiNbRYFIYJl SrnhzWhI+8HrOkC8cIGIBC1TEhLY54/kfJ1K5XzRovXwKY6i5LDROpJAZdEhqA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fy4sd688Pz16kC for ; Fri, 17 Apr 2026 19:37:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 195ba by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 17 Apr 2026 19:37:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau =?utf-8?Q?Monn=C3=A9?= Subject: git: 2ac5b9bd0b13 - main - uart/pci: use different probe return values 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: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ac5b9bd0b132ac0fb69800724dbfcab45ccc35c Auto-Submitted: auto-generated Date: Fri, 17 Apr 2026 19:37:41 +0000 Message-Id: <69e28c05.195ba.26247395@gitrepo.freebsd.org> The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=2ac5b9bd0b132ac0fb69800724dbfcab45ccc35c commit 2ac5b9bd0b132ac0fb69800724dbfcab45ccc35c Author: Roger Pau Monné AuthorDate: 2026-04-17 12:46:39 +0000 Commit: Roger Pau Monné CommitDate: 2026-04-17 19:37:26 +0000 uart/pci: use different probe return values For PCI devices listed in pci_ns8250_ids return BUS_PROBE_SPECIFIC, while for generic UART devices not explicitly listed in pci_ns8250_ids return BUS_PROBE_GENERIC. This allows more specific drivers to take over those devices, and the generic UART PCI driver will only be used as a fallback. This fixes an issue where the UART PCI driver would attach to multiport PCI UART devices, that instead need to use the puc(4) driver to multiplex the device. Reported by: markj Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D56467 Reviewed by: markj imp --- sys/dev/uart/uart_bus_pci.c | 55 +++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index b0d285e3c603..97c5ff84d251 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -280,33 +280,43 @@ uart_pci_probe(device_t dev) { struct uart_softc *sc; const struct pci_id *id; - struct pci_id cid = { - .regshft = 0, - .rclk = 0, - .rid = 0x10 | PCI_NO_MSI, - .desc = "Generic SimpleComm PCI device", - }; - int result; sc = device_get_softc(dev); id = uart_pci_match(dev, pci_ns8250_ids); if (id != NULL) { sc->sc_class = &uart_ns8250_class; - goto match; + return (BUS_PROBE_SPECIFIC); } if (pci_get_class(dev) == PCIC_SIMPLECOMM && pci_get_subclass(dev) == PCIS_SIMPLECOMM_UART && pci_get_progif(dev) <= PCIP_SIMPLECOMM_UART_16550A) { - /* XXX rclk what to do */ - id = &cid; sc->sc_class = &uart_ns8250_class; - goto match; + return (BUS_PROBE_GENERIC); } /* Add checks for non-ns8250 IDs here. */ return (ENXIO); +} + +static int +uart_pci_attach(device_t dev) +{ + static const struct pci_id cid = { + .regshft = 0, + .rclk = 0, + .rid = 0x10 | PCI_NO_MSI, + .desc = "Generic SimpleComm PCI device", + }; + struct uart_softc *sc; + const struct pci_id *id = uart_pci_match(dev, pci_ns8250_ids); + int count, result; + + if (id == NULL) + /* No specific PCI ID match, must be a generic device. */ + id = &cid; + + sc = device_get_softc(dev); - match: result = uart_bus_probe(dev, id->regshft, 0, id->rclk, id->rid & PCI_RID_MASK, 0, 0); /* Bail out on error. */ @@ -322,26 +332,13 @@ uart_pci_probe(device_t dev) /* Set/override the device description. */ if (id->desc) device_set_desc(dev, id->desc); - return (result); -} - -static int -uart_pci_attach(device_t dev) -{ - struct uart_softc *sc; - const struct pci_id *id; - int count; - - sc = device_get_softc(dev); /* - * Use MSI in preference to legacy IRQ if available. However, experience - * suggests this is only reliable when one MSI vector is advertised. + * Use MSI in preference to legacy IRQ if available. However, + * experience suggests this is only reliable when one MSI vector is + * advertised. */ - id = uart_pci_match(dev, pci_ns8250_ids); - /* Always disable MSI for generic devices. */ - if (id != NULL && (id->rid & PCI_NO_MSI) == 0 && - pci_msi_count(dev) == 1) { + if ((id->rid & PCI_NO_MSI) == 0 && pci_msi_count(dev) == 1) { count = 1; if (pci_alloc_msi(dev, &count) == 0) { sc->sc_irid = 1;