Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Header file for SCSI device handler infrastruture.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Modified version of patches posted by Mike Christie <michaelc@cs.wisc.edu>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Copyright IBM Corporation, 2007
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *      Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  *               Chandra Seetharaman <sekharan@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  *               Mike Anderson <andmike@linux.vnet.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <scsi/scsi_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	SCSI_DH_OK = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	 * device errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	SCSI_DH_DEV_FAILED,	/* generic device error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	SCSI_DH_DEV_TEMP_BUSY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	SCSI_DH_DEV_UNSUPP,	/* device handler not supported */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	SCSI_DH_DEVICE_MAX,	/* max device blkerr definition */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	 * transport errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	SCSI_DH_NOTCONN = SCSI_DH_DEVICE_MAX + 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	SCSI_DH_CONN_FAILURE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	SCSI_DH_TRANSPORT_MAX,	/* max transport blkerr definition */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	 * driver and generic errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	SCSI_DH_IO = SCSI_DH_TRANSPORT_MAX + 1,	/* generic error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	SCSI_DH_INVALID_IO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	SCSI_DH_RETRY,		/* retry the req, but not immediately */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	SCSI_DH_IMM_RETRY,	/* immediately retry the req */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	SCSI_DH_TIMED_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	SCSI_DH_RES_TEMP_UNAVAIL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	SCSI_DH_DEV_OFFLINED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	SCSI_DH_NOMEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	SCSI_DH_NOSYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	SCSI_DH_DRIVER_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) typedef void (*activate_complete)(void *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct scsi_device_handler {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	/* Used by the infrastructure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	struct list_head list; /* list of scsi_device_handlers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	/* Filled by the hardware handler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	struct module *module;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	int (*attach)(struct scsi_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	void (*detach)(struct scsi_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	int (*activate)(struct scsi_device *, activate_complete, void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	blk_status_t (*prep_fn)(struct scsi_device *, struct request *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	int (*set_params)(struct scsi_device *, const char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	void (*rescan)(struct scsi_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #ifdef CONFIG_SCSI_DH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) extern int scsi_dh_activate(struct request_queue *, activate_complete, void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) extern int scsi_dh_attach(struct request_queue *, const char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) extern const char *scsi_dh_attached_handler_name(struct request_queue *, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) extern int scsi_dh_set_params(struct request_queue *, const char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static inline int scsi_dh_activate(struct request_queue *req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 					activate_complete fn, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	fn(data, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) static inline int scsi_dh_attach(struct request_queue *req, const char *name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	return SCSI_DH_NOSYS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) static inline const char *scsi_dh_attached_handler_name(struct request_queue *q,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 							gfp_t gfp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) static inline int scsi_dh_set_params(struct request_queue *req, const char *params)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 	return -SCSI_DH_NOSYS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #endif