diff options
author | andrew <andrew@FreeBSD.org> | 2016-04-18 10:37:50 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2016-04-18 10:37:50 +0000 |
commit | d47609db9b6e0c2e5ca7eb4f181cc7b031dc2f37 (patch) | |
tree | 961a9a6a3c43202c09195067931dd181ad51032a | |
parent | 129e98db918f9b9fd962692e6f5be1fa6b3533c3 (diff) | |
download | FreeBSD-src-d47609db9b6e0c2e5ca7eb4f181cc7b031dc2f37.zip FreeBSD-src-d47609db9b6e0c2e5ca7eb4f181cc7b031dc2f37.tar.gz |
Pull the MSI/MSI-X handling functions out to help with INTRNG integration.
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
-rw-r--r-- | sys/dev/pci/pci_host_generic.c | 69 |
1 files changed, 62 insertions, 7 deletions
diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 110ee68..617f2f6 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -656,6 +656,63 @@ generic_pcie_deactivate_resource(device_t dev, device_t child, int type, int rid return (res); } +static int +generic_pcie_alloc_msi(device_t pci, device_t child, int count, int maxcount, + int *irqs) +{ + +#if defined(__aarch64__) + return (arm_alloc_msi(pci, child, count, maxcount, irqs)); +#else + return (ENXIO); +#endif +} + +static int +generic_pcie_release_msi(device_t pci, device_t child, int count, int *irqs) +{ + +#if defined(__aarch64__) + return (arm_release_msi(pci, child, count, irqs)); +#else + return (ENXIO); +#endif +} + +static int +generic_pcie_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, + uint32_t *data) +{ + +#if defined(__aarch64__) + return (arm_map_msi(pci, child, irq, addr, data)); +#else + return (ENXIO); +#endif +} + +static int +generic_pcie_alloc_msix(device_t pci, device_t child, int *irq) +{ + +#if defined(__aarch64__) + return (arm_alloc_msix(pci, child, irq)); +#else + return (ENXIO); +#endif +} + +static int +generic_pcie_release_msix(device_t pci, device_t child, int irq) +{ + +#if defined(__aarch64__) + return (arm_release_msix(pci, child, irq)); +#else + return (ENXIO); +#endif +} + static device_method_t generic_pcie_methods[] = { DEVMETHOD(device_probe, generic_pcie_probe), DEVMETHOD(device_attach, pci_host_generic_attach), @@ -674,13 +731,11 @@ static device_method_t generic_pcie_methods[] = { DEVMETHOD(pcib_route_interrupt, generic_pcie_route_interrupt), DEVMETHOD(pcib_read_config, generic_pcie_read_config), DEVMETHOD(pcib_write_config, generic_pcie_write_config), -#if defined(__aarch64__) - DEVMETHOD(pcib_alloc_msi, arm_alloc_msi), - DEVMETHOD(pcib_release_msi, arm_release_msi), - DEVMETHOD(pcib_alloc_msix, arm_alloc_msix), - DEVMETHOD(pcib_release_msix, arm_release_msix), - DEVMETHOD(pcib_map_msi, arm_map_msi), -#endif + DEVMETHOD(pcib_alloc_msi, generic_pcie_alloc_msi), + DEVMETHOD(pcib_release_msi, generic_pcie_release_msi), + DEVMETHOD(pcib_alloc_msix, generic_pcie_alloc_msix), + DEVMETHOD(pcib_release_msix, generic_pcie_release_msix), + DEVMETHOD(pcib_map_msi, generic_pcie_map_msi), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_devinfo, generic_pcie_ofw_get_devinfo), |