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/ic/siopvar.h

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 /*      $NetBSD: siopvar.h,v 1.24 2006/02/16 20:17:16 perry Exp $       */
    2 
    3 /*
    4  * Copyright (c) 2000 Manuel Bouyer.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. All advertising materials mentioning features or use of this software
   15  *    must display the following acknowledgement:
   16  *      This product includes software developed by Manuel Bouyer.
   17  * 4. The name of the author may not be used to endorse or promote products
   18  *    derived from this software without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   30  *
   31  */
   32 
   33 /* structure and definitions for the siop driver */
   34 
   35 /* Number of tag */
   36 #define SIOP_NTAG 16
   37 
   38 /*
   39  * xfer description of the script: tables and reselect script
   40  * In struct siop_common_cmd siop_xfer will point to this.
   41  */
   42 struct siop_xfer {
   43         struct siop_common_xfer siop_tables;
   44         /* u_int32_t resel[sizeof(load_dsa) / sizeof(load_dsa[0])]; */
   45         u_int32_t resel[25];
   46 } __attribute__((__packed__));
   47 
   48 /*
   49  * This describes a command handled by the SCSI controller
   50  * These are chained in either a free list or a active list
   51  * We have one queue per target
   52  */
   53 
   54 struct siop_cmd {
   55         TAILQ_ENTRY (siop_cmd) next;
   56         struct siop_common_cmd cmd_c;
   57         struct siop_cbd *siop_cbdp; /* pointer to our siop_cbd */
   58         int reselslot;
   59         u_int32_t saved_offset; /* offset in table after disc without sdp */
   60 };
   61 #define cmd_tables cmd_c.siop_tables
   62 
   63 /* command block descriptors: an array of siop_cmd + an array of siop_xfer */
   64 struct siop_cbd {
   65         TAILQ_ENTRY (siop_cbd) next;
   66         struct siop_cmd *cmds;
   67         struct siop_xfer *xfers;
   68         bus_dmamap_t xferdma; /* DMA map for this block of xfers */
   69 };
   70 
   71 /* per-tag struct */
   72 struct siop_tag {
   73         struct siop_cmd *active; /* active command */
   74         u_int reseloff;
   75 };
   76 
   77 /* per lun struct */
   78 struct siop_lun {
   79         struct siop_tag siop_tag[SIOP_NTAG]; /* tag array */
   80         int lun_flags; /* per-lun flags, none currently */
   81         u_int reseloff;
   82 };
   83 
   84 /*
   85  * per target struct; siop_common_cmd->target and siop_common_softc->targets[]
   86  * will point to this
   87  */
   88 struct siop_target {
   89         struct siop_common_target target_c;
   90         struct siop_lun *siop_lun[8]; /* per-lun state */
   91         u_int reseloff;
   92         struct siop_lunsw *lunsw;
   93 };
   94 
   95 struct siop_lunsw {
   96         TAILQ_ENTRY (siop_lunsw) next;
   97         u_int32_t lunsw_off; /* offset of this lun sw, from sc_scriptaddr*/
   98         u_int32_t lunsw_size; /* size of this lun sw */
   99 };
  100 
  101 static __inline void siop_table_sync(struct siop_cmd *, int);
  102 static __inline void
  103 siop_table_sync(siop_cmd, ops)
  104         struct siop_cmd *siop_cmd;
  105         int ops;
  106 {
  107         struct siop_common_softc *sc  = siop_cmd->cmd_c.siop_sc;
  108         bus_addr_t offset;
  109 
  110         offset = siop_cmd->cmd_c.dsa -
  111             siop_cmd->siop_cbdp->xferdma->dm_segs[0].ds_addr;
  112         bus_dmamap_sync(sc->sc_dmat, siop_cmd->siop_cbdp->xferdma, offset,
  113             sizeof(struct siop_xfer), ops);
  114 }
  115 
  116 
  117 TAILQ_HEAD(cmd_list, siop_cmd);
  118 TAILQ_HEAD(cbd_list, siop_cbd);
  119 TAILQ_HEAD(lunsw_list, siop_lunsw);
  120 
  121 
  122 /* Driver internal state */
  123 struct siop_softc {
  124         struct siop_common_softc sc_c;
  125         int sc_currschedslot;           /* current scheduler slot */
  126         struct cbd_list cmds;           /* list of command block descriptors */
  127         struct cmd_list free_list;      /* cmd descr free list */
  128         struct lunsw_list lunsw_list;   /* lunsw free list */
  129         u_int32_t script_free_lo;       /* free ram offset from sc_scriptaddr */
  130         u_int32_t script_free_hi;       /* free ram offset from sc_scriptaddr */
  131         int sc_ntargets;                /* number of known targets */
  132         u_int32_t sc_flags;
  133 };
  134 
  135 /* defs for sc_flags */
  136 #define SCF_CHAN_NOSLOT 0x0001          /* channel out of scheduler slot */
  137 
  138 void    siop_attach(struct siop_softc *);
  139 int     siop_intr(void *);
  140 void    siop_add_dev(struct siop_softc *, int, int);
  141 void    siop_del_dev(struct siop_softc *, int, int);

Cache object: 2d7edb9edf7ae258ea582ba6fc6d4a64


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