scsi_eh.h 1.6 KB

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