[BACK]Return to siopvar.h CVS log [TXT][DIR] Up to [local] / sys / dev / ic

Annotation of sys/dev/ic/siopvar.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: siopvar.h,v 1.13 2005/11/20 22:32:48 krw Exp $ */
                      2: /*     $NetBSD: siopvar.h,v 1.22 2005/11/18 23:10:32 bouyer Exp $      */
                      3:
                      4: /*
                      5:  * Copyright (c) 2000 Manuel Bouyer.
                      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. All advertising materials mentioning features or use of this software
                     16:  *    must display the following acknowledgement:
                     17:  *     This product includes software developed by Manuel Bouyer.
                     18:  * 4. 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 WARRANTIES
                     23:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     24:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     25:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     26:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     27:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     28:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     29:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     30:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     31:  *
                     32:  */
                     33:
                     34: /* structure and definitions for the siop driver */
                     35:
                     36: /* Number of tag */
                     37: #define SIOP_NTAG 16
                     38:
                     39: /*
                     40:  * xfer description of the script: tables and reselect script
                     41:  * In struct siop_common_cmd siop_xfer will point to this.
                     42:  */
                     43: struct siop_xfer {
                     44:        struct siop_common_xfer siop_tables;
                     45:        /* u_int32_t resel[sizeof(load_dsa) / sizeof(load_dsa[0])]; */
                     46:        /* Add some entries to make size 384 bytes (256+128) */
                     47:        u_int32_t resel[36];
                     48: } __packed;
                     49:
                     50: /*
                     51:  * This describes a command handled by the SCSI controller
                     52:  * These are chained in either a free list or an active list
                     53:  * We have one queue per target
                     54:  */
                     55:
                     56: struct siop_cmd {
                     57:        TAILQ_ENTRY (siop_cmd) next;
                     58:        struct siop_common_cmd cmd_c;
                     59:        struct siop_cbd *siop_cbdp; /* pointer to our siop_cbd */
                     60:        int reselslot;
                     61:        u_int32_t saved_offset; /* offset in table after disc without sdp */
                     62: };
                     63: #define cmd_tables cmd_c.siop_tables
                     64:
                     65: /* command block descriptors: an array of siop_cmd + an array of siop_xfer */
                     66: struct siop_cbd {
                     67:        TAILQ_ENTRY (siop_cbd) next;
                     68:        struct siop_cmd *cmds;
                     69:        struct siop_xfer *xfers;
                     70:        bus_dmamap_t xferdma; /* DMA map for this block of xfers */
                     71: };
                     72:
                     73: /* per-tag struct */
                     74: struct siop_tag {
                     75:        struct siop_cmd *active; /* active command */
                     76:        u_int reseloff;
                     77: };
                     78:
                     79: /* per lun struct */
                     80: struct siop_lun {
                     81:        struct siop_tag siop_tag[SIOP_NTAG]; /* tag array */
                     82:        int lun_flags;
                     83: #define SIOP_LUNF_FULL 0x01 /* queue full message */
                     84:        u_int reseloff;
                     85: };
                     86:
                     87: /*
                     88:  * per target struct; siop_common_cmd->target and siop_common_softc->targets[]
                     89:  * will point to this
                     90:  */
                     91: struct siop_target {
                     92:        struct siop_common_target target_c;
                     93:        struct siop_lun *siop_lun[8]; /* per-lun state */
                     94:        u_int reseloff;
                     95:        struct siop_lunsw *lunsw;
                     96: };
                     97:
                     98: struct siop_lunsw {
                     99:        TAILQ_ENTRY (siop_lunsw) next;
                    100:        u_int32_t lunsw_off; /* offset of this lun sw, from sc_scriptaddr*/
                    101:        u_int32_t lunsw_size; /* size of this lun sw */
                    102: };
                    103:
                    104:
                    105: TAILQ_HEAD(cmd_list, siop_cmd);
                    106: TAILQ_HEAD(cbd_list, siop_cbd);
                    107: TAILQ_HEAD(lunsw_list, siop_lunsw);
                    108:
                    109:
                    110: /* Driver internal state */
                    111: struct siop_softc {
                    112:        struct siop_common_softc sc_c;
                    113:        int sc_currschedslot;           /* current scheduler slot */
                    114:        struct cbd_list cmds;           /* list of command block descriptors */
                    115:        struct cmd_list free_list;      /* cmd descr free list */
                    116:        struct cmd_list urgent_list;    /* high priority cmd descr list */
                    117:        struct cmd_list ready_list;     /* cmd descr ready list */
                    118:        struct lunsw_list lunsw_list;   /* lunsw free list */
                    119:        u_int32_t script_free_lo;       /* free ram offset from sc_scriptaddr */
                    120:        u_int32_t script_free_hi;       /* free ram offset from sc_scriptaddr */
                    121:        int sc_ntargets;                /* number of known targets */
                    122:        u_int32_t sc_flags;
                    123: };
                    124:
                    125: /* defs for sc_flags */
                    126: #define SCF_CHAN_NOSLOT        0x0001          /* channel out of scheduler slot */
                    127:
                    128: void    siop_attach(struct siop_softc *);
                    129: int    siop_intr(void *);
                    130: void   siop_add_dev(struct siop_softc *, int, int);
                    131: void   siop_del_dev(struct siop_softc *, int, int);

CVSweb