sun3_scsi.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. * Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl)
  3. *
  4. * Sun3 DMA additions by Sam Creasey (sammy@sammy.net)
  5. *
  6. * Adapted from mac_scsinew.h:
  7. */
  8. /*
  9. * Cumana Generic NCR5380 driver defines
  10. *
  11. * Copyright 1993, Drew Eckhardt
  12. * Visionary Computing
  13. * (Unix and Linux consulting and custom programming)
  14. * drew@colorado.edu
  15. * +1 (303) 440-4894
  16. *
  17. * ALPHA RELEASE 1.
  18. *
  19. * For more information, please consult
  20. *
  21. * NCR 5380 Family
  22. * SCSI Protocol Controller
  23. * Databook
  24. *
  25. * NCR Microelectronics
  26. * 1635 Aeroplaza Drive
  27. * Colorado Springs, CO 80916
  28. * 1+ (719) 578-3400
  29. * 1+ (800) 334-5454
  30. */
  31. #ifndef SUN3_SCSI_H
  32. #define SUN3_SCSI_H
  33. #define SUN3SCSI_PUBLIC_RELEASE 1
  34. /*
  35. * Int: level 2 autovector
  36. * IO: type 1, base 0x00140000, 5 bits phys space: A<4..0>
  37. */
  38. #define IRQ_SUN3_SCSI 2
  39. #define IOBASE_SUN3_SCSI 0x00140000
  40. #define IOBASE_SUN3_VMESCSI 0xff200000
  41. static int sun3scsi_abort(struct scsi_cmnd *);
  42. static int sun3scsi_detect (struct scsi_host_template *);
  43. static const char *sun3scsi_info (struct Scsi_Host *);
  44. static int sun3scsi_bus_reset(struct scsi_cmnd *);
  45. static int sun3scsi_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
  46. static int sun3scsi_release (struct Scsi_Host *);
  47. #ifndef CMD_PER_LUN
  48. #define CMD_PER_LUN 2
  49. #endif
  50. #ifndef CAN_QUEUE
  51. #define CAN_QUEUE 16
  52. #endif
  53. #ifndef SG_TABLESIZE
  54. #define SG_TABLESIZE SG_NONE
  55. #endif
  56. #ifndef MAX_TAGS
  57. #define MAX_TAGS 32
  58. #endif
  59. #ifndef USE_TAGGED_QUEUING
  60. #define USE_TAGGED_QUEUING 1
  61. #endif
  62. #include <scsi/scsicam.h>
  63. #ifdef SUN3_SCSI_VME
  64. #define SUN3_SCSI_NAME "Sun3 NCR5380 VME SCSI"
  65. #else
  66. #define SUN3_SCSI_NAME "Sun3 NCR5380 SCSI"
  67. #endif
  68. #define NCR5380_implementation_fields \
  69. int port, ctrl
  70. #define NCR5380_local_declare() \
  71. struct Scsi_Host *_instance
  72. #define NCR5380_setup(instance) \
  73. _instance = instance
  74. #define NCR5380_read(reg) sun3scsi_read(reg)
  75. #define NCR5380_write(reg, value) sun3scsi_write(reg, value)
  76. #define NCR5380_intr sun3scsi_intr
  77. #define NCR5380_queue_command sun3scsi_queue_command
  78. #define NCR5380_bus_reset sun3scsi_bus_reset
  79. #define NCR5380_abort sun3scsi_abort
  80. #define NCR5380_show_info sun3scsi_show_info
  81. #define NCR5380_dma_xfer_len(i, cmd, phase) \
  82. sun3scsi_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1)
  83. #define NCR5380_dma_write_setup(instance, data, count) sun3scsi_dma_setup(data, count, 1)
  84. #define NCR5380_dma_read_setup(instance, data, count) sun3scsi_dma_setup(data, count, 0)
  85. #define NCR5380_dma_residual sun3scsi_dma_residual
  86. /* additional registers - mainly DMA control regs */
  87. /* these start at regbase + 8 -- directly after the NCR regs */
  88. struct sun3_dma_regs {
  89. unsigned short dma_addr_hi; /* vme only */
  90. unsigned short dma_addr_lo; /* vme only */
  91. unsigned short dma_count_hi; /* vme only */
  92. unsigned short dma_count_lo; /* vme only */
  93. unsigned short udc_data; /* udc dma data reg (obio only) */
  94. unsigned short udc_addr; /* uda dma addr reg (obio only) */
  95. unsigned short fifo_data; /* fifo data reg, holds extra byte on
  96. odd dma reads */
  97. unsigned short fifo_count;
  98. unsigned short csr; /* control/status reg */
  99. unsigned short bpack_hi; /* vme only */
  100. unsigned short bpack_lo; /* vme only */
  101. unsigned short ivect; /* vme only */
  102. unsigned short fifo_count_hi; /* vme only */
  103. };
  104. /* ucd chip specific regs - live in dvma space */
  105. struct sun3_udc_regs {
  106. unsigned short rsel; /* select regs to load */
  107. unsigned short addr_hi; /* high word of addr */
  108. unsigned short addr_lo; /* low word */
  109. unsigned short count; /* words to be xfer'd */
  110. unsigned short mode_hi; /* high word of channel mode */
  111. unsigned short mode_lo; /* low word of channel mode */
  112. };
  113. /* addresses of the udc registers */
  114. #define UDC_MODE 0x38
  115. #define UDC_CSR 0x2e /* command/status */
  116. #define UDC_CHN_HI 0x26 /* chain high word */
  117. #define UDC_CHN_LO 0x22 /* chain lo word */
  118. #define UDC_CURA_HI 0x1a /* cur reg A high */
  119. #define UDC_CURA_LO 0x0a /* cur reg A low */
  120. #define UDC_CURB_HI 0x12 /* cur reg B high */
  121. #define UDC_CURB_LO 0x02 /* cur reg B low */
  122. #define UDC_MODE_HI 0x56 /* mode reg high */
  123. #define UDC_MODE_LO 0x52 /* mode reg low */
  124. #define UDC_COUNT 0x32 /* words to xfer */
  125. /* some udc commands */
  126. #define UDC_RESET 0
  127. #define UDC_CHN_START 0xa0 /* start chain */
  128. #define UDC_INT_ENABLE 0x32 /* channel 1 int on */
  129. /* udc mode words */
  130. #define UDC_MODE_HIWORD 0x40
  131. #define UDC_MODE_LSEND 0xc2
  132. #define UDC_MODE_LRECV 0xd2
  133. /* udc reg selections */
  134. #define UDC_RSEL_SEND 0x282
  135. #define UDC_RSEL_RECV 0x182
  136. /* bits in csr reg */
  137. #define CSR_DMA_ACTIVE 0x8000
  138. #define CSR_DMA_CONFLICT 0x4000
  139. #define CSR_DMA_BUSERR 0x2000
  140. #define CSR_FIFO_EMPTY 0x400 /* fifo flushed? */
  141. #define CSR_SDB_INT 0x200 /* sbc interrupt pending */
  142. #define CSR_DMA_INT 0x100 /* dma interrupt pending */
  143. #define CSR_LEFT 0xc0
  144. #define CSR_LEFT_3 0xc0
  145. #define CSR_LEFT_2 0x80
  146. #define CSR_LEFT_1 0x40
  147. #define CSR_PACK_ENABLE 0x20
  148. #define CSR_DMA_ENABLE 0x10
  149. #define CSR_SEND 0x8 /* 1 = send 0 = recv */
  150. #define CSR_FIFO 0x2 /* reset fifo */
  151. #define CSR_INTR 0x4 /* interrupt enable */
  152. #define CSR_SCSI 0x1
  153. #define VME_DATA24 0x3d00
  154. #endif /* SUN3_SCSI_H */