Keep up with the Joneses.... further synchronization for the eventual
implementation in NetBSD for target mode.
This commit is contained in:
parent
73eba1a839
commit
9f2c2c7a8c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isp_target.c,v 1.13 2001/04/05 02:28:17 mjacob Exp $ */
|
||||
/* $NetBSD: isp_target.c,v 1.14 2001/05/16 03:58:03 mjacob Exp $ */
|
||||
/*
|
||||
* This driver, which is contained in NetBSD in the files:
|
||||
*
|
||||
|
@ -294,7 +294,7 @@ isp_target_notify(struct ispsoftc *isp, void *vptr, u_int16_t *optrp)
|
|||
*/
|
||||
int
|
||||
isp_lun_cmd(struct ispsoftc *isp, int cmd, int bus, int tgt, int lun,
|
||||
u_int32_t opaque)
|
||||
int cmd_cnt, int inot_cnt, u_int32_t opaque)
|
||||
{
|
||||
lun_entry_t el;
|
||||
u_int16_t iptr, optr;
|
||||
|
@ -305,8 +305,8 @@ isp_lun_cmd(struct ispsoftc *isp, int cmd, int bus, int tgt, int lun,
|
|||
if (IS_DUALBUS(isp)) {
|
||||
el.le_rsvd = (bus & 0x1) << 7;
|
||||
}
|
||||
el.le_cmd_count = DFLT_CMD_CNT;
|
||||
el.le_in_count = DFLT_INOTIFY;
|
||||
el.le_cmd_count = cmd_cnt;
|
||||
el.le_in_count = inot_cnt;
|
||||
if (cmd == RQSTYPE_ENABLE_LUN) {
|
||||
if (IS_SCSI(isp)) {
|
||||
el.le_flags = LUN_TQAE|LUN_DISAD;
|
||||
|
@ -466,7 +466,7 @@ isp_endcmd(struct ispsoftc *isp, void *arg, u_int32_t code, u_int16_t hdl)
|
|||
}
|
||||
if (aep->at_datalen) {
|
||||
cto->ct_resid = aep->at_datalen;
|
||||
cto->ct_flags |= CT2_DATA_UNDER;
|
||||
cto->rsp.m1.ct_scsi_status |= CT2_DATA_UNDER;
|
||||
}
|
||||
if ((sts & 0xff) == SCSI_CHECK && (sts & ECMD_SVALID)) {
|
||||
cto->rsp.m1.ct_resp[0] = 0xf0;
|
||||
|
@ -475,7 +475,7 @@ isp_endcmd(struct ispsoftc *isp, void *arg, u_int32_t code, u_int16_t hdl)
|
|||
cto->rsp.m1.ct_resp[12] = (code >> 24) & 0xff;
|
||||
cto->rsp.m1.ct_resp[13] = (code >> 16) & 0xff;
|
||||
cto->rsp.m1.ct_senselen = 16;
|
||||
cto->ct_flags |= CT2_SNSLEN_VALID;
|
||||
cto->rsp.m1.ct_scsi_status |= CT2_SNSLEN_VALID;
|
||||
}
|
||||
cto->ct_syshandle = hdl;
|
||||
} else {
|
||||
|
@ -986,16 +986,7 @@ isp_handle_ctio(struct ispsoftc *isp, ct_entry_t *ct)
|
|||
case CT_NOACK:
|
||||
if (fmsg == NULL)
|
||||
fmsg = "unacknowledged Immediate Notify pending";
|
||||
|
||||
isp_prt(isp, ISP_LOGERR, "CTIO returned by f/w- %s", fmsg);
|
||||
#if 0
|
||||
if (status & SENSEVALID) {
|
||||
bcopy((caddr_t) (cep + CTIO_SENSE_OFFSET),
|
||||
(caddr_t) &cdp->cd_sensedata,
|
||||
sizeof(scsi_sense_t));
|
||||
cdp->cd_flags |= CDF_SENSEVALID;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
isp_prt(isp, ISP_LOGERR, "Unknown CTIO status 0x%x",
|
||||
|
@ -1025,11 +1016,11 @@ isp_handle_ctio(struct ispsoftc *isp, ct_entry_t *ct)
|
|||
ct->ct_syshandle, ct->ct_status & ~QLTM_SVALID);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Final CTIO completed. Release DMA resources and
|
||||
* notify platform dependent layers.
|
||||
*/
|
||||
if (ct->ct_flags & CT_DATAMASK) {
|
||||
/*
|
||||
* Final CTIO completed. Release DMA resources and
|
||||
* notify platform dependent layers.
|
||||
*/
|
||||
if ((ct->ct_flags & CT_DATAMASK) != CT_NO_DATA) {
|
||||
ISP_DMAFREE(isp, xs, ct->ct_syshandle);
|
||||
}
|
||||
isp_prt(isp, pl, "final CTIO complete");
|
||||
|
@ -1056,6 +1047,11 @@ isp_handle_ctio2(struct ispsoftc *isp, ct2_entry_t *ct)
|
|||
}
|
||||
|
||||
switch(ct->ct_status & ~QLTM_SVALID) {
|
||||
case CT_BUS_ERROR:
|
||||
isp_prt(isp, ISP_LOGERR, "PCI DMA Bus Error");
|
||||
/* FALL Through */
|
||||
case CT_DATA_OVER:
|
||||
case CT_DATA_UNDER:
|
||||
case CT_OK:
|
||||
/*
|
||||
* There are generally 2 possibilities as to why we'd get
|
||||
|
@ -1068,19 +1064,18 @@ isp_handle_ctio2(struct ispsoftc *isp, ct2_entry_t *ct)
|
|||
|
||||
case CT_BDR_MSG:
|
||||
/*
|
||||
* Bus Device Reset message received or the SCSI Bus has
|
||||
* been Reset; the firmware has gone to Bus Free.
|
||||
* Target Reset function received.
|
||||
*
|
||||
* The firmware generates an async mailbox interupt to
|
||||
* notify us of this and returns outstanding CTIOs with this
|
||||
* status. These CTIOs are handled in that same way as
|
||||
* CT_ABORTED ones, so just fall through here.
|
||||
*/
|
||||
fmsg = "Bus Device Reset";
|
||||
fmsg = "TARGET RESET Task Management Function Received";
|
||||
/*FALLTHROUGH*/
|
||||
case CT_RESET:
|
||||
if (fmsg == NULL)
|
||||
fmsg = "Bus Reset";
|
||||
fmsg = "LIP Reset";
|
||||
/*FALLTHROUGH*/
|
||||
case CT_ABORTED:
|
||||
/*
|
||||
|
@ -1089,7 +1084,7 @@ isp_handle_ctio2(struct ispsoftc *isp, ct2_entry_t *ct)
|
|||
* set, then sends us an Immediate Notify entry.
|
||||
*/
|
||||
if (fmsg == NULL)
|
||||
fmsg = "ABORT TASK sent by Initiator";
|
||||
fmsg = "ABORT Task Management Function Received";
|
||||
|
||||
isp_prt(isp, ISP_LOGERR, "CTIO2 destroyed by %s", fmsg);
|
||||
break;
|
||||
|
@ -1101,38 +1096,18 @@ isp_handle_ctio2(struct ispsoftc *isp, ct2_entry_t *ct)
|
|||
isp_prt(isp, ISP_LOGERR, "CTIO2 had wrong data directiond");
|
||||
break;
|
||||
|
||||
case CT_NOPATH:
|
||||
/*
|
||||
* CTIO rejected by the firmware due "no path for the
|
||||
* nondisconnecting nexus specified". This means that
|
||||
* we tried to access the bus while a non-disconnecting
|
||||
* command is in process.
|
||||
*/
|
||||
isp_prt(isp, ISP_LOGERR,
|
||||
"Firmware rejected CTIO2 for bad nexus %d->%d",
|
||||
ct->ct_iid, ct->ct_lun);
|
||||
break;
|
||||
|
||||
case CT_RSELTMO:
|
||||
fmsg = "Reselection";
|
||||
fmsg = "failure to reconnect to initiator";
|
||||
/*FALLTHROUGH*/
|
||||
case CT_TIMEOUT:
|
||||
if (fmsg == NULL)
|
||||
fmsg = "Command";
|
||||
fmsg = "command";
|
||||
isp_prt(isp, ISP_LOGERR, "Firmware timed out on %s", fmsg);
|
||||
break;
|
||||
|
||||
case CT_ERR:
|
||||
fmsg = "Completed with Error";
|
||||
/*FALLTHROUGH*/
|
||||
case CT_PHASE_ERROR: /* Bus phase sequence error */
|
||||
if (fmsg == NULL)
|
||||
fmsg = "Phase Sequence Error";
|
||||
/*FALLTHROUGH*/
|
||||
case CT_TERMINATED:
|
||||
if (fmsg == NULL)
|
||||
fmsg = "terminated by TERMINATE TRANSFER";
|
||||
/*FALLTHROUGH*/
|
||||
case CT_LOGOUT:
|
||||
if (fmsg == NULL)
|
||||
fmsg = "Port Logout";
|
||||
|
@ -1140,19 +1115,13 @@ isp_handle_ctio2(struct ispsoftc *isp, ct2_entry_t *ct)
|
|||
case CT_PORTNOTAVAIL:
|
||||
if (fmsg == NULL)
|
||||
fmsg = "Port not available";
|
||||
case CT_PORTCHANGED:
|
||||
if (fmsg == NULL)
|
||||
fmsg = "Port Changed";
|
||||
case CT_NOACK:
|
||||
if (fmsg == NULL)
|
||||
fmsg = "unacknowledged Immediate Notify pending";
|
||||
|
||||
isp_prt(isp, ISP_LOGERR, "CTIO returned by f/w- %s", fmsg);
|
||||
#if 0
|
||||
if (status & SENSEVALID) {
|
||||
bcopy((caddr_t) (cep + CTIO_SENSE_OFFSET),
|
||||
(caddr_t) &cdp->cd_sensedata,
|
||||
sizeof(scsi_sense_t));
|
||||
cdp->cd_flags |= CDF_SENSEVALID;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case CT_INVRXID:
|
||||
|
@ -1192,6 +1161,9 @@ isp_handle_ctio2(struct ispsoftc *isp, ct2_entry_t *ct)
|
|||
ct->ct_syshandle, ct->ct_status & ~QLTM_SVALID);
|
||||
}
|
||||
} else {
|
||||
if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA) {
|
||||
ISP_DMAFREE(isp, xs, ct->ct_syshandle);
|
||||
}
|
||||
if (ct->ct_flags & CT_SENDSTATUS) {
|
||||
/*
|
||||
* Sent status and command complete.
|
||||
|
@ -1208,7 +1180,6 @@ isp_handle_ctio2(struct ispsoftc *isp, ct2_entry_t *ct)
|
|||
* notify platform dependent layers.
|
||||
*/
|
||||
isp_prt(isp, pl, "data CTIO complete");
|
||||
ISP_DMAFREE(isp, xs, ct->ct_syshandle);
|
||||
}
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isp_target.h,v 1.12 2001/04/05 02:28:17 mjacob Exp $ */
|
||||
/* $NetBSD: isp_target.h,v 1.13 2001/05/16 03:58:03 mjacob Exp $ */
|
||||
/*
|
||||
* This driver, which is contained in NetBSD in the files:
|
||||
*
|
||||
|
@ -389,13 +389,16 @@ typedef struct {
|
|||
#define CT_INVAL 0x06 /* request for disabled lun */
|
||||
#define CT_NOPATH 0x07 /* invalid ITL nexus */
|
||||
#define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */
|
||||
#define CT_DATA_OVER 0x09 /* (FC only) Data Overrun */
|
||||
#define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */
|
||||
#define CT_TIMEOUT 0x0B /* timed out */
|
||||
#define CT_RESET 0x0E /* SCSI Bus Reset occurred */
|
||||
#define CT_PARITY 0x0F /* Uncorrectable Parity Error */
|
||||
#define CT_BUS_ERROR 0x10 /* (FC Only) DMA PCI Error */
|
||||
#define CT_PANIC 0x13 /* Unrecoverable Error */
|
||||
#define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */
|
||||
#define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */
|
||||
#define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */
|
||||
#define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */
|
||||
#define CT_PORTNOTAVAIL 0x28 /* port not available */
|
||||
#define CT_LOGOUT 0x29 /* port logout */
|
||||
|
@ -710,10 +713,11 @@ int isp_target_notify(struct ispsoftc *, void *, u_int16_t *);
|
|||
|
||||
/*
|
||||
* Enable/Disable/Modify a logical unit.
|
||||
* (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque)
|
||||
*/
|
||||
#define DFLT_CMD_CNT 32 /* XX */
|
||||
#define DFLT_INOTIFY (4)
|
||||
int isp_lun_cmd(struct ispsoftc *, int, int, int, int, u_int32_t);
|
||||
#define DFLT_CMND_CNT 32
|
||||
#define DFLT_INOT_CNT 4
|
||||
int isp_lun_cmd(struct ispsoftc *, int, int, int, int, int, int, u_int32_t);
|
||||
|
||||
/*
|
||||
* General request queue 'put' routine for target mode entries.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isp_tpublic.h,v 1.6 2001/03/14 05:10:38 mjacob Exp $ */
|
||||
/* $NetBSD: isp_tpublic.h,v 1.7 2001/05/16 03:58:03 mjacob Exp $ */
|
||||
/*
|
||||
* This driver, which is contained in NetBSD in the files:
|
||||
*
|
||||
|
@ -251,11 +251,12 @@ typedef struct tmd_cmd {
|
|||
u_int8_t cd_reserved[_TMD_PAD_LEN];
|
||||
} tmd_cmd_t;
|
||||
|
||||
#define CDFL_BUSY 0x01 /* this command is not on a free list */
|
||||
#define CDFL_SNSVALID 0x01 /* sense data (from f/w) valid */
|
||||
#define CDFL_NODISC 0x02 /* disconnects disabled */
|
||||
#define CDFL_SENTSENSE 0x04 /* last action sent sense data */
|
||||
#define CDFL_SENTSTATUS 0x08 /* last action sent status */
|
||||
#define CDFL_ERROR 0x10 /* last action ended in error */
|
||||
#define CDFL_BUSY 0x40 /* this command is not on a free list */
|
||||
#define CDFL_PRIVATE_0 0x80 /* private layer flags */
|
||||
|
||||
#define CDFH_SNSVALID 0x01 /* sense data valid */
|
||||
|
|
Loading…
Reference in New Issue