Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jan 2010 13:00:33 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r202616 - in stable/8/sys: cam/ata dev/ata
Message-ID:  <201001191300.o0JD0X0q095493@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Jan 19 13:00:33 2010
New Revision: 202616
URL: http://svn.freebsd.org/changeset/base/202616

Log:
  MFC r201990:
  - Report SATA in legacy emulation mode still as SATA.
  - Make ATA XPT able to handle such case.

Modified:
  stable/8/sys/cam/ata/ata_xpt.c
  stable/8/sys/dev/ata/ata-all.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/cam/ata/ata_xpt.c
==============================================================================
--- stable/8/sys/cam/ata/ata_xpt.c	Tue Jan 19 12:58:29 2010	(r202615)
+++ stable/8/sys/cam/ata/ata_xpt.c	Tue Jan 19 13:00:33 2010	(r202616)
@@ -1001,7 +1001,6 @@ typedef struct {
 	union	ccb *request_ccb;
 	struct 	ccb_pathinq *cpi;
 	int	counter;
-	int	found;
 } ata_scan_bus_info;
 
 /*
@@ -1049,14 +1048,11 @@ ata_scan_bus(struct cam_periph *periph, 
 		}
 		scan_info->request_ccb = request_ccb;
 		scan_info->cpi = &work_ccb->cpi;
-		if (scan_info->cpi->transport == XPORT_ATA)
-			scan_info->found = 0x0003;
-		else
-			scan_info->found = 0x8001;
-		scan_info->counter = 0;
 		/* If PM supported, probe it first. */
 		if (scan_info->cpi->hba_inquiry & PI_SATAPM)
-			scan_info->counter = 15;
+			scan_info->counter = scan_info->cpi->max_target;
+		else
+			scan_info->counter = 0;
 
 		work_ccb = xpt_alloc_ccb_nowait();
 		if (work_ccb == NULL) {
@@ -1073,10 +1069,11 @@ ata_scan_bus(struct cam_periph *periph, 
 		/* Free the current request path- we're done with it. */
 		xpt_free_path(work_ccb->ccb_h.path);
 		/* If there is PMP... */
-		if (scan_info->counter == 15) {
+		if ((scan_info->cpi->hba_inquiry & PI_SATAPM) &&
+		    (scan_info->counter == scan_info->cpi->max_target)) {
 			if (work_ccb->ccb_h.ppriv_field1 != 0) {
 				/* everything else willbe probed by it */
-				scan_info->found = 0x8000;
+				goto done;
 			} else {
 				struct ccb_trans_settings cts;
 
@@ -1091,11 +1088,10 @@ ata_scan_bus(struct cam_periph *periph, 
 				xpt_action((union ccb *)&cts);
 			}
 		}
-take_next:
-		/* Take next device. Wrap from 15 (PM) to 0. */
-		scan_info->counter = (scan_info->counter + 1 ) & 0x0f;
-		if (scan_info->counter > scan_info->cpi->max_target -
-		    ((scan_info->cpi->hba_inquiry & PI_SATAPM) ? 1 : 0)) {
+		if (scan_info->counter ==
+		    ((scan_info->cpi->hba_inquiry & PI_SATAPM) ?
+		    0 : scan_info->cpi->max_target)) {
+done:
 			xpt_free_ccb(work_ccb);
 			xpt_free_ccb((union ccb *)scan_info->cpi);
 			request_ccb = scan_info->request_ccb;
@@ -1104,9 +1100,10 @@ take_next:
 			xpt_done(request_ccb);
 			break;
 		}
+		/* Take next device. Wrap from max (PMP) to 0. */
+		scan_info->counter = (scan_info->counter + 1 ) %
+		    (scan_info->cpi->max_target + 1);
 scan_next:
-		if ((scan_info->found & (1 << scan_info->counter)) == 0)
-			goto take_next;
 		status = xpt_create_path(&path, xpt_periph,
 		    scan_info->request_ccb->ccb_h.path_id,
 		    scan_info->counter, 0);

Modified: stable/8/sys/dev/ata/ata-all.c
==============================================================================
--- stable/8/sys/dev/ata/ata-all.c	Tue Jan 19 12:58:29 2010	(r202615)
+++ stable/8/sys/dev/ata/ata-all.c	Tue Jan 19 13:00:33 2010	(r202616)
@@ -1473,7 +1473,7 @@ ataaction(struct cam_sim *sim, union ccb
 			d = &ch->curr[ccb->ccb_h.target_id];
 		else
 			d = &ch->user[ccb->ccb_h.target_id];
-		if ((ch->flags & ATA_SATA) && (ch->flags & ATA_NO_SLAVE)) {
+		if (ch->flags & ATA_SATA) {
 			if (cts->xport_specific.sata.valid & CTS_SATA_VALID_REVISION)
 				d->revision = cts->xport_specific.sata.revision;
 			if (cts->xport_specific.ata.valid & CTS_SATA_VALID_MODE) {
@@ -1497,8 +1497,6 @@ ataaction(struct cam_sim *sim, union ccb
 			}
 			if (cts->xport_specific.ata.valid & CTS_ATA_VALID_BYTECOUNT)
 				d->bytecount = cts->xport_specific.ata.bytecount;
-			if (ch->flags & ATA_SATA)
-				d->bytecount = min(8192, d->bytecount);
 		}
 		ccb->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);
@@ -1515,7 +1513,7 @@ ataaction(struct cam_sim *sim, union ccb
 			d = &ch->user[ccb->ccb_h.target_id];
 		cts->protocol = PROTO_ATA;
 		cts->protocol_version = PROTO_VERSION_UNSPECIFIED;
-		if ((ch->flags & ATA_SATA) && (ch->flags & ATA_NO_SLAVE)) {
+		if (ch->flags & ATA_SATA) {
 			cts->transport = XPORT_SATA;
 			cts->transport_version = XPORT_VERSION_UNSPECIFIED;
 			cts->xport_specific.sata.mode = d->mode;
@@ -1604,7 +1602,7 @@ ataaction(struct cam_sim *sim, union ccb
 		strncpy(cpi->hba_vid, "ATA", HBA_IDLEN);
 		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
-		if ((ch->flags & ATA_SATA) && (ch->flags & ATA_NO_SLAVE))
+		if (ch->flags & ATA_SATA)
 			cpi->transport = XPORT_SATA;
 		else
 			cpi->transport = XPORT_ATA;



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