Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Roll minor version. Change how f/w revisions are ...



details:   https://anonhg.NetBSD.org/src/rev/c3423abd9165
branches:  trunk
changeset: 477179:c3423abd9165
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Thu Oct 14 02:21:50 1999 +0000

description:
Roll minor version. Change how f/w revisions are stored. Add some
defines to get max luns for a card. Make sure the RESULT_QUEUE_LEN is not less
than 64- I've seen breakage with that. Move the temp port database stuff
into the softc (ick). Remove most of the target mode stuff. Make xflist
storage an external outer layer thing (since it will now be allocated based
upon the maximum commands that this HBA can support rather than request
queue size).

diffstat:

 sys/dev/ic/ispvar.h |  136 ++++++++++++++++-----------------------------------
 1 files changed, 43 insertions(+), 93 deletions(-)

diffs (229 lines):

diff -r cf4e6ef260b4 -r c3423abd9165 sys/dev/ic/ispvar.h
--- a/sys/dev/ic/ispvar.h       Thu Oct 14 02:18:40 1999 +0000
+++ b/sys/dev/ic/ispvar.h       Thu Oct 14 02:21:50 1999 +0000
@@ -1,7 +1,6 @@
-/* $NetBSD: ispvar.h,v 1.23 1999/07/05 20:31:36 mjacob Exp $ */
-/* release_6_5_99 */
+/* $NetBSD: ispvar.h,v 1.24 1999/10/14 02:21:50 mjacob Exp $ */
 /*
- * Copyright (C) XXXX National Aeronautics & Space Administration
+ * Copyright (C) 1999 National Aeronautics & Space Administration
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -45,7 +44,7 @@
 #endif
 
 #define        ISP_CORE_VERSION_MAJOR  1
-#define        ISP_CORE_VERSION_MINOR  9
+#define        ISP_CORE_VERSION_MINOR  10
 
 /*
  * Vector for bus specific code to provide specific services.
@@ -65,7 +64,7 @@
        const u_int16_t *dv_ispfw;      /* ptr to f/w */
        u_int16_t       dv_fwlen;       /* length of f/w */
        u_int16_t       dv_codeorg;     /* code ORG for f/w */
-       u_int16_t       dv_fwrev;       /* f/w revision */
+       u_int32_t       dv_fwrev;       /* f/w revision */
        /*
         * Initial values for conf1 register
         */
@@ -80,10 +79,27 @@
 #define        MAX_FC_TARG     126
 #endif
 
-/* queue length must be a power of two */
+#define        ISP_MAX_TARGETS(isp)    (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS)
+#ifdef ISP2100_SCCLUN
+#define        _ISP_FC_LUN(isp)        65536
+#else
+#define        _ISP_FC_LUN(isp)        16
+#endif
+#define        _ISP_SCSI_LUN(isp)      \
+       ((ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(7, 55, 0))? 32 : 8)
+#define        ISP_MAX_LUNS(isp)       \
+       (IS_FC(isp)? _ISP_FC_LUN(isp) : _ISP_SCSI_LUN(isp))
+
+/* this is the size of a queue entry (request and response) */
 #define        QENTRY_LEN                      64
+/* both request and result queue length must be a power of two */
 #define        RQUEST_QUEUE_LEN                MAXISPREQUEST
+/* I've seen wierdnesses with the result queue < 64 */
+#if    MAXISPREQUEST > 64
 #define        RESULT_QUEUE_LEN                (MAXISPREQUEST/2)
+#else
+#define        RESULT_QUEUE_LEN                MAXISPREQUEST
+#endif
 #define        ISP_QUEUE_ENTRY(q, idx)         ((q) + ((idx) * QENTRY_LEN))
 #define        ISP_QUEUE_SIZE(n)               ((n) * QENTRY_LEN)
 #define        ISP_NXT_QENTRY(idx, qlen)       (((idx) + 1) & ((qlen)-1))
@@ -156,6 +172,10 @@
 /*
  * Fibre Channel Specifics
  */
+#define        FL_PORT_ID              0x7e    /* FL_Port Special ID */
+#define        FC_PORT_ID              0x7f    /* Fabric Controller Special ID */
+#define        FC_SNS_ID               0x80    /* SNS Server Special ID */
+
 typedef struct {
        u_int                   isp_fwoptions   : 16,
                                                : 7,
@@ -193,7 +213,7 @@
                u_int32_t               portid; 
                u_int64_t               node_wwn;
                u_int64_t               port_wwn;
-       } portdb[MAX_FC_TARG];
+       } portdb[MAX_FC_TARG], tport[FL_PORT_ID];
 
        /*
         * Scratch DMA mapped in area to fetch Port Database stuff, etc.
@@ -216,46 +236,6 @@
 #define        LOOP_PDB_RCVD           2
 #define        LOOP_READY              7
 
-#define        FL_PORT_ID              0x7e    /* FL_Port Special ID */
-#define        FC_PORT_ID              0x7f    /* Fabric Controller Special ID */
-#define        FC_SNS_ID               0x80    /* SNS Server Special ID */
-
-#ifdef ISP_TARGET_MODE
-/*
- * Some temporary Target Mode definitions
- */
-typedef struct tmd_cmd {
-       u_int8_t        cd_iid;         /* initiator */
-       u_int8_t        cd_tgt;         /* target */
-       u_int8_t        cd_lun;         /* LUN for this command */
-       u_int8_t        cd_state;
-       u_int8_t        cd_cdb[16];     /* command bytes */
-       u_int8_t        cd_sensedata[20];
-       u_int16_t       cd_rxid;
-       u_int32_t       cd_datalen;
-       u_int32_t       cd_totbytes;
-       void *          cd_hba;
-} tmd_cmd_t;
-
-/*
- * Async Target Mode Event Definitions
- */
-#define        TMD_BUS_RESET   0
-#define        TMD_BDR         1
-
-/*
- * Immediate Notify data structure.
- */
-#define NOTIFY_MSGLEN  5
-typedef struct {
-       u_int8_t        nt_iid;                 /* initiator */
-       u_int8_t        nt_tgt;                 /* target */
-       u_int8_t        nt_lun;                 /* LUN for this command */
-       u_int8_t        nt_msg[NOTIFY_MSGLEN];  /* SCSI message byte(s) */
-} tmd_notify_t;
-
-#endif
-
 /*
  * Soft Structure per host adapter
  */
@@ -286,69 +266,40 @@
 
        u_int16_t               isp_fwrev[3];   /* Running F/W revision */
        u_int16_t               isp_romfw_rev[3]; /* 'ROM' F/W revision */
+       u_int16_t               isp_maxcmds;    /* max active I/O cmds */
        void *                  isp_param;
 
        /*
         * Volatile state
         */
 
-       volatile u_int
-                               :       13,
+       volatile u_int          :       9,
                isp_state       :       3,
-                               :       2,
                isp_sendmarker  :       2,      /* send a marker entry */
                isp_update      :       2,      /* update parameters */
-               isp_nactive     :       10;     /* how many commands active */
+               isp_nactive     :       16;     /* how many commands active */
+
+       volatile u_int16_t      isp_reqodx;     /* index of last ISP pickup */
+       volatile u_int16_t      isp_reqidx;     /* index of next request */
+       volatile u_int16_t      isp_residx;     /* index of next result */
+       volatile u_int16_t      isp_lasthdls;   /* last handle seed */
 
        /*
-        * Result and Request Queue indices.
+        * Active commands are stored here, found by handle functions.
         */
-       volatile u_int8_t       isp_reqodx;     /* index of last ISP pickup */
-       volatile u_int8_t       isp_reqidx;     /* index of next request */
-       volatile u_int8_t       isp_residx;     /* index of next result */
-       volatile u_int8_t       isp_seqno;      /* rolling sequence # */
+       ISP_SCSI_XFER_T **isp_xflist;
 
        /*
-        * Sheer laziness, but it gets us around the problem
-        * where we don't have a clean way of remembering
-        * which transaction is bound to which ISP queue entry.
-        *
-        * There are other more clever ways to do this, but,
-        * jeez, so I blow a couple of KB per host adapter...
-        * and it *is* faster.
-        */
-       ISP_SCSI_XFER_T *isp_xflist[RQUEST_QUEUE_LEN];
-
-       /*
-        * request/result queues and dma handles for them.
+        * request/result queue pointers and dma handles for them.
         */
        caddr_t                 isp_rquest;
        caddr_t                 isp_result;
        u_int32_t               isp_rquest_dma;
        u_int32_t               isp_result_dma;
+};
 
-#ifdef ISP_TARGET_MODE
-       /*
-        * Vectors for handling target mode support.
-        *
-        * isp_tmd_newcmd is for feeding a newly arrived command to some
-        * upper layer.
-        *
-        * isp_tmd_event is for notifying some upper layer that an event has
-        * occurred that is not necessarily tied to any target (e.g., a SCSI
-        * Bus Reset).
-        *
-        * isp_tmd_notify is for notifying some upper layer that some
-        * event is now occurring that is either pertinent for a specific
-        * device or for a specific command (e.g., BDR or ABORT TAG).
-        *
-        * It is left undefined (for now) how pools of commands are managed.
-        */
-       void            (*isp_tmd_newcmd) __P((void *, tmd_cmd_t *));
-       void            (*isp_tmd_event) __P((void *, int));
-       void            (*isp_tmd_notify) __P((void *, tmd_notify_t *));
-#endif    
-};
+#define        SDPARAM(isp)    ((sdparam *) (isp)->isp_param)
+#define        FCPARAM(isp)    ((fcparam *) (isp)->isp_param)
 
 /*
  * ISP States
@@ -413,9 +364,9 @@
 #define        ISP_DMASETUP(isp, xs, req, iptrp, optr) \
        (*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr))
 
-#define        ISP_DMAFREE(isp, xs, seqno)     \
+#define        ISP_DMAFREE(isp, xs, hndl)      \
        if ((isp)->isp_mdvec->dv_dmaclr) \
-                (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (seqno))
+                (*(isp)->isp_mdvec->dv_dmaclr)((isp), (xs), (hndl))
 
 #define        ISP_RESET0(isp) \
        if ((isp)->isp_mdvec->dv_reset0) (*(isp)->isp_mdvec->dv_reset0)((isp))
@@ -500,5 +451,4 @@
  */
 void isp_lostcmd __P((struct ispsoftc *, ISP_SCSI_XFER_T *));
 
-
 #endif /* _ISPVAR_H */



Home | Main Index | Thread Index | Old Index