1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

Clean up multi-id mode so it's driven by the f/w loaded,

not by some hint setting.  Do more preparations for FC-Tape.
Clean up resource counting for 24XX or later chipsets so
we find out after EXEC_FIRMWARE what is actually supported.
Set target mode exchange count based upon whether or not
we are supporting simultaneous target/initiator mode. Clean
up some old (pre-24XX) xfwoption and zfwoption issues.

Sponsored by:	Spectralogic
MFC after:	3 days
This commit is contained in:
Matt Jacob 2012-06-24 17:30:54 +00:00
parent 6b14dddf9a
commit 9e7d423d23
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=237537
6 changed files with 100 additions and 54 deletions

View File

@ -1088,7 +1088,6 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
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_defaults)
}
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_defaults)
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_defaults)
* 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, int loopid, int nodename)
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: */

View File

@ -2210,6 +2210,7 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
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];
@ -2304,6 +2305,7 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
* 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;
@ -2340,15 +2342,15 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
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);
@ -2394,6 +2396,7 @@ isp_handle_platform_atio7(ispsoftc_t *isp, at7_entry_t *aep)
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;

View File

@ -62,7 +62,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.
@ -93,13 +93,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,

View File

@ -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, ispsoftc_t *isp, int *nvp)
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);
/*

View File

@ -851,20 +851,35 @@ 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
*/

View File

@ -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 */