atl2.h 16 KB

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