From nobody Sat Sep 19 14:40:25 2026 X-Original-To: dev-commits-src-branches@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 4hnBx62YNqz6srhy for ; Sat, 19 Sep 2026 14:40:26 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hnBx60gWSz4Wgp for ; Sat, 19 Sep 2026 14:40:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789828826; 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=51xQraenSOGb6gSagQCOBEYx0saxvNyJvOTUrfD7bFQ=; b=xTgKpEX3HQd93ITaV8N7lIEilrsw1NMAheWhEsM1PPaxnNgxFK4byGGT7Z1j/y2PVNMHRm 3jodtOKFzME6nRpFtVFPDeBv+/s4Cd45R0VaFKB4vADMhLnB+yL4LLOvpzj22kUT+1uOcJ b/AUXuZelEI8jkFbtP1Ql7P7hp/iURfgOS24JrLZZPbx6qpU3SS1bi67QGU4uXjsjkADG+ ojRsSNjns8T3ZX4PErCT2cZ2U0eA4GwBnag8IfkXbzpidl1FjM66Jk1YNeS/E50u8PiJ8U kugKpC0jgLBvtYNsZ9uYr3qh0telZWGUk/D+M8Dt+MV2574hQwaLhtFBmJ+sgw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789828826; b=P5TmD9qG/HZOeQJM7O/kxH+keST2eLSiLb4zwXBt4wgVRi0jV7e1oiXG6MjMiqhnsuxR8v 8z1A40FlVS+nrflm1KFNksqAIFgGUaGy5qzk6o+eLyuItJEYNZLPiZxzw4kVaeP5jJn28v 4VLvGS0K2GZO6p3cl3Ku6OXIBKlizXFyGF1nq871/q4oLqTCL8JtsuYRck2T4HGYlq5Bvp GOHmN3IysbmWGMup1UzAkfynDVXPDPU/GoCfyQjEjRC5rmpDChQ1iEJI0uL+VfHGgxzuuF apjPcN+2HWKb4iQv4/PE+4b3swyjuwWnfHU5Ie9qbQbeb1uuct40S4yabjbkOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789828826; 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=51xQraenSOGb6gSagQCOBEYx0saxvNyJvOTUrfD7bFQ=; b=ZiEO7RywEzhwZ1OKvz0siKKp8zIiIqTp+4V6J80hln2/rIh8EEFyuQsLelhQrxgS3fCxJ5 DOD85bGDc7FCesRD5g0Eceba7IK90pkLljoa9QujLqhTBJnvkGslH2dx6AmeNsgz6rgJ/3 UNQbQRHQPwDRSiuOfpoVdrYLVpgJCaaCmcCaLGpQL/WAZnxn4eZxcGp63H+wleEyUpJsZd 9wTgHqPcC6+dHLxGhPuwWz/5JfF7G4yI1cis8XmbghSyRuVNiY9E3FFPC6t01VNn/16u3N qRYuhoytMSzgPK7aK6UWTnDjIVsBL8d8yc8JNASsit2wVAFHKkr7W08AaK/Wfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hnBx56bMzz16r3 for ; Sat, 19 Sep 2026 14:40:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18584 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 19 Sep 2026 14:40:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 67c01ebfc241 - stable/15 - LinuxKPI: pci: add pci_select_bars() and pci_msix_vec_count() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/15 X-Git-Reftype: branch X-Git-Commit: 67c01ebfc241a2ee9037f9ca85efc84ccdd56982 Auto-Submitted: auto-generated Date: Sat, 19 Sep 2026 14:40:25 +0000 Message-Id: <6aae9ed9.18584.2dc73914@gitrepo.freebsd.org> The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=67c01ebfc241a2ee9037f9ca85efc84ccdd56982 commit 67c01ebfc241a2ee9037f9ca85efc84ccdd56982 Author: Bjoern A. Zeeb AuthorDate: 2026-08-16 21:32:31 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-09-19 09:34:10 +0000 LinuxKPI: pci: add pci_select_bars() and pci_msix_vec_count() For pci_select_bars() we use the LinuxKPI internal information, while for pci_select_bars() we fall back to the native PCI stack. Needed by a wifi driver. Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D58878 (cherry picked from commit 55c07af60172b211116be47010fc0831aafc99e8) --- sys/compat/linuxkpi/common/include/linux/pci.h | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 8cd52707a7bd..6efd43f311cf 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -437,6 +437,24 @@ pci_resource_flags(struct pci_dev *pdev, int bar) return (1 << type); } +static inline int +pci_select_bars(struct pci_dev *pdev, unsigned long flags) +{ + int bars, bar; + + bars = 0; + /* We only support BARs here; Linux may support more types. */ + for (bar = PCIR_MAX_BAR_0; bar >= 0; bar--) { + int bar_flags; + + bar_flags = pci_resource_flags(pdev, bar); + if ((bar_flags & flags) != 0) + bars |= (1 << bar); + } + + return (bars); +} + static inline const char * pci_name(struct pci_dev *d) { @@ -1569,6 +1587,17 @@ pci_irq_vector(struct pci_dev *pdev, unsigned int vector) return (-ENXIO); } +static inline int +pci_msix_vec_count(struct pci_dev *pdev) +{ + int avail; + + avail = pci_msix_count(pdev->dev.bsddev); + if (avail == 0) + return (-EINVAL); + return (avail); +} + static inline int pci_wake_from_d3(struct pci_dev *pdev, bool enable) {