With rev 1.24 of sys/powerpc/powermac/macio.c, we now get a
total of 6 interrupt resources for scc(4) on macio(4). This is 3 per channel, of which the 1st of each channel is the interrupt associated with the SCC. The other 2 are for DMA operation. Change scc_bfe_attach() to accept an argument that's the number of interrupts per channel (ipc) and change each bus front-end (bfe) to pass that argument through a wrapper for the device_attach method. For now, we only allocate the 1st interrupt of each channel to perserve behaviour.
This commit is contained in:
parent
4924db935d
commit
6239f9e5f1
@ -138,7 +138,7 @@ struct scc_softc {
|
||||
extern devclass_t scc_devclass;
|
||||
extern char scc_driver_name[];
|
||||
|
||||
int scc_bfe_attach(device_t dev);
|
||||
int scc_bfe_attach(device_t dev, u_int ipc);
|
||||
int scc_bfe_detach(device_t dev);
|
||||
int scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid);
|
||||
|
||||
|
@ -64,10 +64,17 @@ scc_ebus_probe(device_t dev)
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
scc_ebus_attach(device_t dev)
|
||||
{
|
||||
|
||||
return (scc_bfe_attach(dev, 0));
|
||||
}
|
||||
|
||||
static device_method_t scc_ebus_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, scc_ebus_probe),
|
||||
DEVMETHOD(device_attach, scc_bfe_attach),
|
||||
DEVMETHOD(device_attach, scc_ebus_attach),
|
||||
DEVMETHOD(device_detach, scc_bfe_detach),
|
||||
|
||||
DEVMETHOD(bus_alloc_resource, scc_bus_alloc_resource),
|
||||
|
@ -61,10 +61,17 @@ scc_macio_probe(device_t dev)
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
scc_macio_attach(device_t dev)
|
||||
{
|
||||
|
||||
return (scc_bfe_attach(dev, 3));
|
||||
}
|
||||
|
||||
static device_method_t scc_macio_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, scc_macio_probe),
|
||||
DEVMETHOD(device_attach, scc_bfe_attach),
|
||||
DEVMETHOD(device_attach, scc_macio_attach),
|
||||
DEVMETHOD(device_detach, scc_bfe_detach),
|
||||
|
||||
DEVMETHOD(bus_alloc_resource, scc_bus_alloc_resource),
|
||||
|
@ -69,10 +69,17 @@ scc_quicc_probe(device_t dev)
|
||||
return (scc_bfe_probe(dev, 0, rclk, 0));
|
||||
}
|
||||
|
||||
static int
|
||||
scc_quicc_attach(device_t dev)
|
||||
{
|
||||
|
||||
return (scc_bfe_attach(dev, 0));
|
||||
}
|
||||
|
||||
static device_method_t scc_quicc_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, scc_quicc_probe),
|
||||
DEVMETHOD(device_attach, scc_bfe_attach),
|
||||
DEVMETHOD(device_attach, scc_quicc_attach),
|
||||
DEVMETHOD(device_detach, scc_bfe_detach),
|
||||
|
||||
DEVMETHOD(bus_alloc_resource, scc_bus_alloc_resource),
|
||||
|
@ -61,10 +61,17 @@ scc_sbus_probe(device_t dev)
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
scc_sbus_attach(device_t dev)
|
||||
{
|
||||
|
||||
return (scc_bfe_attach(dev, 0));
|
||||
}
|
||||
|
||||
static device_method_t scc_sbus_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, scc_sbus_probe),
|
||||
DEVMETHOD(device_attach, scc_bfe_attach),
|
||||
DEVMETHOD(device_attach, scc_sbus_attach),
|
||||
DEVMETHOD(device_detach, scc_bfe_detach),
|
||||
|
||||
DEVMETHOD(bus_alloc_resource, scc_bus_alloc_resource),
|
||||
|
@ -94,7 +94,7 @@ scc_bfe_intr(void *arg)
|
||||
}
|
||||
|
||||
int
|
||||
scc_bfe_attach(device_t dev)
|
||||
scc_bfe_attach(device_t dev, u_int ipc)
|
||||
{
|
||||
struct resource_list_entry *rle;
|
||||
struct scc_chan *ch;
|
||||
@ -144,9 +144,18 @@ scc_bfe_attach(device_t dev)
|
||||
M_SCC, M_WAITOK | M_ZERO);
|
||||
for (c = 0; c < cl->cl_channels; c++) {
|
||||
ch = &sc->sc_chan[c];
|
||||
ch->ch_irid = c;
|
||||
/*
|
||||
* XXX temporary hack. If we have more than 1 interrupt
|
||||
* per channel, allocate the first for the channel. At
|
||||
* this time only the macio bus front-end has more than
|
||||
* 1 interrupt per channel and we don't use the 2nd and
|
||||
* 3rd, because we don't support DMA yet.
|
||||
*/
|
||||
ch->ch_irid = c * ipc;
|
||||
ch->ch_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ,
|
||||
&ch->ch_irid, RF_ACTIVE | RF_SHAREABLE);
|
||||
if (ipc == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user