Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | * Scsi Error Handler Flags |
| 23 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
| 26 | #define SCSI_SENSE_VALID(scmd) \ |
| 27 | (((scmd)->sense_buffer[0] & 0x70) == 0x70) |
| 28 | |
| 29 | /* |
| 30 | * Special value for scanning to specify scanning or rescanning of all |
| 31 | * possible channels, (target) ids, or luns on a given shost. |
| 32 | */ |
| 33 | #define SCAN_WILD_CARD ~0 |
| 34 | |
| 35 | /* hosts.c */ |
| 36 | extern int scsi_init_hosts(void); |
| 37 | extern void scsi_exit_hosts(void); |
| 38 | |
| 39 | /* scsi.c */ |
| 40 | extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd); |
| 41 | extern int scsi_setup_command_freelist(struct Scsi_Host *shost); |
| 42 | extern void scsi_destroy_command_freelist(struct Scsi_Host *shost); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | extern int scsi_insert_special_req(struct scsi_request *sreq, int); |
| 44 | extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, |
| 45 | struct scsi_request *sreq); |
| 46 | extern void __scsi_release_request(struct scsi_request *sreq); |
| 47 | extern void __scsi_done(struct scsi_cmnd *cmd); |
| 48 | #ifdef CONFIG_SCSI_LOGGING |
| 49 | void scsi_log_send(struct scsi_cmnd *cmd); |
| 50 | void scsi_log_completion(struct scsi_cmnd *cmd, int disposition); |
| 51 | #else |
| 52 | static inline void scsi_log_send(struct scsi_cmnd *cmd) |
| 53 | { }; |
| 54 | static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) |
| 55 | { }; |
| 56 | #endif |
| 57 | |
| 58 | /* scsi_devinfo.c */ |
| 59 | extern int scsi_get_device_flags(struct scsi_device *sdev, |
James Bottomley | 7f23e14 | 2005-12-01 12:50:13 -0600 | [diff] [blame^] | 60 | const unsigned char *vendor, |
| 61 | const unsigned char *model); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | extern int __init scsi_init_devinfo(void); |
| 63 | extern void scsi_exit_devinfo(void); |
| 64 | |
| 65 | /* scsi_error.c */ |
Christoph Hellwig | fe1b2d5 | 2005-09-06 14:15:37 +0200 | [diff] [blame] | 66 | extern void scsi_add_timer(struct scsi_cmnd *, int, |
| 67 | void (*)(struct scsi_cmnd *)); |
| 68 | extern int scsi_delete_timer(struct scsi_cmnd *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | extern void scsi_times_out(struct scsi_cmnd *cmd); |
| 70 | extern int scsi_error_handler(void *host); |
| 71 | extern int scsi_decide_disposition(struct scsi_cmnd *cmd); |
| 72 | extern void scsi_eh_wakeup(struct Scsi_Host *shost); |
| 73 | extern int scsi_eh_scmd_add(struct scsi_cmnd *, int); |
| 74 | |
| 75 | /* scsi_lib.c */ |
| 76 | extern int scsi_maybe_unblock_host(struct scsi_device *sdev); |
| 77 | extern void scsi_setup_cmd_retry(struct scsi_cmnd *cmd); |
| 78 | extern void scsi_device_unbusy(struct scsi_device *sdev); |
| 79 | extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason); |
| 80 | extern void scsi_next_command(struct scsi_cmnd *cmd); |
| 81 | extern void scsi_run_host_queues(struct Scsi_Host *shost); |
| 82 | extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev); |
| 83 | extern void scsi_free_queue(struct request_queue *q); |
| 84 | extern int scsi_init_queue(void); |
| 85 | extern void scsi_exit_queue(void); |
| 86 | |
| 87 | /* scsi_proc.c */ |
| 88 | #ifdef CONFIG_SCSI_PROC_FS |
| 89 | extern void scsi_proc_hostdir_add(struct scsi_host_template *); |
| 90 | extern void scsi_proc_hostdir_rm(struct scsi_host_template *); |
| 91 | extern void scsi_proc_host_add(struct Scsi_Host *); |
| 92 | extern void scsi_proc_host_rm(struct Scsi_Host *); |
| 93 | extern int scsi_init_procfs(void); |
| 94 | extern void scsi_exit_procfs(void); |
| 95 | #else |
| 96 | # define scsi_proc_hostdir_add(sht) do { } while (0) |
| 97 | # define scsi_proc_hostdir_rm(sht) do { } while (0) |
| 98 | # define scsi_proc_host_add(shost) do { } while (0) |
| 99 | # define scsi_proc_host_rm(shost) do { } while (0) |
| 100 | # define scsi_init_procfs() (0) |
| 101 | # define scsi_exit_procfs() do { } while (0) |
| 102 | #endif /* CONFIG_PROC_FS */ |
| 103 | |
| 104 | /* scsi_scan.c */ |
| 105 | extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int, |
| 106 | unsigned int, unsigned int, int); |
| 107 | extern void scsi_forget_host(struct Scsi_Host *); |
| 108 | extern void scsi_rescan_device(struct device *); |
| 109 | |
| 110 | /* scsi_sysctl.c */ |
| 111 | #ifdef CONFIG_SYSCTL |
| 112 | extern int scsi_init_sysctl(void); |
| 113 | extern void scsi_exit_sysctl(void); |
| 114 | #else |
| 115 | # define scsi_init_sysctl() (0) |
| 116 | # define scsi_exit_sysctl() do { } while (0) |
| 117 | #endif /* CONFIG_SYSCTL */ |
| 118 | |
| 119 | /* scsi_sysfs.c */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | extern int scsi_sysfs_add_sdev(struct scsi_device *); |
| 121 | extern int scsi_sysfs_add_host(struct Scsi_Host *); |
| 122 | extern int scsi_sysfs_register(void); |
| 123 | extern void scsi_sysfs_unregister(void); |
| 124 | extern void scsi_sysfs_device_initialize(struct scsi_device *); |
| 125 | extern int scsi_sysfs_target_initialize(struct scsi_device *); |
| 126 | extern struct scsi_transport_template blank_transport_template; |
Alan Stern | 903f4fe | 2005-07-26 10:20:53 -0400 | [diff] [blame] | 127 | extern void __scsi_remove_device(struct scsi_device *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | extern struct bus_type scsi_bus_type; |
| 130 | |
| 131 | /* |
| 132 | * internal scsi timeout functions: for use by mid-layer and transport |
| 133 | * classes. |
| 134 | */ |
| 135 | |
| 136 | #define SCSI_DEVICE_BLOCK_MAX_TIMEOUT (HZ*60) |
| 137 | extern int scsi_internal_device_block(struct scsi_device *sdev); |
| 138 | extern int scsi_internal_device_unblock(struct scsi_device *sdev); |
| 139 | |
| 140 | #endif /* _SCSI_PRIV_H */ |