Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Feb 2010 10:45:41 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r204195 - in head: sbin/atacontrol sbin/camcontrol sys/cam sys/dev/ata
Message-ID:  <201002221045.o1MAjfTf020472@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Feb 22 10:45:40 2010
New Revision: 204195
URL: http://svn.freebsd.org/changeset/base/204195

Log:
  Improve output for controllers that doesn't report SATA speed.

Modified:
  head/sbin/atacontrol/atacontrol.c
  head/sbin/camcontrol/camcontrol.c
  head/sys/cam/cam_xpt.c
  head/sys/dev/ata/ata-all.c
  head/sys/dev/ata/ata-pci.c
  head/sys/dev/ata/ata-sata.c

Modified: head/sbin/atacontrol/atacontrol.c
==============================================================================
--- head/sbin/atacontrol/atacontrol.c	Mon Feb 22 07:50:17 2010	(r204194)
+++ head/sbin/atacontrol/atacontrol.c	Mon Feb 22 10:45:40 2010	(r204195)
@@ -72,6 +72,7 @@ satarev2str(int mode)
 	case 1: return "SATA 1.5Gb/s";
 	case 2: return "SATA 3Gb/s";
 	case 3: return "SATA 6Gb/s";
+	case 0xff: return "SATA";
 	default: return "???";
 	}
 }

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Mon Feb 22 07:50:17 2010	(r204194)
+++ head/sbin/camcontrol/camcontrol.c	Mon Feb 22 10:45:40 2010	(r204195)
@@ -1022,6 +1022,8 @@ camxferrate(struct cam_device *device)
 		printf(" (");
 		if (sata->valid & CTS_SATA_VALID_REVISION)
 			printf("SATA %d.x, ", sata->revision);
+		else
+			printf("SATA, ");
 		if (sata->valid & CTS_SATA_VALID_MODE)
 			printf("%s, ", ata_mode2string(sata->mode));
 		if ((sata->valid & CTS_SATA_VALID_ATAPI) && sata->atapi != 0)

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Mon Feb 22 07:50:17 2010	(r204194)
+++ head/sys/cam/cam_xpt.c	Mon Feb 22 10:45:40 2010	(r204195)
@@ -1219,6 +1219,8 @@ xpt_announce_periph(struct cam_periph *p
 		printf(" (");
 		if (sata->valid & CTS_SATA_VALID_REVISION)
 			printf("SATA %d.x, ", sata->revision);
+		else
+			printf("SATA, ");
 		if (sata->valid & CTS_SATA_VALID_MODE)
 			printf("%s, ", ata_mode2string(sata->mode));
 		if ((sata->valid & CTS_ATA_VALID_ATAPI) && sata->atapi != 0)

Modified: head/sys/dev/ata/ata-all.c
==============================================================================
--- head/sys/dev/ata/ata-all.c	Mon Feb 22 07:50:17 2010	(r204194)
+++ head/sys/dev/ata/ata-all.c	Mon Feb 22 10:45:40 2010	(r204195)
@@ -1160,6 +1160,7 @@ ata_satarev2str(int rev)
 	case 1: return "SATA 1.5Gb/s";
 	case 2: return "SATA 3Gb/s";
 	case 3: return "SATA 6Gb/s";
+	case 0xff: return "SATA";
 	default: return "???";
 	}
 }
@@ -1536,6 +1537,7 @@ ataaction(struct cam_sim *sim, union ccb
 		if (ch->flags & ATA_SATA) {
 			cts->transport = XPORT_SATA;
 			cts->transport_version = XPORT_VERSION_UNSPECIFIED;
+			cts->xport_specific.sata.valid = 0;
 			cts->xport_specific.sata.mode = d->mode;
 			cts->xport_specific.sata.valid |= CTS_SATA_VALID_MODE;
 			cts->xport_specific.sata.bytecount = d->bytecount;
@@ -1543,14 +1545,20 @@ ataaction(struct cam_sim *sim, union ccb
 			if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
 				cts->xport_specific.sata.revision =
 				    ATA_GETREV(dev, ccb->ccb_h.target_id);
-			} else
+				if (cts->xport_specific.sata.revision != 0xff) {
+					cts->xport_specific.sata.valid |=
+					    CTS_SATA_VALID_REVISION;
+				}
+			} else {
 				cts->xport_specific.sata.revision = d->revision;
-			cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION;
+				cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION;
+			}
 			cts->xport_specific.sata.atapi = d->atapi;
 			cts->xport_specific.sata.valid |= CTS_SATA_VALID_ATAPI;
 		} else {
 			cts->transport = XPORT_ATA;
 			cts->transport_version = XPORT_VERSION_UNSPECIFIED;
+			cts->xport_specific.ata.valid = 0;
 			cts->xport_specific.ata.mode = d->mode;
 			cts->xport_specific.ata.valid |= CTS_ATA_VALID_MODE;
 			cts->xport_specific.ata.bytecount = d->bytecount;

Modified: head/sys/dev/ata/ata-pci.c
==============================================================================
--- head/sys/dev/ata/ata-pci.c	Mon Feb 22 07:50:17 2010	(r204194)
+++ head/sys/dev/ata/ata-pci.c	Mon Feb 22 10:45:40 2010	(r204195)
@@ -714,10 +714,14 @@ static int
 ata_pcichannel_getrev(device_t dev, int target)
 {
 	struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
+	struct ata_channel *ch = device_get_softc(dev);
 
-	if (ctlr->getrev)
-		return (ctlr->getrev(dev, target));
-	else
+	if (ch->flags & ATA_SATA) {
+		if (ctlr->getrev)
+			return (ctlr->getrev(dev, target));
+		else 
+			return (0xff);
+	} else
 		return (0);
 }
 

Modified: head/sys/dev/ata/ata-sata.c
==============================================================================
--- head/sys/dev/ata/ata-sata.c	Mon Feb 22 07:50:17 2010	(r204194)
+++ head/sys/dev/ata/ata-sata.c	Mon Feb 22 10:45:40 2010	(r204195)
@@ -223,7 +223,7 @@ ata_sata_getrev(device_t dev, int target
 
 	if (ch->r_io[ATA_SSTATUS].res)
 		return ((ATA_IDX_INL(ch, ATA_SSTATUS) & 0x0f0) >> 4);
-	return (0);
+	return (0xff);
 }
 
 int



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