[PATCH rtems-libbsd 10/14] Enable kernel space pci_find_device()

Christian Mauderer christian.mauderer at embedded-brains.de
Tue Jan 23 09:09:11 UTC 2024


From: Sebastian Huber <sebastian.huber at embedded-brains.de>

---
 freebsd/sys/dev/pci/pci.c                             | 2 --
 rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h | 1 +
 rtemsbsd/rtems/rtems-kernel-pci_bus.c                 | 1 +
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/freebsd/sys/dev/pci/pci.c b/freebsd/sys/dev/pci/pci.c
index 3789a73e..5c76f1d5 100644
--- a/freebsd/sys/dev/pci/pci.c
+++ b/freebsd/sys/dev/pci/pci.c
@@ -471,7 +471,6 @@ pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot, uint8_t func)
 	return (NULL);
 }
 
-#ifndef __rtems__
 /* Find a device_t by vendor/device ID */
 
 device_t
@@ -488,7 +487,6 @@ pci_find_device(uint16_t vendor, uint16_t device)
 
 	return (NULL);
 }
-#endif /* __rtems__ */
 
 device_t
 pci_find_class(uint8_t class, uint8_t subclass)
diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
index 94e0d56f..c74eadbc 100644
--- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
+++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h
@@ -3847,6 +3847,7 @@
 #define	pci_find_cap_method _bsd_pci_find_cap_method
 #define	pci_find_class _bsd_pci_find_class
 #define	pci_find_dbsf _bsd_pci_find_dbsf
+#define	pci_find_device _bsd_pci_find_device
 #define	pci_find_extcap_method _bsd_pci_find_extcap_method
 #define	pci_find_htcap_method _bsd_pci_find_htcap_method
 #define	pci_find_next_cap_method _bsd_pci_find_next_cap_method
diff --git a/rtemsbsd/rtems/rtems-kernel-pci_bus.c b/rtemsbsd/rtems/rtems-kernel-pci_bus.c
index 67324dd8..6cbae125 100644
--- a/rtemsbsd/rtems/rtems-kernel-pci_bus.c
+++ b/rtemsbsd/rtems/rtems-kernel-pci_bus.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/resource.h>
 
 #include <rtems/bsd/local/pcib_if.h>
+#undef pci_find_device
 #define pci_find_device rtems_pci_find_device
 #if HAVE_RTEMS_PCI_H
 #include <rtems/pci.h>
-- 
2.35.3



More information about the devel mailing list