Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _SCSI_SCSI_EH_H |
| 2 | #define _SCSI_SCSI_EH_H |
| 3 | |
James Bottomley | 645a0c6 | 2007-10-15 21:07:17 -0400 | [diff] [blame] | 4 | #include <linux/scatterlist.h> |
| 5 | |
Boaz Harrosh | e1c2346 | 2007-10-08 16:36:45 +0200 | [diff] [blame] | 6 | #include <scsi/scsi_cmnd.h> |
Sagi Grimberg | 7708c16 | 2015-07-08 17:58:52 +0300 | [diff] [blame] | 7 | #include <scsi/scsi_common.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | struct scsi_device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | struct Scsi_Host; |
| 10 | |
Tejun Heo | 041c5fc | 2006-01-23 13:09:36 +0900 | [diff] [blame] | 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); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 *); |
Hannes Reinecke | 4753cbc | 2014-10-24 14:26:52 +0200 | [diff] [blame] | 17 | extern bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd, |
| 18 | struct scsi_sense_hdr *sshdr); |
Hannes Reinecke | 3852e37 | 2016-04-04 11:44:01 +0200 | [diff] [blame] | 19 | extern int scsi_check_sense(struct scsi_cmnd *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Hannes Reinecke | 4753cbc | 2014-10-24 14:26:52 +0200 | [diff] [blame] | 21 | static inline bool scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | { |
| 23 | return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1)); |
| 24 | } |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len, |
| 27 | u64 * info_out); |
FUJITA Tomonori | 3bc6a26 | 2008-03-25 09:26:49 +0900 | [diff] [blame] | 28 | |
Christoph Hellwig | 176aa9d | 2014-10-11 12:06:47 +0200 | [diff] [blame] | 29 | extern int scsi_ioctl_reset(struct scsi_device *, int __user *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | |
Boaz Harrosh | e1c2346 | 2007-10-08 16:36:45 +0200 | [diff] [blame] | 31 | struct scsi_eh_save { |
Boaz Harrosh | 30b0c37 | 2007-12-13 13:47:40 +0200 | [diff] [blame] | 32 | /* saved state */ |
Boaz Harrosh | e1c2346 | 2007-10-08 16:36:45 +0200 | [diff] [blame] | 33 | int result; |
| 34 | enum dma_data_direction data_direction; |
Alan Stern | 1226570 | 2008-07-21 10:25:52 -0400 | [diff] [blame] | 35 | unsigned underflow; |
Boaz Harrosh | e1c2346 | 2007-10-08 16:36:45 +0200 | [diff] [blame] | 36 | unsigned char cmd_len; |
Martin K. Petersen | db007fc | 2008-07-17 04:28:31 -0400 | [diff] [blame] | 37 | unsigned char prot_op; |
Boaz Harrosh | 64a87b2 | 2008-04-30 11:19:47 +0300 | [diff] [blame] | 38 | unsigned char *cmnd; |
Boaz Harrosh | 30b0c37 | 2007-12-13 13:47:40 +0200 | [diff] [blame] | 39 | struct scsi_data_buffer sdb; |
Boaz Harrosh | 6f9a35e | 2007-12-13 13:50:53 +0200 | [diff] [blame] | 40 | struct request *next_rq; |
Boaz Harrosh | 30b0c37 | 2007-12-13 13:47:40 +0200 | [diff] [blame] | 41 | /* new command support */ |
Boaz Harrosh | 64a87b2 | 2008-04-30 11:19:47 +0300 | [diff] [blame] | 42 | unsigned char eh_cmnd[BLK_MAX_CDB]; |
Boaz Harrosh | e1c2346 | 2007-10-08 16:36:45 +0200 | [diff] [blame] | 43 | struct scatterlist sense_sgl; |
| 44 | }; |
| 45 | |
| 46 | extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, |
| 47 | struct scsi_eh_save *ses, unsigned char *cmnd, |
| 48 | int cmnd_size, unsigned sense_bytes); |
| 49 | |
| 50 | extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, |
| 51 | struct scsi_eh_save *ses); |
| 52 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #endif /* _SCSI_SCSI_EH_H */ |