he.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  1. /*
  2. he.h
  3. ForeRunnerHE ATM Adapter driver for ATM on Linux
  4. Copyright (C) 1999-2001 Naval Research Laboratory
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. /*
  18. he.h
  19. ForeRunnerHE ATM Adapter driver for ATM on Linux
  20. Copyright (C) 1999-2000 Naval Research Laboratory
  21. Permission to use, copy, modify and distribute this software and its
  22. documentation is hereby granted, provided that both the copyright
  23. notice and this permission notice appear in all copies of the software,
  24. derivative works or modified versions, and any portions thereof, and
  25. that both notices appear in supporting documentation.
  26. NRL ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND
  27. DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
  28. RESULTING FROM THE USE OF THIS SOFTWARE.
  29. */
  30. #ifndef _HE_H_
  31. #define _HE_H_
  32. #define DEV_LABEL "he"
  33. #define CONFIG_DEFAULT_VCIBITS 12
  34. #define CONFIG_DEFAULT_VPIBITS 0
  35. #define CONFIG_IRQ_SIZE 128
  36. #define CONFIG_IRQ_THRESH (CONFIG_IRQ_SIZE/2)
  37. #define CONFIG_NUMTPDS 256
  38. #define CONFIG_TPDRQ_SIZE 512
  39. #define TPDRQ_MASK(x) (((unsigned long)(x))&((CONFIG_TPDRQ_SIZE<<3)-1))
  40. #define CONFIG_RBRQ_SIZE 512
  41. #define CONFIG_RBRQ_THRESH 400
  42. #define RBRQ_MASK(x) (((unsigned long)(x))&((CONFIG_RBRQ_SIZE<<3)-1))
  43. #define CONFIG_TBRQ_SIZE 512
  44. #define CONFIG_TBRQ_THRESH 400
  45. #define TBRQ_MASK(x) (((unsigned long)(x))&((CONFIG_TBRQ_SIZE<<2)-1))
  46. #define CONFIG_RBPL_SIZE 512
  47. #define CONFIG_RBPL_THRESH 64
  48. #define CONFIG_RBPL_BUFSIZE 4096
  49. #define RBPL_MASK(x) (((unsigned long)(x))&((CONFIG_RBPL_SIZE<<3)-1))
  50. #define CONFIG_RBPS_SIZE 1024
  51. #define CONFIG_RBPS_THRESH 64
  52. #define CONFIG_RBPS_BUFSIZE 128
  53. #define RBPS_MASK(x) (((unsigned long)(x))&((CONFIG_RBPS_SIZE<<3)-1))
  54. /* 5.1.3 initialize connection memory */
  55. #define CONFIG_RSRA 0x00000
  56. #define CONFIG_RCMLBM 0x08000
  57. #define CONFIG_RCMABR 0x0d800
  58. #define CONFIG_RSRB 0x0e000
  59. #define CONFIG_TSRA 0x00000
  60. #define CONFIG_TSRB 0x08000
  61. #define CONFIG_TSRC 0x0c000
  62. #define CONFIG_TSRD 0x0e000
  63. #define CONFIG_TMABR 0x0f000
  64. #define CONFIG_TPDBA 0x10000
  65. #define HE_MAXCIDBITS 12
  66. /* 2.9.3.3 interrupt encodings */
  67. struct he_irq {
  68. volatile u32 isw;
  69. };
  70. #define IRQ_ALIGNMENT 0x1000
  71. #define NEXT_ENTRY(base, tail, mask) \
  72. (((unsigned long)base)|(((unsigned long)(tail+1))&mask))
  73. #define ITYPE_INVALID 0xffffffff
  74. #define ITYPE_TBRQ_THRESH (0<<3)
  75. #define ITYPE_TPD_COMPLETE (1<<3)
  76. #define ITYPE_RBPS_THRESH (2<<3)
  77. #define ITYPE_RBPL_THRESH (3<<3)
  78. #define ITYPE_RBRQ_THRESH (4<<3)
  79. #define ITYPE_RBRQ_TIMER (5<<3)
  80. #define ITYPE_PHY (6<<3)
  81. #define ITYPE_OTHER 0x80
  82. #define ITYPE_PARITY 0x81
  83. #define ITYPE_ABORT 0x82
  84. #define ITYPE_GROUP(x) (x & 0x7)
  85. #define ITYPE_TYPE(x) (x & 0xf8)
  86. #define HE_NUM_GROUPS 8
  87. /* 2.1.4 transmit packet descriptor */
  88. struct he_tpd {
  89. /* read by the adapter */
  90. volatile u32 status;
  91. volatile u32 reserved;
  92. #define TPD_MAXIOV 3
  93. struct {
  94. u32 addr, len;
  95. } iovec[TPD_MAXIOV];
  96. #define address0 iovec[0].addr
  97. #define length0 iovec[0].len
  98. /* linux-atm extensions */
  99. struct sk_buff *skb;
  100. struct atm_vcc *vcc;
  101. #ifdef USE_TPD_POOL
  102. struct list_head entry;
  103. #else
  104. u32 inuse;
  105. char padding[32 - sizeof(u32) - (2*sizeof(void*))];
  106. #endif
  107. };
  108. #define TPD_ALIGNMENT 64
  109. #define TPD_LEN_MASK 0xffff
  110. #define TPD_ADDR_SHIFT 6
  111. #define TPD_MASK 0xffffffc0
  112. #define TPD_ADDR(x) ((x) & TPD_MASK)
  113. #define TPD_INDEX(x) (TPD_ADDR(x) >> TPD_ADDR_SHIFT)
  114. /* table 2.3 transmit buffer return elements */
  115. struct he_tbrq {
  116. volatile u32 tbre;
  117. };
  118. #define TBRQ_ALIGNMENT CONFIG_TBRQ_SIZE
  119. #define TBRQ_TPD(tbrq) ((tbrq)->tbre & 0xffffffc0)
  120. #define TBRQ_EOS(tbrq) ((tbrq)->tbre & (1<<3))
  121. #define TBRQ_MULTIPLE(tbrq) ((tbrq)->tbre & (1))
  122. /* table 2.21 receive buffer return queue element field organization */
  123. struct he_rbrq {
  124. volatile u32 addr;
  125. volatile u32 cidlen;
  126. };
  127. #define RBRQ_ALIGNMENT CONFIG_RBRQ_SIZE
  128. #define RBRQ_ADDR(rbrq) ((rbrq)->addr & 0xffffffc0)
  129. #define RBRQ_CRC_ERR(rbrq) ((rbrq)->addr & (1<<5))
  130. #define RBRQ_LEN_ERR(rbrq) ((rbrq)->addr & (1<<4))
  131. #define RBRQ_END_PDU(rbrq) ((rbrq)->addr & (1<<3))
  132. #define RBRQ_AAL5_PROT(rbrq) ((rbrq)->addr & (1<<2))
  133. #define RBRQ_CON_CLOSED(rbrq) ((rbrq)->addr & (1<<1))
  134. #define RBRQ_HBUF_ERR(rbrq) ((rbrq)->addr & 1)
  135. #define RBRQ_CID(rbrq) (((rbrq)->cidlen >> 16) & 0x1fff)
  136. #define RBRQ_BUFLEN(rbrq) ((rbrq)->cidlen & 0xffff)
  137. /* figure 2.3 transmit packet descriptor ready queue */
  138. struct he_tpdrq {
  139. volatile u32 tpd;
  140. volatile u32 cid;
  141. };
  142. #define TPDRQ_ALIGNMENT CONFIG_TPDRQ_SIZE
  143. /* table 2.30 host status page detail */
  144. #define HSP_ALIGNMENT 0x400 /* must align on 1k boundary */
  145. struct he_hsp {
  146. struct he_hsp_entry {
  147. volatile u32 tbrq_tail;
  148. volatile u32 reserved1[15];
  149. volatile u32 rbrq_tail;
  150. volatile u32 reserved2[15];
  151. } group[HE_NUM_GROUPS];
  152. };
  153. /* figure 2.9 receive buffer pools */
  154. struct he_rbp {
  155. volatile u32 phys;
  156. volatile u32 status;
  157. };
  158. /* NOTE: it is suggested that virt be the virtual address of the host
  159. buffer. on a 64-bit machine, this would not work. Instead, we
  160. store the real virtual address in another list, and store an index
  161. (and buffer status) in the virt member.
  162. */
  163. #define RBP_INDEX_OFF 6
  164. #define RBP_INDEX(x) (((long)(x) >> RBP_INDEX_OFF) & 0xffff)
  165. #define RBP_LOANED 0x80000000
  166. #define RBP_SMALLBUF 0x40000000
  167. struct he_virt {
  168. void *virt;
  169. };
  170. #define RBPL_ALIGNMENT CONFIG_RBPL_SIZE
  171. #define RBPS_ALIGNMENT CONFIG_RBPS_SIZE
  172. #ifdef notyet
  173. struct he_group {
  174. u32 rpbs_size, rpbs_qsize;
  175. struct he_rbp rbps_ba;
  176. u32 rpbl_size, rpbl_qsize;
  177. struct he_rpb_entry *rbpl_ba;
  178. };
  179. #endif
  180. #define HE_LOOKUP_VCC(dev, cid) ((dev)->he_vcc_table[(cid)].vcc)
  181. struct he_vcc_table
  182. {
  183. struct atm_vcc *vcc;
  184. };
  185. struct he_cs_stper
  186. {
  187. long pcr;
  188. int inuse;
  189. };
  190. #define HE_NUM_CS_STPER 16
  191. struct he_dev {
  192. unsigned int number;
  193. unsigned int irq;
  194. void __iomem *membase;
  195. char prod_id[30];
  196. char mac_addr[6];
  197. int media;
  198. unsigned int vcibits, vpibits;
  199. unsigned int cells_per_row;
  200. unsigned int bytes_per_row;
  201. unsigned int cells_per_lbuf;
  202. unsigned int r0_numrows, r0_startrow, r0_numbuffs;
  203. unsigned int r1_numrows, r1_startrow, r1_numbuffs;
  204. unsigned int tx_numrows, tx_startrow, tx_numbuffs;
  205. unsigned int buffer_limit;
  206. struct he_vcc_table *he_vcc_table;
  207. #ifdef notyet
  208. struct he_group group[HE_NUM_GROUPS];
  209. #endif
  210. struct he_cs_stper cs_stper[HE_NUM_CS_STPER];
  211. unsigned total_bw;
  212. dma_addr_t irq_phys;
  213. struct he_irq *irq_base, *irq_head, *irq_tail;
  214. volatile unsigned *irq_tailoffset;
  215. int irq_peak;
  216. #ifdef USE_TASKLET
  217. struct tasklet_struct tasklet;
  218. #endif
  219. #ifdef USE_TPD_POOL
  220. struct pci_pool *tpd_pool;
  221. struct list_head outstanding_tpds;
  222. #else
  223. struct he_tpd *tpd_head, *tpd_base, *tpd_end;
  224. dma_addr_t tpd_base_phys;
  225. #endif
  226. dma_addr_t tpdrq_phys;
  227. struct he_tpdrq *tpdrq_base, *tpdrq_tail, *tpdrq_head;
  228. spinlock_t global_lock; /* 8.1.5 pci transaction ordering
  229. error problem */
  230. dma_addr_t rbrq_phys;
  231. struct he_rbrq *rbrq_base, *rbrq_head;
  232. int rbrq_peak;
  233. #ifdef USE_RBPL_POOL
  234. struct pci_pool *rbpl_pool;
  235. #else
  236. void *rbpl_pages;
  237. dma_addr_t rbpl_pages_phys;
  238. #endif
  239. dma_addr_t rbpl_phys;
  240. struct he_rbp *rbpl_base, *rbpl_tail;
  241. struct he_virt *rbpl_virt;
  242. int rbpl_peak;
  243. #ifdef USE_RBPS
  244. #ifdef USE_RBPS_POOL
  245. struct pci_pool *rbps_pool;
  246. #else
  247. void *rbps_pages;
  248. dma_addr_t rbps_pages_phys;
  249. #endif
  250. #endif
  251. dma_addr_t rbps_phys;
  252. struct he_rbp *rbps_base, *rbps_tail;
  253. struct he_virt *rbps_virt;
  254. int rbps_peak;
  255. dma_addr_t tbrq_phys;
  256. struct he_tbrq *tbrq_base, *tbrq_head;
  257. int tbrq_peak;
  258. dma_addr_t hsp_phys;
  259. struct he_hsp *hsp;
  260. struct pci_dev *pci_dev;
  261. struct atm_dev *atm_dev;
  262. struct he_dev *next;
  263. };
  264. struct he_iovec
  265. {
  266. u32 iov_base;
  267. u32 iov_len;
  268. };
  269. #define HE_MAXIOV 20
  270. struct he_vcc
  271. {
  272. struct he_iovec iov_head[HE_MAXIOV];
  273. struct he_iovec *iov_tail;
  274. int pdu_len;
  275. int rc_index;
  276. wait_queue_head_t rx_waitq;
  277. wait_queue_head_t tx_waitq;
  278. };
  279. #define HE_VCC(vcc) ((struct he_vcc *)(vcc->dev_data))
  280. #define PCI_VENDOR_ID_FORE 0x1127
  281. #define PCI_DEVICE_ID_FORE_HE 0x400
  282. #define GEN_CNTL_0 0x40
  283. #define INT_PROC_ENBL (1<<25)
  284. #define SLAVE_ENDIAN_MODE (1<<16)
  285. #define MRL_ENB (1<<5)
  286. #define MRM_ENB (1<<4)
  287. #define INIT_ENB (1<<2)
  288. #define IGNORE_TIMEOUT (1<<1)
  289. #define ENBL_64 (1<<0)
  290. #define MIN_PCI_LATENCY 32 /* errata 8.1.3 */
  291. #define HE_DEV(dev) ((struct he_dev *) (dev)->dev_data)
  292. #define he_is622(dev) ((dev)->media & 0x1)
  293. #define he_isMM(dev) ((dev)->media & 0x20)
  294. #define HE_REGMAP_SIZE 0x100000
  295. #define RESET_CNTL 0x80000
  296. #define BOARD_RST_STATUS (1<<6)
  297. #define HOST_CNTL 0x80004
  298. #define PCI_BUS_SIZE64 (1<<27)
  299. #define DESC_RD_STATIC_64 (1<<26)
  300. #define DATA_RD_STATIC_64 (1<<25)
  301. #define DATA_WR_STATIC_64 (1<<24)
  302. #define ID_CS (1<<12)
  303. #define ID_WREN (1<<11)
  304. #define ID_DOUT (1<<10)
  305. #define ID_DOFFSET 10
  306. #define ID_DIN (1<<9)
  307. #define ID_CLOCK (1<<8)
  308. #define QUICK_RD_RETRY (1<<7)
  309. #define QUICK_WR_RETRY (1<<6)
  310. #define OUTFF_ENB (1<<5)
  311. #define CMDFF_ENB (1<<4)
  312. #define PERR_INT_ENB (1<<2)
  313. #define IGNORE_INTR (1<<0)
  314. #define LB_SWAP 0x80008
  315. #define SWAP_RNUM_MAX(x) (x<<27)
  316. #define DATA_WR_SWAP (1<<20)
  317. #define DESC_RD_SWAP (1<<19)
  318. #define DATA_RD_SWAP (1<<18)
  319. #define INTR_SWAP (1<<17)
  320. #define DESC_WR_SWAP (1<<16)
  321. #define SDRAM_INIT (1<<15)
  322. #define BIG_ENDIAN_HOST (1<<14)
  323. #define XFER_SIZE (1<<7)
  324. #define LB_MEM_ADDR 0x8000c
  325. #define LB_MEM_DATA 0x80010
  326. #define LB_MEM_ACCESS 0x80014
  327. #define LB_MEM_HNDSHK (1<<30)
  328. #define LM_MEM_WRITE (0x7)
  329. #define LM_MEM_READ (0x3)
  330. #define SDRAM_CTL 0x80018
  331. #define LB_64_ENB (1<<3)
  332. #define LB_TWR (1<<2)
  333. #define LB_TRP (1<<1)
  334. #define LB_TRAS (1<<0)
  335. #define INT_FIFO 0x8001c
  336. #define INT_MASK_D (1<<15)
  337. #define INT_MASK_C (1<<14)
  338. #define INT_MASK_B (1<<13)
  339. #define INT_MASK_A (1<<12)
  340. #define INT_CLEAR_D (1<<11)
  341. #define INT_CLEAR_C (1<<10)
  342. #define INT_CLEAR_B (1<<9)
  343. #define INT_CLEAR_A (1<<8)
  344. #define ABORT_ADDR 0x80020
  345. #define IRQ0_BASE 0x80080
  346. #define IRQ_BASE(x) (x<<12)
  347. #define IRQ_MASK ((CONFIG_IRQ_SIZE<<2)-1) /* was 0x3ff */
  348. #define IRQ_TAIL(x) (((unsigned long)(x)) & IRQ_MASK)
  349. #define IRQ0_HEAD 0x80084
  350. #define IRQ_SIZE(x) (x<<22)
  351. #define IRQ_THRESH(x) (x<<12)
  352. #define IRQ_HEAD(x) (x<<2)
  353. /* #define IRQ_PENDING (1) conflict with linux/irq.h */
  354. #define IRQ0_CNTL 0x80088
  355. #define IRQ_ADDRSEL(x) (x<<2)
  356. #define IRQ_INT_A (0<<2)
  357. #define IRQ_INT_B (1<<2)
  358. #define IRQ_INT_C (2<<2)
  359. #define IRQ_INT_D (3<<2)
  360. #define IRQ_TYPE_ADDR 0x1
  361. #define IRQ_TYPE_LINE 0x0
  362. #define IRQ0_DATA 0x8008c
  363. #define IRQ1_BASE 0x80090
  364. #define IRQ1_HEAD 0x80094
  365. #define IRQ1_CNTL 0x80098
  366. #define IRQ1_DATA 0x8009c
  367. #define IRQ2_BASE 0x800a0
  368. #define IRQ2_HEAD 0x800a4
  369. #define IRQ2_CNTL 0x800a8
  370. #define IRQ2_DATA 0x800ac
  371. #define IRQ3_BASE 0x800b0
  372. #define IRQ3_HEAD 0x800b4
  373. #define IRQ3_CNTL 0x800b8
  374. #define IRQ3_DATA 0x800bc
  375. #define GRP_10_MAP 0x800c0
  376. #define GRP_32_MAP 0x800c4
  377. #define GRP_54_MAP 0x800c8
  378. #define GRP_76_MAP 0x800cc
  379. #define G0_RBPS_S 0x80400
  380. #define G0_RBPS_T 0x80404
  381. #define RBP_TAIL(x) ((x)<<3)
  382. #define RBP_MASK(x) ((x)|0x1fff)
  383. #define G0_RBPS_QI 0x80408
  384. #define RBP_QSIZE(x) ((x)<<14)
  385. #define RBP_INT_ENB (1<<13)
  386. #define RBP_THRESH(x) (x)
  387. #define G0_RBPS_BS 0x8040c
  388. #define G0_RBPL_S 0x80410
  389. #define G0_RBPL_T 0x80414
  390. #define G0_RBPL_QI 0x80418
  391. #define G0_RBPL_BS 0x8041c
  392. #define G1_RBPS_S 0x80420
  393. #define G1_RBPS_T 0x80424
  394. #define G1_RBPS_QI 0x80428
  395. #define G1_RBPS_BS 0x8042c
  396. #define G1_RBPL_S 0x80430
  397. #define G1_RBPL_T 0x80434
  398. #define G1_RBPL_QI 0x80438
  399. #define G1_RBPL_BS 0x8043c
  400. #define G2_RBPS_S 0x80440
  401. #define G2_RBPS_T 0x80444
  402. #define G2_RBPS_QI 0x80448
  403. #define G2_RBPS_BS 0x8044c
  404. #define G2_RBPL_S 0x80450
  405. #define G2_RBPL_T 0x80454
  406. #define G2_RBPL_QI 0x80458
  407. #define G2_RBPL_BS 0x8045c
  408. #define G3_RBPS_S 0x80460
  409. #define G3_RBPS_T 0x80464
  410. #define G3_RBPS_QI 0x80468
  411. #define G3_RBPS_BS 0x8046c
  412. #define G3_RBPL_S 0x80470
  413. #define G3_RBPL_T 0x80474
  414. #define G3_RBPL_QI 0x80478
  415. #define G3_RBPL_BS 0x8047c
  416. #define G4_RBPS_S 0x80480
  417. #define G4_RBPS_T 0x80484
  418. #define G4_RBPS_QI 0x80488
  419. #define G4_RBPS_BS 0x8048c
  420. #define G4_RBPL_S 0x80490
  421. #define G4_RBPL_T 0x80494
  422. #define G4_RBPL_QI 0x80498
  423. #define G4_RBPL_BS 0x8049c
  424. #define G5_RBPS_S 0x804a0
  425. #define G5_RBPS_T 0x804a4
  426. #define G5_RBPS_QI 0x804a8
  427. #define G5_RBPS_BS 0x804ac
  428. #define G5_RBPL_S 0x804b0
  429. #define G5_RBPL_T 0x804b4
  430. #define G5_RBPL_QI 0x804b8
  431. #define G5_RBPL_BS 0x804bc
  432. #define G6_RBPS_S 0x804c0
  433. #define G6_RBPS_T 0x804c4
  434. #define G6_RBPS_QI 0x804c8
  435. #define G6_RBPS_BS 0x804cc
  436. #define G6_RBPL_S 0x804d0
  437. #define G6_RBPL_T 0x804d4
  438. #define G6_RBPL_QI 0x804d8
  439. #define G6_RBPL_BS 0x804dc
  440. #define G7_RBPS_S 0x804e0
  441. #define G7_RBPS_T 0x804e4
  442. #define G7_RBPS_QI 0x804e8
  443. #define G7_RBPS_BS 0x804ec
  444. #define G7_RBPL_S 0x804f0
  445. #define G7_RBPL_T 0x804f4
  446. #define G7_RBPL_QI 0x804f8
  447. #define G7_RBPL_BS 0x804fc
  448. #define G0_RBRQ_ST 0x80500
  449. #define G0_RBRQ_H 0x80504
  450. #define G0_RBRQ_Q 0x80508
  451. #define RBRQ_THRESH(x) ((x)<<13)
  452. #define RBRQ_SIZE(x) (x)
  453. #define G0_RBRQ_I 0x8050c
  454. #define RBRQ_TIME(x) ((x)<<8)
  455. #define RBRQ_COUNT(x) (x)
  456. /* fill in 1 ... 7 later */
  457. #define G0_TBRQ_B_T 0x80600
  458. #define G0_TBRQ_H 0x80604
  459. #define G0_TBRQ_S 0x80608
  460. #define G0_TBRQ_THRESH 0x8060c
  461. #define TBRQ_THRESH(x) (x)
  462. /* fill in 1 ... 7 later */
  463. #define RH_CONFIG 0x805c0
  464. #define PHY_INT_ENB (1<<10)
  465. #define OAM_GID(x) (x<<7)
  466. #define PTMR_PRE(x) (x)
  467. #define G0_INMQ_S 0x80580
  468. #define G0_INMQ_L 0x80584
  469. #define G1_INMQ_S 0x80588
  470. #define G1_INMQ_L 0x8058c
  471. #define G2_INMQ_S 0x80590
  472. #define G2_INMQ_L 0x80594
  473. #define G3_INMQ_S 0x80598
  474. #define G3_INMQ_L 0x8059c
  475. #define G4_INMQ_S 0x805a0
  476. #define G4_INMQ_L 0x805a4
  477. #define G5_INMQ_S 0x805a8
  478. #define G5_INMQ_L 0x805ac
  479. #define G6_INMQ_S 0x805b0
  480. #define G6_INMQ_L 0x805b4
  481. #define G7_INMQ_S 0x805b8
  482. #define G7_INMQ_L 0x805bc
  483. #define TPDRQ_B_H 0x80680
  484. #define TPDRQ_T 0x80684
  485. #define TPDRQ_S 0x80688
  486. #define UBUFF_BA 0x8068c
  487. #define RLBF0_H 0x806c0
  488. #define RLBF0_T 0x806c4
  489. #define RLBF1_H 0x806c8
  490. #define RLBF1_T 0x806cc
  491. #define RLBC_H 0x806d0
  492. #define RLBC_T 0x806d4
  493. #define RLBC_H2 0x806d8
  494. #define TLBF_H 0x806e0
  495. #define TLBF_T 0x806e4
  496. #define RLBF0_C 0x806e8
  497. #define RLBF1_C 0x806ec
  498. #define RXTHRSH 0x806f0
  499. #define LITHRSH 0x806f4
  500. #define LBARB 0x80700
  501. #define SLICE_X(x) (x<<28)
  502. #define ARB_RNUM_MAX(x) (x<<23)
  503. #define TH_PRTY(x) (x<<21)
  504. #define RH_PRTY(x) (x<<19)
  505. #define TL_PRTY(x) (x<<17)
  506. #define RL_PRTY(x) (x<<15)
  507. #define BUS_MULTI(x) (x<<8)
  508. #define NET_PREF(x) (x)
  509. #define SDRAMCON 0x80704
  510. #define BANK_ON (1<<14)
  511. #define WIDE_DATA (1<<13)
  512. #define TWR_WAIT (1<<12)
  513. #define TRP_WAIT (1<<11)
  514. #define TRAS_WAIT (1<<10)
  515. #define REF_RATE(x) (x)
  516. #define LBSTAT 0x80708
  517. #define RCC_STAT 0x8070c
  518. #define RCC_BUSY (1)
  519. #define TCMCONFIG 0x80740
  520. #define TM_DESL2 (1<<10)
  521. #define TM_BANK_WAIT(x) (x<<6)
  522. #define TM_ADD_BANK4(x) (x<<4)
  523. #define TM_PAR_CHECK(x) (x<<3)
  524. #define TM_RW_WAIT(x) (x<<2)
  525. #define TM_SRAM_TYPE(x) (x)
  526. #define TSRB_BA 0x80744
  527. #define TSRC_BA 0x80748
  528. #define TMABR_BA 0x8074c
  529. #define TPD_BA 0x80750
  530. #define TSRD_BA 0x80758
  531. #define TX_CONFIG 0x80760
  532. #define DRF_THRESH(x) (x<<22)
  533. #define TX_UT_MODE(x) (x<<21)
  534. #define TX_VCI_MASK(x) (x<<17)
  535. #define LBFREE_CNT(x) (x)
  536. #define TXAAL5_PROTO 0x80764
  537. #define CPCS_UU(x) (x<<8)
  538. #define CPI(x) (x)
  539. #define RCMCONFIG 0x80780
  540. #define RM_DESL2(x) (x<<10)
  541. #define RM_BANK_WAIT(x) (x<<6)
  542. #define RM_ADD_BANK(x) (x<<4)
  543. #define RM_PAR_CHECK(x) (x<<3)
  544. #define RM_RW_WAIT(x) (x<<2)
  545. #define RM_SRAM_TYPE(x) (x)
  546. #define RCMRSRB_BA 0x80784
  547. #define RCMLBM_BA 0x80788
  548. #define RCMABR_BA 0x8078c
  549. #define RC_CONFIG 0x807c0
  550. #define UT_RD_DELAY(x) (x<<11)
  551. #define WRAP_MODE(x) (x<<10)
  552. #define RC_UT_MODE(x) (x<<9)
  553. #define RX_ENABLE (1<<8)
  554. #define RX_VALVP(x) (x<<4)
  555. #define RX_VALVC(x) (x)
  556. #define MCC 0x807c4
  557. #define OEC 0x807c8
  558. #define DCC 0x807cc
  559. #define CEC 0x807d0
  560. #define HSP_BA 0x807f0
  561. #define LB_CONFIG 0x807f4
  562. #define LB_SIZE(x) (x)
  563. #define CON_DAT 0x807f8
  564. #define CON_CTL 0x807fc
  565. #define CON_CTL_MBOX (2<<30)
  566. #define CON_CTL_TCM (1<<30)
  567. #define CON_CTL_RCM (0<<30)
  568. #define CON_CTL_WRITE (1<<29)
  569. #define CON_CTL_READ (0<<29)
  570. #define CON_CTL_BUSY (1<<28)
  571. #define CON_BYTE_DISABLE_3 (1<<22) /* 24..31 */
  572. #define CON_BYTE_DISABLE_2 (1<<21) /* 16..23 */
  573. #define CON_BYTE_DISABLE_1 (1<<20) /* 8..15 */
  574. #define CON_BYTE_DISABLE_0 (1<<19) /* 0..7 */
  575. #define CON_CTL_ADDR(x) (x)
  576. #define FRAMER 0x80800 /* to 0x80bfc */
  577. /* 3.3 network controller (internal) mailbox registers */
  578. #define CS_STPER0 0x0
  579. /* ... */
  580. #define CS_STPER31 0x01f
  581. #define CS_STTIM0 0x020
  582. /* ... */
  583. #define CS_STTIM31 0x03f
  584. #define CS_TGRLD0 0x040
  585. /* ... */
  586. #define CS_TGRLD15 0x04f
  587. #define CS_ERTHR0 0x050
  588. #define CS_ERTHR1 0x051
  589. #define CS_ERTHR2 0x052
  590. #define CS_ERTHR3 0x053
  591. #define CS_ERTHR4 0x054
  592. #define CS_ERCTL0 0x055
  593. #define TX_ENABLE (1<<28)
  594. #define ER_ENABLE (1<<27)
  595. #define CS_ERCTL1 0x056
  596. #define CS_ERCTL2 0x057
  597. #define CS_ERSTAT0 0x058
  598. #define CS_ERSTAT1 0x059
  599. #define CS_RTCCT 0x060
  600. #define CS_RTFWC 0x061
  601. #define CS_RTFWR 0x062
  602. #define CS_RTFTC 0x063
  603. #define CS_RTATR 0x064
  604. #define CS_TFBSET 0x070
  605. #define CS_TFBADD 0x071
  606. #define CS_TFBSUB 0x072
  607. #define CS_WCRMAX 0x073
  608. #define CS_WCRMIN 0x074
  609. #define CS_WCRINC 0x075
  610. #define CS_WCRDEC 0x076
  611. #define CS_WCRCEIL 0x077
  612. #define CS_BWDCNT 0x078
  613. #define CS_OTPPER 0x080
  614. #define CS_OTWPER 0x081
  615. #define CS_OTTLIM 0x082
  616. #define CS_OTTCNT 0x083
  617. #define CS_HGRRT0 0x090
  618. /* ... */
  619. #define CS_HGRRT7 0x097
  620. #define CS_ORPTRS 0x0a0
  621. #define RXCON_CLOSE 0x100
  622. #define RCM_MEM_SIZE 0x10000 /* 1M of 32-bit registers */
  623. #define TCM_MEM_SIZE 0x20000 /* 2M of 32-bit registers */
  624. /* 2.5 transmit connection memory registers */
  625. #define TSR0_CONN_STATE(x) ((x>>28) & 0x7)
  626. #define TSR0_USE_WMIN (1<<23)
  627. #define TSR0_GROUP(x) ((x & 0x7)<<18)
  628. #define TSR0_ABR (2<<16)
  629. #define TSR0_UBR (1<<16)
  630. #define TSR0_CBR (0<<16)
  631. #define TSR0_PROT (1<<15)
  632. #define TSR0_AAL0_SDU (2<<12)
  633. #define TSR0_AAL0 (1<<12)
  634. #define TSR0_AAL5 (0<<12)
  635. #define TSR0_HALT_ER (1<<11)
  636. #define TSR0_MARK_CI (1<<10)
  637. #define TSR0_MARK_ER (1<<9)
  638. #define TSR0_UPDATE_GER (1<<8)
  639. #define TSR0_RC_INDEX(x) (x & 0x1F)
  640. #define TSR1_PCR(x) ((x & 0x7FFF)<<16)
  641. #define TSR1_MCR(x) (x & 0x7FFF)
  642. #define TSR2_ACR(x) ((x & 0x7FFF)<<16)
  643. #define TSR3_NRM_CNT(x) ((x & 0xFF)<<24)
  644. #define TSR3_CRM_CNT(x) (x & 0xFFFF)
  645. #define TSR4_FLUSH_CONN (1<<31)
  646. #define TSR4_SESSION_ENDED (1<<30)
  647. #define TSR4_CRC10 (1<<28)
  648. #define TSR4_NULL_CRC10 (1<<27)
  649. #define TSR4_PROT (1<<26)
  650. #define TSR4_AAL0_SDU (2<<23)
  651. #define TSR4_AAL0 (1<<23)
  652. #define TSR4_AAL5 (0<<23)
  653. #define TSR9_OPEN_CONN (1<<20)
  654. #define TSR11_ICR(x) ((x & 0x7FFF)<<16)
  655. #define TSR11_TRM(x) ((x & 0x7)<<13)
  656. #define TSR11_NRM(x) ((x & 0x7)<<10)
  657. #define TSR11_ADTF(x) (x & 0x3FF)
  658. #define TSR13_RDF(x) ((x & 0xF)<<23)
  659. #define TSR13_RIF(x) ((x & 0xF)<<19)
  660. #define TSR13_CDF(x) ((x & 0x7)<<16)
  661. #define TSR13_CRM(x) (x & 0xFFFF)
  662. #define TSR14_DELETE (1<<31)
  663. #define TSR14_ABR_CLOSE (1<<16)
  664. /* 2.7.1 per connection receieve state registers */
  665. #define RSR0_START_PDU (1<<10)
  666. #define RSR0_OPEN_CONN (1<<6)
  667. #define RSR0_CLOSE_CONN (0<<6)
  668. #define RSR0_PPD_ENABLE (1<<5)
  669. #define RSR0_EPD_ENABLE (1<<4)
  670. #define RSR0_TCP_CKSUM (1<<3)
  671. #define RSR0_AAL5 (0)
  672. #define RSR0_AAL0 (1)
  673. #define RSR0_AAL0_SDU (2)
  674. #define RSR0_RAWCELL (3)
  675. #define RSR0_RAWCELL_CRC10 (4)
  676. #define RSR1_AQI_ENABLE (1<<20)
  677. #define RSR1_RBPL_ONLY (1<<19)
  678. #define RSR1_GROUP(x) ((x)<<16)
  679. #define RSR4_AQI_ENABLE (1<<30)
  680. #define RSR4_GROUP(x) ((x)<<27)
  681. #define RSR4_RBPL_ONLY (1<<26)
  682. /* 2.1.4 transmit packet descriptor */
  683. #define TPD_USERCELL 0x0
  684. #define TPD_SEGMENT_OAMF5 0x4
  685. #define TPD_END2END_OAMF5 0x5
  686. #define TPD_RMCELL 0x6
  687. #define TPD_CELLTYPE(x) (x<<3)
  688. #define TPD_EOS (1<<2)
  689. #define TPD_CLP (1<<1)
  690. #define TPD_INT (1<<0)
  691. #define TPD_LST (1<<31)
  692. /* table 4.3 serial eeprom information */
  693. #define PROD_ID 0x08 /* char[] */
  694. #define PROD_ID_LEN 30
  695. #define HW_REV 0x26 /* char[] */
  696. #define M_SN 0x3a /* integer */
  697. #define MEDIA 0x3e /* integer */
  698. #define HE155MM 0x26
  699. #define HE622MM 0x27
  700. #define HE155SM 0x46
  701. #define HE622SM 0x47
  702. #define MAC_ADDR 0x42 /* char[] */
  703. #define CS_LOW 0x0
  704. #define CS_HIGH ID_CS /* HOST_CNTL_ID_PROM_SEL */
  705. #define CLK_LOW 0x0
  706. #define CLK_HIGH ID_CLOCK /* HOST_CNTL_ID_PROM_CLOCK */
  707. #define SI_HIGH ID_DIN /* HOST_CNTL_ID_PROM_DATA_IN */
  708. #define EEPROM_DELAY 400 /* microseconds */
  709. #endif /* _HE_H_ */