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