1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Header file for SCSI device handler infrastructure.
5 * Modified version of patches posted by Mike Christie <michaelc@cs.wisc.edu>
7 * Copyright IBM Corporation, 2007
9 * Chandra Seetharaman <sekharan@us.ibm.com>
10 * Mike Anderson <andmike@linux.vnet.ibm.com>
13 #include <scsi/scsi_device.h>
20 SCSI_DH_DEV_FAILED, /* generic device error */
21 SCSI_DH_DEV_TEMP_BUSY,
22 SCSI_DH_DEV_UNSUPP, /* device handler not supported */
23 SCSI_DH_DEVICE_MAX, /* max device blkerr definition */
28 SCSI_DH_NOTCONN = SCSI_DH_DEVICE_MAX + 1,
30 SCSI_DH_TRANSPORT_MAX, /* max transport blkerr definition */
33 * driver and generic errors
35 SCSI_DH_IO = SCSI_DH_TRANSPORT_MAX + 1, /* generic error */
37 SCSI_DH_RETRY, /* retry the req, but not immediately */
38 SCSI_DH_IMM_RETRY, /* immediately retry the req */
40 SCSI_DH_RES_TEMP_UNAVAIL,
47 typedef void (*activate_complete)(void *, int);
48 struct scsi_device_handler {
49 /* Used by the infrastructure */
50 struct list_head list; /* list of scsi_device_handlers */
52 /* Filled by the hardware handler */
53 struct module *module;
55 enum scsi_disposition (*check_sense)(struct scsi_device *,
56 struct scsi_sense_hdr *);
57 int (*attach)(struct scsi_device *);
58 void (*detach)(struct scsi_device *);
59 int (*activate)(struct scsi_device *, activate_complete, void *);
60 blk_status_t (*prep_fn)(struct scsi_device *, struct request *);
61 int (*set_params)(struct scsi_device *, const char *);
62 void (*rescan)(struct scsi_device *);
66 extern int scsi_dh_activate(struct request_queue *, activate_complete, void *);
67 extern int scsi_dh_attach(struct request_queue *, const char *);
68 extern const char *scsi_dh_attached_handler_name(struct request_queue *, gfp_t);
69 extern int scsi_dh_set_params(struct request_queue *, const char *);
71 static inline int scsi_dh_activate(struct request_queue *req,
72 activate_complete fn, void *data)
77 static inline int scsi_dh_attach(struct request_queue *req, const char *name)
81 static inline const char *scsi_dh_attached_handler_name(struct request_queue *q,
86 static inline int scsi_dh_set_params(struct request_queue *req, const char *params)
88 return -SCSI_DH_NOSYS;