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
This commit is contained in:
Andrew Turner 2016-05-16 12:18:30 +00:00
parent c6cd01d924
commit 1beaee0c3a
2 changed files with 20 additions and 20 deletions

View File

@ -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, device_t child, int count, int maxcount,
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, device_t child, int irq, uint64_t *addr,
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

View File

@ -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
};