Linux 4.13.16
[linux/fpc-iii.git] / include / scsi / scsi_eh.h
blob64d30d80dadb5f91ba73f2b020ede8d1e11e7ded
1 #ifndef _SCSI_SCSI_EH_H
2 #define _SCSI_SCSI_EH_H
4 #include <linux/scatterlist.h>
6 #include <scsi/scsi_cmnd.h>
7 #include <scsi/scsi_common.h>
8 struct scsi_device;
9 struct Scsi_Host;
11 extern void scsi_eh_finish_cmd(struct scsi_cmnd *scmd,
12 struct list_head *done_q);
13 extern void scsi_eh_flush_done_q(struct list_head *done_q);
14 extern void scsi_report_bus_reset(struct Scsi_Host *, int);
15 extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
16 extern int scsi_block_when_processing_errors(struct scsi_device *);
17 extern bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd,
18 struct scsi_sense_hdr *sshdr);
19 extern int scsi_check_sense(struct scsi_cmnd *);
21 static inline bool scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr)
23 return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1));
26 extern bool scsi_get_sense_info_fld(const u8 *sense_buffer, int sb_len,
27 u64 *info_out);
29 extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
31 struct scsi_eh_save {
32 /* saved state */
33 int result;
34 int eh_eflags;
35 enum dma_data_direction data_direction;
36 unsigned underflow;
37 unsigned char cmd_len;
38 unsigned char prot_op;
39 unsigned char *cmnd;
40 struct scsi_data_buffer sdb;
41 struct request *next_rq;
42 /* new command support */
43 unsigned char eh_cmnd[BLK_MAX_CDB];
44 struct scatterlist sense_sgl;
47 extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
48 struct scsi_eh_save *ses, unsigned char *cmnd,
49 int cmnd_size, unsigned sense_bytes);
51 extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
52 struct scsi_eh_save *ses);
54 #endif /* _SCSI_SCSI_EH_H */