root/dev/ic/twevar.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


    1 /*      $OpenBSD: twevar.h,v 1.7 2005/09/15 05:33:39 krw Exp $  */
    2 
    3 /*
    4  * Copyright (c) 2000 Michael Shalayeff
    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  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   19  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
   20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   22  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   24  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
   25  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   26  * THE POSSIBILITY OF SUCH DAMAGE.
   27  */
   28 
   29 struct twe_softc;
   30 
   31 struct twe_ccb {
   32         struct twe_softc        *ccb_sc;
   33         struct twe_cmd          *ccb_cmd;
   34         struct scsi_xfer        *ccb_xs;
   35         paddr_t                 ccb_cmdpa;
   36         TAILQ_ENTRY(twe_ccb)    ccb_link;
   37         enum {
   38                 TWE_CCB_FREE, TWE_CCB_READY, TWE_CCB_QUEUED, TWE_CCB_PREQUEUED,
   39                 TWE_CCB_DONE
   40         } ccb_state;
   41         int                     ccb_length;
   42         void                    *ccb_data;
   43         void                    *ccb_realdata;
   44         bus_dmamap_t            ccb_dmamap;
   45         bus_dma_segment_t       ccb_2bseg[TWE_MAXOFFSETS];
   46         int                     ccb_2nseg;
   47 };
   48 
   49 typedef TAILQ_HEAD(twe_queue_head, twe_ccb)     twe_queue_head;
   50 
   51 struct twe_softc {
   52         struct device   sc_dev;
   53         void            *sc_ih;
   54         struct scsi_link sc_link;
   55         struct lock     sc_lock;
   56         struct proc     *sc_thread;
   57         int             sc_thread_on;
   58 
   59         bus_space_tag_t iot;
   60         bus_space_handle_t ioh;
   61         bus_dma_tag_t   dmat;
   62 
   63         void *sc_cmds;
   64         bus_dmamap_t    sc_cmdmap;
   65         bus_dma_segment_t sc_cmdseg[1];
   66         struct twe_ccb  sc_ccbs[TWE_MAXCMDS];
   67         twe_queue_head  sc_free_ccb;
   68         twe_queue_head  sc_ccbq;
   69         twe_queue_head  sc_ccb2q;
   70         twe_queue_head  sc_done_ccb;
   71 
   72         struct timeout  sc_enqueue_tmo;
   73 
   74         struct {
   75                 int     hd_present;
   76                 int     hd_devtype;
   77                 int     hd_lock;
   78                 int     hd_size;
   79         } sc_hdr[TWE_MAX_UNITS];
   80 };
   81 
   82 /* XXX These have to become spinlocks in case of SMP */
   83 #define TWE_LOCK(sc) splbio()
   84 #define TWE_UNLOCK(sc, lock) splx(lock)
   85 typedef int twe_lock_t;
   86 
   87 void    tweminphys(struct buf *bp);
   88 int     twe_attach(struct twe_softc *);
   89 int     twe_intr(void *);

/* [<][>][^][v][top][bottom][index][help] */