Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/dev/pci Pull up revisions 1.31-1.41, 1.43-1.49 (via ...



details:   https://anonhg.NetBSD.org/src/rev/57e03f78b5fd
branches:  netbsd-1-4
changeset: 470018:57e03f78b5fd
user:      he <he%NetBSD.org@localhost>
date:      Sat Jan 08 22:44:22 2000 +0000

description:
Pull up revisions 1.31-1.41,1.43-1.49 (via patch, requested by mjacob):
  Untangle Qlogic firmware copyright problems and update firmware.
  Untangle some MD support issues for said firmware. Add 1280 (Dual
  LVD), 1240 (Dual Ultra), 2200 (2nd Generation Qlogic FC chipset).
  Fix some synchronous negotiation problems for parallel SCSI.
  Firm up some Fabric Support issues.

diffstat:

 sys/dev/pci/isp_pci.c |  385 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 274 insertions(+), 111 deletions(-)

diffs (truncated from 728 to 300 lines):

diff -r c835421da5f0 -r 57e03f78b5fd sys/dev/pci/isp_pci.c
--- a/sys/dev/pci/isp_pci.c     Sat Jan 08 22:43:46 2000 +0000
+++ b/sys/dev/pci/isp_pci.c     Sat Jan 08 22:44:22 2000 +0000
@@ -1,38 +1,33 @@
-/* $NetBSD: isp_pci.c,v 1.38 1999/03/27 01:08:59 mjacob Exp $ */
-/* release_03_25_99 */
+/* $NetBSD: isp_pci.c,v 1.38.2.1 2000/01/08 22:44:22 he Exp $ */
 /*
  * PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
- *
- *---------------------------------------
- * Copyright (c) 1997, 1998 by Matthew Jacob
- * NASA/Ames Research Center
+ * Matthew Jacob (mjacob%nas.nasa.gov@localhost)
+ */
+/*
+ * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
  * All rights reserved.
- *---------------------------------------
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice immediately at the beginning of the file, without modification,
- *    this list of conditions, and the following disclaimer.
+ *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
+ *    derived from this software without specific prior written permission
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include <dev/ic/isp_netbsd.h>
@@ -50,13 +45,29 @@
 #endif
 static int isp_pci_mbxdma __P((struct ispsoftc *));
 static int isp_pci_dmasetup __P((struct ispsoftc *, struct scsipi_xfer *,
-       ispreq_t *, u_int8_t *, u_int8_t));
+       ispreq_t *, u_int16_t *, u_int16_t));
 static void isp_pci_dmateardown __P((struct ispsoftc *, struct scsipi_xfer *,
        u_int32_t));
 static void isp_pci_reset1 __P((struct ispsoftc *));
 static void isp_pci_dumpregs __P((struct ispsoftc *));
 static int isp_pci_intr __P((void *));
 
+#ifndef        ISP_CODE_ORG
+#define        ISP_CODE_ORG            0x1000
+#endif
+#ifndef        ISP_1040_RISC_CODE
+#define        ISP_1040_RISC_CODE      NULL
+#endif
+#ifndef        ISP_1080_RISC_CODE
+#define        ISP_1080_RISC_CODE      NULL
+#endif
+#ifndef        ISP_2100_RISC_CODE
+#define        ISP_2100_RISC_CODE      NULL
+#endif
+#ifndef        ISP_2200_RISC_CODE
+#define        ISP_2200_RISC_CODE      NULL
+#endif
+
 #ifndef        ISP_DISABLE_1020_SUPPORT
 static struct ispmdvec mdvec = {
        isp_pci_rd_reg,
@@ -67,10 +78,10 @@
        NULL,
        isp_pci_reset1,
        isp_pci_dumpregs,
-       ISP_RISC_CODE,
-       ISP_CODE_LENGTH,
+       ISP_1040_RISC_CODE,
+       0,
        ISP_CODE_ORG,
-       ISP_CODE_VERSION,
+       0,
        BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64,
        0
 };
@@ -86,10 +97,10 @@
        NULL,
        isp_pci_reset1,
        isp_pci_dumpregs,
-       ISP1080_RISC_CODE,
-       ISP1080_CODE_LENGTH,
-       ISP1080_CODE_ORG,
-       ISP1080_CODE_VERSION,
+       ISP_1080_RISC_CODE,
+       0,
+       ISP_CODE_ORG,
+       0,
        BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64,
        0
 };
@@ -105,11 +116,30 @@
        NULL,
        isp_pci_reset1,
        isp_pci_dumpregs,
-       ISP2100_RISC_CODE,
-       ISP2100_CODE_LENGTH,
-       ISP2100_CODE_ORG,
-       ISP2100_CODE_VERSION,
-       0,                              /* Irrelevant to the 2100 */
+       ISP_2100_RISC_CODE,
+       0,
+       ISP_CODE_ORG,
+       0,
+       0,
+       0
+};
+#endif
+
+#ifndef        ISP_DISABLE_2200_SUPPORT
+static struct ispmdvec mdvec_2200 = {
+       isp_pci_rd_reg,
+       isp_pci_wr_reg,
+       isp_pci_mbxdma,
+       isp_pci_dmasetup,
+       isp_pci_dmateardown,
+       NULL,
+       isp_pci_reset1,
+       isp_pci_dumpregs,
+       ISP_2200_RISC_CODE,
+       0,
+       ISP_CODE_ORG,
+       0,
+       0,
        0
 };
 #endif
@@ -130,10 +160,18 @@
 #define        PCI_PRODUCT_QLOGIC_ISP1240      0x1240
 #endif
 
+#ifndef        PCI_PRODUCT_QLOGIC_ISP1280
+#define        PCI_PRODUCT_QLOGIC_ISP1280      0x1280
+#endif
+
 #ifndef        PCI_PRODUCT_QLOGIC_ISP2100
 #define        PCI_PRODUCT_QLOGIC_ISP2100      0x2100
 #endif
 
+#ifndef        PCI_PRODUCT_QLOGIC_ISP2200
+#define        PCI_PRODUCT_QLOGIC_ISP2200      0x2200
+#endif
+
 #define        PCI_QLOGIC_ISP  ((PCI_PRODUCT_QLOGIC_ISP1020 << 16) | PCI_VENDOR_QLOGIC)
 
 #define        PCI_QLOGIC_ISP1080      \
@@ -142,11 +180,21 @@
 #define        PCI_QLOGIC_ISP1240      \
        ((PCI_PRODUCT_QLOGIC_ISP1240 << 16) | PCI_VENDOR_QLOGIC)
 
+#define        PCI_QLOGIC_ISP1280      \
+       ((PCI_PRODUCT_QLOGIC_ISP1280 << 16) | PCI_VENDOR_QLOGIC)
+
 #define        PCI_QLOGIC_ISP2100      \
        ((PCI_PRODUCT_QLOGIC_ISP2100 << 16) | PCI_VENDOR_QLOGIC)
 
-#define IO_MAP_REG     0x10
-#define MEM_MAP_REG    0x14
+#define        PCI_QLOGIC_ISP2200      \
+       ((PCI_PRODUCT_QLOGIC_ISP2200 << 16) | PCI_VENDOR_QLOGIC)
+
+#define        IO_MAP_REG      0x10
+#define        MEM_MAP_REG     0x14
+#define        PCIR_ROMADDR    0x30
+
+#define        PCI_DFLT_LTNCY  0x40
+#define        PCI_DFLT_LNSZ   0x10
 
 
 static int isp_pci_probe __P((struct device *, struct cfdata *, void *));
@@ -162,7 +210,7 @@
        bus_dmamap_t            pci_scratch_dmap;       /* for fcp only */
        bus_dmamap_t            pci_rquest_dmap;
        bus_dmamap_t            pci_result_dmap;
-       bus_dmamap_t            pci_xfer_dmap[MAXISPREQUEST];
+       bus_dmamap_t            *pci_xfer_dmap;
        void *                  pci_ih;
        int16_t                 pci_poff[_NREG_BLKS];
 };
@@ -173,42 +221,46 @@
 
 static int
 isp_pci_probe(parent, match, aux)
-        struct device *parent;
-        struct cfdata *match;
-       void *aux; 
-{       
-        struct pci_attach_args *pa = aux;
-        switch (pa->pa_id) {
+       struct device *parent;
+       struct cfdata *match;
+       void *aux;
+{
+       struct pci_attach_args *pa = aux;
+       switch (pa->pa_id) {
 #ifndef        ISP_DISABLE_1020_SUPPORT
        case PCI_QLOGIC_ISP:
                return (1);
 #endif
 #ifndef        ISP_DISABLE_1080_SUPPORT
        case PCI_QLOGIC_ISP1080:
-#if    0
-       case PCI_QLOGIC_ISP1240:        /* 1240 not ready yet */
+       case PCI_QLOGIC_ISP1240:
+       case PCI_QLOGIC_ISP1280:
                return (1);
 #endif
-#endif
 #ifndef        ISP_DISABLE_2100_SUPPORT
        case PCI_QLOGIC_ISP2100:
                return (1);
 #endif
+#ifndef        ISP_DISABLE_2200_SUPPORT
+       case PCI_QLOGIC_ISP2200:
+               return (1);
+#endif
        default:
                return (0);
        }
 }
 
 
-static void    
+static void
 isp_pci_attach(parent, self, aux)
-        struct device *parent, *self;
-        void *aux;
+       struct device *parent, *self;
+       void *aux;
 {
 #ifdef DEBUG
        static char oneshot = 1;
 #endif
-       u_int32_t data;
+       static char *nomem = "%s: no mem for sdparam table\n";
+       u_int32_t data, rev, linesz = PCI_DFLT_LNSZ;
        struct pci_attach_args *pa = aux;
        struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) self;
        struct ispsoftc *isp = &pcs->pci_isp;
@@ -248,6 +300,7 @@
        pcs->pci_poff[SXP_BLOCK >> _BLK_REG_SHFT] = PCI_SXP_REGS_OFF;
        pcs->pci_poff[RISC_BLOCK >> _BLK_REG_SHFT] = PCI_RISC_REGS_OFF;
        pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = DMA_REGS_OFF;
+       rev = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_CLASS_REG) & 0xff;
 
 #ifndef        ISP_DISABLE_1020_SUPPORT
        if (pa->pa_id == PCI_QLOGIC_ISP) {
@@ -255,8 +308,7 @@
                isp->isp_type = ISP_HA_SCSI_UNKNOWN;
                isp->isp_param = malloc(sizeof (sdparam), M_DEVBUF, M_NOWAIT);
                if (isp->isp_param == NULL) {
-                       printf("%s: couldn't allocate sdparam table\n",
-                              isp->isp_name);
+                       printf(nomem, isp->isp_name);
                        return;
                }
                bzero(isp->isp_param, sizeof (sdparam));
@@ -268,14 +320,39 @@
                isp->isp_type = ISP_HA_SCSI_1080;
                isp->isp_param = malloc(sizeof (sdparam), M_DEVBUF, M_NOWAIT);
                if (isp->isp_param == NULL) {
-                       printf("%s: couldn't allocate sdparam table\n",
-                              isp->isp_name);
+                       printf(nomem, isp->isp_name);
                        return;
                }
                bzero(isp->isp_param, sizeof (sdparam));
                pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] =
                    ISP1080_DMA_REGS_OFF;
        }
+       if (pa->pa_id == PCI_QLOGIC_ISP1240) {
+               isp->isp_mdvec = &mdvec_1080;



Home | Main Index | Thread Index | Old Index