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.

e1000e.h 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. /*******************************************************************************
  2. Intel PRO/1000 Linux driver
  3. Copyright(c) 1999 - 2009 Intel Corporation.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Contact Information:
  17. Linux NICS <linux.nics@intel.com>
  18. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  19. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  20. *******************************************************************************/
  21. FILE_LICENCE ( GPL2_OR_LATER );
  22. /* Linux PRO/1000 Ethernet Driver main header file */
  23. #ifndef _E1000E_H_
  24. #define _E1000E_H_
  25. #include <stdint.h>
  26. #include <stdlib.h>
  27. #include <stdio.h>
  28. #include <string.h>
  29. #include <unistd.h>
  30. #include <ipxe/io.h>
  31. #include <errno.h>
  32. #include <byteswap.h>
  33. #include <ipxe/pci.h>
  34. #include <ipxe/malloc.h>
  35. #include <ipxe/if_ether.h>
  36. #include <ipxe/ethernet.h>
  37. #include <ipxe/iobuf.h>
  38. #include <ipxe/netdevice.h>
  39. /* Begin OS Dependencies */
  40. #define u8 unsigned char
  41. #define bool boolean_t
  42. #define dma_addr_t unsigned long
  43. #define __le16 uint16_t
  44. #define __le32 uint32_t
  45. #define __le64 uint64_t
  46. #define __iomem
  47. #define msleep(x) mdelay(x)
  48. #define ETH_FCS_LEN 4
  49. typedef int spinlock_t;
  50. typedef enum {
  51. false = 0,
  52. true = 1
  53. } boolean_t;
  54. /* End OS Dependencies */
  55. #include "e1000e_hw.h"
  56. #define E1000_TX_FLAGS_CSUM 0x00000001
  57. #define E1000_TX_FLAGS_VLAN 0x00000002
  58. #define E1000_TX_FLAGS_TSO 0x00000004
  59. #define E1000_TX_FLAGS_IPV4 0x00000008
  60. #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000
  61. #define E1000_TX_FLAGS_VLAN_SHIFT 16
  62. #define E1000_MAX_PER_TXD 8192
  63. #define E1000_MAX_TXD_PWR 12
  64. #define MINIMUM_DHCP_PACKET_SIZE 282
  65. struct e1000_info;
  66. #define e_dbg(arg...) if (0) { printf (arg); };
  67. #ifdef CONFIG_E1000E_MSIX
  68. /* Interrupt modes, as used by the IntMode paramter */
  69. #define E1000E_INT_MODE_LEGACY 0
  70. #define E1000E_INT_MODE_MSI 1
  71. #define E1000E_INT_MODE_MSIX 2
  72. #endif /* CONFIG_E1000E_MSIX */
  73. #ifndef CONFIG_E1000E_NAPI
  74. #define E1000_MAX_INTR 10
  75. #endif /* CONFIG_E1000E_NAPI */
  76. /* Tx/Rx descriptor defines */
  77. #define E1000_DEFAULT_TXD 256
  78. #define E1000_MAX_TXD 4096
  79. #define E1000_MIN_TXD 64
  80. #define E1000_DEFAULT_RXD 256
  81. #define E1000_MAX_RXD 4096
  82. #define E1000_MIN_RXD 64
  83. #define E1000_MIN_ITR_USECS 10 /* 100000 irq/sec */
  84. #define E1000_MAX_ITR_USECS 10000 /* 100 irq/sec */
  85. /* Early Receive defines */
  86. #define E1000_ERT_2048 0x100
  87. #define E1000_FC_PAUSE_TIME 0x0680 /* 858 usec */
  88. /* How many Tx Descriptors do we need to call netif_wake_queue ? */
  89. /* How many Rx Buffers do we bundle into one write to the hardware ? */
  90. #define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */
  91. #define AUTO_ALL_MODES 0
  92. #define E1000_EEPROM_APME 0x0400
  93. #define E1000_MNG_VLAN_NONE (-1)
  94. /* Number of packet split data buffers (not including the header buffer) */
  95. #define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1)
  96. #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
  97. #define DEFAULT_JUMBO 9234
  98. enum e1000_boards {
  99. board_82571,
  100. board_82572,
  101. board_82573,
  102. board_82574,
  103. board_80003es2lan,
  104. board_ich8lan,
  105. board_ich9lan,
  106. board_ich10lan,
  107. board_pchlan,
  108. board_82583,
  109. };
  110. /* board specific private data structure */
  111. struct e1000_adapter {
  112. const struct e1000_info *ei;
  113. /* OS defined structs */
  114. struct net_device *netdev;
  115. struct pci_device *pdev;
  116. struct net_device_stats net_stats;
  117. /* structs defined in e1000_hw.h */
  118. struct e1000_hw hw;
  119. struct e1000_phy_info phy_info;
  120. u32 wol;
  121. u32 pba;
  122. u32 max_hw_frame_size;
  123. bool fc_autoneg;
  124. unsigned int flags;
  125. unsigned int flags2;
  126. #define NUM_TX_DESC 8
  127. #define NUM_RX_DESC 8
  128. struct io_buffer *tx_iobuf[NUM_TX_DESC];
  129. struct io_buffer *rx_iobuf[NUM_RX_DESC];
  130. struct e1000_tx_desc *tx_base;
  131. struct e1000_rx_desc *rx_base;
  132. uint32_t tx_ring_size;
  133. uint32_t rx_ring_size;
  134. uint32_t tx_head;
  135. uint32_t tx_tail;
  136. uint32_t tx_fill_ctr;
  137. uint32_t rx_curr;
  138. uint32_t ioaddr;
  139. uint32_t irqno;
  140. uint32_t tx_int_delay;
  141. uint32_t tx_abs_int_delay;
  142. uint32_t txd_cmd;
  143. };
  144. struct e1000_info {
  145. enum e1000_mac_type mac;
  146. unsigned int flags;
  147. unsigned int flags2;
  148. u32 pba;
  149. u32 max_hw_frame_size;
  150. s32 (*get_variants)(struct e1000_adapter *);
  151. void (*init_ops)(struct e1000_hw *);
  152. };
  153. /* hardware capability, feature, and workaround flags */
  154. #define FLAG_HAS_AMT (1 << 0)
  155. #define FLAG_HAS_FLASH (1 << 1)
  156. #define FLAG_HAS_HW_VLAN_FILTER (1 << 2)
  157. #define FLAG_HAS_WOL (1 << 3)
  158. #define FLAG_HAS_ERT (1 << 4)
  159. #define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5)
  160. #define FLAG_HAS_SWSM_ON_LOAD (1 << 6)
  161. #define FLAG_HAS_JUMBO_FRAMES (1 << 7)
  162. #define FLAG_IS_ICH (1 << 9)
  163. #ifdef CONFIG_E1000E_MSIX
  164. #define FLAG_HAS_MSIX (1 << 10)
  165. #endif
  166. #define FLAG_HAS_SMART_POWER_DOWN (1 << 11)
  167. #define FLAG_IS_QUAD_PORT_A (1 << 12)
  168. #define FLAG_IS_QUAD_PORT (1 << 13)
  169. #define FLAG_TIPG_MEDIUM_FOR_80003ESLAN (1 << 14)
  170. #define FLAG_APME_IN_WUC (1 << 15)
  171. #define FLAG_APME_IN_CTRL3 (1 << 16)
  172. #define FLAG_APME_CHECK_PORT_B (1 << 17)
  173. #define FLAG_DISABLE_FC_PAUSE_TIME (1 << 18)
  174. #define FLAG_NO_WAKE_UCAST (1 << 19)
  175. #define FLAG_MNG_PT_ENABLED (1 << 20)
  176. #define FLAG_RESET_OVERWRITES_LAA (1 << 21)
  177. #define FLAG_TARC_SPEED_MODE_BIT (1 << 22)
  178. #define FLAG_TARC_SET_BIT_ZERO (1 << 23)
  179. #define FLAG_RX_NEEDS_RESTART (1 << 24)
  180. #define FLAG_LSC_GIG_SPEED_DROP (1 << 25)
  181. #define FLAG_SMART_POWER_DOWN (1 << 26)
  182. #define FLAG_MSI_ENABLED (1 << 27)
  183. #define FLAG_RX_CSUM_ENABLED (1 << 28)
  184. #define FLAG_TSO_FORCE (1 << 29)
  185. #define FLAG_RX_RESTART_NOW (1 << 30)
  186. #define FLAG_MSI_TEST_FAILED (1 << 31)
  187. /* CRC Stripping defines */
  188. #define FLAG2_CRC_STRIPPING (1 << 0)
  189. #define FLAG2_HAS_PHY_WAKEUP (1 << 1)
  190. #define E1000_RX_DESC_PS(R, i) \
  191. (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
  192. #define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
  193. #define E1000_RX_DESC(R, i) E1000_GET_DESC(R, i, e1000_rx_desc)
  194. #define E1000_TX_DESC(R, i) E1000_GET_DESC(R, i, e1000_tx_desc)
  195. #define E1000_CONTEXT_DESC(R, i) E1000_GET_DESC(R, i, e1000_context_desc)
  196. enum e1000_state_t {
  197. __E1000E_TESTING,
  198. __E1000E_RESETTING,
  199. __E1000E_DOWN
  200. };
  201. enum latency_range {
  202. lowest_latency = 0,
  203. low_latency = 1,
  204. bulk_latency = 2,
  205. latency_invalid = 255
  206. };
  207. extern void e1000e_check_options(struct e1000_adapter *adapter);
  208. extern void e1000e_reset(struct e1000_adapter *adapter);
  209. extern void e1000e_power_up_phy(struct e1000_adapter *adapter);
  210. extern void e1000e_init_function_pointers_82571(struct e1000_hw *hw)
  211. __attribute__((weak));
  212. extern void e1000e_init_function_pointers_80003es2lan(struct e1000_hw *hw)
  213. __attribute__((weak));
  214. extern void e1000e_init_function_pointers_ich8lan(struct e1000_hw *hw)
  215. __attribute__((weak));
  216. extern int e1000e_probe(struct pci_device *pdev,
  217. const struct pci_device_id *id __unused);
  218. extern void e1000e_remove(struct pci_device *pdev);
  219. extern s32 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num);
  220. static inline s32 e1000e_commit_phy(struct e1000_hw *hw)
  221. {
  222. if (hw->phy.ops.commit)
  223. return hw->phy.ops.commit(hw);
  224. return 0;
  225. }
  226. extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw);
  227. extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw);
  228. extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state);
  229. extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
  230. bool state);
  231. extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
  232. extern void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw);
  233. extern void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw);
  234. extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw);
  235. extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw);
  236. extern s32 e1000e_check_for_serdes_link(struct e1000_hw *hw);
  237. extern s32 e1000e_cleanup_led_generic(struct e1000_hw *hw);
  238. extern s32 e1000e_led_on_generic(struct e1000_hw *hw);
  239. extern s32 e1000e_led_off_generic(struct e1000_hw *hw);
  240. extern s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw);
  241. extern s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *duplex);
  242. extern s32 e1000e_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, u16 *speed, u16 *duplex);
  243. extern s32 e1000e_disable_pcie_master(struct e1000_hw *hw);
  244. extern s32 e1000e_get_auto_rd_done(struct e1000_hw *hw);
  245. extern s32 e1000e_id_led_init(struct e1000_hw *hw);
  246. extern void e1000e_clear_hw_cntrs_base(struct e1000_hw *hw);
  247. extern s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw);
  248. extern s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw);
  249. extern s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw);
  250. extern s32 e1000e_setup_link(struct e1000_hw *hw);
  251. static inline void e1000e_clear_vfta(struct e1000_hw *hw)
  252. {
  253. hw->mac.ops.clear_vfta(hw);
  254. }
  255. extern void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);
  256. extern void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw,
  257. u8 *mc_addr_list,
  258. u32 mc_addr_count);
  259. extern void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
  260. extern s32 e1000e_set_fc_watermarks(struct e1000_hw *hw);
  261. extern void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop);
  262. extern s32 e1000e_get_hw_semaphore(struct e1000_hw *hw);
  263. extern s32 e1000e_valid_led_default(struct e1000_hw *hw, u16 *data);
  264. extern void e1000e_config_collision_dist(struct e1000_hw *hw);
  265. extern s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw);
  266. extern s32 e1000e_force_mac_fc(struct e1000_hw *hw);
  267. extern s32 e1000e_blink_led(struct e1000_hw *hw);
  268. extern void e1000e_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value);
  269. static inline void e1000e_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
  270. {
  271. if (hw->mac.ops.write_vfta)
  272. hw->mac.ops.write_vfta(hw, offset, value);
  273. }
  274. extern void e1000e_reset_adaptive(struct e1000_hw *hw);
  275. extern void e1000e_update_adaptive(struct e1000_hw *hw);
  276. extern s32 e1000e_setup_copper_link(struct e1000_hw *hw);
  277. extern void e1000e_put_hw_semaphore(struct e1000_hw *hw);
  278. extern s32 e1000e_check_reset_block_generic(struct e1000_hw *hw);
  279. #if 0
  280. extern s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw);
  281. #endif
  282. #if 0
  283. extern s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw);
  284. #endif
  285. extern s32 e1000e_get_phy_info_igp(struct e1000_hw *hw);
  286. extern s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
  287. extern s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw);
  288. extern s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active);
  289. extern s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data);
  290. extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw);
  291. #if 0
  292. extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw);
  293. #endif
  294. extern s32 e1000e_get_cfg_done(struct e1000_hw *hw);
  295. #if 0
  296. extern s32 e1000e_get_cable_length_m88(struct e1000_hw *hw);
  297. #endif
  298. extern s32 e1000e_get_phy_info_m88(struct e1000_hw *hw);
  299. extern s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data);
  300. extern s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data);
  301. extern enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id);
  302. extern s32 e1000e_determine_phy_address(struct e1000_hw *hw);
  303. extern s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data);
  304. extern s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data);
  305. #if 0
  306. extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
  307. #endif
  308. extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
  309. extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
  310. extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
  311. u32 usec_interval, bool *success);
  312. extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw);
  313. extern s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data);
  314. extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data);
  315. extern s32 e1000e_check_downshift(struct e1000_hw *hw);
  316. static inline s32 e1000e_phy_hw_reset(struct e1000_hw *hw)
  317. {
  318. if (hw->phy.ops.reset)
  319. return hw->phy.ops.reset(hw);
  320. return 0;
  321. }
  322. static inline s32 e1000e_check_reset_block(struct e1000_hw *hw)
  323. {
  324. if (hw->phy.ops.check_reset_block)
  325. return hw->phy.ops.check_reset_block(hw);
  326. return 0;
  327. }
  328. static inline s32 e1e_rphy(struct e1000_hw *hw, u32 offset, u16 *data)
  329. {
  330. if (hw->phy.ops.read_reg)
  331. return hw->phy.ops.read_reg(hw, offset, data);
  332. return 0;
  333. }
  334. static inline s32 e1e_wphy(struct e1000_hw *hw, u32 offset, u16 data)
  335. {
  336. if (hw->phy.ops.write_reg)
  337. return hw->phy.ops.write_reg(hw, offset, data);
  338. return 0;
  339. }
  340. #if 0
  341. static inline s32 e1000e_get_cable_length(struct e1000_hw *hw)
  342. {
  343. if (hw->phy.ops.get_cable_length)
  344. return hw->phy.ops.get_cable_length(hw);
  345. return 0;
  346. }
  347. #endif
  348. extern s32 e1000e_acquire_nvm(struct e1000_hw *hw);
  349. extern s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
  350. extern s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw);
  351. extern s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
  352. extern s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
  353. extern s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw);
  354. extern void e1000e_release_nvm(struct e1000_hw *hw);
  355. static inline s32 e1000e_read_mac_addr(struct e1000_hw *hw)
  356. {
  357. if (hw->mac.ops.read_mac_addr)
  358. return hw->mac.ops.read_mac_addr(hw);
  359. return e1000e_read_mac_addr_generic(hw);
  360. }
  361. static inline s32 e1000e_validate_nvm_checksum(struct e1000_hw *hw)
  362. {
  363. return hw->nvm.ops.validate(hw);
  364. }
  365. static inline s32 e1000e_update_nvm_checksum(struct e1000_hw *hw)
  366. {
  367. return hw->nvm.ops.update(hw);
  368. }
  369. static inline s32 e1000e_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
  370. {
  371. return hw->nvm.ops.read(hw, offset, words, data);
  372. }
  373. static inline s32 e1000e_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
  374. {
  375. return hw->nvm.ops.write(hw, offset, words, data);
  376. }
  377. static inline s32 e1000e_get_phy_info(struct e1000_hw *hw)
  378. {
  379. if (hw->phy.ops.get_info)
  380. return hw->phy.ops.get_info(hw);
  381. return 0;
  382. }
  383. extern bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw);
  384. #if 0
  385. extern s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length);
  386. #endif
  387. static inline u32 __er32(struct e1000_hw *hw, unsigned long reg)
  388. {
  389. return readl(hw->hw_addr + reg);
  390. }
  391. static inline void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
  392. {
  393. writel(val, hw->hw_addr + reg);
  394. }
  395. #define er32(reg) __er32(hw, E1000_##reg)
  396. #define ew32(reg, val) __ew32(hw, E1000_##reg, (val))
  397. #define e1e_flush() er32(STATUS)
  398. #define E1000_WRITE_REG(a, reg, value) \
  399. writel((value), ((a)->hw_addr + reg))
  400. #define E1000_READ_REG(a, reg) (readl((a)->hw_addr + reg))
  401. #define E1000_WRITE_REG_ARRAY(a, reg, offset, value) \
  402. writel((value), ((a)->hw_addr + reg + ((offset) << 2)))
  403. #define E1000_READ_REG_ARRAY(a, reg, offset) ( \
  404. readl((a)->hw_addr + reg + ((offset) << 2)))
  405. #define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
  406. #define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
  407. static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
  408. {
  409. return readw(hw->flash_address + reg);
  410. }
  411. static inline u32 __er32flash(struct e1000_hw *hw, unsigned long reg)
  412. {
  413. return readl(hw->flash_address + reg);
  414. }
  415. static inline void __ew16flash(struct e1000_hw *hw, unsigned long reg, u16 val)
  416. {
  417. writew(val, hw->flash_address + reg);
  418. }
  419. static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val)
  420. {
  421. writel(val, hw->flash_address + reg);
  422. }
  423. #define er16flash(reg) __er16flash(hw, (reg))
  424. #define er32flash(reg) __er32flash(hw, (reg))
  425. #define ew16flash(reg, val) __ew16flash(hw, (reg), (val))
  426. #define ew32flash(reg, val) __ew32flash(hw, (reg), (val))
  427. #endif /* _E1000E_H_ */