Author: andrew
Date: Mon May 16 12:18:30 2016
New Revision: 299941
URL: https://svnweb.freebsd.org/changeset/base/299941

Log:
  Call ofw_bus_msimap to find the parent MSI controller, it may not use the
  msi-parent property.
  
  Obtained from:        ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/pci/pci_host_generic.c
  head/sys/dev/pci/pci_host_generic.h

Modified: head/sys/dev/pci/pci_host_generic.c
==============================================================================
--- head/sys/dev/pci/pci_host_generic.c Mon May 16 12:15:19 2016        
(r299940)
+++ head/sys/dev/pci/pci_host_generic.c Mon May 16 12:18:30 2016        
(r299941)
@@ -235,10 +235,6 @@ pci_host_generic_attach(device_t dev)
        node = ofw_bus_get_node(dev);
        ofw_bus_setup_iinfo(node, &sc->pci_iinfo, sizeof(cell_t));
 
-       /* Find the MSI interrupt handler */
-       OF_searchencprop(node, "msi-parent", &sc->msi_parent,
-           sizeof(sc->msi_parent));
-
        device_add_child(dev, "pci", -1);
        return (bus_generic_attach(dev));
 }
@@ -671,10 +667,11 @@ generic_pcie_alloc_msi(device_t pci, dev
     int *irqs)
 {
 #if defined(INTRNG)
-       struct generic_pcie_softc *sc;
+       phandle_t msi_parent;
 
-       sc = device_get_softc(pci);
-       return (intr_alloc_msi(pci, child, sc->msi_parent, count, maxcount,
+       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));
 #elif defined(__aarch64__)
        return (arm_alloc_msi(pci, child, count, maxcount, irqs));
@@ -687,10 +684,11 @@ static int
 generic_pcie_release_msi(device_t pci, device_t child, int count, int *irqs)
 {
 #if defined(INTRNG)
-       struct generic_pcie_softc *sc;
+       phandle_t msi_parent;
 
-       sc = device_get_softc(pci);
-       return (intr_release_msi(pci, child, sc->msi_parent, count, irqs));
+       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));
 #elif defined(__aarch64__)
        return (arm_release_msi(pci, child, count, irqs));
 #else
@@ -703,10 +701,11 @@ generic_pcie_map_msi(device_t pci, devic
     uint32_t *data)
 {
 #if defined(INTRNG)
-       struct generic_pcie_softc *sc;
+       phandle_t msi_parent;
 
-       sc = device_get_softc(pci);
-       return (intr_map_msi(pci, child, sc->msi_parent, irq, addr, data));
+       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));
 #elif defined(__aarch64__)
        return (arm_map_msi(pci, child, irq, addr, data));
 #else
@@ -718,10 +717,11 @@ static int
 generic_pcie_alloc_msix(device_t pci, device_t child, int *irq)
 {
 #if defined(INTRNG)
-       struct generic_pcie_softc *sc;
+       phandle_t msi_parent;
 
-       sc = device_get_softc(pci);
-       return (intr_alloc_msix(pci, child, sc->msi_parent, irq));
+       ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+           NULL);
+       return (intr_alloc_msix(pci, child, msi_parent, irq));
 #elif defined(__aarch64__)
        return (arm_alloc_msix(pci, child, irq));
 #else
@@ -733,10 +733,11 @@ static int
 generic_pcie_release_msix(device_t pci, device_t child, int irq)
 {
 #if defined(INTRNG)
-       struct generic_pcie_softc *sc;
+       phandle_t msi_parent;
 
-       sc = device_get_softc(pci);
-       return (intr_release_msix(pci, child, sc->msi_parent, irq));
+       ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+           NULL);
+       return (intr_release_msix(pci, child, msi_parent, irq));
 #elif defined(__aarch64__)
        return (arm_release_msix(pci, child, irq));
 #else

Modified: head/sys/dev/pci/pci_host_generic.h
==============================================================================
--- head/sys/dev/pci/pci_host_generic.h Mon May 16 12:15:19 2016        
(r299940)
+++ head/sys/dev/pci/pci_host_generic.h Mon May 16 12:18:30 2016        
(r299941)
@@ -60,7 +60,6 @@ struct generic_pcie_softc {
        bus_space_handle_t      ioh;
 #ifdef FDT
        struct ofw_bus_iinfo    pci_iinfo;
-       phandle_t               msi_parent;
 #endif
 };
 
_______________________________________________
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