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