[BACK]Return to cy_isa.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / isa

Annotation of src/sys/dev/isa/cy_isa.c, Revision 1.13

1.13    ! lukem       1: /*     $NetBSD: cy_isa.c,v 1.12 2001/01/20 02:26:39 thorpej Exp $      */
1.1       christos    2:
                      3: /*
                      4:  * cy.c
                      5:  *
                      6:  * Driver for Cyclades Cyclom-8/16/32 multiport serial cards
                      7:  * (currently not tested with Cyclom-32 cards)
                      8:  *
                      9:  * Timo Rossi, 1996
                     10:  */
1.13    ! lukem      11:
        !            12: #include <sys/cdefs.h>
        !            13: __KERNEL_RCSID(0, "$NetBSD$");
1.1       christos   14:
                     15: #include <sys/param.h>
                     16: #include <sys/systm.h>
                     17: #include <sys/device.h>
                     18:
                     19: #include <machine/bus.h>
                     20: #include <machine/intr.h>
                     21:
                     22: #include <dev/isa/isavar.h>
                     23: #include <dev/isa/isareg.h>
                     24:
                     25: #include <dev/ic/cd1400reg.h>
                     26: #include <dev/ic/cyreg.h>
                     27: #include <dev/ic/cyvar.h>
                     28:
1.11      thorpej    29: int    cy_isa_probe(struct device *, struct cfdata *, void *);
                     30: void   cy_isa_attach(struct device *, struct device *, void *);
1.1       christos   31:
                     32: struct cfattach cy_isa_ca = {
1.11      thorpej    33:        sizeof(struct cy_softc), cy_isa_probe, cy_isa_attach
1.1       christos   34: };
                     35:
1.11      thorpej    36: int
                     37: cy_isa_probe(struct device *parent, struct cfdata *match, void *aux)
1.1       christos   38: {
                     39:        struct isa_attach_args *ia = aux;
                     40:        struct cy_softc sc;
1.2       thorpej    41:        int found;
1.1       christos   42:
                     43:        memcpy(&sc.sc_dev, match, sizeof(struct device));
                     44:
1.5       thorpej    45:        sc.sc_memt = ia->ia_memt;
1.1       christos   46:        sc.sc_bustype = CY_BUSTYPE_ISA;
1.6       thorpej    47:
1.9       christos   48:        /* Disallow wildcarded memory address. */
1.11      thorpej    49:        if (ia->ia_maddr == ISACF_IOMEM_DEFAULT)
1.6       thorpej    50:                return (0);
1.1       christos   51:
1.11      thorpej    52:        if (ia->ia_irq == IRQUNK)
1.1       christos   53:                return 0;
                     54:
1.5       thorpej    55:        if (bus_space_map(ia->ia_memt, ia->ia_maddr, CY_MEMSIZE, 0,
                     56:            &sc.sc_bsh) != 0)
1.1       christos   57:                return 0;
                     58:
1.2       thorpej    59:        found = cy_find(&sc);
1.1       christos   60:
1.5       thorpej    61:        bus_space_unmap(ia->ia_memt, sc.sc_bsh, CY_MEMSIZE);
1.1       christos   62:
1.2       thorpej    63:        if (found) {
                     64:                ia->ia_iosize = 0;
                     65:                ia->ia_msize = CY_MEMSIZE;
                     66:        }
1.1       christos   67:
1.11      thorpej    68:        return (found);
1.1       christos   69: }
                     70:
1.11      thorpej    71: void
                     72: cy_isa_attach(struct device *parent, struct device *self, void *aux)
1.1       christos   73: {
                     74:        struct cy_softc *sc = (void *) self;
                     75:        struct isa_attach_args *ia = aux;
                     76:
1.5       thorpej    77:        sc->sc_memt = ia->ia_memt;
1.1       christos   78:        sc->sc_bustype = CY_BUSTYPE_ISA;
                     79:
1.11      thorpej    80:        printf(": Cyclades-Y multiport serial\n");
                     81:
1.5       thorpej    82:        if (bus_space_map(ia->ia_memt, ia->ia_maddr, CY_MEMSIZE, 0,
1.7       thorpej    83:            &sc->sc_bsh) != 0) {
1.11      thorpej    84:                printf("%s: unable to map device registers\n",
                     85:                    sc->sc_dev.dv_xname);
1.7       thorpej    86:                return;
                     87:        }
1.1       christos   88:
1.7       thorpej    89:        if (cy_find(sc) == 0) {
1.11      thorpej    90:                printf("%s: unable to find CD1400s\n", sc->sc_dev.dv_xname);
1.7       thorpej    91:                return;
                     92:        }
1.1       christos   93:
1.12      thorpej    94:        cy_attach(sc);
1.1       christos   95:
                     96:        sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq,
                     97:            IST_EDGE, IPL_TTY, cy_intr, sc);
                     98:        if (sc->sc_ih == NULL)
1.11      thorpej    99:                printf("%s: unable to establish interrupt",
                    100:                    sc->sc_dev.dv_xname);
1.1       christos  101: }

CVSweb <webmaster@jp.NetBSD.org>