mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-23 10:40:54 +08:00
Add conditional support for RTEMS PCI to the waf build.
Check for the "rtems/pci.h" header and provide conditional build support with waf to build for BSPs that do not have PCI support. The Makefile build always defines HAVE_RTEMS_PCI_H which is the same state with this change. The PCI calls still exist however they do nothing and return a constant. Any PCI based driver that makes these calls on a BSP that does not have PCI support will not work which is understandable. Either change the driver or add PCI support the BSP.
This commit is contained in:
parent
e35a65e995
commit
1383c80c5a
1
Makefile
1
Makefile
@ -27,6 +27,7 @@ COMMON_FLAGS += -ImDNSResponder/mDNSCore
|
|||||||
COMMON_FLAGS += -ImDNSResponder/mDNSShared
|
COMMON_FLAGS += -ImDNSResponder/mDNSShared
|
||||||
COMMON_FLAGS += -ImDNSResponder/mDNSPosix
|
COMMON_FLAGS += -ImDNSResponder/mDNSPosix
|
||||||
COMMON_FLAGS += -Itestsuite/include
|
COMMON_FLAGS += -Itestsuite/include
|
||||||
|
COMMON_FLAGS += -DHAVE_RTEMS_PCI_H=1
|
||||||
COMMON_FLAGS += -Wall
|
COMMON_FLAGS += -Wall
|
||||||
COMMON_FLAGS += -Wno-format
|
COMMON_FLAGS += -Wno-format
|
||||||
COMMON_FLAGS += -MT $@ -MD -MP -MF $(basename $@).d
|
COMMON_FLAGS += -MT $@ -MD -MP -MF $(basename $@).d
|
||||||
|
@ -191,6 +191,7 @@ class ModuleManager(builder.ModuleManager):
|
|||||||
'COMMON_FLAGS += -ImDNSResponder/mDNSShared\n' \
|
'COMMON_FLAGS += -ImDNSResponder/mDNSShared\n' \
|
||||||
'COMMON_FLAGS += -ImDNSResponder/mDNSPosix\n' \
|
'COMMON_FLAGS += -ImDNSResponder/mDNSPosix\n' \
|
||||||
'COMMON_FLAGS += -Itestsuite/include\n' \
|
'COMMON_FLAGS += -Itestsuite/include\n' \
|
||||||
|
'COMMON_FLAGS += -DHAVE_RTEMS_PCI_H=1\n' \
|
||||||
'COMMON_FLAGS += -Wall\n' \
|
'COMMON_FLAGS += -Wall\n' \
|
||||||
'COMMON_FLAGS += -Wno-format\n' \
|
'COMMON_FLAGS += -Wno-format\n' \
|
||||||
'COMMON_FLAGS += -MT $@ -MD -MP -MF $(basename $@).d\n' \
|
'COMMON_FLAGS += -MT $@ -MD -MP -MF $(basename $@).d\n' \
|
||||||
|
@ -52,21 +52,27 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <rtems/bsd/local/pcib_if.h>
|
#include <rtems/bsd/local/pcib_if.h>
|
||||||
#define pci_find_device rtems_pci_find_device
|
#define pci_find_device rtems_pci_find_device
|
||||||
|
#if HAVE_RTEMS_PCI_H
|
||||||
#include <rtems/pci.h>
|
#include <rtems/pci.h>
|
||||||
|
#endif
|
||||||
#include <machine/bus.h>
|
#include <machine/bus.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
pcibios_pcib_route_interrupt(device_t pcib, device_t dev, int pin)
|
pcibios_pcib_route_interrupt(device_t pcib, device_t dev, int pin)
|
||||||
{
|
{
|
||||||
|
#if HAVE_RTEMS_PCI_H
|
||||||
int bus;
|
int bus;
|
||||||
int slot;
|
int slot;
|
||||||
int func;
|
int func;
|
||||||
uint8_t irq;
|
uint8_t irq;
|
||||||
|
|
||||||
bus = pci_get_bus(dev);
|
bus = pci_get_bus(dev);
|
||||||
slot = pci_get_slot(dev);
|
slot = pci_get_slot(dev);
|
||||||
func = pci_get_function(dev);
|
func = pci_get_function(dev);
|
||||||
|
|
||||||
pci_read_config_byte(bus, slot, func, PCI_INTERRUPT_LINE, &irq);
|
pci_read_config_byte(bus, slot, func, PCI_INTERRUPT_LINE, &irq);
|
||||||
return irq;
|
return irq;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,12 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <dev/pci/pcivar.h>
|
#include <dev/pci/pcivar.h>
|
||||||
#include <dev/pci/pcireg.h>
|
#include <dev/pci/pcireg.h>
|
||||||
#define pci_find_device rtems_pci_find_device
|
#define pci_find_device rtems_pci_find_device
|
||||||
|
#if HAVE_RTEMS_PCI_H
|
||||||
#include <rtems/pci.h>
|
#include <rtems/pci.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
/*
|
* Initialise access to PCI configuration space
|
||||||
* Initialise access to PCI configuration space
|
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pci_cfgregopen(void)
|
pci_cfgregopen(void)
|
||||||
@ -61,12 +62,13 @@ pci_cfgregopen(void)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read configuration space register
|
* Read configuration space register
|
||||||
*/
|
*/
|
||||||
u_int32_t
|
u_int32_t
|
||||||
pci_cfgregread(int bus, int slot, int func, int reg, int bytes)
|
pci_cfgregread(int bus, int slot, int func, int reg, int bytes)
|
||||||
{
|
{
|
||||||
|
#if HAVE_RTEMS_PCI_H
|
||||||
u_int32_t value;
|
u_int32_t value;
|
||||||
uint8_t v8;
|
uint8_t v8;
|
||||||
uint16_t v16;
|
uint16_t v16;
|
||||||
@ -89,14 +91,18 @@ pci_cfgregread(int bus, int slot, int func, int reg, int bytes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write configuration space register
|
* Write configuration space register
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes)
|
pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes)
|
||||||
{
|
{
|
||||||
|
#if HAVE_RTEMS_PCI_H
|
||||||
uint8_t v8 = data & 0xff;
|
uint8_t v8 = data & 0xff;
|
||||||
uint16_t v16 = data & 0xffff;
|
uint16_t v16 = data & 0xffff;
|
||||||
uint32_t v32 = data;
|
uint32_t v32 = data;
|
||||||
@ -112,4 +118,5 @@ pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes)
|
|||||||
pci_write_config_dword( bus, slot, func, reg, v32 );
|
pci_write_config_dword( bus, slot, func, reg, v32 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,7 @@ class ModuleManager(builder.ModuleManager):
|
|||||||
self.add('')
|
self.add('')
|
||||||
self.add('def bsp_configure(conf, arch_bsp):')
|
self.add('def bsp_configure(conf, arch_bsp):')
|
||||||
self.add(' conf.check(header_name = "dlfcn.h", features = "c")')
|
self.add(' conf.check(header_name = "dlfcn.h", features = "c")')
|
||||||
|
self.add(' conf.check(header_name = "rtems/pci.h", features = "c", mandatory = False)')
|
||||||
self.add('')
|
self.add('')
|
||||||
self.add('def configure(conf):')
|
self.add('def configure(conf):')
|
||||||
self.add(' if conf.options.auto_regen:')
|
self.add(' if conf.options.auto_regen:')
|
||||||
|
1
wscript
1
wscript
@ -37,6 +37,7 @@ def options(opt):
|
|||||||
|
|
||||||
def bsp_configure(conf, arch_bsp):
|
def bsp_configure(conf, arch_bsp):
|
||||||
conf.check(header_name = "dlfcn.h", features = "c")
|
conf.check(header_name = "dlfcn.h", features = "c")
|
||||||
|
conf.check(header_name = "rtems/pci.h", features = "c", mandatory = False)
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
if conf.options.auto_regen:
|
if conf.options.auto_regen:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user