[BACK]Return to ispvar.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / ic

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/ic/ispvar.h between version 1.65 and 1.65.4.1

version 1.65, 2007/03/04 06:01:57 version 1.65.4.1, 2007/07/11 20:05:59
Line 1 
Line 1 
 /* $NetBSD$ */  /* $NetBSD$ */
 /*  /*
  * This driver, which is contained in NetBSD in the files:  
  *  
  *      sys/dev/ic/isp.c  
  *      sys/dev/ic/isp_inline.h  
  *      sys/dev/ic/isp_netbsd.c  
  *      sys/dev/ic/isp_netbsd.h  
  *      sys/dev/ic/isp_target.c  
  *      sys/dev/ic/isp_target.h  
  *      sys/dev/ic/isp_tpublic.h  
  *      sys/dev/ic/ispmbox.h  
  *      sys/dev/ic/ispreg.h  
  *      sys/dev/ic/ispvar.h  
  *      sys/microcode/isp/asm_sbus.h  
  *      sys/microcode/isp/asm_1040.h  
  *      sys/microcode/isp/asm_1080.h  
  *      sys/microcode/isp/asm_12160.h  
  *      sys/microcode/isp/asm_2100.h  
  *      sys/microcode/isp/asm_2200.h  
  *      sys/pci/isp_pci.c  
  *      sys/sbus/isp_sbus.c  
  *  
  * Is being actively maintained by Matthew Jacob (mjacob@NetBSD.org).  
  * This driver also is shared source with FreeBSD, OpenBSD, Linux, Solaris,  
  * Linux versions. This tends to be an interesting maintenance problem.  
  *  
  * Please coordinate with Matthew Jacob on changes you wish to make here.  
  */  
 /*  
  * Copyright (C) 1999 National Aeronautics & Space Administration   * Copyright (C) 1999 National Aeronautics & Space Administration
  * All rights reserved.   * All rights reserved.
  *   *
    * Additional Copyright (C) 2000-2007 by Matthew Jacob
    * All rights reserved.
    *
  * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions   * modification, are permitted provided that the following conditions
  * are met:   * are met:
Line 53 
Line 28 
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */   */
   /*
    * Additional Copyright (c) 1997-2006 by Matthew Jacob
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    *  1. Redistributions of source code must retain the above copyright
    *     notice, this list of conditions, and the following disclaimer,
    *     without modification, immediately at the beginning of the file.
    *  2. The name of the author may not be used to endorse or promote products
    *     derived from this software without specific prior written permission.
    *
    *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
    *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    *  ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
    *  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    *  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    *  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    *  SUCH DAMAGE.
    */
 /*  /*
  * Soft Definitions for for Qlogic ISP SCSI adapters.   * Soft Definitions for for Qlogic ISP SCSI adapters.
  * Matthew Jacob <mjacob@nas.nasa.gov>  
  */   */
   
 #ifndef _ISPVAR_H  #ifndef _ISPVAR_H
 #define _ISPVAR_H  #define _ISPVAR_H
   
 #if defined(__NetBSD__) || defined(__OpenBSD__)  #if defined(__NetBSD__) || defined(__OpenBSD__)
   #include <dev/ic/isp_stds.h>
 #include <dev/ic/ispmbox.h>  #include <dev/ic/ispmbox.h>
 #ifdef  ISP_TARGET_MODE  
 #include <dev/ic/isp_target.h>  
 #include <dev/ic/isp_tpublic.h>  
 #endif  
 #endif  #endif
 #ifdef  __FreeBSD__  #ifdef  __FreeBSD__
   #include <dev/isp/isp_stds.h>
 #include <dev/isp/ispmbox.h>  #include <dev/isp/ispmbox.h>
 #ifdef  ISP_TARGET_MODE  
 #include <dev/isp/isp_target.h>  
 #include <dev/isp/isp_tpublic.h>  
 #endif  
 #endif  #endif
 #ifdef  __linux__  #ifdef  __linux__
   #include "isp_stds.h"
 #include "ispmbox.h"  #include "ispmbox.h"
 #ifdef  ISP_TARGET_MODE  
 #include "isp_target.h"  
 #include "isp_tpublic.h"  
 #endif  #endif
   #ifdef  __svr4__
   #include "isp_stds.h"
   #include "ispmbox.h"
 #endif  #endif
   
 #define ISP_CORE_VERSION_MAJOR  2  #define ISP_CORE_VERSION_MAJOR  3
 #define ISP_CORE_VERSION_MINOR  7  #define ISP_CORE_VERSION_MINOR  0
   
 /*  /*
  * Vector for bus specific code to provide specific services.   * Vector for bus specific code to provide specific services.
  */   */
 struct ispsoftc;  typedef struct ispsoftc ispsoftc_t;
 struct ispmdvec {  struct ispmdvec {
         int             (*dv_rd_isr)          int             (*dv_rd_isr)
             (struct ispsoftc *, u_int16_t *, u_int16_t *, u_int16_t *);              (ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *);
         u_int16_t       (*dv_rd_reg) (struct ispsoftc *, int);          uint32_t        (*dv_rd_reg) (ispsoftc_t *, int);
         void            (*dv_wr_reg) (struct ispsoftc *, int, u_int16_t);          void            (*dv_wr_reg) (ispsoftc_t *, int, uint32_t);
         int             (*dv_mbxdma) (struct ispsoftc *);          int             (*dv_mbxdma) (ispsoftc_t *);
         int             (*dv_dmaset) (struct ispsoftc *,          int             (*dv_dmaset)
             XS_T *, ispreq_t *, u_int16_t *, u_int16_t);              (ispsoftc_t *, XS_T *, ispreq_t *, uint32_t *, uint32_t);
         void            (*dv_dmaclr)          void            (*dv_dmaclr) (ispsoftc_t *, XS_T *, uint32_t);
             (struct ispsoftc *, XS_T *, u_int16_t);          void            (*dv_reset0) (ispsoftc_t *);
         void            (*dv_reset0) (struct ispsoftc *);          void            (*dv_reset1) (ispsoftc_t *);
         void            (*dv_reset1) (struct ispsoftc *);          void            (*dv_dregs) (ispsoftc_t *, const char *);
         void            (*dv_dregs) (struct ispsoftc *, const char *);          const void *    dv_ispfw;       /* ptr to f/w */
         const u_int16_t *dv_ispfw;      /* ptr to f/w */          uint16_t        dv_conf1;
         u_int16_t       dv_conf1;          uint16_t        dv_clock;       /* clock frequency */
         u_int16_t       dv_clock;       /* clock frequency */  
 };  };
   
 /*  /*
  * Overall parameters   * Overall parameters
  */   */
 #define MAX_TARGETS             16  #define MAX_TARGETS             16
 #define MAX_FC_TARG             256  #define MAX_FC_TARG             512
 #define ISP_MAX_TARGETS(isp)    (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS)  #define ISP_MAX_TARGETS(isp)    (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS)
 #define ISP_MAX_LUNS(isp)       (isp)->isp_maxluns  #define ISP_MAX_LUNS(isp)       (isp)->isp_maxluns
   
 /*  /*
  * 'Types'  
  */  
 #ifdef  ISP_DAC_SUPPORTED  
 typedef u_int64_t       isp_dma_addr_t;  
 #else  
 typedef u_int32_t       isp_dma_addr_t;  
 #endif  
   
 /*  
  * Macros to access ISP registers through bus specific layers-   * Macros to access ISP registers through bus specific layers-
  * mostly wrappers to vector through the mdvec structure.   * mostly wrappers to vector through the mdvec structure.
  */   */
Line 144  typedef u_int32_t isp_dma_addr_t;
Line 129  typedef u_int32_t isp_dma_addr_t;
 #define ISP_DMASETUP(isp, xs, req, iptrp, optr) \  #define ISP_DMASETUP(isp, xs, req, iptrp, optr) \
         (*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr))          (*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr))
   
 #define ISP_DMAFREE(isp, xs, hndl)      \  #define ISP_DMAFREE(isp, xs, hndl)              \
         if ((isp)->isp_mdvec->dv_dmaclr) \          if ((isp)->isp_mdvec->dv_dmaclr)        \
             (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (hndl))              (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (hndl))
   
 #define ISP_RESET0(isp) \  #define ISP_RESET0(isp) \
Line 172  typedef u_int32_t isp_dma_addr_t;
Line 157  typedef u_int32_t isp_dma_addr_t;
 #define SYNC_SFORDEV    2       /* scratch, sync for ISP */  #define SYNC_SFORDEV    2       /* scratch, sync for ISP */
 #define SYNC_SFORCPU    3       /* scratch, sync for CPU */  #define SYNC_SFORCPU    3       /* scratch, sync for CPU */
 #define SYNC_REG        4       /* for registers */  #define SYNC_REG        4       /* for registers */
   #define SYNC_ATIOQ      5       /* atio result queue (24xx) */
   
 /*  /*
  * Request/Response Queue defines and macros.   * Request/Response Queue defines and macros.
Line 187  typedef u_int32_t isp_dma_addr_t;
Line 173  typedef u_int32_t isp_dma_addr_t;
 #define RESULT_QUEUE_LEN(x)             \  #define RESULT_QUEUE_LEN(x)             \
         (((MAXISPREQUEST(x) >> 2) < 64)? 64 : MAXISPREQUEST(x) >> 2)          (((MAXISPREQUEST(x) >> 2) < 64)? 64 : MAXISPREQUEST(x) >> 2)
 #endif  #endif
 #define ISP_QUEUE_ENTRY(q, idx)         ((char *)(q) + ((idx) * QENTRY_LEN))  #define ISP_QUEUE_ENTRY(q, idx)         (((uint8_t *)q) + ((idx) * QENTRY_LEN))
 #define ISP_QUEUE_SIZE(n)               ((n) * QENTRY_LEN)  #define ISP_QUEUE_SIZE(n)               ((n) * QENTRY_LEN)
 #define ISP_NXT_QENTRY(idx, qlen)       (((idx) + 1) & ((qlen)-1))  #define ISP_NXT_QENTRY(idx, qlen)       (((idx) + 1) & ((qlen)-1))
 #define ISP_QFREE(in, out, qlen)        \  #define ISP_QFREE(in, out, qlen)        \
Line 198  typedef u_int32_t isp_dma_addr_t;
Line 184  typedef u_int32_t isp_dma_addr_t;
   
 #define ISP_ADD_REQUEST(isp, nxti)                                      \  #define ISP_ADD_REQUEST(isp, nxti)                                      \
         MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN);  \          MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN);  \
         WRITE_REQUEST_QUEUE_IN_POINTER(isp, nxti);                      \          ISP_WRITE(isp, isp->isp_rqstinrp, nxti);                        \
         isp->isp_reqidx = nxti          isp->isp_reqidx = nxti
   
 /*  /*
  * SCSI Specific Host Adapter Parameters- per bus, per target   * SCSI Specific Host Adapter Parameters- per bus, per target
  */   */
   
 typedef struct {  typedef struct {
         u_int           isp_gotdparms           : 1,          uint32_t                                : 10,
                           isp_bad_nvram           : 1,
                           isp_gotdparms           : 1,
                         isp_req_ack_active_neg  : 1,                          isp_req_ack_active_neg  : 1,
                         isp_data_line_active_neg: 1,                          isp_data_line_active_neg: 1,
                         isp_cmd_dma_burst_enable: 1,                          isp_cmd_dma_burst_enable: 1,
                         isp_data_dma_burst_enabl: 1,                          isp_data_dma_burst_enabl: 1,
                         isp_fifo_threshold      : 3,                          isp_fifo_threshold      : 3,
                           isp_ptisp               : 1,
                         isp_ultramode           : 1,                          isp_ultramode           : 1,
                         isp_diffmode            : 1,                          isp_diffmode            : 1,
                         isp_lvdmode             : 1,                          isp_lvdmode             : 1,
                         isp_fast_mttr           : 1,    /* fast sram */                          isp_fast_mttr           : 1,    /* fast sram */
                         isp_initiator_id        : 4,                          isp_initiator_id        : 4,
                         isp_async_data_setup    : 4;                          isp_async_data_setup    : 4;
         u_int16_t       isp_selection_timeout;          uint16_t        isp_selection_timeout;
         u_int16_t       isp_max_queue_depth;          uint16_t        isp_max_queue_depth;
         u_int8_t        isp_tag_aging;          uint8_t         isp_tag_aging;
         u_int8_t        isp_bus_reset_delay;          uint8_t         isp_bus_reset_delay;
         u_int8_t        isp_retry_count;          uint8_t         isp_retry_count;
         u_int8_t        isp_retry_delay;          uint8_t         isp_retry_delay;
         struct {          struct {
                 u_int32_t                  uint32_t
                         exc_throttle    :       8,                          exc_throttle    :       8,
                                         :       1,                                          :       1,
                         dev_enable      :       1,      /* ignored */                          dev_enable      :       1,      /* ignored */
Line 234  typedef struct {
Line 222  typedef struct {
                         actv_offset     :       4,                          actv_offset     :       4,
                         goal_offset     :       4,                          goal_offset     :       4,
                         nvrm_offset     :       4;                          nvrm_offset     :       4;
                 u_int8_t        actv_period;    /* current sync period */                  uint8_t         actv_period;    /* current sync period */
                 u_int8_t        goal_period;    /* goal sync period */                  uint8_t         goal_period;    /* goal sync period */
                 u_int8_t        nvrm_period;    /* nvram sync period */                  uint8_t         nvrm_period;    /* nvram sync period */
                 u_int16_t       actv_flags;     /* current device flags */                  uint16_t        actv_flags;     /* current device flags */
                 u_int16_t       goal_flags;     /* goal device flags */                  uint16_t        goal_flags;     /* goal device flags */
                 u_int16_t       nvrm_flags;     /* nvram device flags */                  uint16_t        nvrm_flags;     /* nvram device flags */
         } isp_devparam[MAX_TARGETS];          } isp_devparam[MAX_TARGETS];
 } sdparam;  } sdparam;
   
Line 260  typedef struct {
Line 248  typedef struct {
 #define DPARM_DEFAULT   (0xFF00 & ~DPARM_QFRZ)  #define DPARM_DEFAULT   (0xFF00 & ~DPARM_QFRZ)
 #define DPARM_SAFE_DFLT (DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING))  #define DPARM_SAFE_DFLT (DPARM_DEFAULT & ~(DPARM_WIDE|DPARM_SYNC|DPARM_TQING))
   
   
 /* technically, not really correct, as they need to be rated based upon clock */  /* technically, not really correct, as they need to be rated based upon clock */
 #define ISP_80M_SYNCPARMS       0x0c09  #define ISP_80M_SYNCPARMS       0x0c09
 #define ISP_40M_SYNCPARMS       0x0c0a  #define ISP_40M_SYNCPARMS       0x0c0a
Line 274  typedef struct {
Line 261  typedef struct {
 /*  /*
  * Fibre Channel Specifics   * Fibre Channel Specifics
  */   */
 #define FL_PORT_ID              0x7e    /* FL_Port Special ID */  /* These are for non-2K Login Firmware cards */
 #define FC_PORT_ID              0x7f    /* Fabric Controller Special ID */  #define FL_ID                   0x7e    /* FL_Port Special ID */
 #define FC_SNS_ID               0x80    /* SNS Server Special ID */  #define SNS_ID                  0x80    /* SNS Server Special ID */
   #define NPH_MAX                 0xfe
 /* #define      ISP_USE_GA_NXT  1 */    /* Use GA_NXT with switches */  
 #ifndef GA_NXT_MAX  /* These are for 2K Login Firmware cards */
 #define GA_NXT_MAX      256  #define NPH_RESERVED            0x7F0   /* begin of reserved N-port handles */
 #endif  #define NPH_MGT_ID              0x7FA   /* Management Server Special ID */
   #define NPH_SNS_ID              0x7FC   /* SNS Server Special ID */
   #define NPH_FL_ID               0x7FE   /* FL Port Special ID */
   #define NPH_MAX_2K              0x800
   
   /*
    * "Unassigned" handle to be used internally
    */
   #define NIL_HANDLE              0xffff
   
   /*
    * Limit for devices on an arbitrated loop.
    */
   #define LOCAL_LOOP_LIM          126
   
   /*
    * Special Port IDs
    */
   #define MANAGEMENT_PORT_ID      0xFFFFFA
   #define SNS_PORT_ID             0xFFFFFC
   #define FABRIC_PORT_ID          0xFFFFFE
   
   
   /*
    * FC Port Database entry.
    *
    * It has a handle that the f/w uses to address commands to a device.
    * This handle's value may be assigned by the firmware (e.g., for local loop
    * devices) or by the driver (e.g., for fabric devices).
    *
    * It has a state. If the state if VALID, that means that we've logged into
    * the device. We also *may* have a initiator map index entry. This is a value
    * from 0..MAX_FC_TARG that is used to index into the isp_ini_map array. If
    * the value therein is non-zero, then that value minus one is used to index
    * into the Port Database to find the handle for forming commands. There is
    * back-index minus one value within to Port Database entry that tells us
    * which entry in isp_ini_map points to us (to avoid searching).
    *
    * Local loop devices the firmware automatically performs PLOGI on for us
    * (which is why that handle is imposed upon us). Fabric devices we assign
    * a handle to and perform the PLOGI on.
    *
    * When a PORT DATABASE CHANGED asynchronous event occurs, we mark all VALID
    * entries as PROBATIONAL. This allows us, if policy says to, just keep track
    * of devices whose handles change but are otherwise the same device (and
    * thus keep 'target' constant).
    *
    * In any case, we search all possible local loop handles. For each one that
    * has a port database entity returned, we search for any PROBATIONAL entry
    * that matches it and update as appropriate. Otherwise, as a new entry, we
    * find room for it in the Port Database. We *try* and use the handle as the
    * index to put it into the Database, but that's just an optimization. We mark
    * the entry VALID and make sure that the target index is updated and correct.
    *
    * When we get done searching the local loop, we then search similarily for
    * a list of devices we've gotten from the fabric name controller (if we're
    * on a fabric). VALID marking is also done similarily.
    *
    * When all of this is done, we can march through the database and clean up
    * any entry that is still PROBATIONAL (these represent devices which have
    * departed). Then we're done and can resume normal operations.
    *
    * Negative invariants that we try and test for are:
    *
    *  + There can never be two non-NIL entries with the same { Port, Node } WWN
    *    duples.
    *
    *  + There can never be two non-NIL entries with the same handle.
    *
    *  + There can never be two non-NIL entries which have the same ini_map_idx
    *    value.
    */
   typedef struct {
           /*
            * This is the handle that the firmware needs in order for us to
            * send commands to the device. For pre-24XX cards, this would be
            * the 'loopid'.
            */
           uint16_t        handle;
           /*
            * The ini_map_idx, if nonzero, is the system virtual target ID (+1)
            * as a cross-reference with the isp_ini_map.
            *
            * A device is 'autologin' if the firmware automatically logs into
            * it (re-logins as needed). Basically, local private loop devices.
            *
            * The state is the current state of thsi entry.
            *
            * Role is Initiator, Target, Both
            *
            * Portid is obvious, as or node && port WWNs. The new_role and
            * new_portid is for when we are pending a change.
            */
           uint16_t        ini_map_idx     : 12,
                           autologin       : 1,    /* F/W does PLOGI/PLOGO */
                           state           : 3;
           uint32_t        reserved        : 6,
                           roles           : 2,
                           portid          : 24;
           uint32_t        new_reserved    : 6,
                           new_roles       : 2,
                           new_portid      : 24;
           uint64_t        node_wwn;
           uint64_t        port_wwn;
   } fcportdb_t;
   
   #define FC_PORTDB_STATE_NIL             0
   #define FC_PORTDB_STATE_PROBATIONAL     1
   #define FC_PORTDB_STATE_DEAD            2
   #define FC_PORTDB_STATE_CHANGED         3
   #define FC_PORTDB_STATE_NEW             4
   #define FC_PORTDB_STATE_PENDING_VALID   5
   #define FC_PORTDB_STATE_ZOMBIE          6
   #define FC_PORTDB_STATE_VALID           7
   
   /*
    * FC card specific information
    */
 typedef struct {  typedef struct {
         u_int32_t               isp_fwoptions   : 16,          uint32_t                                : 10,
                                 isp_gbspeed     : 2,                                  isp_tmode       : 1,
                                 isp_iid_set     : 1,                                  isp_2klogin     : 1,
                                 loop_seen_once  : 1,                                  isp_sccfw       : 1,
                                 isp_loopstate   : 4,    /* Current Loop State */                                  isp_gbspeed     : 3,
                                 isp_fwstate     : 3,    /* ISP F/W state */                                                  : 1,
                                                   : 1,
                                 isp_gotdparms   : 1,                                  isp_gotdparms   : 1,
                                   isp_bad_nvram   : 1,
                                   isp_loopstate   : 4,    /* Current Loop State */
                                   isp_fwstate     : 4,    /* ISP F/W state */
                                 isp_topo        : 3,                                  isp_topo        : 3,
                                 isp_onfabric    : 1;                                  loop_seen_once  : 1;
         u_int8_t                isp_iid;        /* 'initiator' id */          uint32_t                                : 8,
         u_int8_t                isp_loopid;     /* hard loop id */                                  isp_portid      : 24;   /* S_ID */
         u_int8_t                isp_alpa;       /* ALPA */          uint16_t                isp_fwoptions;
         u_int32_t               isp_portid;          uint16_t                isp_xfwoptions;
         volatile u_int16_t      isp_lipseq;     /* LIP sequence # */          uint16_t                isp_zfwoptions;
         u_int16_t               isp_fwattr;     /* firmware attributes */          uint16_t                isp_loopid;     /* hard loop id */
         u_int8_t                isp_execthrottle;          uint16_t                isp_fwattr;     /* firmware attributes */
         u_int8_t                isp_retry_delay;          uint16_t                isp_execthrottle;
         u_int8_t                isp_retry_count;          uint8_t                 isp_retry_delay;
         u_int8_t                isp_reserved;          uint8_t                 isp_retry_count;
         u_int16_t               isp_maxalloc;          uint8_t                 isp_reserved;
         u_int16_t               isp_maxfrmlen;          uint16_t                isp_maxalloc;
         u_int64_t               isp_nodewwn;          uint16_t                isp_maxfrmlen;
         u_int64_t               isp_portwwn;          uint64_t                isp_wwnn_nvram;
         /*          uint64_t                isp_wwpn_nvram;
          * Port Data Base. This is indexed by 'target', which is invariate.  
          * However, elements within can move around due to loop changes,          /*
          * so the actual loop ID passed to the F/W is in this structure.           * Our Port Data Base
          * The first time the loop is seen up, loopid will match the index           */
          * (except for fabric nodes which are above mapped above FC_SNS_ID          fcportdb_t              portdb[MAX_FC_TARG];
          * and are completely virtual), but subsequent LIPs can cause things  
          * to move around.          /*
          */           * This maps system virtual 'target' id to a portdb entry.
         struct lportdb {           *
                 u_int32_t           * The mapping function is to take any non-zero entry and
                                         port_type       : 8,           * subtract one to get the portdb index. This means that
                                         loopid          : 8,           * entries which are zero are unmapped (i.e., don't exist).
                                         fc4_type        : 4,           */
                                         last_fabric_dev : 1,          uint16_t                isp_ini_map[MAX_FC_TARG];
                                                         : 2,  
                                         relogin         : 1,  
                                         force_logout    : 1,  
                                         was_fabric_dev  : 1,  
                                         fabric_dev      : 1,  
                                         loggedin        : 1,  
                                         roles           : 2,  
                                         valid           : 1;  
                 u_int32_t               portid;  
                 u_int64_t               node_wwn;  
                 u_int64_t               port_wwn;  
         } portdb[MAX_FC_TARG], tport[FC_PORT_ID];  
   
         /*          /*
          * Scratch DMA mapped in area to fetch Port Database stuff, etc.           * Scratch DMA mapped in area to fetch Port Database stuff, etc.
          */           */
         void *                  isp_scratch;          void *                  isp_scratch;
         isp_dma_addr_t          isp_scdma;          XS_DMA_ADDR_T           isp_scdma;
 #ifdef  ISP_FW_CRASH_DUMP  #ifdef  ISP_FW_CRASH_DUMP
         u_int16_t               *isp_dump_data;          uint16_t *              isp_dump_data;
 #endif  #endif
 } fcparam;  } fcparam;
   
Line 357  typedef struct {
Line 452  typedef struct {
 #define LOOP_NIL                0  #define LOOP_NIL                0
 #define LOOP_LIP_RCVD           1  #define LOOP_LIP_RCVD           1
 #define LOOP_PDB_RCVD           2  #define LOOP_PDB_RCVD           2
 #define LOOP_SCANNING_FABRIC    3  #define LOOP_SCANNING_LOOP      3
 #define LOOP_FSCAN_DONE         4  #define LOOP_LSCAN_DONE         4
 #define LOOP_SCANNING_LOOP      5  #define LOOP_SCANNING_FABRIC    5
 #define LOOP_LSCAN_DONE         6  #define LOOP_FSCAN_DONE         6
 #define LOOP_SYNCING_PDB        7  #define LOOP_SYNCING_PDB        7
 #define LOOP_READY              8  #define LOOP_READY              8
   
Line 373  typedef struct {
Line 468  typedef struct {
 /*  /*
  * Soft Structure per host adapter   * Soft Structure per host adapter
  */   */
 typedef struct ispsoftc {  struct ispsoftc {
         /*          /*
          * Platform (OS) specific data           * Platform (OS) specific data
          */           */
Line 389  typedef struct ispsoftc {
Line 484  typedef struct ispsoftc {
          * may contain some volatile state (e.g., current loop state).           * may contain some volatile state (e.g., current loop state).
          */           */
   
         void *                  isp_param;      /* type specific */          void *                  isp_param;      /* type specific */
         u_int16_t               isp_fwrev[3];   /* Loaded F/W revision */          uint16_t                isp_fwrev[3];   /* Loaded F/W revision */
         u_int16_t               isp_romfw_rev[3]; /* PROM F/W revision */          uint16_t                isp_romfw_rev[3]; /* PROM F/W revision */
         u_int16_t               isp_maxcmds;    /* max possible I/O cmds */          uint16_t                isp_maxcmds;    /* max possible I/O cmds */
         u_int8_t                isp_type;       /* HBA Chip Type */          uint8_t                 isp_type;       /* HBA Chip Type */
         u_int8_t                isp_revision;   /* HBA Chip H/W Revision */          uint8_t                 isp_revision;   /* HBA Chip H/W Revision */
         u_int32_t               isp_maxluns;    /* maximum luns supported */          uint32_t                isp_maxluns;    /* maximum luns supported */
   
         u_int32_t               isp_clock       : 8,    /* input clock */          uint32_t                isp_clock       : 8,    /* input clock */
                                                 : 4,                                                  : 4,
                                 isp_port        : 1,    /* 23XX only */                                  isp_port        : 1,    /* 23XX/24XX only */
                                 isp_failed      : 1,    /* board failed */                                  isp_failed      : 1,    /* board failed */
                                 isp_open        : 1,    /* opened (ioctl) */                                  isp_open        : 1,    /* opened (ioctl) */
                                 isp_touched     : 1,    /* board ever seen? */                                  isp_touched     : 1,    /* board ever seen? */
Line 408  typedef struct ispsoftc {
Line 503  typedef struct ispsoftc {
                                 isp_role        : 2,    /* roles supported */                                  isp_role        : 2,    /* roles supported */
                                 isp_dblev       : 12;   /* debug log mask */                                  isp_dblev       : 12;   /* debug log mask */
   
         u_int32_t               isp_confopts;           /* config options */          uint32_t                isp_confopts;           /* config options */
   
         u_int16_t               isp_rqstinrp;   /* register for REQINP */          uint32_t                isp_rqstinrp;   /* register for REQINP */
         u_int16_t               isp_rqstoutrp;  /* register for REQOUTP */          uint32_t                isp_rqstoutrp;  /* register for REQOUTP */
         u_int16_t               isp_respinrp;   /* register for RESINP */          uint32_t                isp_respinrp;   /* register for RESINP */
         u_int16_t               isp_respoutrp;  /* register for RESOUTP */          uint32_t                isp_respoutrp;  /* register for RESOUTP */
           uint32_t                isp_atioinrp;   /* register for ATIOINP */
           uint32_t                isp_atiooutrp;  /* register for ATIOOUTP */
   
         /*          /*
          * Instrumentation           * Instrumentation
          */           */
         u_int64_t               isp_intcnt;             /* total int count */          uint64_t                isp_intcnt;             /* total int count */
         u_int64_t               isp_intbogus;           /* spurious int count */          uint64_t                isp_intbogus;           /* spurious int count */
         u_int64_t               isp_intmboxc;           /* mbox completions */          uint64_t                isp_intmboxc;           /* mbox completions */
         u_int64_t               isp_intoasync;          /* other async */          uint64_t                isp_intoasync;          /* other async */
         u_int64_t               isp_rsltccmplt;         /* CMDs on result q */          uint64_t                isp_rsltccmplt;         /* CMDs on result q */
         u_int64_t               isp_fphccmplt;          /* CMDs via fastpost */          uint64_t                isp_fphccmplt;          /* CMDs via fastpost */
         u_int16_t               isp_rscchiwater;          uint16_t                isp_rscchiwater;
         u_int16_t               isp_fpcchiwater;          uint16_t                isp_fpcchiwater;
   
         /*          /*
          * Volatile state           * Volatile state
          */           */
   
         volatile u_int32_t          volatile uint32_t       :       8,
                 isp_obits       :       8,      /* mailbox command output */  
                 isp_mboxbsy     :       1,      /* mailbox command active */                  isp_mboxbsy     :       1,      /* mailbox command active */
                 isp_state       :       3,                  isp_state       :       3,
                 isp_sendmarker  :       2,      /* send a marker entry */                  isp_sendmarker  :       2,      /* send a marker entry */
                 isp_update      :       2,      /* update parameters */                  isp_update      :       2,      /* update parameters */
                 isp_nactive     :       16;     /* how many commands active */                  isp_nactive     :       16;     /* how many commands active */
         volatile u_int16_t      isp_reqodx;     /* index of last ISP pickup */          volatile uint32_t       isp_reqodx;     /* index of last ISP pickup */
         volatile u_int16_t      isp_reqidx;     /* index of next request */          volatile uint32_t       isp_reqidx;     /* index of next request */
         volatile u_int16_t      isp_residx;     /* index of next result */          volatile uint32_t       isp_residx;     /* index of next result */
         volatile u_int16_t      isp_resodx;     /* index of next result */          volatile uint32_t       isp_resodx;     /* index of next result */
         volatile u_int16_t      isp_rspbsy;          volatile uint32_t       isp_rspbsy;
         volatile u_int16_t      isp_lasthdls;   /* last handle seed */          volatile uint32_t       isp_lasthdls;   /* last handle seed */
         volatile u_int16_t      isp_mboxtmp[MAX_MAILBOX];          volatile uint32_t       isp_obits;      /* mailbox command output */
         volatile u_int16_t      isp_lastmbxcmd; /* last mbox command sent */          volatile uint16_t       isp_mboxtmp[MAILBOX_STORAGE];
         volatile u_int16_t      isp_mbxwrk0;          volatile uint16_t       isp_lastmbxcmd; /* last mbox command sent */
         volatile u_int16_t      isp_mbxwrk1;          volatile uint16_t       isp_mbxwrk0;
         volatile u_int16_t      isp_mbxwrk2;          volatile uint16_t       isp_mbxwrk1;
         void *                  isp_mbxworkp;          volatile uint16_t       isp_mbxwrk2;
           volatile uint16_t       isp_mbxwrk8;
           void *                  isp_mbxworkp;
   
         /*          /*
          * Active commands are stored here, indexed by handle functions.           * Active commands are stored here, indexed by handle functions.
          */           */
         XS_T **isp_xflist;          XS_T **isp_xflist;
   
   #ifdef  ISP_TARGET_MODE
           /*
            * Active target commands are stored here, indexed by handle function.
            */
           void **isp_tgtlist;
   #endif
   
         /*          /*
          * request/result queue pointers and DMA handles for them.           * request/result queue pointers and DMA handles for them.
          */           */
         void *                  isp_rquest;          void *                  isp_rquest;
         void *                  isp_result;          void *                  isp_result;
         isp_dma_addr_t          isp_rquest_dma;          XS_DMA_ADDR_T           isp_rquest_dma;
         isp_dma_addr_t          isp_result_dma;          XS_DMA_ADDR_T           isp_result_dma;
 } ispsoftc_t;  #ifdef  ISP_TARGET_MODE
           /* for 24XX only */
           void *                  isp_atioq;
           XS_DMA_ADDR_T           isp_atioq_dma;
   #endif
   };
   
 #define SDPARAM(isp)    ((sdparam *) (isp)->isp_param)  #define SDPARAM(isp)    ((sdparam *) (isp)->isp_param)
 #define FCPARAM(isp)    ((fcparam *) (isp)->isp_param)  #define FCPARAM(isp)    ((fcparam *) (isp)->isp_param)
Line 472  typedef struct ispsoftc {
Line 582  typedef struct ispsoftc {
  * ISP Driver Run States   * ISP Driver Run States
  */   */
 #define ISP_NILSTATE    0  #define ISP_NILSTATE    0
 #define ISP_RESETSTATE  1  #define ISP_CRASHED     1
 #define ISP_INITSTATE   2  #define ISP_RESETSTATE  2
 #define ISP_RUNSTATE    3  #define ISP_INITSTATE   3
   #define ISP_RUNSTATE    4
   
 /*  /*
  * ISP Configuration Options   * ISP Configuration Options
Line 494  typedef struct ispsoftc {
Line 605  typedef struct ispsoftc {
 #define ISP_CFG_OWNFSZ          0x400   /* override NVRAM frame size */  #define ISP_CFG_OWNFSZ          0x400   /* override NVRAM frame size */
 #define ISP_CFG_OWNLOOPID       0x800   /* override NVRAM loopid */  #define ISP_CFG_OWNLOOPID       0x800   /* override NVRAM loopid */
 #define ISP_CFG_OWNEXCTHROTTLE  0x1000  /* override NVRAM execution throttle */  #define ISP_CFG_OWNEXCTHROTTLE  0x1000  /* override NVRAM execution throttle */
   #define ISP_CFG_FOURGB          0x2000  /* force 4GB connection (24XX only) */
   
 /*  /*
  * Prior to calling isp_reset for the first time, the outer layer   * Prior to calling isp_reset for the first time, the outer layer
Line 517  typedef struct ispsoftc {
Line 629  typedef struct ispsoftc {
  *   *
  */   */
 #define ISP_ROLE_NONE           0x0  #define ISP_ROLE_NONE           0x0
 #define ISP_ROLE_INITIATOR      0x1  #define ISP_ROLE_TARGET         0x1
 #define ISP_ROLE_TARGET         0x2  #define ISP_ROLE_INITIATOR      0x2
 #define ISP_ROLE_BOTH           (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR)  #define ISP_ROLE_BOTH           (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR)
 #define ISP_ROLE_EITHER         ISP_ROLE_BOTH  #define ISP_ROLE_EITHER         ISP_ROLE_BOTH
 #ifndef ISP_DEFAULT_ROLES  #ifndef ISP_DEFAULT_ROLES
Line 531  typedef struct ispsoftc {
Line 643  typedef struct ispsoftc {
  */   */
 #define ISP_CODE_ORG                    0x1000  /* default f/w code start */  #define ISP_CODE_ORG                    0x1000  /* default f/w code start */
 #define ISP_CODE_ORG_2300               0x0800  /* ..except for 2300s */  #define ISP_CODE_ORG_2300               0x0800  /* ..except for 2300s */
   #define ISP_CODE_ORG_2400               0x100000 /* ..and 2400s */
 #define ISP_FW_REV(maj, min, mic)       ((maj << 24) | (min << 16) | mic)  #define ISP_FW_REV(maj, min, mic)       ((maj << 24) | (min << 16) | mic)
 #define ISP_FW_MAJOR(code)              ((code >> 24) & 0xff)  #define ISP_FW_MAJOR(code)              ((code >> 24) & 0xff)
 #define ISP_FW_MINOR(code)              ((code >> 16) & 0xff)  #define ISP_FW_MINOR(code)              ((code >> 16) & 0xff)
Line 541  typedef struct ispsoftc {
Line 654  typedef struct ispsoftc {
 #define ISP_FW_MICROX(xp)               (xp[2])  #define ISP_FW_MICROX(xp)               (xp[2])
 #define ISP_FW_NEWER_THAN(i, major, minor, micro)               \  #define ISP_FW_NEWER_THAN(i, major, minor, micro)               \
  (ISP_FW_REVX((i)->isp_fwrev) > ISP_FW_REV(major, minor, micro))   (ISP_FW_REVX((i)->isp_fwrev) > ISP_FW_REV(major, minor, micro))
   #define ISP_FW_OLDER_THAN(i, major, minor, micro)               \
    (ISP_FW_REVX((i)->isp_fwrev) < ISP_FW_REV(major, minor, micro))
   
 /*  /*
  * Bus (implementation) types   * Bus (implementation) types
Line 577  typedef struct ispsoftc {
Line 692  typedef struct ispsoftc {
 #define ISP_HA_FC_2200          0x20  #define ISP_HA_FC_2200          0x20
 #define ISP_HA_FC_2300          0x30  #define ISP_HA_FC_2300          0x30
 #define ISP_HA_FC_2312          0x40  #define ISP_HA_FC_2312          0x40
   #define ISP_HA_FC_2322          0x50
   #define ISP_HA_FC_2400          0x60
   
 #define IS_SCSI(isp)    (isp->isp_type & ISP_HA_SCSI)  #define IS_SCSI(isp)    (isp->isp_type & ISP_HA_SCSI)
 #define IS_1240(isp)    (isp->isp_type == ISP_HA_SCSI_1240)  #define IS_1240(isp)    (isp->isp_type == ISP_HA_SCSI_1240)
Line 594  typedef struct ispsoftc {
Line 711  typedef struct ispsoftc {
 #define IS_FC(isp)      ((isp)->isp_type & ISP_HA_FC)  #define IS_FC(isp)      ((isp)->isp_type & ISP_HA_FC)
 #define IS_2100(isp)    ((isp)->isp_type == ISP_HA_FC_2100)  #define IS_2100(isp)    ((isp)->isp_type == ISP_HA_FC_2100)
 #define IS_2200(isp)    ((isp)->isp_type == ISP_HA_FC_2200)  #define IS_2200(isp)    ((isp)->isp_type == ISP_HA_FC_2200)
 #define IS_23XX(isp)    ((isp)->isp_type >= ISP_HA_FC_2300)  #define IS_23XX(isp)    ((isp)->isp_type >= ISP_HA_FC_2300 && \
                                   (isp)->isp_type < ISP_HA_FC_2400)
 #define IS_2300(isp)    ((isp)->isp_type == ISP_HA_FC_2300)  #define IS_2300(isp)    ((isp)->isp_type == ISP_HA_FC_2300)
 #define IS_2312(isp)    ((isp)->isp_type == ISP_HA_FC_2312)  #define IS_2312(isp)    ((isp)->isp_type == ISP_HA_FC_2312)
   #define IS_2322(isp)    ((isp)->isp_type == ISP_HA_FC_2322)
   #define IS_24XX(isp)    ((isp)->isp_type >= ISP_HA_FC_2400)
   
 /*  /*
  * DMA cookie macros   * DMA related macros
  */   */
 #ifdef  ISP_DAC_SUPPORTRED  #define DMA_WD3(x)      (((uint16_t)(((uint64_t)x) >> 48)) & 0xffff)
 #define DMA_WD3(x)      (((x) >> 48) & 0xffff)  #define DMA_WD2(x)      (((uint16_t)(((uint64_t)x) >> 32)) & 0xffff)
 #define DMA_WD2(x)      (((x) >> 32) & 0xffff)  #define DMA_WD1(x)      ((uint16_t)((x) >> 16) & 0xffff)
 #else  #define DMA_WD0(x)      ((uint16_t)((x) & 0xffff))
 #define DMA_WD3(x)      0  
 #define DMA_WD2(x)      0  #define DMA_LO32(x)     ((uint32_t) (x))
 #endif  #define DMA_HI32(x)     ((uint32_t)(((uint64_t)x) >> 32))
 #define DMA_WD1(x)      (((x) >> 16) & 0xffff)  
 #define DMA_WD0(x)      (((x) & 0xffff))  
   
 /*  /*
  * Core System Function Prototypes   * Core System Function Prototypes
Line 619  typedef struct ispsoftc {
Line 737  typedef struct ispsoftc {
  * Reset Hardware. Totally. Assumes that you'll follow this with   * Reset Hardware. Totally. Assumes that you'll follow this with
  * a call to isp_init.   * a call to isp_init.
  */   */
 void isp_reset(struct ispsoftc *);  void isp_reset(ispsoftc_t *);
   
 /*  /*
  * Initialize Hardware to known state   * Initialize Hardware to known state
  */   */
 void isp_init(struct ispsoftc *);  void isp_init(ispsoftc_t *);
   
 /*  /*
  * Reset the ISP and call completion for any orphaned commands.   * Reset the ISP and call completion for any orphaned commands.
  */   */
 void isp_reinit(struct ispsoftc *);  void isp_reinit(ispsoftc_t *);
   
 #ifdef  ISP_FW_CRASH_DUMP  #ifdef  ISP_FW_CRASH_DUMP
 /*  /*
  * Dump firmware entry point.   * Dump firmware entry point.
  */   */
 void isp_fw_dump(struct ispsoftc *isp);  void isp_fw_dump(ispsoftc_t *isp);
 #endif  #endif
   
 /*  /*
Line 645  void isp_fw_dump(struct ispsoftc *isp);
Line 763  void isp_fw_dump(struct ispsoftc *isp);
  * semaphore register and first mailbox register (if appropriate). This also   * semaphore register and first mailbox register (if appropriate). This also
  * means that most spurious/bogus interrupts not for us can be filtered first.   * means that most spurious/bogus interrupts not for us can be filtered first.
  */   */
 void isp_intr(struct ispsoftc *, u_int16_t, u_int16_t, u_int16_t);  void isp_intr(ispsoftc_t *, uint32_t, uint16_t, uint16_t);
   
   
 /*  /*
  * Command Entry Point- Platform Dependent layers call into this   * Command Entry Point- Platform Dependent layers call into this
  */   */
 int isp_start(XS_T *);  int isp_start(XS_T *);
   
 /* these values are what isp_start returns */  /* these values are what isp_start returns */
 #define CMD_COMPLETE    101     /* command completed */  #define CMD_COMPLETE    101     /* command completed */
 #define CMD_EAGAIN      102     /* busy- maybe retry later */  #define CMD_EAGAIN      102     /* busy- maybe retry later */
Line 707  typedef enum {
Line 826  typedef enum {
         ISPCTL_SCAN_LOOP,               /* (Re)scan Local Loop */          ISPCTL_SCAN_LOOP,               /* (Re)scan Local Loop */
         ISPCTL_PDB_SYNC,                /* Synchronize Port Database */          ISPCTL_PDB_SYNC,                /* Synchronize Port Database */
         ISPCTL_SEND_LIP,                /* Send a LIP */          ISPCTL_SEND_LIP,                /* Send a LIP */
         ISPCTL_GET_POSMAP,              /* Get FC-AL position map */          ISPCTL_GET_PORTNAME,            /* get portname from an N-port handle */
         ISPCTL_RUN_MBOXCMD,             /* run a mailbox command */          ISPCTL_RUN_MBOXCMD,             /* run a mailbox command */
         ISPCTL_TOGGLE_TMODE             /* toggle target mode */          ISPCTL_TOGGLE_TMODE,            /* toggle target mode */
           ISPCTL_GET_PDB,                 /* get a single port database entry */
           ISPCTL_PLOGX                    /* do a port login/logout */
 } ispctl_t;  } ispctl_t;
 int isp_control(struct ispsoftc *, ispctl_t, void *);  int isp_control(ispsoftc_t *, ispctl_t, void *);
   
   
 /*  /*
Line 762  typedef enum {
Line 883  typedef enum {
         ISPASYNC_LIP,                   /* LIP Received */          ISPASYNC_LIP,                   /* LIP Received */
         ISPASYNC_LOOP_RESET,            /* Loop Reset Received */          ISPASYNC_LOOP_RESET,            /* Loop Reset Received */
         ISPASYNC_CHANGE_NOTIFY,         /* FC Change Notification */          ISPASYNC_CHANGE_NOTIFY,         /* FC Change Notification */
         ISPASYNC_FABRIC_DEV,            /* FC Fabric Device Arrival */          ISPASYNC_DEV_ARRIVED,           /* FC Device Arrival */
         ISPASYNC_PROMENADE,             /* FC Objects coming && going */          ISPASYNC_DEV_CHANGED,           /* FC Device Change */
         ISPASYNC_TARGET_MESSAGE,        /* target message */          ISPASYNC_DEV_STAYED,            /* FC Device Stayed the Same */
         ISPASYNC_TARGET_EVENT,          /* target asynchronous event */          ISPASYNC_DEV_GONE,              /* FC Device Depart */
         ISPASYNC_TARGET_ACTION,         /* other target command action */          ISPASYNC_TARGET_NOTIFY,         /* target asynchronous notification event */
           ISPASYNC_TARGET_ACTION,         /* target action requested */
         ISPASYNC_CONF_CHANGE,           /* Platform Configuration Change */          ISPASYNC_CONF_CHANGE,           /* Platform Configuration Change */
         ISPASYNC_UNHANDLED_RESPONSE,    /* Unhandled Response Entry */          ISPASYNC_UNHANDLED_RESPONSE,    /* Unhandled Response Entry */
         ISPASYNC_FW_CRASH,              /* Firmware has crashed */          ISPASYNC_FW_CRASH,              /* Firmware has crashed */
         ISPASYNC_FW_DUMPED,             /* Firmware crashdump taken */          ISPASYNC_FW_DUMPED,             /* Firmware crashdump taken */
         ISPASYNC_FW_RESTARTED           /* Firmware has been restarted */          ISPASYNC_FW_RESTARTED           /* Firmware has been restarted */
 } ispasync_t;  } ispasync_t;
 int isp_async(struct ispsoftc *, ispasync_t, void *);  int isp_async(ispsoftc_t *, ispasync_t, void *);
   
 #define ISPASYNC_CHANGE_PDB     ((void *) 0)  #define ISPASYNC_CHANGE_PDB     ((void *) 0)
 #define ISPASYNC_CHANGE_SNS     ((void *) 1)  #define ISPASYNC_CHANGE_SNS     ((void *) 1)
Line 781  int isp_async(struct ispsoftc *, ispasyn
Line 903  int isp_async(struct ispsoftc *, ispasyn
   
 /*  /*
  * Platform Dependent Error and Debug Printout   * Platform Dependent Error and Debug Printout
    *
    * Generally this is:
    *
    *    void isp_prt(ispsoftc_t *, int level, const char *, ...)
    *
    * but due to compiler differences on different platforms this won't be
    * formally done here. Instead, it goes in each platform definition file.
  */   */
 #ifdef  __GNUC__  
 void isp_prt(struct ispsoftc *, int level, const char *, ...)  
         __attribute__((__format__(__printf__,3,4)));  
 #else  
 void isp_prt(struct ispsoftc *, int level, const char *, ...);  
 #endif  
   
 #define ISP_LOGALL      0x0     /* log always */  #define ISP_LOGALL      0x0     /* log always */
 #define ISP_LOGCONFIG   0x1     /* log configuration messages */  #define ISP_LOGCONFIG   0x1     /* log configuration messages */
Line 798  void isp_prt(struct ispsoftc *, int leve
Line 921  void isp_prt(struct ispsoftc *, int leve
 #define ISP_LOGDEBUG1   0x20    /* log intermediate debug messages */  #define ISP_LOGDEBUG1   0x20    /* log intermediate debug messages */
 #define ISP_LOGDEBUG2   0x40    /* log most debug messages */  #define ISP_LOGDEBUG2   0x40    /* log most debug messages */
 #define ISP_LOGDEBUG3   0x80    /* log high frequency debug messages */  #define ISP_LOGDEBUG3   0x80    /* log high frequency debug messages */
 #define ISP_LOGDEBUG4   0x100   /* log high frequency debug messages */  #define ISP_LOGSANCFG   0x100   /* log SAN configuration */
 #define ISP_LOGTDEBUG0  0x200   /* log simple debug messages (target mode) */  #define ISP_LOGTDEBUG0  0x200   /* log simple debug messages (target mode) */
 #define ISP_LOGTDEBUG1  0x400   /* log intermediate debug messages (target) */  #define ISP_LOGTDEBUG1  0x400   /* log intermediate debug messages (target) */
 #define ISP_LOGTDEBUG2  0x800   /* log all debug messages (target) */  #define ISP_LOGTDEBUG2  0x800   /* log all debug messages (target) */
Line 810  void isp_prt(struct ispsoftc *, int leve
Line 933  void isp_prt(struct ispsoftc *, int leve
  * Each platform must also provide the following macros/defines:   * Each platform must also provide the following macros/defines:
  *   *
  *   *
  *      INLINE          -       platform specific define for 'inline' functions  
  *  
  *      ISP_DAC_SUPPORTED -     Is DAC (Dual Address Cycle) is supported?  
  *                              Basically means whether or not DMA for PCI  
  *                              PCI cards (Ultra2 or better or FC) works  
  *                              above 4GB.  
  *  
  *      ISP2100_SCRLEN  -       length for the Fibre Channel scratch DMA area   *      ISP2100_SCRLEN  -       length for the Fibre Channel scratch DMA area
  *   *
  *      MEMZERO(dst, src)                       platform zeroing function   *      MEMZERO(dst, src)                       platform zeroing function
Line 829  void isp_prt(struct ispsoftc *, int leve
Line 945  void isp_prt(struct ispsoftc *, int leve
  *   *
  *      GET_NANOTIME(NANOTIME_T *)              get current nanotime.   *      GET_NANOTIME(NANOTIME_T *)              get current nanotime.
  *   *
  *      GET_NANOSEC(NANOTIME_T *)               get u_int64_t from NANOTIME_T   *      GET_NANOSEC(NANOTIME_T *)               get uint64_t from NANOTIME_T
  *   *
  *      NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *)   *      NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *)
  *                                              subtract two NANOTIME_T values   *                                              subtract two NANOTIME_T values
  *   *
  *   *
  *      MAXISPREQUEST(struct ispsoftc *)        maximum request queue size   *      MAXISPREQUEST(ispsoftc_t *)     maximum request queue size
  *                                              for this particular board type   *                                              for this particular board type
  *   *
  *      MEMORYBARRIER(struct ispsoftc *, barrier_type, offset, size)   *      MEMORYBARRIER(ispsoftc_t *, barrier_type, offset, size)
  *   *
  *              Function/Macro the provides memory synchronization on   *              Function/Macro the provides memory synchronization on
  *              various objects so that the ISP's and the system's view   *              various objects so that the ISP's and the system's view
  *              of the same object is consistent.   *              of the same object is consistent.
  *   *
  *      MBOX_ACQUIRE(struct ispsoftc *)         acquire lock on mailbox regs   *      MBOX_ACQUIRE(ispsoftc_t *)              acquire lock on mailbox regs
  *      MBOX_WAIT_COMPLETE(struct ispsoftc *)   wait for mailbox cmd to be done   *      MBOX_WAIT_COMPLETE(ispsoftc_t *, mbreg_t *) wait for cmd to be done
  *      MBOX_NOTIFY_COMPLETE(struct ispsoftc *) notification of mbox cmd donee   *      MBOX_NOTIFY_COMPLETE(ispsoftc_t *)      notification of mbox cmd donee
  *      MBOX_RELEASE(struct ispsoftc *)         release lock on mailbox regs   *      MBOX_RELEASE(ispsoftc_t *)              release lock on mailbox regs
  *   *
  *      FC_SCRATCH_ACQUIRE(struct ispsoftc *)   acquire lock on FC scratch area   *      FC_SCRATCH_ACQUIRE(ispsoftc_t *)        acquire lock on FC scratch area
  *      FC_SCRATCH_RELEASE(struct ispsoftc *)   acquire lock on FC scratch area   *      FC_SCRATCH_RELEASE(ispsoftc_t *)        acquire lock on FC scratch area
  *   *
  *      SCSI_GOOD       SCSI 'Good' Status   *      SCSI_GOOD       SCSI 'Good' Status
  *      SCSI_CHECK      SCSI 'Check Condition' Status   *      SCSI_CHECK      SCSI 'Check Condition' Status
Line 858  void isp_prt(struct ispsoftc *, int leve
Line 974  void isp_prt(struct ispsoftc *, int leve
  *      SCSI_QFULL      SCSI 'Queue Full' Status   *      SCSI_QFULL      SCSI 'Queue Full' Status
  *   *
  *      XS_T            Platform SCSI transaction type (i.e., command for HBA)   *      XS_T            Platform SCSI transaction type (i.e., command for HBA)
    *      XS_DMA_ADDR_T   Platform PCI DMA Address Type
  *      XS_ISP(xs)      gets an instance out of an XS_T   *      XS_ISP(xs)      gets an instance out of an XS_T
  *      XS_CHANNEL(xs)  gets the channel (bus # for DUALBUS cards) ""   *      XS_CHANNEL(xs)  gets the channel (bus # for DUALBUS cards) ""
  *      XS_TGT(xs)      gets the target ""   *      XS_TGT(xs)      gets the target ""
Line 889  void isp_prt(struct ispsoftc *, int leve
Line 1006  void isp_prt(struct ispsoftc *, int leve
  *      XS_NOERR(xs)    there is no error currently set   *      XS_NOERR(xs)    there is no error currently set
  *      XS_INITERR(xs)  initialize error state   *      XS_INITERR(xs)  initialize error state
  *   *
  *      XS_SAVE_SENSE(xs, sp)           save sense data   *      XS_SAVE_SENSE(xs, sp, len)      save sense data
  *   *
  *      XS_SET_STATE_STAT(isp, sp, xs)  platform dependent interpreter of   *      XS_SET_STATE_STAT(isp, sp, xs)  platform dependent interpreter of
  *                                      response queue entry status bits   *                                      response queue entry status bits
  *   *
  *   *
  *      DEFAULT_IID(struct ispsoftc *)          Default SCSI initiator ID   *      DEFAULT_IID(ispsoftc_t *)               Default SCSI initiator ID
  *      DEFAULT_LOOPID(struct ispsoftc *)       Default FC Loop ID   *      DEFAULT_LOOPID(ispsoftc_t *)            Default FC Loop ID
  *      DEFAULT_NODEWWN(struct ispsoftc *)      Default Node WWN   *      DEFAULT_NODEWWN(ispsoftc_t *)           Default Node WWN
  *      DEFAULT_PORTWWN(struct ispsoftc *)      Default Port WWN   *      DEFAULT_PORTWWN(ispsoftc_t *)           Default Port WWN
  *      DEFAULT_FRAMESIZE(struct ispsoftc *)    Default Frame Size   *      DEFAULT_FRAMESIZE(ispsoftc_t *)         Default Frame Size
  *      DEFAULT_EXEC_THROTTLE(struct ispsoftc *) Default Execution Throttle   *      DEFAULT_EXEC_THROTTLE(ispsoftc_t *) Default Execution Throttle
  *              These establish reasonable defaults for each platform.   *              These establish reasonable defaults for each platform.
  *              These must be available independent of card NVRAM and are   *              These must be available independent of card NVRAM and are
  *              to be used should NVRAM not be readable.   *              to be used should NVRAM not be readable.
  *   *
  *      ISP_NODEWWN(struct ispsoftc *)  FC Node WWN to use   *      ISP_NODEWWN(ispsoftc_t *)               FC Node WWN to use
  *      ISP_PORTWWN(struct ispsoftc *)  FC Port WWN to use   *      ISP_PORTWWN(ispsoftc_t *)               FC Port WWN to use
  *   *
  *              These are to be used after NVRAM is read. The tags   *              These are to be used after NVRAM is read. The tags
  *              in fcparam.isp_{node,port}wwn reflect the values   *              in fcparam.isp_ww{n,p}n_nvram reflect the values
  *              read from NVRAM (possibly corrected for card botches).   *              read from NVRAM (possibly corrected for card botches).
  *              Each platform can take that information and override   *              Each platform can take that information and override
  *              it or ignore and return the Node and Port WWNs to be   *              it or ignore and return the Node and Port WWNs to be
  *              used when sending the Qlogic f/w the Initialization Control   *              used when sending the Qlogic f/w the Initialization
  *              Block.   *              Control Block.
  *   *
  *      (XXX these do endian specific transformations- in transition XXX)   *      (XXX these do endian specific transformations- in transition XXX)
  *   *
  *      ISP_IOXPUT_8(struct ispsoftc *, u_int8_t srcval, u_int8_t *dstptr)   *      ISP_IOXPUT_8(ispsoftc_t *, uint8_t srcval, uint8_t *dstptr)
  *      ISP_IOXPUT_16(struct ispsoftc *, u_int16_t srcval, u_int16_t *dstptr)   *      ISP_IOXPUT_16(ispsoftc_t *, uint16_t srcval, uint16_t *dstptr)
  *      ISP_IOXPUT_32(struct ispsoftc *, u_int32_t srcval, u_int32_t *dstptr)   *      ISP_IOXPUT_32(ispsoftc_t *, uint32_t srcval, uint32_t *dstptr)
  *   *
  *      ISP_IOXGET_8(struct ispsoftc *, u_int8_t *srcptr, u_int8_t dstrval)   *      ISP_IOXGET_8(ispsoftc_t *, uint8_t *srcptr, uint8_t dstrval)
  *      ISP_IOXGET_16(struct ispsoftc *, u_int16_t *srcptr, u_int16_t dstrval)   *      ISP_IOXGET_16(ispsoftc_t *, uint16_t *srcptr, uint16_t dstrval)
  *      ISP_IOXGET_32(struct ispsoftc *, u_int32_t *srcptr, u_int32_t dstrval)   *      ISP_IOXGET_32(ispsoftc_t *, uint32_t *srcptr, uint32_t dstrval)
  *   *
  *      ISP_SWIZZLE_NVRAM_WORD(struct ispsoftc *, u_int16_t *)   *      ISP_SWIZZLE_NVRAM_WORD(ispsoftc_t *, uint16_t *)
    *      ISP_SWIZZLE_NVRAM_LONG(ispsoftc_t *, uint32_t *)
    *      ISP_SWAP16(ispsoftc_t *, uint16_t srcval)
    *      ISP_SWAP32(ispsoftc_t *, uint32_t srcval)
  */   */
   
 #endif  /* _ISPVAR_H */  #endif  /* _ISPVAR_H */

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.65.4.1

CVSweb <webmaster@jp.NetBSD.org>