Author: mav
Date: Mon Nov 30 21:56:31 2015
New Revision: 291529
URL: https://svnweb.freebsd.org/changeset/base/291529

Log:
  MFC r291209: Fix target mode support for Qlogic 2200 FC adapters.
  
  Now target mode works for all supported FC adapters except ancient 2100,
  which is not tested.

Modified:
  stable/10/share/man/man4/isp.4
  stable/10/sys/dev/isp/isp.c
  stable/10/sys/dev/isp/isp_freebsd.c
  stable/10/sys/dev/isp/isp_library.c
  stable/10/sys/dev/isp/isp_pci.c
  stable/10/sys/dev/isp/ispmbox.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/isp.4
==============================================================================
--- stable/10/share/man/man4/isp.4      Mon Nov 30 21:55:35 2015        
(r291528)
+++ stable/10/share/man/man4/isp.4      Mon Nov 30 21:56:31 2015        
(r291529)
@@ -1,7 +1,6 @@
-.\"     $NetBSD: isp.4,v 1.5 1999/12/18 18:33:05 mjacob Exp $
-.\"
-.\" Copyright (c) 1998, 1999, 2001
-.\"     Matthew Jacob, for NASA/Ames Research Center
+.\" Copyright (c) 2009-2015 Alexander Motin <m...@freebsd.org>
+.\" Copyright (c) 2006 Marcus Alves Grando
+.\" Copyright (c) 1998-2001 Matthew Jacob, for NASA/Ames Research Center
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -25,8 +24,6 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" Additional Copyright (c) 2006 by Marcus Alves Grando
-.\"
 .\" $FreeBSD$
 .\"
 .Dd November 22, 2015
@@ -34,7 +31,7 @@
 .Os
 .Sh NAME
 .Nm isp
-.Nd Qlogic based SCSI and FibreChannel SCSI Host Adapters
+.Nd Qlogic based SPI and FibreChannel SCSI Host Adapters
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -52,23 +49,19 @@ isp_load="YES"
 .Ed
 .Sh DESCRIPTION
 This driver provides access to
-.Tn SCSI
+.Tn SPI
 or
 .Tn FibreChannel
-devices.
+SCSI devices.
 .Pp
-SCSI features include support for Ultra SCSI and wide mode transactions
-for
+SPI supports initiator mode for Ultra SCSI and wide mode transactions for
 .Tn SCSI ,
 Ultra2 LVD (1080, 1280), and Ultra3 LVD (10160, 12160).
 .Pp
-Fibre Channel support uses FCP SCSI profile for
-.Tn FibreChannel ,
-and utilizes Class 3 and Class 2 (2200 and later) connections.
+Fibre Channel supports initiator and target modes of FCP SCSI profile,
+utilizing Class 3 and Class 2 (2200 and later) connections.
 Support is available for Public and Private loops, Point-to-Point
 and Fabric connections.
-The newer 2-Gigabit cards (2300, 2312, 2322), 4-Gigabit (2422, 2432)
-and 8-Gigabit (2532) are supported in both initiator and target modes.
 .Sh FIRMWARE
 Firmware loading is supported if the
 .Xr ispfw 4
@@ -120,8 +113,7 @@ Optical 4Gb Fibre Channel PCIe cards.
 Optical 8Gb Fibre Channel PCIe cards.
 .El
 .Sh CONFIGURATION OPTIONS
-Target mode support for 23xx and above Fibre Channel adapters may be
-enabled with the
+Target mode support for Fibre Channel adapters may be enabled with the
 .Pp
 .Cd options ISP_TARGET_MODE
 .Pp

Modified: stable/10/sys/dev/isp/isp.c
==============================================================================
--- stable/10/sys/dev/isp/isp.c Mon Nov 30 21:55:35 2015        (r291528)
+++ stable/10/sys/dev/isp/isp.c Mon Nov 30 21:56:31 2015        (r291529)
@@ -1733,7 +1733,12 @@ isp_fibre_init(ispsoftc_t *isp)
                icbp->icb_fwoptions &= ~ICBOPT_TGT_ENABLE;
        }
 
-       if (fcp->role & ISP_ROLE_INITIATOR) {
+       /*
+        * For some reason my 2200 does not generate ATIOs in target mode
+        * if initiator is disabled.  Extra logins are better then target
+        * not working at all.
+        */
+       if ((fcp->role & ISP_ROLE_INITIATOR) || IS_2100(isp) || IS_2200(isp)) {
                icbp->icb_fwoptions &= ~ICBOPT_INI_DISABLE;
        } else {
                icbp->icb_fwoptions |= ICBOPT_INI_DISABLE;
@@ -1954,6 +1959,8 @@ isp_fibre_init(ispsoftc_t *isp)
        }
        isp_prt(isp, ISP_LOGDEBUG0, "isp_fibre_init: fwopt 0x%x xfwopt 0x%x 
zfwopt 0x%x",
            icbp->icb_fwoptions, icbp->icb_xfwoptions, icbp->icb_zfwoptions);
+       if (isp->isp_dblev & ISP_LOGDEBUG1)
+               isp_print_bytes(isp, "isp_fibre_init", sizeof (*icbp), icbp);
 
        isp_put_icb(isp, icbp, (isp_icb_t *)fcp->isp_scratch);
 
@@ -1966,17 +1973,14 @@ isp_fibre_init(ispsoftc_t *isp)
        mbs.param[3] = DMA_WD0(fcp->isp_scdma);
        mbs.param[6] = DMA_WD3(fcp->isp_scdma);
        mbs.param[7] = DMA_WD2(fcp->isp_scdma);
-       mbs.logval = MBLOGALL;
        isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %p (%08x%08x)",
            fcp->isp_scratch, (uint32_t) ((uint64_t)fcp->isp_scdma >> 32),
            (uint32_t) fcp->isp_scdma);
        MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp), 0);
        isp_mboxcmd(isp, &mbs);
        FC_SCRATCH_RELEASE(isp, 0);
-       if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
-               isp_print_bytes(isp, "isp_fibre_init", sizeof (*icbp), icbp);
+       if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
                return;
-       }
        isp->isp_reqidx = 0;
        isp->isp_reqodx = 0;
        isp->isp_residx = 0;

Modified: stable/10/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/10/sys/dev/isp/isp_freebsd.c Mon Nov 30 21:55:35 2015        
(r291528)
+++ stable/10/sys/dev/isp/isp_freebsd.c Mon Nov 30 21:56:31 2015        
(r291529)
@@ -4947,7 +4947,7 @@ isp_fcp_next_crn(ispsoftc_t *isp, uint8_
        struct isp_nexus *nxp;
        int idx;
 
-       if (isp->isp_type < ISP_HA_FC_2300)
+       if (IS_2100(isp))
                return (0);
 
        chan = XS_CHANNEL(cmd);

Modified: stable/10/sys/dev/isp/isp_library.c
==============================================================================
--- stable/10/sys/dev/isp/isp_library.c Mon Nov 30 21:55:35 2015        
(r291528)
+++ stable/10/sys/dev/isp/isp_library.c Mon Nov 30 21:56:31 2015        
(r291529)
@@ -963,7 +963,8 @@ isp_put_request_t2(ispsoftc_t *isp, ispr
        ISP_IOXPUT_8(isp, src->req_target, &dst->req_target);
        ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
        ISP_IOXPUT_16(isp, src->req_flags,  &dst->req_flags);
-       ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved);
+       ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
+       ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
        ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
        ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
        for (i = 0; i < ASIZE(src->req_cdb); i++) {
@@ -985,7 +986,8 @@ isp_put_request_t2e(ispsoftc_t *isp, isp
        ISP_IOXPUT_16(isp, src->req_target, &dst->req_target);
        ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
        ISP_IOXPUT_16(isp, src->req_flags,  &dst->req_flags);
-       ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved);
+       ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
+       ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
        ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
        ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
        for (i = 0; i < ASIZE(src->req_cdb); i++) {

Modified: stable/10/sys/dev/isp/isp_pci.c
==============================================================================
--- stable/10/sys/dev/isp/isp_pci.c     Mon Nov 30 21:55:35 2015        
(r291528)
+++ stable/10/sys/dev/isp/isp_pci.c     Mon Nov 30 21:56:31 2015        
(r291529)
@@ -1488,7 +1488,7 @@ imc(void *arg, bus_dma_segment_t *segs, 
        segs->ds_addr += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp));
        imushp->vbase += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp));
 
-       if (imushp->isp->isp_type >= ISP_HA_FC_2300) {
+       if (imushp->isp->isp_type >= ISP_HA_FC_2200) {
         imushp->isp->isp_osinfo.ecmd_dma = segs->ds_addr;
         imushp->isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)imushp->vbase;
         imushp->isp->isp_osinfo.ecmd_base = imushp->isp->isp_osinfo.ecmd_free;
@@ -1627,7 +1627,7 @@ isp_pci_mbxdma(ispsoftc_t *isp)
                len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
        }
 #endif
-       if (isp->isp_type >= ISP_HA_FC_2300) {
+       if (isp->isp_type >= ISP_HA_FC_2200) {
                len += (N_XCMDS * XCMD_SIZE);
        }
 
@@ -1689,7 +1689,7 @@ isp_pci_mbxdma(ispsoftc_t *isp)
                                bus_dma_tag_destroy(fc->tdmat);
                                goto bad;
                        }
-                       if (isp->isp_type >= ISP_HA_FC_2300) {
+                       if (!IS_2100(isp)) {
                                for (i = 0; i < INITIAL_NEXUS_COUNT; i++) {
                                        struct isp_nexus *n = malloc(sizeof 
(struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO);
                                        if (n == NULL) {

Modified: stable/10/sys/dev/isp/ispmbox.h
==============================================================================
--- stable/10/sys/dev/isp/ispmbox.h     Mon Nov 30 21:55:35 2015        
(r291528)
+++ stable/10/sys/dev/isp/ispmbox.h     Mon Nov 30 21:56:31 2015        
(r291529)
@@ -481,7 +481,8 @@ typedef struct {
        uint16_t        req_target;
        uint16_t        req_scclun;
        uint16_t        req_flags;
-       uint16_t        req_reserved;
+       uint8_t         req_crn;
+       uint8_t         req_reserved;
        uint16_t        req_time;
        uint16_t        req_seg_count;
        uint8_t         req_cdb[16];
@@ -1010,6 +1011,7 @@ typedef struct {
 #define        ICBZOPT_RATE_AUTO       0x8000
 #define        ICBZOPT_RATE_TWOGB      0x4000
 #define        ICBZOPT_50_OHM          0x2000
+#define        ICBZOPT_NO_LOCAL_PLOGI  0x0080
 #define        ICBZOPT_ENA_OOF         0x0040  /* out of order frame handling 
*/
 #define        ICBZOPT_RSPSZ_MASK      0x0030
 #define        ICBZOPT_RSPSZ_24        0x0000
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to