From nobody Mon Sep 29 23:17:26 2025 X-Original-To: dev-commits-src-main@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 4cbHCV6xKLz691RR; Mon, 29 Sep 2025 23:17: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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cbHCV583zz3Jpy; Mon, 29 Sep 2025 23:17:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759187846; 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=vEUdQYerJ7phCVpuwpSN811ktsSaqaoBw0Pi3CDRPLE=; b=B5lfXM6U1r4M4yYtus0luVePPtlZdlT2yStt/Azvf6Bvu20VpTiHC3RidXNBzuvDB3OrsW mEFJb1Ii4UNAPOV5k8/Fhu84AAl+aoM9NWveoAb4AMw2DtiwwMUfTWxNJAmPJviWiynL3Q FPWOeOQaqHaBdoKzK15I2vxgMJrsE/JFFB06+Aq9LFXRsftsCK3+sVti1cvs40d6/goWI1 NT0HVzaocmlILDgHebc99yq/MpeuDdDQWTTFGcpgMMeo3DT/4M5z4jegHSSscZLA+3vq/F 5NgkGl1BilyuG9L9E63NJKETYRqbgC90zwCGeo/GyK+pkP7Xuru+IrckEEkbuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759187846; 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=vEUdQYerJ7phCVpuwpSN811ktsSaqaoBw0Pi3CDRPLE=; b=bA4NRsdZnt45wcUU7fyyd8qnNKZMvH+PmM5IA17dn43ChIAWrhO2LC5eLi9LE55vIJOAB8 E+xuQrwCgUMeqGQtuQsUZbotWsmUfd22cw/kJVS24O0zXUZMugyCOmcgH9AIgetarPYPff sthWZrYagIz5IZsuaefEIEYfOs9DZ1QBMs+l7S4Q9dJ8aNmyXO1zVpP6+bN6fux3DMP8/9 k4H9tngegE+33fRQqV4ABzMPiSEInfO7fLAfAFBf9GiG0ww6cGJadWWpvz6Fs+Hei16C0k HA63J2xt9bKQTH++LkkCKb/3Bm44AIte9ATW+BltsBx0UBt4nbYZjEI/m2Z2MA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759187846; a=rsa-sha256; cv=none; b=aUSiih8K4jzKeyTWUqPLWPfpCKFCQ8UGQtw5jHR9MzXeAiR382jzQuG3oA6AQcxTocc4zn DA8gHtqIz5uVxX8Ua1UJ/jodD7H4rLwr2g/gB3ZRU3y3VZIf7YrnVTbmunz9r02ubdRMTX 3pSupmlLETubWcYOYFaxzpGCSvEfRRcwedTgs9byKh0oG4lym5s5T5NyEoO0LpbTvJPIeW uQuexfm25KEqGfT+9EbhS7wuAZpaP8KwXwi3hf9Ecplrl6FRR11AoiqeFebMq+uIvrMNfU bCsQFtyGByXbBZ+qIR5rvlOYMbnL6z2ooC0shqcdjHR4Cn2LWyeBTqV3KbJ8xA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cbHCV4h9hz1PJQ; Mon, 29 Sep 2025 23:17:26 +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 58TNHQim004624; Mon, 29 Sep 2025 23:17:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58TNHQW9004621; Mon, 29 Sep 2025 23:17:26 GMT (envelope-from git) Date: Mon, 29 Sep 2025 23:17:26 GMT Message-Id: <202509292317.58TNHQW9004621@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: 4179e6b78297 - main - LinuxKPI: pci: implementation of [lkpi_]pci_get_slot() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 4179e6b78297369f0cf0eae1076e01e5151c5cbe Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4179e6b78297369f0cf0eae1076e01e5151c5cbe commit 4179e6b78297369f0cf0eae1076e01e5151c5cbe Author: Bjoern A. Zeeb AuthorDate: 2025-09-04 20:19:48 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-09-29 23:16:18 +0000 LinuxKPI: pci: implementation of [lkpi_]pci_get_slot() Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot() using pci_find_bsf() instead of pci_find_dbsf() (no domain). This is needed for a wireless driver. Unfortunately the name [pci_get_slot()] collides with the native PCI function. Add a guard around it and disable the use when the native version is required (in lkpifill_pci_dev() and in bnxt/bnxt_en; if the latter gets fixed we can probably also fix work around it in the former; further conflicts in drm-kmod 6.1-lts, 6.6-lts, and master were resolved). Sponsored by: The FreeBSD Foundation (initially) MFC aftre: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52065 --- sys/compat/linuxkpi/common/include/linux/pci.h | 6 ++++++ sys/compat/linuxkpi/common/src/linux_pci.c | 15 +++++++++++++++ sys/dev/bnxt/bnxt_en/if_bnxt.c | 1 + 3 files changed, 22 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index d891d0df3546..ffc2be600c22 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1332,6 +1332,12 @@ struct pci_dev *lkpi_pci_get_domain_bus_and_slot(int domain, #define pci_get_domain_bus_and_slot(domain, bus, devfn) \ lkpi_pci_get_domain_bus_and_slot(domain, bus, devfn) +struct pci_dev *lkpi_pci_get_slot(struct pci_bus *, unsigned int); +#ifndef WANT_NATIVE_PCI_GET_SLOT +#define pci_get_slot(_pbus, _devfn) \ + lkpi_pci_get_slot(_pbus, _devfn) +#endif + static inline int pci_domain_nr(struct pci_bus *pbus) { diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index d0f1d5e3f9c5..8507a59a8df3 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -67,6 +67,7 @@ #include #include #include +#define WANT_NATIVE_PCI_GET_SLOT #include #include @@ -485,6 +486,20 @@ lkpi_pci_get_domain_bus_and_slot(int domain, unsigned int bus, return (pdev); } +struct pci_dev * +lkpi_pci_get_slot(struct pci_bus *pbus, unsigned int devfn) +{ + device_t dev; + struct pci_dev *pdev; + + dev = pci_find_bsf(pbus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); + if (dev == NULL) + return (NULL); + + pdev = lkpinew_pci_dev(dev); + return (pdev); +} + static int linux_pci_probe(device_t dev) { diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c index feac3ce54a29..471e26a4b252 100644 --- a/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -48,6 +48,7 @@ #include #include +#define WANT_NATIVE_PCI_GET_SLOT #include #include #include