atl2.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. /* atl2.h -- atl2 driver definitions
  2. *
  3. * Copyright(c) 2007 Atheros Corporation. All rights reserved.
  4. * Copyright(c) 2006 xiong huang <xiong.huang@atheros.com>
  5. * Copyright(c) 2007 Chris Snook <csnook@redhat.com>
  6. *
  7. * Derived from Intel e1000 driver
  8. * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the Free
  12. * Software Foundation; either version 2 of the License, or (at your option)
  13. * any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  18. * more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along with
  21. * this program; if not, write to the Free Software Foundation, Inc., 59
  22. * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. */
  24. #ifndef _ATL2_H_
  25. #define _ATL2_H_
  26. #include <asm/atomic.h>
  27. #include <linux/netdevice.h>
  28. #ifndef _ATL2_HW_H_
  29. #define _ATL2_HW_H_
  30. #ifndef _ATL2_OSDEP_H_
  31. #define _ATL2_OSDEP_H_
  32. #include <linux/pci.h>
  33. #include <linux/delay.h>
  34. #include <linux/interrupt.h>
  35. #include <linux/if_ether.h>
  36. #include "atlx.h"
  37. #ifdef ETHTOOL_OPS_COMPAT
  38. extern int ethtool_ioctl(struct ifreq *ifr);
  39. #endif
  40. #define PCI_COMMAND_REGISTER PCI_COMMAND
  41. #define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE
  42. #define ETH_ADDR_LEN ETH_ALEN
  43. #define ATL2_WRITE_REG(a, reg, value) (iowrite32((value), \
  44. ((a)->hw_addr + (reg))))
  45. #define ATL2_WRITE_FLUSH(a) (ioread32((a)->hw_addr))
  46. #define ATL2_READ_REG(a, reg) (ioread32((a)->hw_addr + (reg)))
  47. #define ATL2_WRITE_REGB(a, reg, value) (iowrite8((value), \
  48. ((a)->hw_addr + (reg))))
  49. #define ATL2_READ_REGB(a, reg) (ioread8((a)->hw_addr + (reg)))
  50. #define ATL2_WRITE_REGW(a, reg, value) (iowrite16((value), \
  51. ((a)->hw_addr + (reg))))
  52. #define ATL2_READ_REGW(a, reg) (ioread16((a)->hw_addr + (reg)))
  53. #define ATL2_WRITE_REG_ARRAY(a, reg, offset, value) \
  54. (iowrite32((value), (((a)->hw_addr + (reg)) + ((offset) << 2))))
  55. #define ATL2_READ_REG_ARRAY(a, reg, offset) \
  56. (ioread32(((a)->hw_addr + (reg)) + ((offset) << 2)))
  57. #endif /* _ATL2_OSDEP_H_ */
  58. struct atl2_adapter;
  59. struct atl2_hw;
  60. /* function prototype */
  61. static s32 atl2_reset_hw(struct atl2_hw *hw);
  62. static s32 atl2_read_mac_addr(struct atl2_hw *hw);
  63. static s32 atl2_init_hw(struct atl2_hw *hw);
  64. static s32 atl2_get_speed_and_duplex(struct atl2_hw *hw, u16 *speed,
  65. u16 *duplex);
  66. static u32 atl2_hash_mc_addr(struct atl2_hw *hw, u8 *mc_addr);
  67. static void atl2_hash_set(struct atl2_hw *hw, u32 hash_value);
  68. static s32 atl2_read_phy_reg(struct atl2_hw *hw, u16 reg_addr, u16 *phy_data);
  69. static s32 atl2_write_phy_reg(struct atl2_hw *hw, u32 reg_addr, u16 phy_data);
  70. static void atl2_read_pci_cfg(struct atl2_hw *hw, u32 reg, u16 *value);
  71. static void atl2_write_pci_cfg(struct atl2_hw *hw, u32 reg, u16 *value);
  72. static void atl2_set_mac_addr(struct atl2_hw *hw);
  73. static bool atl2_read_eeprom(struct atl2_hw *hw, u32 Offset, u32 *pValue);
  74. static bool atl2_write_eeprom(struct atl2_hw *hw, u32 offset, u32 value);
  75. static s32 atl2_phy_init(struct atl2_hw *hw);
  76. static int atl2_check_eeprom_exist(struct atl2_hw *hw);
  77. static void atl2_force_ps(struct atl2_hw *hw);
  78. /* register definition */
  79. /* Block IDLE Status Register */
  80. #define IDLE_STATUS_RXMAC 1 /* 1: RXMAC is non-IDLE */
  81. #define IDLE_STATUS_TXMAC 2 /* 1: TXMAC is non-IDLE */
  82. #define IDLE_STATUS_DMAR 8 /* 1: DMAR is non-IDLE */
  83. #define IDLE_STATUS_DMAW 4 /* 1: DMAW is non-IDLE */
  84. /* MDIO Control Register */
  85. #define MDIO_WAIT_TIMES 10
  86. /* MAC Control Register */
  87. #define MAC_CTRL_DBG_TX_BKPRESURE 0x100000 /* 1: TX max backoff */
  88. #define MAC_CTRL_MACLP_CLK_PHY 0x8000000 /* 1: 25MHz from phy */
  89. #define MAC_CTRL_HALF_LEFT_BUF_SHIFT 28
  90. #define MAC_CTRL_HALF_LEFT_BUF_MASK 0xF /* MAC retry buf x32B */
  91. /* Internal SRAM Partition Register */
  92. #define REG_SRAM_TXRAM_END 0x1500 /* Internal tail address of TXRAM
  93. * default: 2byte*1024 */
  94. #define REG_SRAM_RXRAM_END 0x1502 /* Internal tail address of RXRAM
  95. * default: 2byte*1024 */
  96. /* Descriptor Control register */
  97. #define REG_TXD_BASE_ADDR_LO 0x1544 /* The base address of the Transmit
  98. * Data Mem low 32-bit(dword align) */
  99. #define REG_TXD_MEM_SIZE 0x1548 /* Transmit Data Memory size(by
  100. * double word , max 256KB) */
  101. #define REG_TXS_BASE_ADDR_LO 0x154C /* The base address of the Transmit
  102. * Status Memory low 32-bit(dword word
  103. * align) */
  104. #define REG_TXS_MEM_SIZE 0x1550 /* double word unit, max 4*2047
  105. * bytes. */
  106. #define REG_RXD_BASE_ADDR_LO 0x1554 /* The base address of the Transmit
  107. * Status Memory low 32-bit(unit 8
  108. * bytes) */
  109. #define REG_RXD_BUF_NUM 0x1558 /* Receive Data & Status Memory buffer
  110. * number (unit 1536bytes, max
  111. * 1536*2047) */
  112. /* DMAR Control Register */
  113. #define REG_DMAR 0x1580
  114. #define DMAR_EN 0x1 /* 1: Enable DMAR */
  115. /* TX Cur-Through (early tx threshold) Control Register */
  116. #define REG_TX_CUT_THRESH 0x1590 /* TxMac begin transmit packet
  117. * threshold(unit word) */
  118. /* DMAW Control Register */
  119. #define REG_DMAW 0x15A0
  120. #define DMAW_EN 0x1
  121. /* Flow control register */
  122. #define REG_PAUSE_ON_TH 0x15A8 /* RXD high watermark of overflow
  123. * threshold configuration register */
  124. #define REG_PAUSE_OFF_TH 0x15AA /* RXD lower watermark of overflow
  125. * threshold configuration register */
  126. /* Mailbox Register */
  127. #define REG_MB_TXD_WR_IDX 0x15f0 /* double word align */
  128. #define REG_MB_RXD_RD_IDX 0x15F4 /* RXD Read index (unit: 1536byets) */
  129. /* Interrupt Status Register */
  130. #define ISR_TIMER 1 /* Interrupt when Timer counts down to zero */
  131. #define ISR_MANUAL 2 /* Software manual interrupt, for debug. Set
  132. * when SW_MAN_INT_EN is set in Table 51
  133. * Selene Master Control Register
  134. * (Offset 0x1400). */
  135. #define ISR_RXF_OV 4 /* RXF overflow interrupt */
  136. #define ISR_TXF_UR 8 /* TXF underrun interrupt */
  137. #define ISR_TXS_OV 0x10 /* Internal transmit status buffer full
  138. * interrupt */
  139. #define ISR_RXS_OV 0x20 /* Internal receive status buffer full
  140. * interrupt */
  141. #define ISR_LINK_CHG 0x40 /* Link Status Change Interrupt */
  142. #define ISR_HOST_TXD_UR 0x80
  143. #define ISR_HOST_RXD_OV 0x100 /* Host rx data memory full , one pulse */
  144. #define ISR_DMAR_TO_RST 0x200 /* DMAR op timeout interrupt. SW should
  145. * do Reset */
  146. #define ISR_DMAW_TO_RST 0x400
  147. #define ISR_PHY 0x800 /* phy interrupt */
  148. #define ISR_TS_UPDATE 0x10000 /* interrupt after new tx pkt status written
  149. * to host */
  150. #define ISR_RS_UPDATE 0x20000 /* interrupt ater new rx pkt status written
  151. * to host. */
  152. #define ISR_TX_EARLY 0x40000 /* interrupt when txmac begin transmit one
  153. * packet */
  154. #define ISR_TX_EVENT (ISR_TXF_UR | ISR_TXS_OV | ISR_HOST_TXD_UR |\
  155. ISR_TS_UPDATE | ISR_TX_EARLY)
  156. #define ISR_RX_EVENT (ISR_RXF_OV | ISR_RXS_OV | ISR_HOST_RXD_OV |\
  157. ISR_RS_UPDATE)
  158. #define IMR_NORMAL_MASK (\
  159. /*ISR_LINK_CHG |*/\
  160. ISR_MANUAL |\
  161. ISR_DMAR_TO_RST |\
  162. ISR_DMAW_TO_RST |\
  163. ISR_PHY |\
  164. ISR_PHY_LINKDOWN |\
  165. ISR_TS_UPDATE |\
  166. ISR_RS_UPDATE)
  167. /* Receive MAC Statistics Registers */
  168. #define REG_STS_RX_PAUSE 0x1700 /* Num pause packets received */
  169. #define REG_STS_RXD_OV 0x1704 /* Num frames dropped due to RX
  170. * FIFO overflow */
  171. #define REG_STS_RXS_OV 0x1708 /* Num frames dropped due to RX
  172. * Status Buffer Overflow */
  173. #define REG_STS_RX_FILTER 0x170C /* Num packets dropped due to
  174. * address filtering */
  175. /* MII definitions */
  176. /* PHY Common Register */
  177. #define MII_SMARTSPEED 0x14
  178. #define MII_DBG_ADDR 0x1D
  179. #define MII_DBG_DATA 0x1E
  180. /* PCI Command Register Bit Definitions */
  181. #define PCI_REG_COMMAND 0x04
  182. #define CMD_IO_SPACE 0x0001
  183. #define CMD_MEMORY_SPACE 0x0002
  184. #define CMD_BUS_MASTER 0x0004
  185. #define MEDIA_TYPE_100M_FULL 1
  186. #define MEDIA_TYPE_100M_HALF 2
  187. #define MEDIA_TYPE_10M_FULL 3
  188. #define MEDIA_TYPE_10M_HALF 4
  189. #define AUTONEG_ADVERTISE_SPEED_DEFAULT 0x000F /* Everything */
  190. /* The size (in bytes) of a ethernet packet */
  191. #define ENET_HEADER_SIZE 14
  192. #define MAXIMUM_ETHERNET_FRAME_SIZE 1518 /* with FCS */
  193. #define MINIMUM_ETHERNET_FRAME_SIZE 64 /* with FCS */
  194. #define ETHERNET_FCS_SIZE 4
  195. #define MAX_JUMBO_FRAME_SIZE 0x2000
  196. #define VLAN_SIZE 4
  197. struct tx_pkt_header {
  198. unsigned pkt_size:11;
  199. unsigned:4; /* reserved */
  200. unsigned ins_vlan:1; /* txmac should insert vlan */
  201. unsigned short vlan; /* vlan tag */
  202. };
  203. /* FIXME: replace above bitfields with MASK/SHIFT defines below */
  204. #define TX_PKT_HEADER_SIZE_MASK 0x7FF
  205. #define TX_PKT_HEADER_SIZE_SHIFT 0
  206. #define TX_PKT_HEADER_INS_VLAN_MASK 0x1
  207. #define TX_PKT_HEADER_INS_VLAN_SHIFT 15
  208. #define TX_PKT_HEADER_VLAN_TAG_MASK 0xFFFF
  209. #define TX_PKT_HEADER_VLAN_TAG_SHIFT 16
  210. struct tx_pkt_status {
  211. unsigned pkt_size:11;
  212. unsigned:5; /* reserved */
  213. unsigned ok:1; /* current packet transmitted without error */
  214. unsigned bcast:1; /* broadcast packet */
  215. unsigned mcast:1; /* multicast packet */
  216. unsigned pause:1; /* transmiited a pause frame */
  217. unsigned ctrl:1;
  218. unsigned defer:1; /* current packet is xmitted with defer */
  219. unsigned exc_defer:1;
  220. unsigned single_col:1;
  221. unsigned multi_col:1;
  222. unsigned late_col:1;
  223. unsigned abort_col:1;
  224. unsigned underun:1; /* current packet is aborted
  225. * due to txram underrun */
  226. unsigned:3; /* reserved */
  227. unsigned update:1; /* always 1'b1 in tx_status_buf */
  228. };
  229. /* FIXME: replace above bitfields with MASK/SHIFT defines below */
  230. #define TX_PKT_STATUS_SIZE_MASK 0x7FF
  231. #define TX_PKT_STATUS_SIZE_SHIFT 0
  232. #define TX_PKT_STATUS_OK_MASK 0x1
  233. #define TX_PKT_STATUS_OK_SHIFT 16
  234. #define TX_PKT_STATUS_BCAST_MASK 0x1
  235. #define TX_PKT_STATUS_BCAST_SHIFT 17
  236. #define TX_PKT_STATUS_MCAST_MASK 0x1
  237. #define TX_PKT_STATUS_MCAST_SHIFT 18
  238. #define TX_PKT_STATUS_PAUSE_MASK 0x1
  239. #define TX_PKT_STATUS_PAUSE_SHIFT 19
  240. #define TX_PKT_STATUS_CTRL_MASK 0x1
  241. #define TX_PKT_STATUS_CTRL_SHIFT 20
  242. #define TX_PKT_STATUS_DEFER_MASK 0x1
  243. #define TX_PKT_STATUS_DEFER_SHIFT 21
  244. #define TX_PKT_STATUS_EXC_DEFER_MASK 0x1
  245. #define TX_PKT_STATUS_EXC_DEFER_SHIFT 22
  246. #define TX_PKT_STATUS_SINGLE_COL_MASK 0x1
  247. #define TX_PKT_STATUS_SINGLE_COL_SHIFT 23
  248. #define TX_PKT_STATUS_MULTI_COL_MASK 0x1
  249. #define TX_PKT_STATUS_MULTI_COL_SHIFT 24
  250. #define TX_PKT_STATUS_LATE_COL_MASK 0x1
  251. #define TX_PKT_STATUS_LATE_COL_SHIFT 25
  252. #define TX_PKT_STATUS_ABORT_COL_MASK 0x1
  253. #define TX_PKT_STATUS_ABORT_COL_SHIFT 26
  254. #define TX_PKT_STATUS_UNDERRUN_MASK 0x1
  255. #define TX_PKT_STATUS_UNDERRUN_SHIFT 27
  256. #define TX_PKT_STATUS_UPDATE_MASK 0x1
  257. #define TX_PKT_STATUS_UPDATE_SHIFT 31
  258. struct rx_pkt_status {
  259. unsigned pkt_size:11; /* packet size, max 2047 bytes */
  260. unsigned:5; /* reserved */
  261. unsigned ok:1; /* current packet received ok without error */
  262. unsigned bcast:1; /* current packet is broadcast */
  263. unsigned mcast:1; /* current packet is multicast */
  264. unsigned pause:1;
  265. unsigned ctrl:1;
  266. unsigned crc:1; /* received a packet with crc error */
  267. unsigned code:1; /* received a packet with code error */
  268. unsigned runt:1; /* received a packet less than 64 bytes
  269. * with good crc */
  270. unsigned frag:1; /* received a packet less than 64 bytes
  271. * with bad crc */
  272. unsigned trunc:1; /* current frame truncated due to rxram full */
  273. unsigned align:1; /* this packet is alignment error */
  274. unsigned vlan:1; /* this packet has vlan */
  275. unsigned:3; /* reserved */
  276. unsigned update:1;
  277. unsigned short vtag; /* vlan tag */
  278. unsigned:16;
  279. };
  280. /* FIXME: replace above bitfields with MASK/SHIFT defines below */
  281. #define RX_PKT_STATUS_SIZE_MASK 0x7FF
  282. #define RX_PKT_STATUS_SIZE_SHIFT 0
  283. #define RX_PKT_STATUS_OK_MASK 0x1
  284. #define RX_PKT_STATUS_OK_SHIFT 16
  285. #define RX_PKT_STATUS_BCAST_MASK 0x1
  286. #define RX_PKT_STATUS_BCAST_SHIFT 17
  287. #define RX_PKT_STATUS_MCAST_MASK 0x1
  288. #define RX_PKT_STATUS_MCAST_SHIFT 18
  289. #define RX_PKT_STATUS_PAUSE_MASK 0x1
  290. #define RX_PKT_STATUS_PAUSE_SHIFT 19
  291. #define RX_PKT_STATUS_CTRL_MASK 0x1
  292. #define RX_PKT_STATUS_CTRL_SHIFT 20
  293. #define RX_PKT_STATUS_CRC_MASK 0x1
  294. #define RX_PKT_STATUS_CRC_SHIFT 21
  295. #define RX_PKT_STATUS_CODE_MASK 0x1
  296. #define RX_PKT_STATUS_CODE_SHIFT 22
  297. #define RX_PKT_STATUS_RUNT_MASK 0x1
  298. #define RX_PKT_STATUS_RUNT_SHIFT 23
  299. #define RX_PKT_STATUS_FRAG_MASK 0x1
  300. #define RX_PKT_STATUS_FRAG_SHIFT 24
  301. #define RX_PKT_STATUS_TRUNK_MASK 0x1
  302. #define RX_PKT_STATUS_TRUNK_SHIFT 25
  303. #define RX_PKT_STATUS_ALIGN_MASK 0x1
  304. #define RX_PKT_STATUS_ALIGN_SHIFT 26
  305. #define RX_PKT_STATUS_VLAN_MASK 0x1
  306. #define RX_PKT_STATUS_VLAN_SHIFT 27
  307. #define RX_PKT_STATUS_UPDATE_MASK 0x1
  308. #define RX_PKT_STATUS_UPDATE_SHIFT 31
  309. #define RX_PKT_STATUS_VLAN_TAG_MASK 0xFFFF
  310. #define RX_PKT_STATUS_VLAN_TAG_SHIFT 32
  311. struct rx_desc {
  312. struct rx_pkt_status status;
  313. unsigned char packet[1536-sizeof(struct rx_pkt_status)];
  314. };
  315. enum atl2_speed_duplex {
  316. atl2_10_half = 0,
  317. atl2_10_full = 1,
  318. atl2_100_half = 2,
  319. atl2_100_full = 3
  320. };
  321. struct atl2_spi_flash_dev {
  322. const char *manu_name; /* manufacturer id */
  323. /* op-code */
  324. u8 cmdWRSR;
  325. u8 cmdREAD;
  326. u8 cmdPROGRAM;
  327. u8 cmdWREN;
  328. u8 cmdWRDI;
  329. u8 cmdRDSR;
  330. u8 cmdRDID;
  331. u8 cmdSECTOR_ERASE;
  332. u8 cmdCHIP_ERASE;
  333. };
  334. /* Structure containing variables used by the shared code (atl2_hw.c) */
  335. struct atl2_hw {
  336. u8 __iomem *hw_addr;
  337. void *back;
  338. u8 preamble_len;
  339. u8 max_retry; /* Retransmission maximum, afterwards the
  340. * packet will be discarded. */
  341. u8 jam_ipg; /* IPG to start JAM for collision based flow
  342. * control in half-duplex mode. In unit of
  343. * 8-bit time. */
  344. u8 ipgt; /* Desired back to back inter-packet gap. The
  345. * default is 96-bit time. */
  346. u8 min_ifg; /* Minimum number of IFG to enforce in between
  347. * RX frames. Frame gap below such IFP is
  348. * dropped. */
  349. u8 ipgr1; /* 64bit Carrier-Sense window */
  350. u8 ipgr2; /* 96-bit IPG window */
  351. u8 retry_buf; /* When half-duplex mode, should hold some
  352. * bytes for mac retry . (8*4bytes unit) */
  353. u16 fc_rxd_hi;
  354. u16 fc_rxd_lo;
  355. u16 lcol; /* Collision Window */
  356. u16 max_frame_size;
  357. u16 MediaType;
  358. u16 autoneg_advertised;
  359. u16 pci_cmd_word;
  360. u16 mii_autoneg_adv_reg;
  361. u32 mem_rang;
  362. u32 txcw;
  363. u32 mc_filter_type;
  364. u32 num_mc_addrs;
  365. u32 collision_delta;
  366. u32 tx_packet_delta;
  367. u16 phy_spd_default;
  368. u16 device_id;
  369. u16 vendor_id;
  370. u16 subsystem_id;
  371. u16 subsystem_vendor_id;
  372. u8 revision_id;
  373. /* spi flash */
  374. u8 flash_vendor;
  375. u8 dma_fairness;
  376. u8 mac_addr[NODE_ADDRESS_SIZE];
  377. u8 perm_mac_addr[NODE_ADDRESS_SIZE];
  378. /* FIXME */
  379. /* bool phy_preamble_sup; */
  380. bool phy_configured;
  381. };
  382. #endif /* _ATL2_HW_H_ */
  383. struct atl2_ring_header {
  384. /* pointer to the descriptor ring memory */
  385. void *desc;
  386. /* physical adress of the descriptor ring */
  387. dma_addr_t dma;
  388. /* length of descriptor ring in bytes */
  389. unsigned int size;
  390. };
  391. /* board specific private data structure */
  392. struct atl2_adapter {
  393. /* OS defined structs */
  394. struct net_device *netdev;
  395. struct pci_dev *pdev;
  396. #ifdef NETIF_F_HW_VLAN_TX
  397. struct vlan_group *vlgrp;
  398. #endif
  399. u32 wol;
  400. u16 link_speed;
  401. u16 link_duplex;
  402. spinlock_t stats_lock;
  403. struct work_struct reset_task;
  404. struct work_struct link_chg_task;
  405. struct timer_list watchdog_timer;
  406. struct timer_list phy_config_timer;
  407. unsigned long cfg_phy;
  408. bool mac_disabled;
  409. /* All Descriptor memory */
  410. dma_addr_t ring_dma;
  411. void *ring_vir_addr;
  412. int ring_size;
  413. struct tx_pkt_header *txd_ring;
  414. dma_addr_t txd_dma;
  415. struct tx_pkt_status *txs_ring;
  416. dma_addr_t txs_dma;
  417. struct rx_desc *rxd_ring;
  418. dma_addr_t rxd_dma;
  419. u32 txd_ring_size; /* bytes per unit */
  420. u32 txs_ring_size; /* dwords per unit */
  421. u32 rxd_ring_size; /* 1536 bytes per unit */
  422. /* read /write ptr: */
  423. /* host */
  424. u32 txd_write_ptr;
  425. u32 txs_next_clear;
  426. u32 rxd_read_ptr;
  427. /* nic */
  428. atomic_t txd_read_ptr;
  429. atomic_t txs_write_ptr;
  430. u32 rxd_write_ptr;
  431. /* Interrupt Moderator timer ( 2us resolution) */
  432. u16 imt;
  433. /* Interrupt Clear timer (2us resolution) */
  434. u16 ict;
  435. unsigned long flags;
  436. /* structs defined in atl2_hw.h */
  437. u32 bd_number; /* board number */
  438. bool pci_using_64;
  439. bool have_msi;
  440. struct atl2_hw hw;
  441. u32 usr_cmd;
  442. /* FIXME */
  443. /* u32 regs_buff[ATL2_REGS_LEN]; */
  444. u32 pci_state[16];
  445. u32 *config_space;
  446. };
  447. enum atl2_state_t {
  448. __ATL2_TESTING,
  449. __ATL2_RESETTING,
  450. __ATL2_DOWN
  451. };
  452. #endif /* _ATL2_H_ */