Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Dec 2009 03:52:39 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 171636 for review
Message-ID:  <200912110352.nBB3qdKC009883@repoman.freebsd.org>

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

Change 171636 by mav@mav_mavtest on 2009/12/11 03:52:21

	Make PMP driber honot user-configured SATA revision.

Affected files ...

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

Differences ...

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

@@ -416,8 +416,11 @@
 static void
 pmpstart(struct cam_periph *periph, union ccb *start_ccb)
 {
+	struct ccb_trans_settings cts;
 	struct ccb_ataio *ataio;
 	struct pmp_softc *softc;
+	struct cam_path *dpath;
+	int revision = 0;
 
 	softc = (struct pmp_softc *)periph->softc;
 	ataio = &start_ccb->ataio;
@@ -426,7 +429,22 @@
 		softc->restart = 0;
 		softc->state = PMP_STATE_PORTS;
 	}
-
+	/* Fetch user wanted device speed. */
+	if (softc->state == PMP_STATE_RESET ||
+	    softc->state == PMP_STATE_CONNECT) {
+		if (xpt_create_path(&dpath, periph,
+		    xpt_path_path_id(periph->path),
+		    softc->pm_step, 0) == CAM_REQ_CMP) {
+			bzero(&cts, sizeof(cts));
+			xpt_setup_ccb(&cts.ccb_h, dpath, CAM_PRIORITY_NORMAL);
+			cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
+			cts.type = CTS_TYPE_USER_SETTINGS;
+			xpt_action((union ccb *)&cts);
+			if (cts.xport_specific.sata.valid & CTS_SATA_VALID_REVISION)
+				revision = cts.xport_specific.sata.revision;
+			xpt_free_path(dpath);
+		}
+	}
 	switch (softc->state) {
 	case PMP_STATE_PORTS:
 		cam_fill_ataio(ataio,
@@ -460,7 +478,8 @@
 		      /*dxfer_len*/0,
 		      pmp_default_timeout * 1000);
 		ata_pm_write_cmd(ataio, 2, softc->pm_step,
-		    (softc->found & (1 << softc->pm_step)) ? 0 : 1);
+		    (revision << 4) |
+		    ((softc->found & (1 << softc->pm_step)) ? 0 : 1));
 		break;
 	case PMP_STATE_CONNECT:
 		cam_fill_ataio(ataio,
@@ -471,7 +490,8 @@
 		      /*data_ptr*/NULL,
 		      /*dxfer_len*/0,
 		      pmp_default_timeout * 1000);
-		ata_pm_write_cmd(ataio, 2, softc->pm_step, 0);
+		ata_pm_write_cmd(ataio, 2, softc->pm_step,
+		    (revision << 4));
 		break;
 	case PMP_STATE_CHECK:
 		cam_fill_ataio(ataio,



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