he.h 21 KB

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