From 11df6402b4916bd2c5bf5c685dc72b0c13a37098 Mon Sep 17 00:00:00 2001 From: mjacob Date: Sat, 27 Feb 2010 05:41:23 +0000 Subject: Revamp the pieces of some of the stuff I forgot to do when shifting to 32 bit handles. The RIO (reduced interrupt operation) and fast posting for the parallel SCSI cards were all 16 bit handles. Furthermore, target mode parallel SCSI only can have 16 bit handles. Use part of a supplied patch to switch over to using 32 bit handles. Be a bit more conservative here and only do this for parallel SCSI for the 12160 (Ultra3) cards. There were a lot of marginal Ultra2 cards, and, frankly, few are findable now for testing. Fix the target handle routine to only do 16 bit handles for parallel SCSI cards. This is okay because the upper sixteen bits of the new 32 bit handles is a sequence number to help protect against duplicate completions. This would be very unlikely to happen with parallel SCSI target mode, and wasn't present before, so we're no worse off than we used to be. While we're at it, finally split the async mailbox completion handlers into FC and parallel SCSI functions. This makes it much cleaner and easier to figure out what is or isn't a legal async mailbox completion code for different card classes. PR: kern/144250 Submitted partially by: Charles D MFC after: 1 week --- sys/dev/isp/isp_library.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'sys/dev/isp/isp_library.c') diff --git a/sys/dev/isp/isp_library.c b/sys/dev/isp/isp_library.c index 57b8400..43c161d 100644 --- a/sys/dev/isp/isp_library.c +++ b/sys/dev/isp/isp_library.c @@ -668,7 +668,7 @@ isp_clear_commands(ispsoftc_t *isp) ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO2; } else { ct_entry_t *ctio = (ct_entry_t *) local; - ctio->ct_syshandle = hdp->handle & 0xffff; + ctio->ct_syshandle = hdp->handle; ctio->ct_status = CT_HBA_RESET & 0xff; ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO; } @@ -1132,17 +1132,36 @@ isp_get_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst) void +isp_get_rio1(ispsoftc_t *isp, isp_rio1_t *r1src, isp_rio1_t *r1dst) +{ + const int lim = sizeof (r1dst->req_handles) / sizeof (r1dst->req_handles[0]); + int i; + isp_get_hdr(isp, &r1src->req_header, &r1dst->req_header); + if (r1dst->req_header.rqs_seqno > lim) { + r1dst->req_header.rqs_seqno = lim; + } + for (i = 0; i < r1dst->req_header.rqs_seqno; i++) { + ISP_IOXGET_32(isp, &r1src->req_handles[i], r1dst->req_handles[i]); + } + while (i < lim) { + r1dst->req_handles[i++] = 0; + } +} + +void isp_get_rio2(ispsoftc_t *isp, isp_rio2_t *r2src, isp_rio2_t *r2dst) { + const int lim = sizeof (r2dst->req_handles) / sizeof (r2dst->req_handles[0]); int i; + isp_get_hdr(isp, &r2src->req_header, &r2dst->req_header); - if (r2dst->req_header.rqs_seqno > 30) { - r2dst->req_header.rqs_seqno = 30; + if (r2dst->req_header.rqs_seqno > lim) { + r2dst->req_header.rqs_seqno = lim; } for (i = 0; i < r2dst->req_header.rqs_seqno; i++) { ISP_IOXGET_16(isp, &r2src->req_handles[i], r2dst->req_handles[i]); } - while (i < 30) { + while (i < lim) { r2dst->req_handles[i++] = 0; } } @@ -2240,7 +2259,13 @@ isp_allocate_xs_tgt(ispsoftc_t *isp, void *xs, uint32_t *handlep) hdp->cmd = xs; hdp->handle = (hdp - isp->isp_tgtlist); hdp->handle |= (ISP_HANDLE_TARGET << ISP_HANDLE_USAGE_SHIFT); - hdp->handle |= (isp->isp_seqno++ << ISP_HANDLE_SEQ_SHIFT); + /* + * Target handles for SCSI cards are only 16 bits, so + * sequence number protection will be ommitted. + */ + if (IS_FC(isp)) { + hdp->handle |= (isp->isp_seqno++ << ISP_HANDLE_SEQ_SHIFT); + } *handlep = hdp->handle; return (0); } -- cgit v1.1