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.

188 lines
6.8 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. mp_def.h
  5. Abstract:
  6. NIC specific definitions
  7. Revision History:
  8. Who When What
  9. -------- -------- ----------------------------------------------
  10. DChen 11-01-99 created
  11. Notes:
  12. --*/
  13. #ifndef _MP_DEF_H
  14. #define _MP_DEF_H
  15. // memory tag for this driver
  16. #define NIC_TAG ((ULONG)'001E')
  17. #define NIC_DBG_STRING ("**E100**")
  18. // packet and header sizes
  19. #define NIC_MAX_PACKET_SIZE 1514
  20. #define NIC_MIN_PACKET_SIZE 60
  21. #define NIC_HEADER_SIZE 14
  22. // multicast list size
  23. #define NIC_MAX_MCAST_LIST 32
  24. // update the driver version number every time you release a new driver
  25. // The high word is the major version. The low word is the minor version.
  26. #define NIC_VENDOR_DRIVER_VERSION 0x00010006
  27. // NDIS version in use by the NIC driver.
  28. // The high byte is the major version. The low byte is the minor version.
  29. #ifdef NDIS51_MINIPORT
  30. #define NIC_DRIVER_VERSION 0x0501
  31. #else
  32. #define NIC_DRIVER_VERSION 0x0500
  33. #endif
  34. // media type, we use ethernet, change if necessary
  35. #define NIC_MEDIA_TYPE NdisMedium802_3
  36. // interface type, we use PCI
  37. #define NIC_INTERFACE_TYPE NdisInterfacePci
  38. #define NIC_INTERRUPT_MODE NdisInterruptLevelSensitive
  39. // NIC PCI Device and vendor IDs
  40. #define NIC_PCI_DEVICE_ID 0x1229
  41. #define NIC_PCI_VENDOR_ID 0x8086
  42. // buffer size passed in NdisMQueryAdapterResources
  43. // We should only need three adapter resources (IO, interrupt and memory),
  44. // Some devices get extra resources, so have room for 10 resources
  45. #define NIC_RESOURCE_BUF_SIZE (sizeof(NDIS_RESOURCE_LIST) + \
  46. (10*sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR)))
  47. // IO space length
  48. #define NIC_MAP_IOSPACE_LENGTH sizeof(CSR_STRUC)
  49. // PCS config space including the Device Specific part of it/
  50. #define NIC_PCI_E100_HDR_LENGTH 0xe2
  51. // define some types for convenience
  52. // TXCB_STRUC, RFD_STRUC and CSR_STRUC are hardware specific structures
  53. // hardware TCB (Transmit Control Block) structure
  54. typedef TXCB_STRUC HW_TCB;
  55. typedef PTXCB_STRUC PHW_TCB;
  56. // hardware RFD (Receive Frame Descriptor) structure
  57. typedef RFD_STRUC HW_RFD;
  58. typedef PRFD_STRUC PHW_RFD;
  59. // hardware CSR (Control Status Register) structure
  60. typedef CSR_STRUC HW_CSR;
  61. typedef PCSR_STRUC PHW_CSR;
  62. // change to your company name instead of using Microsoft
  63. #define NIC_VENDOR_DESC "Microsoft"
  64. // number of TCBs per processor - min, default and max
  65. #define NIC_MIN_TCBS 1
  66. #define NIC_DEF_TCBS 32
  67. #define NIC_MAX_TCBS 64
  68. // max number of physical fragments supported per TCB
  69. #define NIC_MAX_PHYS_BUF_COUNT 8
  70. // number of RFDs - min, default and max
  71. #define NIC_MIN_RFDS 4
  72. #define NIC_DEF_RFDS 20
  73. #define NIC_MAX_RFDS 1024
  74. // only grow the RFDs up to this number
  75. #define NIC_MAX_GROW_RFDS 128
  76. // How many intervals before the RFD list is shrinked?
  77. #define NIC_RFD_SHRINK_THRESHOLD 10
  78. // local data buffer size (to copy send packet data into a local buffer)
  79. #define NIC_BUFFER_SIZE 1520
  80. // max lookahead size
  81. #define NIC_MAX_LOOKAHEAD (NIC_MAX_PACKET_SIZE - NIC_HEADER_SIZE)
  82. // max number of send packets the MiniportSendPackets function can accept
  83. #define NIC_MAX_SEND_PACKETS 10
  84. // supported filters
  85. #define NIC_SUPPORTED_FILTERS ( \
  86. NDIS_PACKET_TYPE_DIRECTED | \
  87. NDIS_PACKET_TYPE_MULTICAST | \
  88. NDIS_PACKET_TYPE_BROADCAST | \
  89. NDIS_PACKET_TYPE_PROMISCUOUS | \
  90. NDIS_PACKET_TYPE_ALL_MULTICAST)
  91. // Threshold for a remove
  92. #define NIC_HARDWARE_ERROR_THRESHOLD 5
  93. // The CheckForHang intervals before we decide the send is stuck
  94. #define NIC_SEND_HANG_THRESHOLD 5
  95. // NDIS_ERROR_CODE_ADAPTER_NOT_FOUND
  96. #define ERRLOG_READ_PCI_SLOT_FAILED 0x00000101L
  97. #define ERRLOG_WRITE_PCI_SLOT_FAILED 0x00000102L
  98. #define ERRLOG_VENDOR_DEVICE_NOMATCH 0x00000103L
  99. // NDIS_ERROR_CODE_ADAPTER_DISABLED
  100. #define ERRLOG_BUS_MASTER_DISABLED 0x00000201L
  101. // NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION
  102. #define ERRLOG_INVALID_SPEED_DUPLEX 0x00000301L
  103. #define ERRLOG_SET_SECONDARY_FAILED 0x00000302L
  104. // NDIS_ERROR_CODE_OUT_OF_RESOURCES
  105. #define ERRLOG_OUT_OF_MEMORY 0x00000401L
  106. #define ERRLOG_OUT_OF_SHARED_MEMORY 0x00000402L
  107. #define ERRLOG_OUT_OF_MAP_REGISTERS 0x00000403L
  108. #define ERRLOG_OUT_OF_BUFFER_POOL 0x00000404L
  109. #define ERRLOG_OUT_OF_NDIS_BUFFER 0x00000405L
  110. #define ERRLOG_OUT_OF_PACKET_POOL 0x00000406L
  111. #define ERRLOG_OUT_OF_NDIS_PACKET 0x00000407L
  112. #define ERRLOG_OUT_OF_LOOKASIDE_MEMORY 0x00000408L
  113. #define ERRLOG_OUT_OF_SG_RESOURCES 0x00000409L
  114. // NDIS_ERROR_CODE_HARDWARE_FAILURE
  115. #define ERRLOG_SELFTEST_FAILED 0x00000501L
  116. #define ERRLOG_INITIALIZE_ADAPTER 0x00000502L
  117. #define ERRLOG_REMOVE_MINIPORT 0x00000503L
  118. // NDIS_ERROR_CODE_RESOURCE_CONFLICT
  119. #define ERRLOG_MAP_IO_SPACE 0x00000601L
  120. #define ERRLOG_QUERY_ADAPTER_RESOURCES 0x00000602L
  121. #define ERRLOG_NO_IO_RESOURCE 0x00000603L
  122. #define ERRLOG_NO_INTERRUPT_RESOURCE 0x00000604L
  123. #define ERRLOG_NO_MEMORY_RESOURCE 0x00000605L
  124. // NIC specific macros
  125. #define NIC_RFD_GET_STATUS(_HwRfd) ((_HwRfd)->RfdCbHeader.CbStatus)
  126. #define NIC_RFD_STATUS_COMPLETED(_Status) ((_Status) & RFD_STATUS_COMPLETE)
  127. #define NIC_RFD_STATUS_SUCCESS(_Status) ((_Status) & RFD_STATUS_OK)
  128. #define NIC_RFD_GET_PACKET_SIZE(_HwRfd) (((_HwRfd)->RfdActualCount) & RFD_ACT_COUNT_MASK)
  129. #define NIC_RFD_VALID_ACTUALCOUNT(_HwRfd) ((((_HwRfd)->RfdActualCount) & (RFD_EOF_BIT | RFD_F_BIT)) == (RFD_EOF_BIT | RFD_F_BIT))
  130. // Constants for various purposes of NdisStallExecution
  131. #define NIC_DELAY_POST_RESET 20
  132. // Wait 5 milliseconds for the self-test to complete
  133. #define NIC_DELAY_POST_SELF_TEST_MS 5
  134. // delay used for link detection to minimize the init time
  135. // change this value to match your hardware
  136. #define NIC_LINK_DETECTION_DELAY 100
  137. #endif // _MP_DEF_H