summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/ofw/ofw_pci.c4
-rw-r--r--sys/powerpc/ofw/ofw_pcib_pci.c6
-rw-r--r--sys/powerpc/ofw/ofw_pcibus.c36
-rw-r--r--sys/powerpc/powerpc/nexus.c17
-rw-r--r--sys/powerpc/pseries/vdevice.c2
5 files changed, 28 insertions, 37 deletions
diff --git a/sys/powerpc/ofw/ofw_pci.c b/sys/powerpc/ofw/ofw_pci.c
index 692b1ab..8543035 100644
--- a/sys/powerpc/ofw/ofw_pci.c
+++ b/sys/powerpc/ofw/ofw_pci.c
@@ -273,9 +273,7 @@ ofw_pci_route_interrupt(device_t bus, device_t dev, int pin)
&sc->sc_pci_iinfo, &reg, sizeof(reg), &pintr, sizeof(pintr),
mintr, sizeof(mintr), &iparent);
if (intrcells) {
- pintr = ofw_bus_map_intr(dev, iparent, mintr[0]);
- if (intrcells == 2)
- ofw_bus_config_intr(dev, pintr, mintr[1]);
+ pintr = ofw_bus_map_intr(dev, iparent, intrcells, mintr);
return (pintr);
}
diff --git a/sys/powerpc/ofw/ofw_pcib_pci.c b/sys/powerpc/ofw/ofw_pcib_pci.c
index df274c4..823f7c9 100644
--- a/sys/powerpc/ofw/ofw_pcib_pci.c
+++ b/sys/powerpc/ofw/ofw_pcib_pci.c
@@ -158,10 +158,8 @@ ofw_pcib_pci_route_interrupt(device_t bridge, device_t dev, int intpin)
* it again on higher levels - that causes problems
* in some cases, and never seems to be required.
*/
- mintr[0] = ofw_bus_map_intr(dev, iparent, mintr[0]);
- if (intrcells == 2)
- ofw_bus_config_intr(dev, mintr[0], mintr[1]);
-
+ mintr[0] = ofw_bus_map_intr(dev, iparent, intrcells,
+ mintr);
return (mintr[0]);
}
} else if (intpin >= 1 && intpin <= 4) {
diff --git a/sys/powerpc/ofw/ofw_pcibus.c b/sys/powerpc/ofw/ofw_pcibus.c
index f1063a1..ee14ccf 100644
--- a/sys/powerpc/ofw/ofw_pcibus.c
+++ b/sys/powerpc/ofw/ofw_pcibus.c
@@ -216,13 +216,9 @@ ofw_pcibus_enum_devtree(device_t dev, u_int domain, u_int busno)
"#interrupt-cells", &icells,
sizeof(icells));
intr[0] = ofw_bus_map_intr(dev, iparent,
- intr[0]);
+ icells, intr);
}
- if (iparent != 0 && icells > 1)
- ofw_bus_config_intr(dev, intr[0],
- intr[1]);
-
resource_list_add(&dinfo->opd_dinfo.resources,
SYS_RES_IRQ, 0, intr[0], intr[0], 1);
}
@@ -309,18 +305,18 @@ ofw_pcibus_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf,
static int
ofw_pcibus_assign_interrupt(device_t dev, device_t child)
{
- ofw_pci_intr_t intr;
+ ofw_pci_intr_t intr[2];
phandle_t node, iparent;
- int isz;
+ int isz, icells;
node = ofw_bus_get_node(child);
if (node == -1) {
/* Non-firmware enumerated child, use standard routing */
- intr = pci_get_intpin(child);
+ intr[0] = pci_get_intpin(child);
return (PCIB_ROUTE_INTERRUPT(device_get_parent(dev), child,
- intr));
+ intr[0]));
}
/*
@@ -331,24 +327,28 @@ ofw_pcibus_assign_interrupt(device_t dev, device_t child)
iparent = -1;
if (OF_getprop(node, "interrupt-parent", &iparent, sizeof(iparent)) < 0)
iparent = -1;
+ icells = 1;
+ if (iparent != -1)
+ OF_getprop(OF_xref_phandle(iparent), "#interrupt-cells",
+ &icells, sizeof(icells));
/*
* Any AAPL,interrupts property gets priority and is
* fully specified (i.e. does not need routing)
*/
- isz = OF_getprop(node, "AAPL,interrupts", &intr, sizeof(intr));
- if (isz == sizeof(intr))
- return ((iparent == -1) ? intr : ofw_bus_map_intr(dev, iparent,
- intr));
+ isz = OF_getprop(node, "AAPL,interrupts", intr, sizeof(intr));
+ if (isz == sizeof(intr[0])*icells)
+ return ((iparent == -1) ? intr[0] : ofw_bus_map_intr(dev,
+ iparent, icells, intr));
- isz = OF_getprop(node, "interrupts", &intr, sizeof(intr));
- if (isz == sizeof(intr)) {
+ isz = OF_getprop(node, "interrupts", intr, sizeof(intr));
+ if (isz == sizeof(intr[0])*icells) {
if (iparent != -1)
- intr = ofw_bus_map_intr(dev, iparent, intr);
+ intr[0] = ofw_bus_map_intr(dev, iparent, icells, intr);
} else {
/* No property: our best guess is the intpin. */
- intr = pci_get_intpin(child);
+ intr[0] = pci_get_intpin(child);
}
/*
@@ -361,7 +361,7 @@ ofw_pcibus_assign_interrupt(device_t dev, device_t child)
* will always use the route_interrupt method, and treat exceptions
* on the level they become apparent.
*/
- return (PCIB_ROUTE_INTERRUPT(device_get_parent(dev), child, intr));
+ return (PCIB_ROUTE_INTERRUPT(device_get_parent(dev), child, intr[0]));
}
static const struct ofw_bus_devinfo *
diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c
index f7100f1..2e9bbe6 100644
--- a/sys/powerpc/powerpc/nexus.c
+++ b/sys/powerpc/powerpc/nexus.c
@@ -75,7 +75,6 @@ static bus_bind_intr_t nexus_bind_intr;
#endif
static bus_config_intr_t nexus_config_intr;
static ofw_bus_map_intr_t nexus_ofw_map_intr;
-static ofw_bus_config_intr_t nexus_ofw_config_intr;
static device_method_t nexus_methods[] = {
/* Bus interface */
@@ -90,7 +89,6 @@ static device_method_t nexus_methods[] = {
/* ofw_bus interface */
DEVMETHOD(ofw_bus_map_intr, nexus_ofw_map_intr),
- DEVMETHOD(ofw_bus_config_intr, nexus_ofw_config_intr),
DEVMETHOD_END
};
@@ -157,19 +155,16 @@ nexus_config_intr(device_t dev, int irq, enum intr_trigger trig,
}
static int
-nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int irq)
+nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells,
+ pcell_t *irq)
{
- return (MAP_IRQ(iparent, irq));
+ u_int intr = MAP_IRQ(iparent, irq[0]);
+ if (icells > 1)
+ powerpc_fw_config_intr(intr, irq[1]);
+ return (intr);
}
static int
-nexus_ofw_config_intr(device_t dev, device_t child, int irq, int sense)
-{
-
- return (powerpc_fw_config_intr(irq, sense));
-}
-
-static int
nexus_activate_resource(device_t bus __unused, device_t child __unused,
int type, int rid __unused, struct resource *r)
{
diff --git a/sys/powerpc/pseries/vdevice.c b/sys/powerpc/pseries/vdevice.c
index 54cd5dd..e733a9d 100644
--- a/sys/powerpc/pseries/vdevice.c
+++ b/sys/powerpc/pseries/vdevice.c
@@ -157,7 +157,7 @@ vdevice_attach(device_t dev)
u_int irq = intr[i];
if (iparent != -1)
irq = ofw_bus_map_intr(dev, iparent,
- intr[i]);
+ icells, &intr[i]);
resource_list_add(&dinfo->mdi_resources,
SYS_RES_IRQ, i, irq, irq, i);
OpenPOWER on IntegriCloud