Enable NEW_PCIB

This commit is contained in:
Sebastian Huber
2021-12-20 10:05:39 +01:00
committed by Christian Mauderer
parent 398c5f6952
commit 0e2d6b8819
3 changed files with 30 additions and 0 deletions

View File

@@ -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_ */

View File

@@ -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 */

View File

@@ -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;