From cf9c1ecfd2ed4b4802a1d27e4e6e23c12790fbd0 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Wed, 20 Apr 2016 13:23:06 +0000 Subject: [PATCH] Pull out the MSI/MSI-X handling calls to simplify future intrng integration. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation --- sys/arm64/cavium/thunder_pcie_pem.c | 53 ++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c index 09ea206cacd6..b9c4c8771d3f 100644 --- a/sys/arm64/cavium/thunder_pcie_pem.c +++ b/sys/arm64/cavium/thunder_pcie_pem.c @@ -126,6 +126,11 @@ static int thunder_pem_adjust_resource(device_t, device_t, int, struct resource *, rman_res_t, rman_res_t); static struct resource * thunder_pem_alloc_resource(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); +static int thunder_pem_alloc_msi(device_t, device_t, int, int, int *); +static int thunder_pem_release_msi(device_t, device_t, int, int *); +static int thunder_pem_map_msi(device_t, device_t, int, uint64_t *, uint32_t *); +static int thunder_pem_alloc_msix(device_t, device_t, int *); +static int thunder_pem_release_msix(device_t, device_t, int); static int thunder_pem_attach(device_t); static int thunder_pem_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -169,11 +174,12 @@ static device_method_t thunder_pem_methods[] = { DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(pcib_map_msi, arm_map_msi), - DEVMETHOD(pcib_alloc_msix, arm_alloc_msix), - DEVMETHOD(pcib_release_msix, arm_release_msix), - DEVMETHOD(pcib_alloc_msi, arm_alloc_msi), - DEVMETHOD(pcib_release_msi, arm_release_msi), + DEVMETHOD(pcib_map_msi, thunder_pem_map_msi), + DEVMETHOD(pcib_alloc_msix, thunder_pem_alloc_msix), + DEVMETHOD(pcib_release_msix, thunder_pem_release_msix), + DEVMETHOD(pcib_alloc_msi, thunder_pem_alloc_msi), + DEVMETHOD(pcib_release_msi, thunder_pem_release_msi), + DEVMETHOD_END }; @@ -314,6 +320,43 @@ thunder_pem_adjust_resource(device_t dev, device_t child, int type, return (rman_adjust_resource(res, start, end)); } +static int +thunder_pem_alloc_msi(device_t pci, device_t child, int count, int maxcount, + int *irqs) +{ + + return (arm_alloc_msi(pci, child, count, maxcount, irqs)); +} + +static int +thunder_pem_release_msi(device_t pci, device_t child, int count, int *irqs) +{ + + return (arm_release_msi(pci, child, count, irqs)); +} + +static int +thunder_pem_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, + uint32_t *data) +{ + + return (arm_map_msi(pci, child, irq, addr, data)); +} + +static int +thunder_pem_alloc_msix(device_t pci, device_t child, int *irq) +{ + + return (arm_alloc_msix(pci, child, irq)); +} + +static int +thunder_pem_release_msix(device_t pci, device_t child, int irq) +{ + + return (arm_release_msix(pci, child, irq)); +} + static int thunder_pem_identify(device_t dev) {