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/stg/tmc18c30_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 /*      $NecBSD: tmc18c30_pisa.c,v 1.22 1998/11/26 01:59:21 honda Exp $ */
    2 /*      $NetBSD$        */
    3 
    4 /*-
    5  * SPDX-License-Identifier: BSD-3-Clause
    6  *
    7  * [Ported for FreeBSD]
    8  *  Copyright (c) 2000
    9  *      Noriaki Mitsunaga, Mitsuru Iwasaki and Takanori Watanabe.
   10  *      All rights reserved.
   11  * [NetBSD for NEC PC-98 series]
   12  *  Copyright (c) 1996, 1997, 1998
   13  *      NetBSD/pc98 porting staff. All rights reserved.
   14  *  Copyright (c) 1996, 1997, 1998
   15  *      Naofumi HONDA. All rights reserved.
   16  *  Copyright (c) 1996, 1997, 1998
   17  *      Kouichi Matsuda. All rights reserved.
   18  * 
   19  *  Redistribution and use in source and binary forms, with or without
   20  *  modification, are permitted provided that the following conditions
   21  *  are met:
   22  *  1. Redistributions of source code must retain the above copyright
   23  *     notice, this list of conditions and the following disclaimer.
   24  *  2. Redistributions in binary form must reproduce the above copyright
   25  *     notice, this list of conditions and the following disclaimer in the
   26  *     documentation and/or other materials provided with the distribution.
   27  *  3. The name of the author may not be used to endorse or promote products
   28  *     derived from this software without specific prior written permission.
   29  * 
   30  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   31  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   32  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   33  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
   34  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   35  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   36  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   37  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   38  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   39  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   40  * POSSIBILITY OF SUCH DAMAGE.
   41  */
   42 
   43 #include <sys/cdefs.h>
   44 __FBSDID("$FreeBSD: releng/12.0/sys/dev/stg/tmc18c30_isa.c 326255 2017-11-27 14:52:40Z pfg $");
   45 
   46 #include <sys/param.h>
   47 #include <sys/systm.h>
   48 #include <sys/kernel.h>
   49 #include <sys/module.h>
   50 #include <sys/bus.h>
   51 #include <sys/malloc.h>
   52 #include <sys/errno.h>
   53 
   54 #include <machine/bus.h>
   55 #include <machine/resource.h>
   56 #include <sys/rman.h>
   57 
   58 #include <cam/scsi/scsi_low.h>
   59 
   60 #include <dev/stg/tmc18c30reg.h>
   61 #include <dev/stg/tmc18c30var.h>
   62 #include <dev/stg/tmc18c30.h>
   63 
   64 static int
   65 stg_isa_probe(device_t dev)
   66 {
   67         struct stg_softc        *sc = device_get_softc(dev);
   68         int                     error;
   69 
   70         sc->port_rid = 0;
   71         sc->irq_rid = 0;
   72         error = stg_alloc_resource(dev);
   73         if (error) {
   74                 return(error);
   75         }
   76 
   77         if (stg_probe(dev) == 0) {
   78                 stg_release_resource(dev);
   79                 return(ENXIO);
   80         }
   81 
   82         stg_release_resource(dev);
   83 
   84         return (BUS_PROBE_DEFAULT);
   85 }
   86 
   87 static int
   88 stg_isa_attach(device_t dev)
   89 {
   90         struct stg_softc        *sc = device_get_softc(dev);
   91         int                     error;
   92 
   93         sc->port_rid = 0;
   94         sc->irq_rid = 0;
   95         error = stg_alloc_resource(dev);
   96         if (error) {
   97                 return(error);
   98         }
   99 
  100         error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_CAM | INTR_ENTROPY |
  101             INTR_MPSAFE, NULL, stg_intr, sc, &sc->stg_intrhand);
  102         if (error) {
  103                 stg_release_resource(dev);
  104                 return(error);
  105         }
  106 
  107         if (stg_attach(dev) == 0) {
  108                 stg_release_resource(dev);
  109                 return(ENXIO);
  110         }
  111 
  112         return(0);
  113 }
  114 
  115 static device_method_t stg_isa_methods[] = {
  116         /* Device interface */
  117         DEVMETHOD(device_probe,         stg_isa_probe),
  118         DEVMETHOD(device_attach,        stg_isa_attach),
  119         DEVMETHOD(device_detach,        stg_detach),
  120 
  121         { 0, 0 }
  122 };
  123 
  124 static driver_t stg_isa_driver = {
  125         "stg",
  126         stg_isa_methods,
  127         sizeof(struct stg_softc),
  128 };
  129 
  130 DRIVER_MODULE(stg, isa, stg_isa_driver, stg_devclass, 0, 0);
  131 MODULE_DEPEND(stg, scsi_low, 1, 1, 1);

Cache object: 8bd106dfc7aae2e6f5e759fedde9fb55


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