diff options
Diffstat (limited to 'sys/dev/ic/isp_target.c')
-rw-r--r-- | sys/dev/ic/isp_target.c | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/sys/dev/ic/isp_target.c b/sys/dev/ic/isp_target.c index bd7a4824e2b..d6b7fd14b9e 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.1 2000/02/20 21:22:40 mjacob Exp $ */ +/* $OpenBSD: isp_target.c,v 1.2 2000/07/06 05:31:48 mjacob Exp $ */ /* * Machine and OS Independent Target Mode Code for the Qlogic SCSI/FC adapters. * @@ -285,7 +285,7 @@ isp_lun_cmd(isp, cmd, bus, tgt, lun, opaque) el.le_in_count = DFLT_INOTIFY; if (cmd == RQSTYPE_ENABLE_LUN) { if (IS_SCSI(isp)) { - el.le_flags = LUN_TQAE; + el.le_flags = LUN_TQAE|LUN_DISAD; el.le_cdb6len = 12; el.le_cdb7len = 12; } @@ -305,10 +305,8 @@ isp_lun_cmd(isp, cmd, bus, tgt, lun, opaque) if (IS_SCSI(isp)) { el.le_tgt = tgt; el.le_lun = lun; -#ifndef ISP2100_SCCLUN - } else { + } else if (isp->isp_maxluns <= 16) { el.le_lun = lun; -#endif } if (isp_getrqentry(isp, &iptr, &optr, &outp)) { @@ -380,11 +378,11 @@ isp_target_put_atio(isp, iid, tgt, lun, ttype, tval) if (IS_FC(isp)) { atun._atio2.at_header.rqs_entry_type = RQSTYPE_ATIO2; atun._atio2.at_header.rqs_entry_count = 1; -#ifdef ISP2100_SCCLUN - atun._atio2.at_scclun = (uint16_t) lun; -#else - atun._atio2.at_lun = (uint8_t) lun; -#endif + if (isp->isp_maxluns > 16) { + atun._atio2.at_scclun = (u_int16_t) lun; + } else { + atun._atio2.at_lun = (u_int8_t) lun; + } atun._atio2.at_status = CT_OK; } else { atun._atio.at_header.rqs_entry_type = RQSTYPE_ATIO; @@ -436,9 +434,9 @@ isp_endcmd(struct ispsoftc *isp, void *arg, u_int32_t code, u_int32_t hdl) cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; cto->ct_header.rqs_entry_count = 1; cto->ct_iid = aep->at_iid; -#ifndef ISP2100_SCCLUN - cto->ct_lun = aep->at_lun; -#endif + if (isp->isp_maxluns <= 16) { + cto->ct_lun = aep->at_lun; + } cto->ct_rxid = aep->at_rxid; cto->rsp.m1.ct_scsi_status = sts & 0xff; cto->ct_flags = CT2_SENDSTATUS | CT2_NO_DATA | CT2_FLAG_MODE1; @@ -596,11 +594,11 @@ isp_got_msg_fc(isp, bus, inp) MEMZERO(&msg, sizeof (msg)); msg.nt_bus = bus; msg.nt_iid = inp->in_iid; -#ifdef ISP2100_SCCLUN - msg.nt_lun = inp->in_scclun; -#else - msg.nt_lun = inp->in_lun; -#endif + if (isp->isp_maxluns > 16) { + msg.nt_lun = inp->in_scclun; + } else { + msg.nt_lun = inp->in_lun; + } msg.nt_tagval = inp->in_seqid; if (inp->in_task_flags & TASK_FLAGS_ABORT_TASK) { @@ -658,11 +656,11 @@ isp_notify_ack(isp, arg) in_fcentry_t *inp = arg; MEMCPY(storage, arg, sizeof (isphdr_t)); na->na_iid = inp->in_iid; -#ifdef ISP2100_SCCLUN - na->na_lun = inp->in_scclun; -#else - na->na_lun = inp->in_lun; -#endif + if (isp->isp_maxluns > 16) { + na->na_lun = inp->in_scclun; + } else { + na->na_lun = inp->in_lun; + } na->na_task_flags = inp->in_task_flags; na->na_seqid = inp->in_seqid; na->na_flags = NAFC_RCOUNT; @@ -672,6 +670,8 @@ isp_notify_ack(isp, arg) } else { na->na_flags = NAFC_RST_CLRD; } + na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; + na->na_header.rqs_entry_count = 1; ISP_SWIZ_NOT_ACK_FC(isp, outp, na); } else { na_entry_t *na = (na_entry_t *) storage; @@ -683,11 +683,13 @@ isp_notify_ack(isp, arg) na->na_tgt = inp->in_tgt; na->na_seqid = inp->in_seqid; if (inp->in_status == IN_RESET) { - na->na_flags = NA_RST_CLRD; + na->na_event = NA_RST_CLRD; } } else { - na->na_flags = NA_RST_CLRD; + na->na_event = NA_RST_CLRD; } + na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK; + na->na_header.rqs_entry_count = 1; ISP_SWIZ_NOT_ACK(isp, outp, na); } ISP_TDQE(isp, "isp_notify_ack", (int) optr, storage); @@ -784,11 +786,13 @@ isp_handle_atio2(isp, aep) at2_entry_t *aep; { int lun; -#ifdef ISP2100_SCCLUN - lun = aep->at_scclun; -#else - lun = aep->at_lun; -#endif + + if (isp->isp_maxluns > 16) { + lun = aep->at_scclun; + } else { + lun = aep->at_lun; + } + /* * The firmware status (except for the QLTM_SVALID bit) indicates * why this ATIO was sent to us. @@ -892,12 +896,14 @@ isp_handle_ctio(isp, ct) * We sent status & command complete. */ - if ((ct->ct_flags & CT_DATAMASK) == CT_NO_DATA) { + if (ct->ct_flags & CT_SENDSTATUS) { + break; + } else if ((ct->ct_flags & CT_DATAMASK) == CT_NO_DATA) { /* * Nothing to do in this case. */ - IDPRINTF(pl, ("%s: CTIO- initiator disconnected OK\n", - isp->isp_name)); + IDPRINTF(pl, ("%s:CTIO- iid %d disconnected OK\n", + isp->isp_name, ct->ct_iid)); return; } break; @@ -1025,7 +1031,7 @@ isp_handle_ctio(isp, ct) * complete thread synchronization. */ IDPRINTF(pl, - ("%s: status CTIO complete\n", isp->isp_name)); + ("%s:status CTIO complete\n", isp->isp_name)); } else { /* * Final CTIO completed. Release DMA resources and |