Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  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  * These are the values that the owner field can take.
 17  * They are used as an indication of who the command belongs to.
 18  */
 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
 25 
 26 /*
 27  * Magic values for certain scsi structs. Shouldn't ever be used.
 28  */
 29 #define SCSI_CMND_MAGIC         0xE25C23A5
 30 #define SCSI_REQ_MAGIC          0x75F6D354
 31 
 32 /*
 33  *  Flag bit for the internal_timeout array
 34  */
 35 #define NORMAL_TIMEOUT          0
 36 
 37 /*
 38  * Scsi Error Handler Flags
 39  */
 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)
 48 
 49 #define SCSI_EH_CANCEL_CMD      0x0001  /* Cancel this cmd */
 50 #define SCSI_EH_REC_TIMEOUT     0x0002  /* EH retry timed out */
 51 
 52 #define SCSI_SENSE_VALID(scmd) \
 53         (((scmd)->sense_buffer[0] & 0x70) == 0x70)
 54 
 55 /*
 56  * Special value for scanning to specify scanning or rescanning of all
 57  * possible channels, (target) ids, or luns on a given shost.
 58  */
 59 #define SCAN_WILD_CARD  ~0
 60 
 61 /* hosts.c */
 62 extern int scsi_init_hosts(void);
 63 extern void scsi_exit_hosts(void);
 64 
 65 /* scsi.c */
 66 extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd);
 67 extern int scsi_setup_command_freelist(struct Scsi_Host *shost);
 68 extern void scsi_destroy_command_freelist(struct Scsi_Host *shost);
 69 extern void scsi_done(struct scsi_cmnd *cmd);
 70 extern int scsi_retry_command(struct scsi_cmnd *cmd);
 71 extern int scsi_insert_special_req(struct scsi_request *sreq, int);
 72 extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd,
 73                 struct scsi_request *sreq);
 74 extern void __scsi_release_request(struct scsi_request *sreq);
 75 extern void __scsi_done(struct scsi_cmnd *cmd);
 76 #ifdef CONFIG_SCSI_LOGGING
 77 void scsi_log_send(struct scsi_cmnd *cmd);
 78 void scsi_log_completion(struct scsi_cmnd *cmd, int disposition);
 79 #else
 80 static inline void scsi_log_send(struct scsi_cmnd *cmd) 
 81         { };
 82 static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
 83         { };
 84 #endif
 85 
 86 /* scsi_devinfo.c */
 87 extern int scsi_get_device_flags(struct scsi_device *sdev,
 88                                  unsigned char *vendor, unsigned char *model);
 89 extern int __init scsi_init_devinfo(void);
 90 extern void scsi_exit_devinfo(void);
 91 
 92 /* scsi_error.c */
 93 extern void scsi_times_out(struct scsi_cmnd *cmd);
 94 extern int scsi_error_handler(void *host);
 95 extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
 96 extern void scsi_eh_wakeup(struct Scsi_Host *shost);
 97 extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
 98 
 99 /* scsi_lib.c */
100 extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
101 extern void scsi_setup_cmd_retry(struct scsi_cmnd *cmd);
102 extern void scsi_device_unbusy(struct scsi_device *sdev);
103 extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
104 extern void scsi_next_command(struct scsi_cmnd *cmd);
105 extern void scsi_run_host_queues(struct Scsi_Host *shost);
106 extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
107 extern void scsi_free_queue(struct request_queue *q);
108 extern int scsi_init_queue(void);
109 extern void scsi_exit_queue(void);
110 
111 /* scsi_proc.c */
112 #ifdef CONFIG_SCSI_PROC_FS
113 extern void scsi_proc_hostdir_add(struct scsi_host_template *);
114 extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
115 extern void scsi_proc_host_add(struct Scsi_Host *);
116 extern void scsi_proc_host_rm(struct Scsi_Host *);
117 extern int scsi_init_procfs(void);
118 extern void scsi_exit_procfs(void);
119 #else
120 # define scsi_proc_hostdir_add(sht)     do { } while (0)
121 # define scsi_proc_hostdir_rm(sht)      do { } while (0)
122 # define scsi_proc_host_add(shost)      do { } while (0)
123 # define scsi_proc_host_rm(shost)       do { } while (0)
124 # define scsi_init_procfs()             (0)
125 # define scsi_exit_procfs()             do { } while (0)
126 #endif /* CONFIG_PROC_FS */
127 
128 /* scsi_scan.c */
129 extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
130                                    unsigned int, unsigned int, int);
131 extern void scsi_forget_host(struct Scsi_Host *);
132 extern void scsi_rescan_device(struct device *);
133 
134 /* scsi_sysctl.c */
135 #ifdef CONFIG_SYSCTL
136 extern int scsi_init_sysctl(void);
137 extern void scsi_exit_sysctl(void);
138 #else
139 # define scsi_init_sysctl()             (0)
140 # define scsi_exit_sysctl()             do { } while (0)
141 #endif /* CONFIG_SYSCTL */
142 
143 /* scsi_sysfs.c */
144 extern void scsi_device_dev_release(struct device *);
145 extern int scsi_sysfs_add_sdev(struct scsi_device *);
146 extern int scsi_sysfs_add_host(struct Scsi_Host *);
147 extern int scsi_sysfs_register(void);
148 extern void scsi_sysfs_unregister(void);
149 extern void scsi_sysfs_device_initialize(struct scsi_device *);
150 extern int scsi_sysfs_target_initialize(struct scsi_device *);
151 extern struct scsi_transport_template blank_transport_template;
152 
153 extern struct class sdev_class;
154 extern struct bus_type scsi_bus_type;
155 
156 /* 
157  * internal scsi timeout functions: for use by mid-layer and transport
158  * classes.
159  */
160 
161 #define SCSI_DEVICE_BLOCK_MAX_TIMEOUT   (HZ*60)
162 extern int scsi_internal_device_block(struct scsi_device *sdev);
163 extern int scsi_internal_device_unblock(struct scsi_device *sdev);
164 
165 #endif /* _SCSI_PRIV_H */
166 
  This page was automatically generated by the LXR engine.