Decode ATA Status Return descriptor.

MFC after:	2 weeks
This commit is contained in:
mav 2016-09-08 12:00:02 +00:00
parent 24af6b6b54
commit 64d000a7ee
2 changed files with 52 additions and 0 deletions

View File

@ -4652,6 +4652,53 @@ scsi_sense_progress_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,
scsi_progress_sbuf(sb, progress_val);
}
void
scsi_sense_ata_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,
u_int sense_len, uint8_t *cdb, int cdb_len,
struct scsi_inquiry_data *inq_data,
struct scsi_sense_desc_header *header)
{
struct scsi_sense_ata_ret_desc *res;
res = (struct scsi_sense_ata_ret_desc *)header;
sbuf_printf(sb, "ATA status: %02x (%s%s%s%s%s%s%s%s), ",
res->status,
(res->status & 0x80) ? "BSY " : "",
(res->status & 0x40) ? "DRDY " : "",
(res->status & 0x20) ? "DF " : "",
(res->status & 0x10) ? "SERV " : "",
(res->status & 0x08) ? "DRQ " : "",
(res->status & 0x04) ? "CORR " : "",
(res->status & 0x02) ? "IDX " : "",
(res->status & 0x01) ? "ERR" : "");
if (res->status & 1) {
sbuf_printf(sb, "error: %02x (%s%s%s%s%s%s%s%s), ",
res->error,
(res->error & 0x80) ? "ICRC " : "",
(res->error & 0x40) ? "UNC " : "",
(res->error & 0x20) ? "MC " : "",
(res->error & 0x10) ? "IDNF " : "",
(res->error & 0x08) ? "MCR " : "",
(res->error & 0x04) ? "ABRT " : "",
(res->error & 0x02) ? "NM " : "",
(res->error & 0x01) ? "ILI" : "");
}
if (res->flags & SSD_DESC_ATA_FLAG_EXTEND) {
sbuf_printf(sb, "count: %02x%02x, ",
res->count_15_8, res->count_7_0);
sbuf_printf(sb, "LBA: %02x%02x%02x%02x%02x%02x, ",
res->lba_47_40, res->lba_39_32, res->lba_31_24,
res->lba_23_16, res->lba_15_8, res->lba_7_0);
} else {
sbuf_printf(sb, "count: %02x, ", res->count_7_0);
sbuf_printf(sb, "LBA: %02x%02x%02x, ",
res->lba_23_16, res->lba_15_8, res->lba_7_0);
}
sbuf_printf(sb, "device: %02x, ", res->device);
}
/*
* Generic sense descriptor printing routine. This is used when we have
* not yet implemented a specific printing routine for this descriptor.
@ -4698,6 +4745,7 @@ struct scsi_sense_desc_printer {
{SSD_DESC_FRU, scsi_sense_fru_sbuf},
{SSD_DESC_STREAM, scsi_sense_stream_sbuf},
{SSD_DESC_BLOCK, scsi_sense_block_sbuf},
{SSD_DESC_ATA, scsi_sense_ata_sbuf},
{SSD_DESC_PROGRESS, scsi_sense_progress_sbuf}
};

View File

@ -3682,6 +3682,10 @@ void scsi_sense_progress_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,
u_int sense_len, uint8_t *cdb, int cdb_len,
struct scsi_inquiry_data *inq_data,
struct scsi_sense_desc_header *header);
void scsi_sense_ata_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,
u_int sense_len, uint8_t *cdb, int cdb_len,
struct scsi_inquiry_data *inq_data,
struct scsi_sense_desc_header *header);
void scsi_sense_generic_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,
u_int sense_len, uint8_t *cdb, int cdb_len,
struct scsi_inquiry_data *inq_data,