From 26e3729fc0da3eab13ab771cd569b951c8554c2a Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 16 May 2016 10:03:57 +0000 Subject: [PATCH] Teach the ThunderX PCI PEM driver about intrng. This will be used later when arm64 is supported by intrng. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation --- sys/arm64/cavium/thunder_pcie_pem_fdt.c | 55 +++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/sys/arm64/cavium/thunder_pcie_pem_fdt.c b/sys/arm64/cavium/thunder_pcie_pem_fdt.c index 9e4770b302e5..7f0398e28dec 100644 --- a/sys/arm64/cavium/thunder_pcie_pem_fdt.c +++ b/sys/arm64/cavium/thunder_pcie_pem_fdt.c @@ -109,6 +109,60 @@ thunder_pem_fdt_probe(device_t dev) return (ENXIO); } +#ifdef INTRNG +static int +thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int maxcount, + int *irqs) +{ + phandle_t msi_parent; + + ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent, + NULL); + return (intr_alloc_msi(pci, child, msi_parent, count, maxcount, + irqs)); +} + +static int +thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int *irqs) +{ + phandle_t msi_parent; + + ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent, + NULL); + return (intr_release_msi(pci, child, msi_parent, count, irqs)); +} + +static int +thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq) +{ + phandle_t msi_parent; + + ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent, + NULL); + return (intr_alloc_msix(pci, child, msi_parent, irq)); +} + +static int +thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq) +{ + phandle_t msi_parent; + + ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent, + NULL); + return (intr_release_msix(pci, child, msi_parent, irq)); +} + +static int +thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, + uint32_t *data) +{ + phandle_t msi_parent; + + ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent, + NULL); + return (intr_map_msi(pci, child, msi_parent, irq, addr, data)); +} +#else static int thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int maxcount, int *irqs) @@ -145,6 +199,7 @@ thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, return (arm_map_msi(pci, child, irq, addr, data)); } +#endif static int thunder_pem_fdt_get_id(device_t dev, device_t child, enum pci_id_type type,