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

This commit is contained in:
Alexander Motin 2010-05-02 11:36:27 +00:00
parent 8caae13f68
commit f930c0db49
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=207498
2 changed files with 21 additions and 3 deletions

View File

@ -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

View File

@ -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"