2003-08-24 17:55:58 +00:00
|
|
|
/*-
|
2009-08-01 01:04:26 +00:00
|
|
|
* Copyright (c) 1997-2008 by Matthew Jacob
|
2006-01-23 06:23:37 +00:00
|
|
|
* All rights reserved.
|
1998-04-22 18:12:29 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2000-09-21 20:16:04 +00:00
|
|
|
* 2. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
1998-04-22 18:12:29 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2006-07-16 20:11:50 +00:00
|
|
|
/*
|
|
|
|
* PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
|
|
|
|
* FreeBSD Version.
|
|
|
|
*/
|
2003-08-24 17:55:58 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2000-02-11 19:45:17 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/module.h>
|
Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.
Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.
However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.
For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.
This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.
We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).
Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after: 2 months
2006-07-09 17:50:20 +00:00
|
|
|
#include <sys/linker.h>
|
|
|
|
#include <sys/firmware.h>
|
2000-02-11 19:45:17 +00:00
|
|
|
#include <sys/bus.h>
|
2005-12-15 22:12:27 +00:00
|
|
|
#include <sys/stdint.h>
|
2003-08-22 06:00:27 +00:00
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
1998-09-15 10:06:23 +00:00
|
|
|
#include <machine/bus.h>
|
2000-02-11 19:45:17 +00:00
|
|
|
#include <machine/resource.h>
|
|
|
|
#include <sys/rman.h>
|
|
|
|
#include <sys/malloc.h>
|
2009-08-01 01:04:26 +00:00
|
|
|
#include <sys/uio.h>
|
2000-02-11 19:45:17 +00:00
|
|
|
|
|
|
|
#include <dev/isp/isp_freebsd.h>
|
1999-03-17 05:07:18 +00:00
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
static uint32_t isp_pci_rd_reg(ispsoftc_t *, int);
|
|
|
|
static void isp_pci_wr_reg(ispsoftc_t *, int, uint32_t);
|
|
|
|
static uint32_t isp_pci_rd_reg_1080(ispsoftc_t *, int);
|
|
|
|
static void isp_pci_wr_reg_1080(ispsoftc_t *, int, uint32_t);
|
|
|
|
static uint32_t isp_pci_rd_reg_2400(ispsoftc_t *, int);
|
|
|
|
static void isp_pci_wr_reg_2400(ispsoftc_t *, int, uint32_t);
|
2009-08-01 01:04:26 +00:00
|
|
|
static int isp_pci_rd_isr(ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *);
|
|
|
|
static int isp_pci_rd_isr_2300(ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *);
|
|
|
|
static int isp_pci_rd_isr_2400(ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *);
|
2006-04-21 18:30:01 +00:00
|
|
|
static int isp_pci_mbxdma(ispsoftc_t *);
|
2009-08-01 01:04:26 +00:00
|
|
|
static int isp_pci_dmasetup(ispsoftc_t *, XS_T *, void *);
|
1998-04-22 18:12:29 +00:00
|
|
|
|
Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.
Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.
However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.
For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.
This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.
We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).
Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after: 2 months
2006-07-09 17:50:20 +00:00
|
|
|
|
2006-12-16 05:54:29 +00:00
|
|
|
static void isp_pci_reset0(ispsoftc_t *);
|
2006-04-21 18:30:01 +00:00
|
|
|
static void isp_pci_reset1(ispsoftc_t *);
|
|
|
|
static void isp_pci_dumpregs(ispsoftc_t *, const char *);
|
1998-04-22 18:12:29 +00:00
|
|
|
|
|
|
|
static struct ispmdvec mdvec = {
|
2001-08-31 21:39:04 +00:00
|
|
|
isp_pci_rd_isr,
|
1998-04-22 18:12:29 +00:00
|
|
|
isp_pci_rd_reg,
|
|
|
|
isp_pci_wr_reg,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_common_dmateardown,
|
2006-12-16 05:54:29 +00:00
|
|
|
isp_pci_reset0,
|
1998-04-22 18:12:29 +00:00
|
|
|
isp_pci_reset1,
|
|
|
|
isp_pci_dumpregs,
|
2000-06-18 05:18:55 +00:00
|
|
|
NULL,
|
2000-08-01 05:16:49 +00:00
|
|
|
BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
|
1998-04-22 18:12:29 +00:00
|
|
|
};
|
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
static struct ispmdvec mdvec_1080 = {
|
2001-08-31 21:39:04 +00:00
|
|
|
isp_pci_rd_isr,
|
1999-03-17 05:07:18 +00:00
|
|
|
isp_pci_rd_reg_1080,
|
|
|
|
isp_pci_wr_reg_1080,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_common_dmateardown,
|
2006-12-16 05:54:29 +00:00
|
|
|
isp_pci_reset0,
|
1999-03-17 05:07:18 +00:00
|
|
|
isp_pci_reset1,
|
|
|
|
isp_pci_dumpregs,
|
2000-06-18 05:18:55 +00:00
|
|
|
NULL,
|
2000-08-01 05:16:49 +00:00
|
|
|
BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
|
1999-03-17 05:07:18 +00:00
|
|
|
};
|
|
|
|
|
2000-02-11 19:45:17 +00:00
|
|
|
static struct ispmdvec mdvec_12160 = {
|
2001-08-31 21:39:04 +00:00
|
|
|
isp_pci_rd_isr,
|
2000-02-11 19:45:17 +00:00
|
|
|
isp_pci_rd_reg_1080,
|
|
|
|
isp_pci_wr_reg_1080,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_common_dmateardown,
|
2006-12-16 05:54:29 +00:00
|
|
|
isp_pci_reset0,
|
2000-02-11 19:45:17 +00:00
|
|
|
isp_pci_reset1,
|
|
|
|
isp_pci_dumpregs,
|
2000-06-18 05:18:55 +00:00
|
|
|
NULL,
|
2000-08-01 05:16:49 +00:00
|
|
|
BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
|
2000-02-11 19:45:17 +00:00
|
|
|
};
|
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
static struct ispmdvec mdvec_2100 = {
|
2001-08-31 21:39:04 +00:00
|
|
|
isp_pci_rd_isr,
|
1998-04-22 18:12:29 +00:00
|
|
|
isp_pci_rd_reg,
|
|
|
|
isp_pci_wr_reg,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_common_dmateardown,
|
2006-12-16 05:54:29 +00:00
|
|
|
isp_pci_reset0,
|
1998-04-22 18:12:29 +00:00
|
|
|
isp_pci_reset1,
|
2000-08-01 05:16:49 +00:00
|
|
|
isp_pci_dumpregs
|
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 struct ispmdvec mdvec_2200 = {
|
2001-08-31 21:39:04 +00:00
|
|
|
isp_pci_rd_isr,
|
|
|
|
isp_pci_rd_reg,
|
|
|
|
isp_pci_wr_reg,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_common_dmateardown,
|
2006-12-16 05:54:29 +00:00
|
|
|
isp_pci_reset0,
|
2001-08-31 21:39:04 +00:00
|
|
|
isp_pci_reset1,
|
|
|
|
isp_pci_dumpregs
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ispmdvec mdvec_2300 = {
|
|
|
|
isp_pci_rd_isr_2300,
|
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_rd_reg,
|
|
|
|
isp_pci_wr_reg,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_common_dmateardown,
|
2006-12-16 05:54:29 +00:00
|
|
|
isp_pci_reset0,
|
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_reset1,
|
2000-08-01 05:16:49 +00:00
|
|
|
isp_pci_dumpregs
|
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-02-09 01:12:52 +00:00
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
static struct ispmdvec mdvec_2400 = {
|
|
|
|
isp_pci_rd_isr_2400,
|
|
|
|
isp_pci_rd_reg_2400,
|
|
|
|
isp_pci_wr_reg_2400,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_common_dmateardown,
|
2006-12-16 05:54:29 +00:00
|
|
|
isp_pci_reset0,
|
2006-11-02 03:21:32 +00:00
|
|
|
isp_pci_reset1,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
static struct ispmdvec mdvec_2500 = {
|
|
|
|
isp_pci_rd_isr_2400,
|
|
|
|
isp_pci_rd_reg_2400,
|
|
|
|
isp_pci_wr_reg_2400,
|
|
|
|
isp_pci_mbxdma,
|
|
|
|
isp_pci_dmasetup,
|
|
|
|
isp_common_dmateardown,
|
|
|
|
isp_pci_reset0,
|
|
|
|
isp_pci_reset1,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
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
|
2006-07-03 08:24:09 +00:00
|
|
|
#ifndef PCIM_CMD_INTX_DISABLE
|
|
|
|
#define PCIM_CMD_INTX_DISABLE 0x0400
|
|
|
|
#endif
|
1999-02-09 01:12:52 +00:00
|
|
|
|
|
|
|
#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
|
2000-06-18 05:18:55 +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
|
|
|
|
|
2002-10-11 17:28:01 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP10160
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP10160 0x1016
|
|
|
|
#endif
|
|
|
|
|
2000-02-11 19:45:17 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP12160
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP12160 0x1216
|
|
|
|
#endif
|
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP1240
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP1240 0x1240
|
|
|
|
#endif
|
1998-04-22 18:12:29 +00:00
|
|
|
|
1999-12-16 05:42:02 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP1280
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP1280 0x1280
|
|
|
|
#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
|
|
|
|
|
2001-08-31 21:39:04 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP2300
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP2300 0x2300
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP2312
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP2312 0x2312
|
|
|
|
#endif
|
|
|
|
|
2006-01-23 06:23:37 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP2322
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP2322 0x2322
|
|
|
|
#endif
|
|
|
|
|
2006-01-26 05:04:35 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP2422
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP2422 0x2422
|
|
|
|
#endif
|
|
|
|
|
2007-02-10 03:33:09 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP2432
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP2432 0x2432
|
|
|
|
#endif
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP2532
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP2532 0x2532
|
|
|
|
#endif
|
|
|
|
|
2005-01-23 06:23:55 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP6312
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP6312 0x6312
|
|
|
|
#endif
|
|
|
|
|
Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.
Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.
However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.
For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.
This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.
We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).
Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after: 2 months
2006-07-09 17:50:20 +00:00
|
|
|
#ifndef PCI_PRODUCT_QLOGIC_ISP6322
|
|
|
|
#define PCI_PRODUCT_QLOGIC_ISP6322 0x6322
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-06-18 05:18:55 +00:00
|
|
|
#define PCI_QLOGIC_ISP1020 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP1020 << 16) | PCI_VENDOR_QLOGIC)
|
1999-03-17 05:07:18 +00:00
|
|
|
|
|
|
|
#define PCI_QLOGIC_ISP1080 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP1080 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
2002-10-11 17:28:01 +00:00
|
|
|
#define PCI_QLOGIC_ISP10160 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP10160 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
2000-02-11 19:45:17 +00:00
|
|
|
#define PCI_QLOGIC_ISP12160 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP12160 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
#define PCI_QLOGIC_ISP1240 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP1240 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
1999-12-16 05:42:02 +00:00
|
|
|
#define PCI_QLOGIC_ISP1280 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP1280 << 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)
|
|
|
|
|
2001-08-31 21:39:04 +00:00
|
|
|
#define PCI_QLOGIC_ISP2300 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP2300 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
|
|
|
#define PCI_QLOGIC_ISP2312 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP2312 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
2006-01-23 06:23:37 +00:00
|
|
|
#define PCI_QLOGIC_ISP2322 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP2322 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
2006-01-26 06:15:58 +00:00
|
|
|
#define PCI_QLOGIC_ISP2422 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP2422 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
2007-02-10 03:33:09 +00:00
|
|
|
#define PCI_QLOGIC_ISP2432 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP2432 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
#define PCI_QLOGIC_ISP2532 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP2532 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
2005-01-23 06:23:55 +00:00
|
|
|
#define PCI_QLOGIC_ISP6312 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP6312 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.
Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.
However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.
For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.
This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.
We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).
Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after: 2 months
2006-07-09 17:50:20 +00:00
|
|
|
#define PCI_QLOGIC_ISP6322 \
|
|
|
|
((PCI_PRODUCT_QLOGIC_ISP6322 << 16) | PCI_VENDOR_QLOGIC)
|
|
|
|
|
2000-09-07 20:27:40 +00:00
|
|
|
/*
|
|
|
|
* Odd case for some AMI raid cards... We need to *not* attach to this.
|
|
|
|
*/
|
|
|
|
#define AMI_RAID_SUBVENDOR_ID 0x101e
|
|
|
|
|
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
|
|
|
|
2000-02-11 19:45:17 +00:00
|
|
|
static int isp_pci_probe (device_t);
|
|
|
|
static int isp_pci_attach (device_t);
|
2006-11-02 03:21:32 +00:00
|
|
|
static int isp_pci_detach (device_t);
|
1998-04-22 18:12:29 +00:00
|
|
|
|
2002-04-02 23:36:14 +00:00
|
|
|
|
2007-05-11 06:28:26 +00:00
|
|
|
#define ISP_PCD(isp) ((struct isp_pcisoftc *)isp)->pci_dev
|
1998-04-22 18:12:29 +00:00
|
|
|
struct isp_pcisoftc {
|
2006-04-21 18:30:01 +00:00
|
|
|
ispsoftc_t pci_isp;
|
2000-02-11 19:45:17 +00:00
|
|
|
device_t pci_dev;
|
|
|
|
struct resource * pci_reg;
|
|
|
|
void * ih;
|
1999-03-17 05:07:18 +00:00
|
|
|
int16_t pci_poff[_NREG_BLKS];
|
2002-04-02 23:36:14 +00:00
|
|
|
bus_dma_tag_t dmat;
|
2007-05-05 20:17:23 +00:00
|
|
|
int msicount;
|
1998-04-22 18:12:29 +00:00
|
|
|
};
|
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
|
2000-02-11 19:45:17 +00:00
|
|
|
static device_method_t isp_pci_methods[] = {
|
|
|
|
/* Device interface */
|
|
|
|
DEVMETHOD(device_probe, isp_pci_probe),
|
|
|
|
DEVMETHOD(device_attach, isp_pci_attach),
|
2006-11-02 03:21:32 +00:00
|
|
|
DEVMETHOD(device_detach, isp_pci_detach),
|
2000-02-11 19:45:17 +00:00
|
|
|
{ 0, 0 }
|
1998-04-22 18:12:29 +00:00
|
|
|
};
|
|
|
|
|
2000-02-11 19:45:17 +00:00
|
|
|
static driver_t isp_pci_driver = {
|
|
|
|
"isp", isp_pci_methods, sizeof (struct isp_pcisoftc)
|
|
|
|
};
|
|
|
|
static devclass_t isp_devclass;
|
|
|
|
DRIVER_MODULE(isp, pci, isp_pci_driver, isp_devclass, 0, 0);
|
1998-04-22 18:12:29 +00:00
|
|
|
|
2000-02-11 19:45:17 +00:00
|
|
|
static int
|
|
|
|
isp_pci_probe(device_t dev)
|
1999-03-17 05:07:18 +00:00
|
|
|
{
|
2009-08-01 01:04:26 +00:00
|
|
|
switch ((pci_get_device(dev) << 16) | (pci_get_vendor(dev))) {
|
2000-06-18 05:18:55 +00:00
|
|
|
case PCI_QLOGIC_ISP1020:
|
2000-02-11 19:45:17 +00:00
|
|
|
device_set_desc(dev, "Qlogic ISP 1020/1040 PCI SCSI Adapter");
|
1999-03-17 05:07:18 +00:00
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP1080:
|
2000-02-11 19:45:17 +00:00
|
|
|
device_set_desc(dev, "Qlogic ISP 1080 PCI SCSI Adapter");
|
1999-05-11 04:53:57 +00:00
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP1240:
|
2000-02-11 19:45:17 +00:00
|
|
|
device_set_desc(dev, "Qlogic ISP 1240 PCI SCSI Adapter");
|
1998-04-22 18:12:29 +00:00
|
|
|
break;
|
1999-12-16 05:42:02 +00:00
|
|
|
case PCI_QLOGIC_ISP1280:
|
2000-02-11 19:45:17 +00:00
|
|
|
device_set_desc(dev, "Qlogic ISP 1280 PCI SCSI Adapter");
|
|
|
|
break;
|
2002-10-11 17:28:01 +00:00
|
|
|
case PCI_QLOGIC_ISP10160:
|
|
|
|
device_set_desc(dev, "Qlogic ISP 10160 PCI SCSI Adapter");
|
|
|
|
break;
|
2000-02-11 19:45:17 +00:00
|
|
|
case PCI_QLOGIC_ISP12160:
|
2000-09-07 20:27:40 +00:00
|
|
|
if (pci_get_subvendor(dev) == AMI_RAID_SUBVENDOR_ID) {
|
|
|
|
return (ENXIO);
|
|
|
|
}
|
2000-02-11 19:45:17 +00:00
|
|
|
device_set_desc(dev, "Qlogic ISP 12160 PCI SCSI Adapter");
|
1999-12-16 05:42:02 +00:00
|
|
|
break;
|
1998-04-22 18:12:29 +00:00
|
|
|
case PCI_QLOGIC_ISP2100:
|
2000-02-11 19:45:17 +00:00
|
|
|
device_set_desc(dev, "Qlogic ISP 2100 PCI FC-AL Adapter");
|
1998-04-22 18:12:29 +00:00
|
|
|
break;
|
1999-07-05 20:24:46 +00:00
|
|
|
case PCI_QLOGIC_ISP2200:
|
2000-02-11 19:45:17 +00:00
|
|
|
device_set_desc(dev, "Qlogic ISP 2200 PCI FC-AL Adapter");
|
1999-07-05 20:24:46 +00:00
|
|
|
break;
|
2001-08-31 21:39:04 +00:00
|
|
|
case PCI_QLOGIC_ISP2300:
|
|
|
|
device_set_desc(dev, "Qlogic ISP 2300 PCI FC-AL Adapter");
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP2312:
|
|
|
|
device_set_desc(dev, "Qlogic ISP 2312 PCI FC-AL Adapter");
|
|
|
|
break;
|
2006-01-23 06:23:37 +00:00
|
|
|
case PCI_QLOGIC_ISP2322:
|
|
|
|
device_set_desc(dev, "Qlogic ISP 2322 PCI FC-AL Adapter");
|
|
|
|
break;
|
2006-01-26 05:04:35 +00:00
|
|
|
case PCI_QLOGIC_ISP2422:
|
|
|
|
device_set_desc(dev, "Qlogic ISP 2422 PCI FC-AL Adapter");
|
|
|
|
break;
|
2007-02-10 03:33:09 +00:00
|
|
|
case PCI_QLOGIC_ISP2432:
|
|
|
|
device_set_desc(dev, "Qlogic ISP 2432 PCI FC-AL Adapter");
|
|
|
|
break;
|
2009-08-01 01:04:26 +00:00
|
|
|
case PCI_QLOGIC_ISP2532:
|
|
|
|
device_set_desc(dev, "Qlogic ISP 2532 PCI FC-AL Adapter");
|
|
|
|
break;
|
2005-01-23 06:23:55 +00:00
|
|
|
case PCI_QLOGIC_ISP6312:
|
|
|
|
device_set_desc(dev, "Qlogic ISP 6312 PCI FC-AL Adapter");
|
|
|
|
break;
|
Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.
Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.
However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.
For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.
This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.
We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).
Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after: 2 months
2006-07-09 17:50:20 +00:00
|
|
|
case PCI_QLOGIC_ISP6322:
|
|
|
|
device_set_desc(dev, "Qlogic ISP 6322 PCI FC-AL Adapter");
|
|
|
|
break;
|
1998-04-22 18:12:29 +00:00
|
|
|
default:
|
2000-02-11 19:45:17 +00:00
|
|
|
return (ENXIO);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
2002-07-11 03:25:04 +00:00
|
|
|
if (isp_announced == 0 && bootverbose) {
|
2000-08-01 05:16:49 +00:00
|
|
|
printf("Qlogic ISP Driver, FreeBSD Version %d.%d, "
|
1999-10-17 19:03:11 +00:00
|
|
|
"Core Version %d.%d\n",
|
1998-09-15 10:06:23 +00:00
|
|
|
ISP_PLATFORM_VERSION_MAJOR, ISP_PLATFORM_VERSION_MINOR,
|
|
|
|
ISP_CORE_VERSION_MAJOR, ISP_CORE_VERSION_MINOR);
|
2002-07-11 03:25:04 +00:00
|
|
|
isp_announced++;
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
2000-06-18 05:18:55 +00:00
|
|
|
/*
|
|
|
|
* XXXX: Here is where we might load the f/w module
|
|
|
|
* XXXX: (or increase a reference count to it).
|
|
|
|
*/
|
2005-03-05 18:17:35 +00:00
|
|
|
return (BUS_PROBE_DEFAULT);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
|
2006-04-21 18:30:01 +00:00
|
|
|
static void
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_get_generic_options(device_t dev, ispsoftc_t *isp, int *nvp)
|
2006-04-21 18:30:01 +00:00
|
|
|
{
|
|
|
|
int tval;
|
2006-11-14 08:45:48 +00:00
|
|
|
|
1999-07-06 01:24:20 +00:00
|
|
|
/*
|
|
|
|
* Figure out if we're supposed to skip this one.
|
|
|
|
*/
|
2001-03-01 02:21:36 +00:00
|
|
|
tval = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "disable", &tval) == 0 && tval) {
|
2006-04-21 18:30:01 +00:00
|
|
|
device_printf(dev, "disabled at user request\n");
|
|
|
|
isp->isp_osinfo.disabled = 1;
|
|
|
|
return;
|
2001-02-11 03:53:23 +00:00
|
|
|
}
|
2001-03-01 02:21:36 +00:00
|
|
|
|
2006-04-21 18:30:01 +00:00
|
|
|
tval = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "fwload_disable", &tval) == 0 && tval != 0) {
|
2006-04-21 18:30:01 +00:00
|
|
|
isp->isp_confopts |= ISP_CFG_NORELOAD;
|
|
|
|
}
|
|
|
|
tval = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "ignore_nvram", &tval) == 0 && tval != 0) {
|
2006-04-21 18:30:01 +00:00
|
|
|
isp->isp_confopts |= ISP_CFG_NONVRAM;
|
|
|
|
}
|
2007-02-23 05:42:41 +00:00
|
|
|
tval = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
(void) resource_int_value(device_get_name(dev), device_get_unit(dev), "debug", &tval);
|
2007-02-23 05:42:41 +00:00
|
|
|
if (tval) {
|
|
|
|
isp->isp_dblev = tval;
|
|
|
|
} else {
|
|
|
|
isp->isp_dblev = ISP_LOGWARN|ISP_LOGERR;
|
|
|
|
}
|
|
|
|
if (bootverbose) {
|
|
|
|
isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO;
|
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
(void) resource_int_value(device_get_name(dev), device_get_unit(dev), "vports", &tval);
|
|
|
|
if (tval > 0 && tval < 127) {
|
|
|
|
*nvp = tval;
|
|
|
|
} else {
|
|
|
|
*nvp = 0;
|
|
|
|
}
|
|
|
|
tval = 1;
|
|
|
|
(void) resource_int_value(device_get_name(dev), device_get_unit(dev), "autoconfig", &tval);
|
|
|
|
isp_autoconfig = tval;
|
|
|
|
tval = 7;
|
|
|
|
(void) resource_int_value(device_get_name(dev), device_get_unit(dev), "quickboot_time", &tval);
|
|
|
|
isp_quickboot_time = tval;
|
2007-02-23 05:42:41 +00:00
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
tval = 0;
|
|
|
|
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "forcemulti", &tval) == 0 && tval != 0) {
|
|
|
|
isp->isp_osinfo.forcemulti = 1;
|
|
|
|
}
|
2007-02-23 05:42:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_get_pci_options(device_t dev, int *m1, int *m2)
|
|
|
|
{
|
|
|
|
int tval;
|
|
|
|
/*
|
|
|
|
* Which we should try first - memory mapping or i/o mapping?
|
|
|
|
*
|
|
|
|
* We used to try memory first followed by i/o on alpha, otherwise
|
|
|
|
* the reverse, but we should just try memory first all the time now.
|
|
|
|
*/
|
|
|
|
*m1 = PCIM_CMD_MEMEN;
|
|
|
|
*m2 = PCIM_CMD_PORTEN;
|
|
|
|
|
|
|
|
tval = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "prefer_iomap", &tval) == 0 && tval != 0) {
|
2007-02-23 05:42:41 +00:00
|
|
|
*m1 = PCIM_CMD_PORTEN;
|
|
|
|
*m2 = PCIM_CMD_MEMEN;
|
|
|
|
}
|
|
|
|
tval = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "prefer_memmap", &tval) == 0 && tval != 0) {
|
2007-02-23 05:42:41 +00:00
|
|
|
*m1 = PCIM_CMD_MEMEN;
|
|
|
|
*m2 = PCIM_CMD_PORTEN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp)
|
2007-02-23 05:42:41 +00:00
|
|
|
{
|
|
|
|
const char *sptr;
|
|
|
|
int tval;
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "iid", &tval)) {
|
2007-02-23 05:42:41 +00:00
|
|
|
if (IS_FC(isp)) {
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->default_id = 109 - chan;
|
2007-02-23 05:42:41 +00:00
|
|
|
} else {
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_SPI_PC(isp, chan)->iid = 7;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (IS_FC(isp)) {
|
|
|
|
ISP_FC_PC(isp, chan)->default_id = tval - chan;
|
|
|
|
} else {
|
|
|
|
ISP_SPI_PC(isp, chan)->iid = tval;
|
|
|
|
}
|
|
|
|
isp->isp_confopts |= ISP_CFG_OWNLOOPID;
|
|
|
|
}
|
|
|
|
|
|
|
|
tval = -1;
|
|
|
|
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "role", &tval) == 0) {
|
|
|
|
switch (tval) {
|
|
|
|
case ISP_ROLE_NONE:
|
|
|
|
case ISP_ROLE_INITIATOR:
|
|
|
|
case ISP_ROLE_TARGET:
|
|
|
|
case ISP_ROLE_INITIATOR|ISP_ROLE_TARGET:
|
|
|
|
device_printf(dev, "setting role to 0x%x\n", tval);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
tval = -1;
|
|
|
|
break;
|
2007-02-23 05:42:41 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
if (tval == -1) {
|
|
|
|
tval = ISP_DEFAULT_ROLES;
|
|
|
|
}
|
2007-02-23 05:42:41 +00:00
|
|
|
|
|
|
|
if (IS_SCSI(isp)) {
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_SPI_PC(isp, chan)->role = tval;
|
2007-02-23 05:42:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->role = tval;
|
2007-02-23 05:42:41 +00:00
|
|
|
|
2006-04-21 18:30:01 +00:00
|
|
|
tval = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "fullduplex", &tval) == 0 && tval != 0) {
|
2006-04-21 18:30:01 +00:00
|
|
|
isp->isp_confopts |= ISP_CFG_FULL_DUPLEX;
|
|
|
|
}
|
|
|
|
sptr = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
if (resource_string_value(device_get_name(dev), device_get_unit(dev), "topology", (const char **) &sptr) == 0 && sptr != 0) {
|
2006-04-21 18:30:01 +00:00
|
|
|
if (strcmp(sptr, "lport") == 0) {
|
|
|
|
isp->isp_confopts |= ISP_CFG_LPORT;
|
|
|
|
} else if (strcmp(sptr, "nport") == 0) {
|
|
|
|
isp->isp_confopts |= ISP_CFG_NPORT;
|
|
|
|
} else if (strcmp(sptr, "lport-only") == 0) {
|
|
|
|
isp->isp_confopts |= ISP_CFG_LPORT_ONLY;
|
|
|
|
} else if (strcmp(sptr, "nport-only") == 0) {
|
|
|
|
isp->isp_confopts |= ISP_CFG_NPORT_ONLY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Because the resource_*_value functions can neither return
|
|
|
|
* 64 bit integer values, nor can they be directly coerced
|
|
|
|
* to interpret the right hand side of the assignment as
|
|
|
|
* you want them to interpret it, we have to force WWN
|
|
|
|
* hint replacement to specify WWN strings with a leading
|
|
|
|
* 'w' (e..g w50000000aaaa0001). Sigh.
|
|
|
|
*/
|
|
|
|
sptr = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
tval = resource_string_value(device_get_name(dev), device_get_unit(dev), "portwwn", (const char **) &sptr);
|
2006-04-21 18:30:01 +00:00
|
|
|
if (tval == 0 && sptr != 0 && *sptr++ == 'w') {
|
|
|
|
char *eptr = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->def_wwpn = strtouq(sptr, &eptr, 16);
|
|
|
|
if (eptr < sptr + 16 || ISP_FC_PC(isp, chan)->def_wwpn == -1) {
|
2006-04-21 18:30:01 +00:00
|
|
|
device_printf(dev, "mangled portwwn hint '%s'\n", sptr);
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->def_wwpn = 0;
|
2006-04-21 18:30:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sptr = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
tval = resource_string_value(device_get_name(dev), device_get_unit(dev), "nodewwn", (const char **) &sptr);
|
2006-04-21 18:30:01 +00:00
|
|
|
if (tval == 0 && sptr != 0 && *sptr++ == 'w') {
|
|
|
|
char *eptr = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->def_wwnn = strtouq(sptr, &eptr, 16);
|
|
|
|
if (eptr < sptr + 16 || ISP_FC_PC(isp, chan)->def_wwnn == 0) {
|
2006-04-21 18:30:01 +00:00
|
|
|
device_printf(dev, "mangled nodewwn hint '%s'\n", sptr);
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->def_wwnn = 0;
|
2006-04-21 18:30:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
tval = 0;
|
2009-08-01 01:04:26 +00:00
|
|
|
(void) resource_int_value(device_get_name(dev), device_get_unit(dev), "hysteresis", &tval);
|
2006-11-02 03:21:32 +00:00
|
|
|
if (tval >= 0 && tval < 256) {
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->hysteresis = tval;
|
2006-11-02 03:21:32 +00:00
|
|
|
} else {
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->hysteresis = isp_fabric_hysteresis;
|
2006-11-02 03:21:32 +00:00
|
|
|
}
|
|
|
|
|
2006-11-14 08:45:48 +00:00
|
|
|
tval = -1;
|
2009-08-01 01:04:26 +00:00
|
|
|
(void) resource_int_value(device_get_name(dev), device_get_unit(dev), "loop_down_limit", &tval);
|
2006-11-02 03:21:32 +00:00
|
|
|
if (tval >= 0 && tval < 0xffff) {
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->loop_down_limit = tval;
|
2006-11-02 03:21:32 +00:00
|
|
|
} else {
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->loop_down_limit = isp_loop_down_limit;
|
2006-11-02 03:21:32 +00:00
|
|
|
}
|
|
|
|
|
2006-11-14 08:45:48 +00:00
|
|
|
tval = -1;
|
2009-08-01 01:04:26 +00:00
|
|
|
(void) resource_int_value(device_get_name(dev), device_get_unit(dev), "gone_device_time", &tval);
|
2006-11-14 08:45:48 +00:00
|
|
|
if (tval >= 0 && tval < 0xffff) {
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->gone_device_time = tval;
|
2006-11-14 08:45:48 +00:00
|
|
|
} else {
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_FC_PC(isp, chan)->gone_device_time = isp_gone_device_time;
|
2006-11-14 08:45:48 +00:00
|
|
|
}
|
2006-04-21 18:30:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
isp_pci_attach(device_t dev)
|
|
|
|
{
|
|
|
|
struct resource *regs, *irq;
|
2009-08-01 01:04:26 +00:00
|
|
|
int rtp, rgd, iqd, i, m1, m2, locksetup = 0;
|
|
|
|
int isp_nvports = 0;
|
|
|
|
uint32_t data, cmd, linesz, did;
|
2006-04-21 18:30:01 +00:00
|
|
|
struct isp_pcisoftc *pcs;
|
|
|
|
ispsoftc_t *isp = NULL;
|
2009-08-01 01:04:26 +00:00
|
|
|
size_t psize, xsize;
|
|
|
|
char fwname[32];
|
2006-04-21 18:30:01 +00:00
|
|
|
|
|
|
|
pcs = device_get_softc(dev);
|
|
|
|
if (pcs == NULL) {
|
|
|
|
device_printf(dev, "cannot get softc\n");
|
|
|
|
return (ENOMEM);
|
|
|
|
}
|
|
|
|
memset(pcs, 0, sizeof (*pcs));
|
2009-08-01 01:04:26 +00:00
|
|
|
|
2006-04-21 18:30:01 +00:00
|
|
|
pcs->pci_dev = dev;
|
|
|
|
isp = &pcs->pci_isp;
|
2009-08-01 01:04:26 +00:00
|
|
|
isp->isp_dev = dev;
|
|
|
|
isp->isp_nchan = 1;
|
2006-04-21 18:30:01 +00:00
|
|
|
|
|
|
|
/*
|
2007-02-23 05:42:41 +00:00
|
|
|
* Get Generic Options
|
2006-04-21 18:30:01 +00:00
|
|
|
*/
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_get_generic_options(dev, isp, &isp_nvports);
|
2006-04-21 18:30:01 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if options have us disabled
|
|
|
|
*/
|
|
|
|
if (isp->isp_osinfo.disabled) {
|
|
|
|
/*
|
|
|
|
* But return zero to preserve unit numbering
|
|
|
|
*/
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get PCI options- which in this case are just mapping preferences.
|
|
|
|
*/
|
|
|
|
isp_get_pci_options(dev, &m1, &m2);
|
|
|
|
|
1999-04-04 01:14:02 +00:00
|
|
|
linesz = PCI_DFLT_LNSZ;
|
2000-02-11 19:45:17 +00:00
|
|
|
irq = regs = NULL;
|
|
|
|
rgd = rtp = iqd = 0;
|
|
|
|
|
2005-05-11 03:00:50 +00:00
|
|
|
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
|
2000-02-11 19:45:17 +00:00
|
|
|
if (cmd & m1) {
|
|
|
|
rtp = (m1 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT;
|
|
|
|
rgd = (m1 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG;
|
2004-03-17 17:50:55 +00:00
|
|
|
regs = bus_alloc_resource_any(dev, rtp, &rgd, RF_ACTIVE);
|
1999-02-09 01:12:52 +00:00
|
|
|
}
|
2000-02-11 19:45:17 +00:00
|
|
|
if (regs == NULL && (cmd & m2)) {
|
|
|
|
rtp = (m2 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT;
|
|
|
|
rgd = (m2 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG;
|
2004-03-17 17:50:55 +00:00
|
|
|
regs = bus_alloc_resource_any(dev, rtp, &rgd, RF_ACTIVE);
|
2000-02-11 19:45:17 +00:00
|
|
|
}
|
|
|
|
if (regs == NULL) {
|
|
|
|
device_printf(dev, "unable to map any ports\n");
|
|
|
|
goto bad;
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
2006-04-21 18:30:01 +00:00
|
|
|
if (bootverbose) {
|
2009-08-01 01:04:26 +00:00
|
|
|
device_printf(dev, "using %s space register mapping\n", (rgd == IO_MAP_REG)? "I/O" : "Memory");
|
2006-04-21 18:30:01 +00:00
|
|
|
}
|
2007-03-13 06:46:08 +00:00
|
|
|
isp->isp_bus_tag = rman_get_bustag(regs);
|
|
|
|
isp->isp_bus_handle = rman_get_bushandle(regs);
|
1998-04-22 18:12:29 +00:00
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
pcs->pci_dev = dev;
|
|
|
|
pcs->pci_reg = regs;
|
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;
|
2009-08-01 01:04:26 +00:00
|
|
|
|
|
|
|
switch (pci_get_devid(dev)) {
|
|
|
|
case PCI_QLOGIC_ISP1020:
|
|
|
|
did = 0x1040;
|
|
|
|
isp->isp_mdvec = &mdvec;
|
|
|
|
isp->isp_type = ISP_HA_SCSI_UNKNOWN;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP1080:
|
|
|
|
did = 0x1080;
|
|
|
|
isp->isp_mdvec = &mdvec_1080;
|
|
|
|
isp->isp_type = ISP_HA_SCSI_1080;
|
|
|
|
pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP1240:
|
|
|
|
did = 0x1080;
|
|
|
|
isp->isp_mdvec = &mdvec_1080;
|
|
|
|
isp->isp_type = ISP_HA_SCSI_1240;
|
|
|
|
isp->isp_nchan = 2;
|
|
|
|
pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP1280:
|
|
|
|
did = 0x1080;
|
|
|
|
isp->isp_mdvec = &mdvec_1080;
|
|
|
|
isp->isp_type = ISP_HA_SCSI_1280;
|
|
|
|
pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP10160:
|
|
|
|
did = 0x12160;
|
|
|
|
isp->isp_mdvec = &mdvec_12160;
|
|
|
|
isp->isp_type = ISP_HA_SCSI_10160;
|
|
|
|
pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP12160:
|
|
|
|
did = 0x12160;
|
|
|
|
isp->isp_nchan = 2;
|
|
|
|
isp->isp_mdvec = &mdvec_12160;
|
|
|
|
isp->isp_type = ISP_HA_SCSI_12160;
|
|
|
|
pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = ISP1080_DMA_REGS_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP2100:
|
|
|
|
did = 0x2100;
|
|
|
|
isp->isp_mdvec = &mdvec_2100;
|
|
|
|
isp->isp_type = ISP_HA_FC_2100;
|
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2100_OFF;
|
2000-02-11 19:45:17 +00:00
|
|
|
if (pci_get_revid(dev) < 3) {
|
1999-04-04 01:14:02 +00:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP2200:
|
|
|
|
did = 0x2200;
|
|
|
|
isp->isp_mdvec = &mdvec_2200;
|
|
|
|
isp->isp_type = ISP_HA_FC_2200;
|
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2100_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP2300:
|
|
|
|
did = 0x2300;
|
|
|
|
isp->isp_mdvec = &mdvec_2300;
|
|
|
|
isp->isp_type = ISP_HA_FC_2300;
|
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2300_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP2312:
|
|
|
|
case PCI_QLOGIC_ISP6312:
|
|
|
|
did = 0x2300;
|
|
|
|
isp->isp_mdvec = &mdvec_2300;
|
|
|
|
isp->isp_type = ISP_HA_FC_2312;
|
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2300_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP2322:
|
|
|
|
case PCI_QLOGIC_ISP6322:
|
|
|
|
did = 0x2322;
|
|
|
|
isp->isp_mdvec = &mdvec_2300;
|
|
|
|
isp->isp_type = ISP_HA_FC_2322;
|
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2300_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP2422:
|
|
|
|
case PCI_QLOGIC_ISP2432:
|
|
|
|
did = 0x2400;
|
|
|
|
isp->isp_nchan += isp_nvports;
|
|
|
|
isp->isp_mdvec = &mdvec_2400;
|
|
|
|
isp->isp_type = ISP_HA_FC_2400;
|
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2400_OFF;
|
|
|
|
break;
|
|
|
|
case PCI_QLOGIC_ISP2532:
|
|
|
|
did = 0x2500;
|
|
|
|
isp->isp_nchan += isp_nvports;
|
|
|
|
isp->isp_mdvec = &mdvec_2500;
|
|
|
|
isp->isp_type = ISP_HA_FC_2500;
|
|
|
|
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2400_OFF;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
device_printf(dev, "unknown device type\n");
|
|
|
|
goto bad;
|
|
|
|
break;
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
isp->isp_revision = pci_get_revid(dev);
|
|
|
|
|
|
|
|
if (IS_FC(isp)) {
|
2006-01-26 05:04:35 +00:00
|
|
|
psize = sizeof (fcparam);
|
2009-08-01 01:04:26 +00:00
|
|
|
xsize = sizeof (struct isp_fc);
|
|
|
|
} else {
|
|
|
|
psize = sizeof (sdparam);
|
|
|
|
xsize = sizeof (struct isp_spi);
|
2006-01-26 05:04:35 +00:00
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
psize *= isp->isp_nchan;
|
|
|
|
xsize *= isp->isp_nchan;
|
2000-12-08 21:51:06 +00:00
|
|
|
isp->isp_param = malloc(psize, M_DEVBUF, M_NOWAIT | M_ZERO);
|
1999-05-11 04:53:57 +00:00
|
|
|
if (isp->isp_param == NULL) {
|
2000-02-11 19:45:17 +00:00
|
|
|
device_printf(dev, "cannot allocate parameter data\n");
|
|
|
|
goto bad;
|
1999-05-11 04:53:57 +00:00
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
isp->isp_osinfo.pc.ptr = malloc(xsize, M_DEVBUF, M_NOWAIT | M_ZERO);
|
|
|
|
if (isp->isp_osinfo.pc.ptr == NULL) {
|
|
|
|
device_printf(dev, "cannot allocate parameter data\n");
|
|
|
|
goto bad;
|
|
|
|
}
|
1998-04-22 18:12:29 +00:00
|
|
|
|
2007-02-23 05:42:41 +00:00
|
|
|
/*
|
|
|
|
* Now that we know who we are (roughly) get/set specific options
|
|
|
|
*/
|
2009-08-01 01:04:26 +00:00
|
|
|
for (i = 0; i < isp->isp_nchan; i++) {
|
|
|
|
isp_get_specific_options(dev, i, isp);
|
|
|
|
}
|
2007-02-23 05:42:41 +00:00
|
|
|
|
2000-06-18 05:18:55 +00:00
|
|
|
/*
|
2009-08-01 01:04:26 +00:00
|
|
|
* The 'it' suffix really only matters for SCSI cards in target mode.
|
2000-06-18 05:18:55 +00:00
|
|
|
*/
|
2009-08-01 01:04:26 +00:00
|
|
|
isp->isp_osinfo.fw = NULL;
|
|
|
|
if (IS_SCSI(isp) && (ISP_SPI_PC(isp, 0)->role & ISP_ROLE_TARGET)) {
|
|
|
|
snprintf(fwname, sizeof (fwname), "isp_%04x_it", did);
|
|
|
|
isp->isp_osinfo.fw = firmware_get(fwname);
|
|
|
|
} else if (IS_24XX(isp) && (isp->isp_nchan > 1 || isp->isp_osinfo.forcemulti)) {
|
|
|
|
snprintf(fwname, sizeof (fwname), "isp_%04x_multi", did);
|
|
|
|
isp->isp_osinfo.fw = firmware_get(fwname);
|
Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.
Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.
However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.
For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.
This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.
We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).
Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after: 2 months
2006-07-09 17:50:20 +00:00
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
if (isp->isp_osinfo.fw == NULL) {
|
|
|
|
snprintf(fwname, sizeof (fwname), "isp_%04x", did);
|
|
|
|
isp->isp_osinfo.fw = firmware_get(fwname);
|
|
|
|
}
|
|
|
|
if (isp->isp_osinfo.fw != NULL) {
|
|
|
|
isp->isp_mdvec->dv_ispfw = isp->isp_osinfo.fw->data;
|
2000-06-18 05:18:55 +00:00
|
|
|
}
|
|
|
|
|
1999-02-09 01:12:52 +00:00
|
|
|
/*
|
|
|
|
* Make sure that SERR, PERR, WRITE INVALIDATE and BUSMASTER
|
|
|
|
* are set.
|
|
|
|
*/
|
2000-02-11 19:45:17 +00:00
|
|
|
cmd |= PCIM_CMD_SEREN | PCIM_CMD_PERRESPEN |
|
|
|
|
PCIM_CMD_BUSMASTEREN | PCIM_CMD_INVEN;
|
Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.
Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.
However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.
For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.
This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.
We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).
Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after: 2 months
2006-07-09 17:50:20 +00:00
|
|
|
|
2002-02-04 21:04:25 +00:00
|
|
|
if (IS_2300(isp)) { /* per QLogic errata */
|
|
|
|
cmd &= ~PCIM_CMD_INVEN;
|
|
|
|
}
|
Convert isp(4) and ispfw(4) to use firmware(9) to manage firmware
loading for the QLogic cards.
Because isp(4) exists before the root is mounted, it's not really
possible for us to use the kernel's linker to load modules directly
from disk- that's really too bad.
However, the this is still a net win in in that the firmware has
been split up on a per chip (and in some cases, functionality)
basis, so the amount of stuff loaded *can* be substantially less
than the 1.5MB of firmware images that ispfw now manages. That is,
each specific f/w set is now also built as a module. For example,
QLogic 2322 f/w is built as isp_2322.ko and Initiator/Target 1080
firmware is built as isp_1080_it.ko.
For compatibility purposes (i.e., to perturb folks the least), we
also still build all of the firmware as one ispfw.ko module.
This allows us to let 'ispfw_LOAD' keep on working in existing
loader.conf files. If you now want to strip this down to just
the firmware for your h/w, you can then change loader.conf to
load the f/w you specifically want.
We also still allow for ispfw to be statically built (e.g., for
PAE and sparc64).
Future changes will look at f/w unloading and also role switching
that then uses the kernel linker to load different ips f/w sets.
MFC after: 2 months
2006-07-09 17:50:20 +00:00
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
if (IS_2322(isp) || pci_get_devid(dev) == PCI_QLOGIC_ISP6312) {
|
|
|
|
cmd &= ~PCIM_CMD_INTX_DISABLE;
|
2002-06-16 04:58:00 +00:00
|
|
|
}
|
2006-07-03 08:24:09 +00:00
|
|
|
|
2006-12-18 23:53:39 +00:00
|
|
|
if (IS_24XX(isp)) {
|
|
|
|
cmd &= ~PCIM_CMD_INTX_DISABLE;
|
|
|
|
}
|
2006-07-03 08:24:09 +00:00
|
|
|
|
2005-05-11 03:00:50 +00:00
|
|
|
pci_write_config(dev, PCIR_COMMAND, cmd, 2);
|
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
|
|
|
*/
|
2000-02-11 19:45:17 +00:00
|
|
|
data = pci_read_config(dev, PCIR_CACHELNSZ, 1);
|
2007-03-13 06:46:08 +00:00
|
|
|
if (data == 0 || (linesz != PCI_DFLT_LNSZ && data != linesz)) {
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_prt(isp, ISP_LOGCONFIG, "set PCI line size to %d from %d", linesz, data);
|
2007-03-13 06:46:08 +00:00
|
|
|
data = linesz;
|
2000-02-11 19:45:17 +00:00
|
|
|
pci_write_config(dev, 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.
|
|
|
|
*/
|
2000-02-11 19:45:17 +00:00
|
|
|
data = pci_read_config(dev, PCIR_LATTIMER, 1);
|
1999-02-09 01:12:52 +00:00
|
|
|
if (data < PCI_DFLT_LTNCY) {
|
|
|
|
data = PCI_DFLT_LTNCY;
|
2000-08-01 05:16:49 +00:00
|
|
|
isp_prt(isp, ISP_LOGCONFIG, "set PCI latency to %d", data);
|
2000-02-11 19:45:17 +00:00
|
|
|
pci_write_config(dev, 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.
|
|
|
|
*/
|
2000-02-11 19:45:17 +00:00
|
|
|
data = pci_read_config(dev, PCIR_ROMADDR, 4);
|
1999-04-04 01:14:02 +00:00
|
|
|
data &= ~1;
|
2000-02-11 19:45:17 +00:00
|
|
|
pci_write_config(dev, PCIR_ROMADDR, data, 4);
|
2009-08-01 01:04:26 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Do MSI
|
|
|
|
*
|
|
|
|
* NB: MSI-X needs to be disabled for the 2432 (PCI-Express)
|
|
|
|
*/
|
2007-05-05 20:17:23 +00:00
|
|
|
if (IS_24XX(isp) || IS_2322(isp)) {
|
|
|
|
pcs->msicount = pci_msi_count(dev);
|
|
|
|
if (pcs->msicount > 1) {
|
|
|
|
pcs->msicount = 1;
|
|
|
|
}
|
|
|
|
if (pci_alloc_msi(dev, &pcs->msicount) == 0) {
|
|
|
|
iqd = 1;
|
|
|
|
} else {
|
|
|
|
iqd = 0;
|
|
|
|
}
|
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, RF_ACTIVE | RF_SHAREABLE);
|
2000-02-11 19:45:17 +00:00
|
|
|
if (irq == NULL) {
|
|
|
|
device_printf(dev, "could not allocate interrupt\n");
|
|
|
|
goto bad;
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
|
2000-12-29 19:10:16 +00:00
|
|
|
/* Make sure the lock is set up. */
|
2002-04-04 21:03:38 +00:00
|
|
|
mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF);
|
2000-12-29 19:10:16 +00:00
|
|
|
locksetup++;
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
if (isp_setup_intr(dev, irq, ISP_IFLAGS, NULL, isp_platform_intr, isp, &pcs->ih)) {
|
2000-02-11 19:45:17 +00:00
|
|
|
device_printf(dev, "could not setup interrupt\n");
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
|
2002-02-04 21:04:25 +00:00
|
|
|
/*
|
|
|
|
* Last minute checks...
|
|
|
|
*/
|
2006-11-02 03:21:32 +00:00
|
|
|
if (IS_23XX(isp) || IS_24XX(isp)) {
|
2002-02-04 21:04:25 +00:00
|
|
|
isp->isp_port = pci_get_function(dev);
|
|
|
|
}
|
|
|
|
|
2000-07-18 06:40:22 +00:00
|
|
|
/*
|
|
|
|
* Make sure we're in reset state.
|
|
|
|
*/
|
2000-10-25 04:40:49 +00:00
|
|
|
ISP_LOCK(isp);
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_reset(isp, 1);
|
1998-04-22 18:12:29 +00:00
|
|
|
if (isp->isp_state != ISP_RESETSTATE) {
|
2000-10-25 04:40:49 +00:00
|
|
|
ISP_UNLOCK(isp);
|
2000-02-11 19:45:17 +00:00
|
|
|
goto bad;
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
isp_init(isp);
|
2009-08-01 01:04:26 +00:00
|
|
|
if (isp->isp_state == ISP_INITSTATE) {
|
|
|
|
isp->isp_state = ISP_RUNSTATE;
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_UNLOCK(isp);
|
|
|
|
if (isp_attach(isp)) {
|
|
|
|
ISP_LOCK(isp);
|
2001-02-11 03:53:23 +00:00
|
|
|
isp_uninit(isp);
|
|
|
|
ISP_UNLOCK(isp);
|
|
|
|
goto bad;
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
2000-02-11 19:45:17 +00:00
|
|
|
return (0);
|
|
|
|
|
|
|
|
bad:
|
|
|
|
if (pcs && pcs->ih) {
|
|
|
|
(void) bus_teardown_intr(dev, irq, pcs->ih);
|
|
|
|
}
|
2000-10-25 04:40:49 +00:00
|
|
|
if (locksetup && isp) {
|
|
|
|
mtx_destroy(&isp->isp_osinfo.lock);
|
|
|
|
}
|
2000-02-11 19:45:17 +00:00
|
|
|
if (irq) {
|
|
|
|
(void) bus_release_resource(dev, SYS_RES_IRQ, iqd, irq);
|
|
|
|
}
|
2007-05-05 20:17:23 +00:00
|
|
|
if (pcs && pcs->msicount) {
|
|
|
|
pci_release_msi(dev);
|
|
|
|
}
|
2000-02-11 19:45:17 +00:00
|
|
|
if (regs) {
|
|
|
|
(void) bus_release_resource(dev, rtp, rgd, regs);
|
|
|
|
}
|
|
|
|
if (pcs) {
|
2006-04-21 18:30:01 +00:00
|
|
|
if (pcs->pci_isp.isp_param) {
|
2000-02-11 19:45:17 +00:00
|
|
|
free(pcs->pci_isp.isp_param, M_DEVBUF);
|
2009-08-01 01:04:26 +00:00
|
|
|
pcs->pci_isp.isp_param = NULL;
|
|
|
|
}
|
|
|
|
if (pcs->pci_isp.isp_osinfo.pc.ptr) {
|
|
|
|
free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF);
|
|
|
|
pcs->pci_isp.isp_osinfo.pc.ptr = NULL;
|
2006-04-21 18:30:01 +00:00
|
|
|
}
|
2000-02-11 19:45:17 +00:00
|
|
|
}
|
|
|
|
return (ENXIO);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
static int
|
|
|
|
isp_pci_detach(device_t dev)
|
|
|
|
{
|
|
|
|
struct isp_pcisoftc *pcs;
|
|
|
|
ispsoftc_t *isp;
|
|
|
|
|
|
|
|
pcs = device_get_softc(dev);
|
|
|
|
if (pcs == NULL) {
|
|
|
|
return (ENXIO);
|
|
|
|
}
|
|
|
|
isp = (ispsoftc_t *) pcs;
|
|
|
|
ISP_DISABLE_INTS(isp);
|
2009-08-01 01:04:26 +00:00
|
|
|
mtx_destroy(&isp->isp_osinfo.lock);
|
2006-11-02 03:21:32 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2001-08-31 21:39:04 +00:00
|
|
|
#define IspVirt2Off(a, x) \
|
|
|
|
(((struct isp_pcisoftc *)a)->pci_poff[((x) & _BLK_REG_MASK) >> \
|
2006-08-14 05:36:26 +00:00
|
|
|
_BLK_REG_SHFT] + ((x) & 0xfff))
|
2001-08-31 21:39:04 +00:00
|
|
|
|
2007-03-13 06:46:08 +00:00
|
|
|
#define BXR2(isp, off) \
|
|
|
|
bus_space_read_2(isp->isp_bus_tag, isp->isp_bus_handle, off)
|
|
|
|
#define BXW2(isp, off, v) \
|
|
|
|
bus_space_write_2(isp->isp_bus_tag, isp->isp_bus_handle, off, v)
|
|
|
|
#define BXR4(isp, off) \
|
|
|
|
bus_space_read_4(isp->isp_bus_tag, isp->isp_bus_handle, off)
|
|
|
|
#define BXW4(isp, off, v) \
|
|
|
|
bus_space_write_4(isp->isp_bus_tag, isp->isp_bus_handle, off, v)
|
2001-08-31 21:39:04 +00:00
|
|
|
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
static ISP_INLINE int
|
2006-04-21 18:30:01 +00:00
|
|
|
isp_pci_rd_debounced(ispsoftc_t *isp, int off, uint16_t *rp)
|
2001-08-31 21:39:04 +00:00
|
|
|
{
|
2006-11-02 03:21:32 +00:00
|
|
|
uint32_t val0, val1;
|
2001-08-31 21:39:04 +00:00
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
do {
|
2007-03-13 06:46:08 +00:00
|
|
|
val0 = BXR2(isp, IspVirt2Off(isp, off));
|
|
|
|
val1 = BXR2(isp, IspVirt2Off(isp, off));
|
2001-08-31 21:39:04 +00:00
|
|
|
} while (val0 != val1 && ++i < 1000);
|
|
|
|
if (val0 != val1) {
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
*rp = val0;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_pci_rd_isr(ispsoftc_t *isp, uint32_t *isrp, uint16_t *semap, uint16_t *mbp)
|
2001-08-31 21:39:04 +00:00
|
|
|
{
|
2006-02-15 00:31:48 +00:00
|
|
|
uint16_t isr, sema;
|
2001-08-31 21:39:04 +00:00
|
|
|
|
|
|
|
if (IS_2100(isp)) {
|
|
|
|
if (isp_pci_rd_debounced(isp, BIU_ISR, &isr)) {
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
if (isp_pci_rd_debounced(isp, BIU_SEMA, &sema)) {
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
} else {
|
2007-03-13 06:46:08 +00:00
|
|
|
isr = BXR2(isp, IspVirt2Off(isp, BIU_ISR));
|
|
|
|
sema = BXR2(isp, IspVirt2Off(isp, BIU_SEMA));
|
2001-08-31 21:39:04 +00:00
|
|
|
}
|
|
|
|
isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema);
|
|
|
|
isr &= INT_PENDING_MASK(isp);
|
|
|
|
sema &= BIU_SEMA_LOCK;
|
|
|
|
if (isr == 0 && sema == 0) {
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
*isrp = isr;
|
|
|
|
if ((*semap = sema) != 0) {
|
|
|
|
if (IS_2100(isp)) {
|
|
|
|
if (isp_pci_rd_debounced(isp, OUTMAILBOX0, mbp)) {
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
} else {
|
2007-03-13 06:46:08 +00:00
|
|
|
*mbp = BXR2(isp, IspVirt2Off(isp, OUTMAILBOX0));
|
2001-08-31 21:39:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-11-02 03:21:32 +00:00
|
|
|
isp_pci_rd_isr_2300(ispsoftc_t *isp, uint32_t *isrp,
|
2006-02-15 00:31:48 +00:00
|
|
|
uint16_t *semap, uint16_t *mbox0p)
|
2001-08-31 21:39:04 +00:00
|
|
|
{
|
2006-11-02 03:21:32 +00:00
|
|
|
uint32_t hccr;
|
2006-02-15 00:31:48 +00:00
|
|
|
uint32_t r2hisr;
|
2001-08-31 21:39:04 +00:00
|
|
|
|
2007-03-13 06:46:08 +00:00
|
|
|
if (!(BXR2(isp, IspVirt2Off(isp, BIU_ISR) & BIU2100_ISR_RISC_INT))) {
|
2001-10-06 19:34:43 +00:00
|
|
|
*isrp = 0;
|
2001-10-06 19:19:24 +00:00
|
|
|
return (0);
|
2001-10-06 19:34:43 +00:00
|
|
|
}
|
2007-03-13 06:46:08 +00:00
|
|
|
r2hisr = BXR4(isp, IspVirt2Off(isp, BIU_R2HSTSLO));
|
2001-08-31 21:39:04 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG3, "RISC2HOST ISR 0x%x", r2hisr);
|
|
|
|
if ((r2hisr & BIU_R2HST_INTR) == 0) {
|
|
|
|
*isrp = 0;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
switch (r2hisr & BIU_R2HST_ISTAT_MASK) {
|
|
|
|
case ISPR2HST_ROM_MBX_OK:
|
|
|
|
case ISPR2HST_ROM_MBX_FAIL:
|
|
|
|
case ISPR2HST_MBX_OK:
|
|
|
|
case ISPR2HST_MBX_FAIL:
|
|
|
|
case ISPR2HST_ASYNC_EVENT:
|
2002-08-17 17:21:54 +00:00
|
|
|
*isrp = r2hisr & 0xffff;
|
|
|
|
*mbox0p = (r2hisr >> 16);
|
|
|
|
*semap = 1;
|
|
|
|
return (1);
|
2002-02-04 21:04:25 +00:00
|
|
|
case ISPR2HST_RIO_16:
|
2002-08-17 17:21:54 +00:00
|
|
|
*isrp = r2hisr & 0xffff;
|
|
|
|
*mbox0p = ASYNC_RIO1;
|
|
|
|
*semap = 1;
|
|
|
|
return (1);
|
2001-08-31 21:39:04 +00:00
|
|
|
case ISPR2HST_FPOST:
|
2002-08-17 17:21:54 +00:00
|
|
|
*isrp = r2hisr & 0xffff;
|
|
|
|
*mbox0p = ASYNC_CMD_CMPLT;
|
|
|
|
*semap = 1;
|
|
|
|
return (1);
|
2001-08-31 21:39:04 +00:00
|
|
|
case ISPR2HST_FPOST_CTIO:
|
|
|
|
*isrp = r2hisr & 0xffff;
|
2002-08-17 17:21:54 +00:00
|
|
|
*mbox0p = ASYNC_CTIO_DONE;
|
2001-08-31 21:39:04 +00:00
|
|
|
*semap = 1;
|
|
|
|
return (1);
|
|
|
|
case ISPR2HST_RSPQ_UPDATE:
|
|
|
|
*isrp = r2hisr & 0xffff;
|
|
|
|
*mbox0p = 0;
|
|
|
|
*semap = 0;
|
|
|
|
return (1);
|
|
|
|
default:
|
2006-07-03 08:24:09 +00:00
|
|
|
hccr = ISP_READ(isp, HCCR);
|
|
|
|
if (hccr & HCCR_PAUSE) {
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_RESET);
|
|
|
|
isp_prt(isp, ISP_LOGERR,
|
2007-01-05 23:01:35 +00:00
|
|
|
"RISC paused at interrupt (%x->%x)", hccr,
|
2006-07-03 08:24:09 +00:00
|
|
|
ISP_READ(isp, HCCR));
|
2007-01-05 23:01:35 +00:00
|
|
|
ISP_WRITE(isp, BIU_ICR, 0);
|
2006-07-03 08:24:09 +00:00
|
|
|
} else {
|
2006-11-02 03:21:32 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "unknown interrupt 0x%x\n",
|
2006-07-03 08:24:09 +00:00
|
|
|
r2hisr);
|
|
|
|
}
|
2001-08-31 21:39:04 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
static int
|
|
|
|
isp_pci_rd_isr_2400(ispsoftc_t *isp, uint32_t *isrp,
|
|
|
|
uint16_t *semap, uint16_t *mbox0p)
|
|
|
|
{
|
|
|
|
uint32_t r2hisr;
|
|
|
|
|
2007-03-13 06:46:08 +00:00
|
|
|
r2hisr = BXR4(isp, IspVirt2Off(isp, BIU2400_R2HSTSLO));
|
2006-11-02 03:21:32 +00:00
|
|
|
isp_prt(isp, ISP_LOGDEBUG3, "RISC2HOST ISR 0x%x", r2hisr);
|
|
|
|
if ((r2hisr & BIU2400_R2HST_INTR) == 0) {
|
|
|
|
*isrp = 0;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
switch (r2hisr & BIU2400_R2HST_ISTAT_MASK) {
|
|
|
|
case ISP2400R2HST_ROM_MBX_OK:
|
|
|
|
case ISP2400R2HST_ROM_MBX_FAIL:
|
|
|
|
case ISP2400R2HST_MBX_OK:
|
|
|
|
case ISP2400R2HST_MBX_FAIL:
|
|
|
|
case ISP2400R2HST_ASYNC_EVENT:
|
|
|
|
*isrp = r2hisr & 0xffff;
|
|
|
|
*mbox0p = (r2hisr >> 16);
|
|
|
|
*semap = 1;
|
|
|
|
return (1);
|
|
|
|
case ISP2400R2HST_RSPQ_UPDATE:
|
|
|
|
case ISP2400R2HST_ATIO_RSPQ_UPDATE:
|
|
|
|
case ISP2400R2HST_ATIO_RQST_UPDATE:
|
|
|
|
*isrp = r2hisr & 0xffff;
|
|
|
|
*mbox0p = 0;
|
|
|
|
*semap = 0;
|
|
|
|
return (1);
|
|
|
|
default:
|
|
|
|
ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RISC_INT);
|
|
|
|
isp_prt(isp, ISP_LOGERR, "unknown interrupt 0x%x\n", r2hisr);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t
|
2006-04-21 18:30:01 +00:00
|
|
|
isp_pci_rd_reg(ispsoftc_t *isp, int regoff)
|
1999-03-17 05:07:18 +00:00
|
|
|
{
|
2007-03-13 06:46:08 +00:00
|
|
|
uint16_t rv;
|
2001-08-31 21:39:04 +00:00
|
|
|
int 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.
|
|
|
|
*/
|
2007-03-13 06:46:08 +00:00
|
|
|
oldconf = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
|
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1),
|
2001-08-31 21:39:04 +00:00
|
|
|
oldconf | BIU_PCI_CONF1_SXP);
|
2007-03-13 06:46:08 +00:00
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
1999-03-17 05:07:18 +00:00
|
|
|
}
|
2007-03-13 06:46:08 +00:00
|
|
|
rv = BXR2(isp, IspVirt2Off(isp, regoff));
|
1999-03-17 05:07:18 +00:00
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oldconf);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
1999-03-17 05:07:18 +00:00
|
|
|
}
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-11-02 03:21:32 +00:00
|
|
|
isp_pci_wr_reg(ispsoftc_t *isp, int regoff, uint32_t val)
|
1999-03-17 05:07:18 +00:00
|
|
|
{
|
2001-08-31 21:39:04 +00:00
|
|
|
int oldconf = 0;
|
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.
|
|
|
|
*/
|
2007-03-13 06:46:08 +00:00
|
|
|
oldconf = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
|
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1),
|
2001-08-31 21:39:04 +00:00
|
|
|
oldconf | BIU_PCI_CONF1_SXP);
|
2007-03-13 06:46:08 +00:00
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
2007-01-23 00:02:29 +00:00
|
|
|
}
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW2(isp, IspVirt2Off(isp, regoff), val);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2);
|
1999-03-17 05:07:18 +00:00
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oldconf);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
1999-03-17 05:07:18 +00:00
|
|
|
}
|
2007-03-13 06:46:08 +00:00
|
|
|
|
1999-03-17 05:07:18 +00:00
|
|
|
}
|
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
static uint32_t
|
2006-04-21 18:30:01 +00:00
|
|
|
isp_pci_rd_reg_1080(ispsoftc_t *isp, int regoff)
|
1998-04-22 18:12:29 +00:00
|
|
|
{
|
2006-11-02 03:21:32 +00:00
|
|
|
uint32_t rv, oc = 0;
|
1999-03-17 05:07:18 +00:00
|
|
|
|
1999-12-16 05:42:02 +00:00
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK ||
|
|
|
|
(regoff & _BLK_REG_MASK) == (SXP_BLOCK|SXP_BANK1_SELECT)) {
|
2006-11-02 03:21:32 +00:00
|
|
|
uint32_t tc;
|
1998-04-22 18:12:29 +00:00
|
|
|
/*
|
|
|
|
* We will assume that someone has paused the RISC processor.
|
|
|
|
*/
|
2007-03-13 06:46:08 +00:00
|
|
|
oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
|
1999-12-16 05:42:02 +00:00
|
|
|
tc = oc & ~BIU_PCI1080_CONF1_DMA;
|
|
|
|
if (regoff & SXP_BANK1_SELECT)
|
|
|
|
tc |= BIU_PCI1080_CONF1_SXP1;
|
|
|
|
else
|
|
|
|
tc |= BIU_PCI1080_CONF1_SXP0;
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1), tc);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
1999-03-17 05:07:18 +00:00
|
|
|
} else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) {
|
2007-03-13 06:46:08 +00:00
|
|
|
oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
|
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1),
|
2001-08-31 21:39:04 +00:00
|
|
|
oc | BIU_PCI1080_CONF1_DMA);
|
2007-03-13 06:46:08 +00:00
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
2007-03-13 06:46:08 +00:00
|
|
|
rv = BXR2(isp, IspVirt2Off(isp, regoff));
|
1999-12-16 05:42:02 +00:00
|
|
|
if (oc) {
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oc);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-11-02 03:21:32 +00:00
|
|
|
isp_pci_wr_reg_1080(ispsoftc_t *isp, int regoff, uint32_t val)
|
1998-04-22 18:12:29 +00:00
|
|
|
{
|
2001-08-31 21:39:04 +00:00
|
|
|
int oc = 0;
|
1999-03-17 05:07:18 +00:00
|
|
|
|
1999-12-16 05:42:02 +00:00
|
|
|
if ((regoff & _BLK_REG_MASK) == SXP_BLOCK ||
|
|
|
|
(regoff & _BLK_REG_MASK) == (SXP_BLOCK|SXP_BANK1_SELECT)) {
|
2006-11-02 03:21:32 +00:00
|
|
|
uint32_t tc;
|
1998-04-22 18:12:29 +00:00
|
|
|
/*
|
|
|
|
* We will assume that someone has paused the RISC processor.
|
|
|
|
*/
|
2007-03-13 06:46:08 +00:00
|
|
|
oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
|
1999-12-16 05:42:02 +00:00
|
|
|
tc = oc & ~BIU_PCI1080_CONF1_DMA;
|
|
|
|
if (regoff & SXP_BANK1_SELECT)
|
|
|
|
tc |= BIU_PCI1080_CONF1_SXP1;
|
|
|
|
else
|
|
|
|
tc |= BIU_PCI1080_CONF1_SXP0;
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1), tc);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
1999-03-17 05:07:18 +00:00
|
|
|
} else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) {
|
2007-03-13 06:46:08 +00:00
|
|
|
oc = BXR2(isp, IspVirt2Off(isp, BIU_CONF1));
|
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1),
|
2001-08-31 21:39:04 +00:00
|
|
|
oc | BIU_PCI1080_CONF1_DMA);
|
2007-03-13 06:46:08 +00:00
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW2(isp, IspVirt2Off(isp, regoff), val);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2);
|
1999-12-16 05:42:02 +00:00
|
|
|
if (oc) {
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW2(isp, IspVirt2Off(isp, BIU_CONF1), oc);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, BIU_CONF1), 2);
|
2006-11-02 03:21:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t
|
|
|
|
isp_pci_rd_reg_2400(ispsoftc_t *isp, int regoff)
|
|
|
|
{
|
|
|
|
uint32_t rv;
|
|
|
|
int block = regoff & _BLK_REG_MASK;
|
|
|
|
|
|
|
|
switch (block) {
|
|
|
|
case BIU_BLOCK:
|
|
|
|
break;
|
|
|
|
case MBOX_BLOCK:
|
2007-03-13 06:46:08 +00:00
|
|
|
return (BXR2(isp, IspVirt2Off(isp, regoff)));
|
2006-11-02 03:21:32 +00:00
|
|
|
case SXP_BLOCK:
|
|
|
|
isp_prt(isp, ISP_LOGWARN, "SXP_BLOCK read at 0x%x", regoff);
|
|
|
|
return (0xffffffff);
|
|
|
|
case RISC_BLOCK:
|
|
|
|
isp_prt(isp, ISP_LOGWARN, "RISC_BLOCK read at 0x%x", regoff);
|
|
|
|
return (0xffffffff);
|
|
|
|
case DMA_BLOCK:
|
|
|
|
isp_prt(isp, ISP_LOGWARN, "DMA_BLOCK read at 0x%x", regoff);
|
|
|
|
return (0xffffffff);
|
|
|
|
default:
|
|
|
|
isp_prt(isp, ISP_LOGWARN, "unknown block read at 0x%x", regoff);
|
|
|
|
return (0xffffffff);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (regoff) {
|
|
|
|
case BIU2400_FLASH_ADDR:
|
|
|
|
case BIU2400_FLASH_DATA:
|
|
|
|
case BIU2400_ICR:
|
|
|
|
case BIU2400_ISR:
|
|
|
|
case BIU2400_CSR:
|
|
|
|
case BIU2400_REQINP:
|
|
|
|
case BIU2400_REQOUTP:
|
|
|
|
case BIU2400_RSPINP:
|
|
|
|
case BIU2400_RSPOUTP:
|
2009-08-01 01:04:26 +00:00
|
|
|
case BIU2400_PRI_REQINP:
|
|
|
|
case BIU2400_PRI_REQOUTP:
|
2006-11-02 03:21:32 +00:00
|
|
|
case BIU2400_ATIO_RSPINP:
|
2009-08-01 01:04:26 +00:00
|
|
|
case BIU2400_ATIO_RSPOUTP:
|
2006-11-02 03:21:32 +00:00
|
|
|
case BIU2400_HCCR:
|
|
|
|
case BIU2400_GPIOD:
|
|
|
|
case BIU2400_GPIOE:
|
|
|
|
case BIU2400_HSEMA:
|
2007-03-13 06:46:08 +00:00
|
|
|
rv = BXR4(isp, IspVirt2Off(isp, regoff));
|
2006-11-02 03:21:32 +00:00
|
|
|
break;
|
|
|
|
case BIU2400_R2HSTSLO:
|
2007-03-13 06:46:08 +00:00
|
|
|
rv = BXR4(isp, IspVirt2Off(isp, regoff));
|
2006-11-02 03:21:32 +00:00
|
|
|
break;
|
|
|
|
case BIU2400_R2HSTSHI:
|
2007-03-13 06:46:08 +00:00
|
|
|
rv = BXR4(isp, IspVirt2Off(isp, regoff)) >> 16;
|
2006-11-02 03:21:32 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"isp_pci_rd_reg_2400: unknown offset %x", regoff);
|
|
|
|
rv = 0xffffffff;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
isp_pci_wr_reg_2400(ispsoftc_t *isp, int regoff, uint32_t val)
|
|
|
|
{
|
|
|
|
int block = regoff & _BLK_REG_MASK;
|
|
|
|
|
|
|
|
switch (block) {
|
|
|
|
case BIU_BLOCK:
|
|
|
|
break;
|
|
|
|
case MBOX_BLOCK:
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW2(isp, IspVirt2Off(isp, regoff), val);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2);
|
2006-11-02 03:21:32 +00:00
|
|
|
return;
|
|
|
|
case SXP_BLOCK:
|
|
|
|
isp_prt(isp, ISP_LOGWARN, "SXP_BLOCK write at 0x%x", regoff);
|
|
|
|
return;
|
|
|
|
case RISC_BLOCK:
|
|
|
|
isp_prt(isp, ISP_LOGWARN, "RISC_BLOCK write at 0x%x", regoff);
|
|
|
|
return;
|
|
|
|
case DMA_BLOCK:
|
|
|
|
isp_prt(isp, ISP_LOGWARN, "DMA_BLOCK write at 0x%x", regoff);
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
isp_prt(isp, ISP_LOGWARN, "unknown block write at 0x%x",
|
|
|
|
regoff);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (regoff) {
|
|
|
|
case BIU2400_FLASH_ADDR:
|
|
|
|
case BIU2400_FLASH_DATA:
|
|
|
|
case BIU2400_ICR:
|
|
|
|
case BIU2400_ISR:
|
|
|
|
case BIU2400_CSR:
|
|
|
|
case BIU2400_REQINP:
|
|
|
|
case BIU2400_REQOUTP:
|
|
|
|
case BIU2400_RSPINP:
|
|
|
|
case BIU2400_RSPOUTP:
|
2009-08-01 01:04:26 +00:00
|
|
|
case BIU2400_PRI_REQINP:
|
|
|
|
case BIU2400_PRI_REQOUTP:
|
2006-11-02 03:21:32 +00:00
|
|
|
case BIU2400_ATIO_RSPINP:
|
2009-08-01 01:04:26 +00:00
|
|
|
case BIU2400_ATIO_RSPOUTP:
|
2006-11-02 03:21:32 +00:00
|
|
|
case BIU2400_HCCR:
|
|
|
|
case BIU2400_GPIOD:
|
|
|
|
case BIU2400_GPIOE:
|
|
|
|
case BIU2400_HSEMA:
|
2007-03-13 06:46:08 +00:00
|
|
|
BXW4(isp, IspVirt2Off(isp, regoff), val);
|
|
|
|
MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 4);
|
2006-11-02 03:21:32 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
isp_prt(isp, ISP_LOGERR,
|
|
|
|
"isp_pci_wr_reg_2400: bad offset 0x%x", regoff);
|
|
|
|
break;
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 {
|
2006-04-21 18:30:01 +00:00
|
|
|
ispsoftc_t *isp;
|
2009-08-01 01:04:26 +00:00
|
|
|
caddr_t vbase;
|
|
|
|
int chan;
|
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 error;
|
|
|
|
};
|
|
|
|
|
2002-04-02 23:36:14 +00:00
|
|
|
static void imc(void *, bus_dma_segment_t *, int, int);
|
2009-08-01 01:04:26 +00:00
|
|
|
static void imc1(void *, bus_dma_segment_t *, int, int);
|
1998-09-15 10:06:23 +00:00
|
|
|
|
|
|
|
static void
|
2002-04-02 23:36:14 +00:00
|
|
|
imc(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;
|
2009-08-01 01:04:26 +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 (error) {
|
|
|
|
imushp->error = error;
|
2009-08-01 01:04:26 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (nseg != 1) {
|
|
|
|
imushp->error = EINVAL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
imushp->isp->isp_rquest = imushp->vbase;
|
|
|
|
imushp->isp->isp_rquest_dma = segs->ds_addr;
|
|
|
|
segs->ds_addr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp));
|
|
|
|
imushp->vbase += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp));
|
|
|
|
imushp->isp->isp_result_dma = segs->ds_addr;
|
|
|
|
imushp->isp->isp_result = imushp->vbase;
|
1998-09-15 10:06:23 +00:00
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
if (IS_24XX(imushp->isp)) {
|
|
|
|
segs->ds_addr += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp));
|
|
|
|
imushp->vbase += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp));
|
|
|
|
imushp->isp->isp_atioq_dma = segs->ds_addr;
|
|
|
|
imushp->isp->isp_atioq = imushp->vbase;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
imc1(void *arg, bus_dma_segment_t *segs, int nseg, int error)
|
|
|
|
{
|
|
|
|
struct imush *imushp = (struct imush *) arg;
|
|
|
|
if (error) {
|
|
|
|
imushp->error = error;
|
|
|
|
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
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
if (nseg != 1) {
|
|
|
|
imushp->error = EINVAL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
FCPARAM(imushp->isp, imushp->chan)->isp_scdma = segs->ds_addr;
|
|
|
|
FCPARAM(imushp->isp, imushp->chan)->isp_scratch = imushp->vbase;
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-04-21 18:30:01 +00:00
|
|
|
isp_pci_mbxdma(ispsoftc_t *isp)
|
1998-09-15 10:06:23 +00:00
|
|
|
{
|
|
|
|
caddr_t base;
|
2006-02-15 00:31:48 +00:00
|
|
|
uint32_t len;
|
2009-08-01 01:04:26 +00:00
|
|
|
int i, error, ns, cmap = 0;
|
2006-02-02 21:31:34 +00:00
|
|
|
bus_size_t slim; /* segment size */
|
2006-02-04 03:41:48 +00:00
|
|
|
bus_addr_t llim; /* low limit of unavailable dma */
|
2006-02-04 08:39:02 +00:00
|
|
|
bus_addr_t hlim; /* high limit of unavailable dma */
|
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 im;
|
|
|
|
|
1999-10-17 19:03:11 +00:00
|
|
|
/*
|
|
|
|
* Already been here? If so, leave...
|
|
|
|
*/
|
|
|
|
if (isp->isp_rquest) {
|
|
|
|
return (0);
|
|
|
|
}
|
2007-05-05 20:17:23 +00:00
|
|
|
ISP_UNLOCK(isp);
|
1999-10-17 19:03:11 +00:00
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
if (isp->isp_maxcmds == 0) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "maxcmds not set");
|
2007-05-05 20:17:23 +00:00
|
|
|
ISP_LOCK(isp);
|
2006-11-02 03:21:32 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
2006-02-02 21:31:34 +00:00
|
|
|
hlim = BUS_SPACE_MAXADDR;
|
2002-04-02 23:36:14 +00:00
|
|
|
if (IS_ULTRA2(isp) || IS_FC(isp) || IS_1240(isp)) {
|
2007-06-11 17:56:17 +00:00
|
|
|
if (sizeof (bus_size_t) > 4) {
|
|
|
|
slim = (bus_size_t) (1ULL << 32);
|
|
|
|
} else {
|
|
|
|
slim = (bus_size_t) (1UL << 31);
|
|
|
|
}
|
2006-02-15 00:31:48 +00:00
|
|
|
llim = BUS_SPACE_MAXADDR;
|
2002-04-02 23:36:14 +00:00
|
|
|
} else {
|
2006-02-15 00:31:48 +00:00
|
|
|
llim = BUS_SPACE_MAXADDR_32BIT;
|
2007-06-11 17:56:17 +00:00
|
|
|
slim = (1UL << 24);
|
2002-04-02 23:36:14 +00:00
|
|
|
}
|
|
|
|
|
2007-05-05 20:17:23 +00:00
|
|
|
len = isp->isp_maxcmds * sizeof (struct isp_pcmd);
|
2009-08-01 01:04:26 +00:00
|
|
|
isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
|
2007-05-05 20:17:23 +00:00
|
|
|
if (isp->isp_osinfo.pcmd_pool == NULL) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "cannot allocate pcmds");
|
|
|
|
ISP_LOCK(isp);
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
2006-05-22 06:51:48 +00:00
|
|
|
/*
|
|
|
|
* XXX: We don't really support 64 bit target mode for parallel scsi yet
|
|
|
|
*/
|
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
if (IS_SCSI(isp) && sizeof (bus_addr_t) > 4) {
|
2007-05-05 20:17:23 +00:00
|
|
|
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
2006-05-22 06:51:48 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "we cannot do DAC for SPI cards yet");
|
2009-08-01 01:04:26 +00:00
|
|
|
ISP_LOCK(isp);
|
2006-05-22 06:51:48 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, &isp->isp_osinfo.dmat)) {
|
2007-05-05 20:17:23 +00:00
|
|
|
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
2002-07-25 16:02:09 +00:00
|
|
|
ISP_LOCK(isp);
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
|
2006-05-22 06:51:48 +00:00
|
|
|
return (1);
|
2002-04-02 23:36:14 +00:00
|
|
|
}
|
|
|
|
|
2000-08-01 05:16:49 +00:00
|
|
|
len = sizeof (XS_T **) * isp->isp_maxcmds;
|
2003-02-19 05:47:46 +00:00
|
|
|
isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
|
1999-10-17 19:03:11 +00:00
|
|
|
if (isp->isp_xflist == NULL) {
|
2007-05-05 20:17:23 +00:00
|
|
|
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
2002-07-25 16:02:09 +00:00
|
|
|
ISP_LOCK(isp);
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
|
1999-10-17 19:03:11 +00:00
|
|
|
return (1);
|
|
|
|
}
|
2004-05-24 07:02:25 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
len = sizeof (void **) * isp->isp_maxcmds;
|
|
|
|
isp->isp_tgtlist = (void **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
|
|
|
|
if (isp->isp_tgtlist == NULL) {
|
2007-05-05 20:17:23 +00:00
|
|
|
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
1999-10-17 19:03:11 +00:00
|
|
|
free(isp->isp_xflist, M_DEVBUF);
|
2002-07-25 16:02:09 +00:00
|
|
|
ISP_LOCK(isp);
|
2007-05-05 20:17:23 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "cannot alloc tgtlist array");
|
1999-10-17 19:03:11 +00:00
|
|
|
return (1);
|
|
|
|
}
|
2007-05-05 20:17:23 +00:00
|
|
|
#endif
|
1999-10-17 19:03:11 +00:00
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
/*
|
2009-08-01 01:04:26 +00:00
|
|
|
* Allocate and map the request and result queues (and ATIO queue
|
|
|
|
* if we're a 2400 supporting target mode).
|
1998-09-15 10:06:23 +00:00
|
|
|
*/
|
2000-08-01 05:16:49 +00:00
|
|
|
len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp));
|
|
|
|
len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
|
2009-08-01 01:04:26 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
if (IS_24XX(isp)) {
|
|
|
|
len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
#endif
|
2002-04-02 23:36:14 +00:00
|
|
|
|
|
|
|
ns = (len / PAGE_SIZE) + 1;
|
2009-08-01 01:04:26 +00:00
|
|
|
|
2006-02-02 21:31:34 +00:00
|
|
|
/*
|
2009-08-01 01:04:26 +00:00
|
|
|
* Create a tag for the control spaces. We don't always need this
|
|
|
|
* to be 32 bits, but we do this for simplicity and speed's sake.
|
2006-02-02 21:31:34 +00:00
|
|
|
*/
|
2009-08-01 01:04:26 +00:00
|
|
|
if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, len, ns, slim, 0, &isp->isp_osinfo.cdmat)) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces");
|
2007-05-05 20:17:23 +00:00
|
|
|
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
1999-10-17 19:03:11 +00:00
|
|
|
free(isp->isp_xflist, M_DEVBUF);
|
2004-05-24 07:02:25 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
free(isp->isp_tgtlist, M_DEVBUF);
|
|
|
|
#endif
|
2002-07-25 16:02:09 +00:00
|
|
|
ISP_LOCK(isp);
|
1998-09-15 10:06:23 +00:00
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
if (bus_dmamem_alloc(isp->isp_osinfo.cdmat, (void **)&base, BUS_DMA_NOWAIT, &isp->isp_osinfo.cdmap) != 0) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "cannot allocate %d bytes of CCB memory", len);
|
|
|
|
bus_dma_tag_destroy(isp->isp_osinfo.cdmat);
|
2007-05-05 20:17:23 +00:00
|
|
|
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
1999-10-17 19:03:11 +00:00
|
|
|
free(isp->isp_xflist, M_DEVBUF);
|
2004-05-24 07:02:25 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
free(isp->isp_tgtlist, M_DEVBUF);
|
|
|
|
#endif
|
2002-07-25 16:02:09 +00:00
|
|
|
ISP_LOCK(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
|
|
|
return (1);
|
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
im.isp = isp;
|
|
|
|
im.chan = 0;
|
|
|
|
im.vbase = base;
|
|
|
|
im.error = 0;
|
|
|
|
|
|
|
|
bus_dmamap_load(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap, base, len, imc, &im, 0);
|
|
|
|
if (im.error) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "error %d loading dma map for control areas", im.error);
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IS_FC(isp)) {
|
|
|
|
for (cmap = 0; cmap < isp->isp_nchan; cmap++) {
|
|
|
|
struct isp_fc *fc = ISP_FC_PC(isp, cmap);
|
|
|
|
if (isp_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, ISP_FC_SCRLEN, 1, slim, 0, &fc->tdmat)) {
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
if (bus_dmamem_alloc(fc->tdmat, (void **)&base, BUS_DMA_NOWAIT, &fc->tdmap) != 0) {
|
|
|
|
bus_dma_tag_destroy(fc->tdmat);
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
im.isp = isp;
|
|
|
|
im.chan = cmap;
|
|
|
|
im.vbase = base;
|
|
|
|
im.error = 0;
|
|
|
|
bus_dmamap_load(fc->tdmat, fc->tdmap, base, ISP_FC_SCRLEN, imc1, &im, 0);
|
|
|
|
if (im.error) {
|
|
|
|
bus_dmamem_free(fc->tdmat, base, fc->tdmap);
|
|
|
|
bus_dma_tag_destroy(fc->tdmat);
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-10-17 19:03:11 +00:00
|
|
|
for (i = 0; i < isp->isp_maxcmds; i++) {
|
2007-05-05 20:17:23 +00:00
|
|
|
struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i];
|
|
|
|
error = bus_dmamap_create(isp->isp_osinfo.dmat, 0, &pcmd->dmap);
|
1998-09-15 10:06:23 +00:00
|
|
|
if (error) {
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "error %d creating per-cmd DMA maps", error);
|
2002-04-02 23:36:14 +00:00
|
|
|
while (--i >= 0) {
|
2009-08-01 01:04:26 +00:00
|
|
|
bus_dmamap_destroy(isp->isp_osinfo.dmat, isp->isp_osinfo.pcmd_pool[i].dmap);
|
2002-04-02 23:36:14 +00:00
|
|
|
}
|
|
|
|
goto bad;
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
callout_init_mtx(&pcmd->wdog, &isp->isp_osinfo.lock, 0);
|
2007-05-05 20:17:23 +00:00
|
|
|
if (i == isp->isp_maxcmds-1) {
|
|
|
|
pcmd->next = NULL;
|
|
|
|
} else {
|
|
|
|
pcmd->next = &isp->isp_osinfo.pcmd_pool[i+1];
|
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
2007-05-05 20:17:23 +00:00
|
|
|
isp->isp_osinfo.pcmd_free = &isp->isp_osinfo.pcmd_pool[0];
|
2002-07-25 16:02:09 +00:00
|
|
|
ISP_LOCK(isp);
|
1998-09-15 10:06:23 +00:00
|
|
|
return (0);
|
2002-04-02 23:36:14 +00:00
|
|
|
|
|
|
|
bad:
|
2009-08-01 01:04:26 +00:00
|
|
|
while (--cmap >= 0) {
|
|
|
|
struct isp_fc *fc = ISP_FC_PC(isp, cmap);
|
|
|
|
bus_dmamem_free(fc->tdmat, base, fc->tdmap);
|
|
|
|
bus_dma_tag_destroy(fc->tdmat);
|
|
|
|
}
|
|
|
|
bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap);
|
|
|
|
bus_dma_tag_destroy(isp->isp_osinfo.cdmat);
|
2002-04-02 23:36:14 +00:00
|
|
|
free(isp->isp_xflist, M_DEVBUF);
|
2004-05-24 07:02:25 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
free(isp->isp_tgtlist, M_DEVBUF);
|
|
|
|
#endif
|
2007-05-05 20:17:23 +00:00
|
|
|
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
2002-04-02 23:36:14 +00:00
|
|
|
isp->isp_rquest = NULL;
|
2007-05-05 20:17:23 +00:00
|
|
|
ISP_LOCK(isp);
|
2002-04-02 23:36:14 +00:00
|
|
|
return (1);
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct {
|
2006-04-21 18:30:01 +00:00
|
|
|
ispsoftc_t *isp;
|
2000-01-03 23:50:13 +00:00
|
|
|
void *cmd_token;
|
2009-08-01 01:04:26 +00:00
|
|
|
void *rq; /* original request */
|
2006-02-15 00:31:48 +00:00
|
|
|
int error;
|
2009-08-01 01:04:26 +00:00
|
|
|
bus_size_t mapsize;
|
1998-09-15 10:06:23 +00:00
|
|
|
} mush_t;
|
|
|
|
|
1998-09-17 21:11:21 +00:00
|
|
|
#define MUSHERR_NOQENTRIES -2
|
|
|
|
|
2000-01-03 23:50:13 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
2009-08-01 01:04:26 +00:00
|
|
|
static void tdma2_2(void *, bus_dma_segment_t *, int, bus_size_t, int);
|
|
|
|
static void tdma2(void *, bus_dma_segment_t *, int, int);
|
2001-04-04 21:53:59 +00:00
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
static void
|
|
|
|
tdma2_2(void *arg, bus_dma_segment_t *dm_segs, int nseg, bus_size_t mapsize, int error)
|
|
|
|
{
|
|
|
|
mush_t *mp;
|
|
|
|
mp = (mush_t *)arg;
|
|
|
|
mp->mapsize = mapsize;
|
|
|
|
tdma2(arg, dm_segs, nseg, error);
|
|
|
|
}
|
2000-01-03 23:50:13 +00:00
|
|
|
|
|
|
|
static void
|
2009-08-01 01:04:26 +00:00
|
|
|
tdma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
|
2000-01-03 23:50:13 +00:00
|
|
|
{
|
|
|
|
mush_t *mp;
|
2006-04-21 18:30:01 +00:00
|
|
|
ispsoftc_t *isp;
|
2009-08-01 01:04:26 +00:00
|
|
|
struct ccb_scsiio *csio;
|
|
|
|
isp_ddir_t ddir;
|
|
|
|
ispreq_t *rq;
|
2000-01-03 23:50:13 +00:00
|
|
|
|
|
|
|
mp = (mush_t *) arg;
|
|
|
|
if (error) {
|
|
|
|
mp->error = error;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
csio = mp->cmd_token;
|
2009-08-01 01:04:26 +00:00
|
|
|
isp = mp->isp;
|
|
|
|
rq = mp->rq;
|
|
|
|
if (nseg) {
|
|
|
|
if (sizeof (bus_addr_t) > 4) {
|
|
|
|
if (nseg >= ISP_NSEG64_MAX) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX);
|
|
|
|
mp->error = EFAULT;
|
2000-07-18 06:40:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
if (rq->req_header.rqs_entry_type == RQSTYPE_CTIO2) {
|
|
|
|
rq->req_header.rqs_entry_type = RQSTYPE_CTIO3;
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it). It also has to handle the SBus cards (for
platforms that have them) which, while on a Big Endian machine, do *not*
require *most* of the request/response queue entry fields to be swizzled
or unswizzled.
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
MFC after: 2 weeks
2001-12-11 00:18:45 +00:00
|
|
|
}
|
2000-01-03 23:50:13 +00:00
|
|
|
} else {
|
2009-08-01 01:04:26 +00:00
|
|
|
if (nseg >= ISP_NSEG_MAX) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG_MAX);
|
|
|
|
mp->error = EFAULT;
|
2000-01-03 23:50:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
|
|
|
bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE);
|
|
|
|
ddir = ISP_TO_DEVICE;
|
|
|
|
} else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) {
|
|
|
|
bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD);
|
|
|
|
ddir = ISP_FROM_DEVICE;
|
2006-05-22 06:51:48 +00:00
|
|
|
} else {
|
2009-08-01 01:04:26 +00:00
|
|
|
ddir = ISP_NOXFR;
|
2006-05-22 06:51:48 +00:00
|
|
|
}
|
|
|
|
} else {
|
2009-08-01 01:04:26 +00:00
|
|
|
dm_segs = NULL;
|
|
|
|
nseg = 0;
|
|
|
|
ddir = ISP_NOXFR;
|
2000-01-03 23:50:13 +00:00
|
|
|
}
|
2002-06-16 04:58:00 +00:00
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
if (isp_send_tgt_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, &csio->sense_data, csio->sense_len) != CMD_QUEUED) {
|
|
|
|
mp->error = MUSHERR_NOQENTRIES;
|
2006-11-02 03:21:32 +00:00
|
|
|
}
|
2000-01-03 23:50:13 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
static void dma2_2(void *, bus_dma_segment_t *, int, bus_size_t, int);
|
2001-08-31 21:39:04 +00:00
|
|
|
static void dma2(void *, bus_dma_segment_t *, int, int);
|
2000-01-03 23:50:13 +00:00
|
|
|
|
2006-11-02 03:21:32 +00:00
|
|
|
static void
|
2009-08-01 01:04:26 +00:00
|
|
|
dma2_2(void *arg, bus_dma_segment_t *dm_segs, int nseg, bus_size_t mapsize, int error)
|
2006-11-02 03:21:32 +00:00
|
|
|
{
|
|
|
|
mush_t *mp;
|
2009-08-01 01:04:26 +00:00
|
|
|
mp = (mush_t *)arg;
|
|
|
|
mp->mapsize = mapsize;
|
|
|
|
dma2(arg, dm_segs, nseg, error);
|
2004-09-07 08:04:09 +00:00
|
|
|
}
|
2006-02-15 00:31:48 +00:00
|
|
|
|
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;
|
2006-04-21 18:30:01 +00:00
|
|
|
ispsoftc_t *isp;
|
2000-01-03 23:50:13 +00:00
|
|
|
struct ccb_scsiio *csio;
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_ddir_t ddir;
|
1998-09-15 10:06:23 +00:00
|
|
|
ispreq_t *rq;
|
|
|
|
|
|
|
|
mp = (mush_t *) arg;
|
|
|
|
if (error) {
|
|
|
|
mp->error = error;
|
|
|
|
return;
|
|
|
|
}
|
2000-01-03 23:50:13 +00:00
|
|
|
csio = mp->cmd_token;
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it). It also has to handle the SBus cards (for
platforms that have them) which, while on a Big Endian machine, do *not*
require *most* of the request/response queue entry fields to be swizzled
or unswizzled.
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
MFC after: 2 weeks
2001-12-11 00:18:45 +00:00
|
|
|
isp = mp->isp;
|
1998-09-15 10:06:23 +00:00
|
|
|
rq = mp->rq;
|
2009-08-01 01:04:26 +00:00
|
|
|
if (nseg) {
|
|
|
|
if (sizeof (bus_addr_t) > 4) {
|
|
|
|
if (nseg >= ISP_NSEG64_MAX) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX);
|
|
|
|
mp->error = EFAULT;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) {
|
|
|
|
rq->req_header.rqs_entry_type = RQSTYPE_T3RQS;
|
|
|
|
} else if (rq->req_header.rqs_entry_type == RQSTYPE_REQUEST) {
|
|
|
|
rq->req_header.rqs_entry_type = RQSTYPE_A64;
|
|
|
|
}
|
2000-02-15 00:50:01 +00:00
|
|
|
} else {
|
2009-08-01 01:04:26 +00:00
|
|
|
if (nseg >= ISP_NSEG_MAX) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG_MAX);
|
|
|
|
mp->error = EFAULT;
|
|
|
|
return;
|
|
|
|
}
|
2000-02-15 00:50:01 +00:00
|
|
|
}
|
2000-01-03 23:50:13 +00:00
|
|
|
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
2009-08-01 01:04:26 +00:00
|
|
|
bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD);
|
|
|
|
ddir = ISP_FROM_DEVICE;
|
|
|
|
} else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) {
|
|
|
|
bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE);
|
|
|
|
ddir = ISP_TO_DEVICE;
|
2000-01-03 23:50:13 +00:00
|
|
|
} else {
|
2009-08-01 01:04:26 +00:00
|
|
|
ddir = ISP_NOXFR;
|
2000-01-03 23:50:13 +00:00
|
|
|
}
|
2009-08-01 01:04:26 +00:00
|
|
|
} else {
|
|
|
|
dm_segs = NULL;
|
|
|
|
nseg = 0;
|
|
|
|
ddir = ISP_NOXFR;
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir) != CMD_QUEUED) {
|
|
|
|
mp->error = MUSHERR_NOQENTRIES;
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_pci_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff)
|
1998-09-15 10:06:23 +00:00
|
|
|
{
|
|
|
|
mush_t mush, *mp;
|
2001-08-31 21:39:04 +00:00
|
|
|
void (*eptr)(void *, bus_dma_segment_t *, int, int);
|
2009-08-01 01:04:26 +00:00
|
|
|
void (*eptr2)(void *, bus_dma_segment_t *, int, bus_size_t, int);
|
|
|
|
|
|
|
|
mp = &mush;
|
|
|
|
mp->isp = isp;
|
|
|
|
mp->cmd_token = csio;
|
|
|
|
mp->rq = ff;
|
|
|
|
mp->error = 0;
|
|
|
|
mp->mapsize = 0;
|
1998-09-15 10:06:23 +00:00
|
|
|
|
2000-01-03 23:50:13 +00:00
|
|
|
#ifdef ISP_TARGET_MODE
|
|
|
|
if (csio->ccb_h.func_code == XPT_CONT_TARGET_IO) {
|
2009-08-01 01:04:26 +00:00
|
|
|
eptr = tdma2;
|
|
|
|
eptr2 = tdma2_2;
|
2000-01-03 23:50:13 +00:00
|
|
|
} else
|
|
|
|
#endif
|
2009-08-01 01:04:26 +00:00
|
|
|
{
|
2006-02-15 00:31:48 +00:00
|
|
|
eptr = dma2;
|
2009-08-01 01:04:26 +00:00
|
|
|
eptr2 = dma2_2;
|
2006-02-15 00:31:48 +00:00
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it). It also has to handle the SBus cards (for
platforms that have them) which, while on a Big Endian machine, do *not*
require *most* of the request/response queue entry fields to be swizzled
or unswizzled.
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
MFC after: 2 weeks
2001-12-11 00:18:45 +00:00
|
|
|
|
2009-08-01 01:04:26 +00:00
|
|
|
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE || (csio->dxfer_len == 0)) {
|
|
|
|
(*eptr)(mp, NULL, 0, 0);
|
|
|
|
} else if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) {
|
2000-01-03 23:50:13 +00:00
|
|
|
if ((csio->ccb_h.flags & CAM_DATA_PHYS) == 0) {
|
2007-05-05 20:17:23 +00:00
|
|
|
int error;
|
2009-08-01 01:04:26 +00:00
|
|
|
error = bus_dmamap_load(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, csio->data_ptr, csio->dxfer_len, eptr, mp, 0);
|
|
|
|
#if 0
|
|
|
|
xpt_print(csio->ccb_h.path, "%s: bus_dmamap_load " "ptr %p len %d returned %d\n", __func__, csio->data_ptr, csio->dxfer_len, error);
|
2007-05-05 20:17:23 +00:00
|
|
|
#endif
|
2009-08-01 01:04:26 +00:00
|
|
|
|
1998-09-15 10:06:23 +00:00
|
|
|
if (error == EINPROGRESS) {
|
2009-08-01 01:04:26 +00:00
|
|
|
bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap);
|
1998-09-15 10:06:23 +00:00
|
|
|
mp->error = EINVAL;
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "deferred dma allocation not supported");
|
1998-09-15 10:06:23 +00:00
|
|
|
} else if (error && mp->error == 0) {
|
1999-08-16 19:52:29 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "error %d in dma mapping code", error);
|
1999-08-16 19:52:29 +00:00
|
|
|
#endif
|
1998-09-15 10:06:23 +00:00
|
|
|
mp->error = error;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Pointer to physical buffer */
|
1999-03-17 05:07:18 +00:00
|
|
|
struct bus_dma_segment seg;
|
2004-09-07 08:04:09 +00:00
|
|
|
seg.ds_addr = (bus_addr_t)(vm_offset_t)csio->data_ptr;
|
1998-09-15 10:06:23 +00:00
|
|
|
seg.ds_len = csio->dxfer_len;
|
2000-01-03 23:50:13 +00:00
|
|
|
(*eptr)(mp, &seg, 1, 0);
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
struct bus_dma_segment *segs;
|
|
|
|
|
2000-01-03 23:50:13 +00:00
|
|
|
if ((csio->ccb_h.flags & CAM_DATA_PHYS) != 0) {
|
2009-08-01 01:04:26 +00:00
|
|
|
isp_prt(isp, ISP_LOGERR, "Physical segment pointers unsupported");
|
1998-09-15 10:06:23 +00:00
|
|
|
mp->error = EINVAL;
|
2000-01-03 23:50:13 +00:00
|
|
|
} else if ((csio->ccb_h.flags & CAM_SG_LIST_PHYS) == 0) {
|
2009-08-01 01:04:26 +00:00
|
|
|
struct uio sguio;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We're taking advantage of the fact that
|
|
|
|
* the pointer/length sizes and layout of the iovec
|
|
|
|
* structure are the same as the bus_dma_segment
|
|
|
|
* structure. This might be a little dangerous,
|
|
|
|
* but only if they change the structures, which
|
|
|
|
* seems unlikely.
|
|
|
|
*/
|
|
|
|
KASSERT((sizeof (sguio.uio_iov) == sizeof (csio->data_ptr) &&
|
|
|
|
sizeof (sguio.uio_iovcnt) >= sizeof (csio->sglist_cnt) &&
|
|
|
|
sizeof (sguio.uio_resid) >= sizeof (csio->dxfer_len)), ("Ken's assumption failed"));
|
|
|
|
sguio.uio_iov = (struct iovec *)csio->data_ptr;
|
|
|
|
sguio.uio_iovcnt = csio->sglist_cnt;
|
|
|
|
sguio.uio_resid = csio->dxfer_len;
|
|
|
|
sguio.uio_segflg = UIO_SYSSPACE;
|
|
|
|
|
|
|
|
error = bus_dmamap_load_uio(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, &sguio, eptr2, mp, 0);
|
|
|
|
|
|
|
|
if (error != 0 && mp->error == 0) {
|
|
|
|
isp_prt(isp, ISP_LOGERR, "error %d in dma mapping code", error);
|
|
|
|
mp->error = error;
|
|
|
|
}
|
1998-09-15 10:06:23 +00:00
|
|
|
} else {
|
|
|
|
/* Just use the segments provided */
|
|
|
|
segs = (struct bus_dma_segment *) csio->data_ptr;
|
2000-01-03 23:50:13 +00:00
|
|
|
(*eptr)(mp, segs, csio->sglist_cnt, 0);
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (mp->error) {
|
1998-09-17 21:11:21 +00:00
|
|
|
int retval = CMD_COMPLETE;
|
|
|
|
if (mp->error == MUSHERR_NOQENTRIES) {
|
|
|
|
retval = CMD_EAGAIN;
|
|
|
|
} else if (mp->error == EFBIG) {
|
1999-08-16 19:52:29 +00:00
|
|
|
XS_SETERR(csio, CAM_REQ_TOO_BIG);
|
1998-09-15 10:06:23 +00:00
|
|
|
} else if (mp->error == EINVAL) {
|
1999-08-16 19:52:29 +00:00
|
|
|
XS_SETERR(csio, CAM_REQ_INVALID);
|
1998-09-15 10:06:23 +00:00
|
|
|
} else {
|
1999-08-16 19:52:29 +00:00
|
|
|
XS_SETERR(csio, CAM_UNREC_HBA_ERROR);
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
1998-09-17 21:11:21 +00:00
|
|
|
return (retval);
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.
The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it). It also has to handle the SBus cards (for
platforms that have them) which, while on a Big Endian machine, do *not*
require *most* of the request/response queue entry fields to be swizzled
or unswizzled.
One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.
Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.
Additional changes:
Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.
Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).
MFC after: 2 weeks
2001-12-11 00:18:45 +00:00
|
|
|
return (CMD_QUEUED);
|
1998-09-15 10:06:23 +00:00
|
|
|
}
|
|
|
|
|
2006-12-16 05:54:29 +00:00
|
|
|
static void
|
|
|
|
isp_pci_reset0(ispsoftc_t *isp)
|
|
|
|
{
|
|
|
|
ISP_DISABLE_INTS(isp);
|
|
|
|
}
|
|
|
|
|
1998-04-22 18:12:29 +00:00
|
|
|
static void
|
2006-04-21 18:30:01 +00:00
|
|
|
isp_pci_reset1(ispsoftc_t *isp)
|
1998-04-22 18:12:29 +00:00
|
|
|
{
|
2006-11-02 03:21:32 +00:00
|
|
|
if (!IS_24XX(isp)) {
|
|
|
|
/* Make sure the BIOS is disabled */
|
|
|
|
isp_pci_wr_reg(isp, HCCR, PCI_HCCR_CMD_BIOS);
|
|
|
|
}
|
2000-07-04 01:01:15 +00:00
|
|
|
/* and enable interrupts */
|
2006-11-02 03:21:32 +00:00
|
|
|
ISP_ENABLE_INTS(isp);
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-04-21 18:30:01 +00:00
|
|
|
isp_pci_dumpregs(ispsoftc_t *isp, const char *msg)
|
1998-04-22 18:12:29 +00:00
|
|
|
{
|
2002-04-02 23:36:14 +00:00
|
|
|
struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp;
|
2000-08-01 05:16:49 +00:00
|
|
|
if (msg)
|
2001-03-01 02:21:36 +00:00
|
|
|
printf("%s: %s\n", device_get_nameunit(isp->isp_dev), msg);
|
|
|
|
else
|
|
|
|
printf("%s:\n", device_get_nameunit(isp->isp_dev));
|
2000-08-01 05:16:49 +00:00
|
|
|
if (IS_SCSI(isp))
|
|
|
|
printf(" biu_conf1=%x", ISP_READ(isp, BIU_CONF1));
|
|
|
|
else
|
|
|
|
printf(" biu_csr=%x", ISP_READ(isp, BIU2100_CSR));
|
|
|
|
printf(" biu_icr=%x biu_isr=%x biu_sema=%x ", ISP_READ(isp, BIU_ICR),
|
|
|
|
ISP_READ(isp, BIU_ISR), ISP_READ(isp, BIU_SEMA));
|
|
|
|
printf("risc_hccr=%x\n", ISP_READ(isp, HCCR));
|
|
|
|
|
|
|
|
|
|
|
|
if (IS_SCSI(isp)) {
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
|
|
|
|
printf(" cdma_conf=%x cdma_sts=%x cdma_fifostat=%x\n",
|
|
|
|
ISP_READ(isp, CDMA_CONF), ISP_READ(isp, CDMA_STATUS),
|
|
|
|
ISP_READ(isp, CDMA_FIFO_STS));
|
|
|
|
printf(" ddma_conf=%x ddma_sts=%x ddma_fifostat=%x\n",
|
|
|
|
ISP_READ(isp, DDMA_CONF), ISP_READ(isp, DDMA_STATUS),
|
|
|
|
ISP_READ(isp, DDMA_FIFO_STS));
|
|
|
|
printf(" sxp_int=%x sxp_gross=%x sxp(scsi_ctrl)=%x\n",
|
|
|
|
ISP_READ(isp, SXP_INTERRUPT),
|
|
|
|
ISP_READ(isp, SXP_GROSS_ERR),
|
|
|
|
ISP_READ(isp, SXP_PINS_CTRL));
|
|
|
|
ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
|
|
|
|
}
|
|
|
|
printf(" mbox regs: %x %x %x %x %x\n",
|
|
|
|
ISP_READ(isp, OUTMAILBOX0), ISP_READ(isp, OUTMAILBOX1),
|
|
|
|
ISP_READ(isp, OUTMAILBOX2), ISP_READ(isp, OUTMAILBOX3),
|
|
|
|
ISP_READ(isp, OUTMAILBOX4));
|
|
|
|
printf(" PCI Status Command/Status=%x\n",
|
2002-04-02 23:36:14 +00:00
|
|
|
pci_read_config(pcs->pci_dev, PCIR_COMMAND, 1));
|
1998-04-22 18:12:29 +00:00
|
|
|
}
|