svn commit: r207775 - stable/8/sbin/camcontrol

Alexander Motin mav at FreeBSD.org
Sat May 8 13:12:53 UTC 2010


Author: mav
Date: Sat May  8 13:12:52 2010
New Revision: 207775
URL: http://svn.freebsd.org/changeset/base/207775

Log:
  MFC r207498:
  Add -d and -f arguments to `camcontrol cmd`, to execute DMA ATA commands.

Modified:
  stable/8/sbin/camcontrol/camcontrol.8
  stable/8/sbin/camcontrol/camcontrol.c
Directory Properties:
  stable/8/sbin/camcontrol/   (props changed)

Modified: stable/8/sbin/camcontrol/camcontrol.8
==============================================================================
--- stable/8/sbin/camcontrol/camcontrol.8	Sat May  8 13:09:36 2010	(r207774)
+++ stable/8/sbin/camcontrol/camcontrol.8	Sat May  8 13:12:52 2010	(r207775)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 20, 2010
+.Dd May 2, 2010
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -123,6 +123,8 @@
 .Op generic args
 .Aq Fl a Ar cmd Op args
 .Aq Fl c Ar cmd Op args
+.Op Fl d
+.Op Fl f
 .Op Fl i Ar len Ar fmt
 .Bk -words
 .Op Fl o Ar len Ar fmt Op args
@@ -530,6 +532,10 @@ lba_high_exp, features_exp, sector_count
 .It Fl c Ar cmd Op args
 This specifies the SCSI CDB.
 SCSI CDBs may be 6, 10, 12 or 16 bytes.
+.It Fl d
+Specifies DMA protocol to be used for ATA command.
+.It Fl f
+Specifies FPDMA (NCQ) protocol to be used for ATA command.
 .It Fl i Ar len Ar fmt
 This specifies the amount of data to read, and how it should be displayed.
 If the format is

Modified: stable/8/sbin/camcontrol/camcontrol.c
==============================================================================
--- stable/8/sbin/camcontrol/camcontrol.c	Sat May  8 13:09:36 2010	(r207774)
+++ stable/8/sbin/camcontrol/camcontrol.c	Sat May  8 13:12:52 2010	(r207775)
@@ -123,7 +123,7 @@ struct camcontrol_opts {
 };
 
 #ifndef MINIMALISTIC
-static const char scsicmd_opts[] = "a:c:i:o:r";
+static const char scsicmd_opts[] = "a:c:dfi:o:r";
 static const char readdefect_opts[] = "f:GP";
 static const char negotiate_opts[] = "acD:M:O:qR:T:UW:";
 #endif
@@ -2184,6 +2184,8 @@ scsicmd(struct cam_device *device, int a
 	int c, data_bytes = 0;
 	int cdb_len = 0;
 	int atacmd_len = 0;
+	int dmacmd = 0;
+	int fpdmacmd = 0;
 	int need_res = 0;
 	char *datastr = NULL, *tstr, *resstr = NULL;
 	int error = 0;
@@ -2246,6 +2248,12 @@ scsicmd(struct cam_device *device, int a
 			 */
 			optind += hook.got;
 			break;
+		case 'd':
+			dmacmd = 1;
+			break;
+		case 'f':
+			fpdmacmd = 1;
+			break;
 		case 'i':
 			if (arglist & CAM_ARG_CMD_OUT) {
 				warnx("command must either be "
@@ -2422,6 +2430,10 @@ scsicmd(struct cam_device *device, int a
 		bcopy(atacmd, &ccb->ataio.cmd.command, atacmd_len);
 		if (need_res)
 			ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT;
+		if (dmacmd)
+			ccb->ataio.cmd.flags |= CAM_ATAIO_DMA;
+		if (fpdmacmd)
+			ccb->ataio.cmd.flags |= CAM_ATAIO_FPDMA;
 
 		cam_fill_ataio(&ccb->ataio,
 		      /*retries*/ retry_count,
@@ -4353,7 +4365,7 @@ usage(int verbose)
 "                              [-P pagectl][-e | -b][-d]\n"
 "        camcontrol cmd        [dev_id][generic args]\n"
 "                              <-a cmd [args] | -c cmd [args]>\n"
-"                              [-i len fmt|-o len fmt [args]] [-r fmt]\n"
+"                              [-d] [-f] [-i len fmt|-o len fmt [args]] [-r fmt]\n"
 "        camcontrol debug      [-I][-P][-T][-S][-X][-c]\n"
 "                              <all|bus[:target[:lun]]|off>\n"
 "        camcontrol tags       [dev_id][generic args] [-N tags] [-q] [-v]\n"


More information about the svn-src-all mailing list