atl1e.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. /*
  2. * Copyright(c) 2007 Atheros Corporation. All rights reserved.
  3. * Copyright(c) 2007 xiong huang <xiong.huang@atheros.com>
  4. *
  5. * Derived from Intel e1000 driver
  6. * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the Free
  10. * Software Foundation; either version 2 of the License, or (at your option)
  11. * any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  16. * more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along with
  19. * this program; if not, write to the Free Software Foundation, Inc., 59
  20. * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. #ifndef _ATL1E_H_
  23. #define _ATL1E_H_
  24. #include <linux/interrupt.h>
  25. #include <linux/types.h>
  26. #include <linux/errno.h>
  27. #include <linux/module.h>
  28. #include <linux/pci.h>
  29. #include <linux/netdevice.h>
  30. #include <linux/etherdevice.h>
  31. #include <linux/skbuff.h>
  32. #include <linux/ioport.h>
  33. #include <linux/slab.h>
  34. #include <linux/list.h>
  35. #include <linux/delay.h>
  36. #include <linux/sched.h>
  37. #include <linux/in.h>
  38. #include <linux/ip.h>
  39. #include <linux/ipv6.h>
  40. #include <linux/udp.h>
  41. #include <linux/mii.h>
  42. #include <linux/io.h>
  43. #include <linux/vmalloc.h>
  44. #include <linux/pagemap.h>
  45. #include <linux/tcp.h>
  46. #include <linux/ethtool.h>
  47. #include <linux/if_vlan.h>
  48. #include <linux/workqueue.h>
  49. #include <net/checksum.h>
  50. #include <net/ip6_checksum.h>
  51. #include "atl1e_hw.h"
  52. #define PCI_REG_COMMAND 0x04 /* PCI Command Register */
  53. #define CMD_IO_SPACE 0x0001
  54. #define CMD_MEMORY_SPACE 0x0002
  55. #define CMD_BUS_MASTER 0x0004
  56. #define BAR_0 0
  57. #define BAR_1 1
  58. #define BAR_5 5
  59. /* Wake Up Filter Control */
  60. #define AT_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */
  61. #define AT_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */
  62. #define AT_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */
  63. #define AT_WUFC_MC 0x00000008 /* Multicast Wakeup Enable */
  64. #define AT_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
  65. #define SPEED_0 0xffff
  66. #define HALF_DUPLEX 1
  67. #define FULL_DUPLEX 2
  68. /* Error Codes */
  69. #define AT_ERR_EEPROM 1
  70. #define AT_ERR_PHY 2
  71. #define AT_ERR_CONFIG 3
  72. #define AT_ERR_PARAM 4
  73. #define AT_ERR_MAC_TYPE 5
  74. #define AT_ERR_PHY_TYPE 6
  75. #define AT_ERR_PHY_SPEED 7
  76. #define AT_ERR_PHY_RES 8
  77. #define AT_ERR_TIMEOUT 9
  78. #define MAX_JUMBO_FRAME_SIZE 0x2000
  79. #define AT_VLAN_TAG_TO_TPD_TAG(_vlan, _tpd) \
  80. _tpd = (((_vlan) << (4)) | (((_vlan) >> 13) & 7) |\
  81. (((_vlan) >> 9) & 8))
  82. #define AT_TPD_TAG_TO_VLAN_TAG(_tpd, _vlan) \
  83. _vlan = (((_tpd) >> 8) | (((_tpd) & 0x77) << 9) |\
  84. (((_tdp) & 0x88) << 5))
  85. #define AT_MAX_RECEIVE_QUEUE 4
  86. #define AT_PAGE_NUM_PER_QUEUE 2
  87. #define AT_DMA_HI_ADDR_MASK 0xffffffff00000000ULL
  88. #define AT_DMA_LO_ADDR_MASK 0x00000000ffffffffULL
  89. #define AT_TX_WATCHDOG (5 * HZ)
  90. #define AT_MAX_INT_WORK 10
  91. #define AT_TWSI_EEPROM_TIMEOUT 100
  92. #define AT_HW_MAX_IDLE_DELAY 10
  93. #define AT_SUSPEND_LINK_TIMEOUT 28
  94. #define AT_REGS_LEN 75
  95. #define AT_EEPROM_LEN 512
  96. #define AT_ADV_MASK (ADVERTISE_10_HALF |\
  97. ADVERTISE_10_FULL |\
  98. ADVERTISE_100_HALF |\
  99. ADVERTISE_100_FULL |\
  100. ADVERTISE_1000_FULL)
  101. /* tpd word 2 */
  102. #define TPD_BUFLEN_MASK 0x3FFF
  103. #define TPD_BUFLEN_SHIFT 0
  104. #define TPD_DMAINT_MASK 0x0001
  105. #define TPD_DMAINT_SHIFT 14
  106. #define TPD_PKTNT_MASK 0x0001
  107. #define TPD_PKTINT_SHIFT 15
  108. #define TPD_VLANTAG_MASK 0xFFFF
  109. #define TPD_VLAN_SHIFT 16
  110. /* tpd word 3 bits 0:4 */
  111. #define TPD_EOP_MASK 0x0001
  112. #define TPD_EOP_SHIFT 0
  113. #define TPD_IP_VERSION_MASK 0x0001
  114. #define TPD_IP_VERSION_SHIFT 1 /* 0 : IPV4, 1 : IPV6 */
  115. #define TPD_INS_VL_TAG_MASK 0x0001
  116. #define TPD_INS_VL_TAG_SHIFT 2
  117. #define TPD_CC_SEGMENT_EN_MASK 0x0001
  118. #define TPD_CC_SEGMENT_EN_SHIFT 3
  119. #define TPD_SEGMENT_EN_MASK 0x0001
  120. #define TPD_SEGMENT_EN_SHIFT 4
  121. /* tdp word 3 bits 5:7 if ip version is 0 */
  122. #define TPD_IP_CSUM_MASK 0x0001
  123. #define TPD_IP_CSUM_SHIFT 5
  124. #define TPD_TCP_CSUM_MASK 0x0001
  125. #define TPD_TCP_CSUM_SHIFT 6
  126. #define TPD_UDP_CSUM_MASK 0x0001
  127. #define TPD_UDP_CSUM_SHIFT 7
  128. /* tdp word 3 bits 5:7 if ip version is 1 */
  129. #define TPD_V6_IPHLLO_MASK 0x0007
  130. #define TPD_V6_IPHLLO_SHIFT 7
  131. /* tpd word 3 bits 8:9 bit */
  132. #define TPD_VL_TAGGED_MASK 0x0001
  133. #define TPD_VL_TAGGED_SHIFT 8
  134. #define TPD_ETHTYPE_MASK 0x0001
  135. #define TPD_ETHTYPE_SHIFT 9
  136. /* tdp word 3 bits 10:13 if ip version is 0 */
  137. #define TDP_V4_IPHL_MASK 0x000F
  138. #define TPD_V4_IPHL_SHIFT 10
  139. /* tdp word 3 bits 10:13 if ip version is 1 */
  140. #define TPD_V6_IPHLHI_MASK 0x000F
  141. #define TPD_V6_IPHLHI_SHIFT 10
  142. /* tpd word 3 bit 14:31 if segment enabled */
  143. #define TPD_TCPHDRLEN_MASK 0x000F
  144. #define TPD_TCPHDRLEN_SHIFT 14
  145. #define TPD_HDRFLAG_MASK 0x0001
  146. #define TPD_HDRFLAG_SHIFT 18
  147. #define TPD_MSS_MASK 0x1FFF
  148. #define TPD_MSS_SHIFT 19
  149. /* tdp word 3 bit 16:31 if custom csum enabled */
  150. #define TPD_PLOADOFFSET_MASK 0x00FF
  151. #define TPD_PLOADOFFSET_SHIFT 16
  152. #define TPD_CCSUMOFFSET_MASK 0x00FF
  153. #define TPD_CCSUMOFFSET_SHIFT 24
  154. struct atl1e_tpd_desc {
  155. __le64 buffer_addr;
  156. __le32 word2;
  157. __le32 word3;
  158. };
  159. /* how about 0x2000 */
  160. #define MAX_TX_BUF_LEN 0x2000
  161. #define MAX_TX_BUF_SHIFT 13
  162. #define MAX_TSO_SEG_SIZE 0x3c00
  163. /* rrs word 1 bit 0:31 */
  164. #define RRS_RX_CSUM_MASK 0xFFFF
  165. #define RRS_RX_CSUM_SHIFT 0
  166. #define RRS_PKT_SIZE_MASK 0x3FFF
  167. #define RRS_PKT_SIZE_SHIFT 16
  168. #define RRS_CPU_NUM_MASK 0x0003
  169. #define RRS_CPU_NUM_SHIFT 30
  170. #define RRS_IS_RSS_IPV4 0x0001
  171. #define RRS_IS_RSS_IPV4_TCP 0x0002
  172. #define RRS_IS_RSS_IPV6 0x0004
  173. #define RRS_IS_RSS_IPV6_TCP 0x0008
  174. #define RRS_IS_IPV6 0x0010
  175. #define RRS_IS_IP_FRAG 0x0020
  176. #define RRS_IS_IP_DF 0x0040
  177. #define RRS_IS_802_3 0x0080
  178. #define RRS_IS_VLAN_TAG 0x0100
  179. #define RRS_IS_ERR_FRAME 0x0200
  180. #define RRS_IS_IPV4 0x0400
  181. #define RRS_IS_UDP 0x0800
  182. #define RRS_IS_TCP 0x1000
  183. #define RRS_IS_BCAST 0x2000
  184. #define RRS_IS_MCAST 0x4000
  185. #define RRS_IS_PAUSE 0x8000
  186. #define RRS_ERR_BAD_CRC 0x0001
  187. #define RRS_ERR_CODE 0x0002
  188. #define RRS_ERR_DRIBBLE 0x0004
  189. #define RRS_ERR_RUNT 0x0008
  190. #define RRS_ERR_RX_OVERFLOW 0x0010
  191. #define RRS_ERR_TRUNC 0x0020
  192. #define RRS_ERR_IP_CSUM 0x0040
  193. #define RRS_ERR_L4_CSUM 0x0080
  194. #define RRS_ERR_LENGTH 0x0100
  195. #define RRS_ERR_DES_ADDR 0x0200
  196. struct atl1e_recv_ret_status {
  197. u16 seq_num;
  198. u16 hash_lo;
  199. __le32 word1;
  200. u16 pkt_flag;
  201. u16 err_flag;
  202. u16 hash_hi;
  203. u16 vtag;
  204. };
  205. enum atl1e_dma_req_block {
  206. atl1e_dma_req_128 = 0,
  207. atl1e_dma_req_256 = 1,
  208. atl1e_dma_req_512 = 2,
  209. atl1e_dma_req_1024 = 3,
  210. atl1e_dma_req_2048 = 4,
  211. atl1e_dma_req_4096 = 5
  212. };
  213. enum atl1e_rrs_type {
  214. atl1e_rrs_disable = 0,
  215. atl1e_rrs_ipv4 = 1,
  216. atl1e_rrs_ipv4_tcp = 2,
  217. atl1e_rrs_ipv6 = 4,
  218. atl1e_rrs_ipv6_tcp = 8
  219. };
  220. enum atl1e_nic_type {
  221. athr_l1e = 0,
  222. athr_l2e_revA = 1,
  223. athr_l2e_revB = 2
  224. };
  225. struct atl1e_hw_stats {
  226. /* rx */
  227. unsigned long rx_ok; /* The number of good packet received. */
  228. unsigned long rx_bcast; /* The number of good broadcast packet received. */
  229. unsigned long rx_mcast; /* The number of good multicast packet received. */
  230. unsigned long rx_pause; /* The number of Pause packet received. */
  231. unsigned long rx_ctrl; /* The number of Control packet received other than Pause frame. */
  232. unsigned long rx_fcs_err; /* The number of packets with bad FCS. */
  233. unsigned long rx_len_err; /* The number of packets with mismatch of length field and actual size. */
  234. unsigned long rx_byte_cnt; /* The number of bytes of good packet received. FCS is NOT included. */
  235. unsigned long rx_runt; /* The number of packets received that are less than 64 byte long and with good FCS. */
  236. unsigned long rx_frag; /* The number of packets received that are less than 64 byte long and with bad FCS. */
  237. unsigned long rx_sz_64; /* The number of good and bad packets received that are 64 byte long. */
  238. unsigned long rx_sz_65_127; /* The number of good and bad packets received that are between 65 and 127-byte long. */
  239. unsigned long rx_sz_128_255; /* The number of good and bad packets received that are between 128 and 255-byte long. */
  240. unsigned long rx_sz_256_511; /* The number of good and bad packets received that are between 256 and 511-byte long. */
  241. unsigned long rx_sz_512_1023; /* The number of good and bad packets received that are between 512 and 1023-byte long. */
  242. unsigned long rx_sz_1024_1518; /* The number of good and bad packets received that are between 1024 and 1518-byte long. */
  243. unsigned long rx_sz_1519_max; /* The number of good and bad packets received that are between 1519-byte and MTU. */
  244. unsigned long rx_sz_ov; /* The number of good and bad packets received that are more than MTU size truncated by Selene. */
  245. unsigned long rx_rxf_ov; /* The number of frame dropped due to occurrence of RX FIFO overflow. */
  246. unsigned long rx_rrd_ov; /* The number of frame dropped due to occurrence of RRD overflow. */
  247. unsigned long rx_align_err; /* Alignment Error */
  248. unsigned long rx_bcast_byte_cnt; /* The byte count of broadcast packet received, excluding FCS. */
  249. unsigned long rx_mcast_byte_cnt; /* The byte count of multicast packet received, excluding FCS. */
  250. unsigned long rx_err_addr; /* The number of packets dropped due to address filtering. */
  251. /* tx */
  252. unsigned long tx_ok; /* The number of good packet transmitted. */
  253. unsigned long tx_bcast; /* The number of good broadcast packet transmitted. */
  254. unsigned long tx_mcast; /* The number of good multicast packet transmitted. */
  255. unsigned long tx_pause; /* The number of Pause packet transmitted. */
  256. unsigned long tx_exc_defer; /* The number of packets transmitted with excessive deferral. */
  257. unsigned long tx_ctrl; /* The number of packets transmitted is a control frame, excluding Pause frame. */
  258. unsigned long tx_defer; /* The number of packets transmitted that is deferred. */
  259. unsigned long tx_byte_cnt; /* The number of bytes of data transmitted. FCS is NOT included. */
  260. unsigned long tx_sz_64; /* The number of good and bad packets transmitted that are 64 byte long. */
  261. unsigned long tx_sz_65_127; /* The number of good and bad packets transmitted that are between 65 and 127-byte long. */
  262. unsigned long tx_sz_128_255; /* The number of good and bad packets transmitted that are between 128 and 255-byte long. */
  263. unsigned long tx_sz_256_511; /* The number of good and bad packets transmitted that are between 256 and 511-byte long. */
  264. unsigned long tx_sz_512_1023; /* The number of good and bad packets transmitted that are between 512 and 1023-byte long. */
  265. unsigned long tx_sz_1024_1518; /* The number of good and bad packets transmitted that are between 1024 and 1518-byte long. */
  266. unsigned long tx_sz_1519_max; /* The number of good and bad packets transmitted that are between 1519-byte and MTU. */
  267. unsigned long tx_1_col; /* The number of packets subsequently transmitted successfully with a single prior collision. */
  268. unsigned long tx_2_col; /* The number of packets subsequently transmitted successfully with multiple prior collisions. */
  269. unsigned long tx_late_col; /* The number of packets transmitted with late collisions. */
  270. unsigned long tx_abort_col; /* The number of transmit packets aborted due to excessive collisions. */
  271. unsigned long tx_underrun; /* The number of transmit packets aborted due to transmit FIFO underrun, or TRD FIFO underrun */
  272. unsigned long tx_rd_eop; /* The number of times that read beyond the EOP into the next frame area when TRD was not written timely */
  273. unsigned long tx_len_err; /* The number of transmit packets with length field does NOT match the actual frame size. */
  274. unsigned long tx_trunc; /* The number of transmit packets truncated due to size exceeding MTU. */
  275. unsigned long tx_bcast_byte; /* The byte count of broadcast packet transmitted, excluding FCS. */
  276. unsigned long tx_mcast_byte; /* The byte count of multicast packet transmitted, excluding FCS. */
  277. };
  278. struct atl1e_hw {
  279. u8 __iomem *hw_addr; /* inner register address */
  280. resource_size_t mem_rang;
  281. struct atl1e_adapter *adapter;
  282. enum atl1e_nic_type nic_type;
  283. u16 device_id;
  284. u16 vendor_id;
  285. u16 subsystem_id;
  286. u16 subsystem_vendor_id;
  287. u8 revision_id;
  288. u16 pci_cmd_word;
  289. u8 mac_addr[ETH_ALEN];
  290. u8 perm_mac_addr[ETH_ALEN];
  291. u8 preamble_len;
  292. u16 max_frame_size;
  293. u16 rx_jumbo_th;
  294. u16 tx_jumbo_th;
  295. u16 media_type;
  296. #define MEDIA_TYPE_AUTO_SENSOR 0
  297. #define MEDIA_TYPE_100M_FULL 1
  298. #define MEDIA_TYPE_100M_HALF 2
  299. #define MEDIA_TYPE_10M_FULL 3
  300. #define MEDIA_TYPE_10M_HALF 4
  301. u16 autoneg_advertised;
  302. #define ADVERTISE_10_HALF 0x0001
  303. #define ADVERTISE_10_FULL 0x0002
  304. #define ADVERTISE_100_HALF 0x0004
  305. #define ADVERTISE_100_FULL 0x0008
  306. #define ADVERTISE_1000_HALF 0x0010 /* Not used, just FYI */
  307. #define ADVERTISE_1000_FULL 0x0020
  308. u16 mii_autoneg_adv_reg;
  309. u16 mii_1000t_ctrl_reg;
  310. u16 imt; /* Interrupt Moderator timer ( 2us resolution) */
  311. u16 ict; /* Interrupt Clear timer (2us resolution) */
  312. u32 smb_timer;
  313. u16 rrd_thresh; /* Threshold of number of RRD produced to trigger
  314. interrupt request */
  315. u16 tpd_thresh;
  316. u16 rx_count_down; /* 2us resolution */
  317. u16 tx_count_down;
  318. u8 tpd_burst; /* Number of TPD to prefetch in cache-aligned burst. */
  319. enum atl1e_rrs_type rrs_type;
  320. u32 base_cpu;
  321. u32 indirect_tab;
  322. enum atl1e_dma_req_block dmar_block;
  323. enum atl1e_dma_req_block dmaw_block;
  324. u8 dmaw_dly_cnt;
  325. u8 dmar_dly_cnt;
  326. bool phy_configured;
  327. bool re_autoneg;
  328. bool emi_ca;
  329. };
  330. /*
  331. * wrapper around a pointer to a socket buffer,
  332. * so a DMA handle can be stored along with the buffer
  333. */
  334. struct atl1e_tx_buffer {
  335. struct sk_buff *skb;
  336. u16 flags;
  337. #define ATL1E_TX_PCIMAP_SINGLE 0x0001
  338. #define ATL1E_TX_PCIMAP_PAGE 0x0002
  339. #define ATL1E_TX_PCIMAP_TYPE_MASK 0x0003
  340. u16 length;
  341. dma_addr_t dma;
  342. };
  343. #define ATL1E_SET_PCIMAP_TYPE(tx_buff, type) do { \
  344. ((tx_buff)->flags) &= ~ATL1E_TX_PCIMAP_TYPE_MASK; \
  345. ((tx_buff)->flags) |= (type); \
  346. } while (0)
  347. struct atl1e_rx_page {
  348. dma_addr_t dma; /* receive rage DMA address */
  349. u8 *addr; /* receive rage virtual address */
  350. dma_addr_t write_offset_dma; /* the DMA address which contain the
  351. receive data offset in the page */
  352. u32 *write_offset_addr; /* the virtaul address which contain
  353. the receive data offset in the page */
  354. u32 read_offset; /* the offset where we have read */
  355. };
  356. struct atl1e_rx_page_desc {
  357. struct atl1e_rx_page rx_page[AT_PAGE_NUM_PER_QUEUE];
  358. u8 rx_using;
  359. u16 rx_nxseq;
  360. };
  361. /* transmit packet descriptor (tpd) ring */
  362. struct atl1e_tx_ring {
  363. struct atl1e_tpd_desc *desc; /* descriptor ring virtual address */
  364. dma_addr_t dma; /* descriptor ring physical address */
  365. u16 count; /* the count of transmit rings */
  366. rwlock_t tx_lock;
  367. u16 next_to_use;
  368. atomic_t next_to_clean;
  369. struct atl1e_tx_buffer *tx_buffer;
  370. dma_addr_t cmb_dma;
  371. u32 *cmb;
  372. };
  373. /* receive packet descriptor ring */
  374. struct atl1e_rx_ring {
  375. void *desc;
  376. dma_addr_t dma;
  377. int size;
  378. u32 page_size; /* bytes length of rxf page */
  379. u32 real_page_size; /* real_page_size = page_size + jumbo + aliagn */
  380. struct atl1e_rx_page_desc rx_page_desc[AT_MAX_RECEIVE_QUEUE];
  381. };
  382. /* board specific private data structure */
  383. struct atl1e_adapter {
  384. struct net_device *netdev;
  385. struct pci_dev *pdev;
  386. struct napi_struct napi;
  387. struct mii_if_info mii; /* MII interface info */
  388. struct atl1e_hw hw;
  389. struct atl1e_hw_stats hw_stats;
  390. u32 wol;
  391. u16 link_speed;
  392. u16 link_duplex;
  393. spinlock_t mdio_lock;
  394. spinlock_t tx_lock;
  395. atomic_t irq_sem;
  396. struct work_struct reset_task;
  397. struct work_struct link_chg_task;
  398. struct timer_list watchdog_timer;
  399. struct timer_list phy_config_timer;
  400. /* All Descriptor memory */
  401. dma_addr_t ring_dma;
  402. void *ring_vir_addr;
  403. u32 ring_size;
  404. struct atl1e_tx_ring tx_ring;
  405. struct atl1e_rx_ring rx_ring;
  406. int num_rx_queues;
  407. unsigned long flags;
  408. #define __AT_TESTING 0x0001
  409. #define __AT_RESETTING 0x0002
  410. #define __AT_DOWN 0x0003
  411. u32 bd_number; /* board number;*/
  412. u32 pci_state[16];
  413. u32 *config_space;
  414. };
  415. #define AT_WRITE_REG(a, reg, value) ( \
  416. writel((value), ((a)->hw_addr + reg)))
  417. #define AT_WRITE_FLUSH(a) (\
  418. readl((a)->hw_addr))
  419. #define AT_READ_REG(a, reg) ( \
  420. readl((a)->hw_addr + reg))
  421. #define AT_WRITE_REGB(a, reg, value) (\
  422. writeb((value), ((a)->hw_addr + reg)))
  423. #define AT_READ_REGB(a, reg) (\
  424. readb((a)->hw_addr + reg))
  425. #define AT_WRITE_REGW(a, reg, value) (\
  426. writew((value), ((a)->hw_addr + reg)))
  427. #define AT_READ_REGW(a, reg) (\
  428. readw((a)->hw_addr + reg))
  429. #define AT_WRITE_REG_ARRAY(a, reg, offset, value) ( \
  430. writel((value), (((a)->hw_addr + reg) + ((offset) << 2))))
  431. #define AT_READ_REG_ARRAY(a, reg, offset) ( \
  432. readl(((a)->hw_addr + reg) + ((offset) << 2)))
  433. extern char atl1e_driver_name[];
  434. extern char atl1e_driver_version[];
  435. void atl1e_check_options(struct atl1e_adapter *adapter);
  436. int atl1e_up(struct atl1e_adapter *adapter);
  437. void atl1e_down(struct atl1e_adapter *adapter);
  438. void atl1e_reinit_locked(struct atl1e_adapter *adapter);
  439. s32 atl1e_reset_hw(struct atl1e_hw *hw);
  440. void atl1e_set_ethtool_ops(struct net_device *netdev);
  441. #endif /* _ATL1_E_H_ */