Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Fix various 2300 GB issues related to chip errata...



details:   https://anonhg.NetBSD.org/src/rev/1edf2b544149
branches:  trunk
changeset: 515879:1edf2b544149
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Sat Oct 06 20:34:49 2001 +0000

description:
Fix various 2300 GB issues related to chip errata and documentation
misunderstandings. We also now can report our connection rate.

diffstat:

 sys/dev/ic/isp.c     |  61 ++++++++++++++++++++++++++++++++------------
 sys/dev/ic/ispmbox.h |  70 ++++++++++++++++++++++++++++-----------------------
 sys/dev/ic/ispvar.h  |   6 ++-
 3 files changed, 87 insertions(+), 50 deletions(-)

diffs (245 lines):

diff -r c79347125abe -r 1edf2b544149 sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c  Sat Oct 06 20:33:24 2001 +0000
+++ b/sys/dev/ic/isp.c  Sat Oct 06 20:34:49 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.80 2001/09/05 23:05:20 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.81 2001/10/06 20:34:49 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -576,15 +576,22 @@
        ISP_RESET1(isp);
 
        /*
-        * Wait for everything to finish firing up...
+        * Wait for everything to finish firing up.
+        *
+        * Avoid doing this on the 2312 because you can generate a PCI
+        * parity error (chip breakage).
         */
-       loops = MBOX_DELAY_COUNT;
-       while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) {
-               USEC_DELAY(100);
-               if (--loops < 0) {
-                       isp_prt(isp, ISP_LOGERR,
-                           "MBOX_BUSY never cleared on reset");
-                       return;
+       if (IS_2300(isp)) {
+               USEC_DELAY(5);
+       } else {
+               loops = MBOX_DELAY_COUNT;
+               while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) {
+                       USEC_DELAY(100);
+                       if (--loops < 0) {
+                               isp_prt(isp, ISP_LOGERR,
+                                   "MBOX_BUSY never cleared on reset");
+                               return;
+                       }
                }
        }
 
@@ -1234,23 +1241,29 @@
                 */
                switch(isp->isp_confopts & ISP_CFG_PORT_PREF) {
                case ISP_CFG_NPORT:
-                       icbp->icb_xfwoptions = ICBXOPT_PTP_2_LOOP;
+                       icbp->icb_xfwoptions |= ICBXOPT_PTP_2_LOOP;
                        break;
                case ISP_CFG_NPORT_ONLY:
-                       icbp->icb_xfwoptions = ICBXOPT_PTP_ONLY;
+                       icbp->icb_xfwoptions |= ICBXOPT_PTP_ONLY;
                        break;
                case ISP_CFG_LPORT_ONLY:
-                       icbp->icb_xfwoptions = ICBXOPT_LOOP_ONLY;
+                       icbp->icb_xfwoptions |= ICBXOPT_LOOP_ONLY;
                        break;
                default:
-                       icbp->icb_xfwoptions = ICBXOPT_LOOP_2_PTP;
+                       icbp->icb_xfwoptions |= ICBXOPT_LOOP_2_PTP;
                        break;
                }
                if (IS_2300(isp)) {
                        if (isp->isp_revision < 2) {
                                icbp->icb_fwoptions &= ~ICBOPT_FAST_POST;
                        }
-                       icbp->icb_xfwoptions |= ICBXOPT_RATE_AUTO;
+                       if (isp->isp_confopts & ISP_CFG_ONEGB) {
+                               icbp->icb_zfwoptions |= ICBZOPT_RATE_ONEGB;
+                       } else if (isp->isp_confopts & ISP_CFG_TWOGB) {
+                               icbp->icb_zfwoptions |= ICBZOPT_RATE_TWOGB;
+                       } else {
+                               icbp->icb_zfwoptions |= ICBZOPT_RATE_AUTO;
+                       }
                }
        }
 
@@ -1611,6 +1624,20 @@
                fcp->portdb[FL_PORT_ID].valid = 0;
        }
 
+       fcp->isp_gbspeed = 1;
+       if (IS_2300(isp)) {
+               mbs.param[0] = MBOX_GET_SET_DATA_RATE;
+               mbs.param[1] = MBGSD_GET_RATE;
+               /* mbs.param[2] undefined if we're just getting rate */
+               isp_mboxcmd(isp, &mbs, MBLOGALL);
+               if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
+                       if (mbs.param[1] == MBGSD_TWOGB) {
+                               isp_prt(isp, ISP_LOGINFO, "2Gb link speed/s");
+                               fcp->isp_gbspeed = 2;
+                       }
+               }
+       }
+
        isp_prt(isp, ISP_LOGINFO, topology, fcp->isp_loopid, fcp->isp_alpa,
            fcp->isp_portid, fcp->isp_loopstate, toponames[fcp->isp_topo]);
 
@@ -4271,7 +4298,7 @@
        ISPOPMAP(0x00, 0x00),   /* 0x25: */
        ISPOPMAP(0x00, 0x00),   /* 0x26: */
        ISPOPMAP(0x00, 0x00),   /* 0x27: */
-       ISPOPMAP(0x01, 0x3),    /* 0x28: MBOX_GET_FIRMWARE_OPTIONS */
+       ISPOPMAP(0x01, 0x03),   /* 0x28: MBOX_GET_FIRMWARE_OPTIONS */
        ISPOPMAP(0x03, 0x07),   /* 0x29: MBOX_GET_PORT_QUEUE_PARAMS */
        ISPOPMAP(0x00, 0x00),   /* 0x2a: */
        ISPOPMAP(0x00, 0x00),   /* 0x2b: */
@@ -4324,7 +4351,7 @@
        ISPOPMAP(0x00, 0x00),   /* 0x5a: */
        ISPOPMAP(0x00, 0x00),   /* 0x5b: */
        ISPOPMAP(0x00, 0x00),   /* 0x5c: */
-       ISPOPMAP(0x00, 0x00),   /* 0x5d: */
+       ISPOPMAP(0x07, 0x03),   /* 0x5d: MBOX_GET_SET_DATA_RATE */
        ISPOPMAP(0x00, 0x00),   /* 0x5e: */
        ISPOPMAP(0x00, 0x00),   /* 0x5f: */
        ISPOPMAP(0xfd, 0x31),   /* 0x60: MBOX_INIT_FIRMWARE */
@@ -4455,7 +4482,7 @@
        NULL,
        NULL,
        NULL,
-       NULL,
+       "GET/SET DATA RATE",
        NULL,
        NULL,
        "INIT FIRMWARE",
diff -r c79347125abe -r 1edf2b544149 sys/dev/ic/ispmbox.h
--- a/sys/dev/ic/ispmbox.h      Sat Oct 06 20:33:24 2001 +0000
+++ b/sys/dev/ic/ispmbox.h      Sat Oct 06 20:34:49 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ispmbox.h,v 1.34 2001/09/01 07:12:24 mjacob Exp $ */
+/* $NetBSD: ispmbox.h,v 1.35 2001/10/06 20:34:51 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -138,37 +138,45 @@
 #define                FW_FEATURE_LVD_NOTIFY   0x2
 #define                FW_FEATURE_FAST_POST    0x1
 
-#define        MBOX_ENABLE_TARGET_MODE         0x55
+#define        MBOX_ENABLE_TARGET_MODE         0x0055
 #define                ENABLE_TARGET_FLAG      0x8000
 #define                ENABLE_TQING_FLAG       0x0004
 #define                ENABLE_MANDATORY_DISC   0x0002
-#define        MBOX_GET_TARGET_STATUS          0x56
+#define        MBOX_GET_TARGET_STATUS          0x0056
 
-/* These are for the ISP2100 FC cards */
-#define        MBOX_GET_LOOP_ID                0x20
-#define        MBOX_GET_FIRMWARE_OPTIONS       0x28
-#define        MBOX_SET_FIRMWARE_OPTIONS       0x38
-#define        MBOX_GET_RESOURCE_COUNT         0x42
-#define        MBOX_ENHANCED_GET_PDB           0x47
-#define        MBOX_EXEC_COMMAND_IOCB_A64      0x54
-#define        MBOX_INIT_FIRMWARE              0x60
-#define        MBOX_GET_INIT_CONTROL_BLOCK     0x61
-#define        MBOX_INIT_LIP                   0x62
-#define        MBOX_GET_FC_AL_POSITION_MAP     0x63
-#define        MBOX_GET_PORT_DB                0x64
-#define        MBOX_CLEAR_ACA                  0x65
-#define        MBOX_TARGET_RESET               0x66
-#define        MBOX_CLEAR_TASK_SET             0x67
-#define        MBOX_ABORT_TASK_SET             0x68
-#define        MBOX_GET_FW_STATE               0x69
-#define        MBOX_GET_PORT_NAME              0x6a
-#define        MBOX_GET_LINK_STATUS            0x6b
-#define        MBOX_INIT_LIP_RESET             0x6c
-#define        MBOX_SEND_SNS                   0x6e
-#define        MBOX_FABRIC_LOGIN               0x6f
-#define        MBOX_SEND_CHANGE_REQUEST        0x70
-#define        MBOX_FABRIC_LOGOUT              0x71
-#define        MBOX_INIT_LIP_LOGIN             0x72
+/* These are for the ISP2X00 FC cards */
+#define        MBOX_GET_LOOP_ID                0x0020
+#define        MBOX_GET_FIRMWARE_OPTIONS       0x0028
+#define        MBOX_SET_FIRMWARE_OPTIONS       0x0038
+#define        MBOX_GET_RESOURCE_COUNT         0x0042
+#define        MBOX_ENHANCED_GET_PDB           0x0047
+#define        MBOX_EXEC_COMMAND_IOCB_A64      0x0054
+#define        MBOX_INIT_FIRMWARE              0x0060
+#define        MBOX_GET_INIT_CONTROL_BLOCK     0x0061
+#define        MBOX_INIT_LIP                   0x0062
+#define        MBOX_GET_FC_AL_POSITION_MAP     0x0063
+#define        MBOX_GET_PORT_DB                0x0064
+#define        MBOX_CLEAR_ACA                  0x0065
+#define        MBOX_TARGET_RESET               0x0066
+#define        MBOX_CLEAR_TASK_SET             0x0067
+#define        MBOX_ABORT_TASK_SET             0x0068
+#define        MBOX_GET_FW_STATE               0x0069
+#define        MBOX_GET_PORT_NAME              0x006A
+#define        MBOX_GET_LINK_STATUS            0x006B
+#define        MBOX_INIT_LIP_RESET             0x006C
+#define        MBOX_SEND_SNS                   0x006E
+#define        MBOX_FABRIC_LOGIN               0x006F
+#define        MBOX_SEND_CHANGE_REQUEST        0x0070
+#define        MBOX_FABRIC_LOGOUT              0x0071
+#define        MBOX_INIT_LIP_LOGIN             0x0072
+
+#define        MBOX_GET_SET_DATA_RATE          0x005D  /* 23XX only */
+#define                MBGSD_GET_RATE  0
+#define                MBGSD_SET_RATE  1
+#define                MBGSD_ONEGB     0
+#define                MBGSD_TWOGB     1
+#define                MBGSD_AUTO      2
+
 
 #define        ISP2100_SET_PCI_PARAM           0x00ff
 
@@ -685,9 +693,9 @@
 #define        ICBXOPT_RIO_32BIT_DELAY 4
 
 /* These 3 only apply to the 2300 */
-#define        ICBXOPT_RATE_ONEGB      (0 << 14)
-#define        ICBXOPT_RATE_TWOGB      (1 << 14)
-#define        ICBXOPT_RATE_AUTO       (2 << 14)
+#define        ICBZOPT_RATE_ONEGB      (MBGSD_ONEGB << 14)
+#define        ICBZOPT_RATE_TWOGB      (MBGSD_TWOGB << 14)
+#define        ICBZOPT_RATE_AUTO       (MBGSD_AUTO << 14)
 
 
 #define        ICB_MIN_FRMLEN          256
diff -r c79347125abe -r 1edf2b544149 sys/dev/ic/ispvar.h
--- a/sys/dev/ic/ispvar.h       Sat Oct 06 20:33:24 2001 +0000
+++ b/sys/dev/ic/ispvar.h       Sat Oct 06 20:34:49 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ispvar.h,v 1.49 2001/09/05 22:33:05 mjacob Exp $ */
+/* $NetBSD: ispvar.h,v 1.50 2001/10/06 20:34:51 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -274,7 +274,7 @@
 
 typedef struct {
        u_int32_t               isp_fwoptions   : 16,
-                                               : 2,
+                               isp_gbspeed     : 2,
                                isp_iid_set     : 1,
                                loop_seen_once  : 1,
                                isp_loopstate   : 4,    /* Current Loop State */
@@ -449,6 +449,8 @@
  */
 #define        ISP_CFG_NORELOAD        0x80    /* don't download f/w */
 #define        ISP_CFG_NONVRAM         0x40    /* ignore NVRAM */
+#define        ISP_CFG_TWOGB           0x20    /* force 2GB connection (23XX only) */
+#define        ISP_CFG_ONEGB           0x10    /* force 1GB connection (23XX only) */
 #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) */



Home | Main Index | Thread Index | Old Index