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 /*      $OpenBSD: cy_isa.c,v 1.11 2022/04/06 18:59:28 naddy Exp $       */
    2 /*
    3  * Copyright (c) 1996 Timo Rossi.
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. Neither the name of the author nor the names of contributors
   15  *    may be used to endorse or promote products derived from this software
   16  *    without specific prior written permission.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   28  * SUCH DAMAGE.
   29  */
   30 
   31 /*
   32  * cy_isa.c
   33  *
   34  * Driver for Cyclades Cyclom-8/16/32 multiport serial cards
   35  * (currently not tested with Cyclom-32 cards)
   36  *
   37  * Timo Rossi, 1996
   38  */
   39 
   40 #include <sys/param.h>
   41 #include <sys/systm.h>
   42 #include <sys/device.h>
   43 
   44 #include <machine/bus.h>
   45 
   46 #include <dev/isa/isavar.h>
   47 #include <dev/isa/isareg.h>
   48 
   49 #include <dev/ic/cd1400reg.h>
   50 #include <dev/ic/cyreg.h>
   51 
   52 static int cy_isa_probe(struct device *, void *, void *);
   53 void cy_isa_attach(struct device *, struct device *, void *);
   54 
   55 const struct cfattach cy_isa_ca = {
   56         sizeof(struct cy_softc), cy_isa_probe, cy_isa_attach
   57 };
   58 
   59 int
   60 cy_isa_probe(struct device *parent, void *match, void *aux)
   61 {
   62         int card = ((struct device *)match)->dv_unit;
   63         struct isa_attach_args *ia = aux;
   64         bus_space_tag_t memt;
   65         bus_space_handle_t memh;
   66         int ret;
   67 
   68         if (ia->ia_irq == IRQUNK) {
   69                 printf("cy%d error: interrupt not defined\n", card);
   70                 return (0);
   71         }
   72 
   73         memt = ia->ia_memt;
   74         if (bus_space_map(memt, ia->ia_maddr, 0x2000, 0, &memh) != 0)
   75                 return (0);
   76 
   77         ret = cy_probe_common(memt, memh, CY_BUSTYPE_ISA);
   78         bus_space_unmap(memt, memh, 0x2000);
   79         if (ret == 0)
   80                 return (0);
   81 
   82         ia->ia_iosize = 0;
   83         ia->ia_msize = 0x2000;
   84         return (1);
   85 }
   86 
   87 void
   88 cy_isa_attach(struct device *parent, struct device *self, void *aux)
   89 {
   90         struct cy_softc *sc = (struct cy_softc *)self;
   91         struct isa_attach_args *ia = aux;
   92 
   93         sc->sc_bustype = CY_BUSTYPE_ISA;
   94         sc->sc_memt = ia->ia_memt;
   95 
   96         if (bus_space_map(ia->ia_memt, ia->ia_maddr, 0x2000, 0,
   97             &sc->sc_memh) != 0)
   98                 return;
   99 
  100         sc->sc_nr_cd1400s = cy_probe_common(sc->sc_memt, sc->sc_memh,
  101             CY_BUSTYPE_ISA);
  102 
  103         cy_attach(parent, self);
  104 
  105         sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq,
  106             IST_EDGE, IPL_TTY, cy_intr, sc, sc->sc_dev.dv_xname);
  107 
  108         if (sc->sc_ih == NULL)
  109                 panic("cy: couldn't establish interrupt");
  110 }

Cache object: 27947bcacdd771911ab30cc283815a80


[ 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.