initial commit with v2.6.9
[linux-2.6.9-moxart.git] / drivers / scsi / scsi_priv.h
blob4dfb3db639d5af105b4e2f5d28f1ce08ed96a316
1 #ifndef _SCSI_PRIV_H
2 #define _SCSI_PRIV_H
4 #include <linux/config.h>
5 #include <linux/device.h>
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;
16 * These are the values that the owner field can take.
17 * They are used as an indication of who the command belongs to.
19 #define SCSI_OWNER_HIGHLEVEL 0x100
20 #define SCSI_OWNER_MIDLEVEL 0x101
21 #define SCSI_OWNER_LOWLEVEL 0x102
22 #define SCSI_OWNER_ERROR_HANDLER 0x103
23 #define SCSI_OWNER_BH_HANDLER 0x104
24 #define SCSI_OWNER_NOBODY 0x105
27 * Magic values for certain scsi structs. Shouldn't ever be used.
29 #define SCSI_CMND_MAGIC 0xE25C23A5
30 #define SCSI_REQ_MAGIC 0x75F6D354
33 * Flag bit for the internal_timeout array
35 #define NORMAL_TIMEOUT 0
38 * Scsi Error Handler Flags
40 #define scsi_eh_eflags_chk(scp, flags) \
41 ((scp)->eh_eflags & (flags))
42 #define scsi_eh_eflags_set(scp, flags) \
43 do { (scp)->eh_eflags |= (flags); } while(0)
44 #define scsi_eh_eflags_clr(scp, flags) \
45 do { (scp)->eh_eflags &= ~(flags); } while(0)
46 #define scsi_eh_eflags_clr_all(scp) \
47 (scp->eh_eflags = 0)
49 #define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */
50 #define SCSI_EH_REC_TIMEOUT 0x0002 /* EH retry timed out */
52 #define SCSI_SENSE_VALID(scmd) \
53 (((scmd)->sense_buffer[0] & 0x70) == 0x70)
56 * Special value for scanning to specify scanning or rescanning of all
57 * possible channels, (target) ids, or luns on a given shost.
59 #define SCAN_WILD_CARD ~0
62 * scsi_target: representation of a scsi target, for now, this is only
63 * used for single_lun devices. If no one has active IO to the target,
64 * starget_sdev_user is NULL, else it points to the active sdev.
66 struct scsi_target {
67 struct scsi_device *starget_sdev_user;
68 unsigned int starget_refcnt;
71 /* hosts.c */
72 extern int scsi_init_hosts(void);
73 extern void scsi_exit_hosts(void);
75 /* scsi.c */
76 extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd);
77 extern int scsi_setup_command_freelist(struct Scsi_Host *shost);
78 extern void scsi_destroy_command_freelist(struct Scsi_Host *shost);
79 extern void scsi_done(struct scsi_cmnd *cmd);
80 extern int scsi_retry_command(struct scsi_cmnd *cmd);
81 extern int scsi_insert_special_req(struct scsi_request *sreq, int);
82 extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd,
83 struct scsi_request *sreq);
84 extern void __scsi_release_request(struct scsi_request *sreq);
85 extern void __scsi_done(struct scsi_cmnd *cmd);
86 #ifdef CONFIG_SCSI_LOGGING
87 void scsi_log_send(struct scsi_cmnd *cmd);
88 void scsi_log_completion(struct scsi_cmnd *cmd, int disposition);
89 #else
90 static inline void scsi_log_send(struct scsi_cmnd *cmd)
91 { };
92 static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
93 { };
94 #endif
96 /* scsi_devinfo.c */
97 extern int scsi_get_device_flags(struct scsi_device *sdev,
98 unsigned char *vendor, unsigned char *model);
99 extern int scsi_init_devinfo(void);
100 extern void scsi_exit_devinfo(void);
102 /* scsi_error.c */
103 extern void scsi_times_out(struct scsi_cmnd *cmd);
104 extern int scsi_error_handler(void *host);
105 extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
106 extern void scsi_eh_wakeup(struct Scsi_Host *shost);
107 extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
109 /* scsi_lib.c */
110 extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
111 extern void scsi_setup_cmd_retry(struct scsi_cmnd *cmd);
112 extern void scsi_device_unbusy(struct scsi_device *sdev);
113 extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
114 extern void scsi_next_command(struct scsi_cmnd *cmd);
115 extern void scsi_run_host_queues(struct Scsi_Host *shost);
116 extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
117 extern void scsi_free_queue(struct request_queue *q);
118 extern int scsi_init_queue(void);
119 extern void scsi_exit_queue(void);
121 /* scsi_proc.c */
122 #ifdef CONFIG_SCSI_PROC_FS
123 extern void scsi_proc_hostdir_add(struct scsi_host_template *);
124 extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
125 extern void scsi_proc_host_add(struct Scsi_Host *);
126 extern void scsi_proc_host_rm(struct Scsi_Host *);
127 extern int scsi_init_procfs(void);
128 extern void scsi_exit_procfs(void);
129 #else
130 # define scsi_proc_hostdir_add(sht) do { } while (0)
131 # define scsi_proc_hostdir_rm(sht) do { } while (0)
132 # define scsi_proc_host_add(shost) do { } while (0)
133 # define scsi_proc_host_rm(shost) do { } while (0)
134 # define scsi_init_procfs() (0)
135 # define scsi_exit_procfs() do { } while (0)
136 #endif /* CONFIG_PROC_FS */
138 /* scsi_scan.c */
139 extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
140 unsigned int, unsigned int, int);
141 extern void scsi_forget_host(struct Scsi_Host *);
142 extern void scsi_rescan_device(struct device *);
144 /* scsi_sysctl.c */
145 #ifdef CONFIG_SYSCTL
146 extern int scsi_init_sysctl(void);
147 extern void scsi_exit_sysctl(void);
148 #else
149 # define scsi_init_sysctl() (0)
150 # define scsi_exit_sysctl() do { } while (0)
151 #endif /* CONFIG_SYSCTL */
153 /* scsi_sysfs.c */
154 extern void scsi_device_dev_release(struct device *);
155 extern int scsi_sysfs_add_sdev(struct scsi_device *);
156 extern int scsi_sysfs_add_host(struct Scsi_Host *);
157 extern int scsi_sysfs_register(void);
158 extern void scsi_sysfs_unregister(void);
159 extern struct scsi_transport_template blank_transport_template;
161 extern struct class sdev_class;
162 extern struct bus_type scsi_bus_type;
164 #endif /* _SCSI_PRIV_H */