Home | History | Annotate | Line # | Download | only in pci
isp_pci.c revision 1.56
      1 /* $NetBSD: isp_pci.c,v 1.56 2000/08/14 06:58:45 mjacob Exp $ */
      2 /*
      3  * This driver, which is contained in NetBSD in the files:
      4  *
      5  *	sys/dev/ic/isp.c
      6  *	sys/dev/ic/ic/isp.c
      7  *	sys/dev/ic/ic/isp_inline.h
      8  *	sys/dev/ic/ic/isp_netbsd.c
      9  *	sys/dev/ic/ic/isp_netbsd.h
     10  *	sys/dev/ic/ic/isp_target.c
     11  *	sys/dev/ic/ic/isp_target.h
     12  *	sys/dev/ic/ic/isp_tpublic.h
     13  *	sys/dev/ic/ic/ispmbox.h
     14  *	sys/dev/ic/ic/ispreg.h
     15  *	sys/dev/ic/ic/ispvar.h
     16  *	sys/microcode/isp/asm_sbus.h
     17  *	sys/microcode/isp/asm_1040.h
     18  *	sys/microcode/isp/asm_1080.h
     19  *	sys/microcode/isp/asm_12160.h
     20  *	sys/microcode/isp/asm_2100.h
     21  *	sys/microcode/isp/asm_2200.h
     22  *	sys/pci/isp_pci.c
     23  *	sys/sbus/isp_sbus.c
     24  *
     25  * Is being actively maintained by Matthew Jacob (mjacob (at) netbsd.org).
     26  * This driver also is shared source with FreeBSD, OpenBSD, Linux, Solaris,
     27  * Linux versions. This tends to be an interesting maintenance problem.
     28  *
     29  * Please coordinate with Matthew Jacob on changes you wish to make here.
     30  */
     31 /*
     32  * PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
     33  * Matthew Jacob (mjacob (at) nas.nasa.gov)
     34  */
     35 /*
     36  * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
     37  * All rights reserved.
     38  *
     39  * Redistribution and use in source and binary forms, with or without
     40  * modification, are permitted provided that the following conditions
     41  * are met:
     42  * 1. Redistributions of source code must retain the above copyright
     43  *    notice, this list of conditions and the following disclaimer.
     44  * 2. Redistributions in binary form must reproduce the above copyright
     45  *    notice, this list of conditions and the following disclaimer in the
     46  *    documentation and/or other materials provided with the distribution.
     47  * 3. The name of the author may not be used to endorse or promote products
     48  *    derived from this software without specific prior written permission
     49  *
     50  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     51  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     52  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     53  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     54  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     55  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     57  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     58  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     59  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     60  */
     61 
     62 #include <dev/ic/isp_netbsd.h>
     63 #include <dev/pci/pcireg.h>
     64 #include <dev/pci/pcivar.h>
     65 #include <dev/pci/pcidevs.h>
     66 
     67 static u_int16_t isp_pci_rd_reg __P((struct ispsoftc *, int));
     68 static void isp_pci_wr_reg __P((struct ispsoftc *, int, u_int16_t));
     69 #if !(defined(ISP_DISABLE_1080_SUPPORT) && defined(ISP_DISABLE_12160_SUPPORT))
     70 static u_int16_t isp_pci_rd_reg_1080 __P((struct ispsoftc *, int));
     71 static void isp_pci_wr_reg_1080 __P((struct ispsoftc *, int, u_int16_t));
     72 #endif
     73 static int isp_pci_mbxdma __P((struct ispsoftc *));
     74 static int isp_pci_dmasetup __P((struct ispsoftc *, struct scsipi_xfer *,
     75 	ispreq_t *, u_int16_t *, u_int16_t));
     76 static void isp_pci_dmateardown __P((struct ispsoftc *, struct scsipi_xfer *,
     77 	u_int32_t));
     78 static void isp_pci_reset1 __P((struct ispsoftc *));
     79 static void isp_pci_dumpregs __P((struct ispsoftc *, const char *));
     80 static int isp_pci_intr __P((void *));
     81 
     82 #if	defined(ISP_DISABLE_1020_SUPPORT)
     83 #define	ISP_1040_RISC_CODE	NULL
     84 #else
     85 #define	ISP_1040_RISC_CODE	isp_1040_risc_code
     86 #include <dev/microcode/isp/asm_1040.h>
     87 #endif
     88 
     89 #if	defined(ISP_DISABLE_1080_SUPPORT)
     90 #define	ISP_1080_RISC_CODE	NULL
     91 #else
     92 #define	ISP_1080_RISC_CODE	isp_1080_risc_code
     93 #include <dev/microcode/isp/asm_1080.h>
     94 #endif
     95 
     96 #if	defined(ISP_DISABLE_12160_SUPPORT)
     97 #define	ISP_12160_RISC_CODE	NULL
     98 #else
     99 #define	ISP_12160_RISC_CODE	isp_12160_risc_code
    100 #include <dev/microcode/isp/asm_12160.h>
    101 #endif
    102 
    103 #if	defined(ISP_DISABLE_2100_SUPPORT)
    104 #define	ISP_2100_RISC_CODE	NULL
    105 #else
    106 #define	ISP_2100_RISC_CODE	isp_2100_risc_code
    107 #include <dev/microcode/isp/asm_2100.h>
    108 #endif
    109 
    110 #if	defined(ISP_DISABLE_2200_SUPPORT)
    111 #define	ISP_2200_RISC_CODE	NULL
    112 #else
    113 #define	ISP_2200_RISC_CODE	isp_2200_risc_code
    114 #include <dev/microcode/isp/asm_2200.h>
    115 #endif
    116 
    117 #ifndef	ISP_DISABLE_1020_SUPPORT
    118 static struct ispmdvec mdvec = {
    119 	isp_pci_rd_reg,
    120 	isp_pci_wr_reg,
    121 	isp_pci_mbxdma,
    122 	isp_pci_dmasetup,
    123 	isp_pci_dmateardown,
    124 	NULL,
    125 	isp_pci_reset1,
    126 	isp_pci_dumpregs,
    127 	ISP_1040_RISC_CODE,
    128 	BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
    129 };
    130 #endif
    131 
    132 #ifndef	ISP_DISABLE_1080_SUPPORT
    133 static struct ispmdvec mdvec_1080 = {
    134 	isp_pci_rd_reg_1080,
    135 	isp_pci_wr_reg_1080,
    136 	isp_pci_mbxdma,
    137 	isp_pci_dmasetup,
    138 	isp_pci_dmateardown,
    139 	NULL,
    140 	isp_pci_reset1,
    141 	isp_pci_dumpregs,
    142 	ISP_1080_RISC_CODE,
    143 	BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
    144 };
    145 #endif
    146 
    147 #ifndef	ISP_DISABLE_12160_SUPPORT
    148 static struct ispmdvec mdvec_12160 = {
    149 	isp_pci_rd_reg_1080,
    150 	isp_pci_wr_reg_1080,
    151 	isp_pci_mbxdma,
    152 	isp_pci_dmasetup,
    153 	isp_pci_dmateardown,
    154 	NULL,
    155 	isp_pci_reset1,
    156 	isp_pci_dumpregs,
    157 	ISP_12160_RISC_CODE,
    158 	BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
    159 };
    160 #endif
    161 
    162 #ifndef	ISP_DISABLE_2100_SUPPORT
    163 static struct ispmdvec mdvec_2100 = {
    164 	isp_pci_rd_reg,
    165 	isp_pci_wr_reg,
    166 	isp_pci_mbxdma,
    167 	isp_pci_dmasetup,
    168 	isp_pci_dmateardown,
    169 	NULL,
    170 	isp_pci_reset1,
    171 	isp_pci_dumpregs,
    172 	ISP_2100_RISC_CODE
    173 };
    174 #endif
    175 
    176 #ifndef	ISP_DISABLE_2200_SUPPORT
    177 static struct ispmdvec mdvec_2200 = {
    178 	isp_pci_rd_reg,
    179 	isp_pci_wr_reg,
    180 	isp_pci_mbxdma,
    181 	isp_pci_dmasetup,
    182 	isp_pci_dmateardown,
    183 	NULL,
    184 	isp_pci_reset1,
    185 	isp_pci_dumpregs,
    186 	ISP_2200_RISC_CODE
    187 };
    188 #endif
    189 
    190 #ifndef	PCI_VENDOR_QLOGIC
    191 #define	PCI_VENDOR_QLOGIC	0x1077
    192 #endif
    193 
    194 #ifndef	PCI_PRODUCT_QLOGIC_ISP1020
    195 #define	PCI_PRODUCT_QLOGIC_ISP1020	0x1020
    196 #endif
    197 
    198 #ifndef	PCI_PRODUCT_QLOGIC_ISP1080
    199 #define	PCI_PRODUCT_QLOGIC_ISP1080	0x1080
    200 #endif
    201 
    202 #ifndef	PCI_PRODUCT_QLOGIC_ISP1240
    203 #define	PCI_PRODUCT_QLOGIC_ISP1240	0x1240
    204 #endif
    205 
    206 #ifndef	PCI_PRODUCT_QLOGIC_ISP1280
    207 #define	PCI_PRODUCT_QLOGIC_ISP1280	0x1280
    208 #endif
    209 
    210 #ifndef	PCI_PRODUCT_QLOGIC_ISP12160
    211 #define	PCI_PRODUCT_QLOGIC_ISP12160	0x1216
    212 #endif
    213 
    214 #ifndef	PCI_PRODUCT_QLOGIC_ISP2100
    215 #define	PCI_PRODUCT_QLOGIC_ISP2100	0x2100
    216 #endif
    217 
    218 #ifndef	PCI_PRODUCT_QLOGIC_ISP2200
    219 #define	PCI_PRODUCT_QLOGIC_ISP2200	0x2200
    220 #endif
    221 
    222 #define	PCI_QLOGIC_ISP	((PCI_PRODUCT_QLOGIC_ISP1020 << 16) | PCI_VENDOR_QLOGIC)
    223 
    224 #define	PCI_QLOGIC_ISP1080	\
    225 	((PCI_PRODUCT_QLOGIC_ISP1080 << 16) | PCI_VENDOR_QLOGIC)
    226 
    227 #define	PCI_QLOGIC_ISP1240	\
    228 	((PCI_PRODUCT_QLOGIC_ISP1240 << 16) | PCI_VENDOR_QLOGIC)
    229 
    230 #define	PCI_QLOGIC_ISP1280	\
    231 	((PCI_PRODUCT_QLOGIC_ISP1280 << 16) | PCI_VENDOR_QLOGIC)
    232 
    233 #define	PCI_QLOGIC_ISP12160	\
    234 	((PCI_PRODUCT_QLOGIC_ISP12160 << 16) | PCI_VENDOR_QLOGIC)
    235 
    236 #define	PCI_QLOGIC_ISP2100	\
    237 	((PCI_PRODUCT_QLOGIC_ISP2100 << 16) | PCI_VENDOR_QLOGIC)
    238 
    239 #define	PCI_QLOGIC_ISP2200	\
    240 	((PCI_PRODUCT_QLOGIC_ISP2200 << 16) | PCI_VENDOR_QLOGIC)
    241 
    242 #define	IO_MAP_REG	0x10
    243 #define	MEM_MAP_REG	0x14
    244 #define	PCIR_ROMADDR	0x30
    245 
    246 #define	PCI_DFLT_LTNCY	0x40
    247 #define	PCI_DFLT_LNSZ	0x10
    248 
    249 
    250 static int isp_pci_probe __P((struct device *, struct cfdata *, void *));
    251 static void isp_pci_attach __P((struct device *, struct device *, void *));
    252 
    253 struct isp_pcisoftc {
    254 	struct ispsoftc		pci_isp;
    255 	pci_chipset_tag_t	pci_pc;
    256 	pcitag_t		pci_tag;
    257 	bus_space_tag_t		pci_st;
    258 	bus_space_handle_t	pci_sh;
    259 	bus_dma_tag_t		pci_dmat;
    260 	bus_dmamap_t		pci_scratch_dmap;	/* for fcp only */
    261 	bus_dmamap_t		pci_rquest_dmap;
    262 	bus_dmamap_t		pci_result_dmap;
    263 	bus_dmamap_t		*pci_xfer_dmap;
    264 	void *			pci_ih;
    265 	int16_t			pci_poff[_NREG_BLKS];
    266 };
    267 
    268 struct cfattach isp_pci_ca = {
    269 	sizeof (struct isp_pcisoftc), isp_pci_probe, isp_pci_attach
    270 };
    271 
    272 #ifdef	DEBUG
    273 static char *vstring =
    274     "Qlogic ISP Driver, NetBSD (pci) Platform Version %d.%d Core Version %d.%d";
    275 #endif
    276 
    277 static int
    278 isp_pci_probe(parent, match, aux)
    279 	struct device *parent;
    280 	struct cfdata *match;
    281 	void *aux;
    282 {
    283 	struct pci_attach_args *pa = aux;
    284 	switch (pa->pa_id) {
    285 #ifndef	ISP_DISABLE_1020_SUPPORT
    286 	case PCI_QLOGIC_ISP:
    287 		return (1);
    288 #endif
    289 #ifndef	ISP_DISABLE_1080_SUPPORT
    290 	case PCI_QLOGIC_ISP1080:
    291 	case PCI_QLOGIC_ISP1240:
    292 	case PCI_QLOGIC_ISP1280:
    293 		return (1);
    294 #endif
    295 #ifndef	ISP_DISABLE_12160_SUPPORT
    296 	case PCI_QLOGIC_ISP12160:
    297 		return (1);
    298 #endif
    299 #ifndef	ISP_DISABLE_2100_SUPPORT
    300 	case PCI_QLOGIC_ISP2100:
    301 		return (1);
    302 #endif
    303 #ifndef	ISP_DISABLE_2200_SUPPORT
    304 	case PCI_QLOGIC_ISP2200:
    305 		return (1);
    306 #endif
    307 	default:
    308 		return (0);
    309 	}
    310 }
    311 
    312 
    313 static void
    314 isp_pci_attach(parent, self, aux)
    315 	struct device *parent, *self;
    316 	void *aux;
    317 {
    318 #ifdef	DEBUG
    319 	static char oneshot = 1;
    320 #endif
    321 	static char *nomem = "%s: no mem for sdparam table\n";
    322 	u_int32_t data, rev, linesz = PCI_DFLT_LNSZ;
    323 	struct pci_attach_args *pa = aux;
    324 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) self;
    325 	struct ispsoftc *isp = &pcs->pci_isp;
    326 	bus_space_tag_t st, iot, memt;
    327 	bus_space_handle_t sh, ioh, memh;
    328 	pci_intr_handle_t ih;
    329 	const char *intrstr;
    330 	int ioh_valid, memh_valid;
    331 
    332 	ioh_valid = (pci_mapreg_map(pa, IO_MAP_REG,
    333 	    PCI_MAPREG_TYPE_IO, 0,
    334 	    &iot, &ioh, NULL, NULL) == 0);
    335 	memh_valid = (pci_mapreg_map(pa, MEM_MAP_REG,
    336 	    PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
    337 	    &memt, &memh, NULL, NULL) == 0);
    338 
    339 	if (memh_valid) {
    340 		st = memt;
    341 		sh = memh;
    342 	} else if (ioh_valid) {
    343 		st = iot;
    344 		sh = ioh;
    345 	} else {
    346 		printf(": unable to map device registers\n");
    347 		return;
    348 	}
    349 	printf("\n");
    350 
    351 	pcs->pci_st = st;
    352 	pcs->pci_sh = sh;
    353 	pcs->pci_dmat = pa->pa_dmat;
    354 	pcs->pci_pc = pa->pa_pc;
    355 	pcs->pci_tag = pa->pa_tag;
    356 	pcs->pci_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF;
    357 	pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS_OFF;
    358 	pcs->pci_poff[SXP_BLOCK >> _BLK_REG_SHFT] = PCI_SXP_REGS_OFF;
    359 	pcs->pci_poff[RISC_BLOCK >> _BLK_REG_SHFT] = PCI_RISC_REGS_OFF;
    360 	pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] = DMA_REGS_OFF;
    361 	rev = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_CLASS_REG) & 0xff;
    362 
    363 #ifndef	ISP_DISABLE_1020_SUPPORT
    364 	if (pa->pa_id == PCI_QLOGIC_ISP) {
    365 		isp->isp_mdvec = &mdvec;
    366 		isp->isp_type = ISP_HA_SCSI_UNKNOWN;
    367 		isp->isp_param = malloc(sizeof (sdparam), M_DEVBUF, M_NOWAIT);
    368 		if (isp->isp_param == NULL) {
    369 			printf(nomem, isp->isp_name);
    370 			return;
    371 		}
    372 		bzero(isp->isp_param, sizeof (sdparam));
    373 	}
    374 #endif
    375 #ifndef	ISP_DISABLE_1080_SUPPORT
    376 	if (pa->pa_id == PCI_QLOGIC_ISP1080) {
    377 		isp->isp_mdvec = &mdvec_1080;
    378 		isp->isp_type = ISP_HA_SCSI_1080;
    379 		isp->isp_param = malloc(sizeof (sdparam), M_DEVBUF, M_NOWAIT);
    380 		if (isp->isp_param == NULL) {
    381 			printf(nomem, isp->isp_name);
    382 			return;
    383 		}
    384 		bzero(isp->isp_param, sizeof (sdparam));
    385 		pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] =
    386 		    ISP1080_DMA_REGS_OFF;
    387 	}
    388 	if (pa->pa_id == PCI_QLOGIC_ISP1240) {
    389 		isp->isp_mdvec = &mdvec_1080;
    390 		isp->isp_type = ISP_HA_SCSI_1240;
    391 		isp->isp_param =
    392 		    malloc(2 * sizeof (sdparam), M_DEVBUF, M_NOWAIT);
    393 		if (isp->isp_param == NULL) {
    394 			printf(nomem, isp->isp_name);
    395 			return;
    396 		}
    397 		bzero(isp->isp_param, 2 * sizeof (sdparam));
    398 		pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] =
    399 		    ISP1080_DMA_REGS_OFF;
    400 	}
    401 	if (pa->pa_id == PCI_QLOGIC_ISP1280) {
    402 		isp->isp_mdvec = &mdvec_1080;
    403 		isp->isp_type = ISP_HA_SCSI_1280;
    404 		isp->isp_param =
    405 		    malloc(2 * sizeof (sdparam), M_DEVBUF, M_NOWAIT);
    406 		if (isp->isp_param == NULL) {
    407 			printf(nomem, isp->isp_name);
    408 			return;
    409 		}
    410 		bzero(isp->isp_param, 2 * sizeof (sdparam));
    411 		pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] =
    412 		    ISP1080_DMA_REGS_OFF;
    413 	}
    414 #endif
    415 #ifndef	ISP_DISABLE_12160_SUPPORT
    416 	if (pa->pa_id == PCI_QLOGIC_ISP12160) {
    417 		isp->isp_mdvec = &mdvec_12160;
    418 		isp->isp_type = ISP_HA_SCSI_12160;
    419 		isp->isp_param =
    420 		    malloc(2 * sizeof (sdparam), M_DEVBUF, M_NOWAIT);
    421 		if (isp->isp_param == NULL) {
    422 			printf(nomem, isp->isp_name);
    423 			return;
    424 		}
    425 		bzero(isp->isp_param, 2 * sizeof (sdparam));
    426 		pcs->pci_poff[DMA_BLOCK >> _BLK_REG_SHFT] =
    427 		    ISP1080_DMA_REGS_OFF;
    428 	}
    429 #endif
    430 #ifndef	ISP_DISABLE_2100_SUPPORT
    431 	if (pa->pa_id == PCI_QLOGIC_ISP2100) {
    432 		isp->isp_mdvec = &mdvec_2100;
    433 		isp->isp_type = ISP_HA_FC_2100;
    434 		isp->isp_param = malloc(sizeof (fcparam), M_DEVBUF, M_NOWAIT);
    435 		if (isp->isp_param == NULL) {
    436 			printf(nomem, isp->isp_name);
    437 			return;
    438 		}
    439 		bzero(isp->isp_param, sizeof (fcparam));
    440 		pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] =
    441 		    PCI_MBOX_REGS2100_OFF;
    442 		if (rev < 3) {
    443 			/*
    444 			 * XXX: Need to get the actual revision
    445 			 * XXX: number of the 2100 FB. At any rate,
    446 			 * XXX: lower cache line size for early revision
    447 			 * XXX; boards.
    448 			 */
    449 			linesz = 1;
    450 		}
    451 	}
    452 #endif
    453 #ifndef	ISP_DISABLE_2200_SUPPORT
    454 	if (pa->pa_id == PCI_QLOGIC_ISP2200) {
    455 		isp->isp_mdvec = &mdvec_2200;
    456 		isp->isp_type = ISP_HA_FC_2200;
    457 		isp->isp_param = malloc(sizeof (fcparam), M_DEVBUF, M_NOWAIT);
    458 		if (isp->isp_param == NULL) {
    459 			printf(nomem, isp->isp_name);
    460 			return;
    461 		}
    462 		bzero(isp->isp_param, sizeof (fcparam));
    463 		pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] =
    464 		    PCI_MBOX_REGS2100_OFF;
    465 		data = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_CLASS_REG);
    466 	}
    467 #endif
    468 	/*
    469 	 * Set up logging levels.
    470 	 */
    471 #ifdef	ISP_LOGDEFAULT
    472 	isp->isp_dblev = ISP_LOGDEFAULT;
    473 #else
    474 	isp->isp_dblev = ISP_LOGCONFIG|ISP_LOGWARN|ISP_LOGERR;
    475 #ifdef	SCSIDEBUG
    476 	isp->isp_dblev |= ISP_LOGDEBUG1|ISP_LOGDEBUG2;
    477 #endif
    478 #ifdef	DEBUG
    479 	isp->isp_dblev |= ISP_LOGDEBUG0;
    480 #endif
    481 #ifdef	DIAGNOSTIC
    482 	isp->isp_dblev |= ISP_LOGINFO;
    483 #endif
    484 #endif
    485 #ifdef	DEBUG
    486 	if (oneshot) {
    487 		oneshot = 0;
    488 		isp_prt(isp, ISP_LOGCONFIG, vstring,
    489 		    ISP_PLATFORM_VERSION_MAJOR, ISP_PLATFORM_VERSION_MINOR,
    490 		    ISP_CORE_VERSION_MAJOR, ISP_CORE_VERSION_MINOR);
    491 	}
    492 #endif
    493 
    494 	isp->isp_revision = rev;
    495 
    496 	/*
    497 	 * Make sure that command register set sanely.
    498 	 */
    499 	data = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
    500 	data |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_INVALIDATE_ENABLE;
    501 
    502 	/*
    503 	 * Not so sure about these- but I think it's important that they get
    504 	 * enabled......
    505 	 */
    506 	data |= PCI_COMMAND_PARITY_ENABLE | PCI_COMMAND_SERR_ENABLE;
    507 	pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, data);
    508 
    509 	/*
    510 	 * Make sure that the latency timer, cache line size,
    511 	 * and ROM is disabled.
    512 	 */
    513 	data = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_BHLC_REG);
    514 	data &= ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT);
    515 	data &= ~(PCI_CACHELINE_MASK << PCI_CACHELINE_SHIFT);
    516 	data |= (PCI_DFLT_LTNCY	<< PCI_LATTIMER_SHIFT);
    517 	data |= (linesz << PCI_CACHELINE_SHIFT);
    518 	pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_BHLC_REG, data);
    519 
    520 	data = pci_conf_read(pa->pa_pc, pa->pa_tag, PCIR_ROMADDR);
    521 	data &= ~1;
    522 	pci_conf_write(pa->pa_pc, pa->pa_tag, PCIR_ROMADDR, data);
    523 
    524 	if (pci_intr_map(pa->pa_pc, pa->pa_intrtag, pa->pa_intrpin,
    525 	    pa->pa_intrline, &ih)) {
    526 		printf("%s: couldn't map interrupt\n", isp->isp_name);
    527 		free(isp->isp_param, M_DEVBUF);
    528 		return;
    529 	}
    530 	intrstr = pci_intr_string(pa->pa_pc, ih);
    531 	if (intrstr == NULL)
    532 		intrstr = "<I dunno>";
    533 	pcs->pci_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO,
    534 	    isp_pci_intr, isp);
    535 	if (pcs->pci_ih == NULL) {
    536 		printf("%s: couldn't establish interrupt at %s\n",
    537 			isp->isp_name, intrstr);
    538 		free(isp->isp_param, M_DEVBUF);
    539 		return;
    540 	}
    541 
    542 	printf("%s: interrupting at %s\n", isp->isp_name, intrstr);
    543 
    544 	if (IS_FC(isp)) {
    545 		DEFAULT_NODEWWN(isp) = 0x400000007F000002;
    546 	}
    547 
    548 	isp->isp_confopts = self->dv_cfdata->cf_flags;
    549 	ISP_LOCK(isp);
    550 	isp->isp_osinfo.no_mbox_ints = 1;
    551 	isp_reset(isp);
    552 	if (isp->isp_state != ISP_RESETSTATE) {
    553 		ISP_UNLOCK(isp);
    554 		free(isp->isp_param, M_DEVBUF);
    555 		return;
    556 	}
    557 	ENABLE_INTS(isp);
    558 	isp_init(isp);
    559 	if (isp->isp_state != ISP_INITSTATE) {
    560 		isp_uninit(isp);
    561 		ISP_UNLOCK(isp);
    562 		free(isp->isp_param, M_DEVBUF);
    563 		return;
    564 	}
    565 	/*
    566 	 * Do platform attach.
    567 	 */
    568 	ISP_UNLOCK(isp);
    569 	isp_attach(isp);
    570 	if (isp->isp_state != ISP_RUNSTATE) {
    571 		ISP_LOCK(isp);
    572 		isp_uninit(isp);
    573 		free(isp->isp_param, M_DEVBUF);
    574 		ISP_UNLOCK(isp);
    575 	}
    576 }
    577 
    578 static u_int16_t
    579 isp_pci_rd_reg(isp, regoff)
    580 	struct ispsoftc *isp;
    581 	int regoff;
    582 {
    583 	u_int16_t rv;
    584 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
    585 	int offset, oldconf = 0;
    586 
    587 	if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
    588 		/*
    589 		 * We will assume that someone has paused the RISC processor.
    590 		 */
    591 		oldconf = isp_pci_rd_reg(isp, BIU_CONF1);
    592 		isp_pci_wr_reg(isp, BIU_CONF1, oldconf | BIU_PCI_CONF1_SXP);
    593 		delay(250);
    594 	}
    595 	offset = pcs->pci_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
    596 	offset += (regoff & 0xff);
    597 	rv = bus_space_read_2(pcs->pci_st, pcs->pci_sh, offset);
    598 	if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
    599 		isp_pci_wr_reg(isp, BIU_CONF1, oldconf);
    600 		delay(250);
    601 	}
    602 	return (rv);
    603 }
    604 
    605 static void
    606 isp_pci_wr_reg(isp, regoff, val)
    607 	struct ispsoftc *isp;
    608 	int regoff;
    609 	u_int16_t val;
    610 {
    611 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
    612 	int offset, oldconf = 0;
    613 
    614 	if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
    615 		/*
    616 		 * We will assume that someone has paused the RISC processor.
    617 		 */
    618 		oldconf = isp_pci_rd_reg(isp, BIU_CONF1);
    619 		isp_pci_wr_reg(isp, BIU_CONF1, oldconf | BIU_PCI_CONF1_SXP);
    620 		delay(250);
    621 	}
    622 	offset = pcs->pci_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
    623 	offset += (regoff & 0xff);
    624 	bus_space_write_2(pcs->pci_st, pcs->pci_sh, offset, val);
    625 	if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
    626 		isp_pci_wr_reg(isp, BIU_CONF1, oldconf);
    627 		delay(250);
    628 	}
    629 }
    630 
    631 #if !(defined(ISP_DISABLE_1080_SUPPORT) && defined(ISP_DISABLE_12160_SUPPORT))
    632 static u_int16_t
    633 isp_pci_rd_reg_1080(isp, regoff)
    634 	struct ispsoftc *isp;
    635 	int regoff;
    636 {
    637 	u_int16_t rv, oc = 0;
    638 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
    639 	int offset;
    640 
    641 	if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
    642 		u_int16_t tc;
    643 		/*
    644 		 * We will assume that someone has paused the RISC processor.
    645 		 */
    646 		oc = isp_pci_rd_reg(isp, BIU_CONF1);
    647 		tc = oc & ~BIU_PCI1080_CONF1_DMA;
    648 		if (IS_1280(isp)) {
    649 			if (regoff & SXP_BANK1_SELECT)
    650 				tc |= BIU_PCI1080_CONF1_SXP0;
    651 			else
    652 				tc |= BIU_PCI1080_CONF1_SXP1;
    653 		} else {
    654 			tc |= BIU_PCI1080_CONF1_SXP0;
    655 		}
    656 		isp_pci_wr_reg(isp, BIU_CONF1, tc);
    657 		delay(250);
    658 	} else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) {
    659 		oc = isp_pci_rd_reg(isp, BIU_CONF1);
    660 		isp_pci_wr_reg(isp, BIU_CONF1, oc | BIU_PCI1080_CONF1_DMA);
    661 		delay(250);
    662 	}
    663 	offset = pcs->pci_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
    664 	offset += (regoff & 0xff);
    665 	rv = bus_space_read_2(pcs->pci_st, pcs->pci_sh, offset);
    666 	/*
    667 	 * Okay, because BIU_CONF1 is always nonzero
    668 	 */
    669 	if (oc) {
    670 		isp_pci_wr_reg(isp, BIU_CONF1, oc);
    671 		delay(250);
    672 	}
    673 	return (rv);
    674 }
    675 
    676 static void
    677 isp_pci_wr_reg_1080(isp, regoff, val)
    678 	struct ispsoftc *isp;
    679 	int regoff;
    680 	u_int16_t val;
    681 {
    682 	u_int16_t oc = 0;
    683 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
    684 	int offset;
    685 
    686 	if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) {
    687 		u_int16_t tc;
    688 		/*
    689 		 * We will assume that someone has paused the RISC processor.
    690 		 */
    691 		oc = isp_pci_rd_reg(isp, BIU_CONF1);
    692 		tc = oc & ~BIU_PCI1080_CONF1_DMA;
    693 		if (IS_1280(isp)) {
    694 			if (regoff & SXP_BANK1_SELECT)
    695 				tc |= BIU_PCI1080_CONF1_SXP0;
    696 			else
    697 				tc |= BIU_PCI1080_CONF1_SXP1;
    698 		} else {
    699 			tc |= BIU_PCI1080_CONF1_SXP0;
    700 		}
    701 		isp_pci_wr_reg(isp, BIU_CONF1, tc);
    702 		delay(250);
    703 	} else if ((regoff & _BLK_REG_MASK) == DMA_BLOCK) {
    704 		oc = isp_pci_rd_reg(isp, BIU_CONF1);
    705 		isp_pci_wr_reg(isp, BIU_CONF1, oc | BIU_PCI1080_CONF1_DMA);
    706 		delay(250);
    707 	}
    708 	offset = pcs->pci_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
    709 	offset += (regoff & 0xff);
    710 	bus_space_write_2(pcs->pci_st, pcs->pci_sh, offset, val);
    711 	/*
    712 	 * Okay, because BIU_CONF1 is always nonzero
    713 	 */
    714 	if (oc) {
    715 		isp_pci_wr_reg(isp, BIU_CONF1, oc);
    716 		delay(250);
    717 	}
    718 }
    719 #endif
    720 
    721 static int
    722 isp_pci_mbxdma(isp)
    723 	struct ispsoftc *isp;
    724 {
    725 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp;
    726 	bus_dma_tag_t dmat = pcs->pci_dmat;
    727 	bus_dma_segment_t sg;
    728 	bus_size_t len;
    729 	fcparam *fcp;
    730 	int rs, i;
    731 
    732 	if (isp->isp_rquest_dma)	/* been here before? */
    733 		return (0);
    734 
    735 	len = isp->isp_maxcmds * sizeof (XS_T);
    736 	isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK);
    737 	if (isp->isp_xflist == NULL) {
    738 		isp_prt(isp, ISP_LOGERR, "cannot malloc xflist array");
    739 		return (1);
    740 	}
    741 	bzero(isp->isp_xflist, len);
    742 	len = isp->isp_maxcmds * sizeof (bus_dmamap_t);
    743 	pcs->pci_xfer_dmap = (bus_dmamap_t *) malloc(len, M_DEVBUF, M_WAITOK);
    744 	if (pcs->pci_xfer_dmap == NULL) {
    745 		free(isp->isp_xflist, M_DEVBUF);
    746 		isp->isp_xflist = NULL;
    747 		isp_prt(isp, ISP_LOGERR, "cannot malloc dma map array");
    748 		return (1);
    749 	}
    750 	for (i = 0; i < isp->isp_maxcmds; i++) {
    751 		if (bus_dmamap_create(dmat, MAXPHYS, (MAXPHYS / NBPG) + 1,
    752 		    MAXPHYS, 0, BUS_DMA_NOWAIT, &pcs->pci_xfer_dmap[i])) {
    753 			isp_prt(isp, ISP_LOGERR, "cannot create dma maps");
    754 			break;
    755 		}
    756 	}
    757 	if (i < isp->isp_maxcmds) {
    758 		while (--i >= 0) {
    759 			bus_dmamap_destroy(dmat, pcs->pci_xfer_dmap[i]);
    760 		}
    761 		free(isp->isp_xflist, M_DEVBUF);
    762 		free(pcs->pci_xfer_dmap, M_DEVBUF);
    763 		isp->isp_xflist = NULL;
    764 		pcs->pci_xfer_dmap = NULL;
    765 		return (1);
    766 	}
    767 
    768 	/*
    769 	 * Allocate and map the request queue.
    770 	 */
    771 	len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp));
    772 	if (bus_dmamem_alloc(dmat, len, NBPG, 0, &sg, 1, &rs, BUS_DMA_NOWAIT) ||
    773 	    bus_dmamem_map(pcs->pci_dmat, &sg, rs, len,
    774 	    (caddr_t *)&isp->isp_rquest, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
    775 		goto dmafail;
    776 	}
    777 
    778 	if (bus_dmamap_create(dmat, len, 1, len, 0, BUS_DMA_NOWAIT,
    779 	    &pcs->pci_rquest_dmap) || bus_dmamap_load(dmat,
    780 	    pcs->pci_rquest_dmap, (caddr_t)isp->isp_rquest, len, NULL,
    781 	    BUS_DMA_NOWAIT)) {
    782 		goto dmafail;
    783 	}
    784 
    785 	isp->isp_rquest_dma = pcs->pci_rquest_dmap->dm_segs[0].ds_addr;
    786 
    787 	/*
    788 	 * Allocate and map the result queue.
    789 	 */
    790 	len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
    791 	if (bus_dmamem_alloc(dmat, len, NBPG, 0, &sg, 1, &rs, BUS_DMA_NOWAIT) ||
    792 	    bus_dmamem_map(dmat, &sg, rs, len, (caddr_t *)&isp->isp_result,
    793 	    BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
    794 		goto dmafail;
    795 	}
    796 	if (bus_dmamap_create(dmat, len, 1, len, 0, BUS_DMA_NOWAIT,
    797 	    &pcs->pci_result_dmap) || bus_dmamap_load(pcs->pci_dmat,
    798 	    pcs->pci_result_dmap, (caddr_t)isp->isp_result, len, NULL,
    799 	    BUS_DMA_NOWAIT)) {
    800 		goto dmafail;
    801 	}
    802 	isp->isp_result_dma = pcs->pci_result_dmap->dm_segs[0].ds_addr;
    803 
    804 	if (IS_SCSI(isp)) {
    805 		return (0);
    806 	}
    807 
    808 	fcp = isp->isp_param;
    809 	len = ISP2100_SCRLEN;
    810 	if (bus_dmamem_alloc(dmat, len, NBPG, 0, &sg, 1, &rs, BUS_DMA_NOWAIT) ||
    811 	    bus_dmamem_map(dmat, &sg, rs, len, (caddr_t *)&fcp->isp_scratch,
    812 	    BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
    813 		goto dmafail;
    814 	}
    815 	if (bus_dmamap_create(dmat, len, 1, len, 0, BUS_DMA_NOWAIT,
    816 	    &pcs->pci_scratch_dmap) || bus_dmamap_load(dmat,
    817 	    pcs->pci_scratch_dmap, (caddr_t)fcp->isp_scratch, len, NULL,
    818 	    BUS_DMA_NOWAIT)) {
    819 		goto dmafail;
    820 	}
    821 	fcp->isp_scdma = pcs->pci_scratch_dmap->dm_segs[0].ds_addr;
    822 	return (0);
    823 dmafail:
    824 	isp_prt(isp, ISP_LOGERR, "mailbox dma setup failure");
    825 	for (i = 0; i < isp->isp_maxcmds; i++) {
    826 		bus_dmamap_destroy(dmat, pcs->pci_xfer_dmap[i]);
    827 	}
    828 	free(isp->isp_xflist, M_DEVBUF);
    829 	free(pcs->pci_xfer_dmap, M_DEVBUF);
    830 	isp->isp_xflist = NULL;
    831 	pcs->pci_xfer_dmap = NULL;
    832 	return (1);
    833 }
    834 
    835 static int
    836 isp_pci_dmasetup(isp, xs, rq, iptrp, optr)
    837 	struct ispsoftc *isp;
    838 	struct scsipi_xfer *xs;
    839 	ispreq_t *rq;
    840 	u_int16_t *iptrp;
    841 	u_int16_t optr;
    842 {
    843 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp;
    844 	bus_dmamap_t dmap;
    845 	ispcontreq_t *crq;
    846 	int segcnt, seg, error, ovseg, seglim, drq;
    847 
    848 	dmap = pcs->pci_xfer_dmap[isp_handle_index(rq->req_handle)];
    849 
    850 	if (xs->datalen == 0) {
    851 		rq->req_seg_count = 1;
    852 		goto mbxsync;
    853 	}
    854 	if (xs->xs_control & XS_CTL_DATA_IN) {
    855 		drq = REQFLAG_DATA_IN;
    856 	} else {
    857 		drq = REQFLAG_DATA_OUT;
    858 	}
    859 
    860 	if (IS_FC(isp)) {
    861 		seglim = ISP_RQDSEG_T2;
    862 		((ispreqt2_t *)rq)->req_totalcnt = xs->datalen;
    863 		((ispreqt2_t *)rq)->req_flags |= drq;
    864 	} else {
    865 		rq->req_flags |= drq;
    866 		if (XS_CDBLEN(xs) > 12) {
    867 			seglim = 0;
    868 		} else {
    869 			seglim = ISP_RQDSEG;
    870 		}
    871 	}
    872 	error = bus_dmamap_load(pcs->pci_dmat, dmap, xs->data, xs->datalen,
    873 	    NULL, xs->xs_control & XS_CTL_NOSLEEP ?
    874 	    BUS_DMA_NOWAIT : BUS_DMA_WAITOK);
    875 	if (error) {
    876 		XS_SETERR(xs, HBA_BOTCH);
    877 		return (CMD_COMPLETE);
    878 	}
    879 
    880 	segcnt = dmap->dm_nsegs;
    881 
    882 	for (seg = 0, rq->req_seg_count = 0;
    883 	    seglim && seg < segcnt && rq->req_seg_count < seglim;
    884 	    seg++, rq->req_seg_count++) {
    885 		if (IS_FC(isp)) {
    886 			ispreqt2_t *rq2 = (ispreqt2_t *)rq;
    887 			rq2->req_dataseg[rq2->req_seg_count].ds_count =
    888 			    dmap->dm_segs[seg].ds_len;
    889 			rq2->req_dataseg[rq2->req_seg_count].ds_base =
    890 			    dmap->dm_segs[seg].ds_addr;
    891 		} else {
    892 			rq->req_dataseg[rq->req_seg_count].ds_count =
    893 			    dmap->dm_segs[seg].ds_len;
    894 			rq->req_dataseg[rq->req_seg_count].ds_base =
    895 			    dmap->dm_segs[seg].ds_addr;
    896 		}
    897 	}
    898 
    899 	if (seg == segcnt)
    900 		goto dmasync;
    901 
    902 	do {
    903 		crq = (ispcontreq_t *) ISP_QUEUE_ENTRY(isp->isp_rquest, *iptrp);
    904 		*iptrp = ISP_NXT_QENTRY(*iptrp, RQUEST_QUEUE_LEN(isp));
    905 		if (*iptrp == optr) {
    906 			isp_prt(isp, ISP_LOGDEBUG0, "Request Queue Overflow++");
    907 			bus_dmamap_unload(pcs->pci_dmat, dmap);
    908 			XS_SETERR(xs, HBA_BOTCH);
    909 			return (CMD_EAGAIN);
    910 		}
    911 		rq->req_header.rqs_entry_count++;
    912 		bzero((void *)crq, sizeof (*crq));
    913 		crq->req_header.rqs_entry_count = 1;
    914 		crq->req_header.rqs_entry_type = RQSTYPE_DATASEG;
    915 
    916 		for (ovseg = 0; seg < segcnt && ovseg < ISP_CDSEG;
    917 		    rq->req_seg_count++, seg++, ovseg++) {
    918 			crq->req_dataseg[ovseg].ds_count =
    919 			    dmap->dm_segs[seg].ds_len;
    920 			crq->req_dataseg[ovseg].ds_base =
    921 			    dmap->dm_segs[seg].ds_addr;
    922 		}
    923 	} while (seg < segcnt);
    924 
    925 
    926 dmasync:
    927 	bus_dmamap_sync(pcs->pci_dmat, dmap, 0, dmap->dm_mapsize,
    928 	    (xs->xs_control & XS_CTL_DATA_IN) ?  BUS_DMASYNC_PREREAD :
    929 	    BUS_DMASYNC_PREWRITE);
    930 
    931 mbxsync:
    932 	ISP_SWIZZLE_REQUEST(isp, rq);
    933 	bus_dmamap_sync(pcs->pci_dmat, pcs->pci_rquest_dmap, 0,
    934 	    pcs->pci_rquest_dmap->dm_mapsize, BUS_DMASYNC_PREWRITE);
    935 	return (CMD_QUEUED);
    936 }
    937 
    938 static int
    939 isp_pci_intr(arg)
    940 	void *arg;
    941 {
    942 	int rv;
    943 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)arg;
    944 	bus_dmamap_sync(pcs->pci_dmat, pcs->pci_result_dmap, 0,
    945 	    pcs->pci_result_dmap->dm_mapsize, BUS_DMASYNC_POSTREAD);
    946 	pcs->pci_isp.isp_osinfo.onintstack = 1;
    947 	rv = isp_intr(arg);
    948 	pcs->pci_isp.isp_osinfo.onintstack = 0;
    949 	return (rv);
    950 }
    951 
    952 static void
    953 isp_pci_dmateardown(isp, xs, handle)
    954 	struct ispsoftc *isp;
    955 	struct scsipi_xfer *xs;
    956 	u_int32_t handle;
    957 {
    958 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp;
    959 	bus_dmamap_t dmap = pcs->pci_xfer_dmap[isp_handle_index(handle)];
    960 	bus_dmamap_sync(pcs->pci_dmat, dmap, 0, dmap->dm_mapsize,
    961 	    xs->xs_control & XS_CTL_DATA_IN ?
    962 	    BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
    963 	bus_dmamap_unload(pcs->pci_dmat, dmap);
    964 }
    965 
    966 static void
    967 isp_pci_reset1(isp)
    968 	struct ispsoftc *isp;
    969 {
    970 	/* Make sure the BIOS is disabled */
    971 	isp_pci_wr_reg(isp, HCCR, PCI_HCCR_CMD_BIOS);
    972 }
    973 
    974 static void
    975 isp_pci_dumpregs(isp, msg)
    976 	struct ispsoftc *isp;
    977 	const char *msg;
    978 {
    979 	struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp;
    980 	if (msg)
    981 		printf("%s: %s\n", isp->isp_name, msg);
    982 	if (IS_SCSI(isp))
    983 		printf("    biu_conf1=%x", ISP_READ(isp, BIU_CONF1));
    984 	else
    985 		printf("    biu_csr=%x", ISP_READ(isp, BIU2100_CSR));
    986 	printf(" biu_icr=%x biu_isr=%x biu_sema=%x ", ISP_READ(isp, BIU_ICR),
    987 	    ISP_READ(isp, BIU_ISR), ISP_READ(isp, BIU_SEMA));
    988 	printf("risc_hccr=%x\n", ISP_READ(isp, HCCR));
    989 
    990 
    991 	if (IS_SCSI(isp)) {
    992 		ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
    993 		printf("    cdma_conf=%x cdma_sts=%x cdma_fifostat=%x\n",
    994 			ISP_READ(isp, CDMA_CONF), ISP_READ(isp, CDMA_STATUS),
    995 			ISP_READ(isp, CDMA_FIFO_STS));
    996 		printf("    ddma_conf=%x ddma_sts=%x ddma_fifostat=%x\n",
    997 			ISP_READ(isp, DDMA_CONF), ISP_READ(isp, DDMA_STATUS),
    998 			ISP_READ(isp, DDMA_FIFO_STS));
    999 		printf("    sxp_int=%x sxp_gross=%x sxp(scsi_ctrl)=%x\n",
   1000 			ISP_READ(isp, SXP_INTERRUPT),
   1001 			ISP_READ(isp, SXP_GROSS_ERR),
   1002 			ISP_READ(isp, SXP_PINS_CTRL));
   1003 		ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
   1004 	}
   1005 	printf("    mbox regs: %x %x %x %x %x\n",
   1006 	    ISP_READ(isp, OUTMAILBOX0), ISP_READ(isp, OUTMAILBOX1),
   1007 	    ISP_READ(isp, OUTMAILBOX2), ISP_READ(isp, OUTMAILBOX3),
   1008 	    ISP_READ(isp, OUTMAILBOX4));
   1009 	printf("    PCI Status Command/Status=%x\n",
   1010 	    pci_conf_read(pcs->pci_pc, pcs->pci_tag, PCI_COMMAND_STATUS_REG));
   1011 }
   1012