mac53c94.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * mac53c94.h: definitions for the driver for the 53c94 SCSI bus adaptor
  4. * found on Power Macintosh computers, controlling the external SCSI chain.
  5. *
  6. * Copyright (C) 1996 Paul Mackerras.
  7. */
  8. #ifndef _MAC53C94_H
  9. #define _MAC53C94_H
  10. /*
  11. * Registers in the 53C94 controller.
  12. */
  13. struct mac53c94_regs {
  14. unsigned char count_lo;
  15. char pad0[15];
  16. unsigned char count_mid;
  17. char pad1[15];
  18. unsigned char fifo;
  19. char pad2[15];
  20. unsigned char command;
  21. char pad3[15];
  22. unsigned char status;
  23. char pad4[15];
  24. unsigned char interrupt;
  25. char pad5[15];
  26. unsigned char seqstep;
  27. char pad6[15];
  28. unsigned char flags;
  29. char pad7[15];
  30. unsigned char config1;
  31. char pad8[15];
  32. unsigned char clk_factor;
  33. char pad9[15];
  34. unsigned char test;
  35. char pad10[15];
  36. unsigned char config2;
  37. char pad11[15];
  38. unsigned char config3;
  39. char pad12[15];
  40. unsigned char config4;
  41. char pad13[15];
  42. unsigned char count_hi;
  43. char pad14[15];
  44. unsigned char fifo_res;
  45. char pad15[15];
  46. };
  47. /*
  48. * Alternate functions for some registers.
  49. */
  50. #define dest_id status
  51. #define sel_timeout interrupt
  52. #define sync_period seqstep
  53. #define sync_offset flags
  54. /*
  55. * Bits in command register.
  56. */
  57. #define CMD_DMA_MODE 0x80
  58. #define CMD_MODE_MASK 0x70
  59. #define CMD_MODE_INIT 0x10
  60. #define CMD_MODE_TARG 0x20
  61. #define CMD_MODE_DISC 0x40
  62. #define CMD_NOP 0
  63. #define CMD_FLUSH 1
  64. #define CMD_RESET 2
  65. #define CMD_SCSI_RESET 3
  66. #define CMD_XFER_DATA 0x10
  67. #define CMD_I_COMPLETE 0x11
  68. #define CMD_ACCEPT_MSG 0x12
  69. #define CMD_XFER_PAD 0x18
  70. #define CMD_SET_ATN 0x1a
  71. #define CMD_CLR_ATN 0x1b
  72. #define CMD_SEND_MSG 0x20
  73. #define CMD_SEND_STATUS 0x21
  74. #define CMD_SEND_DATA 0x22
  75. #define CMD_DISC_SEQ 0x23
  76. #define CMD_TERMINATE 0x24
  77. #define CMD_T_COMPLETE 0x25
  78. #define CMD_DISCONNECT 0x27
  79. #define CMD_RECV_MSG 0x28
  80. #define CMD_RECV_CDB 0x29
  81. #define CMD_RECV_DATA 0x2a
  82. #define CMD_RECV_CMD 0x2b
  83. #define CMD_ABORT_DMA 0x04
  84. #define CMD_RESELECT 0x40
  85. #define CMD_SELECT 0x41
  86. #define CMD_SELECT_ATN 0x42
  87. #define CMD_SELATN_STOP 0x43
  88. #define CMD_ENABLE_SEL 0x44
  89. #define CMD_DISABLE_SEL 0x45
  90. #define CMD_SEL_ATN3 0x46
  91. #define CMD_RESEL_ATN3 0x47
  92. /*
  93. * Bits in status register.
  94. */
  95. #define STAT_IRQ 0x80
  96. #define STAT_ERROR 0x40
  97. #define STAT_PARITY 0x20
  98. #define STAT_TC_ZERO 0x10
  99. #define STAT_DONE 0x08
  100. #define STAT_PHASE 0x07
  101. #define STAT_MSG 0x04
  102. #define STAT_CD 0x02
  103. #define STAT_IO 0x01
  104. /*
  105. * Bits in interrupt register.
  106. */
  107. #define INTR_RESET 0x80 /* SCSI bus was reset */
  108. #define INTR_ILL_CMD 0x40 /* illegal command */
  109. #define INTR_DISCONNECT 0x20 /* we got disconnected */
  110. #define INTR_BUS_SERV 0x10 /* bus service requested */
  111. #define INTR_DONE 0x08 /* function completed */
  112. #define INTR_RESELECTED 0x04 /* we were reselected */
  113. #define INTR_SEL_ATN 0x02 /* we were selected, ATN asserted */
  114. #define INTR_SELECT 0x01 /* we were selected, ATN negated */
  115. /*
  116. * Encoding for the select timeout.
  117. */
  118. #define TIMO_VAL(x) ((x) * 5000 / 7682)
  119. /*
  120. * Bits in sequence step register.
  121. */
  122. #define SS_MASK 7
  123. #define SS_ARB_SEL 0 /* Selection & arbitration complete */
  124. #define SS_MSG_SENT 1 /* One message byte sent */
  125. #define SS_NOT_CMD 2 /* Not in command phase */
  126. #define SS_PHASE_CHG 3 /* Early phase change, cmd bytes lost */
  127. #define SS_DONE 4 /* Command was sent OK */
  128. /*
  129. * Encoding for sync transfer period.
  130. */
  131. #define SYNCP_MASK 0x1f
  132. #define SYNCP_MIN 4
  133. #define SYNCP_MAX 31
  134. /*
  135. * Bits in flags register.
  136. */
  137. #define FLAGS_FIFO_LEV 0x1f
  138. #define FLAGS_SEQ_STEP 0xe0
  139. /*
  140. * Encoding for sync offset.
  141. */
  142. #define SYNCO_MASK 0x0f
  143. #define SYNCO_ASS_CTRL 0x30 /* REQ/ACK assertion control */
  144. #define SYNCO_NEG_CTRL 0xc0 /* REQ/ACK negation control */
  145. /*
  146. * Bits in config1 register.
  147. */
  148. #define CF1_SLOW_CABLE 0x80 /* Slow cable mode */
  149. #define CF1_NO_RES_REP 0x40 /* Disable SCSI reset reports */
  150. #define CF1_PAR_TEST 0x20 /* Parity test mode enable */
  151. #define CF1_PAR_ENABLE 0x10 /* Enable parity checks */
  152. #define CF1_TEST 0x08 /* Chip tests */
  153. #define CF1_MY_ID 0x07 /* Controller's address on bus */
  154. /*
  155. * Encoding for clk_factor register.
  156. */
  157. #define CLKF_MASK 7
  158. #define CLKF_VAL(freq) ((((freq) + 4999999) / 5000000) & CLKF_MASK)
  159. /*
  160. * Bits in test mode register.
  161. */
  162. #define TEST_TARGET 1 /* target test mode */
  163. #define TEST_INITIATOR 2 /* initiator test mode */
  164. #define TEST_TRISTATE 4 /* tristate (hi-z) test mode */
  165. /*
  166. * Bits in config2 register.
  167. */
  168. #define CF2_RFB 0x80
  169. #define CF2_FEATURE_EN 0x40 /* enable features / phase latch */
  170. #define CF2_BYTECTRL 0x20
  171. #define CF2_DREQ_HIZ 0x10
  172. #define CF2_SCSI2 0x08
  173. #define CF2_PAR_ABORT 0x04 /* bad parity target abort */
  174. #define CF2_REG_PARERR 0x02 /* register parity error */
  175. #define CF2_DMA_PARERR 0x01 /* DMA parity error */
  176. /*
  177. * Bits in the config3 register.
  178. */
  179. #define CF3_ID_MSG_CHK 0x80
  180. #define CF3_3B_MSGS 0x40
  181. #define CF3_CDB10 0x20
  182. #define CF3_FASTSCSI 0x10 /* enable fast SCSI support */
  183. #define CF3_FASTCLOCK 0x08
  184. #define CF3_SAVERESID 0x04
  185. #define CF3_ALT_DMA 0x02
  186. #define CF3_THRESH_8 0x01
  187. /*
  188. * Bits in the config4 register.
  189. */
  190. #define CF4_EAN 0x04
  191. #define CF4_TEST 0x02
  192. #define CF4_BBTE 0x01
  193. #endif /* _MAC53C94_H */