Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Oct 2009 12:50:21 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 169389 for review
Message-ID:  <200910111250.n9BCoLUt025246@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=169389

Change 169389 by mav@mav_mavtest on 2009/10/11 12:49:46

	Add ATA-specific done handler, resetting bus on heavy errors.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#39 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#39 (text+ko) ====

@@ -179,11 +179,12 @@
 				struct cam_ed *device,
 				void *async_arg);
 static void	 ata_action(union ccb *start_ccb);
+static void	 ata_done(union ccb *done_ccb);
 
 static struct xpt_xport ata_xport = {
 	.alloc_device = ata_alloc_device,
 	.action = ata_action,
-	.done = xpt_done_default,
+	.done = ata_done,
 	.async = ata_dev_async,
 };
 
@@ -1244,6 +1245,36 @@
 }
 
 static void
+ata_done(union ccb *done_ccb)
+{
+	struct	cam_path *path;
+	union	ccb *work_ccb;
+
+	switch (done_ccb->ccb_h.status & CAM_STATUS_MASK) {
+	case CAM_CMD_TIMEOUT:
+	case CAM_UNCOR_PARITY:
+		work_ccb = xpt_alloc_ccb_nowait();
+		if (work_ccb == NULL)
+			break;
+		if (xpt_create_path(&path, xpt_periph, done_ccb->ccb_h.path_id,
+		    CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+			xpt_free_ccb(work_ccb);
+			break;
+		}
+		xpt_setup_ccb(&work_ccb->ccb_h, path, CAM_PRIORITY_NORMAL);
+		work_ccb->ccb_h.func_code = XPT_RESET_BUS;
+		work_ccb->ccb_h.cbfcnp = NULL;
+		CAM_DEBUG(path, CAM_DEBUG_SUBTRACE, ("Resetting Bus\n"));
+		xpt_action(work_ccb);
+		xpt_free_ccb(work_ccb);
+		break;
+	}	
+	
+	/* Call default done handler. */
+	xpt_done_default(done_ccb);
+}
+
+static void
 scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device,
 			   int async_update)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910111250.n9BCoLUt025246>