svn commit: r189297 - stable/7/sbin/atacontrol

Alexander Motin mav at FreeBSD.org
Mon Mar 2 23:56:43 PST 2009


Author: mav
Date: Tue Mar  3 07:56:42 2009
New Revision: 189297
URL: http://svn.freebsd.org/changeset/base/189297

Log:
  MFC rev. 186079, 188829, 188922, 188959.
  
  Sync with HEAD.

Modified:
  stable/7/sbin/atacontrol/   (props changed)
  stable/7/sbin/atacontrol/atacontrol.8
  stable/7/sbin/atacontrol/atacontrol.c

Modified: stable/7/sbin/atacontrol/atacontrol.8
==============================================================================
--- stable/7/sbin/atacontrol/atacontrol.8	Tue Mar  3 07:01:57 2009	(r189296)
+++ stable/7/sbin/atacontrol/atacontrol.8	Tue Mar  3 07:56:42 2009	(r189297)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 25, 2008
+.Dd February 21, 2009
 .Dt ATACONTROL 8
 .Os
 .Sh NAME
@@ -63,6 +63,7 @@
 .Nm
 .Ic mode
 .Ar device
+.Op Ar mode
 .Nm
 .Ic info
 .Ar channel
@@ -94,7 +95,7 @@ The
 .Ar channel
 argument is the ATA channel device (e.g., ata0) on which to operate.
 The following commands are supported:
-.Bl -tag -width "rebuild"
+.Bl -tag -width ".Ic addspare"
 .It Ic attach
 Attach an ATA
 .Ar channel .
@@ -162,9 +163,13 @@ Rebuild a RAID1 array on a RAID capable 
 .It Ic status
 Get the status of an ATA RAID.
 .It Ic mode
-Without the mode argument, the current transfer modes of the
+Without the
+.Ar mode
+argument, the current transfer mode of the
 device are printed.
-If the mode argument is given, the ATA driver
+If the
+.Ar mode
+argument is given, the ATA driver
 is asked to change the transfer mode to the one given.
 The ATA driver
 will reject modes that are not supported by the hardware.
@@ -175,9 +180,7 @@ Modes are given like
 case does not matter.
 .Pp
 Currently supported modes are:
-.Cm PIO0 , PIO1 , PIO2 , PIO3 , PIO4 ,
-.Cm WDMA2 ,
-.Cm UDMA2
+.Cm BIOSPIO , PIO0 , PIO1 , PIO2 , PIO3 , PIO4 , WDMA2 , UDMA2
 (alias
 .Cm UDMA33 ) ,
 .Cm UDMA4
@@ -185,18 +188,19 @@ Currently supported modes are:
 .Cm UDMA66 ) ,
 .Cm UDMA5
 (alias
-.Cm UDMA100 )
-and
+.Cm UDMA100 ) ,
 .Cm UDMA6
 (alias
-.Cm UDMA133 ) .
-The device name and manufacture/version strings are shown.
+.Cm UDMA133 ) ,
+.Cm SATA150 , SATA300 , USB , USB1 , USB2
+and
+.Cm BIOSDMA .
 .It Ic cap
 Show detailed info about the device on
 .Ar device .
 .It Ic spindown
 Set or report timeout after which the
-.Ar device 
+.Ar device
 will be spun down.
 To arm the timeout the device needs at least one more request after
 setting the timeout.
@@ -205,6 +209,7 @@ No further actions are needed in this ca
 .It Ic info
 Show info about the attached devices on the
 .Ar channel .
+The device name and manufacture/version strings are shown.
 .It Ic list
 Show info about all attached devices on all active controllers.
 .El
@@ -312,7 +317,7 @@ If the system has a pure software array 
 RAID controller, then shut the system down, make sure that the disk
 that was still working is moved to the bootable position (channel 0
 or whatever the BIOS allows the system to boot from) and the blank disk
-is placed in the secondary position, then boot the system into 
+is placed in the secondary position, then boot the system into
 single-user mode and issue the command:
 .Pp
 .Dl "atacontrol addspare ar0 ad6"

Modified: stable/7/sbin/atacontrol/atacontrol.c
==============================================================================
--- stable/7/sbin/atacontrol/atacontrol.c	Tue Mar  3 07:01:57 2009	(r189296)
+++ stable/7/sbin/atacontrol/atacontrol.c	Tue Mar  3 07:56:42 2009	(r189297)
@@ -82,6 +82,11 @@ str2mode(char *str)
 	if (!strcasecmp(str, "UDMA100")) return ATA_UDMA5;
 	if (!strcasecmp(str, "UDMA6")) return ATA_UDMA6;
 	if (!strcasecmp(str, "UDMA133")) return ATA_UDMA6;
+	if (!strcasecmp(str, "SATA150")) return ATA_SA150;
+	if (!strcasecmp(str, "SATA300")) return ATA_SA300;
+	if (!strcasecmp(str, "USB")) return ATA_USB;
+	if (!strcasecmp(str, "USB1")) return ATA_USB1;
+	if (!strcasecmp(str, "USB2")) return ATA_USB2;
 	if (!strcasecmp(str, "BIOSDMA")) return ATA_DMA;
 	return -1;
 }
@@ -127,11 +132,11 @@ param_print(struct ata_params *parm)
 	printf("<%.40s/%.8s> ", parm->model, parm->revision);
 	if (parm->satacapabilities && parm->satacapabilities != 0xffff) {
 		if (parm->satacapabilities & ATA_SATA_GEN2)
-			printf("Serial ATA II\n");
+			printf("SATA revision 2.x\n");
 		else if (parm->satacapabilities & ATA_SATA_GEN1)
-			printf("Serial ATA v1.0\n");
+			printf("SATA revision 1.x\n");
 		else
-			printf("Unknown serial ATA version\n");
+			printf("Unknown SATA revision\n");
 	}
 	else
 		printf("ATA/ATAPI revision %d\n", version(parm->version_major));
@@ -152,11 +157,11 @@ cap_print(struct ata_params *parm)
 	printf("Protocol              ");
 	if (parm->satacapabilities && parm->satacapabilities != 0xffff) {
 		if (parm->satacapabilities & ATA_SATA_GEN2)
-			printf("Serial ATA II\n");
+			printf("SATA revision 2.x\n");
 		else if (parm->satacapabilities & ATA_SATA_GEN1)
-			printf("Serial ATA v1.0\n");
+			printf("SATA revision 1.x\n");
 		else
-			printf("Unknown serial ATA version\n");
+			printf("Unknown SATA revision\n");
 	}
 	else
 		printf("ATA/ATAPI revision %d\n", version(parm->version_major));
@@ -364,6 +369,8 @@ main(int argc, char **argv)
 		fd = open_dev(argv[2], O_RDONLY);
 		if (argc == 4) {
 			mode = str2mode(argv[3]);
+			if (mode == -1)
+				errx(1, "unknown mode");
 			if (ioctl(fd, IOCATASMODE, &mode) < 0)
 				warn("ioctl(IOCATASMODE)");
 		}


More information about the svn-src-stable-7 mailing list