diff options
author | mav <mav@FreeBSD.org> | 2015-11-13 19:23:22 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-11-13 19:23:22 +0000 |
commit | 800769b3180e3137c36d2185a689835c2b4dfd28 (patch) | |
tree | eaa968cd8b3e2975bb72f0ced4a5cb2fb6701eb6 /sys | |
parent | 8daf7a11eb8011162714afbbdc363b7c232854a7 (diff) | |
download | FreeBSD-src-800769b3180e3137c36d2185a689835c2b4dfd28.zip FreeBSD-src-800769b3180e3137c36d2185a689835c2b4dfd28.tar.gz |
MFC r289843: Add partial support for QUERY TMF to CAM and isp(4).
This change allows to decode respective functions in isp(4) in target mode
and pass them through CAM to CTL. Unfortunately neither CAM nor isp(4)
support returning response info for those task management functions now.
On the other side I just have no initiator to test this functionality.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cam/ctl/scsi_ctl.c | 23 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_message.h | 6 | ||||
-rw-r--r-- | sys/dev/isp/isp_freebsd.c | 8 | ||||
-rw-r--r-- | sys/dev/isp/isp_stds.h | 2 | ||||
-rw-r--r-- | sys/dev/isp/isp_target.c | 8 | ||||
-rw-r--r-- | sys/dev/isp/isp_target.h | 4 |
6 files changed, 41 insertions, 10 deletions
diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 27c5ad7..85a341e 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1459,24 +1459,31 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) CTL_TASK_ABORT_TASK_SET; break; case MSG_TARGET_RESET: - io->taskio.task_action = - CTL_TASK_TARGET_RESET; + io->taskio.task_action = CTL_TASK_TARGET_RESET; break; case MSG_ABORT_TASK: - io->taskio.task_action = - CTL_TASK_ABORT_TASK; + io->taskio.task_action = CTL_TASK_ABORT_TASK; break; case MSG_LOGICAL_UNIT_RESET: - io->taskio.task_action = - CTL_TASK_LUN_RESET; + io->taskio.task_action = CTL_TASK_LUN_RESET; break; case MSG_CLEAR_TASK_SET: io->taskio.task_action = - CTL_TASK_CLEAR_TASK_SET; + CTL_TASK_CLEAR_TASK_SET; break; case MSG_CLEAR_ACA: + io->taskio.task_action = CTL_TASK_CLEAR_ACA; + break; + case MSG_QUERY_TASK: + io->taskio.task_action = CTL_TASK_QUERY_TASK; + break; + case MSG_QUERY_TASK_SET: + io->taskio.task_action = + CTL_TASK_QUERY_TASK_SET; + break; + case MSG_QUERY_ASYNC_EVENT: io->taskio.task_action = - CTL_TASK_CLEAR_ACA; + CTL_TASK_QUERY_ASYNC_EVENT; break; case MSG_NOOP: send_ctl_io = 0; diff --git a/sys/cam/scsi/scsi_message.h b/sys/cam/scsi/scsi_message.h index 53b7640..ddac571 100644 --- a/sys/cam/scsi/scsi_message.h +++ b/sys/cam/scsi/scsi_message.h @@ -68,3 +68,9 @@ #define MSG_EXT_PPR_QAS_REQ 0x04 #define MSG_EXT_PPR_DT_REQ 0x02 #define MSG_EXT_PPR_IU_REQ 0x01 + +/* Fake messages not defined for SPI, but needed for other transports */ +#define MSG_QUERY_TASK 0x100 +#define MSG_QUERY_TASK_SET 0x101 +#define MSG_QUERY_ASYNC_EVENT 0x102 + diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index 1ff64e1..8e9f417c 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -3479,6 +3479,12 @@ isp_handle_platform_target_tmf(ispsoftc_t *isp, isp_notify_t *notify) case NT_TARGET_RESET: inot->arg = MSG_TARGET_RESET; break; + case NT_QUERY_TASK_SET: + inot->arg = MSG_QUERY_TASK_SET; + break; + case NT_QUERY_ASYNC_EVENT: + inot->arg = MSG_QUERY_ASYNC_EVENT; + break; default: isp_prt(isp, ISP_LOGWARN, "%s: unknown TMF code 0x%x for chan %d lun 0x%x", __func__, notify->nt_ncode, notify->nt_channel, lun); goto bad; @@ -5883,6 +5889,8 @@ changed: case NT_CLEAR_TASK_SET: case NT_LUN_RESET: case NT_TARGET_RESET: + case NT_QUERY_TASK_SET: + case NT_QUERY_ASYNC_EVENT: /* * These are task management functions. */ diff --git a/sys/dev/isp/isp_stds.h b/sys/dev/isp/isp_stds.h index e53f005..daa199c 100644 --- a/sys/dev/isp/isp_stds.h +++ b/sys/dev/isp/isp_stds.h @@ -97,8 +97,10 @@ typedef struct { #define FCP_CMND_TMF_CLEAR_ACA 0x40 #define FCP_CMND_TMF_TGT_RESET 0x20 #define FCP_CMND_TMF_LUN_RESET 0x10 +#define FCP_CMND_TMF_QUERY_ASYNC_EVENT 0x08 #define FCP_CMND_TMF_CLEAR_TASK_SET 0x04 #define FCP_CMND_TMF_ABORT_TASK_SET 0x02 +#define FCP_CMND_TMF_QUERY_TASK_SET 0x01 /* * Basic CT IU Header diff --git a/sys/dev/isp/isp_target.c b/sys/dev/isp/isp_target.c index aa34622..7e4c600 100644 --- a/sys/dev/isp/isp_target.c +++ b/sys/dev/isp/isp_target.c @@ -1024,12 +1024,18 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep) notify.nt_sid = sid; notify.nt_did = did; notify.nt_channel = chan; - if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_ABORT_TASK_SET) { + if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_QUERY_TASK_SET) { + isp_prt(isp, ISP_LOGINFO, f1, "QUERY TASK SET", sid, notify.nt_lun, aep->at_rxid); + notify.nt_ncode = NT_QUERY_TASK_SET; + } else if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_ABORT_TASK_SET) { isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK SET", sid, notify.nt_lun, aep->at_rxid); notify.nt_ncode = NT_ABORT_TASK_SET; } else if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_CLEAR_TASK_SET) { isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET", sid, notify.nt_lun, aep->at_rxid); notify.nt_ncode = NT_CLEAR_TASK_SET; + } else if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_QUERY_ASYNC_EVENT) { + isp_prt(isp, ISP_LOGINFO, f1, "QUERY ASYNC EVENT", sid, notify.nt_lun, aep->at_rxid); + notify.nt_ncode = NT_QUERY_ASYNC_EVENT; } else if (aep->at_cmnd.fcp_cmnd_task_management & FCP_CMND_TMF_LUN_RESET) { isp_prt(isp, ISP_LOGINFO, f1, "LUN RESET", sid, notify.nt_lun, aep->at_rxid); notify.nt_ncode = NT_LUN_RESET; diff --git a/sys/dev/isp/isp_target.h b/sys/dev/isp/isp_target.h index 8922a33..a75d73b 100644 --- a/sys/dev/isp/isp_target.h +++ b/sys/dev/isp/isp_target.h @@ -51,7 +51,9 @@ typedef enum { NT_LOGOUT, NT_GLOBAL_LOGOUT, NT_CHANGED, - NT_HBA_RESET + NT_HBA_RESET, + NT_QUERY_TASK_SET, + NT_QUERY_ASYNC_EVENT } isp_ncode_t; typedef struct isp_notify { |