summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2010-01-20 13:31:12 +0000
committermav <mav@FreeBSD.org>2010-01-20 13:31:12 +0000
commit9bd3933525366234945bf03795afbfd5e340fb1d (patch)
tree8c10c3177d7a126eead5034c8b934d8cd219ec64 /sbin/camcontrol
parentfcb9d629ca940121446014db94539ed245fe3736 (diff)
downloadFreeBSD-src-9bd3933525366234945bf03795afbfd5e340fb1d.zip
FreeBSD-src-9bd3933525366234945bf03795afbfd5e340fb1d.tar.gz
- Add -v argument to `camcontrol identify` command. It makes camcontrol
print full identify data block. - Improve identify result view and add TRIM support.
Diffstat (limited to 'sbin/camcontrol')
-rw-r--r--sbin/camcontrol/camcontrol.83
-rw-r--r--sbin/camcontrol/camcontrol.c47
2 files changed, 34 insertions, 16 deletions
diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8
index 0509ef7..d1e9587 100644
--- a/sbin/camcontrol/camcontrol.8
+++ b/sbin/camcontrol/camcontrol.8
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 9, 2009
+.Dd January 20, 2010
.Dt CAMCONTROL 8
.Os
.Sh NAME
@@ -62,6 +62,7 @@
.Ic identify
.Op device id
.Op generic args
+.Op Fl v
.Nm
.Ic reportluns
.Op device id
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 1e71ae0..c98d5c9 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -1166,8 +1166,6 @@ atacapprint(struct ata_params *parm)
}
printf("\n");
- printf("overlap%ssupported\n",
- parm->capabilities1 & ATA_SUPPORT_OVERLAP ? " " : " not ");
if (parm->media_rotation_rate == 1) {
printf("media RPM non-rotating\n");
} else if (parm->media_rotation_rate >= 0x0401 &&
@@ -1187,20 +1185,26 @@ atacapprint(struct ata_params *parm)
printf("flush cache %s %s\n",
parm->support.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no",
parm->enabled.command2 & ATA_SUPPORT_FLUSHCACHE ? "yes" : "no");
+ printf("overlap %s\n",
+ parm->capabilities1 & ATA_SUPPORT_OVERLAP ? "yes" : "no");
+ printf("Tagged Command Queuing (TCQ) %s %s",
+ parm->support.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no",
+ parm->enabled.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no");
+ if (parm->support.command2 & ATA_SUPPORT_QUEUED) {
+ printf(" %d tags\n",
+ ATA_QUEUE_LEN(parm->queue) + 1);
+ } else
+ printf("\n");
if (parm->satacapabilities && parm->satacapabilities != 0xffff) {
- printf("Native Command Queuing (NCQ) %s "
- " %d/0x%02X\n",
+ printf("Native Command Queuing (NCQ) %s ",
parm->satacapabilities & ATA_SUPPORT_NCQ ?
- "yes" : "no",
- (parm->satacapabilities & ATA_SUPPORT_NCQ) ?
- ATA_QUEUE_LEN(parm->queue) : 0,
- (parm->satacapabilities & ATA_SUPPORT_NCQ) ?
- ATA_QUEUE_LEN(parm->queue) : 0);
+ "yes" : "no");
+ if (parm->satacapabilities & ATA_SUPPORT_NCQ) {
+ printf(" %d tags\n",
+ ATA_QUEUE_LEN(parm->queue) + 1);
+ } else
+ printf("\n");
}
- printf("Tagged Command Queuing (TCQ) %s %s %d/0x%02X\n",
- parm->support.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no",
- parm->enabled.command2 & ATA_SUPPORT_QUEUED ? "yes" : "no",
- ATA_QUEUE_LEN(parm->queue), ATA_QUEUE_LEN(parm->queue));
printf("SMART %s %s\n",
parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no",
parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no");
@@ -1241,6 +1245,8 @@ atacapprint(struct ata_params *parm)
printf("free-fall %s %s\n",
parm->support2 & ATA_SUPPORT_FREEFALL ? "yes" : "no",
parm->enabled2 & ATA_SUPPORT_FREEFALL ? "yes" : "no");
+ printf("data set management (TRIM) %s\n",
+ parm->support_dsm & ATA_SUPPORT_DSM_TRIM ? "yes" : "no");
}
@@ -1327,8 +1333,18 @@ ataidentify(struct cam_device *device, int retry_count, int timeout)
for (i = 0; i < sizeof(struct ata_params) / 2; i++)
ptr[i] = le16toh(ptr[i]);
+ if (arglist & CAM_ARG_VERBOSE) {
+ fprintf(stdout, "%s%d: Raw identify data:\n",
+ device->device_name, device->dev_unit_num);
+ for (i = 0; i < sizeof(struct ata_params) / 2; i++) {
+ if ((i % 8) == 0)
+ fprintf(stdout, " %3d: ", i);
+ fprintf(stdout, "%04x ", (uint16_t)ptr[i]);
+ if ((i % 8) == 7)
+ fprintf(stdout, "\n");
+ }
+ }
ident_buf = (struct ata_params *)ptr;
-
if (strncmp(ident_buf->model, "FX", 2) &&
strncmp(ident_buf->model, "NEC", 3) &&
strncmp(ident_buf->model, "Pioneer", 7) &&
@@ -2286,6 +2302,7 @@ scsicmd(struct cam_device *device, int argc, char **argv, char *combinedopt,
error = 1;
goto scsicmd_bailout;
}
+ bzero(data_ptr, data_bytes);
/*
* If the user supplied "-" instead of a format, he
* wants the data to be read from stdin.
@@ -4305,7 +4322,7 @@ usage(int verbose)
" camcontrol periphlist [dev_id][-n dev_name] [-u unit]\n"
" camcontrol tur [dev_id][generic args]\n"
" camcontrol inquiry [dev_id][generic args] [-D] [-S] [-R]\n"
-" camcontrol identify [dev_id][generic args]\n"
+" camcontrol identify [dev_id][generic args] [-v]\n"
" camcontrol reportluns [dev_id][generic args] [-c] [-l] [-r report]\n"
" camcontrol readcap [dev_id][generic args] [-b] [-h] [-H] [-N]\n"
" [-q] [-s]\n"
OpenPOWER on IntegriCloud