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.

790 lines
36 KiB

  1. /****************************************************************************
  2. ** COPYRIGHT (C) 1994-1997 INTEL CORPORATION **
  3. ** DEVELOPED FOR MICROSOFT BY INTEL CORP., HILLSBORO, OREGON **
  4. ** HTTP://WWW.INTEL.COM/ **
  5. ** THIS FILE IS PART OF THE INTEL ETHEREXPRESS PRO/100B(TM) AND **
  6. ** ETHEREXPRESS PRO/100+(TM) NDIS 5.0 MINIPORT SAMPLE DRIVER **
  7. ****************************************************************************/
  8. /****************************************************************************
  9. Module Name:
  10. e100_557.h (82557.h)
  11. This driver runs on the following hardware:
  12. - 82558 based PCI 10/100Mb ethernet adapters
  13. (aka Intel EtherExpress(TM) PRO Adapters)
  14. Environment:
  15. Kernel Mode - Or whatever is the equivalent on WinNT
  16. Revision History
  17. - JCB 8/14/97 Example Driver Created
  18. - Dchen 11-01-99 Modified for the new sample driver
  19. *****************************************************************************/
  20. #ifndef _E100_557_H
  21. #define _E100_557_H
  22. //-------------------------------------------------------------------------
  23. // D100 Stepping Defines
  24. //-------------------------------------------------------------------------
  25. #define D100_A_STEP 0 // NEVER SHIPPED
  26. #define D100_B_STEP 1 // d100 first shipped silicon
  27. #define D100_C_STEP 2 // d100' (c-step) with vendor/id and hw fix
  28. #define D101_A_STEP 4 // first silicon of d101
  29. //-------------------------------------------------------------------------
  30. // E100 Stepping Defines - used in PoMgmt Decisions
  31. //-------------------------------------------------------------------------
  32. #define E100_82557_A_STEP 1
  33. #define E100_82557_B_STEP 2
  34. #define E100_82557_C_STEP 3
  35. #define E100_82558_A_STEP 4
  36. #define E100_82558_B_STEP 5
  37. #define E100_82559_A_STEP 6
  38. #define E100_82559_B_STEP 7
  39. #define E100_82559_C_STEP 8
  40. #define E100_82559ER_A_STEP 9
  41. //-------------------------------------------------------------------------
  42. // D100 PORT functions -- lower 4 bits
  43. //-------------------------------------------------------------------------
  44. #define PORT_SOFTWARE_RESET 0
  45. #define PORT_SELFTEST 1
  46. #define PORT_SELECTIVE_RESET 2
  47. #define PORT_DUMP 3
  48. //-------------------------------------------------------------------------
  49. // CSR field definitions -- Offsets from CSR base
  50. //-------------------------------------------------------------------------
  51. #define SCB_STATUS_LOW_BYTE 0x0
  52. #define SCB_STATUS_HIGH_BYTE 0x1
  53. #define SCB_COMMAND_LOW_BYTE 0x2
  54. #define SCB_COMMAND_HIGH_BYTE 0x3
  55. #define SCB_GENERAL_POINTER 0x4
  56. #define CSR_PORT_LOW_WORD 0x8
  57. #define CSR_PORT_HIGH_WORD 0x0a
  58. #define CSR_FLASH_CONTROL_REG 0x0c
  59. #define CSR_EEPROM_CONTROL_REG 0x0e
  60. #define CSR_MDI_CONTROL_LOW_WORD 0x10
  61. #define CSR_MDI_CONTROL_HIGH_WORD 0x12
  62. //-------------------------------------------------------------------------
  63. // SCB Status Word bit definitions
  64. //-------------------------------------------------------------------------
  65. //- Interrupt status fields
  66. #define SCB_STATUS_MASK BIT_12_15 // ACK Mask
  67. #define SCB_STATUS_CX BIT_15 // CU Completed Action Cmd
  68. #define SCB_STATUS_FR BIT_14 // RU Received A Frame
  69. #define SCB_STATUS_CNA BIT_13 // CU Became Inactive (IDLE)
  70. #define SCB_STATUS_RNR BIT_12 // RU Became Not Ready
  71. #define SCB_STATUS_MDI BIT_11 // MDI read or write done
  72. #define SCB_STATUS_SWI BIT_10 // Software generated interrupt
  73. //- Interrupt ACK fields
  74. #define SCB_ACK_MASK (BIT_9 | BIT_12_15 | BIT_8) // ACK Mask
  75. #define SCB_ACK_CX BIT_15 // CU Completed Action Cmd
  76. #define SCB_ACK_FR BIT_14 // RU Received A Frame
  77. #define SCB_ACK_CNA BIT_13 // CU Became Inactive (IDLE)
  78. #define SCB_ACK_RNR BIT_12 // RU Became Not Ready
  79. #define SCB_ACK_MDI BIT_11 // MDI read or write done
  80. #define SCB_ACK_SWI BIT_10 // Software generated interrupt
  81. #define SCB_ACK_ER BIT_9 // Early Receive interrupt
  82. #define SCB_ACK_FCP BIT_8 // Flow Control Pause interrupt
  83. //- CUS Fields
  84. #define SCB_CUS_MASK (BIT_6 | BIT_7) // CUS 2-bit Mask
  85. #define SCB_CUS_IDLE 0 // CU Idle
  86. #define SCB_CUS_SUSPEND BIT_6 // CU Suspended
  87. #define SCB_CUS_ACTIVE BIT_7 // CU Active
  88. //- RUS Fields
  89. #define SCB_RUS_IDLE 0 // RU Idle
  90. #define SCB_RUS_MASK BIT_2_5 // RUS 3-bit Mask
  91. #define SCB_RUS_SUSPEND BIT_2 // RU Suspended
  92. #define SCB_RUS_NO_RESOURCES BIT_3 // RU Out Of Resources
  93. #define SCB_RUS_READY BIT_4 // RU Ready
  94. #define SCB_RUS_SUSP_NO_RBDS (BIT_2 | BIT_5) // RU No More RBDs
  95. #define SCB_RUS_NO_RBDS (BIT_3 | BIT_5) // RU No More RBDs
  96. #define SCB_RUS_READY_NO_RBDS (BIT_4 | BIT_5) // RU Ready, No RBDs
  97. //-------------------------------------------------------------------------
  98. // SCB Command Word bit definitions
  99. //-------------------------------------------------------------------------
  100. //- CUC fields
  101. #define SCB_CUC_MASK BIT_4_6 // CUC 3-bit Mask
  102. #define SCB_CUC_START BIT_4 // CU Start
  103. #define SCB_CUC_RESUME BIT_5 // CU Resume
  104. #define SCB_CUC_DUMP_ADDR BIT_6 // CU Dump Counters Address
  105. #define SCB_CUC_DUMP_STAT (BIT_4 | BIT_6) // CU Dump statistics counters
  106. #define SCB_CUC_LOAD_BASE (BIT_5 | BIT_6) // Load the CU base
  107. #define SCB_CUC_DUMP_RST_STAT BIT_4_6 // CU Dump and reset statistics counters
  108. #define SCB_CUC_STATIC_RESUME (BIT_5 | BIT_7) // CU Static Resume
  109. //- RUC fields
  110. #define SCB_RUC_MASK BIT_0_2 // RUC 3-bit Mask
  111. #define SCB_RUC_START BIT_0 // RU Start
  112. #define SCB_RUC_RESUME BIT_1 // RU Resume
  113. #define SCB_RUC_ABORT BIT_2 // RU Abort
  114. #define SCB_RUC_LOAD_HDS (BIT_0 | BIT_2) // Load RFD Header Data Size
  115. #define SCB_RUC_LOAD_BASE (BIT_1 | BIT_2) // Load the RU base
  116. #define SCB_RUC_RBD_RESUME BIT_0_2 // RBD resume
  117. // Interrupt fields (assuming byte addressing)
  118. #define SCB_INT_MASK BIT_0 // Mask interrupts
  119. #define SCB_SOFT_INT BIT_1 // Generate a software interrupt
  120. //-------------------------------------------------------------------------
  121. // EEPROM bit definitions
  122. //-------------------------------------------------------------------------
  123. //- EEPROM control register bits
  124. #define EN_TRNF 0x10 // Enable turnoff
  125. #define EEDO 0x08 // EEPROM data out
  126. #define EEDI 0x04 // EEPROM data in (set for writing data)
  127. #define EECS 0x02 // EEPROM chip select (1=high, 0=low)
  128. #define EESK 0x01 // EEPROM shift clock (1=high, 0=low)
  129. //- EEPROM opcodes
  130. #define EEPROM_READ_OPCODE 06
  131. #define EEPROM_WRITE_OPCODE 05
  132. #define EEPROM_ERASE_OPCODE 07
  133. #define EEPROM_EWEN_OPCODE 19 // Erase/write enable
  134. #define EEPROM_EWDS_OPCODE 16 // Erase/write disable
  135. //- EEPROM data locations
  136. #define EEPROM_NODE_ADDRESS_BYTE_0 0
  137. #define EEPROM_FLAGS_WORD_3 3
  138. #define EEPROM_FLAG_10MC BIT_0
  139. #define EEPROM_FLAG_100MC BIT_1
  140. //-------------------------------------------------------------------------
  141. // MDI Control register bit definitions
  142. //-------------------------------------------------------------------------
  143. #define MDI_DATA_MASK BIT_0_15 // MDI Data port
  144. #define MDI_REG_ADDR BIT_16_20 // which MDI register to read/write
  145. #define MDI_PHY_ADDR BIT_21_25 // which PHY to read/write
  146. #define MDI_PHY_OPCODE BIT_26_27 // which PHY to read/write
  147. #define MDI_PHY_READY BIT_28 // PHY is ready for another MDI cycle
  148. #define MDI_PHY_INT_ENABLE BIT_29 // Assert INT at MDI cycle completion
  149. //-------------------------------------------------------------------------
  150. // MDI Control register opcode definitions
  151. //-------------------------------------------------------------------------
  152. #define MDI_WRITE 1 // Phy Write
  153. #define MDI_READ 2 // Phy read
  154. //-------------------------------------------------------------------------
  155. // D100 Action Commands
  156. //-------------------------------------------------------------------------
  157. #define CB_NOP 0
  158. #define CB_IA_ADDRESS 1
  159. #define CB_CONFIGURE 2
  160. #define CB_MULTICAST 3
  161. #define CB_TRANSMIT 4
  162. #define CB_LOAD_MICROCODE 5
  163. #define CB_DUMP 6
  164. #define CB_DIAGNOSE 7
  165. //-------------------------------------------------------------------------
  166. // Command Block (CB) Field Definitions
  167. //-------------------------------------------------------------------------
  168. //- CB Command Word
  169. #define CB_EL_BIT BIT_15 // CB EL Bit
  170. #define CB_S_BIT BIT_14 // CB Suspend Bit
  171. #define CB_I_BIT BIT_13 // CB Interrupt Bit
  172. #define CB_TX_SF_BIT BIT_3 // TX CB Flexible Mode
  173. #define CB_CMD_MASK BIT_0_2 // CB 3-bit CMD Mask
  174. //- CB Status Word
  175. #define CB_STATUS_MASK BIT_12_15 // CB Status Mask (4-bits)
  176. #define CB_STATUS_COMPLETE BIT_15 // CB Complete Bit
  177. #define CB_STATUS_OK BIT_13 // CB OK Bit
  178. #define CB_STATUS_UNDERRUN BIT_12 // CB A Bit
  179. #define CB_STATUS_FAIL BIT_11 // CB Fail (F) Bit
  180. //misc command bits
  181. #define CB_TX_EOF_BIT BIT_15 // TX CB/TBD EOF Bit
  182. //-------------------------------------------------------------------------
  183. // Config CB Parameter Fields
  184. //-------------------------------------------------------------------------
  185. #define CB_CFIG_BYTE_COUNT 22 // 22 config bytes
  186. #define CB_SHORT_CFIG_BYTE_COUNT 8 // 8 config bytes
  187. // byte 0 bit definitions
  188. #define CB_CFIG_BYTE_COUNT_MASK BIT_0_5 // Byte count occupies bit 5-0
  189. // byte 1 bit definitions
  190. #define CB_CFIG_RXFIFO_LIMIT_MASK BIT_0_4 // RxFifo limit mask
  191. #define CB_CFIG_TXFIFO_LIMIT_MASK BIT_4_7 // TxFifo limit mask
  192. // byte 3 bit definitions --
  193. #define CB_CFIG_B3_MWI_ENABLE BIT_0 // Memory Write Invalidate Enable Bit
  194. // byte 4 bit definitions
  195. #define CB_CFIG_RX_MIN_DMA_MASK BIT_0_6 // Rx minimum DMA count mask
  196. // byte 5 bit definitions
  197. #define CB_CFIG_TX_MIN_DMA_MASK BIT_0_6 // Tx minimum DMA count mask
  198. #define CB_CFIG_DMBC_EN BIT_7 // Enable Tx/Rx minimum DMA counts
  199. // byte 6 bit definitions
  200. #define CB_CFIG_LATE_SCB BIT_0 // Update SCB After New Tx Start
  201. #define CB_CFIG_TNO_INT BIT_2 // Tx Not OK Interrupt
  202. #define CB_CFIG_CI_INT BIT_3 // Command Complete Interrupt
  203. #define CB_CFIG_SAVE_BAD_FRAMES BIT_7 // Save Bad Frames Enabled
  204. // byte 7 bit definitions
  205. #define CB_CFIG_DISC_SHORT_FRAMES BIT_0 // Discard Short Frames
  206. #define CB_CFIG_URUN_RETRY BIT_1_2 // Underrun Retry Count
  207. // byte 8 bit definitions
  208. #define CB_CFIG_503_MII BIT_0 // 503 vs. MII mode
  209. // byte 9 bit definitions -- pre-defined all zeros
  210. // byte 10 bit definitions
  211. #define CB_CFIG_NO_SRCADR BIT_3 // No Source Address Insertion
  212. #define CB_CFIG_PREAMBLE_LEN BIT_4_5 // Preamble Length
  213. #define CB_CFIG_LOOPBACK_MODE BIT_6_7 // Loopback Mode
  214. // byte 11 bit definitions
  215. #define CB_CFIG_LINEAR_PRIORITY BIT_0_2 // Linear Priority
  216. // byte 12 bit definitions
  217. #define CB_CFIG_LINEAR_PRI_MODE BIT_0 // Linear Priority mode
  218. #define CB_CFIG_IFS_MASK BIT_4_7 // CSMA level Interframe Spacing mask
  219. // byte 13 bit definitions -- pre-defined all zeros
  220. // byte 14 bit definitions -- pre-defined 0xf2
  221. // byte 15 bit definitions
  222. #define CB_CFIG_PROMISCUOUS BIT_0 // Promiscuous Mode Enable
  223. #define CB_CFIG_BROADCAST_DIS BIT_1 // Broadcast Mode Disable
  224. #define CB_CFIG_CRS_OR_CDT BIT_7 // CRS Or CDT
  225. // byte 16 bit definitions -- pre-defined all zeros
  226. // byte 17 bit definitions -- pre-defined 0x40
  227. // byte 18 bit definitions
  228. #define CB_CFIG_STRIPPING BIT_0 // Stripping Disabled
  229. #define CB_CFIG_PADDING BIT_1 // Padding Disabled
  230. #define CB_CFIG_CRC_IN_MEM BIT_2 // Transfer CRC To Memory
  231. // byte 19 bit definitions
  232. #define CB_CFIG_FORCE_FDX BIT_6 // Force Full Duplex
  233. #define CB_CFIG_FDX_ENABLE BIT_7 // Full Duplex Enabled
  234. // byte 20 bit definitions
  235. #define CB_CFIG_MULTI_IA BIT_6 // Multiple IA Addr
  236. // byte 21 bit definitions
  237. #define CB_CFIG_MULTICAST_ALL BIT_3 // Multicast All
  238. //-------------------------------------------------------------------------
  239. // Receive Frame Descriptor Fields
  240. //-------------------------------------------------------------------------
  241. //- RFD Status Bits
  242. #define RFD_RECEIVE_COLLISION BIT_0 // Collision detected on Receive
  243. #define RFD_IA_MATCH BIT_1 // Indv Address Match Bit
  244. #define RFD_RX_ERR BIT_4 // RX_ERR pin on Phy was set
  245. #define RFD_FRAME_TOO_SHORT BIT_7 // Receive Frame Short
  246. #define RFD_DMA_OVERRUN BIT_8 // Receive DMA Overrun
  247. #define RFD_NO_RESOURCES BIT_9 // No Buffer Space
  248. #define RFD_ALIGNMENT_ERROR BIT_10 // Alignment Error
  249. #define RFD_CRC_ERROR BIT_11 // CRC Error
  250. #define RFD_STATUS_OK BIT_13 // RFD OK Bit
  251. #define RFD_STATUS_COMPLETE BIT_15 // RFD Complete Bit
  252. //- RFD Command Bits
  253. #define RFD_EL_BIT BIT_15 // RFD EL Bit
  254. #define RFD_S_BIT BIT_14 // RFD Suspend Bit
  255. #define RFD_H_BIT BIT_4 // Header RFD Bit
  256. #define RFD_SF_BIT BIT_3 // RFD Flexible Mode
  257. //- RFD misc bits
  258. #define RFD_EOF_BIT BIT_15 // RFD End-Of-Frame Bit
  259. #define RFD_F_BIT BIT_14 // RFD Buffer Fetch Bit
  260. #define RFD_ACT_COUNT_MASK BIT_0_13 // RFD Actual Count Mask
  261. #define RFD_HEADER_SIZE 0x10 // Size of RFD Header (16 bytes)
  262. //-------------------------------------------------------------------------
  263. // Receive Buffer Descriptor Fields
  264. //-------------------------------------------------------------------------
  265. #define RBD_EOF_BIT BIT_15 // RBD End-Of-Frame Bit
  266. #define RBD_F_BIT BIT_14 // RBD Buffer Fetch Bit
  267. #define RBD_ACT_COUNT_MASK BIT_0_13 // RBD Actual Count Mask
  268. #define SIZE_FIELD_MASK BIT_0_13 // Size of the associated buffer
  269. #define RBD_EL_BIT BIT_15 // RBD EL Bit
  270. //-------------------------------------------------------------------------
  271. // Size Of Dump Buffer
  272. //-------------------------------------------------------------------------
  273. #define DUMP_BUFFER_SIZE 600 // size of the dump buffer
  274. //-------------------------------------------------------------------------
  275. // Self Test Results
  276. //-------------------------------------------------------------------------
  277. #define CB_SELFTEST_FAIL_BIT BIT_12
  278. #define CB_SELFTEST_DIAG_BIT BIT_5
  279. #define CB_SELFTEST_REGISTER_BIT BIT_3
  280. #define CB_SELFTEST_ROM_BIT BIT_2
  281. #define CB_SELFTEST_ERROR_MASK ( \
  282. CB_SELFTEST_FAIL_BIT | CB_SELFTEST_DIAG_BIT | \
  283. CB_SELFTEST_REGISTER_BIT | CB_SELFTEST_ROM_BIT)
  284. //-------------------------------------------------------------------------
  285. // Driver Configuration Default Parameters for the 557
  286. // Note: If the driver uses any defaults that are different from the chip's
  287. // defaults, it will be noted below
  288. //-------------------------------------------------------------------------
  289. // Byte 0 (byte count) default
  290. #define CB_557_CFIG_DEFAULT_PARM0 CB_CFIG_BYTE_COUNT
  291. // Byte 1 (fifo limits) default
  292. #define DEFAULT_TX_FIFO_LIMIT 0x08
  293. #define DEFAULT_RX_FIFO_LIMIT 0x08
  294. #define CB_557_CFIG_DEFAULT_PARM1 0x88
  295. // Byte 2 (IFS) default
  296. #define CB_557_CFIG_DEFAULT_PARM2 0x00
  297. // Byte 3 (reserved) default
  298. #define CB_557_CFIG_DEFAULT_PARM3 0x00
  299. // Byte 4 (Rx DMA min count) default
  300. #define CB_557_CFIG_DEFAULT_PARM4 0x00
  301. // Byte 5 (Tx DMA min count, DMA min count enable) default
  302. #define CB_557_CFIG_DEFAULT_PARM5 0x00
  303. // Byte 6 (Late SCB, TNO int, CI int, Save bad frames) default
  304. #define CB_557_CFIG_DEFAULT_PARM6 0x32
  305. // Byte 7 (Discard short frames, underrun retry) default
  306. // note: disc short frames will be enabled
  307. #define DEFAULT_UNDERRUN_RETRY 0x01
  308. #define CB_557_CFIG_DEFAULT_PARM7 0x01
  309. // Byte 8 (MII or 503) default
  310. // note: MII will be the default
  311. #define CB_557_CFIG_DEFAULT_PARM8 0x01
  312. // Byte 9 - Power management for 82558B, 82559
  313. #define CB_WAKE_ON_LINK_BYTE9 0x20
  314. #define CB_WAKE_ON_ARP_PKT_BYTE9 0x40
  315. #define CB_557_CFIG_DEFAULT_PARM9 0
  316. // Byte 10 (scr addr insertion, preamble, loopback) default
  317. #define CB_557_CFIG_DEFAULT_PARM10 0x2e
  318. // Byte 11 (linear priority) default
  319. #define CB_557_CFIG_DEFAULT_PARM11 0x00
  320. // Byte 12 (IFS,linear priority mode) default
  321. #define CB_557_CFIG_DEFAULT_PARM12 0x60
  322. // Byte 13 (reserved) default
  323. #define CB_557_CFIG_DEFAULT_PARM13 0x00
  324. // Byte 14 (reserved) default
  325. #define CB_557_CFIG_DEFAULT_PARM14 0xf2
  326. // Byte 15 (promiscuous, broadcast, CRS/CDT) default
  327. #define CB_557_CFIG_DEFAULT_PARM15 0xea
  328. // Byte 16 (reserved) default
  329. #define CB_557_CFIG_DEFAULT_PARM16 0x00
  330. // Byte 17 (reserved) default
  331. #define CB_557_CFIG_DEFAULT_PARM17 0x40
  332. // Byte 18 (Stripping, padding, Rcv CRC in mem) default
  333. // note: padding will be enabled
  334. #define CB_557_CFIG_DEFAULT_PARM18 0xf2
  335. // Byte 19 (reserved) default
  336. // note: full duplex is enabled if FDX# pin is 0
  337. #define CB_557_CFIG_DEFAULT_PARM19 0x80
  338. // Byte 20 (multi-IA) default
  339. #define CB_557_CFIG_DEFAULT_PARM20 0x3f
  340. // Byte 21 (multicast all) default
  341. #define CB_557_CFIG_DEFAULT_PARM21 0x05
  342. #pragma pack(1)
  343. //-------------------------------------------------------------------------
  344. // Ethernet Frame Structure
  345. //-------------------------------------------------------------------------
  346. //- Ethernet 6-byte Address
  347. typedef struct _ETH_ADDRESS_STRUC {
  348. UCHAR EthNodeAddress[ETHERNET_ADDRESS_LENGTH];
  349. } ETH_ADDRESS_STRUC, *PETH_ADDRESS_STRUC;
  350. //- Ethernet 14-byte Header
  351. typedef struct _ETH_HEADER_STRUC {
  352. UCHAR Destination[ETHERNET_ADDRESS_LENGTH];
  353. UCHAR Source[ETHERNET_ADDRESS_LENGTH];
  354. USHORT TypeLength;
  355. } ETH_HEADER_STRUC, *PETH_HEADER_STRUC;
  356. //- Ethernet Buffer (Including Ethernet Header) for Transmits
  357. typedef struct _ETH_TX_BUFFER_STRUC {
  358. ETH_HEADER_STRUC TxMacHeader;
  359. UCHAR TxBufferData[(TCB_BUFFER_SIZE - sizeof(ETH_HEADER_STRUC))];
  360. } ETH_TX_BUFFER_STRUC, *PETH_TX_BUFFER_STRUC;
  361. typedef struct _ETH_RX_BUFFER_STRUC {
  362. ETH_HEADER_STRUC RxMacHeader;
  363. UCHAR RxBufferData[(RCB_BUFFER_SIZE - sizeof(ETH_HEADER_STRUC))];
  364. } ETH_RX_BUFFER_STRUC, *PETH_RX_BUFFER_STRUC;
  365. //-------------------------------------------------------------------------
  366. // 82557 Data Structures
  367. //-------------------------------------------------------------------------
  368. //-------------------------------------------------------------------------
  369. // Self test
  370. //-------------------------------------------------------------------------
  371. typedef struct _SELF_TEST_STRUC {
  372. ULONG StSignature; // Self Test Signature
  373. ULONG StResults; // Self Test Results
  374. } SELF_TEST_STRUC, *PSELF_TEST_STRUC;
  375. //-------------------------------------------------------------------------
  376. // Control/Status Registers (CSR)
  377. //-------------------------------------------------------------------------
  378. typedef struct _CSR_STRUC {
  379. USHORT ScbStatus; // SCB Status register
  380. UCHAR ScbCommandLow; // SCB Command register (low byte)
  381. UCHAR ScbCommandHigh; // SCB Command register (high byte)
  382. ULONG ScbGeneralPointer; // SCB General pointer
  383. ULONG Port; // PORT register
  384. USHORT FlashControl; // Flash Control register
  385. USHORT EepromControl; // EEPROM control register
  386. ULONG MDIControl; // MDI Control Register
  387. ULONG RxDMAByteCount; // Receive DMA Byte count register
  388. } CSR_STRUC, *PCSR_STRUC;
  389. //-------------------------------------------------------------------------
  390. // Error Counters
  391. //-------------------------------------------------------------------------
  392. typedef struct _ERR_COUNT_STRUC {
  393. ULONG XmtGoodFrames; // Good frames transmitted
  394. ULONG XmtMaxCollisions; // Fatal frames -- had max collisions
  395. ULONG XmtLateCollisions; // Fatal frames -- had a late coll.
  396. ULONG XmtUnderruns; // Transmit underruns (fatal or re-transmit)
  397. ULONG XmtLostCRS; // Frames transmitted without CRS
  398. ULONG XmtDeferred; // Deferred transmits
  399. ULONG XmtSingleCollision; // Transmits that had 1 and only 1 coll.
  400. ULONG XmtMultCollisions; // Transmits that had multiple coll.
  401. ULONG XmtTotalCollisions; // Transmits that had 1+ collisions.
  402. ULONG RcvGoodFrames; // Good frames received
  403. ULONG RcvCrcErrors; // Aligned frames that had a CRC error
  404. ULONG RcvAlignmentErrors; // Receives that had alignment errors
  405. ULONG RcvResourceErrors; // Good frame dropped due to lack of resources
  406. ULONG RcvOverrunErrors; // Overrun errors - bus was busy
  407. ULONG RcvCdtErrors; // Received frames that encountered coll.
  408. ULONG RcvShortFrames; // Received frames that were to short
  409. ULONG CommandComplete; // A005h indicates cmd completion
  410. } ERR_COUNT_STRUC, *PERR_COUNT_STRUC;
  411. //-------------------------------------------------------------------------
  412. // Command Block (CB) Generic Header Structure
  413. //-------------------------------------------------------------------------
  414. typedef struct _CB_HEADER_STRUC {
  415. USHORT CbStatus; // Command Block Status
  416. USHORT CbCommand; // Command Block Command
  417. ULONG CbLinkPointer; // Link To Next CB
  418. } CB_HEADER_STRUC, *PCB_HEADER_STRUC;
  419. //-------------------------------------------------------------------------
  420. // NOP Command Block (NOP_CB)
  421. //-------------------------------------------------------------------------
  422. typedef struct _NOP_CB_STRUC {
  423. CB_HEADER_STRUC NopCBHeader;
  424. } NOP_CB_STRUC, *PNOP_CB_STRUC;
  425. //-------------------------------------------------------------------------
  426. // Individual Address Command Block (IA_CB)
  427. //-------------------------------------------------------------------------
  428. typedef struct _IA_CB_STRUC {
  429. CB_HEADER_STRUC IaCBHeader;
  430. UCHAR IaAddress[ETHERNET_ADDRESS_LENGTH];
  431. } IA_CB_STRUC, *PIA_CB_STRUC;
  432. //-------------------------------------------------------------------------
  433. // Configure Command Block (CONFIG_CB)
  434. //-------------------------------------------------------------------------
  435. typedef struct _CONFIG_CB_STRUC {
  436. CB_HEADER_STRUC ConfigCBHeader;
  437. UCHAR ConfigBytes[CB_CFIG_BYTE_COUNT];
  438. } CONFIG_CB_STRUC, *PCONFIG_CB_STRUC;
  439. //-------------------------------------------------------------------------
  440. // MultiCast Command Block (MULTICAST_CB)
  441. //-------------------------------------------------------------------------
  442. typedef struct _MULTICAST_CB_STRUC {
  443. CB_HEADER_STRUC McCBHeader;
  444. USHORT McCount; // Number of multicast addresses
  445. UCHAR McAddress[(ETHERNET_ADDRESS_LENGTH * MAX_MULTICAST_ADDRESSES)];
  446. } MULTICAST_CB_STRUC, *PMULTICAST_CB_STRUC;
  447. //-------------------------------------------------------------------------
  448. // WakeUp Filter Command Block (FILTER_CB)
  449. //-------------------------------------------------------------------------
  450. typedef struct _FILTER_CB_STRUC {
  451. CB_HEADER_STRUC FilterCBHeader;
  452. ULONG Pattern[16];
  453. }FILTER_CB_STRUC , *PFILTER_CB_STRUC ;
  454. //-------------------------------------------------------------------------
  455. // Dump Command Block (DUMP_CB)
  456. //-------------------------------------------------------------------------
  457. typedef struct _DUMP_CB_STRUC {
  458. CB_HEADER_STRUC DumpCBHeader;
  459. ULONG DumpAreaAddress; // Dump Buffer Area Address
  460. } DUMP_CB_STRUC, *PDUMP_CB_STRUC;
  461. //-------------------------------------------------------------------------
  462. // Dump Area structure definition
  463. //-------------------------------------------------------------------------
  464. typedef struct _DUMP_AREA_STRUC {
  465. UCHAR DumpBuffer[DUMP_BUFFER_SIZE];
  466. } DUMP_AREA_STRUC, *PDUMP_AREA_STRUC;
  467. //-------------------------------------------------------------------------
  468. // Diagnose Command Block (DIAGNOSE_CB)
  469. //-------------------------------------------------------------------------
  470. typedef struct _DIAGNOSE_CB_STRUC {
  471. CB_HEADER_STRUC DiagCBHeader;
  472. } DIAGNOSE_CB_STRUC, *PDIAGNOSE_CB_STRUC;
  473. //-------------------------------------------------------------------------
  474. // Transmit Command Block (TxCB)
  475. //-------------------------------------------------------------------------
  476. typedef struct _GENERIC_TxCB {
  477. CB_HEADER_STRUC TxCbHeader;
  478. ULONG TxCbTbdPointer; // TBD address
  479. USHORT TxCbCount; // Data Bytes In TCB past header
  480. UCHAR TxCbThreshold; // TX Threshold for FIFO Extender
  481. UCHAR TxCbTbdNumber;
  482. ETH_TX_BUFFER_STRUC TxCbData;
  483. ULONG pad0;
  484. ULONG pad1;
  485. ULONG pad2;
  486. ULONG pad3;
  487. } TXCB_STRUC, *PTXCB_STRUC;
  488. //-------------------------------------------------------------------------
  489. // Transmit Buffer Descriptor (TBD)
  490. //-------------------------------------------------------------------------
  491. typedef struct _TBD_STRUC {
  492. ULONG TbdBufferAddress; // Physical Transmit Buffer Address
  493. unsigned TbdCount :14;
  494. unsigned :1 ; // always 0
  495. unsigned EndOfList:1 ; // EL bit in Tbd
  496. unsigned :16; // field that is always 0's in a TBD
  497. } TBD_STRUC, *PTBD_STRUC;
  498. //-------------------------------------------------------------------------
  499. // Receive Frame Descriptor (RFD)
  500. //-------------------------------------------------------------------------
  501. typedef struct _RFD_STRUC {
  502. CB_HEADER_STRUC RfdCbHeader;
  503. ULONG RfdRbdPointer; // Receive Buffer Descriptor Addr
  504. USHORT RfdActualCount; // Number Of Bytes Received
  505. USHORT RfdSize; // Number Of Bytes In RFD
  506. ETH_RX_BUFFER_STRUC RfdBuffer; // Data buffer in RFD
  507. } RFD_STRUC, *PRFD_STRUC;
  508. //-------------------------------------------------------------------------
  509. // Receive Buffer Descriptor (RBD)
  510. //-------------------------------------------------------------------------
  511. typedef struct _RBD_STRUC {
  512. USHORT RbdActualCount; // Number Of Bytes Received
  513. USHORT RbdFiller;
  514. ULONG RbdLinkAddress; // Link To Next RBD
  515. ULONG RbdRcbAddress; // Receive Buffer Address
  516. USHORT RbdSize; // Receive Buffer Size
  517. USHORT RbdFiller1;
  518. } RBD_STRUC, *PRBD_STRUC;
  519. #pragma pack()
  520. //-------------------------------------------------------------------------
  521. // 82557 PCI Register Definitions
  522. // Refer To The PCI Specification For Detailed Explanations
  523. //-------------------------------------------------------------------------
  524. //- Register Offsets
  525. #define PCI_VENDOR_ID_REGISTER 0x00 // PCI Vendor ID Register
  526. #define PCI_DEVICE_ID_REGISTER 0x02 // PCI Device ID Register
  527. #define PCI_CONFIG_ID_REGISTER 0x00 // PCI Configuration ID Register
  528. #define PCI_COMMAND_REGISTER 0x04 // PCI Command Register
  529. #define PCI_STATUS_REGISTER 0x06 // PCI Status Register
  530. #define PCI_REV_ID_REGISTER 0x08 // PCI Revision ID Register
  531. #define PCI_CLASS_CODE_REGISTER 0x09 // PCI Class Code Register
  532. #define PCI_CACHE_LINE_REGISTER 0x0C // PCI Cache Line Register
  533. #define PCI_LATENCY_TIMER 0x0D // PCI Latency Timer Register
  534. #define PCI_HEADER_TYPE 0x0E // PCI Header Type Register
  535. #define PCI_BIST_REGISTER 0x0F // PCI Built-In SelfTest Register
  536. #define PCI_BAR_0_REGISTER 0x10 // PCI Base Address Register 0
  537. #define PCI_BAR_1_REGISTER 0x14 // PCI Base Address Register 1
  538. #define PCI_BAR_2_REGISTER 0x18 // PCI Base Address Register 2
  539. #define PCI_BAR_3_REGISTER 0x1C // PCI Base Address Register 3
  540. #define PCI_BAR_4_REGISTER 0x20 // PCI Base Address Register 4
  541. #define PCI_BAR_5_REGISTER 0x24 // PCI Base Address Register 5
  542. #define PCI_SUBVENDOR_ID_REGISTER 0x2C // PCI SubVendor ID Register
  543. #define PCI_SUBDEVICE_ID_REGISTER 0x2E // PCI SubDevice ID Register
  544. #define PCI_EXPANSION_ROM 0x30 // PCI Expansion ROM Base Register
  545. #define PCI_INTERRUPT_LINE 0x3C // PCI Interrupt Line Register
  546. #define PCI_INTERRUPT_PIN 0x3D // PCI Interrupt Pin Register
  547. #define PCI_MIN_GNT_REGISTER 0x3E // PCI Min-Gnt Register
  548. #define PCI_MAX_LAT_REGISTER 0x3F // PCI Max_Lat Register
  549. #define PCI_NODE_ADDR_REGISTER 0x40 // PCI Node Address Register
  550. //-------------------------------------------------------------------------
  551. // PHY 100 MDI Register/Bit Definitions
  552. //-------------------------------------------------------------------------
  553. // MDI register set
  554. #define MDI_CONTROL_REG 0x00 // MDI control register
  555. #define MDI_STATUS_REG 0x01 // MDI Status regiser
  556. #define PHY_ID_REG_1 0x02 // Phy indentification reg (word 1)
  557. #define PHY_ID_REG_2 0x03 // Phy indentification reg (word 2)
  558. #define AUTO_NEG_ADVERTISE_REG 0x04 // Auto-negotiation advertisement
  559. #define AUTO_NEG_LINK_PARTNER_REG 0x05 // Auto-negotiation link partner ability
  560. #define AUTO_NEG_EXPANSION_REG 0x06 // Auto-negotiation expansion
  561. #define AUTO_NEG_NEXT_PAGE_REG 0x07 // Auto-negotiation next page transmit
  562. #define EXTENDED_REG_0 0x10 // Extended reg 0 (Phy 100 modes)
  563. #define EXTENDED_REG_1 0x14 // Extended reg 1 (Phy 100 error indications)
  564. #define NSC_CONG_CONTROL_REG 0x17 // National (TX) congestion control
  565. #define NSC_SPEED_IND_REG 0x19 // National (TX) speed indication
  566. #define PHY_EQUALIZER_REG 0x1A // Register for the Phy Equalizer values
  567. // MDI Control register bit definitions
  568. #define MDI_CR_COLL_TEST_ENABLE BIT_7 // Collision test enable
  569. #define MDI_CR_FULL_HALF BIT_8 // FDX =1, half duplex =0
  570. #define MDI_CR_RESTART_AUTO_NEG BIT_9 // Restart auto negotiation
  571. #define MDI_CR_ISOLATE BIT_10 // Isolate PHY from MII
  572. #define MDI_CR_POWER_DOWN BIT_11 // Power down
  573. #define MDI_CR_AUTO_SELECT BIT_12 // Auto speed select enable
  574. #define MDI_CR_10_100 BIT_13 // 0 = 10Mbs, 1 = 100Mbs
  575. #define MDI_CR_LOOPBACK BIT_14 // 0 = normal, 1 = loopback
  576. #define MDI_CR_RESET BIT_15 // 0 = normal, 1 = PHY reset
  577. // MDI Status register bit definitions
  578. #define MDI_SR_EXT_REG_CAPABLE BIT_0 // Extended register capabilities
  579. #define MDI_SR_JABBER_DETECT BIT_1 // Jabber detected
  580. #define MDI_SR_LINK_STATUS BIT_2 // Link Status -- 1 = link
  581. #define MDI_SR_AUTO_SELECT_CAPABLE BIT_3 // Auto speed select capable
  582. #define MDI_SR_REMOTE_FAULT_DETECT BIT_4 // Remote fault detect
  583. #define MDI_SR_AUTO_NEG_COMPLETE BIT_5 // Auto negotiation complete
  584. #define MDI_SR_10T_HALF_DPX BIT_11 // 10BaseT Half Duplex capable
  585. #define MDI_SR_10T_FULL_DPX BIT_12 // 10BaseT full duplex capable
  586. #define MDI_SR_TX_HALF_DPX BIT_13 // TX Half Duplex capable
  587. #define MDI_SR_TX_FULL_DPX BIT_14 // TX full duplex capable
  588. #define MDI_SR_T4_CAPABLE BIT_15 // T4 capable
  589. // Auto-Negotiation advertisement register bit definitions
  590. #define NWAY_AD_SELCTOR_FIELD BIT_0_4 // identifies supported protocol
  591. #define NWAY_AD_ABILITY BIT_5_12 // technologies that are supported
  592. #define NWAY_AD_10T_HALF_DPX BIT_5 // 10BaseT Half Duplex capable
  593. #define NWAY_AD_10T_FULL_DPX BIT_6 // 10BaseT full duplex capable
  594. #define NWAY_AD_TX_HALF_DPX BIT_7 // TX Half Duplex capable
  595. #define NWAY_AD_TX_FULL_DPX BIT_8 // TX full duplex capable
  596. #define NWAY_AD_T4_CAPABLE BIT_9 // T4 capable
  597. #define NWAY_AD_REMOTE_FAULT BIT_13 // indicates local remote fault
  598. #define NWAY_AD_RESERVED BIT_14 // reserved
  599. #define NWAY_AD_NEXT_PAGE BIT_15 // Next page (not supported)
  600. // Auto-Negotiation link partner ability register bit definitions
  601. #define NWAY_LP_SELCTOR_FIELD BIT_0_4 // identifies supported protocol
  602. #define NWAY_LP_ABILITY BIT_5_9 // technologies that are supported
  603. #define NWAY_LP_REMOTE_FAULT BIT_13 // indicates partner remote fault
  604. #define NWAY_LP_ACKNOWLEDGE BIT_14 // acknowledge
  605. #define NWAY_LP_NEXT_PAGE BIT_15 // Next page (not supported)
  606. // Auto-Negotiation expansion register bit definitions
  607. #define NWAY_EX_LP_NWAY BIT_0 // link partner is NWAY
  608. #define NWAY_EX_PAGE_RECEIVED BIT_1 // link code word received
  609. #define NWAY_EX_NEXT_PAGE_ABLE BIT_2 // local is next page able
  610. #define NWAY_EX_LP_NEXT_PAGE_ABLE BIT_3 // partner is next page able
  611. #define NWAY_EX_PARALLEL_DET_FLT BIT_4 // parallel detection fault
  612. #define NWAY_EX_RESERVED BIT_5_15 // reserved
  613. // PHY 100 Extended Register 0 bit definitions
  614. #define PHY_100_ER0_FDX_INDIC BIT_0 // 1 = FDX, 0 = half duplex
  615. #define PHY_100_ER0_SPEED_INDIC BIT_1 // 1 = 100mbs, 0= 10mbs
  616. #define PHY_100_ER0_WAKE_UP BIT_2 // Wake up DAC
  617. #define PHY_100_ER0_RESERVED BIT_3_4 // Reserved
  618. #define PHY_100_ER0_REV_CNTRL BIT_5_7 // Revsion control (A step = 000)
  619. #define PHY_100_ER0_FORCE_FAIL BIT_8 // Force Fail is enabled
  620. #define PHY_100_ER0_TEST BIT_9_13 // Revsion control (A step = 000)
  621. #define PHY_100_ER0_LINKDIS BIT_14 // Link integrity test is disabled
  622. #define PHY_100_ER0_JABDIS BIT_15 // Jabber function is disabled
  623. // PHY 100 Extended Register 1 bit definitions
  624. #define PHY_100_ER1_RESERVED BIT_0_8 // Reserved
  625. #define PHY_100_ER1_CH2_DET_ERR BIT_9 // Channel 2 EOF detection error
  626. #define PHY_100_ER1_MANCH_CODE_ERR BIT_10 // Manchester code error
  627. #define PHY_100_ER1_EOP_ERR BIT_11 // EOP error
  628. #define PHY_100_ER1_BAD_CODE_ERR BIT_12 // bad code error
  629. #define PHY_100_ER1_INV_CODE_ERR BIT_13 // invalid code error
  630. #define PHY_100_ER1_DC_BAL_ERR BIT_14 // DC balance error
  631. #define PHY_100_ER1_PAIR_SKEW_ERR BIT_15 // Pair skew error
  632. // PHY TX Register/Bit definitions
  633. #define PHY_TX_STATUS_CTRL_REG 0x10
  634. #define PHY_TX_POLARITY_MASK BIT_8 // register 10h bit 8 (the polarity bit)
  635. #define PHY_TX_NORMAL_POLARITY 0 // register 10h bit 8 =0 (normal polarity)
  636. #define PHY_TX_SPECIAL_CTRL_REG 0x11
  637. #define AUTO_POLARITY_DISABLE BIT_4 // register 11h bit 4 (0=enable, 1=disable)
  638. #define PHY_TX_REG_18 0x18 // Error counter register
  639. // National Semiconductor TX phy congestion control register bit definitions
  640. #define NSC_TX_CONG_TXREADY BIT_10 // Makes TxReady an input
  641. #define NSC_TX_CONG_ENABLE BIT_8 // Enables congestion control
  642. #define NSC_TX_CONG_F_CONNECT BIT_5 // Enables congestion control
  643. // National Semiconductor TX phy speed indication register bit definitions
  644. #define NSC_TX_SPD_INDC_SPEED BIT_6 // 0 = 100mb, 1=10mb
  645. #endif // _E100_557_H