Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/dev/ic Pull up revisions 1.39-1.43 (requested by mj...



details:   https://anonhg.NetBSD.org/src/rev/9f2d0440e80b
branches:  netbsd-1-5
changeset: 490887:9f2d0440e80b
user:      he <he%NetBSD.org@localhost>
date:      Fri Mar 16 19:17:09 2001 +0000

description:
Pull up revisions 1.39-1.43 (requested by mjacob):
  Add ISPCTL_RUN_MBOXCMD control op and ISPASYNC_UNHANDLED_RESPONSE
  async event.  Eliminate ISP2100_FABRIC.  ISPASYNC_PDB_CHANGED ->
  ISPASYNC_LOGGED_INOUT.  Add -Wformat patches.  Roll core minor.
  ANSIfy.

diffstat:

 sys/dev/ic/ispvar.h |  210 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 163 insertions(+), 47 deletions(-)

diffs (truncated from 387 to 300 lines):

diff -r 56d7657d853a -r 9f2d0440e80b sys/dev/ic/ispvar.h
--- a/sys/dev/ic/ispvar.h       Fri Mar 16 19:16:29 2001 +0000
+++ b/sys/dev/ic/ispvar.h       Fri Mar 16 19:17:09 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ispvar.h,v 1.30.4.2 2001/01/25 18:25:43 jhawk Exp $ */
+/* $NetBSD: ispvar.h,v 1.30.4.3 2001/03/16 19:17:09 he Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -84,23 +84,23 @@
 #endif
 
 #define        ISP_CORE_VERSION_MAJOR  2
-#define        ISP_CORE_VERSION_MINOR  0
+#define        ISP_CORE_VERSION_MINOR  1
 
 /*
  * Vector for bus specific code to provide specific services.
  */
 struct ispsoftc;
 struct ispmdvec {
-       u_int16_t       (*dv_rd_reg) __P((struct ispsoftc *, int));
-       void            (*dv_wr_reg) __P((struct ispsoftc *, int, u_int16_t));
-       int             (*dv_mbxdma) __P((struct ispsoftc *));
-       int             (*dv_dmaset) __P((struct ispsoftc *,
-               XS_T *, ispreq_t *, u_int16_t *, u_int16_t));
+       u_int16_t       (*dv_rd_reg) (struct ispsoftc *, int);
+       void            (*dv_wr_reg) (struct ispsoftc *, int, u_int16_t);
+       int             (*dv_mbxdma) (struct ispsoftc *);
+       int             (*dv_dmaset) (struct ispsoftc *,
+               XS_T *, ispreq_t *, u_int16_t *, u_int16_t);
        void            (*dv_dmaclr)
-               __P((struct ispsoftc *, XS_T *, u_int32_t));
-       void            (*dv_reset0) __P((struct ispsoftc *));
-       void            (*dv_reset1) __P((struct ispsoftc *));
-       void            (*dv_dregs) __P((struct ispsoftc *, const char *));
+               (struct ispsoftc *, XS_T *, u_int16_t);
+       void            (*dv_reset0) (struct ispsoftc *);
+       void            (*dv_reset1) (struct ispsoftc *);
+       void            (*dv_dregs) (struct ispsoftc *, const char *);
        const u_int16_t *dv_ispfw;      /* ptr to f/w */
        u_int16_t       dv_conf1;
        u_int16_t       dv_clock;       /* clock frequency */
@@ -110,12 +110,7 @@
  * Overall parameters
  */
 #define        MAX_TARGETS     16
-#ifdef ISP2100_FABRIC
 #define        MAX_FC_TARG     256
-#else
-#define        MAX_FC_TARG     126
-#endif
-
 #define        ISP_MAX_TARGETS(isp)    (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS)
 #define        ISP_MAX_LUNS(isp)       (isp)->isp_maxluns
 
@@ -265,17 +260,20 @@
 
 typedef struct {
        u_int32_t               isp_fwoptions   : 16,
-                                               : 4,
+                                               : 3,
+                               isp_iid_set     : 1,
                                loop_seen_once  : 1,
                                isp_loopstate   : 3,    /* Current Loop State */
                                isp_fwstate     : 3,    /* ISP F/W state */
                                isp_gotdparms   : 1,
                                isp_topo        : 3,
                                isp_onfabric    : 1;
+       u_int8_t                isp_iid;        /* 'initiator' id */
        u_int8_t                isp_loopid;     /* hard loop id */
        u_int8_t                isp_alpa;       /* ALPA */
+       u_int32_t               isp_portid;
        volatile u_int16_t      isp_lipseq;     /* LIP sequence # */
-       u_int32_t               isp_portid;
+       u_int16_t               isp_xxxxxx;
        u_int8_t                isp_execthrottle;
        u_int8_t                isp_retry_delay;
        u_int8_t                isp_retry_count;
@@ -296,14 +294,16 @@
        struct lportdb {
                u_int
                                        loopid          : 8,
-                                                       : 4,
+                                                       : 2,
+                                       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[FL_PORT_ID];
+       } portdb[MAX_FC_TARG], tport[FC_PORT_ID];
 
        /*
         * Scratch DMA mapped in area to fetch Port Database stuff, etc.
@@ -324,6 +324,11 @@
 #define        LOOP_NIL                0
 #define        LOOP_LIP_RCVD           1
 #define        LOOP_PDB_RCVD           2
+#define        LOOP_SCANNING_FABRIC    3
+#define        LOOP_FSCAN_DONE         4
+#define        LOOP_SCANNING_LOOP      5
+#define        LOOP_LSCAN_DONE         4
+#define        LOOP_SYNCING_PDB        6
 #define        LOOP_READY              7
 
 #define        TOPO_NL_PORT            0
@@ -359,14 +364,17 @@
        u_int8_t                isp_revision;   /* HBA Chip H/W Revision */
        u_int32_t               isp_maxluns;    /* maximum luns supported */
 
-       u_int32_t
+       u_int32_t               isp_clock       : 8,    /* input clock */
+                                               : 6,
+                               isp_role        : 2,
+                                               : 1,
                                isp_touched     : 1,    /* board ever seen? */
-                                               : 1,
                                isp_bustype     : 1,    /* SBus or PCI */
                                isp_loaded_fw   : 1,    /* loaded firmware */
-                               isp_dblev       : 12,   /* debug log mask */
-                               isp_clock       : 8,    /* input clock */
-                               isp_confopts    : 8;    /* config options */
+                               isp_dblev       : 12;   /* debug log mask */
+
+       u_int32_t               isp_confopts;           /* config options */
+
        /*
         * Instrumentation
         */
@@ -389,6 +397,7 @@
        volatile u_int16_t      isp_residx;     /* index of next result */
        volatile u_int16_t      isp_lasthdls;   /* last handle seed */
        volatile u_int16_t      isp_mboxtmp[MAX_MAILBOX];
+       volatile u_int16_t      isp_lastmbxcmd; /* last mbox command sent */
 
        /*
         * Active commands are stored here, indexed by handle functions.
@@ -420,7 +429,6 @@
  */
 #define        ISP_CFG_NORELOAD        0x80    /* don't download f/w */
 #define        ISP_CFG_NONVRAM         0x40    /* ignore NVRAM */
-#define        ISP_CFG_NOINIT          0x20    /* just set defaults- don't init */
 #define        ISP_CFG_FULL_DUPLEX     0x01    /* Full Duplex (Fibre Channel only) */
 #define        ISP_CFG_OWNWWN          0x02    /* override NVRAM wwn */
 #define        ISP_CFG_PORT_PREF       0x0C    /* Mask for Port Prefs (2200 only) */
@@ -430,11 +438,42 @@
 #define        ISP_CFG_LPORT_ONLY      0x0C    /* insist on {N/F}L-Port connection */
 
 /*
+ * Prior to calling isp_reset for the first time, the outer layer
+ * should set isp_role to one of NONE, INITIATOR, TARGET, BOTH.
+ *
+ * If you set ISP_ROLE_NONE, the cards will be reset, new firmware loaded,
+ * NVRAM read, and defaults set, but any further initialization (e.g.
+ * INITIALIZE CONTROL BLOCK commands for 2X00 cards) won't be done.
+ *
+ * If INITIATOR MODE isn't set, attempts to run commands will be stopped
+ * at isp_start and completed with the moral equivalent of SELECTION TIMEOUT.
+ *
+ * If TARGET MODE is set, it doesn't mean that the rest of target mode support
+ * needs to be enabled, or will even work. What happens with the 2X00 cards
+ * here is that if you have enabled it with TARGET MODE as part of the ICB
+ * options, but you haven't given the f/w any ram resources for ATIOs or
+ * Immediate Notifies, the f/w just handles what it can and you never see
+ * anything. Basically, it sends a single byte of data (the first byte,
+ * which you can set as part of the INITIALIZE CONTROL BLOCK command) for
+ * INQUIRY, and sends back QUEUE FULL status for any other command.
+ * 
+ */
+#define        ISP_ROLE_NONE           0x0
+#define        ISP_ROLE_INITIATOR      0x1
+#define        ISP_ROLE_TARGET         0x2
+#define        ISP_ROLE_BOTH           (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR)
+#define        ISP_ROLE_EITHER         ISP_ROLE_BOTH
+#ifndef        ISP_DEFAULT_ROLES
+#define        ISP_DEFAULT_ROLES       ISP_ROLE_INITIATOR
+#endif
+
+
+/*
  * Firmware related defines
  */
-#define        ISP_CODE_ORG            0x1000  /* default f/w code start */
+#define        ISP_CODE_ORG                    0x1000  /* default f/w code start */
 #define        ISP_FW_REV(maj, min, mic)       ((maj << 24) | (min << 16) | mic)
-#define        ISP_FW_REVX(xp) ((xp[0]<<24) | (xp[1] << 16) | xp[2])
+#define        ISP_FW_REVX(xp)                 ((xp[0]<<24) | (xp[1] << 16) | xp[2])
 
 /*
  * Bus (implementation) types
@@ -490,27 +529,27 @@
  * Reset Hardware. Totally. Assumes that you'll follow this with
  * a call to isp_init.
  */
-void isp_reset __P((struct ispsoftc *));
+void isp_reset(struct ispsoftc *);
 
 /*
  * Initialize Hardware to known state
  */
-void isp_init __P((struct ispsoftc *));
+void isp_init(struct ispsoftc *);
 
 /*
  * Reset the ISP and call completion for any orphaned commands.
  */
-void isp_reinit __P((struct ispsoftc *));
+void isp_reinit(struct ispsoftc *);
 
 /*
  * Interrupt Service Routine
  */
-int isp_intr __P((void *));
+int isp_intr(void *);
 
 /*
  * Command Entry Point- Platform Dependent layers call into this
  */
-int isp_start __P((XS_T *));
+int isp_start(XS_T *);
 /* these values are what isp_start returns */
 #define        CMD_COMPLETE    101     /* command completed */
 #define        CMD_EAGAIN      102     /* busy- maybe retry later */
@@ -520,52 +559,130 @@
 /*
  * Command Completion Point- Core layers call out from this with completed cmds
  */
-void isp_done __P((XS_T *));
+void isp_done(XS_T *);
 
 /*
  * Platform Dependent to External to Internal Control Function
  *
- * Assumes all locks are held and that no reentrancy issues need be dealt with.
+ * Assumes locks are held on entry. You should note that with many of
+ * these commands and locks may be released while this is occurring.
+ *
+ * A few notes about some of these functions:
+ *
+ * ISPCTL_FCLINK_TEST tests to make sure we have good fibre channel link.
+ * The argument is a pointer to an integer which is the time, in microseconds,
+ * we should wait to see whether we have good link. This test, if successful,
+ * lets us know our connection topology and our Loop ID/AL_PA and so on.
+ * You can't get anywhere without this.
  *
+ * ISPCTL_SCAN_FABRIC queries the name server (if we're on a fabric) for
+ * all entities using the FC Generic Services subcommand GET ALL NEXT.
+ * For each found entity, an ISPASYNC_FABRICDEV event is generated (see
+ * below).
+ *
+ * ISPCTL_SCAN_LOOP does a local loop scan. This is only done if the connection
+ * topology is NL or FL port (private or public loop). Since the Qlogic f/w
+ * 'automatically' manages local loop connections, this function essentially
+ * notes the arrival, departure, and possible shuffling around of local loop
+ * entities. Thus for each arrival and departure this generates an isp_async
+ * event of ISPASYNC_PROMENADE (see below).
+ *
+ * ISPCTL_PDB_SYNC is somewhat misnamed. It actually is the final step, in
+ * order, of ISPCTL_FCLINK_TEST, ISPCTL_SCAN_FABRIC, and ISPCTL_SCAN_LOOP.
+ * The main purpose of ISPCTL_PDB_SYNC is to complete management of logging
+ * and logging out of fabric devices (if one is on a fabric) and then marking
+ * the 'loop state' as being ready to now be used for sending commands to
+ * devices. Originally fabric name server and local loop scanning were
+ * part of this function. It's now been seperated to allow for finer control.
  */
 typedef enum {
        ISPCTL_RESET_BUS,               /* Reset Bus */
        ISPCTL_RESET_DEV,               /* Reset Device */
        ISPCTL_ABORT_CMD,               /* Abort Command */
-       ISPCTL_UPDATE_PARAMS,           /* Update Operating Parameters */
+       ISPCTL_UPDATE_PARAMS,           /* Update Operating Parameters (SCSI) */
        ISPCTL_FCLINK_TEST,             /* Test FC Link Status */
+       ISPCTL_SCAN_FABRIC,             /* (Re)scan Fabric Name Server */
+       ISPCTL_SCAN_LOOP,               /* (Re)scan Local Loop */
        ISPCTL_PDB_SYNC,                /* Synchronize Port Database */
+       ISPCTL_SEND_LIP,                /* Send a LIP */
+       ISPCTL_GET_POSMAP,              /* Get FC-AL position map */
+       ISPCTL_RUN_MBOXCMD,             /* run a mailbox command */
        ISPCTL_TOGGLE_TMODE             /* toggle target mode */
 } ispctl_t;
-int isp_control __P((struct ispsoftc *, ispctl_t, void *));
+int isp_control(struct ispsoftc *, ispctl_t, void *);
 
 
 /*
  * Platform Dependent to Internal to External Control Function
  * (each platform must provide such a function)
  *
- * Assumes all locks are held and that no reentrancy issues need be dealt with.
+ * Assumes locks are held.
+ *
+ * A few notes about some of these functions:
+ *
+ * ISPASYNC_CHANGE_NOTIFY notifies the outer layer that a change has
+ * occurred that invalidates the list of fabric devices known and/or
+ * the list of known loop devices. The argument passed is a pointer



Home | Main Index | Thread Index | Old Index