-/* $OpenBSD: isp.c,v 1.14 2000/03/05 22:18:59 mjacob Exp $ */
+/* $OpenBSD: isp.c,v 1.15 2000/04/06 05:50:43 mjacob Exp $ */
/*
* Machine and OS Independent (well, as best as possible)
* code for the Qlogic ISP SCSI adapters.
"F Port"
};
mbreg_t mbs;
- int count, topo = -1;
+ int count;
u_int8_t lwfs;
fcparam *fcp;
#if defined(ISP2100_FABRIC)
}
fcp->isp_loopid = mbs.param[1];
if (IS_2200(isp)) {
- topo = (int) mbs.param[6];
- if (topo < 0 || topo > 3)
- topo = 0;
+ count = (int) mbs.param[6];
+ if (count < TOPO_NL_PORT || count > TOPO_PTP_STUB)
+ count = TOPO_PTP_STUB;
+ fcp->isp_topo = count;
} else {
- topo = 0;
+ fcp->isp_topo = TOPO_NL_PORT;
}
/*
if (isp_getpdb(isp, FL_PORT_ID, &pdb) == 0) {
if (IS_2100(isp))
- topo = 1;
+ fcp->isp_topo = TOPO_FL_PORT;
fcp->isp_portid = mbs.param[2] | (((int)mbs.param[3]) << 16);
fcp->isp_onfabric = 1;
CFGPRINTF("%s: Loop ID %d, AL_PA 0x%x, Port ID 0x%x Loop State "
"0x%x topology '%s'\n", isp->isp_name, fcp->isp_loopid,
fcp->isp_alpa, fcp->isp_portid, fcp->isp_loopstate,
- toponames[topo]);
+ toponames[fcp->isp_topo]);
/*
* Make sure we're logged out of all fabric devices.
#endif
CFGPRINTF("%s: Loop ID %d, ALPA 0x%x Loop State 0x%x topology '%s'\n",
isp->isp_name, fcp->isp_loopid, fcp->isp_alpa, fcp->isp_loopstate,
- toponames[topo]);
+ toponames[fcp->isp_topo]);
return (0);
}
fcparam *fcp = isp->isp_param;
struct lportdb *lp;
#if defined(ISP2100_FABRIC)
- if (target >= FL_PORT_ID) {
- /*
- * If we're not on a Fabric, we can't have a target
- * above FL_PORT_ID-1. If we're on a fabric, we
- * can't have a target less than FC_SNS_ID+1.
- */
- if (fcp->isp_onfabric == 0 || target <= FC_SNS_ID) {
+ /*
+ * If we're not on a Fabric, we can't have a target
+ * above FL_PORT_ID-1. If we're on a fabric and
+ * connected as an F-port, we can't have a target
+ * less than FC_SNS_ID+1.
+ */
+ if (fcp->isp_onfabric == 0) {
+ if (target >= FL_PORT_ID) {
+ XS_SETERR(xs, HBA_SELTIMEOUT);
+ return (CMD_COMPLETE);
+ }
+ } else {
+ if (target >= FL_PORT_ID && target <= FC_SNS_ID) {
+ XS_SETERR(xs, HBA_SELTIMEOUT);
+ return (CMD_COMPLETE);
+ }
+ if (fcp->isp_topo == TOPO_F_PORT &&
+ target < FL_PORT_ID) {
XS_SETERR(xs, HBA_SELTIMEOUT);
return (CMD_COMPLETE);
}
mbs.param[1] = 10;
bus = 0;
}
- isp->isp_sendmarker = 1 << bus;
+ isp->isp_sendmarker |= (1 << bus);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
isp_dumpregs(isp, "isp_control SCSI bus reset failed");
}
PRINTF("%s: Target %d on Bus %d Reset Succeeded\n",
isp->isp_name, tgt, bus);
- isp->isp_sendmarker = 1 << bus;
+ isp->isp_sendmarker |= (1 << bus);
return (0);
case ISPCTL_ABORT_CMD:
case MBOX_COMMAND_COMPLETE: /* sometimes these show up */
break;
case ASYNC_BUS_RESET:
- isp->isp_sendmarker = (1 << bus);
+ isp->isp_sendmarker |= (1 << bus);
#ifdef ISP_TARGET_MODE
isp_target_async(isp, bus, mbox);
#endif
case ASYNC_TIMEOUT_RESET:
PRINTF("%s: timeout initiated SCSI bus reset of bus %d\n",
isp->isp_name, bus);
- isp->isp_sendmarker = (1 << bus);
+ isp->isp_sendmarker |= (1 << bus);
#ifdef ISP_TARGET_MODE
isp_target_async(isp, bus, mbox);
#endif
case ASYNC_DEVICE_RESET:
PRINTF("%s: device reset on bus %d\n", isp->isp_name, bus);
- isp->isp_sendmarker = 1 << bus;
+ isp->isp_sendmarker |= (1 << bus);
#ifdef ISP_TARGET_MODE
isp_target_async(isp, bus, mbox);
#endif
* XXX: Set up to renegotiate again!
*/
/* Can only be for a 1080... */
- isp->isp_sendmarker = (1 << bus);
+ isp->isp_sendmarker |= (1 << bus);
break;
case ASYNC_CMD_CMPLT:
break;
case ASYNC_LOOP_RESET:
- isp->isp_sendmarker = 1 << bus;
+ isp->isp_sendmarker = 1;
((fcparam *) isp->isp_param)->isp_fwstate = FW_CONFIG_WAIT;
((fcparam *) isp->isp_param)->isp_loopstate = LOOP_NIL;
isp_mark_getpdb_all(isp);