scsi_priv.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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_times_out(struct scsi_cmnd *cmd);
  56. extern int scsi_error_handler(void *host);
  57. extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
  58. extern void scsi_eh_wakeup(struct Scsi_Host *shost);
  59. extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
  60. /* scsi_lib.c */
  61. extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
  62. extern void scsi_setup_cmd_retry(struct scsi_cmnd *cmd);
  63. extern void scsi_device_unbusy(struct scsi_device *sdev);
  64. extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
  65. extern void scsi_next_command(struct scsi_cmnd *cmd);
  66. extern void scsi_run_host_queues(struct Scsi_Host *shost);
  67. extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
  68. extern void scsi_free_queue(struct request_queue *q);
  69. extern int scsi_init_queue(void);
  70. extern void scsi_exit_queue(void);
  71. /* scsi_proc.c */
  72. #ifdef CONFIG_SCSI_PROC_FS
  73. extern void scsi_proc_hostdir_add(struct scsi_host_template *);
  74. extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
  75. extern void scsi_proc_host_add(struct Scsi_Host *);
  76. extern void scsi_proc_host_rm(struct Scsi_Host *);
  77. extern int scsi_init_procfs(void);
  78. extern void scsi_exit_procfs(void);
  79. #else
  80. # define scsi_proc_hostdir_add(sht) do { } while (0)
  81. # define scsi_proc_hostdir_rm(sht) do { } while (0)
  82. # define scsi_proc_host_add(shost) do { } while (0)
  83. # define scsi_proc_host_rm(shost) do { } while (0)
  84. # define scsi_init_procfs() (0)
  85. # define scsi_exit_procfs() do { } while (0)
  86. #endif /* CONFIG_PROC_FS */
  87. /* scsi_scan.c */
  88. extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
  89. unsigned int, unsigned int, int);
  90. extern void scsi_forget_host(struct Scsi_Host *);
  91. extern void scsi_rescan_device(struct device *);
  92. /* scsi_sysctl.c */
  93. #ifdef CONFIG_SYSCTL
  94. extern int scsi_init_sysctl(void);
  95. extern void scsi_exit_sysctl(void);
  96. #else
  97. # define scsi_init_sysctl() (0)
  98. # define scsi_exit_sysctl() do { } while (0)
  99. #endif /* CONFIG_SYSCTL */
  100. /* scsi_sysfs.c */
  101. extern int scsi_sysfs_add_sdev(struct scsi_device *);
  102. extern int scsi_sysfs_add_host(struct Scsi_Host *);
  103. extern int scsi_sysfs_register(void);
  104. extern void scsi_sysfs_unregister(void);
  105. extern void scsi_sysfs_device_initialize(struct scsi_device *);
  106. extern int scsi_sysfs_target_initialize(struct scsi_device *);
  107. extern struct scsi_transport_template blank_transport_template;
  108. extern struct bus_type scsi_bus_type;
  109. /*
  110. * internal scsi timeout functions: for use by mid-layer and transport
  111. * classes.
  112. */
  113. #define SCSI_DEVICE_BLOCK_MAX_TIMEOUT (HZ*60)
  114. extern int scsi_internal_device_block(struct scsi_device *sdev);
  115. extern int scsi_internal_device_unblock(struct scsi_device *sdev);
  116. #endif /* _SCSI_PRIV_H */