hw.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright(c) 1999 - 2018 Intel Corporation. */
  3. #ifndef _E1000E_HW_H_
  4. #define _E1000E_HW_H_
  5. #include "regs.h"
  6. #include "defines.h"
  7. struct e1000_hw;
  8. #define E1000_DEV_ID_82571EB_COPPER 0x105E
  9. #define E1000_DEV_ID_82571EB_FIBER 0x105F
  10. #define E1000_DEV_ID_82571EB_SERDES 0x1060
  11. #define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
  12. #define E1000_DEV_ID_82571PT_QUAD_COPPER 0x10D5
  13. #define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5
  14. #define E1000_DEV_ID_82571EB_QUAD_COPPER_LP 0x10BC
  15. #define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9
  16. #define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA
  17. #define E1000_DEV_ID_82572EI_COPPER 0x107D
  18. #define E1000_DEV_ID_82572EI_FIBER 0x107E
  19. #define E1000_DEV_ID_82572EI_SERDES 0x107F
  20. #define E1000_DEV_ID_82572EI 0x10B9
  21. #define E1000_DEV_ID_82573E 0x108B
  22. #define E1000_DEV_ID_82573E_IAMT 0x108C
  23. #define E1000_DEV_ID_82573L 0x109A
  24. #define E1000_DEV_ID_82574L 0x10D3
  25. #define E1000_DEV_ID_82574LA 0x10F6
  26. #define E1000_DEV_ID_82583V 0x150C
  27. #define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096
  28. #define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098
  29. #define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA
  30. #define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB
  31. #define E1000_DEV_ID_ICH8_82567V_3 0x1501
  32. #define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049
  33. #define E1000_DEV_ID_ICH8_IGP_AMT 0x104A
  34. #define E1000_DEV_ID_ICH8_IGP_C 0x104B
  35. #define E1000_DEV_ID_ICH8_IFE 0x104C
  36. #define E1000_DEV_ID_ICH8_IFE_GT 0x10C4
  37. #define E1000_DEV_ID_ICH8_IFE_G 0x10C5
  38. #define E1000_DEV_ID_ICH8_IGP_M 0x104D
  39. #define E1000_DEV_ID_ICH9_IGP_AMT 0x10BD
  40. #define E1000_DEV_ID_ICH9_BM 0x10E5
  41. #define E1000_DEV_ID_ICH9_IGP_M_AMT 0x10F5
  42. #define E1000_DEV_ID_ICH9_IGP_M 0x10BF
  43. #define E1000_DEV_ID_ICH9_IGP_M_V 0x10CB
  44. #define E1000_DEV_ID_ICH9_IGP_C 0x294C
  45. #define E1000_DEV_ID_ICH9_IFE 0x10C0
  46. #define E1000_DEV_ID_ICH9_IFE_GT 0x10C3
  47. #define E1000_DEV_ID_ICH9_IFE_G 0x10C2
  48. #define E1000_DEV_ID_ICH10_R_BM_LM 0x10CC
  49. #define E1000_DEV_ID_ICH10_R_BM_LF 0x10CD
  50. #define E1000_DEV_ID_ICH10_R_BM_V 0x10CE
  51. #define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE
  52. #define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF
  53. #define E1000_DEV_ID_ICH10_D_BM_V 0x1525
  54. #define E1000_DEV_ID_PCH_M_HV_LM 0x10EA
  55. #define E1000_DEV_ID_PCH_M_HV_LC 0x10EB
  56. #define E1000_DEV_ID_PCH_D_HV_DM 0x10EF
  57. #define E1000_DEV_ID_PCH_D_HV_DC 0x10F0
  58. #define E1000_DEV_ID_PCH2_LV_LM 0x1502
  59. #define E1000_DEV_ID_PCH2_LV_V 0x1503
  60. #define E1000_DEV_ID_PCH_LPT_I217_LM 0x153A
  61. #define E1000_DEV_ID_PCH_LPT_I217_V 0x153B
  62. #define E1000_DEV_ID_PCH_LPTLP_I218_LM 0x155A
  63. #define E1000_DEV_ID_PCH_LPTLP_I218_V 0x1559
  64. #define E1000_DEV_ID_PCH_I218_LM2 0x15A0
  65. #define E1000_DEV_ID_PCH_I218_V2 0x15A1
  66. #define E1000_DEV_ID_PCH_I218_LM3 0x15A2 /* Wildcat Point PCH */
  67. #define E1000_DEV_ID_PCH_I218_V3 0x15A3 /* Wildcat Point PCH */
  68. #define E1000_DEV_ID_PCH_SPT_I219_LM 0x156F /* SPT PCH */
  69. #define E1000_DEV_ID_PCH_SPT_I219_V 0x1570 /* SPT PCH */
  70. #define E1000_DEV_ID_PCH_SPT_I219_LM2 0x15B7 /* SPT-H PCH */
  71. #define E1000_DEV_ID_PCH_SPT_I219_V2 0x15B8 /* SPT-H PCH */
  72. #define E1000_DEV_ID_PCH_LBG_I219_LM3 0x15B9 /* LBG PCH */
  73. #define E1000_DEV_ID_PCH_SPT_I219_LM4 0x15D7
  74. #define E1000_DEV_ID_PCH_SPT_I219_V4 0x15D8
  75. #define E1000_DEV_ID_PCH_SPT_I219_LM5 0x15E3
  76. #define E1000_DEV_ID_PCH_SPT_I219_V5 0x15D6
  77. #define E1000_DEV_ID_PCH_CNP_I219_LM6 0x15BD
  78. #define E1000_DEV_ID_PCH_CNP_I219_V6 0x15BE
  79. #define E1000_DEV_ID_PCH_CNP_I219_LM7 0x15BB
  80. #define E1000_DEV_ID_PCH_CNP_I219_V7 0x15BC
  81. #define E1000_DEV_ID_PCH_ICP_I219_LM8 0x15DF
  82. #define E1000_DEV_ID_PCH_ICP_I219_V8 0x15E0
  83. #define E1000_DEV_ID_PCH_ICP_I219_LM9 0x15E1
  84. #define E1000_DEV_ID_PCH_ICP_I219_V9 0x15E2
  85. #define E1000_DEV_ID_PCH_CMP_I219_LM10 0x0D4E
  86. #define E1000_DEV_ID_PCH_CMP_I219_V10 0x0D4F
  87. #define E1000_DEV_ID_PCH_CMP_I219_LM11 0x0D4C
  88. #define E1000_DEV_ID_PCH_CMP_I219_V11 0x0D4D
  89. #define E1000_DEV_ID_PCH_CMP_I219_LM12 0x0D53
  90. #define E1000_DEV_ID_PCH_CMP_I219_V12 0x0D55
  91. #define E1000_DEV_ID_PCH_TGP_I219_LM13 0x15FB
  92. #define E1000_DEV_ID_PCH_TGP_I219_V13 0x15FC
  93. #define E1000_DEV_ID_PCH_TGP_I219_LM14 0x15F9
  94. #define E1000_DEV_ID_PCH_TGP_I219_V14 0x15FA
  95. #define E1000_DEV_ID_PCH_TGP_I219_LM15 0x15F4
  96. #define E1000_DEV_ID_PCH_TGP_I219_V15 0x15F5
  97. #define E1000_DEV_ID_PCH_RPL_I219_LM23 0x0DC5
  98. #define E1000_DEV_ID_PCH_RPL_I219_V23 0x0DC6
  99. #define E1000_DEV_ID_PCH_ADP_I219_LM16 0x1A1E
  100. #define E1000_DEV_ID_PCH_ADP_I219_V16 0x1A1F
  101. #define E1000_DEV_ID_PCH_ADP_I219_LM17 0x1A1C
  102. #define E1000_DEV_ID_PCH_ADP_I219_V17 0x1A1D
  103. #define E1000_DEV_ID_PCH_RPL_I219_LM22 0x0DC7
  104. #define E1000_DEV_ID_PCH_RPL_I219_V22 0x0DC8
  105. #define E1000_DEV_ID_PCH_MTP_I219_LM18 0x550A
  106. #define E1000_DEV_ID_PCH_MTP_I219_V18 0x550B
  107. #define E1000_DEV_ID_PCH_ADP_I219_LM19 0x550C
  108. #define E1000_DEV_ID_PCH_ADP_I219_V19 0x550D
  109. #define E1000_DEV_ID_PCH_LNP_I219_LM20 0x550E
  110. #define E1000_DEV_ID_PCH_LNP_I219_V20 0x550F
  111. #define E1000_DEV_ID_PCH_LNP_I219_LM21 0x5510
  112. #define E1000_DEV_ID_PCH_LNP_I219_V21 0x5511
  113. #define E1000_DEV_ID_PCH_ARL_I219_LM24 0x57A0
  114. #define E1000_DEV_ID_PCH_ARL_I219_V24 0x57A1
  115. #define E1000_DEV_ID_PCH_PTP_I219_LM25 0x57B3
  116. #define E1000_DEV_ID_PCH_PTP_I219_V25 0x57B4
  117. #define E1000_DEV_ID_PCH_PTP_I219_LM26 0x57B5
  118. #define E1000_DEV_ID_PCH_PTP_I219_V26 0x57B6
  119. #define E1000_DEV_ID_PCH_PTP_I219_LM27 0x57B7
  120. #define E1000_DEV_ID_PCH_PTP_I219_V27 0x57B8
  121. #define E1000_DEV_ID_PCH_NVL_I219_LM29 0x57B9
  122. #define E1000_DEV_ID_PCH_NVL_I219_V29 0x57BA
  123. #define E1000_REVISION_4 4
  124. #define E1000_FUNC_1 1
  125. #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0
  126. #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3
  127. enum e1000_mac_type {
  128. e1000_82571,
  129. e1000_82572,
  130. e1000_82573,
  131. e1000_82574,
  132. e1000_82583,
  133. e1000_80003es2lan,
  134. e1000_ich8lan,
  135. e1000_ich9lan,
  136. e1000_ich10lan,
  137. e1000_pchlan,
  138. e1000_pch2lan,
  139. e1000_pch_lpt,
  140. e1000_pch_spt,
  141. e1000_pch_cnp,
  142. e1000_pch_tgp,
  143. e1000_pch_adp,
  144. e1000_pch_mtp,
  145. e1000_pch_lnp,
  146. e1000_pch_ptp,
  147. e1000_pch_nvp,
  148. };
  149. enum e1000_media_type {
  150. e1000_media_type_unknown = 0,
  151. e1000_media_type_copper = 1,
  152. e1000_media_type_fiber = 2,
  153. e1000_media_type_internal_serdes = 3,
  154. e1000_num_media_types
  155. };
  156. enum e1000_nvm_type {
  157. e1000_nvm_unknown = 0,
  158. e1000_nvm_none,
  159. e1000_nvm_eeprom_spi,
  160. e1000_nvm_flash_hw,
  161. e1000_nvm_flash_sw
  162. };
  163. enum e1000_nvm_override {
  164. e1000_nvm_override_none = 0,
  165. e1000_nvm_override_spi_small,
  166. e1000_nvm_override_spi_large
  167. };
  168. enum e1000_phy_type {
  169. e1000_phy_unknown = 0,
  170. e1000_phy_none,
  171. e1000_phy_m88,
  172. e1000_phy_igp,
  173. e1000_phy_igp_2,
  174. e1000_phy_gg82563,
  175. e1000_phy_igp_3,
  176. e1000_phy_ife,
  177. e1000_phy_bm,
  178. e1000_phy_82578,
  179. e1000_phy_82577,
  180. e1000_phy_82579,
  181. e1000_phy_i217,
  182. };
  183. enum e1000_bus_width {
  184. e1000_bus_width_unknown = 0,
  185. e1000_bus_width_pcie_x1,
  186. e1000_bus_width_pcie_x2,
  187. e1000_bus_width_pcie_x4 = 4,
  188. e1000_bus_width_pcie_x8 = 8,
  189. e1000_bus_width_32,
  190. e1000_bus_width_64,
  191. e1000_bus_width_reserved
  192. };
  193. enum e1000_1000t_rx_status {
  194. e1000_1000t_rx_status_not_ok = 0,
  195. e1000_1000t_rx_status_ok,
  196. e1000_1000t_rx_status_undefined = 0xFF
  197. };
  198. enum e1000_rev_polarity {
  199. e1000_rev_polarity_normal = 0,
  200. e1000_rev_polarity_reversed,
  201. e1000_rev_polarity_undefined = 0xFF
  202. };
  203. enum e1000_fc_mode {
  204. e1000_fc_none = 0,
  205. e1000_fc_rx_pause,
  206. e1000_fc_tx_pause,
  207. e1000_fc_full,
  208. e1000_fc_default = 0xFF
  209. };
  210. enum e1000_ms_type {
  211. e1000_ms_hw_default = 0,
  212. e1000_ms_force_master,
  213. e1000_ms_force_slave,
  214. e1000_ms_auto
  215. };
  216. enum e1000_smart_speed {
  217. e1000_smart_speed_default = 0,
  218. e1000_smart_speed_on,
  219. e1000_smart_speed_off
  220. };
  221. enum e1000_serdes_link_state {
  222. e1000_serdes_link_down = 0,
  223. e1000_serdes_link_autoneg_progress,
  224. e1000_serdes_link_autoneg_complete,
  225. e1000_serdes_link_forced_up
  226. };
  227. /* Receive Descriptor - Extended */
  228. union e1000_rx_desc_extended {
  229. struct {
  230. __le64 buffer_addr;
  231. __le64 reserved;
  232. } read;
  233. struct {
  234. struct {
  235. __le32 mrq; /* Multiple Rx Queues */
  236. union {
  237. __le32 rss; /* RSS Hash */
  238. struct {
  239. __le16 ip_id; /* IP id */
  240. __le16 csum; /* Packet Checksum */
  241. } csum_ip;
  242. } hi_dword;
  243. } lower;
  244. struct {
  245. __le32 status_error; /* ext status/error */
  246. __le16 length;
  247. __le16 vlan; /* VLAN tag */
  248. } upper;
  249. } wb; /* writeback */
  250. };
  251. #define MAX_PS_BUFFERS 4
  252. /* Number of packet split data buffers (not including the header buffer) */
  253. #define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1)
  254. /* Receive Descriptor - Packet Split */
  255. union e1000_rx_desc_packet_split {
  256. struct {
  257. /* one buffer for protocol header(s), three data buffers */
  258. __le64 buffer_addr[MAX_PS_BUFFERS];
  259. } read;
  260. struct {
  261. struct {
  262. __le32 mrq; /* Multiple Rx Queues */
  263. union {
  264. __le32 rss; /* RSS Hash */
  265. struct {
  266. __le16 ip_id; /* IP id */
  267. __le16 csum; /* Packet Checksum */
  268. } csum_ip;
  269. } hi_dword;
  270. } lower;
  271. struct {
  272. __le32 status_error; /* ext status/error */
  273. __le16 length0; /* length of buffer 0 */
  274. __le16 vlan; /* VLAN tag */
  275. } middle;
  276. struct {
  277. __le16 header_status;
  278. /* length of buffers 1-3 */
  279. __le16 length[PS_PAGE_BUFFERS];
  280. } upper;
  281. __le64 reserved;
  282. } wb; /* writeback */
  283. };
  284. /* Transmit Descriptor */
  285. struct e1000_tx_desc {
  286. __le64 buffer_addr; /* Address of the descriptor's data buffer */
  287. union {
  288. __le32 data;
  289. struct {
  290. __le16 length; /* Data buffer length */
  291. u8 cso; /* Checksum offset */
  292. u8 cmd; /* Descriptor control */
  293. } flags;
  294. } lower;
  295. union {
  296. __le32 data;
  297. struct {
  298. u8 status; /* Descriptor status */
  299. u8 css; /* Checksum start */
  300. __le16 special;
  301. } fields;
  302. } upper;
  303. };
  304. /* Offload Context Descriptor */
  305. struct e1000_context_desc {
  306. union {
  307. __le32 ip_config;
  308. struct {
  309. u8 ipcss; /* IP checksum start */
  310. u8 ipcso; /* IP checksum offset */
  311. __le16 ipcse; /* IP checksum end */
  312. } ip_fields;
  313. } lower_setup;
  314. union {
  315. __le32 tcp_config;
  316. struct {
  317. u8 tucss; /* TCP checksum start */
  318. u8 tucso; /* TCP checksum offset */
  319. __le16 tucse; /* TCP checksum end */
  320. } tcp_fields;
  321. } upper_setup;
  322. __le32 cmd_and_length;
  323. union {
  324. __le32 data;
  325. struct {
  326. u8 status; /* Descriptor status */
  327. u8 hdr_len; /* Header length */
  328. __le16 mss; /* Maximum segment size */
  329. } fields;
  330. } tcp_seg_setup;
  331. };
  332. /* Offload data descriptor */
  333. struct e1000_data_desc {
  334. __le64 buffer_addr; /* Address of the descriptor's buffer address */
  335. union {
  336. __le32 data;
  337. struct {
  338. __le16 length; /* Data buffer length */
  339. u8 typ_len_ext;
  340. u8 cmd;
  341. } flags;
  342. } lower;
  343. union {
  344. __le32 data;
  345. struct {
  346. u8 status; /* Descriptor status */
  347. u8 popts; /* Packet Options */
  348. __le16 special;
  349. } fields;
  350. } upper;
  351. };
  352. /* Statistics counters collected by the MAC */
  353. struct e1000_hw_stats {
  354. u64 crcerrs;
  355. u64 algnerrc;
  356. u64 symerrs;
  357. u64 rxerrc;
  358. u64 mpc;
  359. u64 scc;
  360. u64 ecol;
  361. u64 mcc;
  362. u64 latecol;
  363. u64 colc;
  364. u64 dc;
  365. u64 tncrs;
  366. u64 sec;
  367. u64 cexterr;
  368. u64 rlec;
  369. u64 xonrxc;
  370. u64 xontxc;
  371. u64 xoffrxc;
  372. u64 xofftxc;
  373. u64 fcruc;
  374. u64 prc64;
  375. u64 prc127;
  376. u64 prc255;
  377. u64 prc511;
  378. u64 prc1023;
  379. u64 prc1522;
  380. u64 gprc;
  381. u64 bprc;
  382. u64 mprc;
  383. u64 gptc;
  384. u64 gorc;
  385. u64 gotc;
  386. u64 rnbc;
  387. u64 ruc;
  388. u64 rfc;
  389. u64 roc;
  390. u64 rjc;
  391. u64 mgprc;
  392. u64 mgpdc;
  393. u64 mgptc;
  394. u64 tor;
  395. u64 tot;
  396. u64 tpr;
  397. u64 tpt;
  398. u64 ptc64;
  399. u64 ptc127;
  400. u64 ptc255;
  401. u64 ptc511;
  402. u64 ptc1023;
  403. u64 ptc1522;
  404. u64 mptc;
  405. u64 bptc;
  406. u64 tsctc;
  407. u64 tsctfc;
  408. u64 iac;
  409. u64 icrxptc;
  410. u64 icrxatc;
  411. u64 ictxptc;
  412. u64 ictxatc;
  413. u64 ictxqec;
  414. u64 ictxqmtc;
  415. u64 icrxdmtc;
  416. u64 icrxoc;
  417. };
  418. struct e1000_phy_stats {
  419. u32 idle_errors;
  420. u32 receive_errors;
  421. };
  422. struct e1000_host_mng_dhcp_cookie {
  423. u32 signature;
  424. u8 status;
  425. u8 reserved0;
  426. u16 vlan_id;
  427. u32 reserved1;
  428. u16 reserved2;
  429. u8 reserved3;
  430. u8 checksum;
  431. };
  432. /* Host Interface "Rev 1" */
  433. struct e1000_host_command_header {
  434. u8 command_id;
  435. u8 command_length;
  436. u8 command_options;
  437. u8 checksum;
  438. };
  439. #define E1000_HI_MAX_DATA_LENGTH 252
  440. struct e1000_host_command_info {
  441. struct e1000_host_command_header command_header;
  442. u8 command_data[E1000_HI_MAX_DATA_LENGTH];
  443. };
  444. /* Host Interface "Rev 2" */
  445. struct e1000_host_mng_command_header {
  446. u8 command_id;
  447. u8 checksum;
  448. u16 reserved1;
  449. u16 reserved2;
  450. u16 command_length;
  451. };
  452. #define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8
  453. struct e1000_host_mng_command_info {
  454. struct e1000_host_mng_command_header command_header;
  455. u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH];
  456. };
  457. #include "mac.h"
  458. #include "phy.h"
  459. #include "nvm.h"
  460. #include "manage.h"
  461. /* Function pointers for the MAC. */
  462. struct e1000_mac_operations {
  463. s32 (*id_led_init)(struct e1000_hw *);
  464. s32 (*blink_led)(struct e1000_hw *);
  465. bool (*check_mng_mode)(struct e1000_hw *);
  466. s32 (*check_for_link)(struct e1000_hw *);
  467. s32 (*cleanup_led)(struct e1000_hw *);
  468. void (*clear_hw_cntrs)(struct e1000_hw *);
  469. void (*clear_vfta)(struct e1000_hw *);
  470. s32 (*get_bus_info)(struct e1000_hw *);
  471. void (*set_lan_id)(struct e1000_hw *);
  472. s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *);
  473. s32 (*led_on)(struct e1000_hw *);
  474. s32 (*led_off)(struct e1000_hw *);
  475. void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32);
  476. s32 (*reset_hw)(struct e1000_hw *);
  477. s32 (*init_hw)(struct e1000_hw *);
  478. s32 (*setup_link)(struct e1000_hw *);
  479. s32 (*setup_physical_interface)(struct e1000_hw *);
  480. s32 (*setup_led)(struct e1000_hw *);
  481. void (*write_vfta)(struct e1000_hw *, u32, u32);
  482. void (*config_collision_dist)(struct e1000_hw *);
  483. int (*rar_set)(struct e1000_hw *, u8 *, u32);
  484. s32 (*read_mac_addr)(struct e1000_hw *);
  485. u32 (*rar_get_count)(struct e1000_hw *);
  486. };
  487. /* When to use various PHY register access functions:
  488. *
  489. * Func Caller
  490. * Function Does Does When to use
  491. * ~~~~~~~~~~~~ ~~~~~ ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  492. * X_reg L,P,A n/a for simple PHY reg accesses
  493. * X_reg_locked P,A L for multiple accesses of different regs
  494. * on different pages
  495. * X_reg_page A L,P for multiple accesses of different regs
  496. * on the same page
  497. *
  498. * Where X=[read|write], L=locking, P=sets page, A=register access
  499. *
  500. */
  501. struct e1000_phy_operations {
  502. s32 (*acquire)(struct e1000_hw *);
  503. s32 (*cfg_on_link_up)(struct e1000_hw *);
  504. s32 (*check_polarity)(struct e1000_hw *);
  505. s32 (*check_reset_block)(struct e1000_hw *);
  506. s32 (*commit)(struct e1000_hw *);
  507. s32 (*force_speed_duplex)(struct e1000_hw *);
  508. s32 (*get_cfg_done)(struct e1000_hw *hw);
  509. s32 (*get_cable_length)(struct e1000_hw *);
  510. s32 (*get_info)(struct e1000_hw *);
  511. s32 (*set_page)(struct e1000_hw *, u16);
  512. s32 (*read_reg)(struct e1000_hw *, u32, u16 *);
  513. s32 (*read_reg_locked)(struct e1000_hw *, u32, u16 *);
  514. s32 (*read_reg_page)(struct e1000_hw *, u32, u16 *);
  515. void (*release)(struct e1000_hw *);
  516. s32 (*reset)(struct e1000_hw *);
  517. s32 (*set_d0_lplu_state)(struct e1000_hw *, bool);
  518. s32 (*set_d3_lplu_state)(struct e1000_hw *, bool);
  519. s32 (*write_reg)(struct e1000_hw *, u32, u16);
  520. s32 (*write_reg_locked)(struct e1000_hw *, u32, u16);
  521. s32 (*write_reg_page)(struct e1000_hw *, u32, u16);
  522. void (*power_up)(struct e1000_hw *);
  523. void (*power_down)(struct e1000_hw *);
  524. };
  525. /* Function pointers for the NVM. */
  526. struct e1000_nvm_operations {
  527. s32 (*acquire)(struct e1000_hw *);
  528. s32 (*read)(struct e1000_hw *, u16, u16, u16 *);
  529. void (*release)(struct e1000_hw *);
  530. void (*reload)(struct e1000_hw *);
  531. s32 (*update)(struct e1000_hw *);
  532. s32 (*valid_led_default)(struct e1000_hw *, u16 *);
  533. s32 (*validate)(struct e1000_hw *);
  534. s32 (*write)(struct e1000_hw *, u16, u16, u16 *);
  535. };
  536. struct e1000_mac_info {
  537. struct e1000_mac_operations ops;
  538. u8 addr[ETH_ALEN];
  539. u8 perm_addr[ETH_ALEN];
  540. enum e1000_mac_type type;
  541. u32 collision_delta;
  542. u32 ledctl_default;
  543. u32 ledctl_mode1;
  544. u32 ledctl_mode2;
  545. u32 mc_filter_type;
  546. u32 tx_packet_delta;
  547. u32 txcw;
  548. u16 current_ifs_val;
  549. u16 ifs_max_val;
  550. u16 ifs_min_val;
  551. u16 ifs_ratio;
  552. u16 ifs_step_size;
  553. u16 mta_reg_count;
  554. /* Maximum size of the MTA register table in all supported adapters */
  555. #define MAX_MTA_REG 128
  556. u32 mta_shadow[MAX_MTA_REG];
  557. u16 rar_entry_count;
  558. u8 forced_speed_duplex;
  559. bool adaptive_ifs;
  560. bool has_fwsm;
  561. bool arc_subsystem_valid;
  562. bool autoneg;
  563. bool autoneg_failed;
  564. bool get_link_status;
  565. bool in_ifs_mode;
  566. bool serdes_has_link;
  567. bool tx_pkt_filtering;
  568. enum e1000_serdes_link_state serdes_link_state;
  569. };
  570. struct e1000_phy_info {
  571. struct e1000_phy_operations ops;
  572. enum e1000_phy_type type;
  573. enum e1000_1000t_rx_status local_rx;
  574. enum e1000_1000t_rx_status remote_rx;
  575. enum e1000_ms_type ms_type;
  576. enum e1000_ms_type original_ms_type;
  577. enum e1000_rev_polarity cable_polarity;
  578. enum e1000_smart_speed smart_speed;
  579. u32 addr;
  580. u32 id;
  581. u32 reset_delay_us; /* in usec */
  582. u32 revision;
  583. u32 retry_count;
  584. enum e1000_media_type media_type;
  585. u16 autoneg_advertised;
  586. u16 autoneg_mask;
  587. u16 cable_length;
  588. u16 max_cable_length;
  589. u16 min_cable_length;
  590. u8 mdix;
  591. bool disable_polarity_correction;
  592. bool is_mdix;
  593. bool polarity_correction;
  594. bool speed_downgraded;
  595. bool autoneg_wait_to_complete;
  596. bool retry_enabled;
  597. };
  598. struct e1000_nvm_info {
  599. struct e1000_nvm_operations ops;
  600. enum e1000_nvm_type type;
  601. enum e1000_nvm_override override;
  602. u32 flash_bank_size;
  603. u32 flash_base_addr;
  604. u16 word_size;
  605. u16 delay_usec;
  606. u16 address_bits;
  607. u16 opcode_bits;
  608. u16 page_size;
  609. };
  610. struct e1000_bus_info {
  611. enum e1000_bus_width width;
  612. u16 func;
  613. };
  614. struct e1000_fc_info {
  615. u32 high_water; /* Flow control high-water mark */
  616. u32 low_water; /* Flow control low-water mark */
  617. u16 pause_time; /* Flow control pause timer */
  618. u16 refresh_time; /* Flow control refresh timer */
  619. bool send_xon; /* Flow control send XON */
  620. bool strict_ieee; /* Strict IEEE mode */
  621. enum e1000_fc_mode current_mode; /* FC mode in effect */
  622. enum e1000_fc_mode requested_mode; /* FC mode requested by caller */
  623. };
  624. struct e1000_dev_spec_82571 {
  625. bool laa_is_present;
  626. u32 smb_counter;
  627. };
  628. struct e1000_dev_spec_80003es2lan {
  629. bool mdic_wa_enable;
  630. };
  631. struct e1000_shadow_ram {
  632. u16 value;
  633. bool modified;
  634. };
  635. #define E1000_ICH8_SHADOW_RAM_WORDS 2048
  636. /* I218 PHY Ultra Low Power (ULP) states */
  637. enum e1000_ulp_state {
  638. e1000_ulp_state_unknown,
  639. e1000_ulp_state_off,
  640. e1000_ulp_state_on,
  641. };
  642. struct e1000_dev_spec_ich8lan {
  643. bool kmrn_lock_loss_workaround_enabled;
  644. struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS];
  645. bool nvm_k1_enabled;
  646. bool eee_disable;
  647. u16 eee_lp_ability;
  648. enum e1000_ulp_state ulp_state;
  649. };
  650. struct e1000_hw {
  651. struct e1000_adapter *adapter;
  652. void __iomem *hw_addr;
  653. void __iomem *flash_address;
  654. struct e1000_mac_info mac;
  655. struct e1000_fc_info fc;
  656. struct e1000_phy_info phy;
  657. struct e1000_nvm_info nvm;
  658. struct e1000_bus_info bus;
  659. struct e1000_host_mng_dhcp_cookie mng_cookie;
  660. union {
  661. struct e1000_dev_spec_82571 e82571;
  662. struct e1000_dev_spec_80003es2lan e80003es2lan;
  663. struct e1000_dev_spec_ich8lan ich8lan;
  664. } dev_spec;
  665. };
  666. #include "82571.h"
  667. #include "80003es2lan.h"
  668. #include "ich8lan.h"
  669. #endif /* _E1000E_HW_H_ */