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/cam/scsi/scsi_low_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 /*      $NecBSD: scsi_low_pisa.c,v 1.13.18.1 2001/06/08 06:27:48 honda Exp $    */
    2 /*      $NetBSD$        */
    3 /*-
    4  * [NetBSD for NEC PC-98 series]
    5  *  Copyright (c) 1995, 1996, 1997, 1998
    6  *      NetBSD/pc98 porting staff. All rights reserved.
    7  *  Copyright (c) 1995, 1996, 1997, 1998
    8  *      Naofumi HONDA. All rights reserved.
    9  * 
   10  *  Redistribution and use in source and binary forms, with or without
   11  *  modification, are permitted provided that the following conditions
   12  *  are met:
   13  *  1. Redistributions of source code must retain the above copyright
   14  *     notice, this list of conditions and the following disclaimer.
   15  *  2. Redistributions in binary form must reproduce the above copyright
   16  *     notice, this list of conditions and the following disclaimer in the
   17  *     documentation and/or other materials provided with the distribution.
   18  *  3. The name of the author may not be used to endorse or promote products
   19  *     derived from this software without specific prior written permission.
   20  * 
   21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   24  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
   25  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   29  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   31  * POSSIBILITY OF SUCH DAMAGE.
   32  */
   33 
   34 #include <sys/cdefs.h>
   35 __FBSDID("$FreeBSD: releng/6.2/sys/cam/scsi/scsi_low_pisa.c 139743 2005-01-05 22:34:37Z imp $");
   36 
   37 #ifdef  __NetBSD__
   38 #include <sys/param.h>
   39 #include <sys/systm.h>
   40 #include <sys/kernel.h>
   41 #include <sys/device.h>
   42 #include <sys/errno.h>
   43 
   44 #include <machine/bus.h>
   45 #include <machine/intr.h>
   46 
   47 #include <dev/isa/isareg.h>
   48 #include <dev/isa/isavar.h>
   49 
   50 #include <dev/isa/pisaif.h>
   51 
   52 #include <machine/dvcfg.h>
   53 
   54 #include <dev/scsipi/scsi_all.h>
   55 #include <dev/scsipi/scsipi_all.h>
   56 #include <dev/scsipi/scsiconf.h>
   57 #include <dev/scsipi/scsi_disk.h>
   58 
   59 #include <i386/Cbus/dev/scsi_low.h>
   60 #include <i386/Cbus/dev/scsi_low_pisa.h>
   61 
   62 #define SCSIBUS_RESCAN
   63 
   64 int
   65 scsi_low_deactivate_pisa(dh)
   66         pisa_device_handle_t dh;
   67 {
   68         struct scsi_low_softc *sc = PISA_DEV_SOFTC(dh);
   69 
   70         if (scsi_low_deactivate(sc) != 0)
   71                 return EBUSY;
   72         return 0;
   73 }
   74 
   75 int
   76 scsi_low_activate_pisa(dh)
   77         pisa_device_handle_t dh;
   78 {
   79         struct scsi_low_softc *sc = PISA_DEV_SOFTC(dh);
   80         slot_device_res_t dr = PISA_RES_DR(dh);
   81 
   82         sc->sl_cfgflags = DVCFG_MKCFG(DVCFG_MAJOR(sc->sl_cfgflags), \
   83                                       DVCFG_MINOR(PISA_DR_DVCFG(dr)));
   84         sc->sl_irq = PISA_DR_IRQ(dr);
   85 
   86         if (scsi_low_activate(sc) != 0)
   87                 return EBUSY;
   88 
   89         /* rescan the scsi bus */
   90 #ifdef  SCSIBUS_RESCAN
   91         if (scsi_low_is_busy(sc) == 0 &&
   92             PISA_RES_EVENT(dh) == PISA_EVENT_INSERT)
   93                 scsi_probe_busses((int) sc->sl_si.si_splp->scsipi_scsi.scsibus,
   94                                   -1, -1);
   95 #endif
   96         return 0;
   97 }
   98 
   99 int
  100 scsi_low_notify_pisa(dh, ev)
  101         pisa_device_handle_t dh;
  102         pisa_event_t ev;
  103 {
  104         struct scsi_low_softc *sc = PISA_DEV_SOFTC(dh);
  105 
  106         switch(ev)
  107         {
  108         case PISA_EVENT_QUERY_SUSPEND:
  109                 if (scsi_low_is_busy(sc) != 0)
  110                         return SD_EVENT_STATUS_BUSY;
  111                 break;
  112 
  113         default:
  114                 break;
  115         }
  116         return 0;
  117 }
  118 #endif  /* __NetBSD__ */
  119 
  120 #ifdef  __FreeBSD__ 
  121 #include <sys/param.h>
  122 #include <sys/systm.h>
  123 #include <sys/kernel.h>
  124 #if __FreeBSD_version >= 500001
  125 #include <sys/bio.h>
  126 #endif
  127 #include <sys/buf.h>
  128 #include <sys/queue.h>
  129 #include <sys/device_port.h>
  130 #include <sys/module.h>
  131 
  132 #include <cam/scsi/scsi_low.h>
  133 #include <cam/scsi/scsi_low_pisa.h>
  134 
  135 int
  136 scsi_low_deactivate_pisa(sc)
  137         struct scsi_low_softc *sc;
  138 {
  139 
  140         if (scsi_low_deactivate(sc) != 0)
  141                 return EBUSY;
  142         return 0;
  143 }
  144 
  145 int
  146 scsi_low_activate_pisa(sc, flags)
  147         struct scsi_low_softc *sc;
  148         int flags;
  149 {
  150 
  151         sc->sl_cfgflags = ((sc->sl_cfgflags & 0xffff0000) |
  152                            (flags & 0x00ff));
  153 
  154         if (scsi_low_activate(sc) != 0)
  155                 return EBUSY;
  156         return 0;
  157 }
  158 
  159 static moduledata_t scsi_low_moduledata = {
  160         "scsi_low",
  161         NULL,
  162         NULL
  163 };
  164 
  165 DECLARE_MODULE(scsi_low, scsi_low_moduledata, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
  166 MODULE_VERSION(scsi_low, 1);
  167 MODULE_DEPEND(scsi_low, cam, 1, 1, 1);
  168 #endif  /* __FreeBSD__ */

Cache object: 7ea20d296f92753d3114992eeeab6e60


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