aboutsummaryrefslogtreecommitdiff
path: root/sbin/camcontrol
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2010-05-02 11:36:27 +0000
committerAlexander Motin <mav@FreeBSD.org>2010-05-02 11:36:27 +0000
commitf930c0db49a2049e7b92ec49b7736546839ed0a3 (patch)
tree39c1623279847c0fdfee003f5c7fc3f01919bc94 /sbin/camcontrol
parent8caae13f6879c2080a6c5ec8b56d48b6bee564f7 (diff)
downloadsrc-f930c0db49a2049e7b92ec49b7736546839ed0a3.tar.gz
src-f930c0db49a2049e7b92ec49b7736546839ed0a3.zip
Add -d and -f arguments to `camcontrol cmd`, to execute DMA ATA commands.
Notes
Notes: svn path=/head/; revision=207498
Diffstat (limited to 'sbin/camcontrol')
-rw-r--r--sbin/camcontrol/camcontrol.88
-rw-r--r--sbin/camcontrol/camcontrol.c16
2 files changed, 21 insertions, 3 deletions
diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8
index d1e9587ab951..1a075b3624d4 100644
--- a/sbin/camcontrol/camcontrol.8
+++ b/sbin/camcontrol/camcontrol.8
@@ -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, sector_count_exp).
.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
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 8e0605f6de21..9136cbe34696 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -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 argc, char **argv, char *combinedopt,
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 argc, char **argv, char *combinedopt,
*/
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 argc, char **argv, char *combinedopt,
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"