Author: andrew
Date: Tue May 10 15:45:59 2016
New Revision: 299370
URL: https://svnweb.freebsd.org/changeset/base/299370

Log:
  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

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem.c
  head/sys/arm64/cavium/thunder_pcie_pem_fdt.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem.c
==============================================================================
--- head/sys/arm64/cavium/thunder_pcie_pem.c    Tue May 10 15:04:24 2016        
(r299369)
+++ head/sys/arm64/cavium/thunder_pcie_pem.c    Tue May 10 15:45:59 2016        
(r299370)
@@ -128,9 +128,9 @@ static struct resource * thunder_pem_all
     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_metho
        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

Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
==============================================================================
--- head/sys/arm64/cavium/thunder_pcie_pem_fdt.c        Tue May 10 15:04:24 
2016        (r299369)
+++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.c        Tue May 10 15:45:59 
2016        (r299370)
@@ -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));
+}
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to