diff options
author | mjacob <mjacob@FreeBSD.org> | 2000-11-08 18:48:21 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2000-11-08 18:48:21 +0000 |
commit | 5c912a20914cf091139f0e1b9924cde123f7e254 (patch) | |
tree | 95500e24e08570253ead3eef56363ed85fe1d248 /sys/alpha | |
parent | 5dd5b4a1d4b147bdcd922658b1918cbe3783c131 (diff) | |
download | FreeBSD-src-5c912a20914cf091139f0e1b9924cde123f7e254.zip FreeBSD-src-5c912a20914cf091139f0e1b9924cde123f7e254.tar.gz |
Clean this is up a bit for multiple MIDs... We can figure out which MID
for an interrupt to enable/disable from the vector (and GID too, if we
had multiple GIDs)- so, stupidly for now, search for the right mcpcia's
softc so we have the right base address for the bridge CSR to apply
IRQ bit-twiddle's to. Alas- this doesn't yet allow us to run, but it's
the right direction.
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/mcbus/mcpcia.c | 99 |
1 files changed, 59 insertions, 40 deletions
diff --git a/sys/alpha/mcbus/mcpcia.c b/sys/alpha/mcbus/mcpcia.c index 0712261..2a229b3 100644 --- a/sys/alpha/mcbus/mcpcia.c +++ b/sys/alpha/mcbus/mcpcia.c @@ -73,7 +73,7 @@ struct mcpcia_softc { vm_offset_t io_base; /* sparse i/o */ int mcpcia_inst; /* our mcpcia instance # */ struct swiz_space io_space; /* accessor for ports */ - struct swiz_space mem_space; /* accessor for memory */ + struct swiz_space mem_space; /* accessor for memory */ struct rman io_rman; /* resource manager for ports */ struct rman mem_rman; /* resource manager for memory */ }; @@ -261,63 +261,82 @@ mcpcia_disable_intr(struct mcpcia_softc *sc, int irq) static void mcpcia_disable_intr_vec(int vector) { - int gid, mid, irq; - vm_offset_t p; + int mid, irq; + struct mcpcia_softc *sc = mcpcia_root; + + if (vector < MCPCIA_VEC_PCI) { + printf("EISA isable (0x%x)\n", vector); + return; + } - printf("D<%03x>", vector); if (vector == MCPCIA_VEC_NCR) { mid = 5; irq = 16; } else { + int tmp, slot; + tmp = vector - MCPCIA_VEC_PCI; + mid = (tmp / MCPCIA_VECWIDTH_PER_MCPCIA) + 4; + tmp &= (MCPCIA_VECWIDTH_PER_MCPCIA - 1); + slot = tmp / MCPCIA_VECWIDTH_PER_SLOT; + if (slot < 2 || slot > 5) { + printf("Bad slot (%d) for vector %x\n", slot, vector); + return; + } + tmp -= (2 * MCPCIA_VECWIDTH_PER_SLOT); + irq = (tmp / MCPCIA_VECWIDTH_PER_INTPIN); irq = ((vector - 0x900) >> 4) - 8; - if (irq < 32) - mid = 4; - else { - irq -= 32; - mid = 5; + } + printf("D<%03x>=%d,%d\n", vector, mid, irq); + while (sc) { + if (mcbus_get_mid(sc->dev) == mid) { + break; } + sc = sc->next; } - - gid = MCBUS_GID_FROM_INSTANCE(0); - p = (MCBUS_IOSPACE | - (((u_int64_t) gid) << MCBUS_GID_SHIFT) | - (((u_int64_t) mid) << MCBUS_MID_SHIFT) | - MCPCIA_PCI_BRIDGE | - _MCPCIA_INT_MASK0); - - alpha_mb(); - REGVAL(p) &= ~(1 << irq); - alpha_mb(); + if (sc == NULL) { + panic("couldn't find MCPCIA softc for vector 0x%x", vector); + } + mcpcia_disable_intr(sc, irq); } static void mcpcia_enable_intr_vec(int vector) { - int gid, mid, irq; - vm_offset_t p; + int mid, irq; + struct mcpcia_softc *sc = mcpcia_root; + + if (vector < MCPCIA_VEC_PCI) { + printf("EISA ensable (0x%x)\n", vector); + return; + } - printf("E<%03x>", vector); if (vector == MCPCIA_VEC_NCR) { mid = 5; irq = 16; } else { - irq = ((vector - 0x900) >> 4) - 8; - if (irq < 32) - mid = 4; - else - mid = 5; + int tmp, slot; + tmp = vector - MCPCIA_VEC_PCI; + mid = (tmp / MCPCIA_VECWIDTH_PER_MCPCIA) + 4; + tmp &= (MCPCIA_VECWIDTH_PER_MCPCIA - 1); + slot = tmp / MCPCIA_VECWIDTH_PER_SLOT; + if (slot < 2 || slot > 5) { + printf("Bad slot (%d) for vector %x\n", slot, vector); + return; + } + tmp -= (2 * MCPCIA_VECWIDTH_PER_SLOT); + irq = (tmp / MCPCIA_VECWIDTH_PER_INTPIN); } - - gid = MCBUS_GID_FROM_INSTANCE(0); - p = (MCBUS_IOSPACE | - (((u_int64_t) gid) << MCBUS_GID_SHIFT) | - (((u_int64_t) mid) << MCBUS_MID_SHIFT) | - MCPCIA_PCI_BRIDGE | - _MCPCIA_INT_MASK0); - - alpha_mb(); - REGVAL(p) |= (1 << irq); - alpha_mb(); + printf("E<%03x>=%d,%d\n", vector, mid, irq); + while (sc) { + if (mcbus_get_mid(sc->dev) == mid) { + break; + } + sc = sc->next; + } + if (sc == NULL) { + panic("couldn't find MCPCIA softc for vector 0x%x", vector); + } + mcpcia_enable_intr(sc, irq); } static int @@ -343,7 +362,7 @@ mcpcia_setup_intr(device_t dev, device_t child, struct resource *ir, int flags, if (slot == 0) { device_t bdev; - /* bridged - get slot from granparent */ + /* bridged - get slot from grandparent */ /* note that this is broken for all but the most trival case */ bdev = device_get_parent(device_get_parent(child)); slot = pci_get_slot(bdev); |