Date: Thu, 19 Oct 2006 23:01:20 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 108127 for review Message-ID: <200610192301.k9JN1K7u058004@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=108127 Change 108127 by mjacob@newisp on 2006/10/19 23:01:10 Add the 24XX ABORT I/O data definition and the associated library function but punt on putting it into use as yet. Instead, just make sure we complain about not being able to things like ABORT I/O or RESET DEV instead of mistakenly trying them on a 24XX. Affected files ... .. //depot/projects/newisp/dev/isp/isp.c#20 edit .. //depot/projects/newisp/dev/isp/isp_library.c#12 edit .. //depot/projects/newisp/dev/isp/isp_library.h#9 edit .. //depot/projects/newisp/dev/isp/ispmbox.h#11 edit Differences ... ==== //depot/projects/newisp/dev/isp/isp.c#20 (text+ko) ==== @@ -4210,8 +4210,13 @@ /* * Issue a bus reset. */ - mbs.param[0] = MBOX_BUS_RESET; - if (IS_SCSI(isp)) { + if (IS_24XX(isp)) { + isp_prt(isp, ISP_LOGWARN, "RESET BUS NOT IMPLETENTED"); + break; + } else if (IS_FC(isp)) { + mbs.param[1] = 10; + bus = 0; + } else { mbs.param[1] = SDPARAM(isp)->isp_bus_reset_delay; if (mbs.param[1] < 2) { mbs.param[1] = 2; @@ -4220,10 +4225,8 @@ if (IS_DUALBUS(isp)) { mbs.param[2] = bus; } - } else { - mbs.param[1] = 10; - bus = 0; } + mbs.param[0] = MBOX_BUS_RESET; isp->isp_sendmarker |= (1 << bus); mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); @@ -4236,18 +4239,22 @@ case ISPCTL_RESET_DEV: tgt = (*((int *) arg)) & 0xffff; - bus = (*((int *) arg)) >> 16; - mbs.param[0] = MBOX_ABORT_TARGET; - if (IS_SCSI(isp)) { - mbs.param[1] = (tgt << 8) | (bus << 15); - } else { + if (IS_24XX(isp)) { + isp_prt(isp, ISP_LOGWARN, "RESET DEV NOT IMPLETENTED"); + break; + } else if (IS_FC(isp)) { if (FCPARAM(isp)->isp_2klogin) { mbs.param[1] = tgt; mbs.ibits = (1 << 10); } else { mbs.param[1] = (tgt << 8); } + bus = 0; + } else { + bus = (*((int *) arg)) >> 16; + mbs.param[1] = (bus << 15) | (tgt << 8); } + mbs.param[0] = MBOX_ABORT_TARGET; mbs.param[2] = 3; /* 'delay', in seconds */ mbs.logval = MBLOGALL; isp_mboxcmd(isp, &mbs); @@ -4262,15 +4269,17 @@ case ISPCTL_ABORT_CMD: xs = (XS_T *) arg; tgt = XS_TGT(xs); + handle = isp_find_handle(isp, xs); if (handle == 0) { isp_prt(isp, ISP_LOGWARN, "cannot find handle for command to abort"); break; } - bus = XS_CHANNEL(xs); - mbs.param[0] = MBOX_ABORT; - if (IS_FC(isp)) { + if (IS_24XX(isp)) { + isp_prt(isp, ISP_LOGWARN, "ABORT CMD NOT IMPLETENTED"); + break; + } else if (IS_FC(isp)) { if (FCPARAM(isp)->isp_sccfw) { if (FCPARAM(isp)->isp_2klogin) { mbs.param[1] = tgt; @@ -4282,20 +4291,17 @@ mbs.param[1] = tgt << 8 | XS_LUN(xs); } } else { - mbs.param[1] = - (bus << 15) | (XS_TGT(xs) << 8) | XS_LUN(xs); + bus = XS_CHANNEL(xs); + mbs.param[1] = (bus << 15) | (tgt << 8) | XS_LUN(xs); } + mbs.param[0] = MBOX_ABORT; mbs.param[2] = handle; mbs.logval = MBLOGALL & ~MBOX_COMMAND_ERROR; isp_mboxcmd(isp, &mbs); - if (mbs.param[0] == MBOX_COMMAND_COMPLETE) { - return (0); + if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + break; } - /* - * XXX: Look for command in the REQUEST QUEUE. That is, - * XXX: It hasen't been picked up by firmware yet. - */ - break; + return (0); case ISPCTL_UPDATE_PARAMS: @@ -4336,7 +4342,7 @@ case ISPCTL_SEND_LIP: - if (IS_FC(isp)) { + if (IS_FC(isp) && !IS_24XX(isp)) { mbs.param[0] = MBOX_INIT_LIP; if (FCPARAM(isp)->isp_2klogin) { mbs.ibits = (1 << 10); ==== //depot/projects/newisp/dev/isp/isp_library.c#12 (text) ==== @@ -266,6 +266,7 @@ #define ISP_IS_SBUS(isp) \ (ISP_SBUS_SUPPORTED && (isp)->isp_bustype == ISP_BT_SBUS) +#define ASIZE(x) (sizeof (x) / sizeof (x[0])) /* * Swizzle/Copy Functions */ @@ -346,7 +347,7 @@ ISP_IOXPUT_16(isp, rqsrc->req_flags, &rqdst->req_flags); ISP_IOXPUT_16(isp, rqsrc->req_time, &rqdst->req_time); ISP_IOXPUT_16(isp, rqsrc->req_seg_count, &rqdst->req_seg_count); - for (i = 0; i < 12; i++) { + for (i = 0; i < ASIZE(rqsrc->req_cdb); i++) { ISP_IOXPUT_8(isp, rqsrc->req_cdb[i], &rqdst->req_cdb[i]); } for (i = 0; i < ISP_RQDSEG; i++) { @@ -373,7 +374,7 @@ ISP_IOXPUT_16(isp, src->mrk_modifier, &dst->mrk_modifier); ISP_IOXPUT_16(isp, src->mrk_flags, &dst->mrk_flags); ISP_IOXPUT_16(isp, src->mrk_lun, &dst->mrk_lun); - for (i = 0; i < 48; i++) { + for (i = 0; i < ASIZE(src->mrk_reserved1); i++) { ISP_IOXPUT_8(isp, src->mrk_reserved1[i], &dst->mrk_reserved1[i]); } @@ -392,10 +393,10 @@ ISP_IOXPUT_8(isp, src->mrk_reserved1, &dst->mrk_reserved1); ISP_IOXPUT_8(isp, src->mrk_vphdl, &dst->mrk_vphdl); ISP_IOXPUT_8(isp, src->mrk_reserved2, &dst->mrk_reserved2); - for (i = 0; i < 8; i++) { + for (i = 0; i < ASIZE(src->mrk_lun); i++) { ISP_IOXPUT_8(isp, src->mrk_lun[i], &dst->mrk_lun[i]); } - for (i = 0; i < 40; i++) { + for (i = 0; i < ASIZE(src->mrk_reserved3); i++) { ISP_IOXPUT_8(isp, src->mrk_reserved3[i], &dst->mrk_reserved3[i]); } @@ -414,7 +415,7 @@ ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved); ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); - for (i = 0; i < 16; i++) { + for (i = 0; i < ASIZE(src->req_cdb); i++) { ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); } ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt); @@ -438,7 +439,7 @@ ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved); ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); - for (i = 0; i < 16; i++) { + for (i = 0; i < ASIZE(src->req_cdb); i++) { ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); } ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt); @@ -463,7 +464,7 @@ ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved); ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); - for (i = 0; i < 16; i++) { + for (i = 0; i < ASIZE(src->req_cdb); i++) { ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); } ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt); @@ -489,7 +490,7 @@ ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved); ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); - for (i = 0; i < 16; i++) { + for (i = 0; i < ASIZE(src->req_cdb); i++) { ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); } ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt); @@ -520,7 +521,7 @@ ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags); ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); - for (i = 0; i < 44; i++) { + for (i = 0; i < ASIZE(src->req_cdb); i++) { ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); } } @@ -539,7 +540,7 @@ ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved); a = (uint32_t *) src->req_lun; b = (uint32_t *) dst->req_lun; - for (i = 0; i < 2; i++ ) { + for (i = 0; i < (ASIZE(src->req_lun) >> 2); i++ ) { ISP_IOZPUT_32(isp, *a++, b++); } ISP_IOXPUT_8(isp, src->req_alen_datadir, &dst->req_alen_datadir); @@ -548,7 +549,7 @@ ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn); a = (uint32_t *) src->req_cdb; b = (uint32_t *) dst->req_cdb; - for (i = 0; i < 4; i++ ) { + for (i = 0; i < (ASIZE(src->req_cdb) >> 2); i++ ) { ISP_IOZPUT_32(isp, *a++, b++); } ISP_IOXPUT_32(isp, src->req_dl, &dst->req_dl); @@ -564,6 +565,28 @@ } void +isp_put_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst) +{ + int i; + isp_put_hdr(isp, &src->abrt_header, &dst->abrt_header); + ISP_IOXPUT_32(isp, src->abrt_handle, &dst->abrt_handle); + ISP_IOXPUT_16(isp, src->abrt_nphdl, &dst->abrt_nphdl); + ISP_IOXPUT_16(isp, src->abrt_options, &dst->abrt_options); + ISP_IOXPUT_32(isp, src->abrt_cmd_handle, &dst->abrt_cmd_handle); + for (i = 0; i < ASIZE(src->abrt_reserved); i++) { + ISP_IOXPUT_8(isp, src->abrt_reserved[i], + &dst->abrt_reserved[i]); + } + ISP_IOXPUT_16(isp, src->abrt_tidlo, &dst->abrt_tidlo); + ISP_IOXPUT_8(isp, src->abrt_tidhi, &dst->abrt_tidhi); + ISP_IOXPUT_8(isp, src->abrt_vpidx, &dst->abrt_vpidx); + for (i = 0; i < ASIZE(src->abrt_reserved1); i++) { + ISP_IOXPUT_8(isp, src->abrt_reserved1[i], + &dst->abrt_reserved1[i]); + } +} + +void isp_put_cont_req(ispsoftc_t *isp, ispcontreq_t *src, ispcontreq_t *dst) { int i; @@ -640,6 +663,29 @@ } void +isp_get_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst) +{ + int i; + isp_get_hdr(isp, &src->abrt_header, &dst->abrt_header); + ISP_IOXGET_32(isp, &src->abrt_handle, dst->abrt_handle); + ISP_IOXGET_16(isp, &src->abrt_nphdl, dst->abrt_nphdl); + ISP_IOXGET_16(isp, &src->abrt_options, dst->abrt_options); + ISP_IOXGET_32(isp, &src->abrt_cmd_handle, dst->abrt_cmd_handle); + for (i = 0; i < ASIZE(&src->abrt_reserved); i++) { + ISP_IOXGET_8(isp, &src->abrt_reserved[i], + dst->abrt_reserved[i]); + } + ISP_IOXGET_16(isp, &src->abrt_tidlo, dst->abrt_tidlo); + ISP_IOXGET_8(isp, &src->abrt_tidhi, dst->abrt_tidhi); + ISP_IOXGET_8(isp, &src->abrt_vpidx, dst->abrt_vpidx); + for (i = 0; i < ASIZE(&src->abrt_reserved1); i++) { + ISP_IOXGET_8(isp, &src->abrt_reserved1[i], + dst->abrt_reserved1[i]); + } +} + + +void isp_get_rio2(ispsoftc_t *isp, isp_rio2_t *r2src, isp_rio2_t *r2dst) { int i; ==== //depot/projects/newisp/dev/isp/isp_library.h#9 (text) ==== @@ -62,6 +62,8 @@ extern void isp_put_request_t7(ispsoftc_t *, ispreqt7_t *, ispreqt7_t *); extern void +isp_put_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *); +extern void isp_put_cont_req(ispsoftc_t *, ispcontreq_t *, ispcontreq_t *); extern void isp_put_cont64_req(ispsoftc_t *, ispcontreq64_t *, ispcontreq64_t *); @@ -69,6 +71,8 @@ isp_get_response(ispsoftc_t *, ispstatusreq_t *, ispstatusreq_t *); extern void isp_get_24xx_response(ispsoftc_t *, isp24xx_statusreq_t *, isp24xx_statusreq_t *); +void +isp_get_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *); extern void isp_get_rio2(ispsoftc_t *, isp_rio2_t *, isp_rio2_t *); extern void ==== //depot/projects/newisp/dev/isp/ispmbox.h#11 (text+ko) ==== @@ -329,6 +329,7 @@ #define RQSTYPE_IP_RECV 0x23 #define RQSTYPE_IP_RECV_CONT 0x24 #define RQSTYPE_CT_PASSTHRU 0x29 +#define RQSTYPE_ABORT_IO 0x33 #define RQSTYPE_T6RQS 0x48 #define RQSTYPE_LOGIN 0x52 #define RQSTYPE_ABTS_RCVD 0x54 /* 24XX only */ @@ -530,6 +531,22 @@ ispds64_t req_dataseg; } ispreqt7_t; +/* I/O Abort Structure */ +typedef struct { + isphdr_t abrt_header; + uint32_t abrt_handle; + uint16_t abrt_nphdl; + uint16_t abrt_options; + uint32_t abrt_cmd_handle; + uint8_t abrt_reserved[32]; + uint16_t abrt_tidlo; + uint8_t abrt_tidhi; + uint8_t abrt_vpidx; + uint8_t abrt_reserved1[12]; +} isp24xx_abrt_t; +#define ISP24XX_ABRT_NO_ABTS 0x01 /* don't actually send an ABTS */ +#define ISP24XX_ABRT_ENXIO 0x31 /* in nphdl on return */ + #define ISP_CDSEG 7 typedef struct { isphdr_t req_header;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610192301.k9JN1K7u058004>