aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2023-01-19 17:46:37 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2023-02-16 11:55:13 +0000
commit2f0b0161cee5f767c82e16f164a1bad5881d428b (patch)
tree94dfe7e2774d666b91c9fac91c6e76b048c8216d
parent01ae017c3e0da57e83982d5bd1d21bd8d4af9a4d (diff)
downloadsrc-2f0b0161cee5f767c82e16f164a1bad5881d428b.tar.gz
src-2f0b0161cee5f767c82e16f164a1bad5881d428b.zip
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)
-rw-r--r--sys/compat/linuxkpi/common/include/linux/pci.h9
-rw-r--r--sys/compat/linuxkpi/common/src/linux_pci.c10
2 files changed, 19 insertions, 0 deletions
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 {