atari_scsi.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * atari_scsi.h -- Header file for the Atari native SCSI driver
  3. *
  4. * Copyright 1994 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
  5. *
  6. * (Loosely based on the work of Robert De Vries' team)
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file COPYING in the main directory of this archive
  10. * for more details.
  11. *
  12. */
  13. #ifndef ATARI_SCSI_H
  14. #define ATARI_SCSI_H
  15. /* (I_HAVE_OVERRUNS stuff removed) */
  16. #ifndef ASM
  17. int atari_scsi_detect (struct scsi_host_template *);
  18. const char *atari_scsi_info (struct Scsi_Host *);
  19. int atari_scsi_reset (Scsi_Cmnd *, unsigned int);
  20. int atari_scsi_release (struct Scsi_Host *);
  21. /* The values for CMD_PER_LUN and CAN_QUEUE are somehow arbitrary. Higher
  22. * values should work, too; try it! (but cmd_per_lun costs memory!) */
  23. /* But there seems to be a bug somewhere that requires CAN_QUEUE to be
  24. * 2*CMD_PER_LUN. At least on a TT, no spurious timeouts seen since
  25. * changed CMD_PER_LUN... */
  26. /* Note: The Falcon currently uses 8/1 setting due to unsolved problems with
  27. * cmd_per_lun != 1 */
  28. #define ATARI_TT_CAN_QUEUE 16
  29. #define ATARI_TT_CMD_PER_LUN 8
  30. #define ATARI_TT_SG_TABLESIZE SG_ALL
  31. #define ATARI_FALCON_CAN_QUEUE 8
  32. #define ATARI_FALCON_CMD_PER_LUN 1
  33. #define ATARI_FALCON_SG_TABLESIZE SG_NONE
  34. #define DEFAULT_USE_TAGGED_QUEUING 0
  35. #define NCR5380_implementation_fields /* none */
  36. #define NCR5380_read(reg) atari_scsi_reg_read( reg )
  37. #define NCR5380_write(reg, value) atari_scsi_reg_write( reg, value )
  38. #define NCR5380_intr atari_scsi_intr
  39. #define NCR5380_queue_command atari_scsi_queue_command
  40. #define NCR5380_abort atari_scsi_abort
  41. #define NCR5380_proc_info atari_scsi_proc_info
  42. #define NCR5380_dma_read_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 0)
  43. #define NCR5380_dma_write_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 1)
  44. #define NCR5380_dma_residual(inst) atari_scsi_dma_residual( inst )
  45. #define NCR5380_dma_xfer_len(i,cmd,phase) \
  46. atari_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1)
  47. /* former generic SCSI error handling stuff */
  48. #define SCSI_ABORT_SNOOZE 0
  49. #define SCSI_ABORT_SUCCESS 1
  50. #define SCSI_ABORT_PENDING 2
  51. #define SCSI_ABORT_BUSY 3
  52. #define SCSI_ABORT_NOT_RUNNING 4
  53. #define SCSI_ABORT_ERROR 5
  54. #define SCSI_RESET_SNOOZE 0
  55. #define SCSI_RESET_PUNT 1
  56. #define SCSI_RESET_SUCCESS 2
  57. #define SCSI_RESET_PENDING 3
  58. #define SCSI_RESET_WAKEUP 4
  59. #define SCSI_RESET_NOT_RUNNING 5
  60. #define SCSI_RESET_ERROR 6
  61. #define SCSI_RESET_SYNCHRONOUS 0x01
  62. #define SCSI_RESET_ASYNCHRONOUS 0x02
  63. #define SCSI_RESET_SUGGEST_BUS_RESET 0x04
  64. #define SCSI_RESET_SUGGEST_HOST_RESET 0x08
  65. #define SCSI_RESET_BUS_RESET 0x100
  66. #define SCSI_RESET_HOST_RESET 0x200
  67. #define SCSI_RESET_ACTION 0xff
  68. /* Debugging printk definitions:
  69. *
  70. * ARB -> arbitration
  71. * ASEN -> auto-sense
  72. * DMA -> DMA
  73. * HSH -> PIO handshake
  74. * INF -> information transfer
  75. * INI -> initialization
  76. * INT -> interrupt
  77. * LNK -> linked commands
  78. * MAIN -> NCR5380_main() control flow
  79. * NDAT -> no data-out phase
  80. * NWR -> no write commands
  81. * PIO -> PIO transfers
  82. * PDMA -> pseudo DMA (unused on Atari)
  83. * QU -> queues
  84. * RSL -> reselections
  85. * SEL -> selections
  86. * USL -> usleep cpde (unused on Atari)
  87. * LBS -> last byte sent (unused on Atari)
  88. * RSS -> restarting of selections
  89. * EXT -> extended messages
  90. * ABRT -> aborting and resetting
  91. * TAG -> queue tag handling
  92. * MER -> merging of consec. buffers
  93. *
  94. */
  95. #define dprint(flg, format...) \
  96. ({ \
  97. if (NDEBUG & (flg)) \
  98. printk(KERN_DEBUG format); \
  99. })
  100. #define ARB_PRINTK(format, args...) \
  101. dprint(NDEBUG_ARBITRATION, format , ## args)
  102. #define ASEN_PRINTK(format, args...) \
  103. dprint(NDEBUG_AUTOSENSE, format , ## args)
  104. #define DMA_PRINTK(format, args...) \
  105. dprint(NDEBUG_DMA, format , ## args)
  106. #define HSH_PRINTK(format, args...) \
  107. dprint(NDEBUG_HANDSHAKE, format , ## args)
  108. #define INF_PRINTK(format, args...) \
  109. dprint(NDEBUG_INFORMATION, format , ## args)
  110. #define INI_PRINTK(format, args...) \
  111. dprint(NDEBUG_INIT, format , ## args)
  112. #define INT_PRINTK(format, args...) \
  113. dprint(NDEBUG_INTR, format , ## args)
  114. #define LNK_PRINTK(format, args...) \
  115. dprint(NDEBUG_LINKED, format , ## args)
  116. #define MAIN_PRINTK(format, args...) \
  117. dprint(NDEBUG_MAIN, format , ## args)
  118. #define NDAT_PRINTK(format, args...) \
  119. dprint(NDEBUG_NO_DATAOUT, format , ## args)
  120. #define NWR_PRINTK(format, args...) \
  121. dprint(NDEBUG_NO_WRITE, format , ## args)
  122. #define PIO_PRINTK(format, args...) \
  123. dprint(NDEBUG_PIO, format , ## args)
  124. #define PDMA_PRINTK(format, args...) \
  125. dprint(NDEBUG_PSEUDO_DMA, format , ## args)
  126. #define QU_PRINTK(format, args...) \
  127. dprint(NDEBUG_QUEUES, format , ## args)
  128. #define RSL_PRINTK(format, args...) \
  129. dprint(NDEBUG_RESELECTION, format , ## args)
  130. #define SEL_PRINTK(format, args...) \
  131. dprint(NDEBUG_SELECTION, format , ## args)
  132. #define USL_PRINTK(format, args...) \
  133. dprint(NDEBUG_USLEEP, format , ## args)
  134. #define LBS_PRINTK(format, args...) \
  135. dprint(NDEBUG_LAST_BYTE_SENT, format , ## args)
  136. #define RSS_PRINTK(format, args...) \
  137. dprint(NDEBUG_RESTART_SELECT, format , ## args)
  138. #define EXT_PRINTK(format, args...) \
  139. dprint(NDEBUG_EXTENDED, format , ## args)
  140. #define ABRT_PRINTK(format, args...) \
  141. dprint(NDEBUG_ABORT, format , ## args)
  142. #define TAG_PRINTK(format, args...) \
  143. dprint(NDEBUG_TAGS, format , ## args)
  144. #define MER_PRINTK(format, args...) \
  145. dprint(NDEBUG_MERGING, format , ## args)
  146. /* conditional macros for NCR5380_print_{,phase,status} */
  147. #define NCR_PRINT(mask) \
  148. ((NDEBUG & (mask)) ? NCR5380_print(instance) : (void)0)
  149. #define NCR_PRINT_PHASE(mask) \
  150. ((NDEBUG & (mask)) ? NCR5380_print_phase(instance) : (void)0)
  151. #define NCR_PRINT_STATUS(mask) \
  152. ((NDEBUG & (mask)) ? NCR5380_print_status(instance) : (void)0)
  153. #endif /* ndef ASM */
  154. #endif /* ATARI_SCSI_H */