Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Feb 2023 11:55:53 GMT
From:      =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 2f0b0161cee5 - stable/13 - linuxkpi: Add `pci_device_is_present()`
Message-ID:  <202302161155.31GBtrcU055247@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dumbbell (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=2f0b0161cee5f767c82e16f164a1bad5881d428b

commit 2f0b0161cee5f767c82e16f164a1bad5881d428b
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-01-19 17:46:37 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-02-16 11:55:13 +0000

    linuxkpi: Add `pci_device_is_present()`
    
    This calls bus_child_present(9) internally.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38148
    
    (cherry picked from commit 49b6d5ed142d6c59b7a517ff5660165d8647bd01)
---
 sys/compat/linuxkpi/common/include/linux/pci.h |  9 +++++++++
 sys/compat/linuxkpi/common/src/linux_pci.c     | 10 ++++++++++
 2 files changed, 19 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index 8d41e33b0da8..ad7589e692f2 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -1664,4 +1664,13 @@ pci_is_enabled(struct pci_dev *pdev)
 	    PCIM_CMD_BUSMASTEREN) != 0);
 }
 
+static inline int
+pci_wait_for_pending_transaction(struct pci_dev *pdev)
+{
+
+	return (0);
+}
+
+bool pci_device_is_present(struct pci_dev *pdev);
+
 #endif	/* _LINUXKPI_LINUX_PCI_H_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c
index 54780adfda14..e4f85b906563 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -962,6 +962,16 @@ out:
 	return (-EINVAL);
 }
 
+bool
+pci_device_is_present(struct pci_dev *pdev)
+{
+	device_t dev;
+
+	dev = pdev->dev.bsddev;
+
+	return (bus_child_present(dev));
+}
+
 CTASSERT(sizeof(dma_addr_t) <= sizeof(uint64_t));
 
 struct linux_dma_obj {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302161155.31GBtrcU055247>