Source code of Windows XP (NT5)
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.

206 lines
8.1 KiB

  1. /*****************************************************************************
  2. ** **
  3. ** COPYRIGHT (C) 2000, 2001 MKNET CORPORATION **
  4. ** DEVELOPED FOR THE MK7100-BASED VFIR PCI CONTROLLER. **
  5. ** **
  6. *****************************************************************************/
  7. /**********************************************************************
  8. Module Name:
  9. WINPCI.H
  10. Comments:
  11. PCI & Windows PCI defs.
  12. **********************************************************************/
  13. #ifndef _WINPCI_H
  14. #define _WINPCI_H
  15. //-------------------------------------------------------------------------
  16. // PCI configuration hardware ports
  17. //-------------------------------------------------------------------------
  18. #define CF1_CONFIG_ADDR_REGISTER 0x0CF8
  19. #define CF1_CONFIG_DATA_REGISTER 0x0CFC
  20. #define CF2_SPACE_ENABLE_REGISTER 0x0CF8
  21. #define CF2_FORWARD_REGISTER 0x0CFA
  22. #define CF2_BASE_ADDRESS 0xC000
  23. //-------------------------------------------------------------------------
  24. // Configuration Space Header
  25. //-------------------------------------------------------------------------
  26. typedef struct _PCI_CONFIG_STRUC {
  27. USHORT PciVendorId; // PCI Vendor ID
  28. USHORT PciDeviceId; // PCI Device ID
  29. USHORT PciCommand;
  30. USHORT PciStatus;
  31. UCHAR PciRevisionId;
  32. UCHAR PciClassCode[3];
  33. UCHAR PciCacheLineSize;
  34. UCHAR PciLatencyTimer;
  35. UCHAR PciHeaderType;
  36. UCHAR PciBIST;
  37. ULONG PciBaseReg0;
  38. ULONG PciBaseReg1;
  39. ULONG PciBaseReg2;
  40. ULONG PciBaseReg3;
  41. ULONG PciBaseReg4;
  42. ULONG PciBaseReg5;
  43. ULONG PciReserved0;
  44. ULONG PciReserved1;
  45. ULONG PciExpROMAddress;
  46. ULONG PciReserved2;
  47. ULONG PciReserved3;
  48. UCHAR PciInterruptLine;
  49. UCHAR PciInterruptPin;
  50. UCHAR PciMinGnt;
  51. UCHAR PciMaxLat;
  52. } PCI_CONFIG_STRUC, *PPCI_CONFIG_STRUC;
  53. //----------------------------------------------------------------------
  54. // PCI Config Space
  55. //----------------------------------------------------------------------
  56. #define PCI_VENDOR_ID_REGISTER 0x00 // PCI Vendor ID Register
  57. #define PCI_DEVICE_ID_REGISTER 0x02 // PCI Device ID Register
  58. #define PCI_CONFIG_ID_REGISTER 0x00 // PCI Configuration ID Register
  59. #define PCI_COMMAND_REGISTER 0x04 // PCI Command Register
  60. #define PCI_STATUS_REGISTER 0x06 // PCI Status Register
  61. #define PCI_REV_ID_REGISTER 0x08 // PCI Revision ID Register
  62. #define PCI_CLASS_CODE_REGISTER 0x09 // PCI Class Code Register
  63. #define PCI_CACHE_LINE_REGISTER 0x0C // PCI Cache Line Register
  64. #define PCI_LATENCY_TIMER 0x0D // PCI Latency Timer Register
  65. #define PCI_HEADER_TYPE 0x0E // PCI Header Type Register
  66. #define PCI_BIST_REGISTER 0x0F // PCI Built-In SelfTest Register
  67. #define PCI_BAR_0_REGISTER 0x10 // PCI Base Address Register 0
  68. #define PCI_BAR_1_REGISTER 0x14 // PCI Base Address Register 1
  69. #define PCI_BAR_2_REGISTER 0x18 // PCI Base Address Register 2
  70. #define PCI_BAR_3_REGISTER 0x1C // PCI Base Address Register 3
  71. #define PCI_BAR_4_REGISTER 0x20 // PCI Base Address Register 4
  72. #define PCI_BAR_5_REGISTER 0x24 // PCI Base Address Register 5
  73. #define PCI_SUBVENDOR_ID_REGISTER 0x2C // PCI SubVendor ID Register
  74. #define PCI_SUBDEVICE_ID_REGISTER 0x2E // PCI SubDevice ID Register
  75. #define PCI_EXPANSION_ROM 0x30 // PCI Expansion ROM Base Register
  76. #define PCI_INTERRUPT_LINE 0x3C // PCI Interrupt Line Register
  77. #define PCI_INTERRUPT_PIN 0x3D // PCI Interrupt Pin Register
  78. #define PCI_MIN_GNT_REGISTER 0x3E // PCI Min-Gnt Register
  79. #define PCI_MAX_LAT_REGISTER 0x3F // PCI Max_Lat Register
  80. #define PCI_NODE_ADDR_REGISTER 0x40 // PCI Node Address Register
  81. //-------------------------------------------------------------------------
  82. // PCI Class Code Definitions
  83. // Configuration Space Header
  84. //-------------------------------------------------------------------------
  85. #define PCI_BASE_CLASS 0x02 // Base Class - Network Controller
  86. #define PCI_SUB_CLASS 0x00 // Sub Class - Ethernet Controller
  87. #define PCI_PROG_INTERFACE 0x00 // Prog I/F - Ethernet COntroller
  88. //-------------------------------------------------------------------------
  89. // The following is copied from EQUATES.H
  90. // Bit Mask definitions
  91. //-------------------------------------------------------------------------
  92. #define BIT_0 0x0001
  93. #define BIT_1 0x0002
  94. #define BIT_2 0x0004
  95. #define BIT_3 0x0008
  96. #define BIT_4 0x0010
  97. #define BIT_5 0x0020
  98. #define BIT_6 0x0040
  99. #define BIT_7 0x0080
  100. #define BIT_8 0x0100
  101. #define BIT_9 0x0200
  102. #define BIT_10 0x0400
  103. #define BIT_11 0x0800
  104. #define BIT_12 0x1000
  105. #define BIT_13 0x2000
  106. #define BIT_14 0x4000
  107. #define BIT_15 0x8000
  108. #define BIT_24 0x01000000
  109. #define BIT_28 0x10000000
  110. //-------------------------------------------------------------------------
  111. // PCI Command Register Bit Definitions
  112. // Configuration Space Header
  113. //-------------------------------------------------------------------------
  114. #define CMD_IO_SPACE BIT_0
  115. #define CMD_MEMORY_SPACE BIT_1
  116. #define CMD_BUS_MASTER BIT_2
  117. #define CMD_SPECIAL_CYCLES BIT_3
  118. #define CMD_MEM_WRT_INVALIDATE BIT_4
  119. #define CMD_VGA_PALLETTE_SNOOP BIT_5
  120. #define CMD_PARITY_RESPONSE BIT_6
  121. #define CMD_WAIT_CYCLE_CONTROL BIT_7
  122. #define CMD_SERR_ENABLE BIT_8
  123. #define CMD_BACK_TO_BACK BIT_9
  124. //-------------------------------------------------------------------------
  125. // PCI Status Register Bit Definitions
  126. // Configuration Space Header
  127. //-------------------------------------------------------------------------
  128. #define STAT_BACK_TO_BACK BIT_7
  129. #define STAT_DATA_PARITY BIT_8
  130. #define STAT_DEVSEL_TIMING BIT_9 OR BIT_10
  131. #define STAT_SIGNAL_TARGET_ABORT BIT_11
  132. #define STAT_RCV_TARGET_ABORT BIT_12
  133. #define STAT_RCV_MASTER_ABORT BIT_13
  134. #define STAT_SIGNAL_MASTER_ABORT BIT_14
  135. #define STAT_DETECT_PARITY_ERROR BIT_15
  136. //-------------------------------------------------------------------------
  137. // PCI Base Address Register For Memory (BARM) Bit Definitions
  138. // Configuration Space Header
  139. //-------------------------------------------------------------------------
  140. #define BARM_LOCATE_BELOW_1_MEG BIT_1
  141. #define BARM_LOCATE_IN_64_SPACE BIT_2
  142. #define BARM_PREFETCHABLE BIT_3
  143. //-------------------------------------------------------------------------
  144. // PCI Base Address Register For I/O (BARIO) Bit Definitions
  145. // Configuration Space Header
  146. //-------------------------------------------------------------------------
  147. #define BARIO_SPACE_INDICATOR BIT_0
  148. //-------------------------------------------------------------------------
  149. // PCI BIOS Definitions
  150. // Refer To The PCI BIOS Specification
  151. //-------------------------------------------------------------------------
  152. //- Function Code List
  153. #define PCI_FUNCTION_ID 0xB1 // AH Register
  154. #define PCI_BIOS_PRESENT 0x01 // AL Register
  155. #define FIND_PCI_DEVICE 0x02 // AL Register
  156. #define FIND_PCI_CLASS_CODE 0x03 // AL Register
  157. #define GENERATE_SPECIAL_CYCLE 0x06 // AL Register
  158. #define READ_CONFIG_BYTE 0x08 // AL Register
  159. #define READ_CONFIG_WORD 0x09 // AL Register
  160. #define READ_CONFIG_DWORD 0x0A // AL Register
  161. #define WRITE_CONFIG_BYTE 0x0B // AL Register
  162. #define WRITE_CONFIG_WORD 0x0C // AL Register
  163. #define WRITE_CONFIG_DWORD 0x0D // AL Register
  164. //- Function Return Code List
  165. #define SUCCESSFUL 0x00
  166. #define FUNC_NOT_SUPPORTED 0x81
  167. #define BAD_VENDOR_ID 0x83
  168. #define DEVICE_NOT_FOUND 0x86
  169. #define BAD_REGISTER_NUMBER 0x87
  170. //- PCI BIOS Calls
  171. #define PCI_BIOS_INTERRUPT 0x1A // PCI BIOS Int 1Ah Function Call
  172. #define PCI_PRESENT_CODE 0x20494350 // Hex Equivalent Of 'PCI '
  173. #define PCI_SERVICE_IDENTIFIER 0x49435024 // ASCII Codes for 'ICP$'
  174. //- Device and Vendor IDs
  175. #define MK7_PCI_DEVICE_ID 0x7100
  176. #define MKNET_PCI_VENDOR_ID 0x1641
  177. // For debugging
  178. #define DBG_DEVICE_ID 0x7100
  179. #define DBG_VENDOR_ID 0x2828
  180. #endif // _WINPCI_H