diff options
-rw-r--r-- | sys/dev/ic/isp.c | 134 | ||||
-rw-r--r-- | sys/dev/ic/isp_openbsd.c | 31 | ||||
-rw-r--r-- | sys/dev/ic/isp_target.c | 16 | ||||
-rw-r--r-- | sys/dev/ic/isp_target.h | 7 |
4 files changed, 183 insertions, 5 deletions
diff --git a/sys/dev/ic/isp.c b/sys/dev/ic/isp.c index 46cd862ef64..b7f23dbd9a7 100644 --- a/sys/dev/ic/isp.c +++ b/sys/dev/ic/isp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp.c,v 1.51 2010/12/31 19:26:00 kettenis Exp $ */ +/* $OpenBSD: isp.c,v 1.52 2011/10/22 19:34:06 miod Exp $ */ /* $FreeBSD: src/sys/dev/isp/isp.c,v 1.150 2008/12/15 21:42:38 marius Exp $*/ /*- * Copyright (c) 1997-2007 by Matthew Jacob @@ -809,9 +809,11 @@ isp_reset(struct ispsoftc *isp) for (;;) { u_int32_t la, wi, wl; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "load 0x%x words of code at load address 0x%x", ptr[3], ptr[2]); +#endif wi = 0; la = ptr[2]; @@ -870,9 +872,11 @@ isp_reset(struct ispsoftc *isp) for (;;) { u_int32_t nxtaddr; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "load 0x%x words of code at load address 0x%x", ptr[3], la); +#endif wi = 0; wl = ptr[3]; @@ -987,7 +991,9 @@ isp_reset(struct ispsoftc *isp) isp->isp_loaded_fw = 1; } else { isp->isp_loaded_fw = 0; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG2, "skipping f/w download"); +#endif } /* @@ -1106,8 +1112,10 @@ isp_reset(struct ispsoftc *isp) #endif } else { FCPARAM(isp)->isp_fwattr = mbs.param[6]; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "Firmware Attributes = 0x%x", mbs.param[6]); +#endif } FCPARAM(isp)->isp_2klogin = 0; FCPARAM(isp)->isp_sccfw = 0; @@ -1519,10 +1527,12 @@ isp_scsi_channel_init(struct ispsoftc *isp, int channel) (sdp->isp_devparam[tgt].goal_offset << 8) | (sdp->isp_devparam[tgt].goal_period); } +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "Initial Settings bus%d tgt%d flags 0x%x off 0x%x per 0x%x", channel, tgt, mbs.param[2], mbs.param[3] >> 8, mbs.param[3] & 0xff); +#endif mbs.logval = MBLOGNONE; isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { @@ -1756,19 +1766,23 @@ isp_fibre_init(struct ispsoftc *isp) icbp->icb_fwoptions |= ICBOPT_BOTH_WWNS; MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, nwwn); MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, pwwn); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "Setting ICB Node 0x%08x%08x Port 0x%08x%08x", ((u_int32_t) (nwwn >> 32)), ((u_int32_t) (nwwn & 0xffffffff)), ((u_int32_t) (pwwn >> 32)), ((u_int32_t) (pwwn & 0xffffffff))); +#endif } else if (pwwn) { icbp->icb_fwoptions &= ~ICBOPT_BOTH_WWNS; MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, pwwn); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "Setting ICB Port 0x%08x%08x", ((u_int32_t) (pwwn >> 32)), ((u_int32_t) (pwwn & 0xffffffff))); +#endif } else { isp_prt(isp, ISP_LOGERR, "No valid WWNs to use"); return; @@ -1790,9 +1804,11 @@ isp_fibre_init(struct ispsoftc *isp) icbp->icb_respaddr[RQRSP_ADDR3247] = DMA_WD2(isp->isp_result_dma); icbp->icb_respaddr[RQRSP_ADDR4863] = DMA_WD3(isp->isp_result_dma); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "isp_fibre_init: fwopt 0x%x xfwopt 0x%x zfwopt 0x%x", icbp->icb_fwoptions, icbp->icb_xfwoptions, icbp->icb_zfwoptions); +#endif FC_SCRATCH_ACQUIRE(isp); isp_put_icb(isp, icbp, (isp_icb_t *)fcp->isp_scratch); @@ -1808,9 +1824,11 @@ isp_fibre_init(struct ispsoftc *isp) mbs.param[7] = DMA_WD2(fcp->isp_scdma); mbs.logval = MBLOGALL; mbs.timeout = 30 * 1000000; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %p (%08x%08x)", fcp->isp_scratch, (u_int32_t) ((u_int64_t)fcp->isp_scdma >> 32), (u_int32_t) fcp->isp_scdma); +#endif MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp)); isp_mboxcmd(isp, &mbs); FC_SCRATCH_RELEASE(isp); @@ -1970,19 +1988,23 @@ isp_fibre_init_2400(struct ispsoftc *isp) icbp->icb_fwoptions1 |= ICB2400_OPT1_BOTH_WWNS; MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, nwwn); MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, pwwn); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "Setting ICB Node 0x%08x%08x Port 0x%08x%08x", ((u_int32_t) (nwwn >> 32)), ((u_int32_t) (nwwn & 0xffffffff)), ((u_int32_t) (pwwn >> 32)), ((u_int32_t) (pwwn & 0xffffffff))); +#endif } else if (pwwn) { icbp->icb_fwoptions1 &= ~ICB2400_OPT1_BOTH_WWNS; MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, pwwn); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "Setting ICB Port 0x%08x%08x", ((u_int32_t) (pwwn >> 32)), ((u_int32_t) (pwwn & 0xffffffff))); +#endif } else { isp_prt(isp, ISP_LOGERR, "No valid WWNs to use"); return; @@ -2027,13 +2049,16 @@ isp_fibre_init_2400(struct ispsoftc *isp) DMA_WD2(isp->isp_atioq_dma); icbp->icb_atioqaddr[RQRSP_ADDR4863] = DMA_WD3(isp->isp_atioq_dma); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "isp_fibre_init_2400: atioq %04x%04x%04x%04x", DMA_WD3(isp->isp_atioq_dma), DMA_WD2(isp->isp_atioq_dma), DMA_WD1(isp->isp_atioq_dma), DMA_WD0(isp->isp_atioq_dma)); +#endif } #endif +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "isp_fibre_init_2400: fwopt1 0x%x fwopt2 0x%x fwopt3 0x%x", icbp->icb_fwoptions1, icbp->icb_fwoptions2, icbp->icb_fwoptions3); @@ -2049,6 +2074,7 @@ isp_fibre_init_2400(struct ispsoftc *isp) isp_print_bytes(isp, "isp_fibre_init_2400", sizeof (*icbp), icbp); } +#endif FC_SCRATCH_ACQUIRE(isp); isp_put_icb_2400(isp, icbp, fcp->isp_scratch); @@ -2064,9 +2090,11 @@ isp_fibre_init_2400(struct ispsoftc *isp) mbs.param[7] = DMA_WD2(fcp->isp_scdma); mbs.logval = MBLOGALL; mbs.timeout = 30 * 1000000; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %04x%04x%04x%04x", DMA_WD3(fcp->isp_scdma), DMA_WD2(fcp->isp_scdma), DMA_WD1(fcp->isp_scdma), DMA_WD0(fcp->isp_scdma)); +#endif MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp)); isp_mboxcmd(isp, &mbs); FC_SCRATCH_RELEASE(isp); @@ -2149,9 +2177,11 @@ isp_plogx(struct ispsoftc *isp, u_int16_t handle, u_int32_t portid, int flags, i plp->plogx_rspsz_porthi = (portid >> 16) & 0xff; plp->plogx_flags = flags; +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "IOCB LOGX", QENTRY_LEN, plp); } +#endif if (gs == 0) { FC_SCRATCH_ACQUIRE(isp); @@ -2178,9 +2208,11 @@ isp_plogx(struct ispsoftc *isp, u_int16_t handle, u_int32_t portid, int flags, i MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN); scp += QENTRY_LEN; isp_get_plogx(isp, (isp_plogx_t *) scp, plp); +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "IOCB LOGX response", QENTRY_LEN, plp); } +#endif if (plp->plogx_status == PLOGX_STATUS_OK) { rval = 0; @@ -2237,15 +2269,19 @@ isp_plogx(struct ispsoftc *isp, u_int16_t handle, u_int32_t portid, int flags, i "PLOGX failed: invalid parameter at offset 0x%x", parm1); break; case PLOGX_IOCBERR_PORTUSED: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "portid 0x%x already logged in with N-port handle 0x%x", portid, parm1); +#endif rval = MBOX_PORT_ID_USED | (handle << 16); break; case PLOGX_IOCBERR_HNDLUSED: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "N-port handle 0x%x already used for portid 0x%x", handle, parm1); +#endif rval = MBOX_LOOP_ID_USED; break; case PLOGX_IOCBERR_NOHANDLE: @@ -2288,15 +2324,19 @@ isp_port_login(struct ispsoftc *isp, u_int16_t handle, u_int32_t portid) switch (mbs.param[0]) { case MBOX_PORT_ID_USED: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "isp_plogi_old: portid 0x%06x already logged in as %u", portid, mbs.param[1]); +#endif return (MBOX_PORT_ID_USED | (mbs.param[1] << 16)); case MBOX_LOOP_ID_USED: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "isp_plogi_old: handle %u in use for port id 0x%02xXXXX", handle, mbs.param[1] & 0xff); +#endif return (MBOX_LOOP_ID_USED); case MBOX_COMMAND_COMPLETE: @@ -2506,10 +2546,12 @@ isp_fclink_test(struct ispsoftc *isp, int usdelay) */ enano = NANOTIME_SUB(&hrb, &hra); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "usec%d: 0x%lx->0x%lx enano 0x%x%08x", count, (long) GET_NANOSEC(&hra), (long) GET_NANOSEC(&hrb), (u_int32_t)(enano >> 32), (u_int32_t)(enano & 0xffffffff)); +#endif /* * If the elapsed time is less than 1 millisecond, @@ -2899,7 +2941,9 @@ isp_scan_loop(struct ispsoftc *isp) lim = 2; break; default: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "no loop topology to scan"); +#endif fcp->isp_loopstate = LOOP_LSCAN_DONE; return (0); } @@ -3137,7 +3181,9 @@ isp_gid_ft_sns(struct ispsoftc *isp) sns_gid_ft_req_t *rq = &un._x; mbreg_t mbs; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "scanning fabric (GID_FT) via SNS"); +#endif MEMZERO(rq, SNS_GID_FT_REQ_SIZE); rq->snscb_rblen = GIDLEN >> 1; @@ -3188,7 +3234,9 @@ isp_gid_ft_ct_passthru(struct ispsoftc *isp) u_int32_t *rp; u_int8_t *scp = fcp->isp_scratch; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "scanning fabric (GID_FT) via CT"); +#endif if (!IS_24XX(isp)) { return (1); @@ -3214,9 +3262,11 @@ isp_gid_ft_ct_passthru(struct ispsoftc *isp) pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma+IGPOFF); pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma+IGPOFF); pt->ctp_dataseg[1].ds_count = GIDLEN; +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "ct IOCB", QENTRY_LEN, pt); } +#endif isp_put_ct_pt(isp, pt, (isp_ct_pt_t *) &scp[CTXOFF]); /* @@ -3235,10 +3285,12 @@ isp_gid_ft_ct_passthru(struct ispsoftc *isp) isp_put_ct_hdr(isp, ct, (ct_hdr_t *) &scp[XTXOFF]); rp = (u_int32_t *) &scp[XTXOFF+sizeof (*ct)]; ISP_IOZPUT_32(isp, FC4_SCSI, rp); +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "CT HDR + payload after put", sizeof (*ct) + sizeof (u_int32_t), &scp[XTXOFF]); } +#endif MEMZERO(&scp[ZTXOFF], QENTRY_LEN); MEMZERO(&mbs, sizeof (mbs)); mbs.param[0] = MBOX_EXEC_COMMAND_IOCB_A64; @@ -3257,9 +3309,11 @@ isp_gid_ft_ct_passthru(struct ispsoftc *isp) MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN); pt = &un.plocal; isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt); +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "IOCB response", QENTRY_LEN, pt); } +#endif if (pt->ctp_status && pt->ctp_status != RQCS_DATA_UNDERRUN) { isp_prt(isp, ISP_LOGWARN, "CT Passthrough returned 0x%x", @@ -3267,9 +3321,11 @@ isp_gid_ft_ct_passthru(struct ispsoftc *isp) return (-1); } MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN + 16); +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "CT response", GIDLEN+16, &scp[IGPOFF]); } +#endif return (0); } @@ -3937,9 +3993,11 @@ isp_register_fc4_type_24xx(struct ispsoftc *isp) MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN); pt = &un.plocal; isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt); +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "IOCB response", QENTRY_LEN, pt); } +#endif if (pt->ctp_status) { FC_SCRATCH_RELEASE(isp); isp_prt(isp, ISP_LOGWARN, "CT Passthrough returned 0x%x", @@ -4092,8 +4150,10 @@ isp_start(XS_T *xs) } hdlidx = fcp->isp_ini_map[XS_TGT(xs)] - 1; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "XS_TGT(xs)=%d- hdlidx value %d", XS_TGT(xs), hdlidx); +#endif if (hdlidx < 0 || hdlidx >= MAX_FC_TARG) { XS_SETERR(xs, HBA_SELTIMEOUT); return (CMD_COMPLETE); @@ -4120,7 +4180,9 @@ isp_start(XS_T *xs) start_again: if (isp_getrqentry(isp, &nxti, &optr, (void *)&qep)) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "Request Queue Overflow"); +#endif XS_SETERR(xs, HBA_BOTCH); return (CMD_EAGAIN); } @@ -4267,7 +4329,9 @@ isp_start(XS_T *xs) } if (isp_save_xs(isp, xs, &handle)) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "out of xflist pointers"); +#endif XS_SETERR(xs, HBA_BOTCH); return (CMD_EAGAIN); } @@ -4288,10 +4352,12 @@ isp_start(XS_T *xs) return (i); } XS_SETERR(xs, HBA_NOERROR); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "START cmd for %d.%d.%d cmd 0x%x datalen %ld", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs), XS_CDBP(xs)[0], (long) XS_XFRLEN(xs)); +#endif ISP_ADD_REQUEST(isp, nxti); isp->isp_nactive++; return (CMD_QUEUED); @@ -4727,9 +4793,11 @@ again: } } isp->isp_intbogus++; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "bogus intr- isr %x (%x) iptr %x optr %x", isr, junk, iptr, optr); +#endif } } isp->isp_resodx = iptr; @@ -4769,20 +4837,24 @@ again: isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe; isp_get_24xx_response(isp, (isp24xx_statusreq_t *)hp, sp2); +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "Response Queue Entry", QENTRY_LEN, sp2); } +#endif scsi_status = sp2->req_scsi_status; completion_status = sp2->req_completion_status; req_state_flags = 0; resid = sp2->req_resid; } else if (etype == RQSTYPE_RESPONSE) { isp_get_response(isp, (ispstatusreq_t *) hp, sp); +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "Response Queue Entry", QENTRY_LEN, sp); } +#endif scsi_status = sp->req_scsi_status; completion_status = sp->req_completion_status; req_status_flags = sp->req_status_flags; @@ -4791,10 +4863,12 @@ again: } else if (etype == RQSTYPE_RIO2) { isp_rio2_t *rio = (isp_rio2_t *)qe; isp_get_rio2(isp, (isp_rio2_t *) hp, rio); +#ifndef SMALL_KERNEL if (isp->isp_dblev & ISP_LOGDEBUG1) { isp_print_bytes(isp, "Response Queue Entry", QENTRY_LEN, rio); } +#endif for (i = 0; i < rio->req_header.rqs_seqno; i++) { isp_fastpost_complete(isp, rio->req_handles[i]); } @@ -4856,8 +4930,10 @@ again: continue; } if (sp->req_header.rqs_flags & RQSFLAG_FULL) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "internal queues full"); +#endif /* * We'll synthesize a QUEUE FULL message below. */ @@ -4995,9 +5071,11 @@ again: if (snsp && slen) { XS_SAVE_SENSE(xs, snsp, slen); } +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG2, "asked for %ld got raw resid %ld settled for %ld", (long) XS_XFRLEN(xs), resid, (long) XS_RESID(xs)); +#endif break; case RQSTYPE_REQUEST: case RQSTYPE_A64: @@ -5015,8 +5093,10 @@ again: * ???? */ XS_SETERR(xs, HBA_BOTCH); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "Request Queue Entry bounced back"); +#endif if ((isp->isp_dblev & ISP_LOGDEBUG1) == 0) { isp_print_bytes(isp, "Bounced Request", QENTRY_LEN, qe); @@ -5121,7 +5201,9 @@ isp_parse_async(struct ispsoftc *isp, u_int16_t mbox) } else { bus = 0; } +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG2, "Async Mbox 0x%x", mbox); +#endif switch (mbox) { case ASYNC_BUS_RESET: @@ -5438,10 +5520,14 @@ isp_parse_async(struct ispsoftc *isp, u_int16_t mbox) case ASYNC_RJT_SENT: /* same as ASYNC_QFULL_SENT */ if (IS_24XX(isp)) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGTDEBUG0, "LS_RJT sent"); +#endif break; } else if (IS_2200(isp)) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGTDEBUG0, "QFULL sent"); +#endif break; } /* FALLTHROUGH */ @@ -5462,8 +5548,10 @@ isp_parse_async(struct ispsoftc *isp, u_int16_t mbox) } for (i = 0; i < nh; i++) { isp_fastpost_complete(isp, handles[i]); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG3, "fast post completion of %u", handles[i]); +#endif } if (isp->isp_fpcchiwater < nh) { isp->isp_fpcchiwater = nh; @@ -5486,10 +5574,14 @@ isp_handle_other_response(struct ispsoftc *isp, int type, { switch (type) { case RQSTYPE_STATUS_CONT: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "Ignored Continuation Response"); +#endif return (1); case RQSTYPE_MARKER: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "Marker Response"); +#endif return (1); case RQSTYPE_ATIO: case RQSTYPE_CTIO: @@ -5548,9 +5640,11 @@ isp_parse_status(struct ispsoftc *isp, ispstatusreq_t *sp, XS_T *xs, long *rp) case RQCS_INCOMPLETE: if ((sp->req_state_flags & RQSF_GOT_TARGET) == 0) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "Selection Timeout for %d.%d.%d", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs)); +#endif if (XS_NOERR(xs)) { XS_SETERR(xs, HBA_SELTIMEOUT); *rp = XS_XFRLEN(xs); @@ -5778,9 +5872,11 @@ isp_parse_status(struct ispsoftc *isp, ispstatusreq_t *sp, XS_T *xs, long *rp) break; case RQCS_QUEUE_FULL: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "internal queues full for %d.%d.%d status 0x%x", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs), *XS_STSP(xs)); +#endif /* * If QFULL or some other status byte is set, then this @@ -6014,10 +6110,12 @@ isp_parse_status_24xx(struct ispsoftc *isp, isp24xx_statusreq_t *sp, return; } XS_RESID(xs) = sp->req_resid; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "%d.%d.%d data underrun (%d) for command 0x%x", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs), sp->req_resid, XS_CDBP(xs)[0] & 0xff); +#endif if (XS_NOERR(xs)) { XS_SETERR(xs, HBA_NOERROR); } @@ -6113,8 +6211,10 @@ isp_fastpost_complete(struct ispsoftc *isp, u_int16_t fph) } xs = isp_find_xs(isp, fph); if (xs == NULL) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "Command for fast post handle 0x%x not found", fph); +#endif return; } isp_destroy_handle(isp, fph); @@ -6774,8 +6874,10 @@ isp_mboxcmd(struct ispsoftc *isp, mbreg_t *mbp) for (box = 0; box < MAX_MAILBOX(isp); box++) { if (ibits & (1 << box)) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "IN mbox %d = 0x%04x", box, mbp->param[box]); +#endif ISP_WRITE(isp, MBOX_OFF(box), mbp->param[box]); } isp->isp_mboxtmp[box] = mbp->param[box] = 0; @@ -6817,8 +6919,10 @@ isp_mboxcmd(struct ispsoftc *isp, mbreg_t *mbp) for (box = 0; box < MAX_MAILBOX(isp); box++) { if (obits & (1 << box)) { mbp->param[box] = isp->isp_mboxtmp[box]; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "OUT mbox %d = 0x%04x", box, mbp->param[box]); +#endif } } @@ -6956,8 +7060,10 @@ isp_update_bus(struct ispsoftc *isp, int bus) if (sdp->isp_devparam[tgt].dev_enable == 0) { sdp->isp_devparam[tgt].dev_update = 0; sdp->isp_devparam[tgt].dev_refresh = 0; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "skipping target %d bus %d update", tgt, bus); +#endif continue; } /* @@ -7013,10 +7119,12 @@ isp_update_bus(struct ispsoftc *isp, int bus) sdp->isp_devparam[tgt].actv_flags &= ~DPARM_TQING; sdp->isp_devparam[tgt].actv_flags |= (sdp->isp_devparam[tgt].goal_flags & DPARM_TQING); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "bus %d set tgt %d flags 0x%x off 0x%x period 0x%x", bus, tgt, mbs.param[2], mbs.param[3] >> 8, mbs.param[3] & 0xff); +#endif get = 0; } else { continue; @@ -7137,6 +7245,7 @@ isp_setdfltparm(struct ispsoftc *isp, int channel) } } +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, sc0, sc3, 0, sdp->isp_fifo_threshold, sdp->isp_initiator_id, sdp->isp_bus_reset_delay, sdp->isp_retry_count, @@ -7145,6 +7254,7 @@ isp_setdfltparm(struct ispsoftc *isp, int channel) sdp->isp_req_ack_active_neg, sdp->isp_data_line_active_neg, sdp->isp_data_dma_burst_enabl, sdp->isp_cmd_dma_burst_enable, sdp->isp_selection_timeout, sdp->isp_max_queue_depth); +#endif /* * The trick here is to establish a default for the default (honk!) @@ -7191,10 +7301,12 @@ isp_setdfltparm(struct ispsoftc *isp, int channel) sdp->isp_devparam[tgt].goal_period = sdp->isp_devparam[tgt].nvrm_period = per; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, sc2, sc3, channel, tgt, sdp->isp_devparam[tgt].nvrm_flags, sdp->isp_devparam[tgt].nvrm_offset, sdp->isp_devparam[tgt].nvrm_period); +#endif } } @@ -7412,8 +7524,10 @@ isp_read_nvram(struct ispsoftc *isp) nvram_data[2] != 0) isp_prt(isp, ISP_LOGWARN, "invalid NVRAM header"); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "%x %x %x", nvram_data[0], nvram_data[1], nvram_data[2]); +#endif } retval = -1; goto out; @@ -7649,6 +7763,7 @@ isp_parse_nvram_1020(struct ispsoftc *isp, u_int8_t *nvram_data) sdp->isp_fast_mttr = ISP_NVRAM_FAST_MTTR_ENABLE(nvram_data); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, sc0, sc4, 0, sdp->isp_fifo_threshold, sdp->isp_initiator_id, sdp->isp_bus_reset_delay, sdp->isp_retry_count, @@ -7657,6 +7772,7 @@ isp_parse_nvram_1020(struct ispsoftc *isp, u_int8_t *nvram_data) sdp->isp_req_ack_active_neg, sdp->isp_data_line_active_neg, sdp->isp_data_dma_burst_enabl, sdp->isp_cmd_dma_burst_enable, sdp->isp_selection_timeout, sdp->isp_max_queue_depth); +#endif for (tgt = 0; tgt < MAX_TARGETS; tgt++) { sdp->isp_devparam[tgt].dev_enable = @@ -7703,10 +7819,12 @@ isp_parse_nvram_1020(struct ispsoftc *isp, u_int8_t *nvram_data) if (ISP_NVRAM_TGT_DISC(nvram_data, tgt)) sdp->isp_devparam[tgt].nvrm_flags |= DPARM_DISC; sdp->isp_devparam[tgt].actv_flags = 0; /* we don't know */ +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, sc2, sc4, 0, tgt, sdp->isp_devparam[tgt].nvrm_flags, sdp->isp_devparam[tgt].nvrm_offset, sdp->isp_devparam[tgt].nvrm_period); +#endif sdp->isp_devparam[tgt].goal_offset = sdp->isp_devparam[tgt].nvrm_offset; sdp->isp_devparam[tgt].goal_period = @@ -7761,6 +7879,7 @@ isp_parse_nvram_1080(struct ispsoftc *isp, int bus, u_int8_t *nvram_data) sdp->isp_max_queue_depth = ISP1080_NVRAM_MAX_QUEUE_DEPTH(nvram_data, bus); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, sc0, sc4, bus, sdp->isp_fifo_threshold, sdp->isp_initiator_id, sdp->isp_bus_reset_delay, sdp->isp_retry_count, @@ -7769,6 +7888,7 @@ isp_parse_nvram_1080(struct ispsoftc *isp, int bus, u_int8_t *nvram_data) sdp->isp_req_ack_active_neg, sdp->isp_data_line_active_neg, sdp->isp_data_dma_burst_enabl, sdp->isp_cmd_dma_burst_enable, sdp->isp_selection_timeout, sdp->isp_max_queue_depth); +#endif for (tgt = 0; tgt < MAX_TARGETS; tgt++) { @@ -7795,10 +7915,12 @@ isp_parse_nvram_1080(struct ispsoftc *isp, int bus, u_int8_t *nvram_data) if (ISP1080_NVRAM_TGT_DISC(nvram_data, tgt, bus)) sdp->isp_devparam[tgt].nvrm_flags |= DPARM_DISC; sdp->isp_devparam[tgt].actv_flags = 0; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, sc2, sc4, bus, tgt, sdp->isp_devparam[tgt].nvrm_flags, sdp->isp_devparam[tgt].nvrm_offset, sdp->isp_devparam[tgt].nvrm_period); +#endif sdp->isp_devparam[tgt].goal_offset = sdp->isp_devparam[tgt].nvrm_offset; sdp->isp_devparam[tgt].goal_period = @@ -7853,6 +7975,7 @@ isp_parse_nvram_12160(struct ispsoftc *isp, int bus, u_int8_t *nvram_data) sdp->isp_max_queue_depth = ISP12160_NVRAM_MAX_QUEUE_DEPTH(nvram_data, bus); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, sc0, sc4, bus, sdp->isp_fifo_threshold, sdp->isp_initiator_id, sdp->isp_bus_reset_delay, sdp->isp_retry_count, @@ -7861,6 +7984,7 @@ isp_parse_nvram_12160(struct ispsoftc *isp, int bus, u_int8_t *nvram_data) sdp->isp_req_ack_active_neg, sdp->isp_data_line_active_neg, sdp->isp_data_dma_burst_enabl, sdp->isp_cmd_dma_burst_enable, sdp->isp_selection_timeout, sdp->isp_max_queue_depth); +#endif for (tgt = 0; tgt < MAX_TARGETS; tgt++) { sdp->isp_devparam[tgt].dev_enable = @@ -7886,10 +8010,12 @@ isp_parse_nvram_12160(struct ispsoftc *isp, int bus, u_int8_t *nvram_data) if (ISP12160_NVRAM_TGT_DISC(nvram_data, tgt, bus)) sdp->isp_devparam[tgt].nvrm_flags |= DPARM_DISC; sdp->isp_devparam[tgt].actv_flags = 0; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, sc2, sc4, bus, tgt, sdp->isp_devparam[tgt].nvrm_flags, sdp->isp_devparam[tgt].nvrm_offset, sdp->isp_devparam[tgt].nvrm_period); +#endif sdp->isp_devparam[tgt].goal_offset = sdp->isp_devparam[tgt].nvrm_offset; sdp->isp_devparam[tgt].goal_period = @@ -7988,6 +8114,7 @@ isp_parse_nvram_2100(struct ispsoftc *isp, u_int8_t *nvram_data) ISP2100_NVRAM_EXECUTION_THROTTLE(nvram_data); } fcp->isp_fwoptions = ISP2100_NVRAM_OPTIONS(nvram_data); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "NVRAM 0x%08x%08x 0x%08x%08x maxalloc %d maxframelen %d", (u_int32_t) (fcp->isp_wwnn_nvram >> 32), (u_int32_t) fcp->isp_wwnn_nvram, @@ -8000,11 +8127,14 @@ isp_parse_nvram_2100(struct ispsoftc *isp, u_int8_t *nvram_data) ISP2100_NVRAM_OPTIONS(nvram_data), ISP2100_NVRAM_HARDLOOPID(nvram_data), ISP2100_NVRAM_TOV(nvram_data)); +#endif fcp->isp_xfwoptions = ISP2100_XFW_OPTIONS(nvram_data); fcp->isp_zfwoptions = ISP2100_ZFW_OPTIONS(nvram_data); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "xfwoptions 0x%x zfw options 0x%x", ISP2100_XFW_OPTIONS(nvram_data), ISP2100_ZFW_OPTIONS(nvram_data)); +#endif } void @@ -8013,6 +8143,7 @@ isp_parse_nvram_2400(struct ispsoftc *isp, u_int8_t *nvram_data) fcparam *fcp = FCPARAM(isp); u_int64_t wwn; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "NVRAM 0x%08x%08x 0x%08x%08x exchg_cnt %d maxframelen %d", (u_int32_t) (ISP2400_NVRAM_NODE_NAME(nvram_data) >> 32), @@ -8028,6 +8159,7 @@ isp_parse_nvram_2400(struct ispsoftc *isp, u_int8_t *nvram_data) ISP2400_NVRAM_FIRMWARE_OPTIONS1(nvram_data), ISP2400_NVRAM_FIRMWARE_OPTIONS2(nvram_data), ISP2400_NVRAM_FIRMWARE_OPTIONS3(nvram_data)); +#endif wwn = ISP2400_NVRAM_PORT_NAME(nvram_data); if (wwn) { diff --git a/sys/dev/ic/isp_openbsd.c b/sys/dev/ic/isp_openbsd.c index 0ed82cc91a3..089d12bf9b4 100644 --- a/sys/dev/ic/isp_openbsd.c +++ b/sys/dev/ic/isp_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_openbsd.c,v 1.46 2011/04/05 12:09:20 dlg Exp $ */ +/* $OpenBSD: isp_openbsd.c,v 1.47 2011/10/22 19:34:06 miod Exp $ */ /* * Platform (OpenBSD) dependent common attachment code for QLogic adapters. * @@ -341,7 +341,9 @@ ispcmd(XS_T *xs) if (isp->isp_osinfo.blocked) { isp_add2_blocked_queue(isp, xs); ISP_UNLOCK(isp); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "added to blocked queue"); +#endif return; } } @@ -365,18 +367,24 @@ ispcmd(XS_T *xs) } if (isp->isp_osinfo.hiwater < isp->isp_nactive) { isp->isp_osinfo.hiwater = isp->isp_nactive; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "Active Hiwater Mark=%d", isp->isp_nactive); +#endif } break; case CMD_EAGAIN: isp->isp_osinfo.blocked |= 2; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "blocking queue"); +#endif isp_add2_blocked_queue(isp, xs); break; case CMD_RQLATER: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "retrying later for %d.%d", XS_TGT(xs), XS_LUN(xs)); +#endif timeout_set(&xs->stimeout, isp_requeue, xs); timeout_add_sec(&xs->stimeout, 1); XS_CMD_S_TIMER(xs); @@ -460,7 +468,9 @@ isp_done(XS_T *xs) scsi_done(xs); if (isp->isp_osinfo.blocked == 2) { isp->isp_osinfo.blocked = 0; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "restarting blocked queue"); +#endif isp_restart(isp); } } @@ -485,17 +495,21 @@ isp_wdog(void *arg) u_int16_t sema, mbox; if (XS_CMD_DONE_P(xs)) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "watchdog found done cmd (handle 0x%x)", handle); +#endif ISP_UNLOCK(isp); return; } if (XS_CMD_WDOG_P(xs)) { +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "recursive watchdog (handle 0x%x)", handle); +#endif ISP_UNLOCK(isp); return; } @@ -553,9 +567,12 @@ isp_wdog(void *arg) isp_put_request(isp, mp, qe); ISP_ADD_REQUEST(isp, nxti); } - } else if (isp->isp_dblev) { + } +#ifndef SMALL_KERNEL + else if (isp->isp_dblev) { isp_prt(isp, ISP_LOGDEBUG1, "watchdog with no command"); } +#endif ISP_UNLOCK(isp); } @@ -603,8 +620,10 @@ isp_requeue(void *arg) r = isp_start(xs); switch (r) { case CMD_QUEUED: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG1, "restarted command for %d.%d", XS_TGT(xs), XS_LUN(xs)); +#endif if (xs->timeout) { timeout_set(&xs->stimeout, isp_wdog, xs); timeout_add(&xs->stimeout, _XT(xs)); @@ -612,14 +631,18 @@ isp_requeue(void *arg) } break; case CMD_EAGAIN: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "blocked cmd again"); +#endif isp->isp_osinfo.blocked |= 2; isp_add2_blocked_queue(isp, xs); break; case CMD_RQLATER: +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "%s for %d.%d", (r == CMD_EAGAIN)? "CMD_EAGAIN" : "CMD_RQLATER", XS_TGT(xs), XS_LUN(xs)); +#endif timeout_set(&xs->stimeout, isp_requeue, xs); timeout_add_sec(&xs->stimeout, 1); XS_CMD_S_TIMER(xs); @@ -660,7 +683,9 @@ isp_trestart(void *arg) if (isp->isp_osinfo.wqf == NULL) nrestarted++; } while (list != NULL); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "requeued %d commands", nrestarted); +#endif } else { ISP_UNLOCK(isp); } @@ -684,7 +709,9 @@ isp_restart(struct ispsoftc *isp) if (isp->isp_osinfo.wqf == NULL) nrestarted++; } while (list != NULL); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGDEBUG0, "requeued %d commands", nrestarted); +#endif } } diff --git a/sys/dev/ic/isp_target.c b/sys/dev/ic/isp_target.c index d7048fb2eaf..70b8ce38ce2 100644 --- a/sys/dev/ic/isp_target.c +++ b/sys/dev/ic/isp_target.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_target.c,v 1.17 2010/02/18 10:40:53 sobrado Exp $ */ +/* $OpenBSD: isp_target.c,v 1.18 2011/10/22 19:34:06 miod Exp $ */ /*- * Copyright (c) 1997-2007 by Matthew Jacob * All rights reserved. @@ -261,9 +261,11 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp) inot_24xx = (in_fcentry_24xx_t *) local; status = inot_24xx->in_status; seqid = inot_24xx->in_rxid; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGTDEBUG0, "Immediate Notify status=0x%x seqid=0x%x", status, seqid); +#endif switch (status) { case IN24XX_LIP_RESET: case IN24XX_LINK_RESET: @@ -305,9 +307,11 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp) } } +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGTDEBUG0, "Immediate Notify On Bus %d, status=0x%x seqid=0x%x", bus, status, seqid); +#endif switch (status) { case IN_MSG_RECEIVED: @@ -1091,9 +1095,11 @@ isp_notify_ack(ispsoftc_t *isp, void *arg) } else { isp_put_notify_ack_fc(isp, na, (na_fcentry_t *)outp); } +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGTDEBUG0, "notify ack loopid %u seqid %x " "flags %x tflags %x response %x", iid, na->na_seqid, na->na_flags, na->na_task_flags, na->na_response); +#endif } else { na_entry_t *na = (na_entry_t *) storage; if (arg) { @@ -1112,9 +1118,11 @@ isp_notify_ack(ispsoftc_t *isp, void *arg) na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; na->na_header.rqs_entry_count = 1; isp_put_notify_ack(isp, na, (na_entry_t *)outp); +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGTDEBUG0, "notify ack loopid %u lun %u tgt " "%u seqid %x event %x", na->na_iid, na->na_lun, na->na_tgt, na->na_seqid, na->na_event); +#endif } ISP_TDQE(isp, "isp_notify_ack", (int) optr, storage); ISP_ADD_REQUEST(isp, nxti); @@ -1353,7 +1361,9 @@ isp_handle_ctio(ispsoftc_t *isp, ct_entry_t *ct) if (fmsg == NULL) fmsg = "ABORT TAG message sent by Initiator"; +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGTDEBUG0, "CTIO destroyed by %s", fmsg); +#endif break; case CT_INVAL: @@ -1508,8 +1518,10 @@ isp_handle_ctio2(ispsoftc_t *isp, ct2_entry_t *ct) fmsg = "ABORT"; } +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGTDEBUG0, "CTIO2 destroyed by %s: RX_ID=0x%x", fmsg, ct->ct_rxid); +#endif break; case CT_INVAL: @@ -1659,8 +1671,10 @@ isp_handle_ctio7(ispsoftc_t *isp, ct7_entry_t *ct) if (fmsg == NULL) { fmsg = "ABORT"; } +#ifndef SMALL_KERNEL isp_prt(isp, ISP_LOGTDEBUG0, "CTIO7 destroyed by %s: RX_ID=0x%x", fmsg, ct->ct_rxid); +#endif break; case CT7_TIMEOUT: diff --git a/sys/dev/ic/isp_target.h b/sys/dev/ic/isp_target.h index d40a068807e..b93fb167883 100644 --- a/sys/dev/ic/isp_target.h +++ b/sys/dev/ic/isp_target.h @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_target.h,v 1.14 2009/06/24 11:00:53 krw Exp $ */ +/* $OpenBSD: isp_target.h,v 1.15 2011/10/22 19:34:06 miod Exp $ */ /* $FreeBSD: src/sys/dev/isp/isp_target.h,v 1.30 2007/03/10 02:39:54 mjacob Exp $ */ /*- * Copyright (c) 1997-2007 by Matthew Jacob @@ -888,8 +888,13 @@ typedef struct { * Debug macros */ +#ifdef SMALL_KERNEL +#define ISP_TDQE(isp, msg, idx, arg) \ + do { } while (0) +#else #define ISP_TDQE(isp, msg, idx, arg) \ if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg) +#endif #ifndef ISP_TOOLS /* |