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.

forcedeth.h 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. /*
  2. * forcedeth.h -- Driver for NVIDIA nForce media access controllers for iPXE
  3. * Copyright (c) 2010 Andrei Faur <da3drus@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of the
  8. * License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18. * 02110-1301, USA.
  19. *
  20. * Portions of this code are taken from the Linux forcedeth driver that was
  21. * based on a cleanroom reimplementation which was based on reverse engineered
  22. * documentation written by Carl-Daniel Hailfinger and Andrew de Quincey:
  23. * Copyright (C) 2003,4,5 Manfred Spraul
  24. * Copyright (C) 2004 Andrew de Quincey (wol support)
  25. * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane
  26. * IRQ rate fixes, bigendian fixes, cleanups, verification)
  27. * Copyright (c) 2004,2005,2006,2007,2008,2009 NVIDIA Corporation
  28. *
  29. * This header is a direct copy of #define lines and structs found in the
  30. * above mentioned driver, modified where necessary to make them work for iPXE.
  31. *
  32. */
  33. FILE_LICENCE ( GPL2_OR_LATER );
  34. #ifndef _FORCEDETH_H_
  35. #define _FORCEDETH_H_
  36. #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
  37. struct ring_desc {
  38. u32 buf;
  39. u32 flaglen;
  40. };
  41. struct ring_desc_ex {
  42. u32 bufhigh;
  43. u32 buflow;
  44. u32 txvlan;
  45. u32 flaglen;
  46. };
  47. #define DESC_VER_1 1
  48. #define DESC_VER_2 2
  49. #define DESC_VER_3 3
  50. #define RX_RING_SIZE 16
  51. #define TX_RING_SIZE 32
  52. #define RXTX_RING_SIZE ( ( RX_RING_SIZE ) + ( TX_RING_SIZE ) )
  53. #define RX_RING_MIN 128
  54. #define TX_RING_MIN 64
  55. #define RING_MAX_DESC_VER_1 1024
  56. #define RING_MAX_DESC_VER_2_3 16384
  57. #define NV_RX_ALLOC_PAD (64)
  58. #define NV_RX_HEADERS (64)
  59. #define RX_BUF_SZ ( ( ETH_FRAME_LEN ) + ( NV_RX_HEADERS ) )
  60. #define NV_PKTLIMIT_1 1500
  61. #define NV_PKTLIMIT_2 9100
  62. #define NV_LINK_POLL_FREQUENCY 128
  63. /* PHY defines */
  64. #define PHY_OUI_MARVELL 0x5043
  65. #define PHY_OUI_CICADA 0x03f1
  66. #define PHY_OUI_VITESSE 0x01c1
  67. #define PHY_OUI_REALTEK 0x0732
  68. #define PHY_OUI_REALTEK2 0x0020
  69. #define PHYID1_OUI_MASK 0x03ff
  70. #define PHYID1_OUI_SHFT 6
  71. #define PHYID2_OUI_MASK 0xfc00
  72. #define PHYID2_OUI_SHFT 10
  73. #define PHYID2_MODEL_MASK 0x03f0
  74. #define PHY_MODEL_REALTEK_8211 0x0110
  75. #define PHY_REV_MASK 0x0001
  76. #define PHY_REV_REALTEK_8211B 0x0000
  77. #define PHY_REV_REALTEK_8211C 0x0001
  78. #define PHY_MODEL_REALTEK_8201 0x0200
  79. #define PHY_MODEL_MARVELL_E3016 0x0220
  80. #define PHY_MARVELL_E3016_INITMASK 0x0300
  81. #define PHY_CICADA_INIT1 0x0f000
  82. #define PHY_CICADA_INIT2 0x0e00
  83. #define PHY_CICADA_INIT3 0x01000
  84. #define PHY_CICADA_INIT4 0x0200
  85. #define PHY_CICADA_INIT5 0x0004
  86. #define PHY_CICADA_INIT6 0x02000
  87. #define PHY_VITESSE_INIT_REG1 0x1f
  88. #define PHY_VITESSE_INIT_REG2 0x10
  89. #define PHY_VITESSE_INIT_REG3 0x11
  90. #define PHY_VITESSE_INIT_REG4 0x12
  91. #define PHY_VITESSE_INIT_MSK1 0xc
  92. #define PHY_VITESSE_INIT_MSK2 0x0180
  93. #define PHY_VITESSE_INIT1 0x52b5
  94. #define PHY_VITESSE_INIT2 0xaf8a
  95. #define PHY_VITESSE_INIT3 0x8
  96. #define PHY_VITESSE_INIT4 0x8f8a
  97. #define PHY_VITESSE_INIT5 0xaf86
  98. #define PHY_VITESSE_INIT6 0x8f86
  99. #define PHY_VITESSE_INIT7 0xaf82
  100. #define PHY_VITESSE_INIT8 0x0100
  101. #define PHY_VITESSE_INIT9 0x8f82
  102. #define PHY_VITESSE_INIT10 0x0
  103. #define PHY_REALTEK_INIT_REG1 0x1f
  104. #define PHY_REALTEK_INIT_REG2 0x19
  105. #define PHY_REALTEK_INIT_REG3 0x13
  106. #define PHY_REALTEK_INIT_REG4 0x14
  107. #define PHY_REALTEK_INIT_REG5 0x18
  108. #define PHY_REALTEK_INIT_REG6 0x11
  109. #define PHY_REALTEK_INIT_REG7 0x01
  110. #define PHY_REALTEK_INIT1 0x0000
  111. #define PHY_REALTEK_INIT2 0x8e00
  112. #define PHY_REALTEK_INIT3 0x0001
  113. #define PHY_REALTEK_INIT4 0xad17
  114. #define PHY_REALTEK_INIT5 0xfb54
  115. #define PHY_REALTEK_INIT6 0xf5c7
  116. #define PHY_REALTEK_INIT7 0x1000
  117. #define PHY_REALTEK_INIT8 0x0003
  118. #define PHY_REALTEK_INIT9 0x0008
  119. #define PHY_REALTEK_INIT10 0x0005
  120. #define PHY_REALTEK_INIT11 0x0200
  121. #define PHY_REALTEK_INIT_MSK1 0x0003
  122. #define PHY_GIGABIT 0x0100
  123. #define PHY_TIMEOUT 0x1
  124. #define PHY_ERROR 0x2
  125. #define PHY_100 0x1
  126. #define PHY_1000 0x2
  127. #define PHY_HALF 0x100
  128. #define NV_PAUSEFRAME_RX_CAPABLE 0x0001
  129. #define NV_PAUSEFRAME_TX_CAPABLE 0x0002
  130. #define NV_PAUSEFRAME_RX_ENABLE 0x0004
  131. #define NV_PAUSEFRAME_TX_ENABLE 0x0008
  132. #define NV_PAUSEFRAME_RX_REQ 0x0010
  133. #define NV_PAUSEFRAME_TX_REQ 0x0020
  134. #define NV_PAUSEFRAME_AUTONEG 0x0040
  135. /* MSI/MSI-X defines */
  136. #define NV_MSI_X_MAX_VECTORS 8
  137. #define NV_MSI_X_VECTORS_MASK 0x000f
  138. #define NV_MSI_CAPABLE 0x0010
  139. #define NV_MSI_X_CAPABLE 0x0020
  140. #define NV_MSI_ENABLED 0x0040
  141. #define NV_MSI_X_ENABLED 0x0080
  142. #define NV_MSI_X_VECTOR_ALL 0x0
  143. #define NV_MSI_X_VECTOR_RX 0x0
  144. #define NV_MSI_X_VECTOR_TX 0x1
  145. #define NV_MSI_X_VECTOR_OTHER 0x2
  146. #define NV_MSI_PRIV_OFFSET 0x68
  147. #define NV_MSI_PRIV_VALUE 0xffffffff
  148. #define NV_MIIBUSY_DELAY 50
  149. #define NV_MIIPHY_DELAY 10
  150. #define NV_MIIPHY_DELAYMAX 10000
  151. /* Hardware access */
  152. #define DEV_NEED_TIMERIRQ 0x0000001 /* set the timer irq flag in the irq mask */
  153. #define DEV_NEED_LINKTIMER 0x0000002 /* poll link settings. Relies on the timer irq */
  154. #define DEV_HAS_LARGEDESC 0x0000004 /* device supports jumbo frames and needs packet format 2 */
  155. #define DEV_HAS_HIGH_DMA 0x0000008 /* device supports 64bit dma */
  156. #define DEV_HAS_CHECKSUM 0x0000010 /* device supports tx and rx checksum offloads */
  157. #define DEV_HAS_VLAN 0x0000020 /* device supports vlan tagging and striping */
  158. #define DEV_HAS_MSI 0x0000040 /* device supports MSI */
  159. #define DEV_HAS_MSI_X 0x0000080 /* device supports MSI-X */
  160. #define DEV_HAS_POWER_CNTRL 0x0000100 /* device supports power savings */
  161. #define DEV_HAS_STATISTICS_V1 0x0000200 /* device supports hw statistics version 1 */
  162. #define DEV_HAS_STATISTICS_V2 0x0000600 /* device supports hw statistics version 2 */
  163. #define DEV_HAS_STATISTICS_V3 0x0000e00 /* device supports hw statistics version 3 */
  164. #define DEV_HAS_TEST_EXTENDED 0x0001000 /* device supports extended diagnostic test */
  165. #define DEV_HAS_MGMT_UNIT 0x0002000 /* device supports management unit */
  166. #define DEV_HAS_CORRECT_MACADDR 0x0004000 /* device supports correct mac address order */
  167. #define DEV_HAS_COLLISION_FIX 0x0008000 /* device supports tx collision fix */
  168. #define DEV_HAS_PAUSEFRAME_TX_V1 0x0010000 /* device supports tx pause frames version 1 */
  169. #define DEV_HAS_PAUSEFRAME_TX_V2 0x0020000 /* device supports tx pause frames version 2 */
  170. #define DEV_HAS_PAUSEFRAME_TX_V3 0x0040000 /* device supports tx pause frames version 3 */
  171. #define DEV_NEED_TX_LIMIT 0x0080000 /* device needs to limit tx */
  172. #define DEV_NEED_TX_LIMIT2 0x0180000 /* device needs to limit tx, expect for some revs */
  173. #define DEV_HAS_GEAR_MODE 0x0200000 /* device supports gear mode */
  174. #define DEV_NEED_PHY_INIT_FIX 0x0400000 /* device needs specific phy workaround */
  175. #define DEV_NEED_LOW_POWER_FIX 0x0800000 /* device needs special power up workaround */
  176. #define DEV_NEED_MSI_FIX 0x1000000 /* device needs msi workaround */
  177. #define FLAG_MASK_V1 0xffff0000
  178. #define FLAG_MASK_V2 0xffffc000
  179. #define LEN_MASK_V1 (0xffffffff ^ FLAG_MASK_V1)
  180. #define LEN_MASK_V2 (0xffffffff ^ FLAG_MASK_V2)
  181. #define NV_TX_LASTPACKET (1<<16)
  182. #define NV_TX_RETRYERROR (1<<19)
  183. #define NV_TX_RETRYCOUNT_MASK (0xF<<20)
  184. #define NV_TX_FORCED_INTERRUPT (1<<24)
  185. #define NV_TX_DEFERRED (1<<26)
  186. #define NV_TX_CARRIERLOST (1<<27)
  187. #define NV_TX_LATECOLLISION (1<<28)
  188. #define NV_TX_UNDERFLOW (1<<29)
  189. #define NV_TX_ERROR (1<<30)
  190. #define NV_TX_VALID (1<<31)
  191. #define NV_TX2_LASTPACKET (1<<29)
  192. #define NV_TX2_RETRYERROR (1<<18)
  193. #define NV_TX2_RETRYCOUNT_MASK (0xF<<19)
  194. #define NV_TX2_FORCED_INTERRUPT (1<<30)
  195. #define NV_TX2_DEFERRED (1<<25)
  196. #define NV_TX2_CARRIERLOST (1<<26)
  197. #define NV_TX2_LATECOLLISION (1<<27)
  198. #define NV_TX2_UNDERFLOW (1<<28)
  199. /* error and valid are the same for both */
  200. #define NV_TX2_ERROR (1<<30)
  201. #define NV_TX2_VALID (1<<31)
  202. #define NV_TX2_TSO (1<<28)
  203. #define NV_TX2_TSO_SHIFT 14
  204. #define NV_TX2_TSO_MAX_SHIFT 14
  205. #define NV_TX2_TSO_MAX_SIZE (1<<NV_TX2_TSO_MAX_SHIFT)
  206. #define NV_TX2_CHECKSUM_L3 (1<<27)
  207. #define NV_TX2_CHECKSUM_L4 (1<<26)
  208. #define NV_TX3_VLAN_TAG_PRESENT (1<<18)
  209. #define NV_RX_DESCRIPTORVALID (1<<16)
  210. #define NV_RX_MISSEDFRAME (1<<17)
  211. #define NV_RX_SUBSTRACT1 (1<<18)
  212. #define NV_RX_ERROR1 (1<<23)
  213. #define NV_RX_ERROR2 (1<<24)
  214. #define NV_RX_ERROR3 (1<<25)
  215. #define NV_RX_ERROR4 (1<<26)
  216. #define NV_RX_CRCERR (1<<27)
  217. #define NV_RX_OVERFLOW (1<<28)
  218. #define NV_RX_FRAMINGERR (1<<29)
  219. #define NV_RX_ERROR (1<<30)
  220. #define NV_RX_AVAIL (1<<31)
  221. #define NV_RX_ERROR_MASK (NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3|NV_RX_ERROR4|NV_RX_CRCERR|NV_RX_OVERFLOW|NV_RX_FRAMINGERR)
  222. #define NV_RX2_CHECKSUMMASK (0x1C000000)
  223. #define NV_RX2_CHECKSUM_IP (0x10000000)
  224. #define NV_RX2_CHECKSUM_IP_TCP (0x14000000)
  225. #define NV_RX2_CHECKSUM_IP_UDP (0x18000000)
  226. #define NV_RX2_DESCRIPTORVALID (1<<29)
  227. #define NV_RX2_SUBSTRACT1 (1<<25)
  228. #define NV_RX2_ERROR1 (1<<18)
  229. #define NV_RX2_ERROR2 (1<<19)
  230. #define NV_RX2_ERROR3 (1<<20)
  231. #define NV_RX2_ERROR4 (1<<21)
  232. #define NV_RX2_CRCERR (1<<22)
  233. #define NV_RX2_OVERFLOW (1<<23)
  234. #define NV_RX2_FRAMINGERR (1<<24)
  235. /* error and avail are the same for both */
  236. #define NV_RX2_ERROR (1<<30)
  237. #define NV_RX2_AVAIL (1<<31)
  238. #define NV_RX2_ERROR_MASK (NV_RX2_ERROR1|NV_RX2_ERROR2|NV_RX2_ERROR3|NV_RX2_ERROR4|NV_RX2_CRCERR|NV_RX2_OVERFLOW|NV_RX2_FRAMINGERR)
  239. #define NV_RX3_VLAN_TAG_PRESENT (1<<16)
  240. #define NV_RX3_VLAN_TAG_MASK (0x0000FFFF)
  241. /* Miscellaneous hardware related defines */
  242. #define NV_PCI_REGSZ_VER1 0x270
  243. #define NV_PCI_REGSZ_VER2 0x2d4
  244. #define NV_PCI_REGSZ_VER3 0x604
  245. #define NV_PCI_REGSZ_MAX 0x604
  246. /* various timeout delays: all in usec */
  247. #define NV_TXRX_RESET_DELAY 4
  248. #define NV_TXSTOP_DELAY1 10
  249. #define NV_TXSTOP_DELAY1MAX 500000
  250. #define NV_TXSTOP_DELAY2 100
  251. #define NV_RXSTOP_DELAY1 10
  252. #define NV_RXSTOP_DELAY1MAX 500000
  253. #define NV_RXSTOP_DELAY2 100
  254. #define NV_SETUP5_DELAY 5
  255. #define NV_SETUP5_DELAYMAX 50000
  256. #define NV_POWERUP_DELAY 5
  257. #define NV_POWERUP_DELAYMAX 5000
  258. #define NV_MIIBUSY_DELAY 50
  259. #define NV_MIIPHY_DELAY 10
  260. #define NV_MIIPHY_DELAYMAX 10000
  261. #define NV_MAC_RESET_DELAY 64
  262. #define NV_MSI_X_CAPABLE 0x0020
  263. #define MII_READ (-1)
  264. struct forcedeth_private {
  265. struct pci_device *pci_dev;
  266. struct net_device *netdev;
  267. void *mmio_addr;
  268. u32 linkspeed;
  269. int duplex;
  270. int phyaddr;
  271. unsigned int phy_oui;
  272. unsigned int phy_rev;
  273. unsigned int phy_model;
  274. u16 gigabit;
  275. u32 mac_in_use;
  276. int mgmt_version;
  277. int mgmt_sema;
  278. /* rx specific fields */
  279. struct ring_desc *rx_ring;
  280. struct io_buffer *rx_iobuf[RX_RING_SIZE];
  281. int rx_curr;
  282. /* tx specific fields */
  283. struct ring_desc *tx_ring;
  284. struct io_buffer *tx_iobuf[TX_RING_SIZE];
  285. int tx_fill_ctr;
  286. int tx_curr;
  287. int tx_tail;
  288. /* flow control */
  289. u32 pause_flags;
  290. unsigned long driver_data;
  291. };
  292. enum {
  293. NvRegIrqStatus = 0x000,
  294. #define NVREG_IRQSTAT_MIIEVENT 0x040
  295. #define NVREG_IRQSTAT_MASK 0x83ff
  296. NvRegIrqMask = 0x004,
  297. #define NVREG_IRQ_RX_ERROR 0x0001
  298. #define NVREG_IRQ_RX 0x0002
  299. #define NVREG_IRQ_RX_NOBUF 0x0004
  300. #define NVREG_IRQ_TX_ERR 0x0008
  301. #define NVREG_IRQ_TX_OK 0x0010
  302. #define NVREG_IRQ_TIMER 0x0020
  303. #define NVREG_IRQ_LINK 0x0040
  304. #define NVREG_IRQ_RX_FORCED 0x0080
  305. #define NVREG_IRQ_TX_FORCED 0x0100
  306. #define NVREG_IRQ_RECOVER_ERROR 0x8200
  307. #define NVREG_IRQMASK_THROUGHPUT 0x00df
  308. #define NVREG_IRQMASK_CPU 0x0060
  309. #define NVREG_IRQ_TX_ALL (NVREG_IRQ_TX_ERR|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_FORCED)
  310. #define NVREG_IRQ_RX_ALL (NVREG_IRQ_RX_ERROR|NVREG_IRQ_RX|NVREG_IRQ_RX_NOBUF|NVREG_IRQ_RX_FORCED)
  311. #define NVREG_IRQ_OTHER (NVREG_IRQ_TIMER|NVREG_IRQ_LINK|NVREG_IRQ_RECOVER_ERROR)
  312. NvRegUnknownSetupReg6 = 0x008,
  313. #define NVREG_UNKSETUP6_VAL 3
  314. /*
  315. * NVREG_POLL_DEFAULT is the interval length of the timer source on the nic
  316. * NVREG_POLL_DEFAULT=97 would result in an interval length of 1 ms
  317. */
  318. NvRegPollingInterval = 0x00c,
  319. #define NVREG_POLL_DEFAULT_THROUGHPUT 65535 /* backup tx cleanup if loop max reached */
  320. #define NVREG_POLL_DEFAULT_CPU 13
  321. NvRegMSIMap0 = 0x020,
  322. NvRegMSIMap1 = 0x024,
  323. NvRegMSIIrqMask = 0x030,
  324. #define NVREG_MSI_VECTOR_0_ENABLED 0x01
  325. NvRegMisc1 = 0x080,
  326. #define NVREG_MISC1_PAUSE_TX 0x01
  327. #define NVREG_MISC1_HD 0x02
  328. #define NVREG_MISC1_FORCE 0x3b0f3c
  329. NvRegMacReset = 0x34,
  330. #define NVREG_MAC_RESET_ASSERT 0x0F3
  331. NvRegTransmitterControl = 0x084,
  332. #define NVREG_XMITCTL_START 0x01
  333. #define NVREG_XMITCTL_MGMT_ST 0x40000000
  334. #define NVREG_XMITCTL_SYNC_MASK 0x000f0000
  335. #define NVREG_XMITCTL_SYNC_NOT_READY 0x0
  336. #define NVREG_XMITCTL_SYNC_PHY_INIT 0x00040000
  337. #define NVREG_XMITCTL_MGMT_SEMA_MASK 0x00000f00
  338. #define NVREG_XMITCTL_MGMT_SEMA_FREE 0x0
  339. #define NVREG_XMITCTL_HOST_SEMA_MASK 0x0000f000
  340. #define NVREG_XMITCTL_HOST_SEMA_ACQ 0x0000f000
  341. #define NVREG_XMITCTL_HOST_LOADED 0x00004000
  342. #define NVREG_XMITCTL_TX_PATH_EN 0x01000000
  343. #define NVREG_XMITCTL_DATA_START 0x00100000
  344. #define NVREG_XMITCTL_DATA_READY 0x00010000
  345. #define NVREG_XMITCTL_DATA_ERROR 0x00020000
  346. NvRegTransmitterStatus = 0x088,
  347. #define NVREG_XMITSTAT_BUSY 0x01
  348. NvRegPacketFilterFlags = 0x8c,
  349. #define NVREG_PFF_PAUSE_RX 0x08
  350. #define NVREG_PFF_ALWAYS 0x7F0000
  351. #define NVREG_PFF_PROMISC 0x80
  352. #define NVREG_PFF_MYADDR 0x20
  353. #define NVREG_PFF_LOOPBACK 0x10
  354. NvRegOffloadConfig = 0x90,
  355. #define NVREG_OFFLOAD_HOMEPHY 0x601
  356. #define NVREG_OFFLOAD_NORMAL RX_NIC_BUFSIZE
  357. NvRegReceiverControl = 0x094,
  358. #define NVREG_RCVCTL_START 0x01
  359. #define NVREG_RCVCTL_RX_PATH_EN 0x01000000
  360. NvRegReceiverStatus = 0x98,
  361. #define NVREG_RCVSTAT_BUSY 0x01
  362. NvRegSlotTime = 0x9c,
  363. #define NVREG_SLOTTIME_LEGBF_ENABLED 0x80000000
  364. #define NVREG_SLOTTIME_10_100_FULL 0x00007f00
  365. #define NVREG_SLOTTIME_1000_FULL 0x0003ff00
  366. #define NVREG_SLOTTIME_HALF 0x0000ff00
  367. #define NVREG_SLOTTIME_DEFAULT 0x00007f00
  368. #define NVREG_SLOTTIME_MASK 0x000000ff
  369. NvRegTxDeferral = 0xA0,
  370. #define NVREG_TX_DEFERRAL_DEFAULT 0x15050f
  371. #define NVREG_TX_DEFERRAL_RGMII_10_100 0x16070f
  372. #define NVREG_TX_DEFERRAL_RGMII_1000 0x14050f
  373. #define NVREG_TX_DEFERRAL_RGMII_STRETCH_10 0x16190f
  374. #define NVREG_TX_DEFERRAL_RGMII_STRETCH_100 0x16300f
  375. #define NVREG_TX_DEFERRAL_MII_STRETCH 0x152000
  376. NvRegRxDeferral = 0xA4,
  377. #define NVREG_RX_DEFERRAL_DEFAULT 0x16
  378. NvRegMacAddrA = 0xA8,
  379. NvRegMacAddrB = 0xAC,
  380. NvRegMulticastAddrA = 0xB0,
  381. #define NVREG_MCASTADDRA_FORCE 0x01
  382. NvRegMulticastAddrB = 0xB4,
  383. NvRegMulticastMaskA = 0xB8,
  384. #define NVREG_MCASTMASKA_NONE 0xffffffff
  385. NvRegMulticastMaskB = 0xBC,
  386. #define NVREG_MCASTMASKB_NONE 0xffff
  387. NvRegPhyInterface = 0xC0,
  388. #define PHY_RGMII 0x10000000
  389. NvRegBackOffControl = 0xC4,
  390. #define NVREG_BKOFFCTRL_DEFAULT 0x70000000
  391. #define NVREG_BKOFFCTRL_SEED_MASK 0x000003ff
  392. #define NVREG_BKOFFCTRL_SELECT 24
  393. #define NVREG_BKOFFCTRL_GEAR 12
  394. NvRegTxRingPhysAddr = 0x100,
  395. NvRegRxRingPhysAddr = 0x104,
  396. NvRegRingSizes = 0x108,
  397. #define NVREG_RINGSZ_TXSHIFT 0
  398. #define NVREG_RINGSZ_RXSHIFT 16
  399. NvRegTransmitPoll = 0x10c,
  400. #define NVREG_TRANSMITPOLL_MAC_ADDR_REV 0x00008000
  401. NvRegLinkSpeed = 0x110,
  402. #define NVREG_LINKSPEED_FORCE 0x10000
  403. #define NVREG_LINKSPEED_10 1000
  404. #define NVREG_LINKSPEED_100 100
  405. #define NVREG_LINKSPEED_1000 50
  406. #define NVREG_LINKSPEED_MASK (0xFFF)
  407. NvRegUnknownSetupReg5 = 0x130,
  408. #define NVREG_UNKSETUP5_BIT31 (1<<31)
  409. NvRegTxWatermark = 0x13c,
  410. #define NVREG_TX_WM_DESC1_DEFAULT 0x0200010
  411. #define NVREG_TX_WM_DESC2_3_DEFAULT 0x1e08000
  412. #define NVREG_TX_WM_DESC2_3_1000 0xfe08000
  413. NvRegTxRxControl = 0x144,
  414. #define NVREG_TXRXCTL_KICK 0x0001
  415. #define NVREG_TXRXCTL_BIT1 0x0002
  416. #define NVREG_TXRXCTL_BIT2 0x0004
  417. #define NVREG_TXRXCTL_IDLE 0x0008
  418. #define NVREG_TXRXCTL_RESET 0x0010
  419. #define NVREG_TXRXCTL_RXCHECK 0x0400
  420. #define NVREG_TXRXCTL_DESC_1 0
  421. #define NVREG_TXRXCTL_DESC_2 0x002100
  422. #define NVREG_TXRXCTL_DESC_3 0xc02200
  423. #define NVREG_TXRXCTL_VLANSTRIP 0x00040
  424. #define NVREG_TXRXCTL_VLANINS 0x00080
  425. NvRegTxRingPhysAddrHigh = 0x148,
  426. NvRegRxRingPhysAddrHigh = 0x14C,
  427. NvRegTxPauseFrame = 0x170,
  428. #define NVREG_TX_PAUSEFRAME_DISABLE 0x0fff0080
  429. #define NVREG_TX_PAUSEFRAME_ENABLE_V1 0x01800010
  430. #define NVREG_TX_PAUSEFRAME_ENABLE_V2 0x056003f0
  431. #define NVREG_TX_PAUSEFRAME_ENABLE_V3 0x09f00880
  432. NvRegTxPauseFrameLimit = 0x174,
  433. #define NVREG_TX_PAUSEFRAMELIMIT_ENABLE 0x00010000
  434. NvRegMIIStatus = 0x180,
  435. #define NVREG_MIISTAT_ERROR 0x0001
  436. #define NVREG_MIISTAT_LINKCHANGE 0x0008
  437. #define NVREG_MIISTAT_MASK_RW 0x0007
  438. #define NVREG_MIISTAT_MASK_ALL 0x000f
  439. NvRegMIIMask = 0x184,
  440. #define NVREG_MII_LINKCHANGE 0x0008
  441. NvRegAdapterControl = 0x188,
  442. #define NVREG_ADAPTCTL_START 0x02
  443. #define NVREG_ADAPTCTL_LINKUP 0x04
  444. #define NVREG_ADAPTCTL_PHYVALID 0x40000
  445. #define NVREG_ADAPTCTL_RUNNING 0x100000
  446. #define NVREG_ADAPTCTL_PHYSHIFT 24
  447. NvRegMIISpeed = 0x18c,
  448. #define NVREG_MIISPEED_BIT8 (1<<8)
  449. #define NVREG_MIIDELAY 5
  450. NvRegMIIControl = 0x190,
  451. #define NVREG_MIICTL_INUSE 0x08000
  452. #define NVREG_MIICTL_WRITE 0x00400
  453. #define NVREG_MIICTL_ADDRSHIFT 5
  454. NvRegMIIData = 0x194,
  455. NvRegTxUnicast = 0x1a0,
  456. NvRegTxMulticast = 0x1a4,
  457. NvRegTxBroadcast = 0x1a8,
  458. NvRegWakeUpFlags = 0x200,
  459. #define NVREG_WAKEUPFLAGS_VAL 0x7770
  460. #define NVREG_WAKEUPFLAGS_BUSYSHIFT 24
  461. #define NVREG_WAKEUPFLAGS_ENABLESHIFT 16
  462. #define NVREG_WAKEUPFLAGS_D3SHIFT 12
  463. #define NVREG_WAKEUPFLAGS_D2SHIFT 8
  464. #define NVREG_WAKEUPFLAGS_D1SHIFT 4
  465. #define NVREG_WAKEUPFLAGS_D0SHIFT 0
  466. #define NVREG_WAKEUPFLAGS_ACCEPT_MAGPAT 0x01
  467. #define NVREG_WAKEUPFLAGS_ACCEPT_WAKEUPPAT 0x02
  468. #define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE 0x04
  469. #define NVREG_WAKEUPFLAGS_ENABLE 0x1111
  470. NvRegMgmtUnitGetVersion = 0x204,
  471. #define NVREG_MGMTUNITGETVERSION 0x01
  472. NvRegMgmtUnitVersion = 0x208,
  473. #define NVREG_MGMTUNITVERSION 0x08
  474. NvRegPowerCap = 0x268,
  475. #define NVREG_POWERCAP_D3SUPP (1<<30)
  476. #define NVREG_POWERCAP_D2SUPP (1<<26)
  477. #define NVREG_POWERCAP_D1SUPP (1<<25)
  478. NvRegPowerState = 0x26c,
  479. #define NVREG_POWERSTATE_POWEREDUP 0x8000
  480. #define NVREG_POWERSTATE_VALID 0x0100
  481. #define NVREG_POWERSTATE_MASK 0x0003
  482. #define NVREG_POWERSTATE_D0 0x0000
  483. #define NVREG_POWERSTATE_D1 0x0001
  484. #define NVREG_POWERSTATE_D2 0x0002
  485. #define NVREG_POWERSTATE_D3 0x0003
  486. NvRegMgmtUnitControl = 0x278,
  487. #define NVREG_MGMTUNITCONTROL_INUSE 0x20000
  488. NvRegTxCnt = 0x280,
  489. NvRegTxZeroReXmt = 0x284,
  490. NvRegTxOneReXmt = 0x288,
  491. NvRegTxManyReXmt = 0x28c,
  492. NvRegTxLateCol = 0x290,
  493. NvRegTxUnderflow = 0x294,
  494. NvRegTxLossCarrier = 0x298,
  495. NvRegTxExcessDef = 0x29c,
  496. NvRegTxRetryErr = 0x2a0,
  497. NvRegRxFrameErr = 0x2a4,
  498. NvRegRxExtraByte = 0x2a8,
  499. NvRegRxLateCol = 0x2ac,
  500. NvRegRxRunt = 0x2b0,
  501. NvRegRxFrameTooLong = 0x2b4,
  502. NvRegRxOverflow = 0x2b8,
  503. NvRegRxFCSErr = 0x2bc,
  504. NvRegRxFrameAlignErr = 0x2c0,
  505. NvRegRxLenErr = 0x2c4,
  506. NvRegRxUnicast = 0x2c8,
  507. NvRegRxMulticast = 0x2cc,
  508. NvRegRxBroadcast = 0x2d0,
  509. NvRegTxDef = 0x2d4,
  510. NvRegTxFrame = 0x2d8,
  511. NvRegRxCnt = 0x2dc,
  512. NvRegTxPause = 0x2e0,
  513. NvRegRxPause = 0x2e4,
  514. NvRegRxDropFrame = 0x2e8,
  515. NvRegVlanControl = 0x300,
  516. #define NVREG_VLANCONTROL_ENABLE 0x2000
  517. NvRegMSIXMap0 = 0x3e0,
  518. NvRegMSIXMap1 = 0x3e4,
  519. NvRegMSIXIrqStatus = 0x3f0,
  520. NvRegPowerState2 = 0x600,
  521. #define NVREG_POWERSTATE2_POWERUP_MASK 0x0F15
  522. #define NVREG_POWERSTATE2_POWERUP_REV_A3 0x0001
  523. #define NVREG_POWERSTATE2_PHY_RESET 0x0004
  524. #define NVREG_POWERSTATE2_GATE_CLOCKS 0x0F00
  525. };
  526. enum {
  527. NV_OPTIMIZATION_MODE_THROUGHPUT,
  528. NV_OPTIMIZATION_MODE_CPU,
  529. NV_OPTIMIZATION_MODE_DYNAMIC
  530. };
  531. enum {
  532. NV_CROSSOVER_DETECTION_DISABLED,
  533. NV_CROSSOVER_DETECTION_ENABLED
  534. };
  535. #define NV_SETUP_RX_RING 0x01
  536. #define NV_SETUP_TX_RING 0x02
  537. #define NV_RESTART_TX 0x1
  538. #define NV_RESTART_RX 0x2
  539. #endif /* _FORCEDETH_H_ */