mac53c94.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:6k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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