svn commit: r280899 - in stable/9/sys/cam: ata scsi
Alexander Motin
mav at FreeBSD.org
Tue Mar 31 07:27:31 UTC 2015
Author: mav
Date: Tue Mar 31 07:27:29 2015
New Revision: 280899
URL: https://svnweb.freebsd.org/changeset/base/280899
Log:
MFC r280172: Improve ATA and SCSI versions printing.
There is no "SCSI-6" and "ATA-9", but there is "SPC-4" and "ACS-2".
Modified:
stable/9/sys/cam/ata/ata_all.c
stable/9/sys/cam/scsi/scsi_all.c
Directory Properties:
stable/9/ (props changed)
stable/9/sys/ (props changed)
Modified: stable/9/sys/cam/ata/ata_all.c
==============================================================================
--- stable/9/sys/cam/ata/ata_all.c Tue Mar 31 07:26:39 2015 (r280898)
+++ stable/9/sys/cam/ata/ata_all.c Tue Mar 31 07:27:29 2015 (r280899)
@@ -272,28 +272,38 @@ ata_res_sbuf(struct ccb_ataio *ataio, st
void
ata_print_ident(struct ata_params *ident_data)
{
- char product[48], revision[16];
+ const char *proto;
+ char product[48], revision[16], ata[12], sata[12];
cam_strvis(product, ident_data->model, sizeof(ident_data->model),
sizeof(product));
cam_strvis(revision, ident_data->revision, sizeof(ident_data->revision),
sizeof(revision));
- printf("<%s %s> %s-%d",
- product, revision,
- (ident_data->config == ATA_PROTO_CFA) ? "CFA" :
- (ident_data->config & ATA_PROTO_ATAPI) ? "ATAPI" : "ATA",
- ata_version(ident_data->version_major));
+ proto = (ident_data->config == ATA_PROTO_CFA) ? "CFA" :
+ (ident_data->config & ATA_PROTO_ATAPI) ? "ATAPI" : "ATA";
+ if (ata_version(ident_data->version_major) == 0) {
+ snprintf(ata, sizeof(ata), "%s", proto);
+ } else if (ata_version(ident_data->version_major) <= 7) {
+ snprintf(ata, sizeof(ata), "%s-%d", proto,
+ ata_version(ident_data->version_major));
+ } else if (ata_version(ident_data->version_major) == 8) {
+ snprintf(ata, sizeof(ata), "%s8-ACS", proto);
+ } else {
+ snprintf(ata, sizeof(ata), "ACS-%d %s",
+ ata_version(ident_data->version_major) - 7, proto);
+ }
if (ident_data->satacapabilities && ident_data->satacapabilities != 0xffff) {
if (ident_data->satacapabilities & ATA_SATA_GEN3)
- printf(" SATA 3.x");
+ snprintf(sata, sizeof(sata), " SATA 3.x");
else if (ident_data->satacapabilities & ATA_SATA_GEN2)
- printf(" SATA 2.x");
+ snprintf(sata, sizeof(sata), " SATA 2.x");
else if (ident_data->satacapabilities & ATA_SATA_GEN1)
- printf(" SATA 1.x");
+ snprintf(sata, sizeof(sata), " SATA 1.x");
else
- printf(" SATA");
- }
- printf(" device\n");
+ snprintf(sata, sizeof(sata), " SATA");
+ } else
+ sata[0] = 0;
+ printf("<%s %s> %s%s device\n", product, revision, ata, sata);
}
void
Modified: stable/9/sys/cam/scsi/scsi_all.c
==============================================================================
--- stable/9/sys/cam/scsi/scsi_all.c Tue Mar 31 07:26:39 2015 (r280898)
+++ stable/9/sys/cam/scsi/scsi_all.c Tue Mar 31 07:27:29 2015 (r280899)
@@ -5146,7 +5146,7 @@ scsi_print_inquiry(struct scsi_inquiry_d
{
u_int8_t type;
char *dtype, *qtype;
- char vendor[16], product[48], revision[16], rstr[4];
+ char vendor[16], product[48], revision[16], rstr[12];
type = SID_TYPE(inq_data);
@@ -5154,7 +5154,7 @@ scsi_print_inquiry(struct scsi_inquiry_d
* Figure out basic device type and qualifier.
*/
if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data)) {
- qtype = "(vendor-unique qualifier)";
+ qtype = " (vendor-unique qualifier)";
} else {
switch (SID_QUAL(inq_data)) {
case SID_QUAL_LU_CONNECTED:
@@ -5162,15 +5162,15 @@ scsi_print_inquiry(struct scsi_inquiry_d
break;
case SID_QUAL_LU_OFFLINE:
- qtype = "(offline)";
+ qtype = " (offline)";
break;
case SID_QUAL_RSVD:
- qtype = "(reserved qualifier)";
+ qtype = " (reserved qualifier)";
break;
default:
case SID_QUAL_BAD_LU:
- qtype = "(LUN not supported)";
+ qtype = " (LUN not supported)";
break;
}
}
@@ -5239,11 +5239,16 @@ scsi_print_inquiry(struct scsi_inquiry_d
cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision),
sizeof(revision));
- if (SID_ANSI_REV(inq_data) == SCSI_REV_CCS)
- bcopy("CCS", rstr, 4);
- else
- snprintf(rstr, sizeof (rstr), "%d", SID_ANSI_REV(inq_data));
- printf("<%s %s %s> %s %s SCSI-%s device %s\n",
+ if (SID_ANSI_REV(inq_data) == SCSI_REV_0)
+ snprintf(rstr, sizeof(rstr), "SCSI");
+ else if (SID_ANSI_REV(inq_data) <= SCSI_REV_SPC) {
+ snprintf(rstr, sizeof(rstr), "SCSI-%d",
+ SID_ANSI_REV(inq_data));
+ } else {
+ snprintf(rstr, sizeof(rstr), "SPC-%d SCSI",
+ SID_ANSI_REV(inq_data) - 2);
+ }
+ printf("<%s %s %s> %s %s %s device%s\n",
vendor, product, revision,
SID_IS_REMOVABLE(inq_data) ? "Removable" : "Fixed",
dtype, rstr, qtype);
More information about the svn-src-stable-9
mailing list