Author: mav
Date: Sun May  2 11:36:27 2010
New Revision: 207498
URL: http://svn.freebsd.org/changeset/base/207498

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

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.8
==============================================================================
--- head/sbin/camcontrol/camcontrol.8   Sun May  2 06:34:13 2010        
(r207497)
+++ head/sbin/camcontrol/camcontrol.8   Sun May  2 11:36:27 2010        
(r207498)
@@ -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: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c   Sun May  2 06:34:13 2010        
(r207497)
+++ head/sbin/camcontrol/camcontrol.c   Sun May  2 11:36:27 2010        
(r207498)
@@ -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"
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to