mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280172
@ -275,28 +275,38 @@ ata_res_sbuf(struct ccb_ataio *ataio, struct sbuf *sb)
|
|||||||
void
|
void
|
||||||
ata_print_ident(struct ata_params *ident_data)
|
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),
|
cam_strvis(product, ident_data->model, sizeof(ident_data->model),
|
||||||
sizeof(product));
|
sizeof(product));
|
||||||
cam_strvis(revision, ident_data->revision, sizeof(ident_data->revision),
|
cam_strvis(revision, ident_data->revision, sizeof(ident_data->revision),
|
||||||
sizeof(revision));
|
sizeof(revision));
|
||||||
printf("<%s %s> %s-%d",
|
proto = (ident_data->config == ATA_PROTO_CFA) ? "CFA" :
|
||||||
product, revision,
|
(ident_data->config & ATA_PROTO_ATAPI) ? "ATAPI" : "ATA";
|
||||||
(ident_data->config == ATA_PROTO_CFA) ? "CFA" :
|
if (ata_version(ident_data->version_major) == 0) {
|
||||||
(ident_data->config & ATA_PROTO_ATAPI) ? "ATAPI" : "ATA",
|
snprintf(ata, sizeof(ata), "%s", proto);
|
||||||
ata_version(ident_data->version_major));
|
} 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 && ident_data->satacapabilities != 0xffff) {
|
||||||
if (ident_data->satacapabilities & ATA_SATA_GEN3)
|
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)
|
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)
|
else if (ident_data->satacapabilities & ATA_SATA_GEN1)
|
||||||
printf(" SATA 1.x");
|
snprintf(sata, sizeof(sata), " SATA 1.x");
|
||||||
else
|
else
|
||||||
printf(" SATA");
|
snprintf(sata, sizeof(sata), " SATA");
|
||||||
}
|
} else
|
||||||
printf(" device\n");
|
sata[0] = 0;
|
||||||
|
printf("<%s %s> %s%s device\n", product, revision, ata, sata);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -5149,7 +5149,7 @@ scsi_print_inquiry(struct scsi_inquiry_data *inq_data)
|
|||||||
{
|
{
|
||||||
u_int8_t type;
|
u_int8_t type;
|
||||||
char *dtype, *qtype;
|
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);
|
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.
|
* Figure out basic device type and qualifier.
|
||||||
*/
|
*/
|
||||||
if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data)) {
|
if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data)) {
|
||||||
qtype = "(vendor-unique qualifier)";
|
qtype = " (vendor-unique qualifier)";
|
||||||
} else {
|
} else {
|
||||||
switch (SID_QUAL(inq_data)) {
|
switch (SID_QUAL(inq_data)) {
|
||||||
case SID_QUAL_LU_CONNECTED:
|
case SID_QUAL_LU_CONNECTED:
|
||||||
@ -5165,15 +5165,15 @@ scsi_print_inquiry(struct scsi_inquiry_data *inq_data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SID_QUAL_LU_OFFLINE:
|
case SID_QUAL_LU_OFFLINE:
|
||||||
qtype = "(offline)";
|
qtype = " (offline)";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SID_QUAL_RSVD:
|
case SID_QUAL_RSVD:
|
||||||
qtype = "(reserved qualifier)";
|
qtype = " (reserved qualifier)";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case SID_QUAL_BAD_LU:
|
case SID_QUAL_BAD_LU:
|
||||||
qtype = "(LUN not supported)";
|
qtype = " (LUN not supported)";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5242,11 +5242,16 @@ scsi_print_inquiry(struct scsi_inquiry_data *inq_data)
|
|||||||
cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision),
|
cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision),
|
||||||
sizeof(revision));
|
sizeof(revision));
|
||||||
|
|
||||||
if (SID_ANSI_REV(inq_data) == SCSI_REV_CCS)
|
if (SID_ANSI_REV(inq_data) == SCSI_REV_0)
|
||||||
bcopy("CCS", rstr, 4);
|
snprintf(rstr, sizeof(rstr), "SCSI");
|
||||||
else
|
else if (SID_ANSI_REV(inq_data) <= SCSI_REV_SPC) {
|
||||||
snprintf(rstr, sizeof (rstr), "%d", SID_ANSI_REV(inq_data));
|
snprintf(rstr, sizeof(rstr), "SCSI-%d",
|
||||||
printf("<%s %s %s> %s %s SCSI-%s device %s\n",
|
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,
|
vendor, product, revision,
|
||||||
SID_IS_REMOVABLE(inq_data) ? "Removable" : "Fixed",
|
SID_IS_REMOVABLE(inq_data) ? "Removable" : "Fixed",
|
||||||
dtype, rstr, qtype);
|
dtype, rstr, qtype);
|
||||||
|
Loading…
Reference in New Issue
Block a user