diff options
author | imp <imp@FreeBSD.org> | 2001-08-10 06:07:20 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2001-08-10 06:07:20 +0000 |
commit | bb40f57a7caad930203ee3bf5e653cd8d69e1019 (patch) | |
tree | 374f710edbd3b68599fd608c4de735d478d8ea94 /sys/pccard/pcic_isa.c | |
parent | 41502082f3ff6465a04cd16ed0469c21b8cc1694 (diff) | |
download | FreeBSD-src-bb40f57a7caad930203ee3bf5e653cd8d69e1019.zip FreeBSD-src-bb40f57a7caad930203ee3bf5e653cd8d69e1019.tar.gz |
Move ISA interrupt ISR and timeout routines to pcic from pcic_isa so
that we can use them in the pci code when we have to fall back to ISA
interrupt routing.
Diffstat (limited to 'sys/pccard/pcic_isa.c')
-rw-r--r-- | sys/pccard/pcic_isa.c | 77 |
1 files changed, 2 insertions, 75 deletions
diff --git a/sys/pccard/pcic_isa.c b/sys/pccard/pcic_isa.c index 860d800..4b0072e 100644 --- a/sys/pccard/pcic_isa.c +++ b/sys/pccard/pcic_isa.c @@ -75,10 +75,6 @@ static struct { { "Intel i82365SL-DF", PCIC_DF_POWER} }; -static driver_intr_t pcicintr; -static int pcicintr1(void *); -static timeout_t pcictimeout; - /* * Look for an Intel PCIC (or compatible). * For each available slot, allocate a PC-CARD slot. @@ -317,7 +313,7 @@ pcic_isa_attach(device_t dev) irq = 0; if (r != NULL) { error = bus_setup_intr(dev, r, INTR_TYPE_MISC, - pcicintr, (void *) sc, &sc->ih); + pcic_isa_intr, (void *) sc, &sc->ih); if (error) { pcic_dealloc(dev); return (error); @@ -327,7 +323,7 @@ pcic_isa_attach(device_t dev) } sc->irq = irq; if (irq == 0) { - sc->slot_poll = pcictimeout; + sc->slot_poll = pcic_timeout; sc->timeout_ch = timeout(sc->slot_poll, (void *) sc, hz/2); device_printf(dev, "Polling mode\n"); } @@ -335,75 +331,6 @@ pcic_isa_attach(device_t dev) return (pcic_attach(dev)); } -/* - * Wrapper function for pcicintr so that signatures match. - */ -static void -pcicintr(void *arg) -{ - pcicintr1(arg); -} - -/* - * PCIC timer. If the controller doesn't have a free IRQ to use - * or if interrupt steering doesn't work, poll the controller for - * insertion/removal events. - */ -static void -pcictimeout(void *chan) -{ - struct pcic_softc *sc = (struct pcic_softc *) chan; - - if (pcicintr1(chan) != 0) { - device_printf(sc->dev, - "Static bug detected, ignoring hardware."); - sc->slot_poll = 0; - return; - } - sc->timeout_ch = timeout(sc->slot_poll, chan, hz/2); -} - -/* - * PCIC Interrupt handler. - * Check each slot in turn, and read the card status change - * register. If this is non-zero, then a change has occurred - * on this card, so send an event to the main code. - */ -static int -pcicintr1(void *arg) -{ - int slot, s; - u_int8_t chg; - struct pcic_softc *sc = (struct pcic_softc *) arg; - struct pcic_slot *sp = &sc->slots[0]; - - s = splhigh(); - for (slot = 0; slot < PCIC_CARD_SLOTS; slot++, sp++) { - if (sp->slt == NULL) - continue; - if ((chg = sp->getb(sp, PCIC_STAT_CHG)) != 0) { - /* - * if chg is 0xff, then we know that we've hit - * the famous "static bug" for some desktop - * pcmcia cards. This is caused by static - * discharge frying the poor card's mind and - * it starts return 0xff forever. We return - * an error and stop polling the card. When - * we're interrupt based, we never see this. - * The card just goes away silently. - */ - if (chg == 0xff) { - splx(s); - return (EIO); - } - if (chg & PCIC_CDTCH) - pcic_do_stat_delta(sp); - } - } - splx(s); - return (0); -} - static device_method_t pcic_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pcic_isa_probe), |