sym895.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:42k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* sym895.h - SYM 895 Script SCSI Controller header file */
  2. /* Copyright 1989-2000 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01b,23jun00,bsp  added description for register access mode macro.
  7. 01a,06feb00,bsp  Created ; adapted from ncr810.h.
  8. */
  9. #ifndef __INCsym895h
  10. #define __INCsym895h
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #ifndef _ASMLANGUAGE
  15. #include "semLib.h"
  16. #include "scsiLib.h"
  17. /* Bit register definitions for the SYM895 */
  18. /* SCSI Control Zero - SCNTL0 */
  19. #define SYM895_SCNTL0_ARB1     0x80  /* Arbitration Control Bits. */
  20. #define SYM895_SCNTL0_ARB0     0x40  /* define Simple or Full arbitration. */
  21. #define SYM895_SCNTL0_START    0x20  /* Start arbitration sequence */
  22. #define SYM895_SCNTL0_WATN     0x10  /* SATN/signal ctrl on Start sequence */
  23. #define SYM895_SCNTL0_EPC      0x08  /* Parity Check enable */
  24. #define SYM895_SCNTL0_AAP      0x02  /* SATN/ signal control on Parity Error */
  25. #define SYM895_SCNTL0_TRG      0x01  /* Initator/Target mode set */
  26. /* SCSI Control One - SCNTL1 */
  27. #define SYM895_SCNTL1_EXC      0x80  /* Extra Clock Period for data setup */
  28. #define SYM895_SCNTL1_ADB      0x40  /* Asset SCSI Data Bus */
  29. #define SYM895_SCNTL1_DHP      0x20  /* Disable Halt on Parity/ATN (tgt only) */
  30. #define SYM895_SCNTL1_CON      0x10  /* Bus Connection status */
  31. #define SYM895_SCNTL1_RST      0x08  /* Assert RST/ */
  32. #define SYM895_SCNTL1_AESP     0x04  /* Force parity error on SCSI Bus */
  33. #define SYM895_SCNTL1_IARB     0x02  /* Immediate arbitration */
  34. #define SYM895_SCNTL1_SST      0x01  /* Start SCSI transfer */
  35. /* SCNTL2 */
  36. #define SYM895_SCNTL2_SDU      0x80  /* SCSI Disconnect Unexpected */
  37. #define SYM895_SCNTL2_CHM      0x40  /* Chained Move (automatically set/reset)*/
  38. #define SYM895_SCNTL2_SLPMD    0x20  /* Longitudianal parity mode related */
  39. #define SYM895_SCNTL2_SLPHBEN  0x10  /* Longitudianal parity mode related */
  40. #define SYM895_SCNTL2_WSS      0x08  /* Wide SCSI Send */
  41. #define SYM895_SCNTL2_VUE0     0x04  /* Vendor Unique Enhansements related */
  42. #define SYM895_SCNTL2_VUE1     0x02  /* Vendor Unique Enhansements related */
  43. #define SYM895_SCNTL2_WSR      0x01  /* Wide SCSI Receive */
  44.  
  45. /* SCNTL3 */
  46. #define SYM895_SCNTL3_ULTRA    0x80  /* Ultra Enable */
  47. #define SYM895_SCNTL3_SCF_MASK 0x70  /* Syncronous Clock Conv. Factor bits */
  48. #define SYM895_SCNTL3_EWS      0x08  /* Enable WIDE SCSI */
  49. #define SYM895_SCNTL3_CCF_MASK 0x07  /* Clock Conversion Factor bits */
  50. /* SCID */
  51. #define SYM895_SCID_RRE        0x40  /* Enable Response to Reselection */
  52. #define SYM895_SCID_SRE        0x20  /* Enable Response to Selection   */
  53. #define SYM895_SCID_ENC_MASK   0x0f  /* The Encoded SCSI ID mask */
  54. /* SXFER */
  55. #define SYM895_SXFER_XFERP_MASK   0xE0 /* Synchronous transfer period */
  56. #define SYM895_SXFER_OFF_MASK     0x1f /* Sync. Transfer Max. Offset period */
  57. /* SDID */
  58. #define SYM895_SDID_ENC_MASK      0x0f /* The Encoded SCSI ID mask */
  59. /* GPREG */
  60. #define SYM895_GPREG_MASK         0x1f /* Mask for IO pins */
  61. #define SYM895_GPREG_GPIO4        0x10 /* Programmable IO Pin */
  62. #define SYM895_GPREG_GPIO3        0x08 /* Programmable IO Pin */
  63. #define SYM895_GPREG_GPIO2        0x04 /* Programmable IO Pin */
  64. #define SYM895_GPREG_GPIO1        0x02 /* Programmable IO Pin */
  65. #define SYM895_GPREG_GPIO0        0x01 /* Programmable IO Pin */
  66. /* SOCL */
  67. #define SYM895_SOCL_REQ           0x80 /* Assert SCSI REQ/ signal */
  68. #define SYM895_SOCL_ACK           0x40 /* Assert SCSI ACK/ signal */
  69. #define SYM895_SOCL_BSY           0x20 /* Assert SCSI BSY/ signal */
  70. #define SYM895_SOCL_SEL           0x10 /* Assert SCSI SEL/ signal */
  71. #define SYM895_SOCL_ATN           0x08 /* Assert SCSI ATN/ signal */
  72. #define SYM895_SOCL_MSG           0x04 /* Assert SCSI MSG/ signal */
  73. #define SYM895_SOCL_CD            0x02 /* Assert SCSI CD/ signal */
  74. #define SYM895_SOCL_IO            0x01 /* Assert SCSI IO/ signal */
  75. /* SSID */
  76. #define SYM895_SSID_VAL           0x80  /* SCSI Valid Bit.*/
  77. #define SYM895_SSID_ENC_MASK      0x0f   /* Binary encoded SCSI ID mask 0-15 */
  78. /* SBCL */
  79. #define SYM895_SBCL_REQ           0x80   /* Get  SCSI REQ/ Status */
  80. #define SYM895_SBCL_ACK           0x40   /* Get  SCSI ACK/ Status */
  81. #define SYM895_SBCL_BSY           0x20   /* Get  SCSI BSY/ Status */
  82. #define SYM895_SBCL_SEL           0x10   /* Get  SCSI SEL/ Status */
  83. #define SYM895_SBCL_ATN           0x08   /* Get  SCSI ATN/ Status */
  84. #define SYM895_SBCL_MSG           0x04   /* Get  SCSI MSG/ Status */
  85. #define SYM895_SBCL_CD            0x02   /* Get  SCSI CD/ Status  */
  86. #define SYM895_SBCL_IO            0x01   /* Get  SCSI IO/ Status  */
  87. /* DSTAT (RO) and DIEN (RW enable intr) */
  88. #define SYM895_B_DFE              0x80   /* Dma fifo empty */
  89. #define SYM895_B_MDPE             0x40   /* Master Data Parity Error */
  90. #define SYM895_B_BF               0x20  /* Bus Fault */
  91. #define SYM895_B_ABT              0x10  /* Abort condition */
  92. #define SYM895_B_SSI              0x08  /* Scsi Step Interrupt */
  93. #define SYM895_B_SIR              0x04  /* Script Interrupt received */
  94. #define SYM895_B_IID              0x01  /* Illegal Instruction Detected */
  95. /* SSTAT0 */
  96. #define SYM895_SSTAT0_ILF         0x80   /* SIDL Input Latch Full */
  97. #define SYM895_SSTAT0_ORF         0x40   /* SODR Output Register Full */
  98. #define SYM895_SSTAT0_OLF         0x20   /* SODL Output Latch Full */
  99. #define SYM895_SSTAT0_AIP         0x10   /* Arbitration In Progress */ 
  100. #define SYM895_SSTAT0_LOA         0x08   /* LOst Arbitration */
  101. #define SYM895_SSTAT0_WOA         0x04   /* WOn Arbitration */
  102. #define SYM895_SSTAT0_RST         0x02   /* SCSI ReSeT signal in ISTAT reg */
  103. #define SYM895_SSTAT0_SDP0        0x01   /* SCSI SDP/0 parity signal */
  104. /* SSTAT1 RO register */
  105. #define SYM895_SSTAT1_FIFO_MASK   0xf0   /* Also..see the SSTAT2 register */
  106. #define SYM895_SSTAT1_SDP0L       0x08   /* Parity for latched scsi i/p data */
  107. #define SYM895_SSTAT1_MSG         0x04   /* SCSI:MSG Signal, latched */
  108. #define SYM895_SSTAT1_CD          0x04  /* SCSI:CD Signal,Latched */
  109. #define SYM895_SSTAT1_IO          0x04   /* SCSI:IO Signal, Latched */
  110. /* SSTAT2 */
  111. #define SYM895_SSTAT2_ILF1        0x80   /* SIDL MSB full */
  112. #define SYM895_SSTAT2_ORF1        0x40   /* SODR MSB full */
  113. #define SYM895_SSTAT2_OLF1        0x20   /* SODL MSB full */
  114. #define SYM895_SSTAT2_FF4         0x10   /* FIFO flags bit 4 */
  115. #define SYM895_SSTAT2_SPL1        0x08   /* Latched SCSI Parity for SIDL */
  116. #define SYM895_SSTAT2_DM          0x04   /* DIFFSENS Mismatch */
  117. #define SYM895_SSTAT2_LDSC        0x02   /* Last Disconnect;used in */
  118.                                          /* conjunction with CON bit in SCNTL1*/
  119. #define SYM895_SSTAT2_SDP1        0x01   /* SCSI SDP1/ parity signal */
  120. /* ISTAT RW register */
  121. #define SYM895_ISTAT_ABRT         0x80  /* Abort operation */
  122. #define SYM895_ISTAT_SOFTRST      0x40  /* Soft chip reset */
  123. #define SYM895_ISTAT_SIGP         0x20  /* signal process */
  124. #define SYM895_ISTAT_SEM          0x10   /* Semaphore */
  125. #define SYM895_ISTAT_CON          0x08  /* stat connected (reset doesn't */
  126.                                          /* disconnect) */
  127. #define SYM895_ISTAT_INTF         0x04   /* set by INTFLY script instruction.*/
  128.                                          /* Signals ISRs while scripts are   */    
  129.                                          /* still running */
  130. #define SYM895_ISTAT_SIP          0x02   /* SCSI Interrupt Pending */
  131. #define SYM895_ISTAT_DIP          0x01   /* Dma Interrupt Pending */
  132. /* CTEST0 */
  133. #define SYM895_CTEST1_FMT_MASK   0xf0   /* Byte Empty in DMA Fifo */
  134. #define SYM895_CTEST1_FFL_MASK   0x0f   /* Byte Full in DMA Fifo */
  135. /* CTEST2 */
  136. #define SYM895_CTEST2_DDIR        0x80   /* Data Direction. 1 => From */
  137.                                          /* SCSI to board */
  138. #define SYM895_CTEST2_SIGP        0x40  /* Signal Process. Same as in ISTAT.*/
  139.                                          /* When this register is read SIGP  */
  140.                                          /* is cleared in ISTAT */
  141. #define SYM895_CTEST2_CIO         0x20   /* Configured as I/O  */
  142. #define SYM895_CTEST2_CM          0x10  /* Configured as Memory */
  143. #define SYM895_CTEST2_SRTCH       0x08   /* Configure Scratch regs */
  144. #define SYM895_CTEST2_TEOP        0x04   /* Scsi True end of process */
  145. #define SYM895_CTEST2_DREQ        0x02   /* Data Request Status */
  146. #define SYM895_CTEST2_DACK        0x01  /* Data Acknowledge Status */
  147. /* CTEST3 */
  148. #define SYM895_CTEST3_REV_MASK    0xf0  /* Chip Revision Mask */
  149. #define SYM895_CTEST3_FLF         0x08  /* Flush DMA FIFO */
  150. #define SYM895_CTEST3_CLF         0x04  /* Clear DMA FIFO */
  151. #define SYM895_CTEST3_FM          0x02  /* Fetch Pin Mode */
  152. #define SYM895_CTEST3_WRIE        0x01  /* Write and Invalidate Enable */
  153. /* DFIFO */
  154. #define SYM895_FIFO_112_MASK      0x7f   /* 7 bits of Byte Offset counter */
  155.                                          /* between  SCSI core and DMA core */
  156. #define SYM895_FIFO_816_MASK      0x3ff  /* 10 bits (8 - DFIFO, 2 - CTEST5 ) */
  157.                                          /* of SCSI Byte Offset counter */
  158.                                          /* between  SCSI core and DMA core */
  159. /* CTEST4 */
  160. #define SYM895_CTEST4_BDIS        0x80   /* Burst transfer DISable */
  161. #define SYM895_CTEST4_ZMOD        0x40  /* High Impedance Mode */
  162. #define SYM895_CTEST4_ZSD         0x20  /* SCSI data high impedance */
  163. #define SYM895_CTEST4_SRTM        0x10  /* Shadow Register Test Mode */
  164. #define SYM895_CTEST4_MPEE        0x08   /* Master Parity Error Enable */
  165. #define SYM895_CTEST4_FBL_MASK    0x07   /* Fifo byte control */
  166. /* CTEST5 */
  167. #define SYM895_CTEST5_ADCK        0x80   /* Increment DNAD register */
  168. #define SYM895_CTEST5_BBCK        0x40   /* Decrement DBC register */
  169. #define SYM895_CTEST5_DFS         0x20   /* DMA FIFO Size: 0=112, 1=816 bytes */
  170. #define SYM895_CTEST5_MASR        0x10   /* Master Ctrl for Set/Reset Pulses */
  171. #define SYM895_CTEST5_BL2         0x04   /* Burst Length bit 2 */
  172. #define SYM895_CTEST5_BO9         0x02   /* b9 of DMA Fifo byte offset counter*/
  173. #define SYM895_CTEST5_BO8         0x01   /* b8 of DMA Fifo byte offset counter*/
  174. /* CTEST6 */
  175. #define SYM895_CTEST6_DF_MASK     0xff   /* Dma Fifo bits - mask */
  176. /* DMODE RW register */
  177. #define SYM895_DMODE_BL1          0x80   /* Burst Length transfer bits; */
  178.                                          /* determine the number of transfers */
  179.                                          /* per bus ownership */
  180. #define SYM895_DMODE_BL0          0x40  /* 00=2,01=4,10=8,11=16 */
  181. #define SYM895_DMODE_SIOM         0x20  /* Source I/O Memory Enable; */
  182.                                          /* 1 => I/O */
  183. #define SYM895_DMODE_DIOM         0x10   /* Destination I/O Memory Enable; */
  184. #define SYM895_DMODE_ERL          0x08   /* Enable PCI Read Line command */
  185. #define SYM895_DMODE_ERMP         0x04   /* Enable PCI Read Multiple command */
  186. #define SYM895_DMODE_BOF          0x02   /* Burst Opcode Fetch enable; */
  187.                                          /* instrs fetched in burst mode */
  188. #define SYM895_DMODE_MAN          0x01   /* Manual start mode ,when set   */
  189.                                          /* disable autostart script when */ 
  190.                                          /* writting in DSP */
  191. /* DCNTL - DMA Control bits */
  192. #define SYM895_DCNTL_CLSE         0x80   /* Cache Line Size Enable */
  193. #define SYM895_DCNTL_PFF          0x40   /* Pre-Fetch Flush */
  194. #define SYM895_DCNTL_PFEN         0x20   /* Pre-Fetch ENable */ 
  195. #define SYM895_DCNTL_SSM          0x10   /* Single-Step Mode */
  196. #define SYM895_DCNTL_IRQM         0x08   /* IRQ Mode */
  197. #define SYM895_DCNTL_STD          0x04   /* Start Dma operation; */
  198. #define SYM895_DCNTL_IRQD         0x02   /* IRQ Disable */
  199. #define SYM895_DCNTL_COM          0x01   /* Compatability 1 => ncr700 mode  */
  200. /* 
  201.  * SIEN0 (enable intr)and SIST0 (RO Status) 
  202.  * Enable interrupt 
  203.  */
  204. #define SYM895_B_MA            0x80  /* Phase Mismatch / ATN interrupt*/
  205. #define SYM895_B_CMP           0x40  /* Funtion CoMPlete; interrupt when full */ 
  206.                                      /* arbitration and selection is complete */
  207. #define SYM895_B_SEL           0x20  /* Selected; intr when selected as tgt */
  208. #define SYM895_B_RSL           0x10  /* Reselected; intr when reselected */
  209. #define SYM895_B_SGE           0x08  /* SCSI Gross Error; intr enable */
  210. #define SYM895_B_UDC           0x04  /* Enable Unexpected Disconnect intr */
  211. #define SYM895_B_RST           0x02  /* Enable Reset intr */
  212. #define SYM895_B_PAR           0x01  /* Enable parity intr */
  213. /* SIEN1 (enable intr) and SIST1 (RO status) */
  214. #define SYM895_B_SBMC          0x10  /* SCSI Bus Mode Change Interrupt */
  215. #define SYM895_B_STO           0x04  /* Selection/Reselection Timeout */
  216. #define SYM895_B_GEN           0x02  /* GENeral purpose timer expired */
  217. #define SYM895_B_HTH           0x01  /* Handshake to Handshake timer expired */
  218. /* MACNTL - Memory Access Control (RW) */
  219. #define SYM895_MACNTL_TYP_MASK 0xf0  /* Identify the chip type */
  220. #define SYM895_MACNTL_DWR      0x08  /* Data WRite is local memeory access */
  221. #define SYM895_MACNTL_DRD      0x04  /* Data ReaD is local memory access */
  222. #define SYM895_MACNTL_PSCPT    0x02  /* Pointer to SCRIPTs is local mem access*/
  223. #define SYM895_MACNTL_SCPTS    0x01  /* SCRIPTS fetch is local mem access */
  224. /* 
  225.  * GPCNTL - General Purpose Pin Control (RW) 
  226.  * This reg is used to determine if GPREG pins are inputs or outputs 
  227.  */
  228. #define SYM895_GPCNTL_ME       0x80  /* Master Enable;internal busmaster:GPIO1*/
  229. #define SYM895_GPCNTL_FE       0x40  /* Fetch Enable; */ 
  230.                                      /* internal op-code fetch GPIO0*/
  231. #define SYM895_GPCNTL_GPIO4    0x10  /* GPIO4: set - input and reset - output */
  232. #define SYM895_GPCNTL_GPIO3    0x08  /* GPIO3: set - input and reset - output */
  233. #define SYM895_GPCNTL_GPIO2    0x04  /* GPIO2: set - input and reset - output */
  234. #define SYM895_GPCNTL_GPIO1    0x02  /* GPIO1: set - input and reset - output */
  235. #define SYM895_GPCNTL_GPIO0    0x01  /* GPIO0: set - input and reset - output */
  236. /* STIME0  SCSI Timer Zero (RW) */
  237. /* These bits select various timeout values.e.g 0000 => disable; 1111 => 1.6s */
  238. #define SYM895_STIME0_HTH_MASK 0xf0  /* Handshake-To-Handshake period mask*/
  239. #define SYM895_STIME0_SEL_MASK 0x0f  /* SELection timeout mask */
  240. /* STIME1 SCSI Timer One (RW) */
  241. #define SYM895_STIME1_HTHBA    0x40  /* HTH Timer Bus Activity Enable */
  242. #define SYM895_STIME1_GENSF    0x20  /* General Purpose Timer Scale Factor */
  243. #define SYM895_STIME1_HTHSF    0x10  /* HTH Timer Scale Factor */
  244. #define SYM895_STIME1_GEN_MASK 0x0f  /* GENeral timer timeout mask */
  245. /* STEST0 SCSI Test Zero (RO) */
  246. #define SYM895_STEST0_SSAID_MASK    0xf0 /* SCSI Selected As ID */
  247. #define SYM895_STEST0_SLT           0x08 /* Selection response logic test */
  248. #define SYM895_STEST0_ART           0x04 /* Arbitation Priority encoder Test */
  249. #define SYM895_STEST0_SOZ           0x02 /* SCSI Synchronous Offset Zero */
  250. #define SYM895_STEST0_SOM           0x01 /* SCSI Synchronous Offset Maximum */
  251. /* STEST1 SCSI Test One (RW) */
  252. #define SYM895_STEST1_SCLK          0x80 /* Disables external SCLK and uses */
  253.                                          /* PCI internal SCSI clock */
  254. #define SYM895_STEST1_SISO          0x40 /* SCSI Isolation Mode; inputs  */
  255.                                          /* isolated from the SCSI bus */
  256. #define SYM895_STEST1_QEN           0x08 /* Enable: Power on clock Quadrupler */
  257. #define SYM895_STEST1_QSEL          0x04 /* Select: Increase clock to 160 MHz */
  258. /* STEST2 SCSI Test Two (RW) */
  259. #define SYM895_STEST2_SCE           0x80 /* SCSI Control Enable */
  260. #define SYM895_STEST2_ROF           0x40 /* Reset SCSI OFfset */
  261. #define SYM895_STEST2_DIF           0x20 /* SCSI Differential Mode */
  262. #define SYM895_STEST2_SLB           0x10 /* SCSI Loopback Mode */
  263. #define SYM895_STEST2_SZM           0x08 /* SCSI High-Impedance Mode */
  264. #define SYM895_STEST2_AWS           0x04 /* Always Wide SCSI */
  265. #define SYM895_STEST2_EXT           0x02 /* Extend SREQ/SACK filtering -  */
  266.                                          /* Should not be set during FAST */
  267.                                          /* SCSI> 5MB/s */
  268. #define SYM895_STEST2_LOW           0x01 /* SCSI LOW level mode; no DMA  */
  269.                                          /* operation occur and no SCRIPTS */ 
  270.                                          /* execute */
  271. /* STEST3 SCSI Test Three (RW) */
  272. #define SYM895_STEST3_TE            0x80 /* Tolerant Enable */ 
  273. #define SYM895_STEST3_STR           0x40 /* SCSI FIFO Test Read */
  274. #define SYM895_STEST3_HSC           0x20 /* Halt Scsi Clock */
  275. #define SYM895_STEST3_DSI           0x10 /* Disable Single Initiator */
  276.                                          /* response (SCSI-1) */
  277. #define SYM895_STEST3_S16           0x08 /* 16-bit System */
  278. #define SYM895_STEST3_TTM           0x04 /* Timer Test Mode */
  279. #define SYM895_STEST3_CSF           0x02 /* Clear Scsi Fifo */
  280. #define SYM895_STEST3_STW           0x01 /* SCSI Fifo Test Write */
  281. /* STEST4 SCSI Test Four (R) */
  282. #define SYM895_STEST4_SMODE_MASK    0xc0 /* SCSI Mode Detect */
  283. #define SYM895_STEST4_LOCK          0x20 /* Detect Clock Quadrupler Lockup */
  284. /* Byte Offsets of On-Chip Registers from the base address */
  285. /* 
  286.  * The registers can be accessed in two ways.One is using Memory IO base addr
  287.  * plus the offset and the other by using PCI config base addr plus offset. 
  288.  * These registers are part of PCI configuration space for the device.
  289.  */
  290. #define MEMIO_REG_BASE      (0x00)
  291. #define PCI_CONFIG_REG_BASE (0x80)
  292. #define BASE                MEMIO_REG_BASE
  293. /* Little Endian offsets */
  294. #define SYM895_OFF_SCNTL0  (BASE)          /* SCTNL0 SCSI control register 0 */
  295. #define SYM895_OFF_SCNTL1  (BASE + 0x01)   /* SCTNL1 SCSI control register 1 */
  296. #define SYM895_OFF_SCNTL2  (BASE + 0x02)   /* SCTNL2 SCSI control register 2 */
  297. #define SYM895_OFF_SCNTL3  (BASE + 0x03)   /* SCTNL3 SCSI control register 3 */
  298. #define SYM895_OFF_SCID    (BASE + 0x04)   /* SCID SCSI chip ID register */
  299. #define SYM895_OFF_SXFER   (BASE + 0x05)   /* SXFER SCSI chip ID register */
  300. #define SYM895_OFF_SDID    (BASE + 0x06)   /* SDID SCSI destination ID  */
  301. #define SYM895_OFF_GPREG   (BASE + 0x07)   /* GPREG General Purpose register */
  302. #define SYM895_OFF_SFBR    (BASE + 0x08)   /* SFBR SCSI first byte received  */
  303. #define SYM895_OFF_SOCL    (BASE + 0x09)   /* SOCL SCSI output control latch */
  304. #define SYM895_OFF_SSID    (BASE + 0x0a)   /* SSID SCSI selector ID */
  305. #define SYM895_OFF_SBCL    (BASE + 0x0b)   /* SBCL SCSI bus control lines */
  306. #define SYM895_OFF_DSTAT   (BASE + 0x0c)   /* DSTAT DMA status register */
  307. #define SYM895_OFF_SSTAT0  (BASE + 0x0d)   /* SSTAT0 SCSI status register 0 */
  308. #define SYM895_OFF_SSTAT1  (BASE + 0x0e)   /* SSTAT1 SCSI status register 0 */
  309. #define SYM895_OFF_SSTAT2  (BASE + 0x0f)   /* SSTAT2 SCSI status register 0 */
  310. #define SYM895_OFF_DSA     (BASE + 0x10)   /* 32-bit DSA data structure */
  311.                                            /* address */
  312. #define SYM895_OFF_ISTAT   (BASE + 0x14)   /* 8-bit ISTAT interrupt status  */
  313. #define SYM895_OFF_CTEST0  (BASE + 0x18)   /* CTEST0 chip test register 0 */
  314. #define SYM895_OFF_CTEST1  (BASE + 0x19)   /* CTEST1 chip test register 1 */
  315. #define SYM895_OFF_CTEST2  (BASE + 0x1a)   /* CTEST2 chip test register 2 */
  316. #define SYM895_OFF_CTEST3  (BASE + 0x1b)   /* CTEST3 chip test register 3 */
  317. #define SYM895_OFF_TEMP    (BASE + 0x1c)   /* 32-bit TEMP temporary holding */
  318.                                            /* register */
  319. #define SYM895_OFF_DFIFO   (BASE + 0x20)   /* DFIFO DMA FIFO control register */
  320. #define SYM895_OFF_CTEST4  (BASE + 0x21)   /* CTEST4 chip test register 4 */
  321. #define SYM895_OFF_CTEST5  (BASE + 0x22)   /* CTEST5 chip test register 5 */
  322. #define SYM895_OFF_CTEST6  (BASE + 0x23)   /* CTEST6 chip test register 6 */
  323. #define SYM895_OFF_DBC     (BASE + 0x24)   /* 24-bit DBC SIOP command reg.*/
  324. #define SYM895_OFF_DCMD    (BASE + 0x27)   /* 8-bit DCMD SIOP command register */
  325. #define SYM895_OFF_DNAD    (BASE + 0x28)   /* 32-bit DNAD DMA buffer ptr */
  326.                                            /* (next addr) */
  327. #define SYM895_OFF_DSP     (BASE + 0x2c)   /* 32-bit DSP SIOP scripts pointer */
  328.                                            /* register */
  329. #define SYM895_OFF_DSPS    (BASE + 0x30)   /* 32-bit DSPS SIOP scripts ptr */
  330.                                            /* save register */
  331. #define SYM895_OFF_DMODE   (BASE + 0x38)   /* DMODE DMA operation mode */
  332.                                            /* register */
  333. #define SYM895_OFF_DIEN    (BASE + 0x39)   /* DIEN DMA interrupt enable */
  334. #define SYM895_OFF_DWT     (BASE + 0x3a)   /* DWT DMA watchdog timer register */
  335. #define SYM895_OFF_DCNTL   (BASE + 0x3b)   /* DCTNL DMA control register */
  336. #define SYM895_OFF_ADDER   (BASE + 0x3c)   /* 32-bit ADDER Adder output */
  337.                                            /* Register */
  338. #define SYM895_OFF_SIEN0   (BASE + 0x40)   /* SIEN0 SCSI interrupt enable 0 */
  339.                                            /* register */
  340. #define SYM895_OFF_SIEN1   (BASE + 0x41)   /* SIEN1 SCSI interrupt enable 1 */
  341.                                            /* register */
  342. #define SYM895_OFF_SIST0   (BASE + 0x42)   /* SIST0 SCSI interrupt status 0 */
  343.                                            /* register */
  344. #define SYM895_OFF_SIST1   (BASE + 0x43)   /* SIST1 SCSI interrupt status 1 */
  345.                                            /* register */
  346. #define SYM895_OFF_SLPAR   (BASE + 0x44)   /* SLPAR SCSI longitudinal Parity*/
  347.                                            /* register */
  348. #define SYM895_OFF_SWIDE   (BASE + 0x45)   /* SWIDE SCSI Wide Residue */
  349. #define SYM895_OFF_MACNTL  (BASE + 0x46)   /* MACNTL Memory Access Control */
  350.                                            /* register */
  351. #define SYM895_OFF_GPCNTL  (BASE + 0x47)   /* GPCNTL General Purpose Pin */
  352.                                            /* Control */
  353. #define SYM895_OFF_STIME0  (BASE + 0x48)   /* STIME0 SCSI Timer Zero reg */
  354. #define SYM895_OFF_STIME1  (BASE + 0x49)   /* STIME1 SCSI Timer One reg */
  355. #define SYM895_OFF_RESPID0 (BASE + 0x4a)   /* RESPID Response ID register 0 */
  356. #define SYM895_OFF_RESPID1 (BASE + 0x4b)   /* RESPID Response ID register 1 */
  357. #define SYM895_OFF_STEST0  (BASE + 0x4c)   /* STEST0 SCSI Test 0 register */
  358. #define SYM895_OFF_STEST1  (BASE + 0x4d)   /* STEST1 SCSI Test 1 register */
  359. #define SYM895_OFF_STEST2  (BASE + 0x4e)   /* STEST2 SCSI Test 2 register */
  360. #define SYM895_OFF_STEST3  (BASE + 0x4f)   /* STEST3 SCSI Test 3 register */
  361. #define SYM895_OFF_SIDL    (BASE + 0x50)   /* 16-bit SIDL SCSI input data */
  362.                                            /* latch register */
  363. #define SYM895_OFF_STEST4  (BASE + 0x52)   /* STEST4 SCSI Test 4 register */
  364. #define SYM895_OFF_SODL    (BASE + 0x54)   /* 16-bit SCSI output data latch */
  365.                                            /* register */
  366. #define SYM895_OFF_SBDL    (BASE + 0x58)   /* 16-bit SBDL SCSI bus data lines */
  367.                                            /* register */
  368. #define SYM895_OFF_SCRATCHA0 (BASE + 0x34) /* SCRATCHA0 gen purpose */
  369.                                                 /* scratch register A0 */
  370. #define SYM895_OFF_SCRATCHA1 (BASE + 0x35) /* SCRATCHA1 gen purpose */ 
  371.                                                 /* scratch reg A1 */
  372. #define SYM895_OFF_SCRATCHA2 (BASE + 0x36) /* SCRATCHA2 gen purpose */
  373.                                                 /* scratch reg A2 */
  374. #define SYM895_OFF_SCRATCHA3 (BASE + 0x37) /* SCRATCHA3 gen purpose */
  375.                                                 /* scratch reg A3 */
  376. #define SYM895_OFF_SCRATCHB0 (BASE + 0x5c) /* SCRATCHB0 gen purpose */
  377.                                                 /* scratch reg B0 */
  378. #define SYM895_OFF_SCRATCHB (BASE + 0x5c) /* SCRATCHB Scratch Register B */
  379. #define SYM895_OFF_SCRATCHC0 (BASE + 0x60) /* SCRATCHC Scratch Register C */
  380. #define SYM895_OFF_SCRATCHC1 (BASE + 0x61) /* SCRATCHC Scratch Register C */
  381. #define SYM895_OFF_SCRATCHC2 (BASE + 0x62) /* SCRATCHC Scratch Register C */
  382. #define SYM895_OFF_SCRATCHC (BASE + 0x60) /* SCRATCHC Scratch Register C */
  383. #define SYM895_OFF_SCRATCHD (BASE + 0x64) /* SCRATCHD Scratch Register D */
  384. #define SYM895_OFF_SCRATCHE (BASE + 0x68) /* SCRATCHE Scratch Register E */
  385. #define SYM895_OFF_SCRATCHF (BASE + 0x6c) /* SCRATCHF Scratch Register F */
  386. #define SYM895_OFF_SCRATCHG (BASE + 0x70) /* SCRATCHG Scratch Register G */
  387. #define SYM895_OFF_SCRATCHH (BASE + 0x74) /* SCRATCHH Scratch Register H */
  388. #define SYM895_OFF_SCRATCHI (BASE + 0x78) /* SCRATCHI Scratch Register I */
  389. #define SYM895_OFF_SCRATCHJ (BASE + 0x7C) /* SCRATCHJ Scratch Register J */
  390. /* 
  391.  * The Device Id's (required for finding the device on PCI Bus)
  392.  * for the SYM895 Chip. Note that NCR895 and SYM895 are both the same.
  393.  * the SCSI division of NCR is now Symbios, which is taken over by LSI logic
  394.  */
  395. #define NCR810_DEVICE_ID    0x0001
  396. #define NCR825_DEVICE_ID    0x0003
  397. #define NCR875_DEVICE_ID    0x000f
  398. #define NCR895_DEVICE_ID    0x000c
  399. #define NCR895A_DEVICE_ID   0x0012
  400. #define SYM895_DEVICE_ID    NCR895_DEVICE_ID
  401. #define PCI_ID_SYMBIOS      0x1000
  402. /* 
  403.  * The Block Move Counter Mask.
  404.  * The DBC register in sym895 holds the number of bytes transferred in 
  405.  * a Block Move instruction. It is also used to hold the least significant 
  406.  * 24 bits of the first dword of a SCRIPTS fetch. For more details, please 
  407.  * refer to chap 5, of the 895 data manual.
  408.  * The maximum value that it can store is 0x00ffffff (24 bits only). 
  409.  */
  410. #define SYM895_COUNT_MASK   ((UINT)0x00ffffff)
  411. /* 
  412.  * As a part of the SCSI Thread, the target parameters are to be set
  413.  * in the thread context. These parameters are  encoded. Device (target)id 
  414.  * and a copy of the sxfer register are to be encoded in a single 32 bit word. 
  415.  * Bits 23-16 specify the target bus id(mapped to SDID register) and bits 15-08 
  416.  * specify the copy of sxfer register. Refer to 8-8 of PCI-SCSI Programming 
  417.  * guide.
  418.  */
  419. #define SYM895_TARGET_BUS_ID_SHIFT  16
  420. #define SYM895_XFER_PARAMS_SHIFT    8
  421. /* 
  422.  * Allowable SCSI Synchronous Offset and Transfer period values.
  423.  * Please refer to chap 2, the Functional description and chap 5, Operating 
  424.  * registers of sym895 data manual, for more details.
  425.  */
  426. #define SYM895_MIN_SYNC_OFFSET      1
  427. #define SYM895_MAX_SYNC_OFFSET      31
  428. #define SYM895_ASYNC_OFFSET         0   /* Sync. Offset should be 0x00 */
  429.                                         /* for asynchronous xfers */
  430. /* Allowable values for SCSI Sync. transfer period in XFERP register */
  431. #define SYM895_MIN_XFERP            4
  432. #define SYM895_MAX_XFERP            11  /* Not recommended.see the manual */
  433. #define SYM895_IDEAL_XFERP          4
  434. #define SYM895_SYNC_XFER_PERIOD_SHIFT   5 /* PERIOD is Bits 7-5 of XFER reg */
  435. /* The Value of sxfer register for asynchronous transfers */
  436. #define SYM895_ASYNC_SXFER          0x00
  437. /* 
  438.  * Synchronous Transfer : Clock division factor 
  439.  * Refer to chap 5, Operating Registers, SCNTL3 register bits SCF2-0
  440.  */
  441. #define SYM895_SYNC_MIN_CLK_DIV     1
  442. #define SYM895_SYNC_MAX_CLK_DIV     7
  443. #define SYM895_SYNC_CLK_DIV_1       1       /* SCLK / 1 */
  444. #define SYM895_SYNC_CLK_DIV_1_5     2       /* SCLK / 1.5 */
  445. #define SYM895_SYNC_CLK_DIV_2       3       /* SCLK / 2 */ 
  446. #define SYM895_SYNC_CLK_DIV_3       4       /* SCLK / 3 */
  447. #define SYM895_SYNC_CLK_DIV_4       5       /* SCLK / 4 */
  448. #define SYM895_SYNC_CLK_DIV_6       6       /* SCLK / 6 */
  449. #define SYM895_SYNC_CLK_DIV_8       7       /* SCLK / 8 */
  450. /* 
  451.  * Asynchronous Transfer : Clock conversion factor 
  452.  * Refer to chap 5, Operating Registers, SCNTL3 register
  453.  * Bits CCF2-0.
  454.  */
  455. #define SYM895_ASYNC_MIN_CLK_DIV    1       /* 16.67 - 25 MHz */
  456. #define SYM895_ASYNC_MAX_CLK_DIV    7       /* 160 MHz : The clock quadrupler  */
  457.                                             /* bit must be set */
  458. /* prescale factor for asynchronous scsi core (scntl3) */
  459. #define SYM895_16MHZ_ASYNC_DIV      0x01    /* 16.67-25.00Mhz input clock */
  460. #define SYM895_25MHZ_ASYNC_DIV      0x02    /* 25.01-37.50Mhz input clock */
  461. #define SYM895_3750MHZ_ASYNC_DIV    0x03    /* 37.51-50.00Mhz input clock */
  462. #define SYM895_50MHZ_ASYNC_DIV      0x04    /* 50.01-75.00Mhz input clock */
  463. /* 
  464.  * Note: 70MHz & 160MHz value has Ultra Enable bit set (b7).
  465.  * When Ultra enable bit is set, the Tolerant Enable bit must also be set . 
  466.  * It is STEST3:TE (bit 7).
  467.  */
  468. #define SYM895_75MHZ_ASYNC_DIV      0x85    /* 75.01-80.00Mhz input clock */
  469. /* 160.00 Mhz input clock with clock quadrupler and 40 Mhz input clock */
  470. #define SYM895_160MHZ_ASYNC_DIV     0x87    
  471. /* Nano Seconds x 100 clock period */
  472. #define SYM895_1667MHZ      6000    /* 16.67Mhz chip */
  473. #define SYM895_20MHZ        5000    /* 20Mhz chip */
  474. #define SYM895_25MHZ        4000    /* 25Mhz chip */
  475. #define SYM895_3750MHZ      2667    /* 37.50Mhz chip */
  476. #define SYM895_40MHZ        2500    /* 40Mhz chip */
  477. #define SYM895_50MHZ        2000    /* 50Mhz chip */
  478. #define SYM895_66MHZ        1515    /* 66Mhz chip */
  479. #define SYM895_6666MHZ      1500    /* 66Mhz chip */
  480. #define SYM895_75MHZ        1333    /* 75Mhz chip */
  481. #define SYM895_80MHZ        1250    /* 80Mhz chip */
  482. #define SYM895_160MHZ        625    /* 40Mhz chip with Quadrupler */
  483. /* Timer values for General Purpose Timer (STIME1) */
  484. #define SYM895_GEN_DISABLED 0x00    /* Disabled */
  485. #define SYM895_GEN_128MS    0x0B    /* 128 MS */
  486. #define SYM895_GEN_64MS     0x0A    /* 64 MS */
  487. /* Various Bus Modes supported by 895 */
  488. #define SYM895_BUSMODE_LVD     3
  489. #define SYM895_BUSMODE_SE      2
  490. #define SYM895_BUSMODE_HVD     1
  491. #define SYM895_BUSMODE_SHIFT   6
  492. #define SYM895_MAX_XFER_WIDTH  1    /* in transfer width exponent units.*/
  493.                                     /* 16bits. */
  494. #define SYM895_TYPE     0x895       /* Chip Type; */
  495. /* sym895 PCI Resources  */
  496. #define SYM895_MEMBASE         0xf5200000
  497. #define SYM895_MEMSIZE         0x00001000      /* memory size for Int.RAM, 4KB */
  498. #define SYM895_RAM_ADR         (SYM895_MEMBASE)
  499. #define SYM895_MEM_ADR         (SYM895_MEMBASE + SYM895_MEMSIZE)
  500. #define SYM895_IO_ADR          0xf800
  501. #define SYM895_INT_LVL         0x0a
  502. #define SYM895_INIT_STATE_MASK (VM_STATE_MASK_FOR_ALL)
  503. #define SYM895_INIT_STATE      (VM_STATE_FOR_IO)
  504. #define SYM895_DEV_MMU_MSK      (~(VM_PAGE_SIZE - 1))   /* Mask MMU page */
  505. #define SYM895_DEV_ADRS_SIZE    VM_PAGE_SIZE * 2        /* two pages */
  506. /* Controller Options, while creating the Controller Structure */
  507. #define SYM895_ENABLE_PARITY_CHECK      0x01
  508. #define SYM895_ENABLE_SINGLE_STEP       0x02
  509. #define SYM895_COPY_SCRIPTS             0x04
  510. /* SCRIPT ram Size for various controllers */
  511. #define SYM895_SCRIPT_RAM_SIZE 4*1024 /* bytes */
  512. /* 
  513.  * Chip register access mode (memory mapped / IO). If SYM895_IO_MAPPED is 
  514.  * defined, then IO Base Address (PCI BAR 0) is used for all register access. 
  515.  * If not defined, then Memory Base Address(PCI BAR 1) is used.
  516.  */
  517. #define SYM895_IO_MAPPED   /* IO mapped access by default */
  518. /* Loopback diagnostics */
  519. #define LOOPBACK_MSG_BYTE  0xa5
  520. #define LOOPBACK_DATA      0x5a5a
  521. /*
  522.  *  Structure , used as an interface between the C Code and the Scripts.
  523.  *  used for storing data in Block Move instructions.
  524.  */
  525. typedef struct moveParams
  526.     {
  527.     ULONG  size;              /* # bytes to move to/from SCSI */
  528.     UINT8 *addr;              /* where in memory they go/come */
  529.     } MOVE_PARAMS;
  530. /*
  531.  * This has to be defined to include support for SCATTER-GATHER memory
  532.  * operations. 
  533.  */
  534. /* #define SCATTER_GATHER  */
  535. /* Maximum number of scattered data elements. */
  536. #define MAX_NO_OF_SCAT_ELEMENTS 255
  537. /*
  538.  * Structure to hold the scattered data, to be gathered by the SIOP while
  539.  * in scripts. Gathered Data is transferred using chained block moves, one 
  540.  * after the other (block wise) with out the intervention of the host.
  541.  */
  542. typedef struct scatGather
  543.     {
  544.     ULONG         noElems;   /* No of places to gather the scattered the data */
  545.     MOVE_PARAMS   Elements[MAX_NO_OF_SCAT_ELEMENTS]; 
  546.  
  547.     } SCAT_DATA;
  548. /*
  549.  *  Shared structure defining all information about a SCSI connection
  550.  *  visible to the script.  
  551.  *  For more details, please refer to PCI-SCSI programmers guide (8)
  552.  *  Every element in this structure _must_ be aligned on
  553.  *  a 4-byte boundary, otherwise the script will fail (illegal instruction).
  554.  */
  555. typedef struct sym895Shared
  556.     {
  557.     ULONG       device;       /* target bus ID, sync xfer params */
  558.     MOVE_PARAMS command;      /* command bytes sent to target    */
  559.     MOVE_PARAMS dataIn;       /* data bytes from target          */
  560.    
  561.     MOVE_PARAMS dataOut;      /* data bytes to target            */
  562.     MOVE_PARAMS status;       /* command status byte from target */
  563.     MOVE_PARAMS identOut;     /* outgoing identification msg     */
  564.     MOVE_PARAMS identIn;      /* incoming identification msg     */
  565.     MOVE_PARAMS msgOut;       /* message bytes sent to target    */
  566.     MOVE_PARAMS msgIn;        /* message bytes recvd from target */
  567.     MOVE_PARAMS msgInSecond;  /* second byte of multi-byte msg   */
  568.     MOVE_PARAMS msgInRest;    /* remainder of multi-byte message */
  569. #ifdef SCATTER_GATHER
  570.     SCAT_DATA scatData;     /* scatter - gather memory moves */
  571. #endif
  572.     } SYM895_SHARED;
  573. /* The Typedefs and the structure definitions */
  574. /* 
  575.  * Shared structure exclusively used by the diagnostic scripts for 
  576.  * loopback mode. Every element of this structure must be 4-byte aligned.
  577.  */
  578. typedef struct sym895Loopback
  579. {
  580.     ULONG       device    ;  /* target bus ID, sync xfer params */
  581.     MOVE_PARAMS identOut  ;  /* Identify buffer for loopback mode */
  582.  
  583.     MOVE_PARAMS dataOut   ;  /* data buffer for loopback mode */
  584. } SYM895_LOOPBACK;
  585. /* Sym895 Thread strcuture. */
  586. typedef struct sym895Thread 
  587.     {
  588.     SCSI_THREAD             scsiThread  ;  /* generic SCSI Thread */
  589.     struct sym895Shared *    pShMem     ; /* Pointer to SIOP shared */
  590.                                           /* data area */
  591.  
  592.     struct sym895Shared *    pShMemDuplicate ; /* Pointer to SIOP */
  593.                                                /* shared data area */
  594.     /* 
  595.      * Every thread has its own context, which is the image of some of the 
  596.      * SIOP registers. Whenever the execution comes out of thread, the
  597.      * current values of those registers are saved in these variables, and 
  598.      * retreived, when the execution is back to the thread.
  599.      */
  600.     UINT8   nHostFlags;     /* Scratch A register byte 0 */
  601.     UINT8   msgOutStatus;   /* Scratch A register byte 1 */
  602.     UINT8   msgInStatus;    /* Scratch A register byte 2 */
  603.     UINT8   targetId;       /* Scratch A register byte 3 */
  604.     UINT8   busPhase;       /* Scratch B register byte 0 */
  605.     UINT8   sxfer;          /* SXFER register */
  606.     UINT8   scntl3;         /* SCNTL3 registers */
  607.     /* scatter gather memory support */
  608.     UINT8   isScatTransfer;    /* Scratch C register byte 0 */
  609.     UINT8   totalScatElements; /* Scratch C register byte 1 */
  610.     UINT8   noRemaining;       /* Scratch C register byte 2 */
  611.     }SYM895_THREAD;
  612. /* Sym895 Event Structure. */
  613. typedef struct sym895Event 
  614.     {
  615.     SCSI_EVENT          scsiEvent  ;      /* generic SCSI Event */
  616.     UINT                remCount   ;      /* Remaining Byte Count */
  617.                                           /* (Phase Mismatch) */
  618.     }SYM895_EVENT;
  619. /* 
  620.  * Script Entry Point Identifiers. These are the 4 Scripts that VxWorks
  621.  * requires. If some more are to be added, they have to be added here and in 
  622.  * sym895StartScript() to ensure that the script starts when required.
  623.  */
  624. typedef enum sym895ScriptEntries
  625.     {
  626.     SYM895_SCRIPT_WAIT          = 0,    /* Wait for ReSelect or Host Command */
  627.     SYM895_SCRIPT_INIT_START,           /* Start an Initiator Thread */
  628.     SYM895_SCRIPT_INIT_CONTINUE,        /* Continue an Initiator Thread */
  629.     SYM895_SCRIPT_TGT_DISCONNECT,       /* Disconnect a Target Thread */
  630.     SYM895_SCRIPT_DIAG
  631.     }SYM895_SCRIPT_ENTRY;
  632. /* SIOP operating States */
  633. typedef enum sym895State
  634.     {
  635.     SYM895_STATE_IDLE           = 0,    /* Not running any script */
  636.     SYM895_STATE_PASSIVE,               /* Wait for ReSelect or Host Command */
  637.     SYM895_STATE_ACTIVE                 /* Running a script */
  638.     }SYM895_STATE;
  639. /* 
  640.  * SIOP hardware configuration structure. This is used to set/reset various 
  641.  * options available in SYM895. This is used as a parameter for the
  642.  * sym895SetHWOptions() functions. This is a  bit-field structure and has 
  643.  * to be operated with caution. 
  644.  *
  645.  * Note : AWS bit affects all the SCSI phases while EWS bit affects only the 
  646.  * data transfers. EWS, unlike AWS, doesn't affect the command, status and 
  647.  * message phases.
  648.  */
  649. typedef struct sym895HWOptions
  650.     {
  651.     UINT    SCLK    : 1;     /* STEST1:b7,if false,uses PCI Clock for SCSI*/
  652.     UINT    QEN     : 1;     /* STEST1:b3, Clock Quadrapler Enable */
  653.     UINT    SCE     : 1;     /* STEST2:b7,enable assertion of SCSI thro SOCL */
  654.                              /* and SODL registers */
  655.     UINT    DIF     : 1;     /* STEST2:b5, enable differential SCSI */
  656.     UINT    AWS     : 1;     /* STEST2:b2, Always Wide SCSI */
  657.     UINT    EWS     : 1;     /* SCNTL3:b3, Enable Wide SCSI */
  658.     UINT    EXTEND  : 1;     /* STEST2:b1, Extend SREQ/SACK filtering */
  659.     UINT    TE      : 1;     /* STEST3:b7, TolerANT Enable */
  660.     UINT    BL      : 3;     /* DMODE:b7,b6, CTEST5:b2 : Burst length */
  661.                              /* when set to any of 32/64/128 burst length */
  662.                              /* transfers, requires the DMA Fifo size to be */
  663.                              /* 816 bytes (ctest5:b5 = 1). */
  664.     UINT    SIOM    : 1;     /* DMODE:b5, Source I/O Memory Enable */
  665.     UINT    DIOM    : 1;     /* DMODE:b4, Destination I/O Memory Enable */
  666.     UINT    EXC     : 1;     /* SCNTL1:b7, Slow Cable Mode */
  667.     UINT    ULTRA   : 1;     /* SCNTL3:b7, Ultra Enable */
  668.     UINT    DFS     : 1;     /* CTEST5:b5, DMA Fifo size 112/816 bytes */
  669.     }SYM895_HW_OPTIONS;
  670. /* 
  671.  * The Default HW Options as the driver initialies the Sym 895 Chip 
  672.  * These options SHOULD correspond to the above mentioned structure.
  673.  * 
  674.  * Use SCSI Clock and not PCI clock
  675.  * Enable Clock Quadrapler
  676.  * SCSI signal assertion through regsiters - disable 
  677.  * Disable High Voltage differential SCSI  
  678.  * Not always WIDE SCSI
  679.  * Enable Wide SCSI 
  680.  * No filtering via SREQ/ SACK
  681.  * TolerANT Enable
  682.  * 128 burst transfer
  683.  * Disable IO mode for both source and destination
  684.  * No slow cable mode
  685.  * Ultra SCSI  
  686.  * DMA Fifo size - 816 bytes 
  687.  *
  688.  * NOTE:  These options can be overriden by sym895SetHwOptions() call in 
  689.  *        "sysScsi.c".
  690.  */
  691. #define  SYM895_ULTRA2_SCSI_OPTIONS         { 0,1,0,0,0,1,0,1,6,0,0,0,1,1 }
  692. #define  SYM895_FAST_SCSI_OPTIONS           { 0,0,0,0,0,1,0,1,6,0,0,0,0,1 }
  693. /* 
  694.  * SCSI Controller Structure
  695.  *
  696.  * This the structure describing the SCSI controller chip and the SCSI 
  697.  * parameters used on the SCSI Bus. This structure also contains the 
  698.  * shared memory areas and the Thread information like what threads is
  699.  * being executed by the SCRIPT processor currently and what script is 
  700.  * scheduled to run next etc.
  701.  *
  702.  * As this structure contains shared memory areas which are accessed 
  703.  * by both the SCSI controller and the CPU, this entire structure and
  704.  * its memory buffers must be located in the cache-coherent memory, safe for
  705.  * the dma transfers.
  706.  */
  707. typedef struct sym895ScsiCtrl
  708.     {
  709.     SCSI_CTRL       scsiCtrl;           /* generic SCSI Controller info. */
  710.                                         /* used by both the driver and SCSI */ 
  711.                                         /* Manager.*/
  712.     SEM_ID          singleStepSem;      /* used to debug script */
  713.     SYM895_STATE    state;              /* Current state of the controller */
  714.     UINT            clkPeriod;          /* Clock Period; nSec*100 */
  715.     UINT            clkDiv;             /* SYNC/ASYNC clock divisor */
  716.     UINT            devType;            /* Currently 895 */
  717.     BOOL            isParityCheck;      /* Enable/Disable Paritychecks on Bus*/
  718.  
  719.     BOOL            isScriptsCopy;      /* Copy SCRIPTS to on-chip RAM */      
  720.     BOOL            isCmdPending;       /* Is there a new command to start */
  721.     BOOL            isSingleStep;       /* is Single Step Debugging enabled */
  722.     /* 
  723.      * The following identMsg buffer is used for initialising the pointer
  724.      * for the current thread's IdentOut Message buffer. This buffer is also
  725.      * defined in the SCSI_THREAD structure and was previously used for the
  726.      * IdentOut Message buffer. The additional 5 bytes are for wide/sync SCSI
  727.      */
  728.     UINT8           identMsg[SCSI_MAX_IDENT_MSG_LENGTH + 5]; 
  729.     UINT            identMsgLength;
  730.     SYM895_THREAD * pCurThread;        /* Thread corresponding to current */
  731.                                        /* running script */
  732.  
  733.     SYM895_THREAD * pNewThread;        /* Thread to be activated next */
  734.     SYM895_SHARED * pIdentShMem;       /* Shared Data Area for Identification */
  735.                                        /* Thread */
  736.     SYM895_SHARED * pClientShMem;      /* Shared Data Area for Client thread*/
  737.     volatile UINT8 * baseAddress;      /* Address where the Chip is mapped */
  738.                                        /* in memory */
  739.     volatile UINT8 * siopRamBaseAddress; /* Base Address for internal Ram */
  740.     SYM895_HW_OPTIONS  hwOptions;      /* 895 Options used/not being used */
  741.     }SYM895_SCSI_CTRL;
  742. /* Function Declarations */
  743. IMPORT SYM895_SCSI_CTRL * sym895CtrlCreate (
  744.                                             UINT8 *  siopBaseAdrs,
  745.                                             UINT     clkPeriod,
  746.                                             UINT16   devType,
  747.                                             UINT8 *  siopRamBaseAdrs,
  748.                                             UINT16   flags
  749.                                            );
  750. IMPORT STATUS sym895CtrlInit (
  751.                               SYM895_SCSI_CTRL * pSiop,
  752.                               UINT scsiCtrlBusId
  753.                              );
  754. IMPORT STATUS sym895SetHwOptions (
  755.                                   SYM895_SCSI_CTRL  * pSiop,
  756.                                   SYM895_HW_OPTIONS * pHwRegs
  757.                                  );
  758. IMPORT void sym895Intr (SYM895_SCSI_CTRL * pSiop);
  759. IMPORT STATUS sym895Show (SYM895_SCSI_CTRL * pSiop);
  760. IMPORT void sym895StepEnable (SYM895_SCSI_CTRL * pSiop, BOOL enable);
  761. IMPORT void sym895SingleStep (SYM895_SCSI_CTRL * pSiop, BOOL verbose);
  762. #endif /* _ASMLANGUAGE */
  763. #ifdef __cplusplus
  764. }
  765. #endif /* __cplusplus */
  766. #endif /* __INCsym895h */