scsi_eh.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. static inline bool scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr)
  17. {
  18. return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1));
  19. }
  20. extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
  21. u64 * info_out);
  22. extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
  23. struct scsi_eh_save {
  24. /* saved state */
  25. int result;
  26. enum dma_data_direction data_direction;
  27. unsigned underflow;
  28. unsigned char cmd_len;
  29. unsigned char prot_op;
  30. unsigned char *cmnd;
  31. struct scsi_data_buffer sdb;
  32. struct request *next_rq;
  33. /* new command support */
  34. unsigned char eh_cmnd[BLK_MAX_CDB];
  35. struct scatterlist sense_sgl;
  36. };
  37. extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
  38. struct scsi_eh_save *ses, unsigned char *cmnd,
  39. int cmnd_size, unsigned sense_bytes);
  40. extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
  41. struct scsi_eh_save *ses);
  42. #endif /* _SCSI_SCSI_EH_H */