root/dev/i2o/ioprbsvar.h

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

INCLUDED FROM


    1 /*      $OpenBSD: ioprbsvar.h,v 1.2 2005/09/15 05:33:39 krw Exp $       */
    2 
    3 /*
    4  * Copyright (c) 2001 Niklas Hallqvist
    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 AND CONTRIBUTORS ``AS IS'' AND
   17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26  * SUCH DAMAGE.
   27  */
   28 
   29 #ifndef _I2O_IOPRBSVAR_H_
   30 #define _I2O_IOPRBSVAR_H_
   31 
   32 /*
   33  * A command contol block, one for each corresponding command index of the
   34  * controller.
   35  */
   36 struct ioprbs_ccb {
   37         TAILQ_ENTRY(ioprbs_ccb) ic_chain;
   38         struct scsi_xfer *ic_xs;
   39 #if 0
   40         struct aac_fib *ac_fib;         /* FIB associated with this command */
   41         bus_addr_t ac_fibphys;          /* bus address of the FIB */
   42         bus_dmamap_t ac_dmamap_xfer;
   43         struct aac_sg_table *ac_sgtable;/* pointer to s/g table in command */
   44 #endif
   45         int ic_timeout;
   46         u_int32_t ic_blockno;
   47         u_int32_t ic_blockcnt;
   48         u_int8_t ic_flags;
   49 #define IOPRBS_ICF_WATCHDOG     0x1
   50 #define IOPRBS_ICF_COMPLETED    0x2
   51 };
   52 
   53 /* XXX What is correct? */
   54 #define IOPRBS_MAX_CCBS 256
   55 
   56 struct ioprbs_softc {
   57         struct  device sc_dv;                   /* Generic device data */
   58         struct  scsi_link sc_link;      /* Virtual SCSI bus for cache devs */
   59         struct  iop_initiator sc_ii;
   60         struct  iop_initiator sc_eventii;
   61 
   62         int     sc_flags;
   63         int     sc_secperunit;                  /* # sectors in total */
   64         int     sc_secsize;                     /* sector size in bytes */
   65         int     sc_maxxfer;                     /* max xfer size in bytes */
   66         int     sc_maxqueuecnt;                 /* maximum h/w queue depth */
   67         int     sc_queuecnt;                    /* current h/w queue depth */
   68 
   69         struct ioprbs_ccb sc_ccbs[IOPRBS_MAX_CCBS];
   70         TAILQ_HEAD(, ioprbs_ccb) sc_free_ccb, sc_ccbq;
   71         /* commands on hold for controller resources */
   72         TAILQ_HEAD(, ioprbs_ccb) sc_ready;
   73         /* commands which have been returned by the controller */
   74         LIST_HEAD(, scsi_xfer) sc_queue;
   75         struct scsi_xfer *sc_queuelast;
   76 };
   77 
   78 #define IOPRBS_CLAIMED          0x01
   79 #define IOPRBS_NEW_EVTMASK      0x02
   80 #define IOPRBS_ENABLED          0x04
   81 
   82 #define IOPRBS_TIMEOUT          (30 * 1000)
   83 #define IOPRBS_BLOCK_SIZE       512
   84 
   85 /*
   86  * Wait this long for a lost interrupt to get detected.
   87  */
   88 #define IOPRBS_WATCH_TIMEOUT    10000           /* 10000 * 1ms = 10s */
   89 
   90 
   91 /* XXX These have to become spinlocks in case of SMP */
   92 #define IOPRBS_LOCK(sc) splbio()
   93 #define IOPRBS_UNLOCK(sc, lock) splx(lock)
   94 typedef int ioprbs_lock_t;
   95 
   96 #endif  /* !_I2O_IOPRMSVAR_H_ */

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