The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/isa/cy_isa.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: cy_isa.c,v 1.17 2002/10/02 03:10:46 thorpej Exp $      */
    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  */
   11 
   12 #include <sys/cdefs.h>
   13 __KERNEL_RCSID(0, "$NetBSD: cy_isa.c,v 1.17 2002/10/02 03:10:46 thorpej Exp $");
   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 
   29 int     cy_isa_probe(struct device *, struct cfdata *, void *);
   30 void    cy_isa_attach(struct device *, struct device *, void *);
   31 
   32 CFATTACH_DECL(cy_isa, sizeof(struct cy_softc),
   33     cy_isa_probe, cy_isa_attach, NULL, NULL);
   34 
   35 int
   36 cy_isa_probe(struct device *parent, struct cfdata *match, void *aux)
   37 {
   38         struct isa_attach_args *ia = aux;
   39         struct cy_softc sc;
   40         int found;
   41 
   42         if (ia->ia_niomem < 1)
   43                 return (0);
   44         if (ia->ia_nirq < 1)
   45                 return (0);
   46 
   47         memcpy(&sc.sc_dev, match, sizeof(struct device));
   48 
   49         sc.sc_memt = ia->ia_memt;
   50         sc.sc_bustype = CY_BUSTYPE_ISA;
   51 
   52         /* Disallow wildcarded memory address. */
   53         if (ia->ia_iomem[0].ir_addr == ISACF_IOMEM_DEFAULT)
   54                 return 0;
   55         if (ia->ia_irq[0].ir_irq == ISACF_IRQ_DEFAULT)
   56                 return 0;
   57 
   58         if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, CY_MEMSIZE, 0,
   59             &sc.sc_bsh) != 0)
   60                 return 0;
   61 
   62         found = cy_find(&sc);
   63 
   64         bus_space_unmap(ia->ia_memt, sc.sc_bsh, CY_MEMSIZE);
   65 
   66         if (found) {
   67                 ia->ia_niomem = 1;
   68                 ia->ia_iomem[0].ir_size = CY_MEMSIZE;
   69 
   70                 ia->ia_nirq = 1;
   71 
   72                 ia->ia_nio = 0;
   73                 ia->ia_ndrq = 0;
   74         }
   75         return (found);
   76 }
   77 
   78 void
   79 cy_isa_attach(struct device *parent, struct device *self, void *aux)
   80 {
   81         struct cy_softc *sc = (void *) self;
   82         struct isa_attach_args *ia = aux;
   83 
   84         sc->sc_memt = ia->ia_memt;
   85         sc->sc_bustype = CY_BUSTYPE_ISA;
   86 
   87         printf(": Cyclades-Y multiport serial\n");
   88 
   89         if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, CY_MEMSIZE, 0,
   90             &sc->sc_bsh) != 0) {
   91                 printf("%s: unable to map device registers\n",
   92                     sc->sc_dev.dv_xname);
   93                 return;
   94         }
   95 
   96         if (cy_find(sc) == 0) {
   97                 printf("%s: unable to find CD1400s\n", sc->sc_dev.dv_xname);
   98                 return;
   99         }
  100 
  101         cy_attach(sc);
  102 
  103         sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq,
  104             IST_EDGE, IPL_TTY, cy_intr, sc);
  105         if (sc->sc_ih == NULL)
  106                 printf("%s: unable to establish interrupt",
  107                     sc->sc_dev.dv_xname);
  108 }

Cache object: a4a4aad3d6c3a347bb15edfa2aefa2ff


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.