summaryrefslogtreecommitdiffstats
path: root/share/examples
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2012-06-26 14:51:35 +0000
committerken <ken@FreeBSD.org>2012-06-26 14:51:35 +0000
commit877f7e22dc80676c9ece47bf58c4a6bdc79be4c7 (patch)
tree7b016bc8afd686b682aaffe21bfcace67afaf0e7 /share/examples
parent4183957bce956b38c2e2189a30e2a92d9dc592af (diff)
downloadFreeBSD-src-877f7e22dc80676c9ece47bf58c4a6bdc79be4c7.zip
FreeBSD-src-877f7e22dc80676c9ece47bf58c4a6bdc79be4c7.tar.gz
Fix an issue that caused the kernel to panic inside CTL when trying
to attach to target capable HBAs that implement the old immediate notify (XPT_IMMED_NOTIFY) and notify acknowledge (XPT_NOTIFY_ACK) CCBs. The new API has been in place since SVN change 196008 in 2009. The solution is two-fold: fix CTL to handle the responses from the HBAs, and convert the HBA drivers in question to use the new API. These drivers have not been tested with CTL, so how well they will interoperate with CTL is unknown. scsi_target.c: Update the userland target example code to use the new immediate notify API. scsi_ctl.c: Detect when an immediate notify CCB is returned with CAM_REQ_INVALID or CAM_PROVIDE_FAIL status, and just free it. Fix a duplicate assignment. aic79xx.c, aic79xx_osm.c: Update the aic79xx driver to use the new API. Target mode is not enabled on for this driver, so the changes will have no practical effect. aic7xxx.c, aic7xxx_osm.c: Update the aic7xxx driver to use the new API. sbp_targ.c: Update the firewire target code to work with the new API. mpt_cam.c: Update the mpt(4) driver to work with the new API. Target mode is only enabled for Fibre Channel mpt(4) devices. MFC after: 3 days
Diffstat (limited to 'share/examples')
-rw-r--r--share/examples/scsi_target/scsi_target.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/share/examples/scsi_target/scsi_target.c b/share/examples/scsi_target/scsi_target.c
index 6f665af..1a7a061 100644
--- a/share/examples/scsi_target/scsi_target.c
+++ b/share/examples/scsi_target/scsi_target.c
@@ -88,7 +88,7 @@ static void handle_read(void);
/* static int work_atio(struct ccb_accept_tio *); */
static void queue_io(struct ccb_scsiio *);
static int run_queue(struct ccb_accept_tio *);
-static int work_inot(struct ccb_immed_notify *);
+static int work_inot(struct ccb_immediate_notify *);
static struct ccb_scsiio *
get_ctio(void);
/* static void free_ccb(union ccb *); */
@@ -387,7 +387,7 @@ init_ccbs()
warn("malloc INOT");
return (-1);
}
- inot->ccb_h.func_code = XPT_IMMED_NOTIFY;
+ inot->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY;
send_ccb((union ccb *)inot, /*priority*/1);
}
@@ -495,8 +495,8 @@ request_loop()
/* Start one more transfer. */
retval = work_atio(&ccb->atio);
break;
- case XPT_IMMED_NOTIFY:
- retval = work_inot(&ccb->cin);
+ case XPT_IMMEDIATE_NOTIFY:
+ retval = work_inot(&ccb->cin1);
break;
default:
warnx("Unhandled ccb type %#x on workq",
@@ -651,7 +651,7 @@ work_atio(struct ccb_accept_tio *atio)
warnx("ATIO with %u bytes sense received",
atio->sense_len);
}
- sense = &atio->sense_data;
+ sense = (struct scsi_sense_data_fixed *)&atio->sense_data;
tcmd_sense(ctio->init_id, ctio, sense->flags,
sense->add_sense_code, sense->add_sense_code_qual);
send_ccb((union ccb *)ctio, /*priority*/1);
@@ -772,16 +772,14 @@ run_queue(struct ccb_accept_tio *atio)
}
static int
-work_inot(struct ccb_immed_notify *inot)
+work_inot(struct ccb_immediate_notify *inot)
{
cam_status status;
- int sense;
if (debug)
warnx("Working on INOT %p", inot);
status = inot->ccb_h.status;
- sense = (status & CAM_AUTOSNS_VALID) != 0;
status &= CAM_STATUS_MASK;
switch (status) {
@@ -794,7 +792,7 @@ work_inot(struct ccb_immed_notify *inot)
abort_all_pending();
break;
case CAM_MESSAGE_RECV:
- switch (inot->message_args[0]) {
+ switch (inot->arg) {
case MSG_TASK_COMPLETE:
case MSG_INITIATOR_DET_ERR:
case MSG_ABORT_TASK_SET:
@@ -805,7 +803,7 @@ work_inot(struct ccb_immed_notify *inot)
case MSG_ABORT_TASK:
case MSG_CLEAR_TASK_SET:
default:
- warnx("INOT message %#x", inot->message_args[0]);
+ warnx("INOT message %#x", inot->arg);
break;
}
break;
@@ -817,17 +815,6 @@ work_inot(struct ccb_immed_notify *inot)
break;
}
- /* If there is sense data, use it */
- if (sense != 0) {
- struct scsi_sense_data_fixed *sense;
-
- sense = (struct scsi_sense_data_fixed *)&inot->sense_data;
- tcmd_sense(inot->initiator_id, NULL, sense->flags,
- sense->add_sense_code, sense->add_sense_code_qual);
- if (debug)
- warnx("INOT has sense: %#x", sense->flags);
- }
-
/* Requeue on SIM */
TAILQ_REMOVE(&work_queue, &inot->ccb_h, periph_links.tqe);
send_ccb((union ccb *)inot, /*priority*/1);
OpenPOWER on IntegriCloud