1 #ifndef _SCSI_PRIV_H 2 #define _SCSI_PRIV_H 3 4 #include <linux/config.h> 5 #include <linux/device.h> 6 7 struct request_queue; 8 struct scsi_cmnd; 9 struct scsi_device; 10 struct scsi_host_template; 11 struct scsi_request; 12 struct Scsi_Host; 13 14 15 /* 16 * Magic values for certain scsi structs. Shouldn't ever be used. 17 */ 18 #define SCSI_CMND_MAGIC 0xE25C23A5 19 #define SCSI_REQ_MAGIC 0x75F6D354 20 21 /* 22 * Scsi Error Handler Flags 23 */ 24 #define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */ 25 #define SCSI_EH_REC_TIMEOUT 0x0002 /* EH retry timed out */ 26 27 #define SCSI_SENSE_VALID(scmd) \ 28 (((scmd)->sense_buffer[0] & 0x70) == 0x70) 29 30 /* 31 * Special value for scanning to specify scanning or rescanning of all 32 * possible channels, (target) ids, or luns on a given shost. 33 */ 34 #define SCAN_WILD_CARD ~0 35 36 /* hosts.c */ 37 extern int scsi_init_hosts(void); 38 extern void scsi_exit_hosts(void); 39 40 /* scsi.c */ 41 extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd); 42 extern int scsi_setup_command_freelist(struct Scsi_Host *shost); 43 extern void scsi_destroy_command_freelist(struct Scsi_Host *shost); 44 extern int scsi_insert_special_req(struct scsi_request *sreq, int); 45 extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, 46 struct scsi_request *sreq); 47 extern void __scsi_release_request(struct scsi_request *sreq); 48 extern void __scsi_done(struct scsi_cmnd *cmd); 49 #ifdef CONFIG_SCSI_LOGGING 50 void scsi_log_send(struct scsi_cmnd *cmd); 51 void scsi_log_completion(struct scsi_cmnd *cmd, int disposition); 52 #else 53 static inline void scsi_log_send(struct scsi_cmnd *cmd) 54 { }; 55 static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) 56 { }; 57 #endif 58 59 /* scsi_devinfo.c */ 60 extern int scsi_get_device_flags(struct scsi_device *sdev, 61 unsigned char *vendor, unsigned char *model); 62 extern int __init scsi_init_devinfo(void); 63 extern void scsi_exit_devinfo(void); 64 65 /* scsi_error.c */ 66 extern void scsi_times_out(struct scsi_cmnd *cmd); 67 extern int scsi_error_handler(void *host); 68 extern int scsi_decide_disposition(struct scsi_cmnd *cmd); 69 extern void scsi_eh_wakeup(struct Scsi_Host *shost); 70 extern int scsi_eh_scmd_add(struct scsi_cmnd *, int); 71 72 /* scsi_lib.c */ 73 extern int scsi_maybe_unblock_host(struct scsi_device *sdev); 74 extern void scsi_setup_cmd_retry(struct scsi_cmnd *cmd); 75 extern void scsi_device_unbusy(struct scsi_device *sdev); 76 extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason); 77 extern void scsi_next_command(struct scsi_cmnd *cmd); 78 extern void scsi_run_host_queues(struct Scsi_Host *shost); 79 extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev); 80 extern void scsi_free_queue(struct request_queue *q); 81 extern int scsi_init_queue(void); 82 extern void scsi_exit_queue(void); 83 84 /* scsi_proc.c */ 85 #ifdef CONFIG_SCSI_PROC_FS 86 extern void scsi_proc_hostdir_add(struct scsi_host_template *); 87 extern void scsi_proc_hostdir_rm(struct scsi_host_template *); 88 extern void scsi_proc_host_add(struct Scsi_Host *); 89 extern void scsi_proc_host_rm(struct Scsi_Host *); 90 extern int scsi_init_procfs(void); 91 extern void scsi_exit_procfs(void); 92 #else 93 # define scsi_proc_hostdir_add(sht) do { } while (0) 94 # define scsi_proc_hostdir_rm(sht) do { } while (0) 95 # define scsi_proc_host_add(shost) do { } while (0) 96 # define scsi_proc_host_rm(shost) do { } while (0) 97 # define scsi_init_procfs() (0) 98 # define scsi_exit_procfs() do { } while (0) 99 #endif /* CONFIG_PROC_FS */ 100 101 /* scsi_scan.c */ 102 extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int, 103 unsigned int, unsigned int, int); 104 extern void scsi_forget_host(struct Scsi_Host *); 105 extern void scsi_rescan_device(struct device *); 106 107 /* scsi_sysctl.c */ 108 #ifdef CONFIG_SYSCTL 109 extern int scsi_init_sysctl(void); 110 extern void scsi_exit_sysctl(void); 111 #else 112 # define scsi_init_sysctl() (0) 113 # define scsi_exit_sysctl() do { } while (0) 114 #endif /* CONFIG_SYSCTL */ 115 116 /* scsi_sysfs.c */ 117 extern int scsi_sysfs_add_sdev(struct scsi_device *); 118 extern int scsi_sysfs_add_host(struct Scsi_Host *); 119 extern int scsi_sysfs_register(void); 120 extern void scsi_sysfs_unregister(void); 121 extern void scsi_sysfs_device_initialize(struct scsi_device *); 122 extern int scsi_sysfs_target_initialize(struct scsi_device *); 123 extern struct scsi_transport_template blank_transport_template; 124 125 extern struct bus_type scsi_bus_type; 126 127 /* 128 * internal scsi timeout functions: for use by mid-layer and transport 129 * classes. 130 */ 131 132 #define SCSI_DEVICE_BLOCK_MAX_TIMEOUT (HZ*60) 133 extern int scsi_internal_device_block(struct scsi_device *sdev); 134 extern int scsi_internal_device_unblock(struct scsi_device *sdev); 135 136 #endif /* _SCSI_PRIV_H */ 137