scsi_priv.h 4.6 KB

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