hw.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  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_MTP_I219_LM19 0x550C
  108. #define E1000_DEV_ID_PCH_MTP_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_REVISION_4 4
  114. #define E1000_FUNC_1 1
  115. #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0
  116. #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3
  117. enum e1000_mac_type {
  118. e1000_82571,
  119. e1000_82572,
  120. e1000_82573,
  121. e1000_82574,
  122. e1000_82583,
  123. e1000_80003es2lan,
  124. e1000_ich8lan,
  125. e1000_ich9lan,
  126. e1000_ich10lan,
  127. e1000_pchlan,
  128. e1000_pch2lan,
  129. e1000_pch_lpt,
  130. e1000_pch_spt,
  131. e1000_pch_cnp,
  132. e1000_pch_tgp,
  133. e1000_pch_adp,
  134. e1000_pch_mtp,
  135. e1000_pch_lnp,
  136. };
  137. enum e1000_media_type {
  138. e1000_media_type_unknown = 0,
  139. e1000_media_type_copper = 1,
  140. e1000_media_type_fiber = 2,
  141. e1000_media_type_internal_serdes = 3,
  142. e1000_num_media_types
  143. };
  144. enum e1000_nvm_type {
  145. e1000_nvm_unknown = 0,
  146. e1000_nvm_none,
  147. e1000_nvm_eeprom_spi,
  148. e1000_nvm_flash_hw,
  149. e1000_nvm_flash_sw
  150. };
  151. enum e1000_nvm_override {
  152. e1000_nvm_override_none = 0,
  153. e1000_nvm_override_spi_small,
  154. e1000_nvm_override_spi_large
  155. };
  156. enum e1000_phy_type {
  157. e1000_phy_unknown = 0,
  158. e1000_phy_none,
  159. e1000_phy_m88,
  160. e1000_phy_igp,
  161. e1000_phy_igp_2,
  162. e1000_phy_gg82563,
  163. e1000_phy_igp_3,
  164. e1000_phy_ife,
  165. e1000_phy_bm,
  166. e1000_phy_82578,
  167. e1000_phy_82577,
  168. e1000_phy_82579,
  169. e1000_phy_i217,
  170. };
  171. enum e1000_bus_width {
  172. e1000_bus_width_unknown = 0,
  173. e1000_bus_width_pcie_x1,
  174. e1000_bus_width_pcie_x2,
  175. e1000_bus_width_pcie_x4 = 4,
  176. e1000_bus_width_pcie_x8 = 8,
  177. e1000_bus_width_32,
  178. e1000_bus_width_64,
  179. e1000_bus_width_reserved
  180. };
  181. enum e1000_1000t_rx_status {
  182. e1000_1000t_rx_status_not_ok = 0,
  183. e1000_1000t_rx_status_ok,
  184. e1000_1000t_rx_status_undefined = 0xFF
  185. };
  186. enum e1000_rev_polarity {
  187. e1000_rev_polarity_normal = 0,
  188. e1000_rev_polarity_reversed,
  189. e1000_rev_polarity_undefined = 0xFF
  190. };
  191. enum e1000_fc_mode {
  192. e1000_fc_none = 0,
  193. e1000_fc_rx_pause,
  194. e1000_fc_tx_pause,
  195. e1000_fc_full,
  196. e1000_fc_default = 0xFF
  197. };
  198. enum e1000_ms_type {
  199. e1000_ms_hw_default = 0,
  200. e1000_ms_force_master,
  201. e1000_ms_force_slave,
  202. e1000_ms_auto
  203. };
  204. enum e1000_smart_speed {
  205. e1000_smart_speed_default = 0,
  206. e1000_smart_speed_on,
  207. e1000_smart_speed_off
  208. };
  209. enum e1000_serdes_link_state {
  210. e1000_serdes_link_down = 0,
  211. e1000_serdes_link_autoneg_progress,
  212. e1000_serdes_link_autoneg_complete,
  213. e1000_serdes_link_forced_up
  214. };
  215. /* Receive Descriptor - Extended */
  216. union e1000_rx_desc_extended {
  217. struct {
  218. __le64 buffer_addr;
  219. __le64 reserved;
  220. } read;
  221. struct {
  222. struct {
  223. __le32 mrq; /* Multiple Rx Queues */
  224. union {
  225. __le32 rss; /* RSS Hash */
  226. struct {
  227. __le16 ip_id; /* IP id */
  228. __le16 csum; /* Packet Checksum */
  229. } csum_ip;
  230. } hi_dword;
  231. } lower;
  232. struct {
  233. __le32 status_error; /* ext status/error */
  234. __le16 length;
  235. __le16 vlan; /* VLAN tag */
  236. } upper;
  237. } wb; /* writeback */
  238. };
  239. #define MAX_PS_BUFFERS 4
  240. /* Number of packet split data buffers (not including the header buffer) */
  241. #define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1)
  242. /* Receive Descriptor - Packet Split */
  243. union e1000_rx_desc_packet_split {
  244. struct {
  245. /* one buffer for protocol header(s), three data buffers */
  246. __le64 buffer_addr[MAX_PS_BUFFERS];
  247. } read;
  248. struct {
  249. struct {
  250. __le32 mrq; /* Multiple Rx Queues */
  251. union {
  252. __le32 rss; /* RSS Hash */
  253. struct {
  254. __le16 ip_id; /* IP id */
  255. __le16 csum; /* Packet Checksum */
  256. } csum_ip;
  257. } hi_dword;
  258. } lower;
  259. struct {
  260. __le32 status_error; /* ext status/error */
  261. __le16 length0; /* length of buffer 0 */
  262. __le16 vlan; /* VLAN tag */
  263. } middle;
  264. struct {
  265. __le16 header_status;
  266. /* length of buffers 1-3 */
  267. __le16 length[PS_PAGE_BUFFERS];
  268. } upper;
  269. __le64 reserved;
  270. } wb; /* writeback */
  271. };
  272. /* Transmit Descriptor */
  273. struct e1000_tx_desc {
  274. __le64 buffer_addr; /* Address of the descriptor's data buffer */
  275. union {
  276. __le32 data;
  277. struct {
  278. __le16 length; /* Data buffer length */
  279. u8 cso; /* Checksum offset */
  280. u8 cmd; /* Descriptor control */
  281. } flags;
  282. } lower;
  283. union {
  284. __le32 data;
  285. struct {
  286. u8 status; /* Descriptor status */
  287. u8 css; /* Checksum start */
  288. __le16 special;
  289. } fields;
  290. } upper;
  291. };
  292. /* Offload Context Descriptor */
  293. struct e1000_context_desc {
  294. union {
  295. __le32 ip_config;
  296. struct {
  297. u8 ipcss; /* IP checksum start */
  298. u8 ipcso; /* IP checksum offset */
  299. __le16 ipcse; /* IP checksum end */
  300. } ip_fields;
  301. } lower_setup;
  302. union {
  303. __le32 tcp_config;
  304. struct {
  305. u8 tucss; /* TCP checksum start */
  306. u8 tucso; /* TCP checksum offset */
  307. __le16 tucse; /* TCP checksum end */
  308. } tcp_fields;
  309. } upper_setup;
  310. __le32 cmd_and_length;
  311. union {
  312. __le32 data;
  313. struct {
  314. u8 status; /* Descriptor status */
  315. u8 hdr_len; /* Header length */
  316. __le16 mss; /* Maximum segment size */
  317. } fields;
  318. } tcp_seg_setup;
  319. };
  320. /* Offload data descriptor */
  321. struct e1000_data_desc {
  322. __le64 buffer_addr; /* Address of the descriptor's buffer address */
  323. union {
  324. __le32 data;
  325. struct {
  326. __le16 length; /* Data buffer length */
  327. u8 typ_len_ext;
  328. u8 cmd;
  329. } flags;
  330. } lower;
  331. union {
  332. __le32 data;
  333. struct {
  334. u8 status; /* Descriptor status */
  335. u8 popts; /* Packet Options */
  336. __le16 special;
  337. } fields;
  338. } upper;
  339. };
  340. /* Statistics counters collected by the MAC */
  341. struct e1000_hw_stats {
  342. u64 crcerrs;
  343. u64 algnerrc;
  344. u64 symerrs;
  345. u64 rxerrc;
  346. u64 mpc;
  347. u64 scc;
  348. u64 ecol;
  349. u64 mcc;
  350. u64 latecol;
  351. u64 colc;
  352. u64 dc;
  353. u64 tncrs;
  354. u64 sec;
  355. u64 cexterr;
  356. u64 rlec;
  357. u64 xonrxc;
  358. u64 xontxc;
  359. u64 xoffrxc;
  360. u64 xofftxc;
  361. u64 fcruc;
  362. u64 prc64;
  363. u64 prc127;
  364. u64 prc255;
  365. u64 prc511;
  366. u64 prc1023;
  367. u64 prc1522;
  368. u64 gprc;
  369. u64 bprc;
  370. u64 mprc;
  371. u64 gptc;
  372. u64 gorc;
  373. u64 gotc;
  374. u64 rnbc;
  375. u64 ruc;
  376. u64 rfc;
  377. u64 roc;
  378. u64 rjc;
  379. u64 mgprc;
  380. u64 mgpdc;
  381. u64 mgptc;
  382. u64 tor;
  383. u64 tot;
  384. u64 tpr;
  385. u64 tpt;
  386. u64 ptc64;
  387. u64 ptc127;
  388. u64 ptc255;
  389. u64 ptc511;
  390. u64 ptc1023;
  391. u64 ptc1522;
  392. u64 mptc;
  393. u64 bptc;
  394. u64 tsctc;
  395. u64 tsctfc;
  396. u64 iac;
  397. u64 icrxptc;
  398. u64 icrxatc;
  399. u64 ictxptc;
  400. u64 ictxatc;
  401. u64 ictxqec;
  402. u64 ictxqmtc;
  403. u64 icrxdmtc;
  404. u64 icrxoc;
  405. };
  406. struct e1000_phy_stats {
  407. u32 idle_errors;
  408. u32 receive_errors;
  409. };
  410. struct e1000_host_mng_dhcp_cookie {
  411. u32 signature;
  412. u8 status;
  413. u8 reserved0;
  414. u16 vlan_id;
  415. u32 reserved1;
  416. u16 reserved2;
  417. u8 reserved3;
  418. u8 checksum;
  419. };
  420. /* Host Interface "Rev 1" */
  421. struct e1000_host_command_header {
  422. u8 command_id;
  423. u8 command_length;
  424. u8 command_options;
  425. u8 checksum;
  426. };
  427. #define E1000_HI_MAX_DATA_LENGTH 252
  428. struct e1000_host_command_info {
  429. struct e1000_host_command_header command_header;
  430. u8 command_data[E1000_HI_MAX_DATA_LENGTH];
  431. };
  432. /* Host Interface "Rev 2" */
  433. struct e1000_host_mng_command_header {
  434. u8 command_id;
  435. u8 checksum;
  436. u16 reserved1;
  437. u16 reserved2;
  438. u16 command_length;
  439. };
  440. #define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8
  441. struct e1000_host_mng_command_info {
  442. struct e1000_host_mng_command_header command_header;
  443. u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH];
  444. };
  445. #include "mac.h"
  446. #include "phy.h"
  447. #include "nvm.h"
  448. #include "manage.h"
  449. /* Function pointers for the MAC. */
  450. struct e1000_mac_operations {
  451. s32 (*id_led_init)(struct e1000_hw *);
  452. s32 (*blink_led)(struct e1000_hw *);
  453. bool (*check_mng_mode)(struct e1000_hw *);
  454. s32 (*check_for_link)(struct e1000_hw *);
  455. s32 (*cleanup_led)(struct e1000_hw *);
  456. void (*clear_hw_cntrs)(struct e1000_hw *);
  457. void (*clear_vfta)(struct e1000_hw *);
  458. s32 (*get_bus_info)(struct e1000_hw *);
  459. void (*set_lan_id)(struct e1000_hw *);
  460. s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *);
  461. s32 (*led_on)(struct e1000_hw *);
  462. s32 (*led_off)(struct e1000_hw *);
  463. void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32);
  464. s32 (*reset_hw)(struct e1000_hw *);
  465. s32 (*init_hw)(struct e1000_hw *);
  466. s32 (*setup_link)(struct e1000_hw *);
  467. s32 (*setup_physical_interface)(struct e1000_hw *);
  468. s32 (*setup_led)(struct e1000_hw *);
  469. void (*write_vfta)(struct e1000_hw *, u32, u32);
  470. void (*config_collision_dist)(struct e1000_hw *);
  471. int (*rar_set)(struct e1000_hw *, u8 *, u32);
  472. s32 (*read_mac_addr)(struct e1000_hw *);
  473. u32 (*rar_get_count)(struct e1000_hw *);
  474. };
  475. /* When to use various PHY register access functions:
  476. *
  477. * Func Caller
  478. * Function Does Does When to use
  479. * ~~~~~~~~~~~~ ~~~~~ ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  480. * X_reg L,P,A n/a for simple PHY reg accesses
  481. * X_reg_locked P,A L for multiple accesses of different regs
  482. * on different pages
  483. * X_reg_page A L,P for multiple accesses of different regs
  484. * on the same page
  485. *
  486. * Where X=[read|write], L=locking, P=sets page, A=register access
  487. *
  488. */
  489. struct e1000_phy_operations {
  490. s32 (*acquire)(struct e1000_hw *);
  491. s32 (*cfg_on_link_up)(struct e1000_hw *);
  492. s32 (*check_polarity)(struct e1000_hw *);
  493. s32 (*check_reset_block)(struct e1000_hw *);
  494. s32 (*commit)(struct e1000_hw *);
  495. s32 (*force_speed_duplex)(struct e1000_hw *);
  496. s32 (*get_cfg_done)(struct e1000_hw *hw);
  497. s32 (*get_cable_length)(struct e1000_hw *);
  498. s32 (*get_info)(struct e1000_hw *);
  499. s32 (*set_page)(struct e1000_hw *, u16);
  500. s32 (*read_reg)(struct e1000_hw *, u32, u16 *);
  501. s32 (*read_reg_locked)(struct e1000_hw *, u32, u16 *);
  502. s32 (*read_reg_page)(struct e1000_hw *, u32, u16 *);
  503. void (*release)(struct e1000_hw *);
  504. s32 (*reset)(struct e1000_hw *);
  505. s32 (*set_d0_lplu_state)(struct e1000_hw *, bool);
  506. s32 (*set_d3_lplu_state)(struct e1000_hw *, bool);
  507. s32 (*write_reg)(struct e1000_hw *, u32, u16);
  508. s32 (*write_reg_locked)(struct e1000_hw *, u32, u16);
  509. s32 (*write_reg_page)(struct e1000_hw *, u32, u16);
  510. void (*power_up)(struct e1000_hw *);
  511. void (*power_down)(struct e1000_hw *);
  512. };
  513. /* Function pointers for the NVM. */
  514. struct e1000_nvm_operations {
  515. s32 (*acquire)(struct e1000_hw *);
  516. s32 (*read)(struct e1000_hw *, u16, u16, u16 *);
  517. void (*release)(struct e1000_hw *);
  518. void (*reload)(struct e1000_hw *);
  519. s32 (*update)(struct e1000_hw *);
  520. s32 (*valid_led_default)(struct e1000_hw *, u16 *);
  521. s32 (*validate)(struct e1000_hw *);
  522. s32 (*write)(struct e1000_hw *, u16, u16, u16 *);
  523. };
  524. struct e1000_mac_info {
  525. struct e1000_mac_operations ops;
  526. u8 addr[ETH_ALEN];
  527. u8 perm_addr[ETH_ALEN];
  528. enum e1000_mac_type type;
  529. u32 collision_delta;
  530. u32 ledctl_default;
  531. u32 ledctl_mode1;
  532. u32 ledctl_mode2;
  533. u32 mc_filter_type;
  534. u32 tx_packet_delta;
  535. u32 txcw;
  536. u16 current_ifs_val;
  537. u16 ifs_max_val;
  538. u16 ifs_min_val;
  539. u16 ifs_ratio;
  540. u16 ifs_step_size;
  541. u16 mta_reg_count;
  542. /* Maximum size of the MTA register table in all supported adapters */
  543. #define MAX_MTA_REG 128
  544. u32 mta_shadow[MAX_MTA_REG];
  545. u16 rar_entry_count;
  546. u8 forced_speed_duplex;
  547. bool adaptive_ifs;
  548. bool has_fwsm;
  549. bool arc_subsystem_valid;
  550. bool autoneg;
  551. bool autoneg_failed;
  552. bool get_link_status;
  553. bool in_ifs_mode;
  554. bool serdes_has_link;
  555. bool tx_pkt_filtering;
  556. enum e1000_serdes_link_state serdes_link_state;
  557. };
  558. struct e1000_phy_info {
  559. struct e1000_phy_operations ops;
  560. enum e1000_phy_type type;
  561. enum e1000_1000t_rx_status local_rx;
  562. enum e1000_1000t_rx_status remote_rx;
  563. enum e1000_ms_type ms_type;
  564. enum e1000_ms_type original_ms_type;
  565. enum e1000_rev_polarity cable_polarity;
  566. enum e1000_smart_speed smart_speed;
  567. u32 addr;
  568. u32 id;
  569. u32 reset_delay_us; /* in usec */
  570. u32 revision;
  571. enum e1000_media_type media_type;
  572. u16 autoneg_advertised;
  573. u16 autoneg_mask;
  574. u16 cable_length;
  575. u16 max_cable_length;
  576. u16 min_cable_length;
  577. u8 mdix;
  578. bool disable_polarity_correction;
  579. bool is_mdix;
  580. bool polarity_correction;
  581. bool speed_downgraded;
  582. bool autoneg_wait_to_complete;
  583. };
  584. struct e1000_nvm_info {
  585. struct e1000_nvm_operations ops;
  586. enum e1000_nvm_type type;
  587. enum e1000_nvm_override override;
  588. u32 flash_bank_size;
  589. u32 flash_base_addr;
  590. u16 word_size;
  591. u16 delay_usec;
  592. u16 address_bits;
  593. u16 opcode_bits;
  594. u16 page_size;
  595. };
  596. struct e1000_bus_info {
  597. enum e1000_bus_width width;
  598. u16 func;
  599. };
  600. struct e1000_fc_info {
  601. u32 high_water; /* Flow control high-water mark */
  602. u32 low_water; /* Flow control low-water mark */
  603. u16 pause_time; /* Flow control pause timer */
  604. u16 refresh_time; /* Flow control refresh timer */
  605. bool send_xon; /* Flow control send XON */
  606. bool strict_ieee; /* Strict IEEE mode */
  607. enum e1000_fc_mode current_mode; /* FC mode in effect */
  608. enum e1000_fc_mode requested_mode; /* FC mode requested by caller */
  609. };
  610. struct e1000_dev_spec_82571 {
  611. bool laa_is_present;
  612. u32 smb_counter;
  613. };
  614. struct e1000_dev_spec_80003es2lan {
  615. bool mdic_wa_enable;
  616. };
  617. struct e1000_shadow_ram {
  618. u16 value;
  619. bool modified;
  620. };
  621. #define E1000_ICH8_SHADOW_RAM_WORDS 2048
  622. /* I218 PHY Ultra Low Power (ULP) states */
  623. enum e1000_ulp_state {
  624. e1000_ulp_state_unknown,
  625. e1000_ulp_state_off,
  626. e1000_ulp_state_on,
  627. };
  628. struct e1000_dev_spec_ich8lan {
  629. bool kmrn_lock_loss_workaround_enabled;
  630. struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS];
  631. bool nvm_k1_enabled;
  632. bool eee_disable;
  633. u16 eee_lp_ability;
  634. enum e1000_ulp_state ulp_state;
  635. };
  636. struct e1000_hw {
  637. struct e1000_adapter *adapter;
  638. void __iomem *hw_addr;
  639. void __iomem *flash_address;
  640. struct e1000_mac_info mac;
  641. struct e1000_fc_info fc;
  642. struct e1000_phy_info phy;
  643. struct e1000_nvm_info nvm;
  644. struct e1000_bus_info bus;
  645. struct e1000_host_mng_dhcp_cookie mng_cookie;
  646. union {
  647. struct e1000_dev_spec_82571 e82571;
  648. struct e1000_dev_spec_80003es2lan e80003es2lan;
  649. struct e1000_dev_spec_ich8lan ich8lan;
  650. } dev_spec;
  651. };
  652. #include "82571.h"
  653. #include "80003es2lan.h"
  654. #include "ich8lan.h"
  655. #endif /* _E1000E_HW_H_ */