atari_scsi.h 5.5 KB

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