Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

261 lines
6.1 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. ncr53C94.h
  5. Abstract:
  6. The module defines the structures, defines and functions for the NCR 53C94
  7. host bus adapter chip.
  8. Author:
  9. Jeff Havens (jhavens) 28-Feb-1991
  10. Revision History:
  11. R.D. Lanser (DEC) 05-Oct-1991
  12. Copied SCSI_REGISTER structure from d3scsidd.c and added check for
  13. DECSTATION. Changed the UCHAR's in the read/write register structures
  14. with SCSI_REGISTER, and added the dot Byte member reference to
  15. SCSI_WRITE and SCSI_READ macros.
  16. --*/
  17. #ifndef _NCR53C94_
  18. #define _NCR53C94_
  19. //
  20. // Define SCSI Protocol Chip register format.
  21. //
  22. #if defined(DECSTATION)
  23. typedef struct _SCSI_REGISTER {
  24. UCHAR Byte;
  25. UCHAR Fill[3];
  26. } SCSI_REGISTER, *PSCSI_REGISTER;
  27. #else
  28. #define SCSI_REGISTER UCHAR
  29. #endif // DECSTATION
  30. //
  31. // SCSI Protocol Chip Definitions.
  32. //
  33. // Define SCSI Protocol Chip Read registers structure.
  34. //
  35. typedef struct _SCSI_READ_REGISTERS {
  36. SCSI_REGISTER TransferCountLow;
  37. SCSI_REGISTER TransferCountHigh;
  38. SCSI_REGISTER Fifo;
  39. SCSI_REGISTER Command;
  40. SCSI_REGISTER ScsiStatus;
  41. SCSI_REGISTER ScsiInterrupt;
  42. SCSI_REGISTER SequenceStep;
  43. SCSI_REGISTER FifoFlags;
  44. SCSI_REGISTER Configuration1;
  45. SCSI_REGISTER Reserved1;
  46. SCSI_REGISTER Reserved2;
  47. SCSI_REGISTER Configuration2;
  48. SCSI_REGISTER Configuration3;
  49. SCSI_REGISTER Reserved;
  50. SCSI_REGISTER TransferCountPage;
  51. SCSI_REGISTER FifoBottem;
  52. } SCSI_READ_REGISTERS, *PSCSI_READ_REGISTERS;
  53. //
  54. // Define SCSI Protocol Chip Write registers structure.
  55. //
  56. typedef struct _SCSI_WRITE_REGISTERS {
  57. SCSI_REGISTER TransferCountLow;
  58. SCSI_REGISTER TransferCountHigh;
  59. SCSI_REGISTER Fifo;
  60. SCSI_REGISTER Command;
  61. SCSI_REGISTER DestinationId;
  62. SCSI_REGISTER SelectTimeOut;
  63. SCSI_REGISTER SynchronousPeriod;
  64. SCSI_REGISTER SynchronousOffset;
  65. SCSI_REGISTER Configuration1;
  66. SCSI_REGISTER ClockConversionFactor;
  67. SCSI_REGISTER TestMode;
  68. SCSI_REGISTER Configuration2;
  69. SCSI_REGISTER Configuration3;
  70. SCSI_REGISTER Reserved;
  71. SCSI_REGISTER TransferCountPage;
  72. SCSI_REGISTER FifoBottem;
  73. } SCSI_WRITE_REGISTERS, *PSCSI_WRITE_REGISTERS;
  74. typedef union _SCSI_REGISTERS {
  75. SCSI_READ_REGISTERS ReadRegisters;
  76. SCSI_WRITE_REGISTERS WriteRegisters;
  77. } SCSI_REGISTERS, *PSCSI_REGISTERS;
  78. //
  79. // Define SCSI Command Codes.
  80. //
  81. #define NO_OPERATION_DMA 0x80
  82. #define FLUSH_FIFO 0x1
  83. #define RESET_SCSI_CHIP 0x2
  84. #define RESET_SCSI_BUS 0x3
  85. #define TRANSFER_INFORMATION 0x10
  86. #define TRANSFER_INFORMATION_DMA 0x90
  87. #define COMMAND_COMPLETE 0x11
  88. #define MESSAGE_ACCEPTED 0x12
  89. #define TRANSFER_PAD 0x18
  90. #define SET_ATTENTION 0x1a
  91. #define RESET_ATTENTION 0x1b
  92. #define RESELECT 0x40
  93. #define SELECT_WITHOUT_ATTENTION 0x41
  94. #define SELECT_WITH_ATTENTION 0x42
  95. #define SELECT_WITH_ATTENTION_STOP 0x43
  96. #define ENABLE_SELECTION_RESELECTION 0x44
  97. #define DISABLE_SELECTION_RESELECTION 0x45
  98. #define SELECT_WITH_ATTENTION3 0x46
  99. //
  100. // Define SCSI Status Register structure.
  101. //
  102. typedef struct _SCSI_STATUS {
  103. UCHAR Phase : 3;
  104. UCHAR ValidGroup : 1;
  105. UCHAR TerminalCount : 1;
  106. UCHAR ParityError : 1;
  107. UCHAR GrossError : 1;
  108. UCHAR Interrupt : 1;
  109. } SCSI_STATUS, *PSCSI_STATUS;
  110. //
  111. // Define SCSI Phase Codes.
  112. //
  113. #define DATA_OUT 0x0
  114. #define DATA_IN 0x1
  115. #define COMMAND_OUT 0x2
  116. #define STATUS_IN 0x3
  117. #define MESSAGE_OUT 0x6
  118. #define MESSAGE_IN 0x7
  119. //
  120. // Define SCSI Interrupt Register structure.
  121. //
  122. typedef struct _SCSI_INTERRUPT {
  123. UCHAR Selected : 1;
  124. UCHAR SelectedWithAttention : 1;
  125. UCHAR Reselected : 1;
  126. UCHAR FunctionComplete : 1;
  127. UCHAR BusService : 1;
  128. UCHAR Disconnect : 1;
  129. UCHAR IllegalCommand : 1;
  130. UCHAR ScsiReset : 1;
  131. } SCSI_INTERRUPT, *PSCSI_INTERRUPT;
  132. //
  133. // Define SCSI Sequence Step Register structure.
  134. //
  135. typedef struct _SCSI_SEQUENCE_STEP {
  136. UCHAR Step : 3;
  137. UCHAR MaximumOffset : 1;
  138. UCHAR Reserved : 4;
  139. } SCSI_SEQUENCE_STEP, *PSCSI_SEQUENCE_STEP;
  140. //
  141. // Define SCSI Fifo Flags Register structure.
  142. //
  143. typedef struct _SCSI_FIFO_FLAGS {
  144. UCHAR ByteCount : 5;
  145. UCHAR FifoStep : 3;
  146. } SCSI_FIFO_FLAGS, *PSCSI_FIFO_FLAGS;
  147. //
  148. // Define SCSI Configuration 1 Register structure.
  149. //
  150. typedef struct _SCSI_CONFIGURATION1 {
  151. UCHAR HostBusId : 3;
  152. UCHAR ChipTestEnable : 1;
  153. UCHAR ParityEnable : 1;
  154. UCHAR ParityTestMode : 1;
  155. UCHAR ResetInterruptDisable : 1;
  156. UCHAR SlowCableMode : 1;
  157. } SCSI_CONFIGURATION1, *PSCSI_CONFIGURATION1;
  158. //
  159. // Define SCSI Configuration 2 Register structure.
  160. //
  161. typedef struct _SCSI_CONFIGURATION2 {
  162. UCHAR DmaParityEnable : 1;
  163. UCHAR RegisterParityEnable : 1;
  164. UCHAR TargetBadParityAbort : 1;
  165. UCHAR Scsi2 : 1;
  166. UCHAR HighImpedance : 1;
  167. UCHAR EnableByteControl : 1;
  168. UCHAR EnablePhaseLatch : 1;
  169. UCHAR ReserveFifoByte : 1;
  170. } SCSI_CONFIGURATION2, *PSCSI_CONFIGURATION2;
  171. //
  172. // Define SCSI Configuration 3 Register structure.
  173. //
  174. typedef struct _SCSI_CONFIGURATION3 {
  175. UCHAR Threshold8 : 1;
  176. UCHAR AlternateDmaMode : 1;
  177. UCHAR SaveResidualByte : 1;
  178. UCHAR FastClock : 1;
  179. UCHAR FastScsi : 1;
  180. UCHAR EnableCdb10 : 1;
  181. UCHAR EnableQueue : 1;
  182. UCHAR CheckIdMessage : 1;
  183. } SCSI_CONFIGURATION3, *PSCSI_CONFIGURATION3;
  184. //
  185. // Define Emulex FAS 218 unique part Id code.
  186. //
  187. typedef struct _NCR_PART_CODE {
  188. UCHAR RevisionLevel : 3;
  189. UCHAR ChipFamily : 5;
  190. }NCR_PART_CODE, *PNCR_PART_CODE;
  191. #define EMULEX_FAS_216 2
  192. //
  193. // SCSI Protocol Chip Control read and write macros.
  194. //
  195. #if defined(DECSTATION)
  196. #define SCSI_READ(ChipAddr, Register) \
  197. (READ_REGISTER_UCHAR (&((ChipAddr)->ReadRegisters.Register.Byte)))
  198. #define SCSI_WRITE(ChipAddr, Register, Value) \
  199. WRITE_REGISTER_UCHAR(&((ChipAddr)->WriteRegisters.Register.Byte), (Value))
  200. #else
  201. #define SCSI_READ(ChipAddr, Register) \
  202. (READ_REGISTER_UCHAR (&((ChipAddr)->ReadRegisters.Register)))
  203. #define SCSI_WRITE(ChipAddr, Register, Value) \
  204. WRITE_REGISTER_UCHAR(&((ChipAddr)->WriteRegisters.Register), (Value))
  205. #endif
  206. #endif