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/i386/isa/bs/bs_pisa.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$        */
    2 /*
    3  * [NetBSD for NEC PC98 series]
    4  *  Copyright (c) 1995, 1996 NetBSD/pc98 porting staff.
    5  *  All rights reserved.
    6  * 
    7  *  Redistribution and use in source and binary forms, with or without
    8  *  modification, are permitted provided that the following conditions
    9  *  are met:
   10  *  1. Redistributions of source code must retain the above copyright
   11  *     notice, this list of conditions and the following disclaimer.
   12  *  2. Redistributions in binary form must reproduce the above copyright
   13  *     notice, this list of conditions and the following disclaimer in the
   14  *     documentation and/or other materials provided with the distribution.
   15  *  3. The name of the author may not be used to endorse or promote products
   16  *     derived from this software without specific prior written permission.
   17  * 
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   21  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
   22  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   27  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   28  * POSSIBILITY OF SUCH DAMAGE.
   29  */
   30 
   31 #include <dev/isa/bs/bsif.h>
   32 
   33 static int bs_pisa_probe __P((struct device *, void *, void *));
   34 static void bs_pisa_attach __P((struct device *, struct device *, void *));
   35 static int bs_deactivate __P((pisa_device_args_t));
   36 static int bs_activate __P((pisa_device_args_t));
   37 
   38 struct cfattach bs_pisa_ca = {
   39         sizeof(struct bs_softc), bs_pisa_probe, bs_pisa_attach
   40 };
   41 
   42 struct pisa_driver bs_pd = {
   43         bs_activate, bs_deactivate,
   44 };
   45 
   46 static int
   47 bs_pisa_probe(parent, match, aux)
   48         struct device *parent;
   49         void *match, *aux;
   50 {
   51         struct bs_softc *sc = match;
   52         struct pisa_attach_args *pa = aux;
   53         struct isa_attach_args *ia = &pa->pa_ia;
   54 
   55         if (ia->ia_iobase == IOBASEUNK ||
   56             ia->ia_irq == IRQUNK || ia->ia_drq == DRQUNK)
   57                 return 0;
   58 
   59         sc->sc_pdv = pa->pa_pdv;
   60 
   61         return bsprobe(parent, match, ia);
   62 }
   63 
   64 static void
   65 bs_pisa_attach(parent, self, aux)
   66         struct device *parent, *self;
   67         void *aux;
   68 {
   69         struct bs_softc *sc = (void *) self;
   70         struct pisa_attach_args *pa = aux;
   71 
   72         sc->sc_pdv = PISAMSG_BIND(pa->pa_pdv, sc, &bs_pd);
   73 
   74         bsattach(parent, self, (void *) &pa->pa_ia);
   75 
   76         PISA_INTR_REGISTER(sc->sc_pdv, sc->sc_ih);
   77 }
   78 
   79 static int
   80 bs_deactivate(arg)
   81         pisa_device_args_t arg;
   82 {
   83         struct bs_softc *bsc = arg->id;
   84 
   85         bsc->sc_flags |= BSINACTIVE;
   86         bshw_dmaabort(bsc, NULL);
   87         bshw_smitabort(bsc);
   88         bs_terminate_timeout(bsc);
   89 
   90         return 0;
   91 }
   92 
   93 #define SCSIBUS_RESCAN
   94 
   95 static int
   96 bs_activate(arg)
   97         pisa_device_args_t arg;
   98 {
   99         struct bs_softc *bsc = arg->id;
  100         struct isa_attach_args *ia = arg->ia;
  101         struct targ_info *ti;
  102         int i;
  103 
  104         bsc->sc_irqmasks = (1 << ia->ia_irq);
  105 
  106         while((ti = bsc->sc_titab.tqh_first) != NULL)
  107                 TAILQ_REMOVE(&bsc->sc_titab, ti, ti_tchain);
  108 
  109         bsc->sc_openf = 0;
  110         for (i = 0; i < NTARGETS; i ++)
  111                 if (i != bsc->sc_hostid && (ti = bsc->sc_ti[i]) != NULL)
  112                 {
  113                         TAILQ_INSERT_TAIL(&bsc->sc_titab, ti, ti_tchain);
  114                         bsc->sc_openf |= (1 << i);
  115                 }
  116 
  117         bsc->sc_hstate = BSC_BOOTUP;
  118         bsc->sc_flags &= ~BSINACTIVE;
  119         bs_reset_nexus(bsc);
  120 
  121 #ifdef  SCSIBUS_RESCAN
  122         if (bsc->sc_nexus == NULL)
  123                 scsi_probe_busses((int) bsc->sc_link.scsibus, -1, -1);
  124 #endif
  125 
  126         bs_start_timeout(bsc);
  127         return 0;
  128 }

Cache object: 9f6ab6e8d92f26f20775b94a7bd3773e


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