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.

246 lines
6.6 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Copyright (c) 1991 NCR Corporation
  4. Module Name:
  5. mca.h
  6. Abstract:
  7. This module contains the defines and structure definitions for
  8. Micro Channel machines.
  9. Author:
  10. David Risner (o-ncrdr) 21-Jul-1991
  11. Revision History:
  12. --*/
  13. #ifndef _MCA_
  14. #define _MCA_
  15. //
  16. // Define the DMA page register structure (for 8237 compatibility)
  17. //
  18. #if defined(NEC_98)
  19. #else
  20. #ifndef _EISA_
  21. typedef struct _DMA_PAGE{
  22. UCHAR Reserved1;
  23. UCHAR Channel2;
  24. UCHAR Channel3;
  25. UCHAR Channel1;
  26. UCHAR Reserved2[3];
  27. UCHAR Channel0;
  28. UCHAR Reserved3;
  29. UCHAR Channel6;
  30. UCHAR Channel7;
  31. UCHAR Channel5;
  32. UCHAR Reserved4[3];
  33. UCHAR RefreshPage;
  34. } DMA_PAGE, *PDMA_PAGE;
  35. //
  36. // Define DMA 1 address and count structure (for 8237 compatibility)
  37. //
  38. typedef struct _DMA1_ADDRESS_COUNT {
  39. UCHAR DmaBaseAddress;
  40. UCHAR DmaBaseCount;
  41. } DMA1_ADDRESS_COUNT, *PDMA1_ADDRESS_COUNT;
  42. //
  43. // Define DMA 2 address and count structure (for 8237 compatibility)
  44. //
  45. typedef struct _DMA2_ADDRESS_COUNT {
  46. UCHAR DmaBaseAddress;
  47. UCHAR Reserved1;
  48. UCHAR DmaBaseCount;
  49. UCHAR Reserved2;
  50. } DMA2_ADDRESS_COUNT, *PDMA2_ADDRESS_COUNT;
  51. //
  52. // Define DMA 1 control register structure (for 8237 compatibility)
  53. //
  54. typedef struct _DMA1_CONTROL {
  55. DMA1_ADDRESS_COUNT DmaAddressCount[4];
  56. UCHAR DmaStatus;
  57. UCHAR DmaRequest;
  58. UCHAR SingleMask;
  59. UCHAR Mode;
  60. UCHAR ClearBytePointer;
  61. UCHAR MasterClear;
  62. UCHAR ClearMask;
  63. UCHAR AllMask;
  64. } DMA1_CONTROL, *PDMA1_CONTROL;
  65. //
  66. // Define DMA 2 control register structure (for 8237 compatibility)
  67. //
  68. typedef struct _DMA2_CONTROL {
  69. DMA2_ADDRESS_COUNT DmaAddressCount[4];
  70. UCHAR DmaStatus;
  71. UCHAR Reserved1;
  72. UCHAR DmaRequest;
  73. UCHAR Reserved2;
  74. UCHAR SingleMask;
  75. UCHAR Reserved3;
  76. UCHAR Mode;
  77. UCHAR Reserved4;
  78. UCHAR ClearBytePointer;
  79. UCHAR Reserved5;
  80. UCHAR MasterClear;
  81. UCHAR Reserved6;
  82. UCHAR ClearMask;
  83. UCHAR Reserved7;
  84. UCHAR AllMask;
  85. UCHAR Reserved8;
  86. } DMA2_CONTROL, *PDMA2_CONTROL;
  87. #endif //_EISA_
  88. #endif //NEC_98
  89. typedef struct _MCA_DMA_CONTROLLER {
  90. UCHAR DmaFunctionLsb; // Offset 0x018
  91. UCHAR DmaFunctionMsb; // Offset 0x019
  92. UCHAR DmaFunctionData; // Offset 0x01a
  93. UCHAR Reserved01;
  94. UCHAR ScbAttentionPort; // Offset 0x01c
  95. UCHAR ScbCommandPort; // Offset 0x01d
  96. UCHAR Reserved02;
  97. UCHAR ScbStatusPort; // Offset 0x01f
  98. } MCA_DMA_CONTROLLER, *PMCA_DMA_CONTROLLER;
  99. //
  100. // Define Programmable Option Select register set
  101. //
  102. typedef struct _PROGRAMMABLE_OPTION_SELECT {
  103. UCHAR AdapterIdLsb;
  104. UCHAR AdapterIdMsb;
  105. UCHAR OptionSelectData1;
  106. UCHAR OptionSelectData2;
  107. UCHAR OptionSelectData3;
  108. UCHAR OptionSelectData4;
  109. UCHAR SubaddressExtensionLsb;
  110. UCHAR SubaddressExtensionMsb;
  111. } PROGRAMMABLE_OPTION_SELECT, *PPROGRAMMABLE_OPTION_SELECT;
  112. //
  113. // Define Micro Channel i/o address map
  114. //
  115. typedef struct _MCA_CONTROL {
  116. DMA1_CONTROL Dma1BasePort; // Offset 0x000
  117. UCHAR Reserved0[8];
  118. UCHAR ExtendedDmaBasePort[8]; // Offset 0x018
  119. UCHAR Interrupt1ControlPort0; // Offset 0x020
  120. UCHAR Interrupt1ControlPort1; // Offset 0x021
  121. UCHAR Reserved1[64 - 1];
  122. UCHAR SystemControlPortB; // Offset 0x061
  123. UCHAR Reserved2[32 - 2];
  124. DMA_PAGE DmaPageLowPort; // Offset 0x080
  125. UCHAR Reserved3;
  126. UCHAR CardSelectedFeedback; // Offset 0x091
  127. UCHAR SystemControlPortA; // Offset 0x092
  128. UCHAR Reserved4;
  129. UCHAR SystemBoardSetup; // Offset 0x094
  130. UCHAR Reserved5;
  131. UCHAR AdapterSetup; // Offset 0x096
  132. UCHAR AdapterSetup2; // Offset 0x097
  133. UCHAR Reserved7[8];
  134. UCHAR Interrupt2ControlPort0; // Offset 0x0a0
  135. UCHAR Interrupt2ControlPort1; // Offset 0x0a1
  136. UCHAR Reserved8[32-2];
  137. #if defined(NEC_98)
  138. #else
  139. DMA2_CONTROL Dma2BasePort; // Offset 0x0c0
  140. UCHAR Reserved9[32];
  141. PROGRAMMABLE_OPTION_SELECT Pos; // Offset 0x100
  142. #endif //NEC_98
  143. } MCA_CONTROL, *PMCA_CONTROL;
  144. //
  145. // Define POS adapter setup equates for use with AdapterSetup field above
  146. //
  147. #define MCA_ADAPTER_SETUP_ON 0x008
  148. #define MCA_ADAPTER_SETUP_OFF 0x000
  149. //
  150. // Define DMA Extended Function register
  151. //
  152. typedef struct _DMA_EXTENDED_FUNCTION {
  153. UCHAR ChannelNumber : 3;
  154. UCHAR Reserved : 1;
  155. UCHAR Command : 4;
  156. } DMA_EXTENDED_FUNCTION, *PDMA_EXTENDED_FUNCTION;
  157. //
  158. // Define Command values
  159. //
  160. #define WRITE_IO_ADDRESS 0x00 // write I/O address reg
  161. #define WRITE_MEMORY_ADDRESS 0x20 // write memory address reg
  162. #define READ_MEMORY_ADDRESS 0x30 // read memory address reg
  163. #define WRITE_TRANSFER_COUNT 0x40 // write transfer count reg
  164. #define READ_TRANSFER_COUNT 0x50 // read transfer count reg
  165. #define READ_STATUS 0x60 // read status register
  166. #define WRITE_MODE 0x70 // write mode register
  167. #define WRITE_ARBUS 0x80 // write arbus register
  168. #define SET_MASK_BIT 0x90 // set bit in mask reg
  169. #define CLEAR_MASK_BIT 0xa0 // clear bit in mask reg
  170. #define MASTER_CLEAR 0xd0 // master clear
  171. //
  172. // Define DMA Extended Mode register
  173. //
  174. typedef struct _DMA_EXTENDED_MODE_MCA {
  175. UCHAR ProgrammedIo : 1; // 0 = do not use programmed i/o address
  176. UCHAR Reserved0 : 1;
  177. UCHAR DmaOpcode : 1; // 0 = verify memory, 1 = data transfer
  178. UCHAR TransferDirection : 1; // 0 = read memory, 1 = write memory
  179. UCHAR Reserved1 : 2;
  180. UCHAR DmaWidth : 1; // 0 = 8bit, 1 = 16bit
  181. UCHAR Reserved2 : 1;
  182. } DMA_EXTENDED_MODE_MCA, *PDMA_EXTENDED_MODE_MCA;
  183. //
  184. // DMA Extended Mode equates for use with the _DMA_EXTENDED_MODE structure.
  185. //
  186. #define DMA_EXT_USE_PIO 0x01
  187. #define DMA_EXT_NO_PIO 0x00
  188. #define DMA_EXT_VERIFY 0x00
  189. #define DMA_EXT_DATA_XFER 0x01
  190. #define DMA_EXT_WIDTH_8_BIT 0x00
  191. #define DMA_EXT_WIDTH_16_BIT 0x01
  192. //
  193. // DMA mode option definitions
  194. //
  195. #define DMA_MODE_READ 0x00 // read data into memory
  196. #define DMA_MODE_WRITE 0x08 // write data from memory
  197. #define DMA_MODE_VERIFY 0x00 // verify data
  198. #define DMA_MODE_TRANSFER 0x04 // transfer data
  199. //
  200. // DMA extended mode constants
  201. //
  202. #define MAX_MCA_DMA_CHANNEL_NUMBER 0x07 // maximum MCA DMA channel number
  203. #endif