From owner-svn-src-stable-9@FreeBSD.ORG Sun Sep 2 14:45:37 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 162C1106566B; Sun, 2 Sep 2012 14:45:37 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 001508FC15; Sun, 2 Sep 2012 14:45:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q82EjaTY019262; Sun, 2 Sep 2012 14:45:36 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q82EjaDP019255; Sun, 2 Sep 2012 14:45:36 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201209021445.q82EjaDP019255@svn.freebsd.org> From: Matt Jacob Date: Sun, 2 Sep 2012 14:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240010 - stable/9/sys/dev/isp X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2012 14:45:37 -0000 Author: mjacob Date: Sun Sep 2 14:45:36 2012 New Revision: 240010 URL: http://svn.freebsd.org/changeset/base/240010 Log: MFC of 237537 Clean up multi-id mode so it's driven by the f/w loaded,... Modified: stable/9/sys/dev/isp/isp.c stable/9/sys/dev/isp/isp_freebsd.c stable/9/sys/dev/isp/isp_freebsd.h stable/9/sys/dev/isp/isp_pci.c stable/9/sys/dev/isp/ispmbox.h stable/9/sys/dev/isp/ispvar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/isp/ (props changed) Modified: stable/9/sys/dev/isp/isp.c ============================================================================== --- stable/9/sys/dev/isp/isp.c Sun Sep 2 14:44:09 2012 (r240009) +++ stable/9/sys/dev/isp/isp.c Sun Sep 2 14:45:36 2012 (r240010) @@ -1088,7 +1088,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d isp->isp_fwattr = mbs.param[6]; } if (IS_24XX(isp) && (isp->isp_fwattr & ISP2400_FW_ATTR_EXTNDED)) { - isp->isp_fwattr ^= ISP2400_FW_ATTR_EXTNDED; isp->isp_fwattr |= (((uint64_t) mbs.param[15]) << 16) | (((uint64_t) mbs.param[16]) << 32) | (((uint64_t) mbs.param[17]) << 48); } } else if (IS_SCSI(isp)) { @@ -1140,7 +1139,8 @@ isp_reset(ispsoftc_t *isp, int do_load_d } fwt &= ~ISP2400_FW_ATTR_EXTNDED; if (fwt) { - ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (unknown 0x%jx)", buf, (uintmax_t)fwt); + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (unknown 0x%08x%08x)", buf, + (uint32_t) (fwt >> 32), (uint32_t) fwt); } isp_prt(isp, ISP_LOGCONFIG, "%s", buf); } else if (IS_FC(isp)) { @@ -1183,12 +1183,23 @@ isp_reset(ispsoftc_t *isp, int do_load_d ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s 2K-Login", buf); } if (fwt != 0) { - ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (unknown 0x%jx)", buf, (uintmax_t)fwt); + ISP_SNPRINTF(buf, ISP_FC_SCRLEN - strlen(buf), "%s (unknown 0x%08x%08x)", buf, + (uint32_t) (fwt >> 32), (uint32_t) fwt); } isp_prt(isp, ISP_LOGCONFIG, "%s", buf); } - if (!IS_24XX(isp)) { + if (IS_24XX(isp)) { + MBSINIT(&mbs, MBOX_GET_RESOURCE_COUNT, MBLOGALL, 0); + isp_mboxcmd(isp, &mbs); + if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + ISP_RESET0(isp); + return; + } + if (isp->isp_maxcmds >= mbs.param[3]) { + isp->isp_maxcmds = mbs.param[3]; + } + } else { MBSINIT(&mbs, MBOX_GET_FIRMWARE_STATUS, MBLOGALL, 0); isp_mboxcmd(isp, &mbs); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { @@ -1206,11 +1217,12 @@ isp_reset(ispsoftc_t *isp, int do_load_d * Only make this check for non-SCSI cards (I'm not sure firmware attributes * work for them). */ - if (IS_FC(isp) && ISP_CAP_MULTI_ID(isp) == 0 && isp->isp_nchan > 1) { - isp_prt(isp, ISP_LOGWARN, "non-MULTIID f/w loaded, only can enable 1 of %d channels", isp->isp_nchan); - isp->isp_nchan = 1; + if (IS_FC(isp) && isp->isp_nchan > 1) { + if (!IS_24XX(isp) || (fwt & ISP2400_FW_ATTR_MULTIID) == 0) { + isp_prt(isp, ISP_LOGWARN, "non-MULTIID f/w loaded, only can enable 1 of %d channels", isp->isp_nchan); + isp->isp_nchan = 1; + } } - for (i = 0; i < isp->isp_nchan; i++) { isp_fw_state(isp, i); } @@ -1697,21 +1709,39 @@ isp_fibre_init(ispsoftc_t *isp) */ if (IS_2200(isp) || IS_23XX(isp)) { icbp->icb_fwoptions |= ICBOPT_EXTENDED; + + icbp->icb_xfwoptions = fcp->isp_xfwoptions; + /* * Prefer or force Point-To-Point instead Loop? */ switch (isp->isp_confopts & ISP_CFG_PORT_PREF) { case ISP_CFG_NPORT: + icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK; icbp->icb_xfwoptions |= ICBXOPT_PTP_2_LOOP; break; case ISP_CFG_NPORT_ONLY: + icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK; icbp->icb_xfwoptions |= ICBXOPT_PTP_ONLY; break; case ISP_CFG_LPORT_ONLY: + icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK; icbp->icb_xfwoptions |= ICBXOPT_LOOP_ONLY; break; default: - icbp->icb_xfwoptions |= ICBXOPT_LOOP_2_PTP; + /* + * Let NVRAM settings define it if they are sane + */ + switch (icbp->icb_xfwoptions & ICBXOPT_TOPO_MASK) { + case ICBXOPT_PTP_2_LOOP: + case ICBXOPT_PTP_ONLY: + case ICBXOPT_LOOP_ONLY: + case ICBXOPT_LOOP_2_PTP: + break; + default: + icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK; + icbp->icb_xfwoptions |= ICBXOPT_LOOP_2_PTP; + } break; } if (IS_2200(isp)) { @@ -1737,15 +1767,24 @@ isp_fibre_init(ispsoftc_t *isp) icbp->icb_xfwoptions |= ICBXOPT_ZIO; icbp->icb_idelaytimer = 10; } + icbp->icb_zfwoptions = fcp->isp_zfwoptions; if (isp->isp_confopts & ISP_CFG_ONEGB) { + icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK; icbp->icb_zfwoptions |= ICBZOPT_RATE_ONEGB; } else if (isp->isp_confopts & ISP_CFG_TWOGB) { + icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK; icbp->icb_zfwoptions |= ICBZOPT_RATE_TWOGB; } else { - icbp->icb_zfwoptions |= ICBZOPT_RATE_AUTO; - } - if (fcp->isp_zfwoptions & ICBZOPT_50_OHM) { - icbp->icb_zfwoptions |= ICBZOPT_50_OHM; + switch (icbp->icb_zfwoptions & ICBZOPT_RATE_MASK) { + case ICBZOPT_RATE_ONEGB: + case ICBZOPT_RATE_TWOGB: + case ICBZOPT_RATE_AUTO: + break; + default: + icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK; + icbp->icb_zfwoptions |= ICBZOPT_RATE_AUTO; + break; + } } } } @@ -1915,16 +1954,13 @@ isp_fibre_init_2400(ispsoftc_t *isp) icbp->icb_execthrottle = ICB_DFLT_THROTTLE; } + /* + * Set target exchange count. Take half if we are supporting both roles. + */ if (icbp->icb_fwoptions1 & ICB2400_OPT1_TGT_ENABLE) { - /* - * Get current resource count - */ - MBSINIT(&mbs, MBOX_GET_RESOURCE_COUNT, MBLOGALL, 0); - isp_mboxcmd(isp, &mbs); - if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { - return; - } - icbp->icb_xchgcnt = mbs.param[3]; + icbp->icb_xchgcnt = isp->isp_maxcmds; + if ((icbp->icb_fwoptions1 & ICB2400_OPT1_INI_DISABLE) == 0) + icbp->icb_xchgcnt >>= 1; } @@ -2511,15 +2547,12 @@ isp_get_wwn(ispsoftc_t *isp, int chan, i MBSINIT(&mbs, MBOX_GET_PORT_NAME, MBLOGALL & ~MBOX_COMMAND_PARAM_ERROR, 500000); if (ISP_CAP_2KLOGIN(isp)) { mbs.param[1] = loopid; - mbs.ibits = (1 << 10); if (nodename) { mbs.param[10] = 1; } - if (ISP_CAP_MULTI_ID(isp)) { - mbs.ibits |= (1 << 9); - mbs.param[9] = chan; - } + mbs.param[9] = chan; } else { + mbs.ibits = 3; mbs.param[1] = loopid << 8; if (nodename) { mbs.param[1] |= 1; @@ -7013,7 +7046,7 @@ static const uint32_t mbpfc[] = { ISP_FC_OPMAP(0x00, 0x00), /* 0x3f: */ ISP_FC_OPMAP(0x03, 0x01), /* 0x40: MBOX_LOOP_PORT_BYPASS */ ISP_FC_OPMAP(0x03, 0x01), /* 0x41: MBOX_LOOP_PORT_ENABLE */ - ISP_FC_OPMAP_HALF(0x3, 0xcf, 0x0, 0x07), /* 0x42: MBOX_GET_RESOURCE_COUNT */ + ISP_FC_OPMAP_HALF(0x0, 0x01, 0x3, 0xcf), /* 0x42: MBOX_GET_RESOURCE_COUNT */ ISP_FC_OPMAP(0x01, 0x01), /* 0x43: MBOX_REQUEST_OFFLINE_MODE */ ISP_FC_OPMAP(0x00, 0x00), /* 0x44: */ ISP_FC_OPMAP(0x00, 0x00), /* 0x45: */ @@ -7053,7 +7086,7 @@ static const uint32_t mbpfc[] = { ISP_FC_OPMAP(0x07, 0x01), /* 0x67: MBOX_CLEAR_TASK_SET */ ISP_FC_OPMAP(0x07, 0x01), /* 0x68: MBOX_ABORT_TASK_SET */ ISP_FC_OPMAP(0x01, 0x07), /* 0x69: MBOX_GET_FW_STATE */ - ISP_FC_OPMAP(0x03, 0xcf), /* 0x6a: MBOX_GET_PORT_NAME */ + ISP_FC_OPMAP_HALF(0x6, 0x03, 0x0, 0xcf), /* 0x6a: MBOX_GET_PORT_NAME */ ISP_FC_OPMAP(0xcf, 0x01), /* 0x6b: MBOX_GET_LINK_STATUS */ ISP_FC_OPMAP(0x0f, 0x01), /* 0x6c: MBOX_INIT_LIP_RESET */ ISP_FC_OPMAP(0x00, 0x00), /* 0x6d: */ Modified: stable/9/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/9/sys/dev/isp/isp_freebsd.c Sun Sep 2 14:44:09 2012 (r240009) +++ stable/9/sys/dev/isp/isp_freebsd.c Sun Sep 2 14:45:36 2012 (r240010) @@ -2202,6 +2202,7 @@ isp_handle_platform_atio7(ispsoftc_t *is tstate_t *tptr; struct ccb_accept_tio *atiop; atio_private_data_t *atp = NULL; + atio_private_data_t *oatp; inot_private_data_t *ntp; did = (aep->at_hdr.d_id[0] << 16) | (aep->at_hdr.d_id[1] << 8) | aep->at_hdr.d_id[2]; @@ -2296,6 +2297,7 @@ isp_handle_platform_atio7(ispsoftc_t *is * it and go to noresrc. */ if (tptr->restart_queue) { + isp_prt(isp, ISP_LOGTDEBUG0, "%s: restart queue refilling", __func__); if (restart_queue) { ntp = tptr->restart_queue; tptr->restart_queue = restart_queue; @@ -2332,15 +2334,15 @@ isp_handle_platform_atio7(ispsoftc_t *is isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] out of atps", aep->at_rxid); goto noresrc; } - if (isp_get_atpd(isp, tptr, aep->at_rxid)) { - isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] tag wraparound in isp_handle_platforms_atio7 (N-Port Handle 0x%04x S_ID 0x%04x OX_ID 0x%04x)\n", - aep->at_rxid, nphdl, sid, aep->at_hdr.ox_id); + oatp = isp_get_atpd(isp, tptr, aep->at_rxid); + if (oatp) { + isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] tag wraparound in isp_handle_platforms_atio7 (N-Port Handle 0x%04x S_ID 0x%04x OX_ID 0x%04x) oatp state %d\n", + aep->at_rxid, nphdl, sid, aep->at_hdr.ox_id, oatp->state); /* * It's not a "no resource" condition- but we can treat it like one */ goto noresrc; } - atp->tag = aep->at_rxid; atp->state = ATPD_STATE_ATIO; SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); @@ -2386,6 +2388,7 @@ isp_handle_platform_atio7(ispsoftc_t *is atp->nphdl = nphdl; atp->portid = sid; atp->oxid = aep->at_hdr.ox_id; + atp->rxid = aep->at_hdr.rx_id; 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; Modified: stable/9/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/9/sys/dev/isp/isp_freebsd.h Sun Sep 2 14:44:09 2012 (r240009) +++ stable/9/sys/dev/isp/isp_freebsd.h Sun Sep 2 14:45:36 2012 (r240010) @@ -61,7 +61,7 @@ #include "opt_isp.h" #define ISP_PLATFORM_VERSION_MAJOR 7 -#define ISP_PLATFORM_VERSION_MINOR 0 +#define ISP_PLATFORM_VERSION_MINOR 10 /* * Efficiency- get rid of SBus code && tests unless we need them. @@ -85,13 +85,14 @@ typedef struct { uint32_t orig_datalen; uint32_t bytes_xfered; uint32_t last_xframt; - uint32_t tag; + uint32_t tag; /* typically f/w RX_ID */ uint32_t lun; uint32_t nphdl; uint32_t sid; uint32_t portid; + uint16_t rxid; /* wire rxid */ + uint16_t oxid; /* wire oxid */ uint32_t - oxid : 16, cdb0 : 8, : 1, dead : 1, Modified: stable/9/sys/dev/isp/isp_pci.c ============================================================================== --- stable/9/sys/dev/isp/isp_pci.c Sun Sep 2 14:44:09 2012 (r240009) +++ stable/9/sys/dev/isp/isp_pci.c Sun Sep 2 14:45:36 2012 (r240010) @@ -374,6 +374,7 @@ static devclass_t isp_devclass; DRIVER_MODULE(isp, pci, isp_pci_driver, isp_devclass, 0, 0); MODULE_DEPEND(isp, cam, 1, 1, 1); MODULE_DEPEND(isp, firmware, 1, 1, 1); +static int isp_nvports = 0; static int isp_pci_probe(device_t dev) @@ -451,7 +452,7 @@ isp_pci_probe(device_t dev) } static void -isp_get_generic_options(device_t dev, ispsoftc_t *isp, int *nvp) +isp_get_generic_options(device_t dev, ispsoftc_t *isp) { int tval; @@ -483,12 +484,10 @@ isp_get_generic_options(device_t dev, is if (bootverbose) { isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO; } - tval = 0; + tval = -1; (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "vports", &tval); if (tval > 0 && tval < 127) { - *nvp = tval; - } else { - *nvp = 0; + isp_nvports = tval; } tval = 1; (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "autoconfig", &tval); @@ -527,7 +526,7 @@ static void isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp) { const char *sptr; - int tval; + int tval = 0; if (resource_int_value(device_get_name(dev), device_get_unit(dev), "iid", &tval)) { if (IS_FC(isp)) { @@ -648,7 +647,6 @@ static int isp_pci_attach(device_t dev) { int i, m1, m2, locksetup = 0; - int isp_nvports = 0; uint32_t data, cmd, linesz, did; struct isp_pcisoftc *pcs; ispsoftc_t *isp; @@ -670,7 +668,8 @@ isp_pci_attach(device_t dev) /* * Get Generic Options */ - isp_get_generic_options(dev, isp, &isp_nvports); + isp_nvports = 0; + isp_get_generic_options(dev, isp); /* * Check to see if options have us disabled @@ -876,21 +875,16 @@ isp_pci_attach(device_t dev) /* * Make sure that SERR, PERR, WRITE INVALIDATE and BUSMASTER are set. */ - cmd |= PCIM_CMD_SEREN | PCIM_CMD_PERRESPEN | - PCIM_CMD_BUSMASTEREN | PCIM_CMD_INVEN; - + cmd |= PCIM_CMD_SEREN | PCIM_CMD_PERRESPEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_INVEN; if (IS_2300(isp)) { /* per QLogic errata */ cmd &= ~PCIM_CMD_INVEN; } - if (IS_2322(isp) || pci_get_devid(dev) == PCI_QLOGIC_ISP6312) { cmd &= ~PCIM_CMD_INTX_DISABLE; } - if (IS_24XX(isp)) { cmd &= ~PCIM_CMD_INTX_DISABLE; } - pci_write_config(dev, PCIR_COMMAND, cmd, 2); /* Modified: stable/9/sys/dev/isp/ispmbox.h ============================================================================== --- stable/9/sys/dev/isp/ispmbox.h Sun Sep 2 14:44:09 2012 (r240009) +++ stable/9/sys/dev/isp/ispmbox.h Sun Sep 2 14:45:36 2012 (r240010) @@ -851,21 +851,36 @@ typedef struct { #define ISP2400_FW_ATTR_EXPFW 0x2000 #define ISP2400_FW_ATTR_EXTNDED 0x8000 -#define ISP_CAP_FCTAPE(isp) \ - (IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_FCTAPE)) +/* + * These are either manifestly true or are dependent on f/w attributes + */ #define ISP_CAP_TMODE(isp) \ (IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_TMODE)) #define ISP_CAP_SCCFW(isp) \ (IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_SCCLUN)) #define ISP_CAP_2KLOGIN(isp) \ (IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_2KLOGINS)) + +/* + * This is only true for 24XX cards with this f/w attribute + */ #define ISP_CAP_MULTI_ID(isp) \ (IS_24XX(isp)? (isp->isp_fwattr & ISP2400_FW_ATTR_MULTIID) : 0) - #define ISP_GET_VPIDX(isp, tag) \ (ISP_CAP_MULTI_ID(isp) ? tag : 0) /* + * This is true manifestly or is dependent on a f/w attribute + * but may or may not actually be *enabled*. In any case, it + * is enabled on a per-channel basis. + */ +#define ISP_CAP_FCTAPE(isp) \ + (IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_FCTAPE)) + +#define ISP_FCTAPE_ENABLED(isp, chan) \ + (IS_24XX(isp)? (FCPARAM(isp, chan)->isp_xfwoptions & ICB2400_OPT2_FCTAPE) != 0 : (FCPARAM(isp, chan)->isp_xfwoptions & ICBXOPT_FCTAPE) != 0) + +/* * Reduced Interrupt Operation Response Queue Entries */ Modified: stable/9/sys/dev/isp/ispvar.h ============================================================================== --- stable/9/sys/dev/isp/ispvar.h Sun Sep 2 14:44:09 2012 (r240009) +++ stable/9/sys/dev/isp/ispvar.h Sun Sep 2 14:45:36 2012 (r240010) @@ -678,7 +678,7 @@ struct ispsoftc { #define ISP_RUNSTATE 4 /* - * ISP Configuration Options + * ISP Runtime Configuration Options */ #define ISP_CFG_NORELOAD 0x80 /* don't download f/w */ #define ISP_CFG_NONVRAM 0x40 /* ignore NVRAM */