scsi_eh.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. /* new command support */
  37. unsigned char eh_cmnd[BLK_MAX_CDB];
  38. struct scatterlist sense_sgl;
  39. };
  40. extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
  41. struct scsi_eh_save *ses, unsigned char *cmnd,
  42. int cmnd_size, unsigned sense_bytes);
  43. extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
  44. struct scsi_eh_save *ses);
  45. #endif /* _SCSI_SCSI_EH_H */