Improve ATA and SCSI versions printing.
There is no "SCSI-6" and "ATA-9", but there is "SPC-4" and "ACS-2". MFC after: 2 weeks
This commit is contained in:
parent
c2290ff6b8
commit
4f42bb1021
@ -275,28 +275,38 @@ ata_res_sbuf(struct ccb_ataio *ataio, struct sbuf *sb)
|
||||
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
|
||||
|
@ -5149,7 +5149,7 @@ scsi_print_inquiry(struct scsi_inquiry_data *inq_data)
|
||||
{
|
||||
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);
|
||||
|
||||
@ -5157,7 +5157,7 @@ scsi_print_inquiry(struct scsi_inquiry_data *inq_data)
|
||||
* 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:
|
||||
@ -5165,15 +5165,15 @@ scsi_print_inquiry(struct scsi_inquiry_data *inq_data)
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -5242,11 +5242,16 @@ scsi_print_inquiry(struct scsi_inquiry_data *inq_data)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user