]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/scsi/scsi_eh.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / include / scsi / scsi_eh.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef _SCSI_SCSI_EH_H
3#define _SCSI_SCSI_EH_H
4
645a0c6c
JB
5#include <linux/scatterlist.h>
6
e1c23468 7#include <scsi/scsi_cmnd.h>
7708c165 8#include <scsi/scsi_common.h>
1da177e4 9struct scsi_device;
1da177e4
LT
10struct Scsi_Host;
11
041c5fc3
TH
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);
1da177e4
LT
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 *);
4753cbc0
HR
18extern bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd,
19 struct scsi_sense_hdr *sshdr);
3852e373 20extern int scsi_check_sense(struct scsi_cmnd *);
1da177e4 21
4753cbc0 22static inline bool scsi_sense_is_deferred(const struct scsi_sense_hdr *sshdr)
1da177e4
LT
23{
24 return ((sshdr->response_code >= 0x70) && (sshdr->response_code & 1));
25}
26
2908769c
DLM
27extern bool scsi_get_sense_info_fld(const u8 *sense_buffer, int sb_len,
28 u64 *info_out);
3bc6a261 29
176aa9d6 30extern int scsi_ioctl_reset(struct scsi_device *, int __user *);
1da177e4 31
e1c23468 32struct scsi_eh_save {
30b0c37b 33 /* saved state */
e1c23468 34 int result;
8e8c9d01 35 int eh_eflags;
e1c23468 36 enum dma_data_direction data_direction;
12265709 37 unsigned underflow;
e1c23468 38 unsigned char cmd_len;
db007fc5 39 unsigned char prot_op;
64a87b24 40 unsigned char *cmnd;
30b0c37b 41 struct scsi_data_buffer sdb;
6f9a35e2 42 struct request *next_rq;
30b0c37b 43 /* new command support */
64a87b24 44 unsigned char eh_cmnd[BLK_MAX_CDB];
e1c23468
BH
45 struct scatterlist sense_sgl;
46};
47
48extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
49 struct scsi_eh_save *ses, unsigned char *cmnd,
50 int cmnd_size, unsigned sense_bytes);
51
52extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
53 struct scsi_eh_save *ses);
54
1da177e4 55#endif /* _SCSI_SCSI_EH_H */