Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jan 2023 22:15:04 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-main@FreeBSD.org
Subject:   git: 49b6d5ed142d - main - linuxkpi: Add `pci_device_is_present()`
Message-ID:  <202301252215.30PMF4BD064190@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=49b6d5ed142d6c59b7a517ff5660165d8647bd01

commit 49b6d5ed142d6c59b7a517ff5660165d8647bd01
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-01-25 21:49:38 +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
---
 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 6651fd62b44b..b54b5cc8dd70 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -1672,4 +1672,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 da5430eb0d7b..aa29d0654cd1 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -996,6 +996,16 @@ lkpi_pci_msi_desc_alloc(int irq)
 	return (desc);
 }
 
+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?202301252215.30PMF4BD064190>