PERFORCE change 169517 for review
Alexander Motin
mav at FreeBSD.org
Thu Oct 15 13:42:31 UTC 2009
http://p4web.freebsd.org/chv.cgi?CH=169517
Change 169517 by mav at mav_mavtest on 2009/10/15 13:41:46
Make PMP to freeze child devices while resetting/scanning.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#8 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#8 (text+ko) ====
@@ -93,6 +93,7 @@
int pm_step;
int pm_try;
int found;
+ int frozen;
union ccb saved_ccb;
struct task sysctl_task;
struct sysctl_ctx_list sysctl_ctx;
@@ -158,6 +159,49 @@
}
static void
+pmpfreeze(struct cam_periph *periph, int mask)
+{
+ struct pmp_softc *softc = (struct pmp_softc *)periph->softc;
+ struct cam_path *dpath;
+ int i;
+
+ for (i = 0; i < 15; i++) {
+ if ((mask & (1 << i)) == 0)
+ continue;
+ if (xpt_create_path(&dpath, periph,
+ xpt_path_path_id(periph->path),
+ i, 0) == CAM_REQ_CMP) {
+printf("PMP freeze: %d\n", i);
+ softc->frozen |= (1 << i);
+ cam_freeze_devq(dpath);
+ xpt_free_path(dpath);
+ }
+ }
+}
+
+static void
+pmprelease(struct cam_periph *periph, int mask)
+{
+ struct pmp_softc *softc = (struct pmp_softc *)periph->softc;
+ struct cam_path *dpath;
+ int i;
+
+ mask &= softc->frozen;
+ for (i = 0; i < 15; i++) {
+ if ((mask & (1 << i)) == 0)
+ continue;
+ if (xpt_create_path(&dpath, periph,
+ xpt_path_path_id(periph->path),
+ i, 0) == CAM_REQ_CMP) {
+printf("PMP release: %d\n", i);
+ softc->frozen &= ~(1 << i);
+ cam_release_devq(dpath, 0, 0, 0, FALSE);
+ xpt_free_path(dpath);
+ }
+ }
+}
+
+static void
pmponinvalidate(struct cam_periph *periph)
{
struct pmp_softc *softc;
@@ -249,6 +293,7 @@
cam_periph_async(periph, code, path, arg);
if (softc->state != PMP_STATE_NORMAL)
break;
+ pmpfreeze(periph, softc->found);
if (code == AC_SENT_BDR || code == AC_BUS_RESET)
softc->found = 0; /* We have to reset everything. */
softc->state = PMP_STATE_PORTS;
@@ -677,11 +722,13 @@
work_ccb->ccb_h.ppriv_ptr0 = done_ccb;
work_ccb->crcn.flags = done_ccb->crcn.flags;
xpt_action(work_ccb);
+ pmprelease(periph, 1 << softc->pm_step);
return;
default:
break;
}
softc->state = PMP_STATE_NORMAL;
+ pmprelease(periph, -1);
cam_periph_release_locked(periph);
}
More information about the p4-projects
mailing list