1999-07-05 22:04:08 +00:00
|
|
|
/* $Id: isp_pci.c,v 1.26 1999/07/05 22:01:48 mjacob Exp $ */
|
1999-07-05 20:24:46 +00:00
|
|
|
/* release_6_5_99 */
|
1998-04-22 18:12:29 +00:00
|
|
|
/*
|
|
|
|
* PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
|
|
|
|
* FreeBSD Version.
|
|
|
|
*
|
|
|
|
*---------------------------------------
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
* Copyright (c) 1997, 1998, 1999 by Matthew Jacob
|
1998-04-22 18:12:29 +00:00
|
|
|
* NASA/Ames Research Center
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
#include <dev/isp/isp_freebsd.h>
|
|
|
|
#include <dev/isp/asm_pci.h>
|
1998-09-15 10:06:23 +00:00
|
|
|
#include <sys/malloc.h>
|
1999-03-17 05:07:18 +00:00
|
|
|
#include <vm/vm.h>
|
1998-09-15 10:06:23 +00:00
|
|
|
#include <vm/pmap.h>
|
|
|
|
#include <vm/vm_extern.h>
|
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
|
|
|
|
#include <pci/pcireg.h>
|
|
|
|
#include <pci/pcivar.h>
|
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
#include <machine/bus_memio.h>
|
|
|
|
#include <machine/bus_pio.h>
|
|
|
|
#include <machine/bus.h>
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
#include <machine/md_var.h>
|
1998-09-15 10:06:23 +00:00
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
static u_int16_t isp_pci_rd_reg __P((struct ispsoftc *, int));
|
|
|
|
static void isp_pci_wr_reg __P((struct ispsoftc *, int, u_int16_t));
|
1999-03-17 05:07:18 +00:00
|
|
|
#ifndef ISP_DISABLE_1080_SUPPORT
|
|
|
|
static u_int16_t isp_pci_rd_reg_1080 __P((struct ispsoftc *, int));
|
|
|
|
static void isp_pci_wr_reg_1080 __P((struct ispsoftc *, int, u_int16_t));
|
|
|
|
#endif
|
1998-04-22 18:12:29 +00:00
|
|
|
static int isp_pci_mbxdma __P((struct ispsoftc *));
|
|
|
|
static int isp_pci_dmasetup __P((struct ispsoftc *, ISP_SCSI_XFER_T *,
|
|
|
|
ispreq_t *, u_int8_t *, u_int8_t));
|
1998-09-15 10:06:23 +00:00
|
|
|
static void
|
|
|
|
isp_pci_dmateardown __P((struct ispsoftc *, ISP_SCSI_XFER_T *, u_int32_t));
|
1998-04-22 18:12:29 +00:00
|
|
|
|
|
|
|
static void isp_pci_reset1 __P((struct ispsoftc *));
|
|
|
|
static void isp_pci_dumpregs __P((struct ispsoftc *));
|
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
#ifndef ISP_DISABLE_1020_SUPPORT
|
1998-04-22 18:12:29 +00:00
|
|
|
static struct ispmdvec mdvec = {
|
|
|
|
isp_pci_rd_reg,
|
|
|
|
isp_pci_wr_reg,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
1998-09-15 10:06:23 +00:00
|
|
|
isp_pci_dmateardown,
|
1998-04-22 18:12:29 +00:00
|
|
|
NULL,
|
|
|
|
isp_pci_reset1,
|
|
|
|
isp_pci_dumpregs,
|
|
|
|
ISP_RISC_CODE,
|
|
|
|
ISP_CODE_LENGTH,
|
|
|
|
ISP_CODE_ORG,
|
|
|
|
ISP_CODE_VERSION,
|
1999-01-10 02:45:51 +00:00
|
|
|
BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64,
|
1998-09-15 10:06:23 +00:00
|
|
|
0
|
1998-04-22 18:12:29 +00:00
|
|
|
};
|
1999-03-17 05:07:18 +00:00
|
|
|
#endif
|
1998-04-22 18:12:29 +00:00
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
#ifndef ISP_DISABLE_1080_SUPPORT
|
|
|
|
static struct ispmdvec mdvec_1080 = {
|
|
|
|
isp_pci_rd_reg_1080,
|
|
|
|
isp_pci_wr_reg_1080,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
|
|
|
isp_pci_dmateardown,
|
|
|
|
NULL,
|
|
|
|
isp_pci_reset1,
|
|
|
|
isp_pci_dumpregs,
|
1999-03-25 22:53:56 +00:00
|
|
|
ISP1080_RISC_CODE,
|
|
|
|
ISP1080_CODE_LENGTH,
|
|
|
|
ISP1080_CODE_ORG,
|
|
|
|
ISP1080_CODE_VERSION,
|
1999-03-17 05:07:18 +00:00
|
|
|
BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef ISP_DISABLE_2100_SUPPORT
|
1998-04-22 18:12:29 +00:00
|
|
|
static struct ispmdvec mdvec_2100 = {
|
|
|
|
isp_pci_rd_reg,
|
|
|
|
isp_pci_wr_reg,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
1998-09-15 10:06:23 +00:00
|
|
|
isp_pci_dmateardown,
|
1998-04-22 18:12:29 +00:00
|
|
|
NULL,
|
|
|
|
isp_pci_reset1,
|
|
|
|
isp_pci_dumpregs,
|
|
|
|
ISP2100_RISC_CODE,
|
|
|
|
ISP2100_CODE_LENGTH,
|
|
|
|
ISP2100_CODE_ORG,
|
|
|
|
ISP2100_CODE_VERSION,
|
1999-01-10 02:45:51 +00:00
|
|
|
0, /* Irrelevant to the 2100 */
|
1998-09-15 10:06:23 +00:00
|
|
|
0
|
1998-04-22 18:12:29 +00:00
|
|
|
};
|
1999-07-05 20:24:46 +00:00
|
|
|
#endif
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
|
1999-07-05 22:01:48 +00:00
|
|
|
#ifndef ISP_DISABLE_2200_SUPPORT
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
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,
|
1999-07-05 20:24:46 +00:00
|
|
|
ISP2200_RISC_CODE,
|
|
|
|
ISP2200_CODE_LENGTH,
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
ISP2100_CODE_ORG,
|
1999-07-05 22:04:08 +00:00
|
|
|
ISP2200_CODE_VERSION,
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
0,
|
|
|
|
0
|
|
|
|
};
|
1999-03-17 05:07:18 +00:00
|
|
|
#endif
|
1998-04-22 18:12:29 +00:00
|
|
|
|
1999-02-09 01:12:52 +00:00
|
|
|
#ifndef SCSI_ISP_PREFER_MEM_MAP
|
|
|
|
#ifdef __alpha__
|
|
|
|
#define SCSI_ISP_PREFER_MEM_MAP 0
|
|
|
|
#else
|
|
|
|
#define SCSI_ISP_PREFER_MEM_MAP 1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
#ifndef PCIM_CMD_INVEN
|
1998-09-15 10:06:23 +00:00
|
|
|
#define PCIM_CMD_INVEN 0x10
|
1998-04-22 18:12:29 +00:00
|
|
|
#endif
|
|
|
|
#ifndef PCIM_CMD_BUSMASTEREN
|
1998-09-15 10:06:23 +00:00
|
|
|
#define PCIM_CMD_BUSMASTEREN 0x0004
|
1998-04-22 18:12:29 +00:00
|
|
|
#endif
|
1999-02-09 01:12:52 +00:00
|
|
|
#ifndef PCIM_CMD_PERRESPEN
|
|
|
|
#define PCIM_CMD_PERRESPEN 0x0040
|
|
|
|
#endif
|
|
|
|
#ifndef PCIM_CMD_SEREN
|
|
|
|
#define PCIM_CMD_SEREN 0x0100
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PCIR_COMMAND
|
|
|
|
#define PCIR_COMMAND 0x04
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PCIR_CACHELNSZ
|
|
|
|
#define PCIR_CACHELNSZ 0x0c
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PCIR_LATTIMER
|
|
|
|
#define PCIR_LATTIMER 0x0d
|
|
|
|
#endif
|
|
|
|
|
1999-04-04 01:14:02 +00:00
|
|
|
#ifndef PCIR_ROMADDR
|
|
|
|
#define PCIR_ROMADDR 0x30
|
|
|
|
#endif
|
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
#ifndef PCI_VENDOR_QLOGIC
|
1999-03-17 05:07:18 +00:00
|
|
|
#define PCI_VENDOR_QLOGIC 0x1077
|
1998-04-22 18:12:29 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP1020
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP1020 0x1020
|
|
|
|
#endif
|
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP1080
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP1080 0x1080
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP1240
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP1240 0x1240
|
|
|
|
#endif
|
1998-04-22 18:12:29 +00:00
|
|
|
|
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP2100
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP2100 0x2100
|
|
|
|
#endif
|
|
|
|
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP2200
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP2200 0x2200
|
|
|
|
#endif
|
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
#define PCI_QLOGIC_ISP ((PCI_PRODUCT_QLOGIC_ISP1020 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
|
|
|
#define PCI_QLOGIC_ISP1080 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP1080 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
|
|
|
#define PCI_QLOGIC_ISP1240 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP1240 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
#define PCI_QLOGIC_ISP2100 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP2100 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
#define PCI_QLOGIC_ISP2200 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP2200 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
#define IO_MAP_REG 0x10
|
|
|
|
#define MEM_MAP_REG 0x14
|
1998-04-22 18:12:29 +00:00
|
|
|
|
1999-02-09 01:12:52 +00:00
|
|
|
#define PCI_DFLT_LTNCY 0x40
|
|
|
|
#define PCI_DFLT_LNSZ 0x10
|
1998-04-22 18:12:29 +00:00
|
|
|
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
static const char *isp_pci_probe __P((pcici_t tag, pcidi_t type));
|
1998-04-22 18:12:29 +00:00
|
|
|
static void isp_pci_attach __P((pcici_t config_d, int unit));
|
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
/* This distinguishing define is not right, but it does work */
|
1998-09-16 16:43:17 +00:00
|
|
|
#ifdef __alpha__
|
|
|
|
#define IO_SPACE_MAPPING ALPHA_BUS_SPACE_IO
|
|
|
|
#define MEM_SPACE_MAPPING ALPHA_BUS_SPACE_MEM
|
|
|
|
#else
|
|
|
|
#define IO_SPACE_MAPPING I386_BUS_SPACE_IO
|
|
|
|
#define MEM_SPACE_MAPPING I386_BUS_SPACE_MEM
|
|
|
|
#endif
|
1998-04-22 18:12:29 +00:00
|
|
|
|
|
|
|
struct isp_pcisoftc {
|
1998-09-15 10:06:23 +00:00
|
|
|
struct ispsoftc pci_isp;
|
|
|
|
pcici_t pci_id;
|
|
|
|
bus_space_tag_t pci_st;
|
|
|
|
bus_space_handle_t pci_sh;
|
1999-03-17 05:07:18 +00:00
|
|
|
int16_t pci_poff[_NREG_BLKS];
|
1998-09-15 10:06:23 +00:00
|
|
|
bus_dma_tag_t parent_dmat;
|
|
|
|
bus_dma_tag_t cntrol_dmat;
|
|
|
|
bus_dmamap_t cntrol_dmap;
|
|
|
|
bus_dmamap_t dmaps[MAXISPREQUEST];
|
1998-04-22 18:12:29 +00:00
|
|
|
};
|
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
static u_long ispunit;
|
1998-04-22 18:12:29 +00:00
|
|
|
|
1999-04-11 02:50:42 +00:00
|
|
|
static struct pci_device isp_pci_driver = {
|
1998-04-22 18:12:29 +00:00
|
|
|
"isp",
|
|
|
|
isp_pci_probe,
|
|
|
|
isp_pci_attach,
|
1998-09-15 10:06:23 +00:00
|
|
|
&ispunit,
|
1998-04-22 18:12:29 +00:00
|
|
|
NULL
|
|
|
|
};
|
1999-04-24 20:17:05 +00:00
|
|
|
COMPAT_PCI_DRIVER (isp_pci, isp_pci_driver);
|
1998-04-22 18:12:29 +00:00
|
|
|
|
|
|
|
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
static const char *
|
1998-12-28 19:24:23 +00:00
|
|
|
isp_pci_probe(pcici_t tag, pcidi_t type)
|
1999-03-17 05:07:18 +00:00
|
|
|
{
|
1998-04-22 18:12:29 +00:00
|
|
|
static int oneshot = 1;
|
|
|
|
char *x;
|
|
|
|
|
|
|
|
switch (type) {
|
1999-03-17 05:07:18 +00:00
|
|
|
#ifndef ISP_DISABLE_1020_SUPPORT
|
1998-04-22 18:12:29 +00:00
|
|
|
case PCI_QLOGIC_ISP:
|
1999-03-17 05:07:18 +00:00
|
|
|
x = "Qlogic ISP 1020/1040 PCI SCSI Adapter";
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifndef ISP_DISABLE_1080_SUPPORT
|
|
|
|
case PCI_QLOGIC_ISP1080:
|
1999-05-11 04:53:57 +00:00
|
|
|
x = "Qlogic ISP 1080 PCI SCSI Adapter";
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP1240:
|
|
|
|
x = "Qlogic ISP 1240 PCI SCSI Adapter";
|
1998-04-22 18:12:29 +00:00
|
|
|
break;
|
1999-03-17 05:07:18 +00:00
|
|
|
#endif
|
|
|
|
#ifndef ISP_DISABLE_2100_SUPPORT
|
1998-04-22 18:12:29 +00:00
|
|
|
case PCI_QLOGIC_ISP2100:
|
|
|
|
x = "Qlogic ISP 2100 PCI FC-AL Adapter";
|
|
|
|
break;
|
1999-07-05 20:24:46 +00:00
|
|
|
#endif
|
|
|
|
#ifndef ISP_DISABLE_2200_SUPPORT
|
|
|
|
case PCI_QLOGIC_ISP2200:
|
|
|
|
x = "Qlogic ISP 2200 PCI FC-AL Adapter";
|
|
|
|
break;
|
1999-03-17 05:07:18 +00:00
|
|
|
#endif
|
1998-04-22 18:12:29 +00:00
|
|
|
default:
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
if (oneshot) {
|
|
|
|
oneshot = 0;
|
1998-09-15 10:06:23 +00:00
|
|
|
printf("%s Version %d.%d, Core Version %d.%d\n", PVS,
|
|
|
|
ISP_PLATFORM_VERSION_MAJOR, ISP_PLATFORM_VERSION_MINOR,
|
|
|
|
ISP_CORE_VERSION_MAJOR, ISP_CORE_VERSION_MINOR);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
return (x);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
static void
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
isp_pci_attach(pcici_t cfid, int unit)
|
1998-04-22 18:12:29 +00:00
|
|
|
{
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
int mapped, prefer_mem_map, bitmap;
|
1998-09-16 16:43:17 +00:00
|
|
|
pci_port_t io_port;
|
1999-05-11 04:53:57 +00:00
|
|
|
u_int32_t data, linesz, psize, basetype;
|
1998-04-22 18:12:29 +00:00
|
|
|
struct isp_pcisoftc *pcs;
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
vm_offset_t vaddr, paddr;
|
1999-05-11 04:53:57 +00:00
|
|
|
struct ispmdvec *mdvp;
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
bus_size_t lim;
|
1998-04-22 18:12:29 +00:00
|
|
|
ISP_LOCKVAL_DECL;
|
|
|
|
|
|
|
|
pcs = malloc(sizeof (struct isp_pcisoftc), M_DEVBUF, M_NOWAIT);
|
|
|
|
if (pcs == NULL) {
|
1998-07-13 09:53:11 +00:00
|
|
|
printf("isp%d: cannot allocate softc\n", unit);
|
1998-04-22 18:12:29 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
bzero(pcs, sizeof (struct isp_pcisoftc));
|
|
|
|
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
/*
|
|
|
|
* Figure out which we should try first - memory mapping or i/o mapping?
|
|
|
|
*/
|
|
|
|
#if SCSI_ISP_PREFER_MEM_MAP == 1
|
|
|
|
prefer_mem_map = 1;
|
|
|
|
#else
|
|
|
|
prefer_mem_map = 0;
|
|
|
|
#endif
|
|
|
|
bitmap = 0;
|
|
|
|
if (getenv_int("isp_mem_map", &bitmap)) {
|
|
|
|
if (bitmap & (1 << unit))
|
|
|
|
prefer_mem_map = 1;
|
|
|
|
}
|
|
|
|
bitmap = 0;
|
|
|
|
if (getenv_int("isp_io_map", &bitmap)) {
|
|
|
|
if (bitmap & (1 << unit))
|
|
|
|
prefer_mem_map = 0;
|
|
|
|
}
|
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
vaddr = paddr = NULL;
|
|
|
|
mapped = 0;
|
1999-04-04 01:14:02 +00:00
|
|
|
linesz = PCI_DFLT_LNSZ;
|
1999-02-09 01:12:52 +00:00
|
|
|
/*
|
|
|
|
* Note that pci_conf_read is a 32 bit word aligned function.
|
|
|
|
*/
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
data = pci_conf_read(cfid, PCIR_COMMAND);
|
|
|
|
if (prefer_mem_map) {
|
|
|
|
if (data & PCI_COMMAND_MEM_ENABLE) {
|
|
|
|
if (pci_map_mem(cfid, MEM_MAP_REG, &vaddr, &paddr)) {
|
|
|
|
pcs->pci_st = MEM_SPACE_MAPPING;
|
|
|
|
pcs->pci_sh = vaddr;
|
|
|
|
mapped++;
|
|
|
|
}
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (mapped == 0 && (data & PCI_COMMAND_IO_ENABLE)) {
|
|
|
|
if (pci_map_port(cfid, PCI_MAP_REG_START, &io_port)) {
|
|
|
|
pcs->pci_st = IO_SPACE_MAPPING;
|
|
|
|
pcs->pci_sh = io_port;
|
|
|
|
mapped++;
|
|
|
|
}
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
} else {
|
|
|
|
if (data & PCI_COMMAND_IO_ENABLE) {
|
|
|
|
if (pci_map_port(cfid, PCI_MAP_REG_START, &io_port)) {
|
|
|
|
pcs->pci_st = IO_SPACE_MAPPING;
|
|
|
|
pcs->pci_sh = io_port;
|
|
|
|
mapped++;
|
|
|
|
}
|
1999-02-09 01:12:52 +00:00
|
|
|
}
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (mapped == 0 && (data & PCI_COMMAND_MEM_ENABLE)) {
|
|
|
|
if (pci_map_mem(cfid, MEM_MAP_REG, &vaddr, &paddr)) {
|
|
|
|
pcs->pci_st = MEM_SPACE_MAPPING;
|
|
|
|
pcs->pci_sh = vaddr;
|
|
|
|
mapped++;
|
|
|
|
}
|
1999-02-09 01:12:52 +00:00
|
|
|
}
|
|
|
|
}
|
1998-04-22 18:12:29 +00:00
|
|
|
if (mapped == 0) {
|
1998-07-13 09:53:11 +00:00
|
|
|
printf("isp%d: unable to map any ports!\n", unit);
|
1998-04-22 18:12:29 +00:00
|
|
|
free(pcs, M_DEVBUF);
|
|
|
|
return;
|
|
|
|
}
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (bootverbose)
|
|
|
|
printf("isp%d: using %s space register mapping\n", unit,
|
|
|
|
pcs->pci_st == IO_SPACE_MAPPING? "I/O" : "Memory");
|
1998-04-22 18:12:29 +00:00
|
|
|
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
data = pci_conf_read(cfid, PCI_ID_REG);
|
1999-03-17 05:07:18 +00:00
|
|
|
pcs->pci_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF;
|
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS_OFF;
|
|
|
|
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;
|
1999-05-11 04:53:57 +00:00
|
|
|
/*
|
|
|
|
* GCC!
|
|
|
|
*/
|
|
|
|
mdvp = &mdvec;
|
|
|
|
basetype = ISP_HA_SCSI_UNKNOWN;
|
|
|
|
psize = sizeof (sdparam);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
lim = BUS_SPACE_MAXSIZE_32BIT;
|
1999-03-17 05:07:18 +00:00
|
|
|
#ifndef ISP_DISABLE_1020_SUPPORT
|
1998-04-22 18:12:29 +00:00
|
|
|
if (data == PCI_QLOGIC_ISP) {
|
1999-05-11 04:53:57 +00:00
|
|
|
mdvp = &mdvec;
|
|
|
|
basetype = ISP_HA_SCSI_UNKNOWN;
|
|
|
|
psize = sizeof (sdparam);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
lim = BUS_SPACE_MAXSIZE_24BIT;
|
1999-03-17 05:07:18 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef ISP_DISABLE_1080_SUPPORT
|
1999-05-11 04:53:57 +00:00
|
|
|
if (data == PCI_QLOGIC_ISP1080) {
|
|
|
|
mdvp = &mdvec_1080;
|
|
|
|
basetype = ISP_HA_SCSI_1080;
|
|
|
|
psize = sizeof (sdparam);
|
|
|
|
pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] =
|
|
|
|
ISP1080_DMA_REGS_OFF;
|
|
|
|
}
|
|
|
|
if (data == PCI_QLOGIC_ISP1240) {
|
|
|
|
mdvp = &mdvec_1080;
|
|
|
|
basetype = ISP_HA_SCSI_12X0;
|
|
|
|
psize = 2 * sizeof (sdparam);
|
1999-03-17 05:07:18 +00:00
|
|
|
pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] =
|
|
|
|
ISP1080_DMA_REGS_OFF;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef ISP_DISABLE_2100_SUPPORT
|
|
|
|
if (data == PCI_QLOGIC_ISP2100) {
|
1999-05-11 04:53:57 +00:00
|
|
|
mdvp = &mdvec_2100;
|
|
|
|
basetype = ISP_HA_FC_2100;
|
|
|
|
psize = sizeof (fcparam);
|
1999-03-17 05:07:18 +00:00
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] =
|
|
|
|
PCI_MBOX_REGS2100_OFF;
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
data = pci_conf_read(cfid, PCI_CLASS_REG);
|
1999-04-04 01:14:02 +00:00
|
|
|
if ((data & 0xff) < 3) {
|
|
|
|
/*
|
|
|
|
* XXX: Need to get the actual revision
|
|
|
|
* XXX: number of the 2100 FB. At any rate,
|
|
|
|
* XXX: lower cache line size for early revision
|
|
|
|
* XXX; boards.
|
|
|
|
*/
|
|
|
|
linesz = 1;
|
|
|
|
}
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
1999-07-05 20:24:46 +00:00
|
|
|
#endif
|
|
|
|
#ifndef ISP_DISABLE_2200_SUPPORT
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (data == PCI_QLOGIC_ISP2200) {
|
|
|
|
mdvp = &mdvec_2200;
|
|
|
|
basetype = ISP_HA_FC_2200;
|
|
|
|
psize = sizeof (fcparam);
|
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] =
|
|
|
|
PCI_MBOX_REGS2100_OFF;
|
|
|
|
}
|
1999-03-17 05:07:18 +00:00
|
|
|
#endif
|
1999-05-11 04:53:57 +00:00
|
|
|
isp = &pcs->pci_isp;
|
|
|
|
isp->isp_param = malloc(psize, M_DEVBUF, M_NOWAIT);
|
|
|
|
if (isp->isp_param == NULL) {
|
|
|
|
printf("isp%d: cannot allocate parameter data\n", unit);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
bzero(isp->isp_param, psize);
|
|
|
|
isp->isp_mdvec = mdvp;
|
|
|
|
isp->isp_type = basetype;
|
|
|
|
(void) snprintf(isp->isp_name, sizeof (isp->isp_name), "isp%d", unit);
|
|
|
|
isp->isp_osinfo.unit = unit;
|
1998-04-22 18:12:29 +00:00
|
|
|
|
1999-02-09 01:12:52 +00:00
|
|
|
ISP_LOCK(isp);
|
1999-04-04 01:14:02 +00:00
|
|
|
|
1999-02-09 01:12:52 +00:00
|
|
|
/*
|
|
|
|
* Make sure that SERR, PERR, WRITE INVALIDATE and BUSMASTER
|
|
|
|
* are set.
|
|
|
|
*/
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
data = pci_cfgread(cfid, PCIR_COMMAND, 2);
|
1999-02-09 01:12:52 +00:00
|
|
|
data |= PCIM_CMD_SEREN |
|
|
|
|
PCIM_CMD_PERRESPEN |
|
|
|
|
PCIM_CMD_BUSMASTEREN |
|
|
|
|
PCIM_CMD_INVEN;
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
pci_cfgwrite(cfid, PCIR_COMMAND, 2, data);
|
1999-04-04 01:14:02 +00:00
|
|
|
|
1999-02-09 01:12:52 +00:00
|
|
|
/*
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
* Make sure the Cache Line Size register is set sensibly.
|
1999-02-09 01:12:52 +00:00
|
|
|
*/
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
data = pci_cfgread(cfid, PCIR_CACHELNSZ, 1);
|
1999-04-04 01:14:02 +00:00
|
|
|
if (data != linesz) {
|
1999-02-09 01:12:52 +00:00
|
|
|
data = PCI_DFLT_LNSZ;
|
|
|
|
printf("%s: set PCI line size to %d\n", isp->isp_name, data);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
pci_cfgwrite(cfid, PCIR_CACHELNSZ, data, 1);
|
1999-02-09 01:12:52 +00:00
|
|
|
}
|
1999-04-04 01:14:02 +00:00
|
|
|
|
1999-02-09 01:12:52 +00:00
|
|
|
/*
|
|
|
|
* Make sure the Latency Timer is sane.
|
|
|
|
*/
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
data = pci_cfgread(cfid, PCIR_LATTIMER, 1);
|
1999-02-09 01:12:52 +00:00
|
|
|
if (data < PCI_DFLT_LTNCY) {
|
|
|
|
data = PCI_DFLT_LTNCY;
|
|
|
|
printf("%s: set PCI latency to %d\n", isp->isp_name, data);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
pci_cfgwrite(cfid, PCIR_LATTIMER, data, 1);
|
1999-02-09 01:12:52 +00:00
|
|
|
}
|
1999-04-04 01:14:02 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure we've disabled the ROM.
|
|
|
|
*/
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
data = pci_cfgread(cfid, PCIR_ROMADDR, 4);
|
1999-04-04 01:14:02 +00:00
|
|
|
data &= ~1;
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
pci_cfgwrite(cfid, PCIR_ROMADDR, data, 4);
|
1999-02-09 01:12:52 +00:00
|
|
|
ISP_UNLOCK(isp);
|
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
if (bus_dma_tag_create(NULL, 0, 0, BUS_SPACE_MAXADDR_32BIT,
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
BUS_SPACE_MAXADDR, NULL, NULL, lim + 1,
|
|
|
|
255, lim, 0, &pcs->parent_dmat) != 0) {
|
1998-09-15 10:06:23 +00:00
|
|
|
printf("%s: could not create master dma tag\n", isp->isp_name);
|
|
|
|
free(pcs, M_DEVBUF);
|
|
|
|
return;
|
|
|
|
}
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (pci_map_int(cfid, (void (*)(void *))isp_intr,
|
1998-04-22 18:12:29 +00:00
|
|
|
(void *)isp, &IMASK) == 0) {
|
1998-07-13 09:53:11 +00:00
|
|
|
printf("%s: could not map interrupt\n", isp->isp_name);
|
1998-04-22 18:12:29 +00:00
|
|
|
free(pcs, M_DEVBUF);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
pcs->pci_id = cfid;
|
1999-02-09 01:12:52 +00:00
|
|
|
#ifdef SCSI_ISP_NO_FWLOAD_MASK
|
|
|
|
if (SCSI_ISP_NO_FWLOAD_MASK && (SCSI_ISP_NO_FWLOAD_MASK & (1 << unit)))
|
|
|
|
isp->isp_confopts |= ISP_CFG_NORELOAD;
|
|
|
|
#endif
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (getenv_int("isp_no_fwload", &bitmap)) {
|
|
|
|
if (bitmap & (1 << unit))
|
|
|
|
isp->isp_confopts |= ISP_CFG_NORELOAD;
|
|
|
|
}
|
|
|
|
if (getenv_int("isp_fwload", &bitmap)) {
|
|
|
|
if (bitmap & (1 << unit))
|
|
|
|
isp->isp_confopts &= ~ISP_CFG_NORELOAD;
|
|
|
|
}
|
|
|
|
|
1999-02-09 01:12:52 +00:00
|
|
|
#ifdef SCSI_ISP_NO_NVRAM_MASK
|
1999-04-04 01:14:02 +00:00
|
|
|
if (SCSI_ISP_NO_NVRAM_MASK && (SCSI_ISP_NO_NVRAM_MASK & (1 << unit))) {
|
|
|
|
printf("%s: ignoring NVRAM\n", isp->isp_name);
|
1999-02-09 01:12:52 +00:00
|
|
|
isp->isp_confopts |= ISP_CFG_NONVRAM;
|
1999-04-04 01:14:02 +00:00
|
|
|
}
|
1999-02-09 01:12:52 +00:00
|
|
|
#endif
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (getenv_int("isp_no_nvram", &bitmap)) {
|
|
|
|
if (bitmap & (1 << unit))
|
|
|
|
isp->isp_confopts |= ISP_CFG_NONVRAM;
|
|
|
|
}
|
|
|
|
if (getenv_int("isp_nvram", &bitmap)) {
|
|
|
|
if (bitmap & (1 << unit))
|
|
|
|
isp->isp_confopts &= ~ISP_CFG_NONVRAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef SCSI_ISP_FCDUPLEX
|
|
|
|
if (IS_FC(isp)) {
|
|
|
|
if (SCSI_ISP_FCDUPLEX && (SCSI_ISP_FCDUPLEX & (1 << unit))) {
|
|
|
|
isp->isp_confopts |= ISP_CFG_FULL_DUPLEX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (getenv_int("isp_fcduplex", &bitmap)) {
|
|
|
|
if (bitmap & (1 << unit))
|
|
|
|
isp->isp_confopts |= ISP_CFG_FULL_DUPLEX;
|
|
|
|
}
|
|
|
|
if (getenv_int("isp_no_fcduplex", &bitmap)) {
|
|
|
|
if (bitmap & (1 << unit))
|
|
|
|
isp->isp_confopts &= ~ISP_CFG_FULL_DUPLEX;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getenv_int("isp_seed", &isp->isp_osinfo.seed)) {
|
|
|
|
isp->isp_osinfo.seed <<= 8;
|
|
|
|
isp->isp_osinfo.seed += (unit + 1);
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* poor man's attempt at pseudo randomness.
|
|
|
|
*/
|
|
|
|
long i = (long) isp;
|
|
|
|
|
|
|
|
i >>= 5;
|
|
|
|
i &= 0x7;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This isn't very random, but it's the best we can do for
|
|
|
|
* the real edge case of cards that don't have WWNs.
|
|
|
|
*/
|
|
|
|
isp->isp_osinfo.seed += ((int) cfid->bus) << 16;
|
|
|
|
isp->isp_osinfo.seed += ((int) cfid->slot) << 8;
|
|
|
|
isp->isp_osinfo.seed += ((int) cfid->func);
|
|
|
|
while (version[i])
|
|
|
|
isp->isp_osinfo.seed += (int) version[i++];
|
|
|
|
isp->isp_osinfo.seed <<= 8;
|
|
|
|
isp->isp_osinfo.seed += (unit + 1);
|
|
|
|
}
|
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
ISP_LOCK(isp);
|
1998-04-22 18:12:29 +00:00
|
|
|
isp_reset(isp);
|
|
|
|
if (isp->isp_state != ISP_RESETSTATE) {
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
(void) pci_unmap_int(cfid);
|
1998-09-15 10:06:23 +00:00
|
|
|
ISP_UNLOCK(isp);
|
1998-04-22 18:12:29 +00:00
|
|
|
free(pcs, M_DEVBUF);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
isp_init(isp);
|
|
|
|
if (isp->isp_state != ISP_INITSTATE) {
|
1999-03-17 05:07:18 +00:00
|
|
|
/* If we're a Fibre Channel Card, we allow deferred attach */
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1999-03-17 05:07:18 +00:00
|
|
|
isp_uninit(isp);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
(void) pci_unmap_int(cfid); /* Does nothing */
|
1999-05-11 04:53:57 +00:00
|
|
|
ISP_UNLOCK(isp);
|
1999-03-17 05:07:18 +00:00
|
|
|
free(pcs, M_DEVBUF);
|
1999-05-11 04:53:57 +00:00
|
|
|
return;
|
1999-03-17 05:07:18 +00:00
|
|
|
}
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
isp_attach(isp);
|
|
|
|
if (isp->isp_state != ISP_RUNSTATE) {
|
1999-03-17 05:07:18 +00:00
|
|
|
/* If we're a Fibre Channel Card, we allow deferred attach */
|
1999-03-25 22:53:56 +00:00
|
|
|
if (IS_SCSI(isp)) {
|
1999-03-17 05:07:18 +00:00
|
|
|
isp_uninit(isp);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
(void) pci_unmap_int(cfid); /* Does nothing */
|
1999-05-11 04:53:57 +00:00
|
|
|
ISP_UNLOCK(isp);
|
1999-03-17 05:07:18 +00:00
|
|
|
free(pcs, M_DEVBUF);
|
1999-05-11 04:53:57 +00:00
|
|
|
return;
|
1999-03-17 05:07:18 +00:00
|
|
|
}
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
ISP_UNLOCK(isp);
|
1998-09-26 14:37:49 +00:00
|
|
|
#ifdef __alpha__
|
1999-02-09 01:12:52 +00:00
|
|
|
/*
|
|
|
|
* THIS SHOULD NOT HAVE TO BE HERE
|
|
|
|
*/
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
alpha_register_pci_scsi(cfid->bus, cfid->slot, isp->isp_sim);
|
1998-09-26 14:37:49 +00:00
|
|
|
#endif
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
static u_int16_t
|
|
|
|
isp_pci_rd_reg(isp, regoff)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int regoff;
|
|
|
|
{
|
|
|
|
u_int16_t rv;
|
|
|
|
struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
|
|
|
|
int offset, oldconf = 0;
|
1998-04-22 18:12:29 +00:00
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
|
|
|
|
/*
|
|
|
|
* We will assume that someone has paused the RISC processor.
|
|
|
|
*/
|
|
|
|
oldconf = isp_pci_rd_reg(isp, BIU_CONF1);
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oldconf | BIU_PCI_CONF1_SXP);
|
|
|
|
}
|
|
|
|
offset = pcs->pci_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
|
|
|
|
offset += (regoff & 0xff);
|
|
|
|
rv = bus_space_read_2(pcs->pci_st, pcs->pci_sh, offset);
|
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oldconf);
|
|
|
|
}
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_pci_wr_reg(isp, regoff, val)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int regoff;
|
|
|
|
u_int16_t val;
|
|
|
|
{
|
|
|
|
struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
|
|
|
|
int offset, oldconf = 0;
|
|
|
|
|
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
|
|
|
|
/*
|
|
|
|
* We will assume that someone has paused the RISC processor.
|
|
|
|
*/
|
|
|
|
oldconf = isp_pci_rd_reg(isp, BIU_CONF1);
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oldconf | BIU_PCI_CONF1_SXP);
|
|
|
|
}
|
|
|
|
offset = pcs->pci_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
|
|
|
|
offset += (regoff & 0xff);
|
|
|
|
bus_space_write_2(pcs->pci_st, pcs->pci_sh, offset, val);
|
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oldconf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef ISP_DISABLE_1080_SUPPORT
|
1998-04-22 18:12:29 +00:00
|
|
|
static u_int16_t
|
1999-03-17 05:07:18 +00:00
|
|
|
isp_pci_rd_reg_1080(isp, regoff)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int regoff;
|
1998-04-22 18:12:29 +00:00
|
|
|
{
|
|
|
|
u_int16_t rv;
|
|
|
|
struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
|
1999-03-17 05:07:18 +00:00
|
|
|
int offset, oc = 0;
|
|
|
|
|
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
|
1998-04-22 18:12:29 +00:00
|
|
|
/*
|
|
|
|
* We will assume that someone has paused the RISC processor.
|
|
|
|
*/
|
1999-03-17 05:07:18 +00:00
|
|
|
oc = isp_pci_rd_reg(isp, BIU_CONF1);
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oc | BIU_PCI1080_CONF1_SXP);
|
|
|
|
} else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) {
|
|
|
|
oc = isp_pci_rd_reg(isp, BIU_CONF1);
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oc | BIU_PCI1080_CONF1_DMA);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
1999-03-17 05:07:18 +00:00
|
|
|
offset = pcs->pci_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
|
|
|
|
offset += (regoff & 0xff);
|
1998-04-22 18:12:29 +00:00
|
|
|
rv = bus_space_read_2(pcs->pci_st, pcs->pci_sh, offset);
|
1999-03-17 05:07:18 +00:00
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK ||
|
|
|
|
((regoff & _BLK_REG_MASK) == DMA_BLOCK)) {
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oc);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-03-17 05:07:18 +00:00
|
|
|
isp_pci_wr_reg_1080(isp, regoff, val)
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int regoff;
|
|
|
|
u_int16_t val;
|
1998-04-22 18:12:29 +00:00
|
|
|
{
|
|
|
|
struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
|
1999-03-17 05:07:18 +00:00
|
|
|
int offset, oc = 0;
|
|
|
|
|
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
|
1998-04-22 18:12:29 +00:00
|
|
|
/*
|
|
|
|
* We will assume that someone has paused the RISC processor.
|
|
|
|
*/
|
1999-03-17 05:07:18 +00:00
|
|
|
oc = isp_pci_rd_reg(isp, BIU_CONF1);
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oc | BIU_PCI1080_CONF1_SXP);
|
|
|
|
} else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) {
|
|
|
|
oc = isp_pci_rd_reg(isp, BIU_CONF1);
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oc | BIU_PCI1080_CONF1_DMA);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
1999-03-17 05:07:18 +00:00
|
|
|
offset = pcs->pci_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
|
|
|
|
offset += (regoff & 0xff);
|
1998-04-22 18:12:29 +00:00
|
|
|
bus_space_write_2(pcs->pci_st, pcs->pci_sh, offset, val);
|
1999-03-17 05:07:18 +00:00
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK ||
|
|
|
|
((regoff & _BLK_REG_MASK) == DMA_BLOCK)) {
|
|
|
|
isp_pci_wr_reg(isp, BIU_CONF1, oc);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
}
|
1999-03-17 05:07:18 +00:00
|
|
|
#endif
|
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
static void isp_map_rquest __P((void *, bus_dma_segment_t *, int, int));
|
|
|
|
static void isp_map_result __P((void *, bus_dma_segment_t *, int, int));
|
|
|
|
static void isp_map_fcscrt __P((void *, bus_dma_segment_t *, int, int));
|
|
|
|
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
struct imush {
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
int error;
|
|
|
|
};
|
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
static void
|
1998-12-28 19:24:23 +00:00
|
|
|
isp_map_rquest(void *arg, bus_dma_segment_t *segs, int nseg, int error)
|
1998-09-15 10:06:23 +00:00
|
|
|
{
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
struct imush *imushp = (struct imush *) arg;
|
|
|
|
if (error) {
|
|
|
|
imushp->error = error;
|
|
|
|
} else {
|
|
|
|
imushp->isp->isp_rquest_dma = segs->ds_addr;
|
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-12-28 19:24:23 +00:00
|
|
|
isp_map_result(void *arg, bus_dma_segment_t *segs, int nseg, int error)
|
1998-09-15 10:06:23 +00:00
|
|
|
{
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
struct imush *imushp = (struct imush *) arg;
|
|
|
|
if (error) {
|
|
|
|
imushp->error = error;
|
|
|
|
} else {
|
|
|
|
imushp->isp->isp_result_dma = segs->ds_addr;
|
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-12-28 19:24:23 +00:00
|
|
|
isp_map_fcscrt(void *arg, bus_dma_segment_t *segs, int nseg, int error)
|
1998-09-15 10:06:23 +00:00
|
|
|
{
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
struct imush *imushp = (struct imush *) arg;
|
|
|
|
if (error) {
|
|
|
|
imushp->error = error;
|
|
|
|
} else {
|
|
|
|
fcparam *fcp = imushp->isp->isp_param;
|
|
|
|
fcp->isp_scdma = segs->ds_addr;
|
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
1998-12-28 19:24:23 +00:00
|
|
|
isp_pci_mbxdma(struct ispsoftc *isp)
|
1998-09-15 10:06:23 +00:00
|
|
|
{
|
|
|
|
struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp;
|
|
|
|
caddr_t base;
|
|
|
|
u_int32_t len;
|
|
|
|
int i, error;
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
bus_size_t lim;
|
|
|
|
struct imush im;
|
|
|
|
|
|
|
|
|
|
|
|
if (IS_FC(isp) || IS_1080(isp) || IS_12X0(isp))
|
|
|
|
lim = BUS_SPACE_MAXADDR + 1;
|
|
|
|
else
|
|
|
|
lim = BUS_SPACE_MAXADDR_24BIT + 1;
|
1998-09-15 10:06:23 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate and map the request, result queues, plus FC scratch area.
|
|
|
|
*/
|
|
|
|
len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN);
|
|
|
|
len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-09-15 10:06:23 +00:00
|
|
|
len += ISP2100_SCRLEN;
|
|
|
|
}
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (bus_dma_tag_create(pci->parent_dmat, PAGE_SIZE, lim,
|
|
|
|
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, len, 1,
|
|
|
|
BUS_SPACE_MAXSIZE_32BIT, 0, &pci->cntrol_dmat) != 0) {
|
1998-09-15 10:06:23 +00:00
|
|
|
printf("%s: cannot create a dma tag for control spaces\n",
|
|
|
|
isp->isp_name);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
if (bus_dmamem_alloc(pci->cntrol_dmat, (void **)&base,
|
|
|
|
BUS_DMA_NOWAIT, &pci->cntrol_dmap) != 0) {
|
1998-09-17 21:11:21 +00:00
|
|
|
printf("%s: cannot allocate %d bytes of CCB memory\n",
|
|
|
|
isp->isp_name, len);
|
1998-09-15 10:06:23 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
isp->isp_rquest = base;
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
im.isp = isp;
|
|
|
|
im.error = 0;
|
1998-09-15 10:06:23 +00:00
|
|
|
bus_dmamap_load(pci->cntrol_dmat, pci->cntrol_dmap, isp->isp_rquest,
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN), isp_map_rquest, &im, 0);
|
|
|
|
if (im.error) {
|
|
|
|
printf("%s: error %d loading dma map for DMA request queue\n",
|
|
|
|
isp->isp_name, im.error);
|
|
|
|
return (1);
|
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
isp->isp_result = base + ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
im.error = 0;
|
1998-09-15 10:06:23 +00:00
|
|
|
bus_dmamap_load(pci->cntrol_dmat, pci->cntrol_dmap, isp->isp_result,
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
ISP_QUEUE_SIZE(RESULT_QUEUE_LEN), isp_map_result, &im, 0);
|
|
|
|
if (im.error) {
|
|
|
|
printf("%s: error %d loading dma map for DMA result queue\n",
|
|
|
|
isp->isp_name, im.error);
|
|
|
|
return (1);
|
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Use this opportunity to initialize/create data DMA maps.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < MAXISPREQUEST; i++) {
|
|
|
|
error = bus_dmamap_create(pci->parent_dmat, 0, &pci->dmaps[i]);
|
|
|
|
if (error) {
|
1998-09-17 21:11:21 +00:00
|
|
|
printf("%s: error %d creating mailbox DMA maps\n",
|
1998-09-15 10:06:23 +00:00
|
|
|
isp->isp_name, error);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (IS_FC(isp)) {
|
1999-03-25 22:53:56 +00:00
|
|
|
fcparam *fcp = (fcparam *) isp->isp_param;
|
|
|
|
fcp->isp_scratch = base +
|
|
|
|
ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN) +
|
|
|
|
ISP_QUEUE_SIZE(RESULT_QUEUE_LEN);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
im.error = 0;
|
1999-03-25 22:53:56 +00:00
|
|
|
bus_dmamap_load(pci->cntrol_dmat, pci->cntrol_dmap,
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
fcp->isp_scratch, ISP2100_SCRLEN, isp_map_fcscrt, &im, 0);
|
|
|
|
if (im.error) {
|
|
|
|
printf("%s: error %d loading FC scratch area\n",
|
|
|
|
isp->isp_name, im.error);
|
|
|
|
return (1);
|
|
|
|
}
|
1999-03-25 22:53:56 +00:00
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dma2 __P((void *, bus_dma_segment_t *, int, int));
|
|
|
|
typedef struct {
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
ISP_SCSI_XFER_T *ccb;
|
|
|
|
ispreq_t *rq;
|
|
|
|
u_int8_t *iptrp;
|
|
|
|
u_int8_t optr;
|
|
|
|
u_int error;
|
|
|
|
} mush_t;
|
|
|
|
|
1998-09-17 21:11:21 +00:00
|
|
|
#define MUSHERR_NOQENTRIES -2
|
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
static void
|
1998-12-28 19:24:23 +00:00
|
|
|
dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
|
1998-09-15 10:06:23 +00:00
|
|
|
{
|
|
|
|
mush_t *mp;
|
|
|
|
ISP_SCSI_XFER_T *ccb;
|
|
|
|
struct ispsoftc *isp;
|
|
|
|
struct isp_pcisoftc *pci;
|
|
|
|
bus_dmamap_t *dp;
|
|
|
|
bus_dma_segment_t *eseg;
|
|
|
|
ispreq_t *rq;
|
|
|
|
u_int8_t *iptrp;
|
|
|
|
u_int8_t optr;
|
|
|
|
ispcontreq_t *crq;
|
|
|
|
int drq, seglim, datalen;
|
|
|
|
|
|
|
|
mp = (mush_t *) arg;
|
|
|
|
if (error) {
|
|
|
|
mp->error = error;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
isp = mp->isp;
|
|
|
|
if (nseg < 1) {
|
|
|
|
printf("%s: zero or negative segment count\n", isp->isp_name);
|
|
|
|
mp->error = EFAULT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ccb = mp->ccb;
|
|
|
|
rq = mp->rq;
|
|
|
|
iptrp = mp->iptrp;
|
|
|
|
optr = mp->optr;
|
|
|
|
|
|
|
|
pci = (struct isp_pcisoftc *)isp;
|
|
|
|
dp = &pci->dmaps[rq->req_handle - 1];
|
|
|
|
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
|
|
|
bus_dmamap_sync(pci->parent_dmat, *dp, BUS_DMASYNC_PREREAD);
|
|
|
|
drq = REQFLAG_DATA_IN;
|
|
|
|
} else {
|
|
|
|
bus_dmamap_sync(pci->parent_dmat, *dp, BUS_DMASYNC_PREWRITE);
|
|
|
|
drq = REQFLAG_DATA_OUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
datalen = XS_XFRLEN(ccb);
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-09-15 10:06:23 +00:00
|
|
|
seglim = ISP_RQDSEG_T2;
|
|
|
|
((ispreqt2_t *)rq)->req_totalcnt = datalen;
|
|
|
|
((ispreqt2_t *)rq)->req_flags |= drq;
|
|
|
|
} else {
|
|
|
|
seglim = ISP_RQDSEG;
|
|
|
|
rq->req_flags |= drq;
|
|
|
|
}
|
|
|
|
|
|
|
|
eseg = dm_segs + nseg;
|
|
|
|
|
|
|
|
while (datalen != 0 && rq->req_seg_count < seglim && dm_segs != eseg) {
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-09-15 10:06:23 +00:00
|
|
|
ispreqt2_t *rq2 = (ispreqt2_t *)rq;
|
|
|
|
rq2->req_dataseg[rq2->req_seg_count].ds_base =
|
|
|
|
dm_segs->ds_addr;
|
|
|
|
rq2->req_dataseg[rq2->req_seg_count].ds_count =
|
|
|
|
dm_segs->ds_len;
|
|
|
|
} else {
|
|
|
|
rq->req_dataseg[rq->req_seg_count].ds_base =
|
|
|
|
dm_segs->ds_addr;
|
|
|
|
rq->req_dataseg[rq->req_seg_count].ds_count =
|
|
|
|
dm_segs->ds_len;
|
|
|
|
}
|
|
|
|
datalen -= dm_segs->ds_len;
|
|
|
|
#if 0
|
Remove pre-CAM code. Add in getenv_int calls for variables isp_mem_map,
isp_io_map, isp_no_fwload, isp_fwload, isp_no_nvram, isp_fcduplex
which are all bitmaps of isp instances that should or shouldn't
map memory space, I/O space, not load f/w, load f/w, ignore nvram,
not ignore nvarm, set full duplex mode. Also have an isp_seed value
that we can use to generate a pseudo seed for a synthetic WWN.
Other minor cosmetic cleanup. Add in support for the Qlogic ISP
2200. Very important change where we actually check now to see
whether we were successful in mapping request and response queues
(and fibre channel scratch space).
1999-07-02 23:18:03 +00:00
|
|
|
if (IS_FC(isp)) {
|
1998-09-15 10:06:23 +00:00
|
|
|
ispreqt2_t *rq2 = (ispreqt2_t *)rq;
|
|
|
|
printf("%s: seg0[%d] cnt 0x%x paddr 0x%08x\n",
|
|
|
|
isp->isp_name, rq->req_seg_count,
|
|
|
|
rq2->req_dataseg[rq2->req_seg_count].ds_count,
|
|
|
|
rq2->req_dataseg[rq2->req_seg_count].ds_base);
|
|
|
|
} else {
|
|
|
|
printf("%s: seg0[%d] cnt 0x%x paddr 0x%08x\n",
|
|
|
|
isp->isp_name, rq->req_seg_count,
|
|
|
|
rq->req_dataseg[rq->req_seg_count].ds_count,
|
|
|
|
rq->req_dataseg[rq->req_seg_count].ds_base);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
rq->req_seg_count++;
|
|
|
|
dm_segs++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (datalen > 0 && dm_segs != eseg) {
|
|
|
|
crq = (ispcontreq_t *) ISP_QUEUE_ENTRY(isp->isp_rquest, *iptrp);
|
1998-09-17 21:11:21 +00:00
|
|
|
*iptrp = ISP_NXT_QENTRY(*iptrp, RQUEST_QUEUE_LEN);
|
1998-09-15 10:06:23 +00:00
|
|
|
if (*iptrp == optr) {
|
1998-09-17 21:11:21 +00:00
|
|
|
#if 0
|
|
|
|
printf("%s: Request Queue Overflow++\n", isp->isp_name);
|
|
|
|
#endif
|
|
|
|
mp->error = MUSHERR_NOQENTRIES;
|
1998-09-15 10:06:23 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
rq->req_header.rqs_entry_count++;
|
|
|
|
bzero((void *)crq, sizeof (*crq));
|
|
|
|
crq->req_header.rqs_entry_count = 1;
|
|
|
|
crq->req_header.rqs_entry_type = RQSTYPE_DATASEG;
|
|
|
|
|
|
|
|
seglim = 0;
|
|
|
|
while (datalen > 0 && seglim < ISP_CDSEG && dm_segs != eseg) {
|
|
|
|
crq->req_dataseg[seglim].ds_base =
|
|
|
|
dm_segs->ds_addr;
|
|
|
|
crq->req_dataseg[seglim].ds_count =
|
|
|
|
dm_segs->ds_len;
|
|
|
|
#if 0
|
|
|
|
printf("%s: seg%d[%d] cnt 0x%x paddr 0x%08x\n",
|
|
|
|
isp->isp_name, rq->req_header.rqs_entry_count-1,
|
|
|
|
seglim, crq->req_dataseg[seglim].ds_count,
|
|
|
|
crq->req_dataseg[seglim].ds_base);
|
|
|
|
#endif
|
|
|
|
rq->req_seg_count++;
|
|
|
|
dm_segs++;
|
|
|
|
seglim++;
|
|
|
|
datalen -= dm_segs->ds_len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
1998-12-28 19:24:23 +00:00
|
|
|
isp_pci_dmasetup(struct ispsoftc *isp, ISP_SCSI_XFER_T *ccb, ispreq_t *rq,
|
|
|
|
u_int8_t *iptrp, u_int8_t optr)
|
1998-09-15 10:06:23 +00:00
|
|
|
{
|
|
|
|
struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp;
|
|
|
|
struct ccb_hdr *ccb_h;
|
|
|
|
struct ccb_scsiio *csio;
|
|
|
|
bus_dmamap_t *dp;
|
|
|
|
mush_t mush, *mp;
|
|
|
|
|
|
|
|
csio = (struct ccb_scsiio *) ccb;
|
|
|
|
ccb_h = &csio->ccb_h;
|
|
|
|
|
|
|
|
if ((ccb_h->flags & CAM_DIR_MASK) == CAM_DIR_NONE) {
|
|
|
|
rq->req_seg_count = 1;
|
1998-09-17 21:11:21 +00:00
|
|
|
return (CMD_QUEUED);
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
dp = &pci->dmaps[rq->req_handle - 1];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do a virtual grapevine step to collect info for
|
1998-09-17 21:11:21 +00:00
|
|
|
* the callback dma allocation that we have to use...
|
1998-09-15 10:06:23 +00:00
|
|
|
*/
|
|
|
|
mp = &mush;
|
|
|
|
mp->isp = isp;
|
|
|
|
mp->ccb = ccb;
|
|
|
|
mp->rq = rq;
|
|
|
|
mp->iptrp = iptrp;
|
|
|
|
mp->optr = optr;
|
|
|
|
mp->error = 0;
|
|
|
|
|
|
|
|
if ((ccb_h->flags & CAM_SCATTER_VALID) == 0) {
|
|
|
|
if ((ccb_h->flags & CAM_DATA_PHYS) == 0) {
|
1998-09-17 21:11:21 +00:00
|
|
|
int error, s;
|
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
s = splsoftvm();
|
|
|
|
error = bus_dmamap_load(pci->parent_dmat, *dp,
|
|
|
|
csio->data_ptr, csio->dxfer_len, dma2, mp, 0);
|
|
|
|
if (error == EINPROGRESS) {
|
|
|
|
bus_dmamap_unload(pci->parent_dmat, *dp);
|
|
|
|
mp->error = EINVAL;
|
1998-09-17 21:11:21 +00:00
|
|
|
printf("%s: deferred dma allocation not "
|
|
|
|
"supported\n", isp->isp_name);
|
1998-09-15 10:06:23 +00:00
|
|
|
} else if (error && mp->error == 0) {
|
|
|
|
mp->error = error;
|
|
|
|
}
|
1998-09-17 21:11:21 +00:00
|
|
|
splx(s);
|
1998-09-15 10:06:23 +00:00
|
|
|
} else {
|
|
|
|
/* Pointer to physical buffer */
|
1999-03-17 05:07:18 +00:00
|
|
|
struct bus_dma_segment seg;
|
1998-09-15 10:06:23 +00:00
|
|
|
seg.ds_addr = (bus_addr_t)csio->data_ptr;
|
|
|
|
seg.ds_len = csio->dxfer_len;
|
|
|
|
dma2(mp, &seg, 1, 0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
struct bus_dma_segment *segs;
|
|
|
|
|
|
|
|
if ((ccb_h->flags & CAM_DATA_PHYS) != 0) {
|
|
|
|
printf("%s: Physical segment pointers unsupported",
|
|
|
|
isp->isp_name);
|
|
|
|
mp->error = EINVAL;
|
1998-09-17 21:11:21 +00:00
|
|
|
} else if ((ccb_h->flags & CAM_SG_LIST_PHYS) == 0) {
|
1998-09-15 10:06:23 +00:00
|
|
|
printf("%s: Virtual segment addresses unsupported",
|
|
|
|
isp->isp_name);
|
|
|
|
mp->error = EINVAL;
|
|
|
|
} else {
|
|
|
|
/* Just use the segments provided */
|
|
|
|
segs = (struct bus_dma_segment *) csio->data_ptr;
|
|
|
|
dma2(mp, segs, csio->sglist_cnt, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mp->error) {
|
1998-09-17 21:11:21 +00:00
|
|
|
int retval = CMD_COMPLETE;
|
|
|
|
if (mp->error == MUSHERR_NOQENTRIES) {
|
|
|
|
retval = CMD_EAGAIN;
|
|
|
|
ccb_h->status = CAM_UNREC_HBA_ERROR;
|
|
|
|
} else if (mp->error == EFBIG) {
|
|
|
|
ccb_h->status = CAM_REQ_TOO_BIG;
|
1998-09-15 10:06:23 +00:00
|
|
|
} else if (mp->error == EINVAL) {
|
|
|
|
ccb_h->status = CAM_REQ_INVALID;
|
|
|
|
} else {
|
|
|
|
ccb_h->status = CAM_UNREC_HBA_ERROR;
|
|
|
|
}
|
1998-09-17 21:11:21 +00:00
|
|
|
return (retval);
|
|
|
|
} else {
|
|
|
|
return (CMD_QUEUED);
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-12-28 19:24:23 +00:00
|
|
|
isp_pci_dmateardown(struct ispsoftc *isp, ISP_SCSI_XFER_T *ccb,
|
|
|
|
u_int32_t handle)
|
1998-09-15 10:06:23 +00:00
|
|
|
{
|
|
|
|
struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp;
|
|
|
|
bus_dmamap_t *dp = &pci->dmaps[handle];
|
|
|
|
|
|
|
|
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
|
|
|
bus_dmamap_sync(pci->parent_dmat, *dp, BUS_DMASYNC_POSTREAD);
|
|
|
|
} else {
|
|
|
|
bus_dmamap_sync(pci->parent_dmat, *dp, BUS_DMASYNC_POSTWRITE);
|
|
|
|
}
|
|
|
|
bus_dmamap_unload(pci->parent_dmat, *dp);
|
|
|
|
}
|
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
|
|
|
|
static void
|
1998-12-28 19:24:23 +00:00
|
|
|
isp_pci_reset1(struct ispsoftc *isp)
|
1998-04-22 18:12:29 +00:00
|
|
|
{
|
|
|
|
/* Make sure the BIOS is disabled */
|
|
|
|
isp_pci_wr_reg(isp, HCCR, PCI_HCCR_CMD_BIOS);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1998-12-28 19:24:23 +00:00
|
|
|
isp_pci_dumpregs(struct ispsoftc *isp)
|
1998-04-22 18:12:29 +00:00
|
|
|
{
|
|
|
|
struct isp_pcisoftc *pci = (struct isp_pcisoftc *)isp;
|
1998-07-13 09:53:11 +00:00
|
|
|
printf("%s: PCI Status Command/Status=%lx\n", pci->pci_isp.isp_name,
|
1999-02-09 01:12:52 +00:00
|
|
|
pci_conf_read(pci->pci_id, PCIR_COMMAND));
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|