Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _SCSI_SCSI_DBG_H
0003 #define _SCSI_SCSI_DBG_H
0004 
0005 struct scsi_cmnd;
0006 struct scsi_device;
0007 struct scsi_sense_hdr;
0008 
0009 extern void scsi_print_command(struct scsi_cmnd *);
0010 extern size_t __scsi_format_command(char *, size_t,
0011                    const unsigned char *, size_t);
0012 extern void scsi_print_sense_hdr(const struct scsi_device *, const char *,
0013                  const struct scsi_sense_hdr *);
0014 extern void scsi_print_sense(const struct scsi_cmnd *);
0015 extern void __scsi_print_sense(const struct scsi_device *, const char *name,
0016                    const unsigned char *sense_buffer,
0017                    int sense_len);
0018 extern void scsi_print_result(const struct scsi_cmnd *, const char *, int);
0019 
0020 #ifdef CONFIG_SCSI_CONSTANTS
0021 extern bool scsi_opcode_sa_name(int, int, const char **, const char **);
0022 extern const char *scsi_sense_key_string(unsigned char);
0023 extern const char *scsi_extd_sense_format(unsigned char, unsigned char,
0024                       const char **);
0025 extern const char *scsi_mlreturn_string(int);
0026 extern const char *scsi_hostbyte_string(int);
0027 extern const char *scsi_driverbyte_string(int);
0028 #else
0029 static inline bool
0030 scsi_opcode_sa_name(int cmd, int sa,
0031             const char **cdb_name, const char **sa_name)
0032 {
0033     *cdb_name = NULL;
0034     switch (cmd) {
0035     case VARIABLE_LENGTH_CMD:
0036     case MAINTENANCE_IN:
0037     case MAINTENANCE_OUT:
0038     case PERSISTENT_RESERVE_IN:
0039     case PERSISTENT_RESERVE_OUT:
0040     case SERVICE_ACTION_IN_12:
0041     case SERVICE_ACTION_OUT_12:
0042     case SERVICE_ACTION_BIDIRECTIONAL:
0043     case SERVICE_ACTION_IN_16:
0044     case SERVICE_ACTION_OUT_16:
0045     case EXTENDED_COPY:
0046     case RECEIVE_COPY_RESULTS:
0047         *sa_name = NULL;
0048         return true;
0049     default:
0050         return false;
0051     }
0052 }
0053 
0054 static inline const char *
0055 scsi_sense_key_string(unsigned char key)
0056 {
0057     return NULL;
0058 }
0059 
0060 static inline const char *
0061 scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
0062 {
0063     *fmt = NULL;
0064     return NULL;
0065 }
0066 
0067 static inline const char *
0068 scsi_mlreturn_string(int result)
0069 {
0070     return NULL;
0071 }
0072 
0073 static inline const char *
0074 scsi_hostbyte_string(int result)
0075 {
0076     return NULL;
0077 }
0078 
0079 static inline const char *
0080 scsi_driverbyte_string(int result)
0081 {
0082     return NULL;
0083 }
0084 
0085 #endif
0086 
0087 #endif /* _SCSI_SCSI_DBG_H */