Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

forcedeth.h 19KB

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