diff --git a/sys/dev/isp/isp_target.c b/sys/dev/isp/isp_target.c index b53ad83ebfd..04be57508a5 100644 --- a/sys/dev/isp/isp_target.c +++ b/sys/dev/isp/isp_target.c @@ -672,6 +672,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 +685,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); @@ -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 diff --git a/sys/dev/isp/isp_target.h b/sys/dev/isp/isp_target.h index 1c7cb203f17..874814ebc51 100644 --- a/sys/dev/isp/isp_target.h +++ b/sys/dev/isp/isp_target.h @@ -186,6 +186,8 @@ typedef struct { * Value for the na_event field */ #define NA_RST_CLRD 0x80 /* Clear an async event notification */ +#define NA_OK 0x01 /* Notify Acknowledge Succeeded */ +#define NA_INVALID 0x06 /* Invalid Notify Acknowledge */ #define NA2_RSVDLEN 21 typedef struct { @@ -623,7 +625,7 @@ int isp_target_notify __P((struct ispsoftc *, void *, u_int16_t *)); */ #define DFLT_CMD_CNT (RESULT_QUEUE_LEN >> 1) #define DFLT_INOTIFY (4) -int isp_lun_cmd __P((struct ispsoftc *isp, int, int, int, int, u_int32_t)); +int isp_lun_cmd __P((struct ispsoftc *, int, int, int, int, u_int32_t)); /* * General request queue 'put' routine for target mode entries. @@ -635,14 +637,14 @@ int isp_target_put_entry __P((struct ispsoftc *isp, void *)); * used for replenishing f/w resource counts. */ int -isp_target_put_atio __P((struct ispsoftc *isp, int, int, int, int, int)); +isp_target_put_atio __P((struct ispsoftc *, int, int, int, int, int)); /* * General routine to send a final CTIO for a command- used mostly for * local responses. */ int -isp_endcmd __P((struct ispsoftc *isp, void *, u_int32_t, u_int32_t)); +isp_endcmd __P((struct ispsoftc *, void *, u_int32_t, u_int32_t)); #define ECMD_SVALID 0x100 /* diff --git a/sys/dev/isp/isp_tpublic.h b/sys/dev/isp/isp_tpublic.h index 0565a7ddd5f..d5e886fb1b4 100644 --- a/sys/dev/isp/isp_tpublic.h +++ b/sys/dev/isp/isp_tpublic.h @@ -59,11 +59,26 @@ typedef struct { } tmd_event_t; /* - * Suggested software target mode command handling structure. + * Suggested Software Target Mode Command Handling structure. * - * The command structure is one suggested possible MD command structure, - * but since the handling of thbis is entirely in the MD layer, there - * is no requirement that it be used. + * A note about terminology: + * + * MD stands for "Machine Dependent". + * + * This driver is structured in three layers: Outer MD, core, and inner MD. + * The latter also is bus dependent (i.e., is cognizant of PCI bus issues + * as well as platform issues). + * + * + * "Outer Layer" means "Other Module" + * + * Some additional module that actually implements SCSI target command + * policy is the recipient of incoming commands and the source of the + * disposition for them. + * + * The command structure below is one suggested possible MD command structure, + * but since the handling of thbis is entirely in the MD layer, there is + * no explicit or implicit requirement that it be used. * * The cd_private tag should be used by the MD layer to keep a free list * of these structures. Code outside of this driver can then use this @@ -123,17 +138,16 @@ typedef struct { * layers must agree on the meaning of cd_data. * * The tag cd_totlen is the total data amount expected to be moved - * over the life of the command. It may be set by the MD layer, - * for example, from the datalen field of an FCP CMND IU unit. If - * it shows up in the outer layers set to zero and the CDB indicates - * data should be moved, the outer layer should set it to the amount - * expected to be moved. + * over the life of the command. It *may* be set by the MD layer, possibly + * from the datalen field of an FCP CMND IU unit. If it shows up in the outer + * layers set to zero and the CDB indicates data should be moved, the outer + * layer should set it to the amount expected to be moved. * * The tag cd_resid should be the total residual of data not transferred. * The outer layers need to set this at the begining of command processing * to equal cd_totlen. As data is successfully moved, this value is decreased. * At the end of a command, any nonzero residual indicates the number of bytes - * requested but not moved. + * requested but not moved. XXXXXXXXXXXXXXXXXXXXXXX TOO VAGUE!!! * * The tag cd_xfrlen is the length of the currently active data transfer. * This allows several interations between any outside software and the @@ -206,9 +220,10 @@ typedef struct tmd_cmd { } tmd_cmd_t; #define CDFL_BUSY 0x01 /* this command is not on a free list */ -#define CDFL_NODISC 0x02 /* disconnect not allowed */ +#define CDFL_NODISC 0x02 /* disconnects disabled */ #define CDFL_SENTSENSE 0x04 /* last action sent sense data */ -#define CDFL_ERROR 0x08 /* last action ended in error */ +#define CDFL_SENTSTATUS 0x08 /* last action sent status */ +#define CDFL_ERROR 0x10 /* last action ended in error */ #define CDFL_PRIVATE_0 0x80 /* private layer flags */ #define CDFH_SNSVALID 0x01 /* sense data valid */