Author: mav
Date: Thu Jan  5 11:53:43 2017
New Revision: 311438
URL: https://svnweb.freebsd.org/changeset/base/311438

Log:
  MFC r310489: Implement printing forwarded sense data.

Modified:
  stable/10/sys/cam/scsi/scsi_all.c
  stable/10/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_all.c
==============================================================================
--- stable/10/sys/cam/scsi/scsi_all.c   Thu Jan  5 11:53:07 2017        
(r311437)
+++ stable/10/sys/cam/scsi/scsi_all.c   Thu Jan  5 11:53:43 2017        
(r311438)
@@ -4662,6 +4662,26 @@ scsi_sense_progress_sbuf(struct sbuf *sb
        scsi_progress_sbuf(sb, progress_val);
 }
 
+void
+scsi_sense_forwarded_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_forwarded *forwarded;
+       const char *sense_key_desc;
+       const char *asc_desc;
+       int error_code, sense_key, asc, ascq;
+
+       forwarded = (struct scsi_sense_forwarded *)header;
+       scsi_extract_sense_len((struct scsi_sense_data *)forwarded->sense_data,
+           forwarded->length - 2, &error_code, &sense_key, &asc, &ascq, 1);
+       scsi_sense_desc(sense_key, asc, ascq, NULL, &sense_key_desc, &asc_desc);
+
+       sbuf_printf(sb, "Forwarded sense: %s asc:%x,%x (%s): ",
+           sense_key_desc, asc, ascq, asc_desc);
+}
+
 /*
  * Generic sense descriptor printing routine.  This is used when we have
  * not yet implemented a specific printing routine for this descriptor.
@@ -4708,7 +4728,8 @@ 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_PROGRESS, scsi_sense_progress_sbuf}
+       {SSD_DESC_PROGRESS, scsi_sense_progress_sbuf},
+       {SSD_DESC_FORWARDED, scsi_sense_forwarded_sbuf}
 };
 
 void

Modified: stable/10/sys/cam/scsi/scsi_all.h
==============================================================================
--- stable/10/sys/cam/scsi/scsi_all.h   Thu Jan  5 11:53:07 2017        
(r311437)
+++ stable/10/sys/cam/scsi/scsi_all.h   Thu Jan  5 11:53:43 2017        
(r311438)
@@ -3426,6 +3426,8 @@ struct scsi_sense_forwarded
 #define        SSD_FORWARDED_SDS_UNK   0x00
 #define        SSD_FORWARDED_SDS_EXSRC 0x01
 #define        SSD_FORWARDED_SDS_EXDST 0x02
+       uint8_t status;
+       uint8_t sense_data[];
 };
 
 /*
@@ -3654,6 +3656,10 @@ void scsi_sense_progress_sbuf(struct sbu
                              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_forwarded_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,
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to