rrunner.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _RRUNNER_H_
  3. #define _RRUNNER_H_
  4. #include <linux/interrupt.h>
  5. #if ((BITS_PER_LONG != 32) && (BITS_PER_LONG != 64))
  6. #error "BITS_PER_LONG not defined or not valid"
  7. #endif
  8. struct rr_regs {
  9. u32 pad0[16];
  10. u32 HostCtrl;
  11. u32 LocalCtrl;
  12. u32 Pc;
  13. u32 BrkPt;
  14. /* Timer increments every 0.97 micro-seconds (unsigned int) */
  15. u32 Timer_Hi;
  16. u32 Timer;
  17. u32 TimerRef;
  18. u32 PciState;
  19. u32 Event;
  20. u32 MbEvent;
  21. u32 WinBase;
  22. u32 WinData;
  23. u32 RX_state;
  24. u32 TX_state;
  25. u32 Overhead;
  26. u32 ExtIo;
  27. u32 DmaWriteHostHi;
  28. u32 DmaWriteHostLo;
  29. u32 pad1[2];
  30. u32 DmaReadHostHi;
  31. u32 DmaReadHostLo;
  32. u32 pad2;
  33. u32 DmaReadLen;
  34. u32 DmaWriteState;
  35. u32 DmaWriteLcl;
  36. u32 DmaWriteIPchecksum;
  37. u32 DmaWriteLen;
  38. u32 DmaReadState;
  39. u32 DmaReadLcl;
  40. u32 DmaReadIPchecksum;
  41. u32 pad3;
  42. u32 RxBase;
  43. u32 RxPrd;
  44. u32 RxCon;
  45. u32 pad4;
  46. u32 TxBase;
  47. u32 TxPrd;
  48. u32 TxCon;
  49. u32 pad5;
  50. u32 RxIndPro;
  51. u32 RxIndCon;
  52. u32 RxIndRef;
  53. u32 pad6;
  54. u32 TxIndPro;
  55. u32 TxIndCon;
  56. u32 TxIndRef;
  57. u32 pad7[17];
  58. u32 DrCmndPro;
  59. u32 DrCmndCon;
  60. u32 DrCmndRef;
  61. u32 pad8;
  62. u32 DwCmndPro;
  63. u32 DwCmndCon;
  64. u32 DwCmndRef;
  65. u32 AssistState;
  66. u32 DrDataPro;
  67. u32 DrDataCon;
  68. u32 DrDataRef;
  69. u32 pad9;
  70. u32 DwDataPro;
  71. u32 DwDataCon;
  72. u32 DwDataRef;
  73. u32 pad10[33];
  74. u32 EvtCon;
  75. u32 pad11[5];
  76. u32 TxPi;
  77. u32 IpRxPi;
  78. u32 pad11a[8];
  79. u32 CmdRing[16];
  80. /* The ULA is in two registers the high order two bytes of the first
  81. * word contain the RunCode features.
  82. * ula0 res res byte0 byte1
  83. * ula1 byte2 byte3 byte4 byte5
  84. */
  85. u32 Ula0;
  86. u32 Ula1;
  87. u32 RxRingHi;
  88. u32 RxRingLo;
  89. u32 InfoPtrHi;
  90. u32 InfoPtrLo;
  91. u32 Mode;
  92. u32 ConRetry;
  93. u32 ConRetryTmr;
  94. u32 ConTmout;
  95. u32 CtatTmr;
  96. u32 MaxRxRng;
  97. u32 IntrTmr;
  98. u32 TxDataMvTimeout;
  99. u32 RxDataMvTimeout;
  100. u32 EvtPrd;
  101. u32 TraceIdx;
  102. u32 Fail1;
  103. u32 Fail2;
  104. u32 DrvPrm;
  105. u32 FilterLA;
  106. u32 FwRev;
  107. u32 FwRes1;
  108. u32 FwRes2;
  109. u32 FwRes3;
  110. u32 WriteDmaThresh;
  111. u32 ReadDmaThresh;
  112. u32 pad12[325];
  113. u32 Window[512];
  114. };
  115. /*
  116. * Host control register bits.
  117. */
  118. #define RR_INT 0x01
  119. #define RR_CLEAR_INT 0x02
  120. #define NO_SWAP 0x04000004
  121. #define NO_SWAP1 0x00000004
  122. #define PCI_RESET_NIC 0x08
  123. #define HALT_NIC 0x10
  124. #define SSTEP_NIC 0x20
  125. #define MEM_READ_MULTI 0x40
  126. #define NIC_HALTED 0x100
  127. #define HALT_INST 0x200
  128. #define PARITY_ERR 0x400
  129. #define INVALID_INST_B 0x800
  130. #define RR_REV_2 0x20000000
  131. #define RR_REV_MASK 0xf0000000
  132. /*
  133. * Local control register bits.
  134. */
  135. #define INTA_STATE 0x01
  136. #define CLEAR_INTA 0x02
  137. #define FAST_EEPROM_ACCESS 0x08
  138. #define ENABLE_EXTRA_SRAM 0x100
  139. #define ENABLE_EXTRA_DESC 0x200
  140. #define ENABLE_PARITY 0x400
  141. #define FORCE_DMA_PARITY_ERROR 0x800
  142. #define ENABLE_EEPROM_WRITE 0x1000
  143. #define ENABLE_DATA_CACHE 0x2000
  144. #define SRAM_LO_PARITY_ERR 0x4000
  145. #define SRAM_HI_PARITY_ERR 0x8000
  146. /*
  147. * PCI state bits.
  148. */
  149. #define FORCE_PCI_RESET 0x01
  150. #define PROVIDE_LENGTH 0x02
  151. #define MASK_DMA_READ_MAX 0x1C
  152. #define RBURST_DISABLE 0x00
  153. #define RBURST_4 0x04
  154. #define RBURST_16 0x08
  155. #define RBURST_32 0x0C
  156. #define RBURST_64 0x10
  157. #define RBURST_128 0x14
  158. #define RBURST_256 0x18
  159. #define RBURST_1024 0x1C
  160. #define MASK_DMA_WRITE_MAX 0xE0
  161. #define WBURST_DISABLE 0x00
  162. #define WBURST_4 0x20
  163. #define WBURST_16 0x40
  164. #define WBURST_32 0x60
  165. #define WBURST_64 0x80
  166. #define WBURST_128 0xa0
  167. #define WBURST_256 0xc0
  168. #define WBURST_1024 0xe0
  169. #define MASK_MIN_DMA 0xFF00
  170. #define FIFO_RETRY_ENABLE 0x10000
  171. /*
  172. * Event register
  173. */
  174. #define DMA_WRITE_DONE 0x10000
  175. #define DMA_READ_DONE 0x20000
  176. #define DMA_WRITE_ERR 0x40000
  177. #define DMA_READ_ERR 0x80000
  178. /*
  179. * Receive state
  180. *
  181. * RoadRunner HIPPI Receive State Register controls and monitors the
  182. * HIPPI receive interface in the NIC. Look at err bits when a HIPPI
  183. * receive Error Event occurs.
  184. */
  185. #define ENABLE_NEW_CON 0x01
  186. #define RESET_RECV 0x02
  187. #define RECV_ALL 0x00
  188. #define RECV_1K 0x20
  189. #define RECV_2K 0x40
  190. #define RECV_4K 0x60
  191. #define RECV_8K 0x80
  192. #define RECV_16K 0xa0
  193. #define RECV_32K 0xc0
  194. #define RECV_64K 0xe0
  195. /*
  196. * Transmit status.
  197. */
  198. #define ENA_XMIT 0x01
  199. #define PERM_CON 0x02
  200. /*
  201. * DMA write state
  202. */
  203. #define RESET_DMA 0x01
  204. #define NO_SWAP_DMA 0x02
  205. #define DMA_ACTIVE 0x04
  206. #define THRESH_MASK 0x1F
  207. #define DMA_ERROR_MASK 0xff000000
  208. /*
  209. * Gooddies stored in the ULA registers.
  210. */
  211. #define TRACE_ON_WHAT_BIT 0x00020000 /* Traces on */
  212. #define ONEM_BUF_WHAT_BIT 0x00040000 /* 1Meg vs 256K */
  213. #define CHAR_API_WHAT_BIT 0x00080000 /* Char API vs network only */
  214. #define CMD_EVT_WHAT_BIT 0x00200000 /* Command event */
  215. #define LONG_TX_WHAT_BIT 0x00400000
  216. #define LONG_RX_WHAT_BIT 0x00800000
  217. #define WHAT_BIT_MASK 0xFFFD0000 /* Feature bit mask */
  218. /*
  219. * Mode status
  220. */
  221. #define EVENT_OVFL 0x80000000
  222. #define FATAL_ERR 0x40000000
  223. #define LOOP_BACK 0x01
  224. #define MODE_PH 0x02
  225. #define MODE_FP 0x00
  226. #define PTR64BIT 0x04
  227. #define PTR32BIT 0x00
  228. #define PTR_WD_SWAP 0x08
  229. #define PTR_WD_NOSWAP 0x00
  230. #define POST_WARN_EVENT 0x10
  231. #define ERR_TERM 0x20
  232. #define DIRECT_CONN 0x40
  233. #define NO_NIC_WATCHDOG 0x80
  234. #define SWAP_DATA 0x100
  235. #define SWAP_CONTROL 0x200
  236. #define NIC_HALT_ON_ERR 0x400
  237. #define NIC_NO_RESTART 0x800
  238. #define HALF_DUP_TX 0x1000
  239. #define HALF_DUP_RX 0x2000
  240. /*
  241. * Error codes
  242. */
  243. /* Host Error Codes - values of fail1 */
  244. #define ERR_UNKNOWN_MBOX 0x1001
  245. #define ERR_UNKNOWN_CMD 0x1002
  246. #define ERR_MAX_RING 0x1003
  247. #define ERR_RING_CLOSED 0x1004
  248. #define ERR_RING_OPEN 0x1005
  249. /* Firmware internal errors */
  250. #define ERR_EVENT_RING_FULL 0x01
  251. #define ERR_DW_PEND_CMND_FULL 0x02
  252. #define ERR_DR_PEND_CMND_FULL 0x03
  253. #define ERR_DW_PEND_DATA_FULL 0x04
  254. #define ERR_DR_PEND_DATA_FULL 0x05
  255. #define ERR_ILLEGAL_JUMP 0x06
  256. #define ERR_UNIMPLEMENTED 0x07
  257. #define ERR_TX_INFO_FULL 0x08
  258. #define ERR_RX_INFO_FULL 0x09
  259. #define ERR_ILLEGAL_MODE 0x0A
  260. #define ERR_MAIN_TIMEOUT 0x0B
  261. #define ERR_EVENT_BITS 0x0C
  262. #define ERR_UNPEND_FULL 0x0D
  263. #define ERR_TIMER_QUEUE_FULL 0x0E
  264. #define ERR_TIMER_QUEUE_EMPTY 0x0F
  265. #define ERR_TIMER_NO_FREE 0x10
  266. #define ERR_INTR_START 0x11
  267. #define ERR_BAD_STARTUP 0x12
  268. #define ERR_NO_PKT_END 0x13
  269. #define ERR_HALTED_ON_ERR 0x14
  270. /* Hardware NIC Errors */
  271. #define ERR_WRITE_DMA 0x0101
  272. #define ERR_READ_DMA 0x0102
  273. #define ERR_EXT_SERIAL 0x0103
  274. #define ERR_TX_INT_PARITY 0x0104
  275. /*
  276. * Event definitions
  277. */
  278. #define EVT_RING_ENTRIES 64
  279. #define EVT_RING_SIZE (EVT_RING_ENTRIES * sizeof(struct event))
  280. struct event {
  281. #ifdef __LITTLE_ENDIAN
  282. u16 index;
  283. u8 ring;
  284. u8 code;
  285. #else
  286. u8 code;
  287. u8 ring;
  288. u16 index;
  289. #endif
  290. u32 timestamp;
  291. };
  292. /*
  293. * General Events
  294. */
  295. #define E_NIC_UP 0x01
  296. #define E_WATCHDOG 0x02
  297. #define E_STAT_UPD 0x04
  298. #define E_INVAL_CMD 0x05
  299. #define E_SET_CMD_CONS 0x06
  300. #define E_LINK_ON 0x07
  301. #define E_LINK_OFF 0x08
  302. #define E_INTERN_ERR 0x09
  303. #define E_HOST_ERR 0x0A
  304. #define E_STATS_UPDATE 0x0B
  305. #define E_REJECTING 0x0C
  306. /*
  307. * Send Events
  308. */
  309. #define E_CON_REJ 0x13
  310. #define E_CON_TMOUT 0x14
  311. #define E_CON_NC_TMOUT 0x15 /* I , Connection No Campon Timeout */
  312. #define E_DISC_ERR 0x16
  313. #define E_INT_PRTY 0x17
  314. #define E_TX_IDLE 0x18
  315. #define E_TX_LINK_DROP 0x19
  316. #define E_TX_INV_RNG 0x1A
  317. #define E_TX_INV_BUF 0x1B
  318. #define E_TX_INV_DSC 0x1C
  319. /*
  320. * Destination Events
  321. */
  322. /*
  323. * General Receive events
  324. */
  325. #define E_VAL_RNG 0x20
  326. #define E_RX_RNG_ENER 0x21
  327. #define E_INV_RNG 0x22
  328. #define E_RX_RNG_SPC 0x23
  329. #define E_RX_RNG_OUT 0x24
  330. #define E_PKT_DISCARD 0x25
  331. #define E_INFO_EVT 0x27
  332. /*
  333. * Data corrupted events
  334. */
  335. #define E_RX_PAR_ERR 0x2B
  336. #define E_RX_LLRC_ERR 0x2C
  337. #define E_IP_CKSM_ERR 0x2D
  338. #define E_DTA_CKSM_ERR 0x2E
  339. #define E_SHT_BST 0x2F
  340. /*
  341. * Data lost events
  342. */
  343. #define E_LST_LNK_ERR 0x30
  344. #define E_FLG_SYN_ERR 0x31
  345. #define E_FRM_ERR 0x32
  346. #define E_RX_IDLE 0x33
  347. #define E_PKT_LN_ERR 0x34
  348. #define E_STATE_ERR 0x35
  349. #define E_UNEXP_DATA 0x3C
  350. /*
  351. * Fatal events
  352. */
  353. #define E_RX_INV_BUF 0x36
  354. #define E_RX_INV_DSC 0x37
  355. #define E_RNG_BLK 0x38
  356. /*
  357. * Warning events
  358. */
  359. #define E_RX_TO 0x39
  360. #define E_BFR_SPC 0x3A
  361. #define E_INV_ULP 0x3B
  362. #define E_NOT_IMPLEMENTED 0x40
  363. /*
  364. * Commands
  365. */
  366. #define CMD_RING_ENTRIES 16
  367. struct cmd {
  368. #ifdef __LITTLE_ENDIAN
  369. u16 index;
  370. u8 ring;
  371. u8 code;
  372. #else
  373. u8 code;
  374. u8 ring;
  375. u16 index;
  376. #endif
  377. };
  378. #define C_START_FW 0x01
  379. #define C_UPD_STAT 0x02
  380. #define C_WATCHDOG 0x05
  381. #define C_DEL_RNG 0x09
  382. #define C_NEW_RNG 0x0A
  383. #define C_CONN 0x0D
  384. /*
  385. * Mode bits
  386. */
  387. #define PACKET_BAD 0x01 /* Packet had link-layer error */
  388. #define INTERRUPT 0x02
  389. #define TX_IP_CKSUM 0x04
  390. #define PACKET_END 0x08
  391. #define PACKET_START 0x10
  392. #define SAME_IFIELD 0x80
  393. typedef struct {
  394. #if (BITS_PER_LONG == 64)
  395. u64 addrlo;
  396. #else
  397. u32 addrhi;
  398. u32 addrlo;
  399. #endif
  400. } rraddr;
  401. static inline void set_rraddr(rraddr *ra, dma_addr_t addr)
  402. {
  403. unsigned long baddr = addr;
  404. #if (BITS_PER_LONG == 64)
  405. ra->addrlo = baddr;
  406. #else
  407. /* Don't bother setting zero every time */
  408. ra->addrlo = baddr;
  409. #endif
  410. mb();
  411. }
  412. static inline void set_rxaddr(struct rr_regs __iomem *regs, volatile dma_addr_t addr)
  413. {
  414. unsigned long baddr = addr;
  415. #if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN)
  416. writel(baddr & 0xffffffff, &regs->RxRingHi);
  417. writel(baddr >> 32, &regs->RxRingLo);
  418. #elif (BITS_PER_LONG == 64)
  419. writel(baddr >> 32, &regs->RxRingHi);
  420. writel(baddr & 0xffffffff, &regs->RxRingLo);
  421. #else
  422. writel(0, &regs->RxRingHi);
  423. writel(baddr, &regs->RxRingLo);
  424. #endif
  425. mb();
  426. }
  427. static inline void set_infoaddr(struct rr_regs __iomem *regs, volatile dma_addr_t addr)
  428. {
  429. unsigned long baddr = addr;
  430. #if (BITS_PER_LONG == 64) && defined(__LITTLE_ENDIAN)
  431. writel(baddr & 0xffffffff, &regs->InfoPtrHi);
  432. writel(baddr >> 32, &regs->InfoPtrLo);
  433. #elif (BITS_PER_LONG == 64)
  434. writel(baddr >> 32, &regs->InfoPtrHi);
  435. writel(baddr & 0xffffffff, &regs->InfoPtrLo);
  436. #else
  437. writel(0, &regs->InfoPtrHi);
  438. writel(baddr, &regs->InfoPtrLo);
  439. #endif
  440. mb();
  441. }
  442. /*
  443. * TX ring
  444. */
  445. #ifdef CONFIG_ROADRUNNER_LARGE_RINGS
  446. #define TX_RING_ENTRIES 32
  447. #else
  448. #define TX_RING_ENTRIES 16
  449. #endif
  450. #define TX_TOTAL_SIZE (TX_RING_ENTRIES * sizeof(struct tx_desc))
  451. struct tx_desc{
  452. rraddr addr;
  453. u32 res;
  454. #ifdef __LITTLE_ENDIAN
  455. u16 size;
  456. u8 pad;
  457. u8 mode;
  458. #else
  459. u8 mode;
  460. u8 pad;
  461. u16 size;
  462. #endif
  463. };
  464. #ifdef CONFIG_ROADRUNNER_LARGE_RINGS
  465. #define RX_RING_ENTRIES 32
  466. #else
  467. #define RX_RING_ENTRIES 16
  468. #endif
  469. #define RX_TOTAL_SIZE (RX_RING_ENTRIES * sizeof(struct rx_desc))
  470. struct rx_desc{
  471. rraddr addr;
  472. u32 res;
  473. #ifdef __LITTLE_ENDIAN
  474. u16 size;
  475. u8 pad;
  476. u8 mode;
  477. #else
  478. u8 mode;
  479. u8 pad;
  480. u16 size;
  481. #endif
  482. };
  483. /*
  484. * ioctl's
  485. */
  486. #define SIOCRRPFW SIOCDEVPRIVATE /* put firmware */
  487. #define SIOCRRGFW SIOCDEVPRIVATE+1 /* get firmware */
  488. #define SIOCRRID SIOCDEVPRIVATE+2 /* identify */
  489. struct seg_hdr {
  490. u32 seg_start;
  491. u32 seg_len;
  492. u32 seg_eestart;
  493. };
  494. #define EEPROM_BASE 0x80000000
  495. #define EEPROM_WORDS 8192
  496. #define EEPROM_BYTES (EEPROM_WORDS * sizeof(u32))
  497. struct eeprom_boot {
  498. u32 key1;
  499. u32 key2;
  500. u32 sram_size;
  501. struct seg_hdr loader;
  502. u32 init_chksum;
  503. u32 reserved1;
  504. };
  505. struct eeprom_manf {
  506. u32 HeaderFmt;
  507. u32 Firmware;
  508. u32 BoardRevision;
  509. u32 RoadrunnerRev;
  510. char OpticsPart[8];
  511. u32 OpticsRev;
  512. u32 pad1;
  513. char SramPart[8];
  514. u32 SramRev;
  515. u32 pad2;
  516. char EepromPart[8];
  517. u32 EepromRev;
  518. u32 EepromSize;
  519. char PalPart[8];
  520. u32 PalRev;
  521. u32 pad3;
  522. char PalCodeFile[12];
  523. u32 PalCodeRev;
  524. char BoardULA[8];
  525. char SerialNo[8];
  526. char MfgDate[8];
  527. char MfgTime[8];
  528. char ModifyDate[8];
  529. u32 ModCount;
  530. u32 pad4[13];
  531. };
  532. struct eeprom_phase_info {
  533. char phase1File[12];
  534. u32 phase1Rev;
  535. char phase1Date[8];
  536. char phase2File[12];
  537. u32 phase2Rev;
  538. char phase2Date[8];
  539. u32 reserved7[4];
  540. };
  541. struct eeprom_rncd_info {
  542. u32 FwStart;
  543. u32 FwRev;
  544. char FwDate[8];
  545. u32 AddrRunCodeSegs;
  546. u32 FileNames;
  547. char File[13][8];
  548. };
  549. /* Phase 1 region (starts are word offset 0x80) */
  550. struct phase1_hdr{
  551. u32 jump;
  552. u32 noop;
  553. struct seg_hdr phase2Seg;
  554. };
  555. struct eeprom {
  556. struct eeprom_boot boot;
  557. u32 pad1[8];
  558. struct eeprom_manf manf;
  559. struct eeprom_phase_info phase_info;
  560. struct eeprom_rncd_info rncd_info;
  561. u32 pad2[15];
  562. u32 hdr_checksum;
  563. struct phase1_hdr phase1;
  564. };
  565. struct rr_stats {
  566. u32 NicTimeStamp;
  567. u32 RngCreated;
  568. u32 RngDeleted;
  569. u32 IntrGen;
  570. u32 NEvtOvfl;
  571. u32 InvCmd;
  572. u32 DmaReadErrs;
  573. u32 DmaWriteErrs;
  574. u32 StatUpdtT;
  575. u32 StatUpdtC;
  576. u32 WatchDog;
  577. u32 Trace;
  578. /* Serial HIPPI */
  579. u32 LnkRdyEst;
  580. u32 GLinkErr;
  581. u32 AltFlgErr;
  582. u32 OvhdBit8Sync;
  583. u32 RmtSerPrtyErr;
  584. u32 RmtParPrtyErr;
  585. u32 RmtLoopBk;
  586. u32 pad1;
  587. /* HIPPI tx */
  588. u32 ConEst;
  589. u32 ConRejS;
  590. u32 ConRetry;
  591. u32 ConTmOut;
  592. u32 SndConDiscon;
  593. u32 SndParErr;
  594. u32 PktSnt;
  595. u32 pad2[2];
  596. u32 ShFBstSnt;
  597. u64 BytSent;
  598. u32 TxTimeout;
  599. u32 pad3[3];
  600. /* HIPPI rx */
  601. u32 ConAcc;
  602. u32 ConRejdiPrty;
  603. u32 ConRejd64b;
  604. u32 ConRejdBuf;
  605. u32 RxConDiscon;
  606. u32 RxConNoData;
  607. u32 PktRx;
  608. u32 pad4[2];
  609. u32 ShFBstRx;
  610. u64 BytRx;
  611. u32 RxParErr;
  612. u32 RxLLRCerr;
  613. u32 RxBstSZerr;
  614. u32 RxStateErr;
  615. u32 RxRdyErr;
  616. u32 RxInvULP;
  617. u32 RxSpcBuf;
  618. u32 RxSpcDesc;
  619. u32 RxRngSpc;
  620. u32 RxRngFull;
  621. u32 RxPktLenErr;
  622. u32 RxCksmErr;
  623. u32 RxPktDrp;
  624. u32 RngLowSpc;
  625. u32 RngDataClose;
  626. u32 RxTimeout;
  627. u32 RxIdle;
  628. };
  629. /*
  630. * This struct is shared with the NIC firmware.
  631. */
  632. struct ring_ctrl {
  633. rraddr rngptr;
  634. #ifdef __LITTLE_ENDIAN
  635. u16 entries;
  636. u8 pad;
  637. u8 entry_size;
  638. u16 pi;
  639. u16 mode;
  640. #else
  641. u8 entry_size;
  642. u8 pad;
  643. u16 entries;
  644. u16 mode;
  645. u16 pi;
  646. #endif
  647. };
  648. struct rr_info {
  649. union {
  650. struct rr_stats stats;
  651. u32 stati[128];
  652. } s;
  653. struct ring_ctrl evt_ctrl;
  654. struct ring_ctrl cmd_ctrl;
  655. struct ring_ctrl tx_ctrl;
  656. u8 pad[464];
  657. u8 trace[3072];
  658. };
  659. /*
  660. * The linux structure for the RoadRunner.
  661. *
  662. * RX/TX descriptors are put first to make sure they are properly
  663. * aligned and do not cross cache-line boundaries.
  664. */
  665. struct rr_private
  666. {
  667. struct rx_desc *rx_ring;
  668. struct tx_desc *tx_ring;
  669. struct event *evt_ring;
  670. dma_addr_t tx_ring_dma;
  671. dma_addr_t rx_ring_dma;
  672. dma_addr_t evt_ring_dma;
  673. /* Alignment ok ? */
  674. struct sk_buff *rx_skbuff[RX_RING_ENTRIES];
  675. struct sk_buff *tx_skbuff[TX_RING_ENTRIES];
  676. struct rr_regs __iomem *regs; /* Register base */
  677. struct ring_ctrl *rx_ctrl; /* Receive ring control */
  678. struct rr_info *info; /* Shared info page */
  679. dma_addr_t rx_ctrl_dma;
  680. dma_addr_t info_dma;
  681. spinlock_t lock;
  682. struct timer_list timer;
  683. u32 cur_rx, cur_cmd, cur_evt;
  684. u32 dirty_rx, dirty_tx;
  685. u32 tx_full;
  686. u32 fw_rev;
  687. volatile short fw_running;
  688. struct pci_dev *pci_dev;
  689. };
  690. /*
  691. * Prototypes
  692. */
  693. static int rr_init(struct net_device *dev);
  694. static int rr_init1(struct net_device *dev);
  695. static irqreturn_t rr_interrupt(int irq, void *dev_id);
  696. static int rr_open(struct net_device *dev);
  697. static netdev_tx_t rr_start_xmit(struct sk_buff *skb,
  698. struct net_device *dev);
  699. static int rr_close(struct net_device *dev);
  700. static int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
  701. static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
  702. unsigned long offset,
  703. unsigned char *buf,
  704. unsigned long length);
  705. static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset);
  706. static int rr_load_firmware(struct net_device *dev);
  707. static inline void rr_raz_tx(struct rr_private *, struct net_device *);
  708. static inline void rr_raz_rx(struct rr_private *, struct net_device *);
  709. #endif /* _RRUNNER_H_ */