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/aic6360var.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: aic6360var.h,v 1.9 2001/04/30 03:45:35 lukem Exp $     */
    2 
    3 /*
    4  * Copyright (c) 1994, 1995, 1996 Charles M. Hannum.  All rights reserved.
    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 Charles M. Hannum.
   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  * Copyright (c) 1994 Jarle Greipsland
   21  * All rights reserved.
   22  *
   23  * Redistribution and use in source and binary forms, with or without
   24  * modification, are permitted provided that the following conditions
   25  * are met:
   26  * 1. Redistributions of source code must retain the above copyright
   27  *    notice, this list of conditions and the following disclaimer.
   28  * 2. Redistributions in binary form must reproduce the above copyright
   29  *    notice, this list of conditions and the following disclaimer in the
   30  *    documentation and/or other materials provided with the distribution.
   31  * 3. The name of the author may not be used to endorse or promote products
   32  *    derived from this software without specific prior written permission.
   33  *
   34  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   35  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   36  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   37  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
   38  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   39  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   40  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   41  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   42  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   43  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   44  * POSSIBILITY OF SUCH DAMAGE.
   45  */
   46 
   47 /*
   48  * Acknowledgements: Many of the algorithms used in this driver are
   49  * inspired by the work of Julian Elischer (julian@tfs.com) and
   50  * Charles Hannum (mycroft@duality.gnu.ai.mit.edu).  Thanks a million!
   51  */
   52 
   53 typedef u_long physaddr;
   54 typedef u_long physlen;
   55 
   56 struct aic_dma_seg {
   57         physaddr seg_addr;
   58         physlen seg_len;
   59 };
   60 
   61 #define AIC_NSEG        16
   62 
   63 /*
   64  * ACB. Holds additional information for each SCSI command Comments: We
   65  * need a separate scsi command block because we may need to overwrite it
   66  * with a request sense command.  Basicly, we refrain from fiddling with
   67  * the scsipi_xfer struct (except do the expected updating of return values).
   68  * We'll generally update: xs->{flags,resid,error,sense,status} and
   69  * occasionally xs->retries.
   70  */
   71 struct aic_acb {
   72         struct scsi_generic scsipi_cmd;
   73         int scsipi_cmd_length;
   74         u_char *data_addr;              /* Saved data pointer */
   75         int data_length;                /* Residue */
   76 
   77         u_char target_stat;             /* SCSI status byte */
   78 
   79 #ifdef notdef
   80         struct aic_dma_seg dma[AIC_NSEG]; /* Physical addresses+len */
   81 #endif
   82 
   83         TAILQ_ENTRY(aic_acb) chain;
   84         struct scsipi_xfer *xs; /* SCSI xfer ctrl block from above */
   85         int flags;
   86 #define ACB_ALLOC       0x01
   87 #define ACB_NEXUS       0x02
   88 #define ACB_SENSE       0x04
   89 #define ACB_ABORT       0x40
   90 #define ACB_RESET       0x80
   91         int timeout;
   92 };
   93 
   94 /*
   95  * Some info about each (possible) target on the SCSI bus.  This should
   96  * probably have been a "per target+lunit" structure, but we'll leave it at
   97  * this for now.
   98  */
   99 struct aic_tinfo {
  100         int     cmds;           /* #commands processed */
  101         int     dconns;         /* #disconnects */
  102         int     touts;          /* #timeouts */
  103         int     perrs;          /* #parity errors */
  104         int     senses;         /* #request sense commands sent */
  105         ushort  lubusy;         /* What local units/subr. are busy? */
  106         u_char  flags;
  107 #define DO_SYNC         0x01    /* (Re)Negotiate synchronous options */
  108 #define DO_WIDE         0x02    /* (Re)Negotiate wide options */
  109         u_char  period;         /* Period suggestion */
  110         u_char  offset;         /* Offset suggestion */
  111         u_char  width;          /* Width suggestion */
  112 };
  113 
  114 struct aic_softc {
  115         struct device sc_dev;
  116 
  117         bus_space_tag_t sc_iot;
  118         bus_space_handle_t sc_ioh;
  119 
  120         struct scsipi_adapter sc_adapter;
  121         struct scsipi_channel sc_channel;
  122 
  123         TAILQ_HEAD(, aic_acb) free_list, ready_list, nexus_list;
  124         struct aic_acb *sc_nexus;       /* current command */
  125         struct aic_acb sc_acb[8];
  126         struct aic_tinfo sc_tinfo[8];
  127 
  128         /* Data about the current nexus (updated for every cmd switch) */
  129         u_char  *sc_dp;         /* Current data pointer */
  130         size_t  sc_dleft;       /* Data bytes left to transfer */
  131         u_char  *sc_cp;         /* Current command pointer */
  132         size_t  sc_cleft;       /* Command bytes left to transfer */
  133 
  134         /* Adapter state */
  135         u_char   sc_phase;      /* Current bus phase */
  136         u_char   sc_prevphase;  /* Previous bus phase */
  137         u_char   sc_state;      /* State applicable to the adapter */
  138 #define AIC_INIT        0
  139 #define AIC_IDLE        1
  140 #define AIC_SELECTING   2       /* SCSI command is arbiting  */
  141 #define AIC_RESELECTED  3       /* Has been reselected */
  142 #define AIC_CONNECTED   4       /* Actively using the SCSI bus */
  143 #define AIC_DISCONNECT  5       /* MSG_DISCONNECT received */
  144 #define AIC_CMDCOMPLETE 6       /* MSG_CMDCOMPLETE received */
  145 #define AIC_CLEANING    7
  146         u_char   sc_flags;
  147 #define AIC_DROP_MSGIN  0x01    /* Discard all msgs (parity err detected) */
  148 #define AIC_ABORTING    0x02    /* Bailing out */
  149 #define AIC_DOINGDMA    0x04    /* The FIFO data path is active! */
  150         u_char  sc_selid;       /* Reselection ID */
  151         struct device *sc_child;/* Our child */
  152 
  153         /* Message stuff */
  154         u_char  sc_msgpriq;     /* Messages we want to send */
  155         u_char  sc_msgoutq;     /* Messages sent during last MESSAGE OUT */
  156         u_char  sc_lastmsg;     /* Message last transmitted */
  157         u_char  sc_currmsg;     /* Message currently ready to transmit */
  158 #define SEND_DEV_RESET          0x01
  159 #define SEND_PARITY_ERROR       0x02
  160 #define SEND_INIT_DET_ERR       0x04
  161 #define SEND_REJECT             0x08
  162 #define SEND_IDENTIFY           0x10
  163 #define SEND_ABORT              0x20
  164 #define SEND_SDTR               0x40
  165 #define SEND_WDTR               0x80
  166 #define AIC_MAX_MSG_LEN 8
  167         u_char  sc_omess[AIC_MAX_MSG_LEN];
  168         u_char  *sc_omp;                /* Outgoing message pointer */
  169         u_char  sc_imess[AIC_MAX_MSG_LEN];
  170         u_char  *sc_imp;                /* Incoming message pointer */
  171 
  172         /* Hardware stuff */
  173         int     sc_initiator;           /* Our scsi id */
  174         int     sc_freq;                /* Clock frequency in MHz */
  175         int     sc_minsync;             /* Minimum sync period / 4 */
  176         int     sc_maxsync;             /* Maximum sync period / 4 */
  177 };
  178 
  179 #if AIC_DEBUG
  180 #define AIC_SHOWACBS    0x01
  181 #define AIC_SHOWINTS    0x02
  182 #define AIC_SHOWCMDS    0x04
  183 #define AIC_SHOWMISC    0x08
  184 #define AIC_SHOWTRACE   0x10
  185 #define AIC_SHOWSTART   0x20
  186 #define AIC_DOBREAK     0x40
  187 extern int aic_debug; /* AIC_SHOWSTART|AIC_SHOWMISC|AIC_SHOWTRACE; */
  188 #define AIC_PRINT(b, s) do { \
  189                                 if ((aic_debug & (b)) != 0) \
  190                                         printf s; \
  191                         } while (/* CONSTCOND */ 0)
  192 #define AIC_BREAK()     do { \
  193                                 if ((aic_debug & AIC_DOBREAK) != 0) \
  194                                         Debugger(); \
  195                         } while (/* CONSTCOND */ 0)
  196 #define AIC_ASSERT(x)   do { \
  197                         if (! (x)) { \
  198                                 printf("%s at line %d: assertion failed\n", \
  199                                     sc->sc_dev.dv_xname, __LINE__); \
  200                                 Debugger(); \
  201                         } } while (/* CONSTCOND */ 0)
  202 #else
  203 #define AIC_PRINT(b, s) /* NOTHING */
  204 #define AIC_BREAK()     /* NOTHING */
  205 #define AIC_ASSERT(x)   /* NOTHING */
  206 #endif
  207 
  208 #define AIC_ACBS(s)     AIC_PRINT(AIC_SHOWACBS, s)
  209 #define AIC_INTS(s)     AIC_PRINT(AIC_SHOWINTS, s)
  210 #define AIC_CMDS(s)     AIC_PRINT(AIC_SHOWCMDS, s)
  211 #define AIC_MISC(s)     AIC_PRINT(AIC_SHOWMISC, s)
  212 #define AIC_TRACE(s)    AIC_PRINT(AIC_SHOWTRACE, s)
  213 #define AIC_START(s)    AIC_PRINT(AIC_SHOWSTART, s)
  214 
  215 #define AIC_ISA_IOSIZE  0x20    /* XXX */
  216 
  217 void    aicattach       __P((struct aic_softc *));
  218 int     aic_activate    __P((struct device *, enum devact));
  219 int     aic_detach      __P((struct device *, int));
  220 int     aicintr         __P((void *));
  221 int     aic_find        __P((bus_space_tag_t, bus_space_handle_t));
  222 void    aic_isa_attach  __P((struct device *, struct device *, void *));
  223 void    aic_init        __P((struct aic_softc *, int));

Cache object: 27dcaca58e5c2c1f9d47576b43642e49


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