2 * Copyright (c) 1997-2006 by Matthew Jacob
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice immediately at the beginning of the file, without modification,
10 * this list of conditions, and the following disclaimer.
11 * 2. The name of the author may not be used to endorse or promote products
12 * derived from this software without specific prior written permission.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
18 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SBus specific probe and attach routines for Qlogic ISP SCSI adapters.
31 #include <sys/cdefs.h>
32 __FBSDID("$FreeBSD$");
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #if __FreeBSD_version >= 700000
37 #include <sys/linker.h>
38 #include <sys/firmware.h>
41 #include <sys/kernel.h>
42 #include <sys/module.h>
43 #include <sys/resource.h>
45 #include <dev/ofw/ofw_bus.h>
47 #include <machine/bus.h>
48 #include <machine/resource.h>
50 #include <sparc64/sbus/sbusvar.h>
52 #include <dev/isp/isp_freebsd.h>
55 isp_sbus_rd_reg(ispsoftc_t *, int);
57 isp_sbus_wr_reg(ispsoftc_t *, int, uint32_t);
59 isp_sbus_rd_isr(ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *);
60 static int isp_sbus_mbxdma(ispsoftc_t *);
62 isp_sbus_dmasetup(ispsoftc_t *, XS_T *, ispreq_t *, uint32_t *, uint32_t);
64 static void isp_sbus_reset0(ispsoftc_t *);
65 static void isp_sbus_reset1(ispsoftc_t *);
66 static void isp_sbus_dumpregs(ispsoftc_t *, const char *);
68 static struct ispmdvec mdvec = {
74 isp_common_dmateardown,
79 BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64
82 static int isp_sbus_probe (device_t);
83 static int isp_sbus_attach (device_t);
86 #define ISP_SBD(isp) ((struct isp_sbussoftc *)isp)->sbus_dev
87 struct isp_sbussoftc {
90 struct resource * sbus_reg;
92 int16_t sbus_poff[_NREG_BLKS];
94 struct ispmdvec sbus_mdvec;
95 struct resource * sbus_ires;
99 static device_method_t isp_sbus_methods[] = {
100 /* Device interface */
101 DEVMETHOD(device_probe, isp_sbus_probe),
102 DEVMETHOD(device_attach, isp_sbus_attach),
106 static driver_t isp_sbus_driver = {
107 "isp", isp_sbus_methods, sizeof (struct isp_sbussoftc)
109 static devclass_t isp_devclass;
110 DRIVER_MODULE(isp, sbus, isp_sbus_driver, isp_devclass, 0, 0);
111 #if __FreeBSD_version < 700000
112 extern ispfwfunc *isp_get_firmware_p;
116 isp_sbus_probe(device_t dev)
119 const char *name = ofw_bus_get_name(dev);
120 if (strcmp(name, "SUNW,isp") == 0 ||
121 strcmp(name, "QLGC,isp") == 0 ||
122 strcmp(name, "ptisp") == 0 ||
123 strcmp(name, "PTI,ptisp") == 0) {
129 if (isp_announced == 0 && bootverbose) {
130 printf("Qlogic ISP Driver, FreeBSD Version %d.%d, "
131 "Core Version %d.%d\n",
132 ISP_PLATFORM_VERSION_MAJOR, ISP_PLATFORM_VERSION_MINOR,
133 ISP_CORE_VERSION_MAJOR, ISP_CORE_VERSION_MINOR);
140 isp_sbus_attach(device_t dev)
142 struct resource *regs;
143 int tval, iqd, isp_debug, role, rid, ispburst;
144 struct isp_sbussoftc *sbs;
145 ispsoftc_t *isp = NULL;
150 * Figure out if we're supposed to skip this one.
151 * If we are, we actually go to ISP_ROLE_NONE.
155 if (resource_int_value(device_get_name(dev), device_get_unit(dev),
156 "disable", &tval) == 0 && tval) {
157 device_printf(dev, "device is disabled\n");
158 /* but return 0 so the !$)$)*!$*) unit isn't reused */
163 if (resource_int_value(device_get_name(dev), device_get_unit(dev),
164 "role", &role) == 0 &&
165 ((role & ~(ISP_ROLE_INITIATOR|ISP_ROLE_TARGET)) == 0)) {
166 device_printf(dev, "setting role to 0x%x\n", role);
168 #ifdef ISP_TARGET_MODE
169 role = ISP_ROLE_INITIATOR|ISP_ROLE_TARGET;
171 role = ISP_DEFAULT_ROLES;
175 sbs = malloc(sizeof (*sbs), M_DEVBUF, M_NOWAIT | M_ZERO);
177 device_printf(dev, "cannot allocate softc\n");
184 regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
186 device_printf(dev, "unable to map registers\n");
190 sbs->sbus_reg = regs;
191 sbs->sbus_mdvec = mdvec;
193 sbs->sbus_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF;
194 sbs->sbus_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = SBUS_MBOX_REGS_OFF;
195 sbs->sbus_poff[SXP_BLOCK >> _BLK_REG_SHFT] = SBUS_SXP_REGS_OFF;
196 sbs->sbus_poff[RISC_BLOCK >> _BLK_REG_SHFT] = SBUS_RISC_REGS_OFF;
197 sbs->sbus_poff[DMA_BLOCK >> _BLK_REG_SHFT] = DMA_REGS_OFF;
198 isp = &sbs->sbus_isp;
199 isp->isp_bus_tag = rman_get_bustag(regs);
200 isp->isp_bus_handle = rman_get_bushandle(regs);
201 isp->isp_mdvec = &sbs->sbus_mdvec;
202 isp->isp_bustype = ISP_BT_SBUS;
203 isp->isp_type = ISP_HA_SCSI_UNKNOWN;
204 isp->isp_param = &sbs->sbus_param;
205 isp->isp_revision = 0; /* XXX */
206 isp->isp_role = role;
210 * Get the clock frequency and convert it from HZ to MHz,
211 * rounding up. This defaults to 25MHz if there isn't a
212 * device specific one in the OFW device tree.
214 sbs->sbus_mdvec.dv_clock = (sbus_get_clockfreq(dev) + 500000)/1000000;
217 * Now figure out what the proper burst sizes, etc., to use.
218 * Unfortunately, there is no ddi_dma_burstsizes here which
219 * walks up the tree finding the limiting burst size node (if
220 * any). We just use what's here for isp.
222 ispburst = sbus_get_burstsz(dev);
224 ispburst = SBUS_BURST_32 - 1;
226 sbs->sbus_mdvec.dv_conf1 = 0;
227 if (ispburst & (1 << 5)) {
228 sbs->sbus_mdvec.dv_conf1 = BIU_SBUS_CONF1_FIFO_32;
229 } else if (ispburst & (1 << 4)) {
230 sbs->sbus_mdvec.dv_conf1 = BIU_SBUS_CONF1_FIFO_16;
231 } else if (ispburst & (1 << 3)) {
232 sbs->sbus_mdvec.dv_conf1 =
233 BIU_SBUS_CONF1_BURST8 | BIU_SBUS_CONF1_FIFO_8;
235 if (sbs->sbus_mdvec.dv_conf1) {
236 sbs->sbus_mdvec.dv_conf1 |= BIU_BURST_ENABLE;
240 * We don't trust NVRAM on SBus cards
242 isp->isp_confopts |= ISP_CFG_NONVRAM;
245 * Mark things if we're a PTI SBus adapter.
247 if (strcmp("PTI,ptisp", ofw_bus_get_name(dev)) == 0 ||
248 strcmp("ptisp", ofw_bus_get_name(dev)) == 0) {
249 SDPARAM(isp)->isp_ptisp = 1;
253 #if __FreeBSD_version >= 700000
254 isp->isp_osinfo.fw = firmware_get("isp_1000");
255 if (isp->isp_osinfo.fw) {
260 stupid.cp = isp->isp_osinfo.fw->data;
261 isp->isp_mdvec->dv_ispfw = stupid.sp;
265 * Try and find firmware for this device.
267 if (isp_get_firmware_p) {
268 (*isp_get_firmware_p)(0, 0, 0x1000, &sbs->sbus_mdvec.dv_ispfw);
273 if (resource_int_value(device_get_name(dev), device_get_unit(dev),
274 "fwload_disable", &tval) == 0 && tval != 0) {
275 isp->isp_confopts |= ISP_CFG_NORELOAD;
278 isp->isp_osinfo.default_id = -1;
279 if (resource_int_value(device_get_name(dev), device_get_unit(dev),
280 "iid", &tval) == 0) {
281 isp->isp_osinfo.default_id = tval;
282 isp->isp_confopts |= ISP_CFG_OWNLOOPID;
284 if (isp->isp_osinfo.default_id == -1) {
286 * XXX: should be a way to get properties w/o having
287 * XXX: to call OF_xxx functions
289 isp->isp_osinfo.default_id = 7;
293 (void) resource_int_value(device_get_name(dev), device_get_unit(dev),
294 "debug", &isp_debug);
296 /* Make sure the lock is set up. */
297 mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF);
301 sbs->sbus_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd,
302 RF_ACTIVE | RF_SHAREABLE);
303 if (sbs->sbus_ires == NULL) {
304 device_printf(dev, "could not allocate interrupt\n");
308 if (isp_setup_intr(dev, sbs->sbus_ires, ISP_IFLAGS, NULL,
309 isp_platform_intr, isp, &sbs->ih)) {
310 device_printf(dev, "could not setup interrupt\n");
316 * Set up logging levels.
319 isp->isp_dblev = isp_debug;
321 isp->isp_dblev = ISP_LOGWARN|ISP_LOGERR;
324 isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO;
328 * Make sure we're in reset state.
331 if (isp->isp_state != ISP_RESETSTATE) {
336 if (isp->isp_role != ISP_ROLE_NONE && isp->isp_state != ISP_INITSTATE) {
341 if (isp->isp_role != ISP_ROLE_NONE && isp->isp_state != ISP_RUNSTATE) {
349 if (sbs && ints_setup) {
350 (void) bus_teardown_intr(dev, sbs->sbus_ires, sbs->ih);
353 if (sbs && sbs->sbus_ires) {
354 bus_release_resource(dev, SYS_RES_IRQ, iqd, sbs->sbus_ires);
357 if (locksetup && isp) {
358 mtx_destroy(&isp->isp_osinfo.lock);
362 (void) bus_release_resource(dev, 0, 0, regs);
366 if (sbs->sbus_isp.isp_param) {
367 free(sbs->sbus_isp.isp_param, M_DEVBUF);
374 #define IspVirt2Off(a, x) \
375 (((struct isp_sbussoftc *)a)->sbus_poff[((x) & _BLK_REG_MASK) >> \
376 _BLK_REG_SHFT] + ((x) & 0xff))
378 #define BXR2(sbc, off) \
379 bus_space_read_2(isp->isp_bus_tag, isp->isp_bus_handle, off)
382 isp_sbus_rd_isr(ispsoftc_t *isp, uint32_t *isrp, uint16_t *semap, uint16_t *mbp)
386 isr = BXR2(sbc, IspVirt2Off(isp, BIU_ISR));
387 sema = BXR2(sbc, IspVirt2Off(isp, BIU_SEMA));
388 isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema);
389 isr &= INT_PENDING_MASK(isp);
390 sema &= BIU_SEMA_LOCK;
391 if (isr == 0 && sema == 0) {
395 if ((*semap = sema) != 0) {
396 *mbp = BXR2(sbc, IspVirt2Off(isp, OUTMAILBOX0));
402 isp_sbus_rd_reg(ispsoftc_t *isp, int regoff)
405 struct isp_sbussoftc *sbs = (struct isp_sbussoftc *) isp;
406 int offset = sbs->sbus_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
407 offset += (regoff & 0xff);
408 rval = bus_space_read_2(isp->isp_bus_tag, isp->isp_bus_handle, offset);
409 isp_prt(isp, ISP_LOGDEBUG3,
410 "isp_sbus_rd_reg(off %x) = %x", regoff, rval);
415 isp_sbus_wr_reg(ispsoftc_t *isp, int regoff, uint32_t val)
417 struct isp_sbussoftc *sbs = (struct isp_sbussoftc *) isp;
418 int offset = sbs->sbus_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT];
419 offset += (regoff & 0xff);
420 isp_prt(isp, ISP_LOGDEBUG3,
421 "isp_sbus_wr_reg(off %x) = %x", regoff, val);
422 bus_space_write_2(isp->isp_bus_tag, isp->isp_bus_handle, offset, val);
423 MEMORYBARRIER(isp, SYNC_REG, offset, 2);
431 static void imc(void *, bus_dma_segment_t *, int, int);
434 imc(void *arg, bus_dma_segment_t *segs, int nseg, int error)
436 struct imush *imushp = (struct imush *) arg;
438 imushp->error = error;
440 ispsoftc_t *isp =imushp->isp;
441 bus_addr_t addr = segs->ds_addr;
443 isp->isp_rquest_dma = addr;
444 addr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp));
445 isp->isp_result_dma = addr;
450 isp_sbus_mbxdma(ispsoftc_t *isp)
458 * Already been here? If so, leave...
460 if (isp->isp_rquest) {
466 len = sizeof (struct isp_pcmd) * isp->isp_maxcmds;
467 isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *)
468 malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
469 if (isp->isp_osinfo.pcmd_pool == NULL) {
470 isp_prt(isp, ISP_LOGERR, "cannot alloc pcmd pool");
475 len = sizeof (XS_T **) * isp->isp_maxcmds;
476 isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
477 if (isp->isp_xflist == NULL) {
478 isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
482 len = sizeof (bus_dmamap_t) * isp->isp_maxcmds;
484 if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_SBD(isp), 1,
485 BUS_SPACE_MAXADDR_24BIT+1, BUS_SPACE_MAXADDR_32BIT,
486 BUS_SPACE_MAXADDR_32BIT, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT,
487 ISP_NSEGS, BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_osinfo.dmat)) {
488 isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
489 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
490 free(isp->isp_xflist, M_DEVBUF);
496 * Allocate and map the request, result queues, plus FC scratch area.
498 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp));
499 len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
501 ns = (len / PAGE_SIZE) + 1;
502 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN,
503 BUS_SPACE_MAXADDR_24BIT+1, BUS_SPACE_MAXADDR_32BIT,
504 BUS_SPACE_MAXADDR_32BIT, NULL, NULL, len, ns,
505 BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_cdmat)) {
506 isp_prt(isp, ISP_LOGERR,
507 "cannot create a dma tag for control spaces");
508 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
509 free(isp->isp_xflist, M_DEVBUF);
514 if (bus_dmamem_alloc(isp->isp_cdmat, (void **)&base, BUS_DMA_NOWAIT,
515 &isp->isp_cdmap) != 0) {
516 isp_prt(isp, ISP_LOGERR,
517 "cannot allocate %d bytes of CCB memory", len);
518 bus_dma_tag_destroy(isp->isp_cdmat);
519 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
520 free(isp->isp_xflist, M_DEVBUF);
525 for (i = 0; i < isp->isp_maxcmds; i++) {
526 struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i];
527 error = bus_dmamap_create(isp->isp_osinfo.dmat, 0, &pcmd->dmap);
529 isp_prt(isp, ISP_LOGERR,
530 "error %d creating per-cmd DMA maps", error);
532 bus_dmamap_destroy(isp->isp_osinfo.dmat,
533 isp->isp_osinfo.pcmd_pool[i].dmap);
537 isp_callout_init(&pcmd->wdog);
538 if (i == isp->isp_maxcmds-1) {
541 pcmd->next = &isp->isp_osinfo.pcmd_pool[i+1];
544 isp->isp_osinfo.pcmd_free = &isp->isp_osinfo.pcmd_pool[0];
548 bus_dmamap_load(isp->isp_cdmat, isp->isp_cdmap, base, len, imc, &im, 0);
550 isp_prt(isp, ISP_LOGERR,
551 "error %d loading dma map for control areas", im.error);
555 isp->isp_rquest = base;
556 base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp));
557 isp->isp_result = base;
562 bus_dmamem_free(isp->isp_cdmat, base, isp->isp_cdmap);
563 bus_dma_tag_destroy(isp->isp_cdmat);
564 free(isp->isp_xflist, M_DEVBUF);
565 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
566 isp->isp_rquest = NULL;
580 #define MUSHERR_NOQENTRIES -2
583 static void dma2(void *, bus_dma_segment_t *, int, int);
586 dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
590 struct ccb_scsiio *csio;
591 bus_dma_segment_t *eseg;
603 isp_prt(mp->isp, ISP_LOGERR, "bad segment count (%d)", nseg);
607 csio = mp->cmd_token;
612 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
613 bus_dmamap_sync(isp->isp_osinfo.dmat,
614 PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD);
616 bus_dmamap_sync(isp->isp_osinfo.dmat,
617 PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE);
620 datalen = XS_XFRLEN(csio);
623 * We're passed an initial partially filled in entry that
624 * has most fields filled in except for data transfer
627 * Our job is to fill in the initial request queue entry and
628 * then to start allocating and filling in continuation entries
629 * until we've covered the entire transfer.
632 if (csio->cdb_len > 12) {
637 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
638 rq->req_flags |= REQFLAG_DATA_IN;
640 rq->req_flags |= REQFLAG_DATA_OUT;
643 eseg = dm_segs + nseg;
645 while (datalen != 0 && rq->req_seg_count < seglim && dm_segs != eseg) {
646 rq->req_dataseg[rq->req_seg_count].ds_base = dm_segs->ds_addr;
647 rq->req_dataseg[rq->req_seg_count].ds_count = dm_segs->ds_len;
648 datalen -= dm_segs->ds_len;
653 while (datalen > 0 && dm_segs != eseg) {
655 ispcontreq_t local, *crq = &local, *cqe;
657 cqe = (ispcontreq_t *) ISP_QUEUE_ENTRY(isp->isp_rquest, nxti);
659 nxti = ISP_NXT_QENTRY(onxti, RQUEST_QUEUE_LEN(isp));
660 if (nxti == mp->optr) {
661 isp_prt(isp, ISP_LOGDEBUG0, "Request Queue Overflow++");
662 mp->error = MUSHERR_NOQENTRIES;
665 rq->req_header.rqs_entry_count++;
666 MEMZERO((void *)crq, sizeof (*crq));
667 crq->req_header.rqs_entry_count = 1;
668 crq->req_header.rqs_entry_type = RQSTYPE_DATASEG;
671 while (datalen > 0 && seglim < ISP_CDSEG && dm_segs != eseg) {
672 crq->req_dataseg[seglim].ds_base =
674 crq->req_dataseg[seglim].ds_count =
679 datalen -= dm_segs->ds_len;
681 isp_put_cont_req(isp, crq, cqe);
682 MEMORYBARRIER(isp, SYNC_REQUEST, onxti, QENTRY_LEN);
688 isp_sbus_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, ispreq_t *rq,
689 uint32_t *nxtip, uint32_t optr)
693 void (*eptr)(void *, bus_dma_segment_t *, int, int);
695 qep = (ispreq_t *) ISP_QUEUE_ENTRY(isp->isp_rquest, isp->isp_reqidx);
699 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE ||
700 (csio->dxfer_len == 0)) {
701 rq->req_seg_count = 1;
706 * Do a virtual grapevine step to collect info for
707 * the callback dma allocation that we have to use...
711 mp->cmd_token = csio;
717 if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) {
718 if ((csio->ccb_h.flags & CAM_DATA_PHYS) == 0) {
719 int error = bus_dmamap_load(isp->isp_osinfo.dmat,
720 PISP_PCMD(csio)->dmap, csio->data_ptr,
721 csio->dxfer_len, eptr, mp, 0);
722 if (error == EINPROGRESS) {
723 bus_dmamap_unload(isp->isp_osinfo.dmat,
724 PISP_PCMD(csio)->dmap);
726 isp_prt(isp, ISP_LOGERR,
727 "deferred dma allocation not supported");
728 } else if (error && mp->error == 0) {
730 isp_prt(isp, ISP_LOGERR,
731 "error %d in dma mapping code", error);
736 /* Pointer to physical buffer */
737 struct bus_dma_segment seg;
738 seg.ds_addr = (bus_addr_t)csio->data_ptr;
739 seg.ds_len = csio->dxfer_len;
740 (*eptr)(mp, &seg, 1, 0);
743 struct bus_dma_segment *segs;
745 if ((csio->ccb_h.flags & CAM_DATA_PHYS) != 0) {
746 isp_prt(isp, ISP_LOGERR,
747 "Physical segment pointers unsupported");
749 } else if ((csio->ccb_h.flags & CAM_SG_LIST_PHYS) == 0) {
750 isp_prt(isp, ISP_LOGERR,
751 "Virtual segment addresses unsupported");
754 /* Just use the segments provided */
755 segs = (struct bus_dma_segment *) csio->data_ptr;
756 (*eptr)(mp, segs, csio->sglist_cnt, 0);
760 int retval = CMD_COMPLETE;
761 if (mp->error == MUSHERR_NOQENTRIES) {
763 } else if (mp->error == EFBIG) {
764 XS_SETERR(csio, CAM_REQ_TOO_BIG);
765 } else if (mp->error == EINVAL) {
766 XS_SETERR(csio, CAM_REQ_INVALID);
768 XS_SETERR(csio, CAM_UNREC_HBA_ERROR);
773 if (isp->isp_dblev & ISP_LOGDEBUG1) {
774 isp_print_bytes(isp, "Request Queue Entry", QENTRY_LEN, rq);
776 switch (rq->req_header.rqs_entry_type) {
777 case RQSTYPE_REQUEST:
778 isp_put_request(isp, rq, qep);
780 case RQSTYPE_CMDONLY:
781 isp_put_extended_request(isp, (ispextreq_t *)rq,
789 isp_sbus_reset0(ispsoftc_t *isp)
791 ISP_DISABLE_INTS(isp);
795 isp_sbus_reset1(ispsoftc_t *isp)
797 ISP_ENABLE_INTS(isp);
801 isp_sbus_dumpregs(ispsoftc_t *isp, const char *msg)
804 printf("%s: %s\n", device_get_nameunit(isp->isp_dev), msg);
806 printf("%s:\n", device_get_nameunit(isp->isp_dev));
807 printf(" biu_conf1=%x", ISP_READ(isp, BIU_CONF1));
808 printf(" biu_icr=%x biu_isr=%x biu_sema=%x ", ISP_READ(isp, BIU_ICR),
809 ISP_READ(isp, BIU_ISR), ISP_READ(isp, BIU_SEMA));
810 printf("risc_hccr=%x\n", ISP_READ(isp, HCCR));
813 ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
814 printf(" cdma_conf=%x cdma_sts=%x cdma_fifostat=%x\n",
815 ISP_READ(isp, CDMA_CONF), ISP_READ(isp, CDMA_STATUS),
816 ISP_READ(isp, CDMA_FIFO_STS));
817 printf(" ddma_conf=%x ddma_sts=%x ddma_fifostat=%x\n",
818 ISP_READ(isp, DDMA_CONF), ISP_READ(isp, DDMA_STATUS),
819 ISP_READ(isp, DDMA_FIFO_STS));
820 printf(" sxp_int=%x sxp_gross=%x sxp(scsi_ctrl)=%x\n",
821 ISP_READ(isp, SXP_INTERRUPT),
822 ISP_READ(isp, SXP_GROSS_ERR),
823 ISP_READ(isp, SXP_PINS_CTRL));
824 ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
825 printf(" mbox regs: %x %x %x %x %x\n",
826 ISP_READ(isp, OUTMAILBOX0), ISP_READ(isp, OUTMAILBOX1),
827 ISP_READ(isp, OUTMAILBOX2), ISP_READ(isp, OUTMAILBOX3),
828 ISP_READ(isp, OUTMAILBOX4));