diff options
author | mav <mav@FreeBSD.org> | 2015-12-30 11:50:52 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-12-30 11:50:52 +0000 |
commit | 27a8f09a1b080c3913553e9a747a1e1b1ddde85b (patch) | |
tree | 2b8fe844c062d94796c02bf3c91f051d9bc3cec9 /sys/dev/isp/isp_library.c | |
parent | a4b1c16e98e75f90d54e9dbd7a1fdb698da68539 (diff) | |
download | FreeBSD-src-27a8f09a1b080c3913553e9a747a1e1b1ddde85b.zip FreeBSD-src-27a8f09a1b080c3913553e9a747a1e1b1ddde85b.tar.gz |
MFC r292739: Make virtual ports control asynchronous.
Before this change virtual ports control IOCBs were executed synchronously
via Execute IOCB mailbox command. It required exclusive use of scratch
space of driver and mailbox registers of the hardware. Because of that
shared resources use this code could not really sleep, having to spin for
completion, blocking any other operation.
This change introduces new asynchronous design, sending the IOCBs directly
on request queue and gracefully waiting for their return on response queue.
Returned IOCBs are identified with unified handle space from r292725.
Diffstat (limited to 'sys/dev/isp/isp_library.c')
-rw-r--r-- | sys/dev/isp/isp_library.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/isp/isp_library.c b/sys/dev/isp/isp_library.c index 76890dc..78c7f6f 100644 --- a/sys/dev/isp/isp_library.c +++ b/sys/dev/isp/isp_library.c @@ -572,7 +572,8 @@ isp_clear_commands(ispsoftc_t *isp) for (tmp = 0; isp->isp_xflist && tmp < isp->isp_maxcmds; tmp++) { hdp = &isp->isp_xflist[tmp]; - if (ISP_H2HT(hdp->handle) == ISP_HANDLE_INITIATOR) { + switch (ISP_H2HT(hdp->handle)) { + case ISP_HANDLE_INITIATOR: { XS_T *xs = hdp->cmd; if (XS_XFRLEN(xs)) { ISP_DMAFREE(isp, xs, hdp->handle); @@ -580,12 +581,13 @@ isp_clear_commands(ispsoftc_t *isp) } else { XS_SET_RESID(xs, 0); } - hdp->handle = 0; - hdp->cmd = NULL; + isp_destroy_handle(isp, hdp->handle); XS_SETERR(xs, HBA_BUSRESET); isp_done(xs); + break; + } #ifdef ISP_TARGET_MODE - } else if (ISP_H2HT(hdp->handle) == ISP_HANDLE_TARGET) { + case ISP_HANDLE_TARGET: { uint8_t local[QENTRY_LEN]; ISP_DMAFREE(isp, hdp->cmd, hdp->handle); ISP_MEMZERO(local, QENTRY_LEN); @@ -601,7 +603,13 @@ isp_clear_commands(ispsoftc_t *isp) ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO2; } isp_async(isp, ISPASYNC_TARGET_ACTION, local); + break; + } #endif + case ISP_HANDLE_CTRL: + wakeup(hdp->cmd); + isp_destroy_handle(isp, hdp->handle); + break; } } #ifdef ISP_TARGET_MODE |