[PATCH rtems-libbsd 07/14] Enable NEW_PCIB
Christian Mauderer
christian.mauderer at embedded-brains.de
Tue Jan 23 09:09:08 UTC 2024
From: Sebastian Huber <sebastian.huber at embedded-brains.de>
---
rtemsbsd/include/machine/resource.h | 1 +
.../include/machine/rtems-bsd-kernel-space.h | 8 +++++++
rtemsbsd/rtems/rtems-kernel-nexus.c | 21 +++++++++++++++++++
3 files changed, 30 insertions(+)
diff --git a/rtemsbsd/include/machine/resource.h b/rtemsbsd/include/machine/resource.h
index ad4f0f29..babc1ae6 100644
--- a/rtemsbsd/include/machine/resource.h
+++ b/rtemsbsd/include/machine/resource.h
@@ -45,5 +45,6 @@
#define SYS_RES_MEMORY 3
#define SYS_RES_IOPORT 4
#define SYS_RES_GPIO 5
+#define PCI_RES_BUS 6
#endif /* _RTEMS_BSD_MACHINE_RESOURCE_H_ */
diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-space.h b/rtemsbsd/include/machine/rtems-bsd-kernel-space.h
index 09f3c64d..2b45c2db 100644
--- a/rtemsbsd/include/machine/rtems-bsd-kernel-space.h
+++ b/rtemsbsd/include/machine/rtems-bsd-kernel-space.h
@@ -247,6 +247,14 @@ dev_t rtems_bsd__makedev(int _M, int _m);
struct dirent;
void dirent_terminate(struct dirent *dp);
+/*
+ * Enable the "new" PCI-PCI bridge driver, since this is going to be the future
+ * FreeBSD driver:
+ *
+ * https://reviews.freebsd.org/D32954
+ */
+#define NEW_PCIB 1
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/rtemsbsd/rtems/rtems-kernel-nexus.c b/rtemsbsd/rtems/rtems-kernel-nexus.c
index 8fc879fe..c5ee33d8 100644
--- a/rtemsbsd/rtems/rtems-kernel-nexus.c
+++ b/rtemsbsd/rtems/rtems-kernel-nexus.c
@@ -57,6 +57,7 @@
#endif
#include <rtems/bsd/bsd.h>
+#include <rtems/bsd/modules.h>
#include <rtems/irq-extension.h>
#include <bsp.h>
@@ -103,6 +104,10 @@ static struct rman mem_rman;
static struct rman irq_rman;
+#ifdef RTEMS_BSD_MODULE_PCI
+static struct rman pci_rman;
+#endif
+
#if defined(RTEMS_BSP_PCI_IO_REGION_BASE)
static struct rman port_rman;
#endif
@@ -137,6 +142,17 @@ nexus_probe(device_t dev)
err = rman_manage_region(&irq_rman, irq_rman.rm_start, irq_rman.rm_end);
BSD_ASSERT(err == 0);
+#ifdef RTEMS_BSD_MODULE_PCI
+ pci_rman.rm_start = 0;
+ pci_rman.rm_end = ~0UL;
+ pci_rman.rm_type = RMAN_ARRAY;
+ pci_rman.rm_descr = "PCI bus";
+ err = rman_init(&pci_rman) != 0;
+ BSD_ASSERT(err == 0);
+ err = rman_manage_region(&pci_rman, pci_rman.rm_start, pci_rman.rm_end);
+ BSD_ASSERT(err == 0);
+#endif
+
#if defined(RTEMS_BSP_PCI_IO_REGION_BASE)
port_rman.rm_start = 0;
port_rman.rm_end = ~0UL;
@@ -191,6 +207,11 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
case SYS_RES_IRQ:
rm = &irq_rman;
break;
+#ifdef RTEMS_BSD_MODULE_PCI
+ case PCI_RES_BUS:
+ rm = &pci_rman;
+ break;
+#endif
#if defined(RTEMS_BSP_PCI_IO_REGION_BASE)
case SYS_RES_IOPORT:
rm = &port_rman;
--
2.35.3
More information about the devel
mailing list