Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Add in 12160 (Ultra3) support. Turn back on fast ...



details:   https://anonhg.NetBSD.org/src/rev/b3a9cb860941
branches:  trunk
changeset: 482012:b3a9cb860941
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Sat Feb 12 02:32:21 2000 +0000

description:
Add in 12160 (Ultra3) support. Turn back on fast posting for the new
generateion parallel SCSI cards (1240/1080/1280/12160). Split up nvram
reading routines to be more readable. Fix topology reporting- 2200 has
connected topology in mailbox 6 when you're done getting your loop id
(supported: Private Loop (NL Port), N-Port, F-Port, FL-Port). The 2100
doens't report this, but we can synthesize it to be either NL-Port or
FL-Port. Add in some connection mode async events.

diffstat:

 sys/dev/ic/isp.c |  948 +++++++++++++++++++++++++++++++++---------------------
 1 files changed, 585 insertions(+), 363 deletions(-)

diffs (truncated from 1066 to 300 lines):

diff -r 0020b26a78cc -r b3a9cb860941 sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c  Sat Feb 12 02:29:00 2000 +0000
+++ b/sys/dev/ic/isp.c  Sat Feb 12 02:32:21 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.48 2000/01/14 08:46:37 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.49 2000/02/12 02:32:21 mjacob Exp $ */
 /*
  * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
  * All rights reserved.
@@ -95,6 +95,11 @@
 static void isp_setdfltparm __P((struct ispsoftc *, int));
 static int isp_read_nvram __P((struct ispsoftc *));
 static void isp_rdnvram_word __P((struct ispsoftc *, int, u_int16_t *));
+static void isp_parse_nvram_1020 __P((struct ispsoftc *, u_int8_t *));
+static void isp_parse_nvram_1080 __P((struct ispsoftc *, int, u_int8_t *));
+static void isp_parse_nvram_12160 __P((struct ispsoftc *, int, u_int8_t *));
+static void isp_parse_nvram_2100 __P((struct ispsoftc *, u_int8_t *));
+
 
 /*
  * Reset Hardware.
@@ -188,7 +193,15 @@
 
                isp->isp_clock = 100;
 
-               revname = "1080";
+               if (IS_1280(isp))
+                       revname = "1280";
+               else if (IS_1080(isp))
+                       revname = "1080";
+               else if (IS_12160(isp))
+                       revname = "12160";
+               else
+                       revname = "<UNKLVD>";
+
                l = ISP_READ(isp, SXP_PINS_DIFF) & ISP1080_MODE_MASK;
                switch (l) {
                case ISP1080_LVD_MODE:
@@ -209,9 +222,8 @@
                        break;
                }
 
-               if (IS_1280(isp)) {
+               if (IS_DUALBUS(isp)) {
                        sdp++;
-                       revname[1] = '2';
                        l = ISP_READ(isp, SXP_PINS_DIFF|SXP_BANK1_SELECT);
                        l &= ISP1080_MODE_MASK;
                        switch(l) {
@@ -802,8 +814,10 @@
        mbs.param[1] = 0;
        if (IS_ULTRA2(isp))
                mbs.param[1] |= FW_FEATURE_LVD_NOTIFY;
+       if (IS_ULTRA2(isp) || IS_1240(isp))
+               mbs.param[1] |= FW_FEATURE_FAST_POST;
 #ifndef        ISP_NO_FASTPOST_SCSI
-       if ((ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(4, 55, 0) &&
+       else if ((ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(4, 55, 0) &&
            (ISP_FW_REVX(isp->isp_fwrev) < ISP_FW_REV(5, 0, 0))) ||
            (ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(7, 55, 0))) {
                mbs.param[1] |= FW_FEATURE_FAST_POST;
@@ -1058,6 +1072,18 @@
        icbp->icb_retry_delay = fcp->isp_retry_delay;
        icbp->icb_retry_count = fcp->isp_retry_count;
        icbp->icb_hardaddr = loopid;
+#ifdef PRET_A_PORTE
+       if (IS_2200(isp)) {
+               icbp->icb_fwoptions |= ICBOPT_EXTENDED;
+               /*
+                * Prefer or force Point-To-Point instead Loop?
+                */
+               if (isp->isp_confopts & ISP_CFG_NPORT)
+                       icbp->icb_xfwoptions = ICBXOPT_PTP_2_LOOP;
+               else
+                       icbp->icb_xfwoptions = ICBXOPT_LOOP_2_PTP;
+       }
+#endif
        icbp->icb_logintime = 60;       /* 60 second login timeout */
 
        if (fcp->isp_nodewwn) {
@@ -1237,7 +1263,6 @@
                "N-Port to N-Port",
                "F Port"
        };
-       char *tname;
        mbreg_t mbs;
        int count, topo = -1;
        u_int8_t lwfs;
@@ -1282,19 +1307,13 @@
                return (-1);
        }
        fcp->isp_loopid = mbs.param[1];
-       if (isp->isp_type == ISP_HA_FC_2200) {
-               if (ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(2, 0, 14)) {
-                       topo = (int) mbs.param[6];
-               }
-       } else if (isp->isp_type == ISP_HA_FC_2100) {
-               if (ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(1, 17, 26)) {
-                       topo = (int) mbs.param[6];
-               }
+       if (IS_2200(isp)) {
+               topo = (int) mbs.param[6];
+               if (topo < 0 || topo > 3)
+                       topo = 0;
+       } else {
+               topo = 0;
        }
-       if (topo < 0 || topo > 3)
-               tname = "unknown";
-       else
-               tname = toponames[topo];
 
        /*
         * If we're not on a fabric, the low 8 bits will be our AL_PA.
@@ -1304,11 +1323,16 @@
 #if    defined(ISP2100_FABRIC)
        fcp->isp_onfabric = 0;
        if (isp_getpdb(isp, FL_PORT_ID, &pdb) == 0) {
+
+               if (IS_2100(isp))
+                       topo = 1;
+
                fcp->isp_portid = mbs.param[2] | (((int)mbs.param[3]) << 16);
                fcp->isp_onfabric = 1;
                CFGPRINTF("%s: Loop ID %d, AL_PA 0x%x, Port ID 0x%x Loop State "
-                   "0x%x topology %s\n", isp->isp_name, fcp->isp_loopid,
-                   fcp->isp_alpa, fcp->isp_portid, fcp->isp_loopstate, tname);
+                   "0x%x topology '%s'\n", isp->isp_name, fcp->isp_loopid,
+                   fcp->isp_alpa, fcp->isp_portid, fcp->isp_loopstate,
+                   toponames[topo]);
 
                /*
                 * Make sure we're logged out of all fabric devices.
@@ -1328,9 +1352,9 @@
                }
        } else
 #endif
-       CFGPRINTF("%s: Loop ID %d, ALPA 0x%x Loop State 0x%x topology %s\n",
+       CFGPRINTF("%s: Loop ID %d, ALPA 0x%x Loop State 0x%x topology '%s'\n",
            isp->isp_name, fcp->isp_loopid, fcp->isp_alpa, fcp->isp_loopstate,
-           tname);
+           toponames[topo]);
        return (0);
 }
 
@@ -2711,6 +2735,37 @@
                isp_async(isp, ISPASYNC_CHANGE_NOTIFY, NULL);
                break;
 
+       case ASYNC_PTPMODE:
+               PRINTF("%s: Point-to-Point mode\n", isp->isp_name);
+               break;
+
+       case ASYNC_CONNMODE:
+               mbox = ISP_READ(isp, OUTMAILBOX1);
+               switch (mbox) {
+               case ISP_CONN_LOOP:
+                       PRINTF("%s: Point-to-Point -> Loop mode\n",
+                           isp->isp_name);
+                       break;
+               case ISP_CONN_PTP:
+                       PRINTF("%s: Loop -> Point-to-Point mode\n",
+                           isp->isp_name);
+                       break;
+               case ISP_CONN_BADLIP:
+                       PRINTF("%s: Point-to-Point -> Loop mode (1)\n",
+                           isp->isp_name);
+                       break;
+               case ISP_CONN_FATAL:
+                       PRINTF("%s: FATAL CONNECTION ERROR\n", isp->isp_name);
+                       isp_restart(isp);
+                       /* no point continuing after this */
+                       return (-1);
+
+               case ISP_CONN_LOOPBACK:
+                       PRINTF("%s: Looped Back in Point-to-Point mode\n",
+                            isp->isp_name);
+               }
+               break;
+
        default:
                PRINTF("%s: unknown async code 0x%x\n", isp->isp_name, mbox);
                break;
@@ -3443,6 +3498,12 @@
                }
        }
 
+       if (IS_2200(isp)) {
+               if (opcode == MBOX_GET_LOOP_ID) {
+                       mbp->param[6] = ISP_READ(isp, OUTMAILBOX6);
+               }
+       }
+
        switch (outparam) {
        case 8: mbp->param[7] = ISP_READ(isp, OUTMAILBOX7);
        case 7: mbp->param[6] = ISP_READ(isp, OUTMAILBOX6);
@@ -4018,13 +4079,10 @@
 /*
  * NVRAM Routines
  */
-
 static int
 isp_read_nvram(isp)
        struct ispsoftc *isp;
 {
-       static char *tru = "true";
-       static char *not = "false";
        int i, amt;
        u_int8_t csum, minversion;
        union {
@@ -4077,349 +4135,23 @@
                return (-1);
        }
 
-       if (IS_ULTRA2(isp)) {
-               int bus;
-               sdparam *sdp = (sdparam *) isp->isp_param;
-               for (bus = 0; bus < (IS_DUALBUS(isp)? 2 : 1); bus++, sdp++) {
-                       sdp->isp_fifo_threshold = 
-                           ISP1080_NVRAM_FIFO_THRESHOLD(nvram_data);
-
-                       sdp->isp_initiator_id =
-                           ISP1080_NVRAM_INITIATOR_ID(nvram_data, bus);
-
-                       sdp->isp_bus_reset_delay =
-                           ISP1080_NVRAM_BUS_RESET_DELAY(nvram_data, bus);
-
-                       sdp->isp_retry_count =
-                           ISP1080_NVRAM_BUS_RETRY_COUNT(nvram_data, bus);
-
-                       sdp->isp_retry_delay =
-                           ISP1080_NVRAM_BUS_RETRY_DELAY(nvram_data, bus);
-
-                       sdp->isp_async_data_setup =
-                           ISP1080_NVRAM_ASYNC_DATA_SETUP_TIME(nvram_data,
-                           bus);
-
-                       sdp->isp_req_ack_active_neg =
-                           ISP1080_NVRAM_REQ_ACK_ACTIVE_NEGATION(nvram_data,
-                           bus);
-
-                       sdp->isp_data_line_active_neg =
-                           ISP1080_NVRAM_DATA_LINE_ACTIVE_NEGATION(nvram_data,
-                           bus);
-
-                       sdp->isp_data_dma_burst_enabl =
-                           ISP1080_NVRAM_BURST_ENABLE(nvram_data);
-
-                       sdp->isp_cmd_dma_burst_enable =
-                           ISP1080_NVRAM_BURST_ENABLE(nvram_data);
-
-                       sdp->isp_selection_timeout =
-                           ISP1080_NVRAM_SELECTION_TIMEOUT(nvram_data, bus);
-
-                       sdp->isp_max_queue_depth =
-                            ISP1080_NVRAM_MAX_QUEUE_DEPTH(nvram_data, bus);
-
-                       if (isp->isp_dblev >= 3) {
-                               PRINTF("%s: ISP1080 bus %d NVRAM values:\n",
-                                   isp->isp_name, bus);
-                               PRINTF("               Initiator ID = %d\n",
-                                   sdp->isp_initiator_id);
-                               PRINTF("             Fifo Threshold = 0x%x\n",
-                                   sdp->isp_fifo_threshold);
-                               PRINTF("            Bus Reset Delay = %d\n",
-                                   sdp->isp_bus_reset_delay);
-                               PRINTF("                Retry Count = %d\n",
-                                   sdp->isp_retry_count);
-                               PRINTF("                Retry Delay = %d\n",
-                                   sdp->isp_retry_delay);
-                               PRINTF("              Tag Age Limit = %d\n",
-                                   sdp->isp_tag_aging);
-                               PRINTF("          Selection Timeout = %d\n",
-                                   sdp->isp_selection_timeout);
-                               PRINTF("            Max Queue Depth = %d\n",
-                                   sdp->isp_max_queue_depth);
-                               PRINTF("           Async Data Setup = 0x%x\n",
-                                   sdp->isp_async_data_setup);
-                               PRINTF("    REQ/ACK Active Negation = %s\n",
-                                   sdp->isp_req_ack_active_neg? tru : not);
-                               PRINTF("  Data Line Active Negation = %s\n",
-                                   sdp->isp_data_line_active_neg? tru : not);
-                               PRINTF("       Cmd DMA Burst Enable = %s\n",
-                                   sdp->isp_cmd_dma_burst_enable? tru : not);
-                       }
-                       for (i = 0; i < MAX_TARGETS; i++) {
-                               sdp->isp_devparam[i].dev_enable =
-                                   ISP1080_NVRAM_TGT_DEVICE_ENABLE(nvram_data, i, bus);
-                               sdp->isp_devparam[i].exc_throttle =
-                                       ISP1080_NVRAM_TGT_EXEC_THROTTLE(nvram_data, i, bus);
-                               sdp->isp_devparam[i].sync_offset =
-                                       ISP1080_NVRAM_TGT_SYNC_OFFSET(nvram_data, i, bus);
-                               sdp->isp_devparam[i].sync_period =
-                                       ISP1080_NVRAM_TGT_SYNC_PERIOD(nvram_data, i, bus);
-                               sdp->isp_devparam[i].dev_flags = 0;
-                               if (ISP1080_NVRAM_TGT_RENEG(nvram_data, i, bus))
-                                       sdp->isp_devparam[i].dev_flags |= DPARM_RENEG;
-                               if (ISP1080_NVRAM_TGT_QFRZ(nvram_data, i, bus)) {
-                                       PRINTF("%s: not supporting QFRZ option "
-                                           "for target %d bus %d\n",



Home | Main Index | Thread Index | Old Index