summaryrefslogtreecommitdiffstats
path: root/sys/arm64
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2016-05-10 15:45:59 +0000
committerandrew <andrew@FreeBSD.org>2016-05-10 15:45:59 +0000
commite08747edd2f2b5a853923dbf1483e6ce3bf5ab5a (patch)
treec9f16588ac149b6e9ebfe1bf200624d1c5a266ce /sys/arm64
parent462ab9427b8d77c31c8eae7853b42328dddda5f8 (diff)
downloadFreeBSD-src-e08747edd2f2b5a853923dbf1483e6ce3bf5ab5a.zip
FreeBSD-src-e08747edd2f2b5a853923dbf1483e6ce3bf5ab5a.tar.gz
Push the logic to talk with the MSI/MSI-X interrupt controller to the FDT
attachment. This is where it will live when we import intrng as it will need to look at either the msi-parent or msi-map FDT properties. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/arm64')
-rw-r--r--sys/arm64/cavium/thunder_pcie_pem.c33
-rw-r--r--sys/arm64/cavium/thunder_pcie_pem_fdt.c54
2 files changed, 76 insertions, 11 deletions
diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c
index e9e9c1a..78514b9 100644
--- a/sys/arm64/cavium/thunder_pcie_pem.c
+++ b/sys/arm64/cavium/thunder_pcie_pem.c
@@ -128,9 +128,9 @@ 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_map_msi(device_t, device_t, int, uint64_t *, uint32_t *);
static int thunder_pem_attach(device_t);
static int thunder_pem_deactivate_resource(device_t, device_t, int, int,
struct resource *);
@@ -177,11 +177,11 @@ static device_method_t thunder_pem_methods[] = {
DEVMETHOD(pcib_maxslots, thunder_pem_maxslots),
DEVMETHOD(pcib_read_config, thunder_pem_read_config),
DEVMETHOD(pcib_write_config, thunder_pem_write_config),
- 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(pcib_map_msi, thunder_pem_map_msi),
DEVMETHOD_END
};
@@ -327,37 +327,48 @@ static int
thunder_pem_alloc_msi(device_t pci, device_t child, int count, int maxcount,
int *irqs)
{
+ device_t bus;
- return (arm_alloc_msi(pci, child, count, maxcount, irqs));
+ bus = device_get_parent(pci);
+ return (PCIB_ALLOC_MSI(device_get_parent(bus), child, count, maxcount,
+ irqs));
}
static int
thunder_pem_release_msi(device_t pci, device_t child, int count, int *irqs)
{
+ device_t bus;
- return (arm_release_msi(pci, child, count, irqs));
+ bus = device_get_parent(pci);
+ return (PCIB_RELEASE_MSI(device_get_parent(bus), child, count, irqs));
}
static int
-thunder_pem_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
- uint32_t *data)
+thunder_pem_alloc_msix(device_t pci, device_t child, int *irq)
{
+ device_t bus;
- return (arm_map_msi(pci, child, irq, addr, data));
+ bus = device_get_parent(pci);
+ return (PCIB_ALLOC_MSIX(device_get_parent(bus), child, irq));
}
static int
-thunder_pem_alloc_msix(device_t pci, device_t child, int *irq)
+thunder_pem_release_msix(device_t pci, device_t child, int irq)
{
+ device_t bus;
- return (arm_alloc_msix(pci, child, irq));
+ bus = device_get_parent(pci);
+ return (PCIB_RELEASE_MSIX(device_get_parent(bus), child, irq));
}
static int
-thunder_pem_release_msix(device_t pci, device_t child, int irq)
+thunder_pem_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
+ uint32_t *data)
{
+ device_t bus;
- return (arm_release_msix(pci, child, irq));
+ bus = device_get_parent(pci);
+ return (PCIB_MAP_MSI(device_get_parent(bus), child, irq, addr, data));
}
static int
diff --git a/sys/arm64/cavium/thunder_pcie_pem_fdt.c b/sys/arm64/cavium/thunder_pcie_pem_fdt.c
index 39fed31..7c3a436 100644
--- a/sys/arm64/cavium/thunder_pcie_pem_fdt.c
+++ b/sys/arm64/cavium/thunder_pcie_pem_fdt.c
@@ -51,15 +51,32 @@ __FBSDID("$FreeBSD$");
#include <dev/pci/pcib_private.h>
#include <dev/pci/pci_host_generic.h>
+#include <machine/intr.h>
+
#include "thunder_pcie_common.h"
#include "thunder_pcie_pem.h"
+#include "pcib_if.h"
+
static int thunder_pem_fdt_probe(device_t);
+static int thunder_pem_fdt_alloc_msix(device_t, device_t, int *);
+static int thunder_pem_fdt_release_msix(device_t, device_t, int);
+static int thunder_pem_fdt_alloc_msi(device_t, device_t, int, int, int *);
+static int thunder_pem_fdt_release_msi(device_t, device_t, int, int *);
+static int thunder_pem_fdt_map_msi(device_t, device_t, int, uint64_t *,
+ uint32_t *);
static device_method_t thunder_pem_fdt_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, thunder_pem_fdt_probe),
+ /* pcib interface */
+ DEVMETHOD(pcib_alloc_msix, thunder_pem_fdt_alloc_msix),
+ DEVMETHOD(pcib_release_msix, thunder_pem_fdt_release_msix),
+ DEVMETHOD(pcib_alloc_msi, thunder_pem_fdt_alloc_msi),
+ DEVMETHOD(pcib_release_msi, thunder_pem_fdt_release_msi),
+ DEVMETHOD(pcib_map_msi, thunder_pem_fdt_map_msi),
+
/* End */
DEVMETHOD_END
};
@@ -88,3 +105,40 @@ thunder_pem_fdt_probe(device_t dev)
return (ENXIO);
}
+
+static int
+thunder_pem_fdt_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_fdt_release_msi(device_t pci, device_t child, int count, int *irqs)
+{
+
+ return (arm_release_msi(pci, child, count, irqs));
+}
+
+static int
+thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq)
+{
+
+ return (arm_alloc_msix(pci, child, irq));
+}
+
+static int
+thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq)
+{
+
+ return (arm_release_msix(pci, child, irq));
+}
+
+static int
+thunder_pem_fdt_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));
+}
OpenPOWER on IntegriCloud