PERFORCE change 169793 for review

Alexander Motin mav at FreeBSD.org
Sun Oct 25 11:45:05 UTC 2009


http://p4web.freebsd.org/chv.cgi?CH=169793

Change 169793 by mav at mav_mavtest on 2009/10/25 11:44:40

	Replace DELAY() with device freezing to not spent 1s in a loop.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#14 edit

Differences ...

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

@@ -578,7 +578,12 @@
 		softc->pm_step++;
 		if (softc->pm_step >= softc->pm_ports) {
 			softc->pm_step = 0;
-			DELAY(5000);
+			cam_freeze_devq(periph->path);
+			cam_release_devq(periph->path,
+			    RELSIM_RELEASE_AFTER_TIMEOUT,
+			    /*reduction*/0,
+			    /*timeout*/5,
+			    /*getcount_only*/0);
 			printf("PM reset done\n");
 			softc->state = PMP_STATE_CONNECT;
 		}
@@ -607,7 +612,12 @@
 			softc->pm_step++;
 		} else {
 			if (softc->pm_try < 100) {
-				DELAY(10000);
+				cam_freeze_devq(periph->path);
+				cam_release_devq(periph->path,
+				    RELSIM_RELEASE_AFTER_TIMEOUT,
+				    /*reduction*/0,
+				    /*timeout*/10,
+				    /*getcount_only*/0);
 				softc->pm_try++;
 			} else {
 				printf("PM status: %d - %08x\n", softc->pm_step, res);
@@ -621,18 +631,13 @@
 				softc->pm_step++;
 			}
 		}
-		if (softc->pm_step < softc->pm_ports) {
-			xpt_release_ccb(done_ccb);
-			xpt_schedule(periph, priority);
-			return;
-		} else {
+		if (softc->pm_step >= softc->pm_ports) {
+			softc->state = PMP_STATE_CLEAR;
 			softc->pm_step = 0;
-			softc->state = PMP_STATE_CLEAR;
-			xpt_release_ccb(done_ccb);
-			xpt_schedule(periph, priority);
-			return;
 		}
-		break;
+		xpt_release_ccb(done_ccb);
+		xpt_schedule(periph, priority);
+		return;
 	case PMP_STATE_CLEAR:
 		softc->pm_step++;
 		if (softc->pm_step < softc->pm_ports) {


More information about the p4-projects mailing list