0001
0002 #ifndef _SCSI_SCSI_EH_H
0003 #define _SCSI_SCSI_EH_H
0004
0005 #include <linux/scatterlist.h>
0006
0007 #include <scsi/scsi_cmnd.h>
0008 #include <scsi/scsi_common.h>
0009 struct scsi_device;
0010 struct Scsi_Host;
0011
0012 extern void scsi_eh_finish_cmd(struct scsi_cmnd *scmd,
0013 struct list_head *done_q);
0014 extern void scsi_eh_flush_done_q(struct list_head *done_q);
0015 extern void scsi_report_bus_reset(struct Scsi_Host *, int);
0016 extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
0017 extern int scsi_block_when_processing_errors(struct scsi_device *);
0018 extern bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd,
0019 struct scsi_sense_hdr *sshdr);
0020 extern enum scsi_disposition scsi_check_sense(struct scsi_cmnd *);
0021
0022 static inline bool scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr)
0023 {
0024 return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1));
0025 }
0026
0027 extern bool scsi_get_sense_info_fld(const u8 *sense_buffer, int sb_len,
0028 u64 *info_out);
0029
0030 extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
0031
0032 struct scsi_eh_save {
0033
0034 int result;
0035 unsigned int resid_len;
0036 int eh_eflags;
0037 enum dma_data_direction data_direction;
0038 unsigned underflow;
0039 unsigned char cmd_len;
0040 unsigned char prot_op;
0041 unsigned char cmnd[32];
0042 struct scsi_data_buffer sdb;
0043 struct scatterlist sense_sgl;
0044 };
0045
0046 extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
0047 struct scsi_eh_save *ses, unsigned char *cmnd,
0048 int cmnd_size, unsigned sense_bytes);
0049
0050 extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
0051 struct scsi_eh_save *ses);
0052
0053 #endif