11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _SCSI_PRIV_H 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _SCSI_PRIV_H 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/device.h> 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct request_queue; 7242f9dcb8ba6f68fcd217a119a7648a4f69290e9Jens Axboestruct request; 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct scsi_cmnd; 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct scsi_device; 10bc4f24014de58f045f169742701a6598884d93dbAlan Sternstruct scsi_target; 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct scsi_host_template; 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct Scsi_Host; 1384314fd4740ad73550c76dee4a9578979d84af48James Smartstruct scsi_nl_hdr; 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Scsi Error Handler Flags 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */ 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SCSI_SENSE_VALID(scmd) \ 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (((scmd)->sense_buffer[0] & 0x70) == 0x70) 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* hosts.c */ 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_init_hosts(void); 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_exit_hosts(void); 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* scsi.c */ 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_dispatch_cmd(struct scsi_cmnd *cmd); 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_setup_command_freelist(struct Scsi_Host *shost); 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_destroy_command_freelist(struct Scsi_Host *shost); 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_SCSI_LOGGING 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid scsi_log_send(struct scsi_cmnd *cmd); 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid scsi_log_completion(struct scsi_cmnd *cmd, int disposition); 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic inline void scsi_log_send(struct scsi_cmnd *cmd) 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds { }; 381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstatic inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds { }; 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* scsi_devinfo.c */ 43598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley 44598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley/* list of keys for the lists */ 45598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomleyenum { 46598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley SCSI_DEVINFO_GLOBAL = 0, 47a9e0edb687151617fe89cc5ab0086ebfc73ffccbJames Bottomley SCSI_DEVINFO_SPI, 48598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley}; 49598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_get_device_flags(struct scsi_device *sdev, 517f23e146a122966bd58e5da9c16a0e12385f09fcJames Bottomley const unsigned char *vendor, 527f23e146a122966bd58e5da9c16a0e12385f09fcJames Bottomley const unsigned char *model); 53598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomleyextern int scsi_get_device_flags_keyed(struct scsi_device *sdev, 54598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley const unsigned char *vendor, 55598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley const unsigned char *model, int key); 56598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomleyextern int scsi_dev_info_list_add_keyed(int compatible, char *vendor, 57598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley char *model, char *strflags, 58598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley int flags, int key); 5938a039be2e7bda32517642ecfce54c9317292a9cPeter Jonesextern int scsi_dev_info_list_del_keyed(char *vendor, char *model, int key); 60598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomleyextern int scsi_dev_info_add_list(int key, const char *name); 61598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomleyextern int scsi_dev_info_remove_list(int key); 62598fa4b775d064d4656132c78d9a312eb1d2f91fJames Bottomley 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int __init scsi_init_devinfo(void); 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_exit_devinfo(void); 651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* scsi_error.c */ 67242f9dcb8ba6f68fcd217a119a7648a4f69290e9Jens Axboeextern enum blk_eh_timer_return scsi_times_out(struct request *req); 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_error_handler(void *host); 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_decide_disposition(struct scsi_cmnd *cmd); 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_eh_wakeup(struct Scsi_Host *shost); 711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_eh_scmd_add(struct scsi_cmnd *, int); 72dca84e4694419adf61ad052b1e5a50ac82726597Darrick J. Wongvoid scsi_eh_ready_devs(struct Scsi_Host *shost, 73dca84e4694419adf61ad052b1e5a50ac82726597Darrick J. Wong struct list_head *work_q, 74dca84e4694419adf61ad052b1e5a50ac82726597Darrick J. Wong struct list_head *done_q); 75dca84e4694419adf61ad052b1e5a50ac82726597Darrick J. Wongint scsi_eh_get_sense(struct list_head *work_q, 76dca84e4694419adf61ad052b1e5a50ac82726597Darrick J. Wong struct list_head *done_q); 774a27446f3e39b06c28d1c8e31d33a5340826ed5cMike Christieint scsi_noretry_cmd(struct scsi_cmnd *scmd); 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* scsi_lib.c */ 801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_maybe_unblock_host(struct scsi_device *sdev); 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_device_unbusy(struct scsi_device *sdev); 821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason); 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_next_command(struct scsi_cmnd *cmd); 847b3d9545f9ac8b31528dd2d6d8ec8d19922917b8Linus Torvaldsextern void scsi_io_completion(struct scsi_cmnd *, unsigned int); 851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_run_host_queues(struct Scsi_Host *shost); 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev); 871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_free_queue(struct request_queue *q); 881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_init_queue(void); 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_exit_queue(void); 90751bf4d7865e4ced406be93b04c7436d866d3684James Bottomleystruct request_queue; 91751bf4d7865e4ced406be93b04c7436d866d3684James Bottomleystruct request; 927027ad72a689797475973c6feb5f0b673382f779Martin K. Petersenextern struct kmem_cache *scsi_sdb_cache; 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* scsi_proc.c */ 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_SCSI_PROC_FS 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_proc_hostdir_add(struct scsi_host_template *); 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_proc_hostdir_rm(struct scsi_host_template *); 981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_proc_host_add(struct Scsi_Host *); 991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_proc_host_rm(struct Scsi_Host *); 1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_init_procfs(void); 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_exit_procfs(void); 1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define scsi_proc_hostdir_add(sht) do { } while (0) 1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define scsi_proc_hostdir_rm(sht) do { } while (0) 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define scsi_proc_host_add(shost) do { } while (0) 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define scsi_proc_host_rm(shost) do { } while (0) 1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define scsi_init_procfs() (0) 1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define scsi_exit_procfs() do { } while (0) 1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* CONFIG_PROC_FS */ 1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* scsi_scan.c */ 112fea6d607e154cf96ab22254ccb48addfd43d4cb5Alan Sternextern int scsi_complete_async_scans(void); 1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int, 1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int, unsigned int, int); 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_forget_host(struct Scsi_Host *); 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_rescan_device(struct device *); 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* scsi_sysctl.c */ 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef CONFIG_SYSCTL 1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_init_sysctl(void); 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_exit_sysctl(void); 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#else 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define scsi_init_sysctl() (0) 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds# define scsi_exit_sysctl() do { } while (0) 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* CONFIG_SYSCTL */ 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* scsi_sysfs.c */ 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_sysfs_add_sdev(struct scsi_device *); 1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_sysfs_add_host(struct Scsi_Host *); 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_sysfs_register(void); 1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_sysfs_unregister(void); 1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void scsi_sysfs_device_initialize(struct scsi_device *); 1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_sysfs_target_initialize(struct scsi_device *); 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern struct scsi_transport_template blank_transport_template; 135903f4fed858a7b56b260cbd55d174fe54d188fb7Alan Sternextern void __scsi_remove_device(struct scsi_device *); 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern struct bus_type scsi_bus_type; 138a4dbd6740df0872cdf0a86841f75beec8381964dDavid Brownellextern const struct attribute_group *scsi_sysfs_shost_attr_groups[]; 1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 14084314fd4740ad73550c76dee4a9578979d84af48James Smart/* scsi_netlink.c */ 14184314fd4740ad73550c76dee4a9578979d84af48James Smart#ifdef CONFIG_SCSI_NETLINK 14284314fd4740ad73550c76dee4a9578979d84af48James Smartextern void scsi_netlink_init(void); 14384314fd4740ad73550c76dee4a9578979d84af48James Smartextern void scsi_netlink_exit(void); 14484314fd4740ad73550c76dee4a9578979d84af48James Smartextern struct sock *scsi_nl_sock; 14584314fd4740ad73550c76dee4a9578979d84af48James Smart#else 14684314fd4740ad73550c76dee4a9578979d84af48James Smartstatic inline void scsi_netlink_init(void) {} 14784314fd4740ad73550c76dee4a9578979d84af48James Smartstatic inline void scsi_netlink_exit(void) {} 14884314fd4740ad73550c76dee4a9578979d84af48James Smart#endif 14984314fd4740ad73550c76dee4a9578979d84af48James Smart 150db5bd1e0b505c54ff492172ce4abc245cf6cd639Alan Stern/* scsi_pm.c */ 151aa33860158114d0df3c7997bc1dd41c0168e1c2aRafael J. Wysocki#ifdef CONFIG_PM 152db5bd1e0b505c54ff492172ce4abc245cf6cd639Alan Sternextern const struct dev_pm_ops scsi_bus_pm_ops; 153db5bd1e0b505c54ff492172ce4abc245cf6cd639Alan Stern#endif 154bc4f24014de58f045f169742701a6598884d93dbAlan Stern#ifdef CONFIG_PM_RUNTIME 155bc4f24014de58f045f169742701a6598884d93dbAlan Sternextern void scsi_autopm_get_target(struct scsi_target *); 156bc4f24014de58f045f169742701a6598884d93dbAlan Sternextern void scsi_autopm_put_target(struct scsi_target *); 157bc4f24014de58f045f169742701a6598884d93dbAlan Sternextern int scsi_autopm_get_host(struct Scsi_Host *); 158bc4f24014de58f045f169742701a6598884d93dbAlan Sternextern void scsi_autopm_put_host(struct Scsi_Host *); 159bc4f24014de58f045f169742701a6598884d93dbAlan Stern#else 160bc4f24014de58f045f169742701a6598884d93dbAlan Sternstatic inline void scsi_autopm_get_target(struct scsi_target *t) {} 161bc4f24014de58f045f169742701a6598884d93dbAlan Sternstatic inline void scsi_autopm_put_target(struct scsi_target *t) {} 162bc4f24014de58f045f169742701a6598884d93dbAlan Sternstatic inline int scsi_autopm_get_host(struct Scsi_Host *h) { return 0; } 163bc4f24014de58f045f169742701a6598884d93dbAlan Sternstatic inline void scsi_autopm_put_host(struct Scsi_Host *h) {} 164bc4f24014de58f045f169742701a6598884d93dbAlan Stern#endif /* CONFIG_PM_RUNTIME */ 165db5bd1e0b505c54ff492172ce4abc245cf6cd639Alan Stern 1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * internal scsi timeout functions: for use by mid-layer and transport 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * classes. 1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1711c9e16e47a22c61d99aabb1c154e5106ddbf3575James Smart#define SCSI_DEVICE_BLOCK_MAX_TIMEOUT 600 /* units in seconds */ 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_internal_device_block(struct scsi_device *sdev); 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int scsi_internal_device_unblock(struct scsi_device *sdev); 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _SCSI_PRIV_H */ 176