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-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: siopvar.h,v 1.19 2003/11/02 11:07:46 wiz 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 };
   60 #define cmd_tables cmd_c.siop_tables
   61 
   62 /* command block descriptors: an array of siop_cmd + an array of siop_xfer */
   63 struct siop_cbd {
   64         TAILQ_ENTRY (siop_cbd) next;
   65         struct siop_cmd *cmds;
   66         struct siop_xfer *xfers;
   67         bus_dmamap_t xferdma; /* DMA map for this block of xfers */
   68 };
   69 
   70 /* per-tag struct */
   71 struct siop_tag {
   72         struct siop_cmd *active; /* active command */
   73         u_int reseloff;
   74 };
   75 
   76 /* per lun struct */
   77 struct siop_lun {
   78         struct siop_tag siop_tag[SIOP_NTAG]; /* tag array */
   79         int lun_flags; /* per-lun flags, none currently */
   80         u_int reseloff;
   81 };
   82 
   83 /*
   84  * per target struct; siop_common_cmd->target and siop_common_softc->targets[]
   85  * will point to this
   86  */
   87 struct siop_target {
   88         struct siop_common_target target_c;
   89         struct siop_lun *siop_lun[8]; /* per-lun state */
   90         u_int reseloff;
   91         struct siop_lunsw *lunsw;
   92 };
   93 
   94 struct siop_lunsw {
   95         TAILQ_ENTRY (siop_lunsw) next;
   96         u_int32_t lunsw_off; /* offset of this lun sw, from sc_scriptaddr*/
   97         u_int32_t lunsw_size; /* size of this lun sw */
   98 };
   99 
  100 static __inline__ void siop_table_sync __P((struct siop_cmd *, int));
  101 static __inline__ void
  102 siop_table_sync(siop_cmd, ops)
  103         struct siop_cmd *siop_cmd;
  104         int ops;
  105 {
  106         struct siop_common_softc *sc  = siop_cmd->cmd_c.siop_sc;
  107         bus_addr_t offset;
  108 
  109         offset = siop_cmd->cmd_c.dsa -
  110             siop_cmd->siop_cbdp->xferdma->dm_segs[0].ds_addr;
  111         bus_dmamap_sync(sc->sc_dmat, siop_cmd->siop_cbdp->xferdma, offset,
  112             sizeof(struct siop_xfer), ops);
  113 }
  114 
  115 
  116 TAILQ_HEAD(cmd_list, siop_cmd);
  117 TAILQ_HEAD(cbd_list, siop_cbd);
  118 TAILQ_HEAD(lunsw_list, siop_lunsw);
  119 
  120 
  121 /* Driver internal state */
  122 struct siop_softc {
  123         struct siop_common_softc sc_c;
  124         int sc_currschedslot;           /* current scheduler slot */
  125         struct cbd_list cmds;           /* list of command block descriptors */
  126         struct cmd_list free_list;      /* cmd descr free list */
  127         struct lunsw_list lunsw_list;   /* lunsw free list */
  128         u_int32_t script_free_lo;       /* free ram offset from sc_scriptaddr */
  129         u_int32_t script_free_hi;       /* free ram offset from sc_scriptaddr */
  130         int sc_ntargets;                /* number of known targets */
  131         u_int32_t sc_flags;
  132 };
  133 
  134 /* defs for sc_flags */
  135 #define SCF_CHAN_NOSLOT 0x0001          /* channel out of scheduler slot */
  136 
  137 void    siop_attach __P((struct siop_softc *));
  138 int     siop_intr __P((void *));
  139 void    siop_add_dev __P((struct siop_softc *, int, int));
  140 void    siop_del_dev __P((struct siop_softc *, int, int));

Cache object: e8eb8248dcfa4fd6b39d75e377fc965f


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