scsi_eh.h 1.6 KB

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