From owner-svn-src-all@freebsd.org Sat Oct 24 17:34:41 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D103DA1E6F0; Sat, 24 Oct 2015 17:34:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9339DDFB; Sat, 24 Oct 2015 17:34:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9OHYe5i004327; Sat, 24 Oct 2015 17:34:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9OHYe7K004323; Sat, 24 Oct 2015 17:34:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510241734.t9OHYe7K004323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 24 Oct 2015 17:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289882 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Oct 2015 17:34:41 -0000 Author: mav Date: Sat Oct 24 17:34:40 2015 New Revision: 289882 URL: https://svnweb.freebsd.org/changeset/base/289882 Log: Add PIM_EXTLUNS support to isp(4) driver. Now 24xx and above chips support full 8-byte LUN address space. Older FC chips may support up to 16K LUNs when firmware allows. Tested in both initiator and target modes for 23xx, 24xx and 25xx. Modified: head/sys/dev/isp/isp.c head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/isp_freebsd.h head/sys/dev/isp/isp_target.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Sat Oct 24 17:24:19 2015 (r289881) +++ head/sys/dev/isp/isp.c Sat Oct 24 17:34:40 2015 (r289882) @@ -1319,7 +1319,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d } } else { if (ISP_CAP_SCCFW(isp)) { - isp->isp_maxluns = 16384; + isp->isp_maxluns = 0; /* No limit -- 2/8 bytes */ } else { isp->isp_maxluns = 16; } @@ -4380,7 +4380,9 @@ isp_start(XS_T *xs) fcparam *fcp = FCPARAM(isp, XS_CHANNEL(xs)); if ((fcp->role & ISP_ROLE_INITIATOR) == 0) { - isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d I am not an initiator", XS_CHANNEL(xs), target, XS_LUN(xs)); + isp_prt(isp, ISP_LOG_WARN1, + "%d.%d.%jx I am not an initiator", + XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs)); XS_SETERR(xs, HBA_SELTIMEOUT); return (CMD_COMPLETE); } @@ -4400,18 +4402,24 @@ isp_start(XS_T *xs) return (CMD_COMPLETE); } if (lp->state == FC_PORTDB_STATE_ZOMBIE) { - isp_prt(isp, ISP_LOGDEBUG1, "%d.%d.%d target zombie", XS_CHANNEL(xs), target, XS_LUN(xs)); + isp_prt(isp, ISP_LOGDEBUG1, + "%d.%d.%jx target zombie", + XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs)); return (CMD_RQLATER); } if (lp->state != FC_PORTDB_STATE_VALID) { - isp_prt(isp, ISP_LOGDEBUG1, "%d.%d.%d bad db port state 0x%x", XS_CHANNEL(xs), target, XS_LUN(xs), lp->state); + isp_prt(isp, ISP_LOGDEBUG1, + "%d.%d.%jx bad db port state 0x%x", + XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs), lp->state); XS_SETERR(xs, HBA_SELTIMEOUT); return (CMD_COMPLETE); } } else { sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); if ((sdp->role & ISP_ROLE_INITIATOR) == 0) { - isp_prt(isp, ISP_LOGDEBUG1, "%d.%d.%d I am not an initiator", XS_CHANNEL(xs), target, XS_LUN(xs)); + isp_prt(isp, ISP_LOGDEBUG1, + "%d.%d.%jx I am not an initiator", + XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs)); XS_SETERR(xs, HBA_SELTIMEOUT); return (CMD_COMPLETE); } @@ -4561,14 +4569,20 @@ isp_start(XS_T *xs) t7->req_tidlo = lp->portid; t7->req_tidhi = lp->portid >> 16; t7->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs)); - if (XS_LUN(xs) > 256) { +#if __FreeBSD_version >= 1000700 + be64enc(t7->req_lun, CAM_EXTLUN_BYTE_SWIZZLE(XS_LUN(xs))); +#else + if (XS_LUN(xs) >= 256) { t7->req_lun[0] = XS_LUN(xs) >> 8; t7->req_lun[0] |= 0x40; } t7->req_lun[1] = XS_LUN(xs); +#endif if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) { if (FCP_NEXT_CRN(isp, &t7->req_crn, xs)) { - isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d cannot generate next CRN", XS_CHANNEL(xs), target, XS_LUN(xs)); + isp_prt(isp, ISP_LOG_WARN1, + "%d.%d.%jx cannot generate next CRN", + XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs)); XS_SETERR(xs, HBA_BOTCH); return (CMD_EAGAIN); } @@ -4585,7 +4599,9 @@ isp_start(XS_T *xs) } if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) { if (FCP_NEXT_CRN(isp, &t2->req_crn, xs)) { - isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d cannot generate next CRN", XS_CHANNEL(xs), target, XS_LUN(xs)); + isp_prt(isp, ISP_LOG_WARN1, + "%d.%d.%jx cannot generate next CRN", + XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs)); XS_SETERR(xs, HBA_BOTCH); return (CMD_EAGAIN); } @@ -4594,11 +4610,19 @@ isp_start(XS_T *xs) ispreqt2e_t *t2e = (ispreqt2e_t *)local; t2e->req_target = lp->handle; t2e->req_scclun = XS_LUN(xs); +#if __FreeBSD_version < 1000700 + if (XS_LUN(xs) >= 256) + t2e->req_scclun |= 0x4000; +#endif cdbp = t2e->req_cdb; } else if (ISP_CAP_SCCFW(isp)) { ispreqt2_t *t2 = (ispreqt2_t *)local; t2->req_target = lp->handle; t2->req_scclun = XS_LUN(xs); +#if __FreeBSD_version < 1000700 + if (XS_LUN(xs) >= 256) + t2->req_scclun |= 0x4000; +#endif cdbp = t2->req_cdb; } else { t2->req_target = lp->handle; @@ -5386,12 +5410,14 @@ again: continue; } if (req_status_flags & RQSTF_BUS_RESET) { - isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d bus was reset", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs)); + isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%jx bus was reset", + XS_CHANNEL(xs), XS_TGT(xs), (uintmax_t)XS_LUN(xs)); XS_SETERR(xs, HBA_BUSRESET); ISP_SET_SENDMARKER(isp, XS_CHANNEL(xs), 1); } if (buddaboom) { - isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d buddaboom", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs)); + isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%jx buddaboom", + XS_CHANNEL(xs), XS_TGT(xs), (uintmax_t)XS_LUN(xs)); XS_SETERR(xs, HBA_BOTCH); } @@ -5535,7 +5561,11 @@ again: *XS_STSP(xs) = SCSI_QFULL; XS_SETERR(xs, HBA_NOERROR); } else if (XS_NOERR(xs)) { - isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d badness at %s:%u", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs), __func__, __LINE__); + isp_prt(isp, ISP_LOG_WARN1, + "%d.%d.%jx badness at %s:%u", + XS_CHANNEL(xs), XS_TGT(xs), + (uintmax_t)XS_LUN(xs), + __func__, __LINE__); XS_SETERR(xs, HBA_BOTCH); } XS_SET_RESID(xs, XS_XFRLEN(xs)); @@ -5947,7 +5977,11 @@ isp_parse_async_fc(ispsoftc_t *isp, uint continue; } j++; - isp_prt(isp, ISP_LOG_WARN1, "%d.%d.%d bus reset set at %s:%u", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs), __func__, __LINE__); + isp_prt(isp, ISP_LOG_WARN1, + "%d.%d.%jx bus reset set at %s:%u", + XS_CHANNEL(xs), XS_TGT(xs), + (uintmax_t)XS_LUN(xs), + __func__, __LINE__); XS_SETERR(xs, HBA_BUSRESET); } if (j) { @@ -6426,7 +6460,9 @@ isp_parse_status(ispsoftc_t *isp, ispsta break; case RQCS_XACT_ERR2: - isp_xs_prt(isp, xs, ISP_LOGERR, "HBA attempted queued transaction to target routine %d", XS_LUN(xs)); + isp_xs_prt(isp, xs, ISP_LOGERR, + "HBA attempted queued transaction to target routine %jx", + (uintmax_t)XS_LUN(xs)); break; case RQCS_XACT_ERR3: Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Sat Oct 24 17:24:19 2015 (r289881) +++ head/sys/dev/isp/isp_freebsd.c Sat Oct 24 17:34:40 2015 (r289882) @@ -1153,7 +1153,7 @@ create_lun_state(ispsoftc_t *isp, int bu lun = xpt_path_lun_id(path); if (lun != CAM_LUN_WILDCARD) { - if (lun >= ISP_MAX_LUNS(isp)) { + if (ISP_MAX_LUNS(isp) > 0 && lun >= ISP_MAX_LUNS(isp)) { return (CAM_LUN_INVALID); } } @@ -1238,7 +1238,8 @@ isp_enable_lun(ispsoftc_t *isp, union cc bus = XS_CHANNEL(ccb); target = ccb->ccb_h.target_id; lun = ccb->ccb_h.target_lun; - ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, "enabling lun %u\n", lun); + ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, + "enabling lun %jx\n", (uintmax_t)lun); if (target == CAM_TARGET_WILDCARD && lun != CAM_LUN_WILDCARD) { ccb->ccb_h.status = CAM_LUN_INVALID; xpt_done(ccb); @@ -1251,7 +1252,8 @@ isp_enable_lun(ispsoftc_t *isp, union cc return; } if (isp->isp_dblev & ISP_LOGTDEBUG0) { - xpt_print(ccb->ccb_h.path, "enabling lun 0x%x on channel %d\n", lun, bus); + xpt_print(ccb->ccb_h.path, + "enabling lun 0x%jx on channel %d\n", (uintmax_t)lun, bus); } /* @@ -1450,7 +1452,8 @@ isp_disable_lun(ispsoftc_t *isp, union c bus = XS_CHANNEL(ccb); target = ccb->ccb_h.target_id; lun = ccb->ccb_h.target_lun; - ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, "disabling lun %u\n", lun); + ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, + "disabling lun %jx\n", (uintmax_t)lun); if (target == CAM_TARGET_WILDCARD && lun != CAM_LUN_WILDCARD) { ccb->ccb_h.status = CAM_LUN_INVALID; xpt_done(ccb); @@ -2181,6 +2184,10 @@ isp_target_putback_atio(union ccb *ccb) at->at_header.rqs_entry_count = 1; if (ISP_CAP_SCCFW(isp)) { at->at_scclun = (uint16_t) ccb->ccb_h.target_lun; +#if __FreeBSD_version < 1000700 + if (at->at_scclun >= 256) + at->at_scclun |= 0x4000; +#endif } else { at->at_lun = (uint8_t) ccb->ccb_h.target_lun; } @@ -2366,6 +2373,9 @@ isp_handle_platform_atio2(ispsoftc_t *is if (ISP_CAP_SCCFW(isp)) { lun = aep->at_scclun; +#if __FreeBSD_version < 1000700 + lun &= 0x3fff; +#endif } else { lun = aep->at_lun; } @@ -2512,7 +2522,8 @@ static void isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep) { int cdbxlen; - uint16_t lun, chan, nphdl = NIL_HANDLE; + lun_id_t lun; + uint16_t chan, nphdl = NIL_HANDLE; uint32_t did, sid; fcportdb_t *lp; tstate_t *tptr; @@ -2523,7 +2534,12 @@ isp_handle_platform_atio7(ispsoftc_t *is did = (aep->at_hdr.d_id[0] << 16) | (aep->at_hdr.d_id[1] << 8) | aep->at_hdr.d_id[2]; sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2]; - lun = (aep->at_cmnd.fcp_cmnd_lun[0] << 8) | aep->at_cmnd.fcp_cmnd_lun[1]; +#if __FreeBSD_version >= 1000700 + lun = CAM_EXTLUN_BYTE_SWIZZLE(be64dec(aep->at_cmnd.fcp_cmnd_lun)); +#else + lun = (aep->at_cmnd.fcp_cmnd_lun[0] & 0x3f << 8) | + aep->at_cmnd.fcp_cmnd_lun[1]; +#endif /* * Find the N-port handle, and Virtual Port Index for this command. @@ -2589,7 +2605,9 @@ isp_handle_platform_atio7(ispsoftc_t *is if (tptr == NULL) { tptr = get_lun_statep(isp, chan, CAM_LUN_WILDCARD); if (tptr == NULL) { - isp_prt(isp, ISP_LOGWARN, "%s: [0x%x] no state pointer for lun %d or wildcard", __func__, aep->at_rxid, lun); + isp_prt(isp, ISP_LOGWARN, + "%s: [0x%x] no state pointer for lun %jx or wildcard", + __func__, aep->at_rxid, (uintmax_t)lun); if (lun == 0) { isp_endcmd(isp, aep, nphdl, SCSI_STATUS_BUSY, 0); } else { @@ -2711,7 +2729,8 @@ isp_handle_platform_atio7(ispsoftc_t *is atp->cdb0 = atiop->cdb_io.cdb_bytes[0]; atp->tattr = aep->at_cmnd.fcp_cmnd_task_attribute & FCP_CMND_TASK_ATTR_MASK; atp->state = ATPD_STATE_CAM; - isp_prt(isp, ISP_LOGTDEBUG0, "ATIO7[0x%x] CDB=0x%x lun %d datalen %u", aep->at_rxid, atp->cdb0, lun, atp->orig_datalen); + isp_prt(isp, ISP_LOGTDEBUG0, "ATIO7[0x%x] CDB=0x%x lun %jx datalen %u", + aep->at_rxid, atp->cdb0, (uintmax_t)lun, atp->orig_datalen); xpt_done((union ccb *)atiop); rls_lun_statep(isp, tptr); return; @@ -2999,7 +3018,7 @@ isp_handle_platform_ctio(ispsoftc_t *isp resid = ct->ct_resid; moved_data = data_requested - resid; } - isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO[%x] seq %u nc %d tag %x S_ID 0x%x lun %d sts %x flg %x resid %d %s", __func__, ct->ct_fwhandle, ATPD_GET_SEQNO(ct), + isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO[%x] seq %u nc %d tag %x S_ID 0x%x lun %x sts %x flg %x resid %d %s", __func__, ct->ct_fwhandle, ATPD_GET_SEQNO(ct), notify_cam, ct->ct_tag_val, ct->ct_iid, ct->ct_lun, ct->ct_status, ct->ct_flags, resid, sentstatus? "FIN" : "MID"); } if (ok) { @@ -3090,6 +3109,9 @@ isp_handle_platform_notify_fc(ispsoftc_t if (ISP_CAP_SCCFW(isp)) { lun = inp->in_scclun; +#if __FreeBSD_version < 1000700 + lun &= 0x3fff; +#endif } else { lun = inp->in_lun; } @@ -3849,8 +3871,9 @@ isp_ldt_task(void *arg, int pending) if (dbidx != XS_TGT(xs)) { continue; } - isp_prt(isp, ISP_LOGWARN, "command handle 0x%x for %d.%d.%d orphaned by loop down timeout", - isp->isp_xflist[i].handle, chan, XS_TGT(xs), XS_LUN(xs)); + isp_prt(isp, ISP_LOGWARN, "command handle 0x%x for %d.%d.%jx orphaned by loop down timeout", + isp->isp_xflist[i].handle, chan, XS_TGT(xs), + (uintmax_t)XS_LUN(xs)); } isp_prt(isp, ISP_LOGCONFIG, prom3, chan, dbidx, lp->portid, "Loop Down Timeout"); @@ -4034,10 +4057,11 @@ isp_action(struct cam_sim *sim, union cc } ccb->csio.req_map = NULL; #ifdef DIAGNOSTIC - if (ccb->ccb_h.target_id > (ISP_MAX_TARGETS(isp) - 1)) { + if (ccb->ccb_h.target_id >= ISP_MAX_TARGETS(isp)) { xpt_print(ccb->ccb_h.path, "invalid target\n"); ccb->ccb_h.status = CAM_PATH_INVALID; - } else if (ccb->ccb_h.target_lun > (ISP_MAX_LUNS(isp) - 1)) { + } else if (ISP_MAX_LUNS(isp) > 0 && + ccb->ccb_h.target_lun >= ISP_MAX_LUNS(isp)) { xpt_print(ccb->ccb_h.path, "invalid lun\n"); ccb->ccb_h.status = CAM_PATH_INVALID; } @@ -4080,15 +4104,23 @@ isp_action(struct cam_sim *sim, union cc lim = ISP_FC_PC(isp, bus)->loop_down_limit; if (FCPARAM(isp, bus)->loop_seen_once == 0 || ISP_FC_PC(isp, bus)->loop_down_time >= lim) { if (FCPARAM(isp, bus)->loop_seen_once == 0) { - isp_prt(isp, ISP_LOGDEBUG0, "%d.%d loop not seen yet @ %lu", XS_TGT(ccb), XS_LUN(ccb), (unsigned long) time_uptime); + isp_prt(isp, ISP_LOGDEBUG0, + "%d.%jx loop not seen yet @ %lu", + XS_TGT(ccb), (uintmax_t)XS_LUN(ccb), + (unsigned long) time_uptime); } else { - isp_prt(isp, ISP_LOGDEBUG0, "%d.%d downtime (%d) > lim (%d)", XS_TGT(ccb), XS_LUN(ccb), ISP_FC_PC(isp, bus)->loop_down_time, lim); + isp_prt(isp, ISP_LOGDEBUG0, + "%d.%jx downtime (%d) > lim (%d)", + XS_TGT(ccb), (uintmax_t)XS_LUN(ccb), + ISP_FC_PC(isp, bus)->loop_down_time, + lim); } ccb->ccb_h.status = CAM_SEL_TIMEOUT; isp_done((struct ccb_scsiio *) ccb); break; } - isp_prt(isp, ISP_LOGDEBUG0, "%d.%d retry later", XS_TGT(ccb), XS_LUN(ccb)); + isp_prt(isp, ISP_LOGDEBUG0, "%d.%jx retry later", + XS_TGT(ccb), (uintmax_t)XS_LUN(ccb)); cam_freeze_devq(ccb->ccb_h.path); cam_release_devq(ccb->ccb_h.path, RELSIM_RELEASE_AFTER_TIMEOUT, 0, 1000, 0); ccb->ccb_h.status = CAM_REQUEUE_REQ; @@ -4591,7 +4623,8 @@ isp_action(struct cam_sim *sim, union cc #endif cpi->hba_eng_cnt = 0; cpi->max_target = ISP_MAX_TARGETS(isp) - 1; - cpi->max_lun = ISP_MAX_LUNS(isp) - 1; + cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ? + 255 : ISP_MAX_LUNS(isp) - 1; cpi->bus_id = cam_sim_bus(sim); if (isp->isp_osinfo.sixtyfourbit) cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE; @@ -4603,6 +4636,9 @@ isp_action(struct cam_sim *sim, union cc fcparam *fcp = FCPARAM(isp, bus); cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED; +#if __FreeBSD_version >= 1000700 + cpi->hba_misc |= PIM_EXTLUNS; +#endif #if __FreeBSD_version >= 1000039 cpi->hba_misc |= PIM_NOSCAN; #endif @@ -4682,7 +4718,10 @@ isp_done(XS_T *sccb) status = sccb->ccb_h.status & CAM_STATUS_MASK; if (status != CAM_REQ_CMP) { if (status != CAM_SEL_TIMEOUT) - isp_prt(isp, ISP_LOGDEBUG0, "target %d lun %d CAM status 0x%x SCSI status 0x%x", XS_TGT(sccb), XS_LUN(sccb), sccb->ccb_h.status, sccb->scsi_status); + isp_prt(isp, ISP_LOGDEBUG0, + "target %d lun %jx CAM status 0x%x SCSI status 0x%x", + XS_TGT(sccb), (uintmax_t)XS_LUN(sccb), + sccb->ccb_h.status, sccb->scsi_status); else if ((IS_FC(isp)) && (XS_TGT(sccb) < MAX_FC_TARG)) { fcparam *fcp; @@ -5485,7 +5524,8 @@ isp_fcp_reset_crn(struct isp_fc *fc, uin int isp_fcp_next_crn(ispsoftc_t *isp, uint8_t *crnp, XS_T *cmd) { - uint32_t chan, tgt, lun; + lun_id_t lun; + uint32_t chan, tgt; struct isp_fc *fc; struct isp_nexus *nxp; int idx; Modified: head/sys/dev/isp/isp_freebsd.h ============================================================================== --- head/sys/dev/isp/isp_freebsd.h Sat Oct 24 17:24:19 2015 (r289881) +++ head/sys/dev/isp/isp_freebsd.h Sat Oct 24 17:34:40 2015 (r289882) @@ -207,12 +207,10 @@ struct isp_pcmd { * Per nexus info. */ struct isp_nexus { - struct isp_nexus * next; - uint32_t - crnseed : 8; /* next command reference number */ - uint32_t - tgt : 16, /* TGT for target */ - lun : 16; /* LUN for target */ + uint64_t lun; /* LUN for target */ + uint32_t tgt; /* TGT for target */ + uint8_t crnseed; /* next command reference number */ + struct isp_nexus *next; }; #define NEXUS_HASH_WIDTH 32 #define INITIAL_NEXUS_COUNT MAX_FC_TARG @@ -532,7 +530,7 @@ default: \ #define XS_ISP(ccb) cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path)) #define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)) #define XS_TGT(ccb) (ccb)->ccb_h.target_id -#define XS_LUN(ccb) (uint32_t)((ccb)->ccb_h.target_lun) +#define XS_LUN(ccb) (ccb)->ccb_h.target_lun #define XS_CDBP(ccb) \ (((ccb)->ccb_h.flags & CAM_CDB_POINTER)? \ Modified: head/sys/dev/isp/isp_target.c ============================================================================== --- head/sys/dev/isp/isp_target.c Sat Oct 24 17:24:19 2015 (r289881) +++ head/sys/dev/isp/isp_target.c Sat Oct 24 17:34:40 2015 (r289882) @@ -953,6 +953,9 @@ isp_got_msg_fc(ispsoftc_t *isp, in_fcent /* nt_tgt set in outer layers */ if (ISP_CAP_SCCFW(isp)) { notify.nt_lun = inp->in_scclun; +#if __FreeBSD_version < 1000700 + notify.nt_lun &= 0x3fff; +#endif } else { notify.nt_lun = inp->in_lun; } @@ -1330,6 +1333,9 @@ isp_handle_atio2(ispsoftc_t *isp, at2_en if (ISP_CAP_SCCFW(isp)) { lun = aep->at_scclun; +#if __FreeBSD_version < 1000700 + lun &= 0x3fff; +#endif } else { lun = aep->at_lun; } @@ -1357,7 +1363,7 @@ isp_handle_atio2(ispsoftc_t *isp, at2_en /* * ATIO rejected by the firmware due to disabled lun. */ - isp_prt(isp, ISP_LOGERR, "rejected ATIO2 for disabled lun %d", lun); + isp_prt(isp, ISP_LOGERR, "rejected ATIO2 for disabled lun %x", lun); break; case AT_NOCAP: /* @@ -1365,7 +1371,7 @@ isp_handle_atio2(ispsoftc_t *isp, at2_en * We sent an ATIO that overflowed the firmware's * command resource count. */ - isp_prt(isp, ISP_LOGERR, "rejected ATIO2 for lun %d- command count overflow", lun); + isp_prt(isp, ISP_LOGERR, "rejected ATIO2 for lun %x- command count overflow", lun); break; case AT_BDR_MSG: @@ -1402,7 +1408,7 @@ isp_handle_atio2(ispsoftc_t *isp, at2_en default: - isp_prt(isp, ISP_LOGERR, "Unknown ATIO2 status 0x%x from loopid %d for lun %d", aep->at_status, iid, lun); + isp_prt(isp, ISP_LOGERR, "Unknown ATIO2 status 0x%x from loopid %d for lun %x", aep->at_status, iid, lun); (void) isp_target_put_atio(isp, aep); break; }