Back to home page

OSCL-LXR

 
 

    


0001 /*
0002 
0003   he.h
0004 
0005   ForeRunnerHE ATM Adapter driver for ATM on Linux
0006   Copyright (C) 1999-2001  Naval Research Laboratory
0007 
0008   This library is free software; you can redistribute it and/or
0009   modify it under the terms of the GNU Lesser General Public
0010   License as published by the Free Software Foundation; either
0011   version 2.1 of the License, or (at your option) any later version.
0012 
0013   This library is distributed in the hope that it will be useful,
0014   but WITHOUT ANY WARRANTY; without even the implied warranty of
0015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016   Lesser General Public License for more details.
0017 
0018   You should have received a copy of the GNU Lesser General Public
0019   License along with this library; if not, write to the Free Software
0020   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0021 
0022 */
0023 
0024 /*
0025 
0026   he.h
0027 
0028   ForeRunnerHE ATM Adapter driver for ATM on Linux
0029   Copyright (C) 1999-2000  Naval Research Laboratory
0030 
0031   Permission to use, copy, modify and distribute this software and its
0032   documentation is hereby granted, provided that both the copyright
0033   notice and this permission notice appear in all copies of the software,
0034   derivative works or modified versions, and any portions thereof, and
0035   that both notices appear in supporting documentation.
0036 
0037   NRL ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND
0038   DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
0039   RESULTING FROM THE USE OF THIS SOFTWARE.
0040 
0041  */
0042 
0043 #ifndef _HE_H_
0044 #define _HE_H_
0045 
0046 #define DEV_LABEL       "he"
0047 
0048 #define CONFIG_DEFAULT_VCIBITS  12
0049 #define CONFIG_DEFAULT_VPIBITS  0
0050 
0051 #define CONFIG_IRQ_SIZE     128
0052 #define CONFIG_IRQ_THRESH   (CONFIG_IRQ_SIZE/2)
0053 
0054 #define CONFIG_TPDRQ_SIZE   512
0055 #define TPDRQ_MASK(x)       (((unsigned long)(x))&((CONFIG_TPDRQ_SIZE<<3)-1))
0056 
0057 #define CONFIG_RBRQ_SIZE    512
0058 #define CONFIG_RBRQ_THRESH  400
0059 #define RBRQ_MASK(x)        (((unsigned long)(x))&((CONFIG_RBRQ_SIZE<<3)-1))
0060 
0061 #define CONFIG_TBRQ_SIZE    512
0062 #define CONFIG_TBRQ_THRESH  400
0063 #define TBRQ_MASK(x)        (((unsigned long)(x))&((CONFIG_TBRQ_SIZE<<2)-1))
0064 
0065 #define CONFIG_RBPL_SIZE    512
0066 #define CONFIG_RBPL_THRESH  64
0067 #define CONFIG_RBPL_BUFSIZE 4096
0068 #define RBPL_MASK(x)        (((unsigned long)(x))&((CONFIG_RBPL_SIZE<<3)-1))
0069 
0070 /* 5.1.3 initialize connection memory */
0071 
0072 #define CONFIG_RSRA     0x00000
0073 #define CONFIG_RCMLBM       0x08000
0074 #define CONFIG_RCMABR       0x0d800
0075 #define CONFIG_RSRB     0x0e000
0076 
0077 #define CONFIG_TSRA     0x00000
0078 #define CONFIG_TSRB     0x08000
0079 #define CONFIG_TSRC     0x0c000
0080 #define CONFIG_TSRD     0x0e000
0081 #define CONFIG_TMABR        0x0f000
0082 #define CONFIG_TPDBA        0x10000
0083 
0084 #define HE_MAXCIDBITS       12
0085 
0086 /* 2.9.3.3 interrupt encodings */
0087 
0088 struct he_irq {
0089     volatile u32 isw;
0090 };
0091 
0092 #define IRQ_ALIGNMENT       0x1000
0093 
0094 #define NEXT_ENTRY(base, tail, mask) \
0095                 (((unsigned long)base)|(((unsigned long)(tail+1))&mask))
0096 
0097 #define ITYPE_INVALID       0xffffffff
0098 #define ITYPE_TBRQ_THRESH   (0<<3)
0099 #define ITYPE_TPD_COMPLETE  (1<<3)
0100 #define ITYPE_RBPS_THRESH   (2<<3)
0101 #define ITYPE_RBPL_THRESH   (3<<3)
0102 #define ITYPE_RBRQ_THRESH   (4<<3)
0103 #define ITYPE_RBRQ_TIMER    (5<<3)
0104 #define ITYPE_PHY       (6<<3)
0105 #define ITYPE_OTHER     0x80
0106 #define ITYPE_PARITY        0x81
0107 #define ITYPE_ABORT     0x82
0108 
0109 #define ITYPE_GROUP(x)      (x & 0x7)
0110 #define ITYPE_TYPE(x)       (x & 0xf8)
0111 
0112 #define HE_NUM_GROUPS 8
0113 
0114 /* 2.1.4 transmit packet descriptor */
0115 
0116 struct he_tpd {
0117 
0118     /* read by the adapter */
0119 
0120     volatile u32 status;
0121     volatile u32 reserved;
0122 
0123 #define TPD_MAXIOV  3
0124     struct {
0125         u32 addr, len;
0126     } iovec[TPD_MAXIOV];
0127 
0128 #define address0 iovec[0].addr
0129 #define length0 iovec[0].len
0130 
0131     /* linux-atm extensions */
0132 
0133     struct sk_buff *skb;
0134     struct atm_vcc *vcc;
0135 
0136     struct list_head entry;
0137 };
0138 
0139 #define TPD_ALIGNMENT   64
0140 #define TPD_LEN_MASK    0xffff
0141 
0142 #define TPD_ADDR_SHIFT  6
0143 #define TPD_MASK    0xffffffc0
0144 #define TPD_ADDR(x) ((x) & TPD_MASK)
0145 #define TPD_INDEX(x)    (TPD_ADDR(x) >> TPD_ADDR_SHIFT)
0146 
0147 
0148 /* table 2.3 transmit buffer return elements */
0149 
0150 struct he_tbrq {
0151     volatile u32 tbre;
0152 };
0153 
0154 #define TBRQ_ALIGNMENT  CONFIG_TBRQ_SIZE
0155 
0156 #define TBRQ_TPD(tbrq)      ((tbrq)->tbre & 0xffffffc0)
0157 #define TBRQ_EOS(tbrq)      ((tbrq)->tbre & (1<<3))
0158 #define TBRQ_MULTIPLE(tbrq) ((tbrq)->tbre & (1))
0159 
0160 /* table 2.21 receive buffer return queue element field organization */
0161 
0162 struct he_rbrq {
0163     volatile u32 addr;
0164     volatile u32 cidlen;
0165 };
0166 
0167 #define RBRQ_ALIGNMENT  CONFIG_RBRQ_SIZE
0168 
0169 #define RBRQ_ADDR(rbrq)     ((rbrq)->addr & 0xffffffc0)
0170 #define RBRQ_CRC_ERR(rbrq)  ((rbrq)->addr & (1<<5))
0171 #define RBRQ_LEN_ERR(rbrq)  ((rbrq)->addr & (1<<4))
0172 #define RBRQ_END_PDU(rbrq)  ((rbrq)->addr & (1<<3))
0173 #define RBRQ_AAL5_PROT(rbrq)    ((rbrq)->addr & (1<<2))
0174 #define RBRQ_CON_CLOSED(rbrq)   ((rbrq)->addr & (1<<1))
0175 #define RBRQ_HBUF_ERR(rbrq) ((rbrq)->addr & 1)
0176 #define RBRQ_CID(rbrq)      (((rbrq)->cidlen >> 16) & 0x1fff)
0177 #define RBRQ_BUFLEN(rbrq)   ((rbrq)->cidlen & 0xffff)
0178 
0179 /* figure 2.3 transmit packet descriptor ready queue */
0180 
0181 struct he_tpdrq {
0182     volatile u32 tpd;
0183     volatile u32 cid;
0184 };
0185 
0186 #define TPDRQ_ALIGNMENT CONFIG_TPDRQ_SIZE
0187 
0188 /* table 2.30 host status page detail */
0189 
0190 #define HSP_ALIGNMENT   0x400       /* must align on 1k boundary */
0191 
0192 struct he_hsp {
0193     struct he_hsp_entry {
0194         volatile u32 tbrq_tail; 
0195         volatile u32 reserved1[15];
0196         volatile u32 rbrq_tail; 
0197         volatile u32 reserved2[15];
0198     } group[HE_NUM_GROUPS];
0199 };
0200 
0201 /*
0202  * figure 2.9 receive buffer pools
0203  *
0204  * since a virtual address might be more than 32 bits, we store an index
0205  * in the virt member of he_rbp.  NOTE: the lower six bits in the  rbrq
0206  * addr member are used for buffer status further limiting us to 26 bits.
0207  */
0208 
0209 struct he_rbp {
0210     volatile u32 phys;
0211     volatile u32 idx;   /* virt */
0212 };
0213 
0214 #define RBP_IDX_OFFSET 6
0215 
0216 /*
0217  * the he dma engine will try to hold an extra 16 buffers in its local
0218  * caches.  and add a couple buffers for safety.
0219  */
0220 
0221 #define RBPL_TABLE_SIZE (CONFIG_RBPL_SIZE + 16 + 2)
0222 
0223 struct he_buff {
0224     struct list_head entry;
0225     dma_addr_t mapping;
0226     unsigned long len;
0227     u8 data[];
0228 };
0229 
0230 #ifdef notyet
0231 struct he_group {
0232     u32 rpbl_size, rpbl_qsize;
0233     struct he_rpb_entry *rbpl_ba;
0234 };
0235 #endif
0236 
0237 #define HE_LOOKUP_VCC(dev, cid) ((dev)->he_vcc_table[(cid)].vcc)
0238 
0239 struct he_vcc_table 
0240 {
0241     struct atm_vcc *vcc;
0242 };
0243 
0244 struct he_cs_stper
0245 {
0246     long pcr;
0247     int inuse;
0248 };
0249 
0250 #define HE_NUM_CS_STPER     16
0251 
0252 struct he_dev {
0253     unsigned int number;
0254     unsigned int irq;
0255     void __iomem *membase;
0256 
0257     char prod_id[30];
0258     char mac_addr[6];
0259     int media;
0260 
0261     unsigned int vcibits, vpibits;
0262     unsigned int cells_per_row;
0263     unsigned int bytes_per_row;
0264     unsigned int cells_per_lbuf;
0265     unsigned int r0_numrows, r0_startrow, r0_numbuffs;
0266     unsigned int r1_numrows, r1_startrow, r1_numbuffs;
0267     unsigned int tx_numrows, tx_startrow, tx_numbuffs;
0268     unsigned int buffer_limit;
0269 
0270     struct he_vcc_table *he_vcc_table;
0271 
0272 #ifdef notyet
0273     struct he_group group[HE_NUM_GROUPS];
0274 #endif
0275     struct he_cs_stper cs_stper[HE_NUM_CS_STPER];
0276     unsigned total_bw;
0277 
0278     dma_addr_t irq_phys;
0279     struct he_irq *irq_base, *irq_head, *irq_tail;
0280     volatile unsigned *irq_tailoffset;
0281     int irq_peak;
0282 
0283     struct tasklet_struct tasklet;
0284     struct dma_pool *tpd_pool;
0285     struct list_head outstanding_tpds;
0286 
0287     dma_addr_t tpdrq_phys;
0288     struct he_tpdrq *tpdrq_base, *tpdrq_tail, *tpdrq_head;
0289 
0290     spinlock_t global_lock;     /* 8.1.5 pci transaction ordering
0291                       error problem */
0292     dma_addr_t rbrq_phys;
0293     struct he_rbrq *rbrq_base, *rbrq_head;
0294     int rbrq_peak;
0295 
0296     struct he_buff **rbpl_virt;
0297     unsigned long *rbpl_table;
0298     unsigned long rbpl_hint;
0299     struct dma_pool *rbpl_pool;
0300     dma_addr_t rbpl_phys;
0301     struct he_rbp *rbpl_base, *rbpl_tail;
0302     struct list_head rbpl_outstanding;
0303     int rbpl_peak;
0304 
0305     dma_addr_t tbrq_phys;
0306     struct he_tbrq *tbrq_base, *tbrq_head;
0307     int tbrq_peak;
0308 
0309     dma_addr_t hsp_phys;
0310     struct he_hsp *hsp;
0311 
0312     struct pci_dev *pci_dev;
0313     struct atm_dev *atm_dev;
0314     struct he_dev *next;
0315 };
0316 
0317 #define HE_MAXIOV 20
0318 
0319 struct he_vcc
0320 {
0321     struct list_head buffers;
0322     int pdu_len;
0323     int rc_index;
0324 
0325     wait_queue_head_t rx_waitq;
0326     wait_queue_head_t tx_waitq;
0327 };
0328 
0329 #define HE_VCC(vcc) ((struct he_vcc *)(vcc->dev_data))
0330 
0331 #define PCI_VENDOR_ID_FORE  0x1127
0332 #define PCI_DEVICE_ID_FORE_HE   0x400
0333 
0334 #define GEN_CNTL_0              0x40
0335 #define  INT_PROC_ENBL      (1<<25)
0336 #define  SLAVE_ENDIAN_MODE  (1<<16)
0337 #define  MRL_ENB        (1<<5)
0338 #define  MRM_ENB        (1<<4)
0339 #define  INIT_ENB       (1<<2)
0340 #define  IGNORE_TIMEOUT     (1<<1)
0341 #define  ENBL_64        (1<<0)
0342 
0343 #define MIN_PCI_LATENCY     32  /* errata 8.1.3 */
0344 
0345 #define HE_DEV(dev) ((struct he_dev *) (dev)->dev_data)
0346 
0347 #define he_is622(dev)   ((dev)->media & 0x1)
0348 #define he_isMM(dev)    ((dev)->media & 0x20)
0349 
0350 #define HE_REGMAP_SIZE  0x100000
0351 
0352 #define RESET_CNTL  0x80000
0353 #define  BOARD_RST_STATUS   (1<<6)
0354 
0355 #define HOST_CNTL   0x80004
0356 #define  PCI_BUS_SIZE64         (1<<27)
0357 #define  DESC_RD_STATIC_64      (1<<26)
0358 #define  DATA_RD_STATIC_64      (1<<25)
0359 #define  DATA_WR_STATIC_64      (1<<24)
0360 #define  ID_CS              (1<<12)
0361 #define  ID_WREN            (1<<11)
0362 #define  ID_DOUT            (1<<10)
0363 #define   ID_DOFFSET            10
0364 #define  ID_DIN             (1<<9)
0365 #define  ID_CLOCK           (1<<8)
0366 #define  QUICK_RD_RETRY         (1<<7)
0367 #define  QUICK_WR_RETRY         (1<<6)
0368 #define  OUTFF_ENB          (1<<5)
0369 #define  CMDFF_ENB          (1<<4)
0370 #define  PERR_INT_ENB           (1<<2)
0371 #define  IGNORE_INTR            (1<<0)
0372 
0373 #define LB_SWAP     0x80008
0374 #define  SWAP_RNUM_MAX(x)   (x<<27)
0375 #define  DATA_WR_SWAP       (1<<20)
0376 #define  DESC_RD_SWAP       (1<<19)
0377 #define  DATA_RD_SWAP       (1<<18)
0378 #define  INTR_SWAP      (1<<17)
0379 #define  DESC_WR_SWAP       (1<<16)
0380 #define  SDRAM_INIT     (1<<15)
0381 #define  BIG_ENDIAN_HOST    (1<<14)
0382 #define  XFER_SIZE      (1<<7)
0383 
0384 #define LB_MEM_ADDR 0x8000c
0385 #define LB_MEM_DATA 0x80010
0386 
0387 #define LB_MEM_ACCESS   0x80014
0388 #define  LB_MEM_HNDSHK      (1<<30)
0389 #define  LM_MEM_WRITE       (0x7)
0390 #define  LM_MEM_READ        (0x3)
0391 
0392 #define SDRAM_CTL   0x80018
0393 #define  LB_64_ENB      (1<<3)
0394 #define  LB_TWR         (1<<2)
0395 #define  LB_TRP         (1<<1)
0396 #define  LB_TRAS        (1<<0)
0397 
0398 #define INT_FIFO    0x8001c
0399 #define  INT_MASK_D     (1<<15)
0400 #define  INT_MASK_C     (1<<14)
0401 #define  INT_MASK_B     (1<<13)
0402 #define  INT_MASK_A     (1<<12)
0403 #define  INT_CLEAR_D        (1<<11)
0404 #define  INT_CLEAR_C        (1<<10)
0405 #define  INT_CLEAR_B        (1<<9)
0406 #define  INT_CLEAR_A        (1<<8)
0407 
0408 #define ABORT_ADDR  0x80020
0409 
0410 #define IRQ0_BASE   0x80080
0411 #define  IRQ_BASE(x)        (x<<12)
0412 #define  IRQ_MASK       ((CONFIG_IRQ_SIZE<<2)-1)    /* was 0x3ff */
0413 #define  IRQ_TAIL(x)        (((unsigned long)(x)) & IRQ_MASK)
0414 #define IRQ0_HEAD   0x80084
0415 #define  IRQ_SIZE(x)        (x<<22)
0416 #define  IRQ_THRESH(x)      (x<<12)
0417 #define  IRQ_HEAD(x)        (x<<2)
0418 /* #define  IRQ_PENDING     (1)         conflict with linux/irq.h */
0419 #define IRQ0_CNTL   0x80088
0420 #define  IRQ_ADDRSEL(x)     (x<<2)
0421 #define  IRQ_INT_A      (0<<2)
0422 #define  IRQ_INT_B      (1<<2)
0423 #define  IRQ_INT_C      (2<<2)
0424 #define  IRQ_INT_D      (3<<2)
0425 #define  IRQ_TYPE_ADDR      0x1
0426 #define  IRQ_TYPE_LINE      0x0
0427 #define IRQ0_DATA   0x8008c
0428 
0429 #define IRQ1_BASE   0x80090
0430 #define IRQ1_HEAD   0x80094
0431 #define IRQ1_CNTL   0x80098
0432 #define IRQ1_DATA   0x8009c
0433 
0434 #define IRQ2_BASE   0x800a0
0435 #define IRQ2_HEAD   0x800a4
0436 #define IRQ2_CNTL   0x800a8
0437 #define IRQ2_DATA   0x800ac
0438 
0439 #define IRQ3_BASE   0x800b0
0440 #define IRQ3_HEAD   0x800b4
0441 #define IRQ3_CNTL   0x800b8
0442 #define IRQ3_DATA   0x800bc
0443 
0444 #define GRP_10_MAP  0x800c0
0445 #define GRP_32_MAP  0x800c4
0446 #define GRP_54_MAP  0x800c8
0447 #define GRP_76_MAP  0x800cc
0448 
0449 #define G0_RBPS_S   0x80400
0450 #define G0_RBPS_T   0x80404
0451 #define  RBP_TAIL(x)        ((x)<<3)
0452 #define  RBP_MASK(x)        ((x)|0x1fff)
0453 #define G0_RBPS_QI  0x80408
0454 #define  RBP_QSIZE(x)       ((x)<<14)
0455 #define  RBP_INT_ENB        (1<<13)
0456 #define  RBP_THRESH(x)      (x)
0457 #define G0_RBPS_BS  0x8040c
0458 #define G0_RBPL_S   0x80410
0459 #define G0_RBPL_T   0x80414
0460 #define G0_RBPL_QI  0x80418 
0461 #define G0_RBPL_BS  0x8041c
0462 
0463 #define G1_RBPS_S   0x80420
0464 #define G1_RBPS_T   0x80424
0465 #define G1_RBPS_QI  0x80428
0466 #define G1_RBPS_BS  0x8042c
0467 #define G1_RBPL_S   0x80430
0468 #define G1_RBPL_T   0x80434
0469 #define G1_RBPL_QI  0x80438
0470 #define G1_RBPL_BS  0x8043c
0471 
0472 #define G2_RBPS_S   0x80440
0473 #define G2_RBPS_T   0x80444
0474 #define G2_RBPS_QI  0x80448
0475 #define G2_RBPS_BS  0x8044c
0476 #define G2_RBPL_S   0x80450
0477 #define G2_RBPL_T   0x80454
0478 #define G2_RBPL_QI  0x80458
0479 #define G2_RBPL_BS  0x8045c
0480 
0481 #define G3_RBPS_S   0x80460
0482 #define G3_RBPS_T   0x80464
0483 #define G3_RBPS_QI  0x80468
0484 #define G3_RBPS_BS  0x8046c
0485 #define G3_RBPL_S   0x80470
0486 #define G3_RBPL_T   0x80474
0487 #define G3_RBPL_QI  0x80478
0488 #define G3_RBPL_BS  0x8047c
0489 
0490 #define G4_RBPS_S   0x80480
0491 #define G4_RBPS_T   0x80484
0492 #define G4_RBPS_QI  0x80488
0493 #define G4_RBPS_BS  0x8048c
0494 #define G4_RBPL_S   0x80490
0495 #define G4_RBPL_T   0x80494
0496 #define G4_RBPL_QI  0x80498
0497 #define G4_RBPL_BS  0x8049c
0498 
0499 #define G5_RBPS_S   0x804a0
0500 #define G5_RBPS_T   0x804a4
0501 #define G5_RBPS_QI  0x804a8
0502 #define G5_RBPS_BS  0x804ac
0503 #define G5_RBPL_S   0x804b0
0504 #define G5_RBPL_T   0x804b4
0505 #define G5_RBPL_QI  0x804b8
0506 #define G5_RBPL_BS  0x804bc
0507 
0508 #define G6_RBPS_S   0x804c0
0509 #define G6_RBPS_T   0x804c4
0510 #define G6_RBPS_QI  0x804c8
0511 #define G6_RBPS_BS  0x804cc
0512 #define G6_RBPL_S   0x804d0
0513 #define G6_RBPL_T   0x804d4
0514 #define G6_RBPL_QI  0x804d8
0515 #define G6_RBPL_BS  0x804dc
0516 
0517 #define G7_RBPS_S   0x804e0
0518 #define G7_RBPS_T   0x804e4
0519 #define G7_RBPS_QI  0x804e8
0520 #define G7_RBPS_BS  0x804ec
0521 
0522 #define G7_RBPL_S   0x804f0
0523 #define G7_RBPL_T   0x804f4
0524 #define G7_RBPL_QI  0x804f8
0525 #define G7_RBPL_BS  0x804fc
0526 
0527 #define G0_RBRQ_ST  0x80500
0528 #define G0_RBRQ_H   0x80504
0529 #define G0_RBRQ_Q   0x80508
0530 #define  RBRQ_THRESH(x)     ((x)<<13)
0531 #define  RBRQ_SIZE(x)       (x)
0532 #define G0_RBRQ_I   0x8050c
0533 #define  RBRQ_TIME(x)       ((x)<<8)
0534 #define  RBRQ_COUNT(x)      (x)
0535 
0536 /* fill in 1 ... 7 later */
0537 
0538 #define G0_TBRQ_B_T 0x80600
0539 #define G0_TBRQ_H   0x80604
0540 #define G0_TBRQ_S   0x80608
0541 #define G0_TBRQ_THRESH  0x8060c
0542 #define  TBRQ_THRESH(x)     (x)
0543 
0544 /* fill in 1 ... 7 later */
0545 
0546 #define RH_CONFIG   0x805c0
0547 #define  PHY_INT_ENB    (1<<10)
0548 #define  OAM_GID(x) (x<<7)
0549 #define  PTMR_PRE(x)    (x)
0550 
0551 #define G0_INMQ_S   0x80580
0552 #define G0_INMQ_L   0x80584
0553 #define G1_INMQ_S   0x80588
0554 #define G1_INMQ_L   0x8058c
0555 #define G2_INMQ_S   0x80590
0556 #define G2_INMQ_L   0x80594
0557 #define G3_INMQ_S   0x80598
0558 #define G3_INMQ_L   0x8059c
0559 #define G4_INMQ_S   0x805a0
0560 #define G4_INMQ_L   0x805a4
0561 #define G5_INMQ_S   0x805a8
0562 #define G5_INMQ_L   0x805ac
0563 #define G6_INMQ_S   0x805b0
0564 #define G6_INMQ_L   0x805b4
0565 #define G7_INMQ_S   0x805b8
0566 #define G7_INMQ_L   0x805bc
0567 
0568 #define TPDRQ_B_H   0x80680
0569 #define TPDRQ_T     0x80684
0570 #define TPDRQ_S     0x80688
0571 
0572 #define UBUFF_BA    0x8068c
0573 
0574 #define RLBF0_H     0x806c0
0575 #define RLBF0_T     0x806c4
0576 #define RLBF1_H     0x806c8
0577 #define RLBF1_T     0x806cc
0578 #define RLBC_H      0x806d0
0579 #define RLBC_T      0x806d4
0580 #define RLBC_H2     0x806d8
0581 #define TLBF_H      0x806e0
0582 #define TLBF_T      0x806e4
0583 #define RLBF0_C     0x806e8
0584 #define RLBF1_C     0x806ec
0585 #define RXTHRSH     0x806f0
0586 #define LITHRSH     0x806f4
0587 
0588 #define LBARB       0x80700
0589 #define  SLICE_X(x)      (x<<28)
0590 #define  ARB_RNUM_MAX(x)     (x<<23)
0591 #define  TH_PRTY(x)      (x<<21)
0592 #define  RH_PRTY(x)      (x<<19)
0593 #define  TL_PRTY(x)      (x<<17)
0594 #define  RL_PRTY(x)      (x<<15)
0595 #define  BUS_MULTI(x)        (x<<8)
0596 #define  NET_PREF(x)         (x)
0597 
0598 #define SDRAMCON    0x80704
0599 #define  BANK_ON        (1<<14)
0600 #define  WIDE_DATA      (1<<13)
0601 #define  TWR_WAIT       (1<<12)
0602 #define  TRP_WAIT       (1<<11)
0603 #define  TRAS_WAIT      (1<<10)
0604 #define  REF_RATE(x)        (x)
0605 
0606 #define LBSTAT      0x80708
0607 
0608 #define RCC_STAT    0x8070c
0609 #define  RCC_BUSY       (1)
0610 
0611 #define TCMCONFIG   0x80740
0612 #define  TM_DESL2       (1<<10)
0613 #define  TM_BANK_WAIT(x)    (x<<6)
0614 #define  TM_ADD_BANK4(x)    (x<<4)
0615 #define  TM_PAR_CHECK(x)    (x<<3)
0616 #define  TM_RW_WAIT(x)      (x<<2)
0617 #define  TM_SRAM_TYPE(x)    (x)
0618 
0619 #define TSRB_BA     0x80744 
0620 #define TSRC_BA     0x80748 
0621 #define TMABR_BA    0x8074c 
0622 #define TPD_BA      0x80750 
0623 #define TSRD_BA     0x80758 
0624 
0625 #define TX_CONFIG   0x80760
0626 #define  DRF_THRESH(x)      (x<<22)
0627 #define  TX_UT_MODE(x)      (x<<21)
0628 #define  TX_VCI_MASK(x)     (x<<17)
0629 #define  LBFREE_CNT(x)      (x)
0630 
0631 #define TXAAL5_PROTO    0x80764
0632 #define  CPCS_UU(x)     (x<<8)
0633 #define  CPI(x)         (x)
0634 
0635 #define RCMCONFIG   0x80780
0636 #define  RM_DESL2(x)        (x<<10)
0637 #define  RM_BANK_WAIT(x)    (x<<6)
0638 #define  RM_ADD_BANK(x)     (x<<4)
0639 #define  RM_PAR_CHECK(x)    (x<<3)
0640 #define  RM_RW_WAIT(x)      (x<<2)
0641 #define  RM_SRAM_TYPE(x)    (x)
0642 
0643 #define RCMRSRB_BA  0x80784
0644 #define RCMLBM_BA   0x80788
0645 #define RCMABR_BA   0x8078c
0646 
0647 #define RC_CONFIG   0x807c0
0648 #define  UT_RD_DELAY(x)     (x<<11)
0649 #define  WRAP_MODE(x)       (x<<10)
0650 #define  RC_UT_MODE(x)      (x<<9)
0651 #define  RX_ENABLE      (1<<8)
0652 #define  RX_VALVP(x)        (x<<4)
0653 #define  RX_VALVC(x)        (x)
0654 
0655 #define MCC     0x807c4
0656 #define OEC     0x807c8
0657 #define DCC     0x807cc
0658 #define CEC     0x807d0
0659 
0660 #define HSP_BA      0x807f0
0661 
0662 #define LB_CONFIG   0x807f4
0663 #define  LB_SIZE(x)     (x)
0664 
0665 #define CON_DAT     0x807f8
0666 #define CON_CTL     0x807fc
0667 #define  CON_CTL_MBOX       (2<<30)
0668 #define  CON_CTL_TCM        (1<<30)
0669 #define  CON_CTL_RCM        (0<<30)
0670 #define  CON_CTL_WRITE      (1<<29)
0671 #define  CON_CTL_READ       (0<<29)
0672 #define  CON_CTL_BUSY       (1<<28)
0673 #define  CON_BYTE_DISABLE_3 (1<<22)     /* 24..31 */
0674 #define  CON_BYTE_DISABLE_2 (1<<21)     /* 16..23 */
0675 #define  CON_BYTE_DISABLE_1 (1<<20)     /* 8..15 */
0676 #define  CON_BYTE_DISABLE_0 (1<<19)     /* 0..7 */
0677 #define  CON_CTL_ADDR(x)    (x)
0678 
0679 #define FRAMER      0x80800     /* to 0x80bfc */
0680 
0681 /* 3.3 network controller (internal) mailbox registers */
0682 
0683 #define CS_STPER0   0x0
0684     /* ... */
0685 #define CS_STPER31  0x01f
0686 
0687 #define CS_STTIM0   0x020
0688     /* ... */
0689 #define CS_STTIM31  0x03f
0690 
0691 #define CS_TGRLD0   0x040
0692     /* ... */
0693 #define CS_TGRLD15  0x04f
0694 
0695 #define CS_ERTHR0   0x050
0696 #define CS_ERTHR1   0x051
0697 #define CS_ERTHR2   0x052
0698 #define CS_ERTHR3   0x053
0699 #define CS_ERTHR4   0x054
0700 #define CS_ERCTL0   0x055
0701 #define  TX_ENABLE      (1<<28)
0702 #define  ER_ENABLE      (1<<27)
0703 #define CS_ERCTL1   0x056
0704 #define CS_ERCTL2   0x057
0705 #define CS_ERSTAT0  0x058
0706 #define CS_ERSTAT1  0x059
0707 
0708 #define CS_RTCCT    0x060
0709 #define CS_RTFWC    0x061
0710 #define CS_RTFWR    0x062
0711 #define CS_RTFTC    0x063
0712 #define CS_RTATR    0x064
0713 
0714 #define CS_TFBSET   0x070
0715 #define CS_TFBADD   0x071
0716 #define CS_TFBSUB   0x072
0717 #define CS_WCRMAX   0x073
0718 #define CS_WCRMIN   0x074
0719 #define CS_WCRINC   0x075
0720 #define CS_WCRDEC   0x076
0721 #define CS_WCRCEIL  0x077
0722 #define CS_BWDCNT   0x078
0723 
0724 #define CS_OTPPER   0x080
0725 #define CS_OTWPER   0x081
0726 #define CS_OTTLIM   0x082
0727 #define CS_OTTCNT   0x083
0728 
0729 #define CS_HGRRT0   0x090
0730     /* ... */
0731 #define CS_HGRRT7   0x097
0732 
0733 #define CS_ORPTRS   0x0a0
0734 
0735 #define RXCON_CLOSE 0x100
0736 
0737 
0738 #define RCM_MEM_SIZE    0x10000     /* 1M of 32-bit registers */
0739 #define TCM_MEM_SIZE    0x20000     /* 2M of 32-bit registers */
0740 
0741 /* 2.5 transmit connection memory registers */
0742 
0743 #define TSR0_CONN_STATE(x)  ((x>>28) & 0x7)
0744 #define TSR0_USE_WMIN       (1<<23)
0745 #define TSR0_GROUP(x)       ((x & 0x7)<<18)
0746 #define TSR0_ABR        (2<<16)
0747 #define TSR0_UBR        (1<<16)
0748 #define TSR0_CBR        (0<<16)
0749 #define TSR0_PROT       (1<<15)
0750 #define TSR0_AAL0_SDU       (2<<12)
0751 #define TSR0_AAL0       (1<<12)
0752 #define TSR0_AAL5       (0<<12)
0753 #define TSR0_HALT_ER        (1<<11)
0754 #define TSR0_MARK_CI        (1<<10)
0755 #define TSR0_MARK_ER        (1<<9)
0756 #define TSR0_UPDATE_GER     (1<<8)
0757 #define TSR0_RC_INDEX(x)    (x & 0x1F)
0758 
0759 #define TSR1_PCR(x)     ((x & 0x7FFF)<<16)
0760 #define TSR1_MCR(x)     (x & 0x7FFF)
0761 
0762 #define TSR2_ACR(x)     ((x & 0x7FFF)<<16)
0763 
0764 #define TSR3_NRM_CNT(x)     ((x & 0xFF)<<24)
0765 #define TSR3_CRM_CNT(x)     (x & 0xFFFF)
0766 
0767 #define TSR4_FLUSH_CONN     (1<<31)
0768 #define TSR4_SESSION_ENDED  (1<<30)
0769 #define TSR4_CRC10      (1<<28)
0770 #define TSR4_NULL_CRC10     (1<<27)
0771 #define TSR4_PROT       (1<<26)
0772 #define TSR4_AAL0_SDU       (2<<23)
0773 #define TSR4_AAL0       (1<<23)
0774 #define TSR4_AAL5       (0<<23)
0775 
0776 #define TSR9_OPEN_CONN      (1<<20)
0777 
0778 #define TSR11_ICR(x)        ((x & 0x7FFF)<<16)
0779 #define TSR11_TRM(x)        ((x & 0x7)<<13)
0780 #define TSR11_NRM(x)        ((x & 0x7)<<10)
0781 #define TSR11_ADTF(x)       (x & 0x3FF)
0782 
0783 #define TSR13_RDF(x)        ((x & 0xF)<<23)
0784 #define TSR13_RIF(x)        ((x & 0xF)<<19)
0785 #define TSR13_CDF(x)        ((x & 0x7)<<16)
0786 #define TSR13_CRM(x)        (x & 0xFFFF)
0787 
0788 #define TSR14_DELETE        (1<<31)
0789 #define TSR14_ABR_CLOSE     (1<<16)
0790 
0791 /* 2.7.1 per connection receieve state registers */
0792 
0793 #define RSR0_START_PDU  (1<<10)
0794 #define RSR0_OPEN_CONN  (1<<6)
0795 #define RSR0_CLOSE_CONN (0<<6)
0796 #define RSR0_PPD_ENABLE (1<<5)
0797 #define RSR0_EPD_ENABLE (1<<4)
0798 #define RSR0_TCP_CKSUM  (1<<3)
0799 #define RSR0_AAL5       (0)
0800 #define RSR0_AAL0       (1)
0801 #define RSR0_AAL0_SDU       (2)
0802 #define RSR0_RAWCELL        (3)
0803 #define RSR0_RAWCELL_CRC10  (4)
0804 
0805 #define RSR1_AQI_ENABLE (1<<20)
0806 #define RSR1_RBPL_ONLY  (1<<19)
0807 #define RSR1_GROUP(x)   ((x)<<16)
0808 
0809 #define RSR4_AQI_ENABLE (1<<30)
0810 #define RSR4_GROUP(x)   ((x)<<27)
0811 #define RSR4_RBPL_ONLY  (1<<26)
0812 
0813 /* 2.1.4 transmit packet descriptor */
0814 
0815 #define TPD_USERCELL        0x0
0816 #define TPD_SEGMENT_OAMF5   0x4
0817 #define TPD_END2END_OAMF5   0x5
0818 #define TPD_RMCELL      0x6
0819 #define TPD_CELLTYPE(x)     (x<<3)
0820 #define TPD_EOS         (1<<2)
0821 #define TPD_CLP         (1<<1)
0822 #define TPD_INT         (1<<0)
0823 #define TPD_LST     (1<<31)
0824 
0825 /* table 4.3 serial eeprom information */
0826 
0827 #define PROD_ID     0x08    /* char[] */
0828 #define  PROD_ID_LEN    30
0829 #define HW_REV      0x26    /* char[] */
0830 #define M_SN        0x3a    /* integer */
0831 #define MEDIA       0x3e    /* integer */
0832 #define  HE155MM    0x26
0833 #define  HE622MM    0x27
0834 #define  HE155SM    0x46
0835 #define  HE622SM    0x47
0836 #define MAC_ADDR    0x42    /* char[] */
0837 
0838 #define CS_LOW      0x0
0839 #define CS_HIGH     ID_CS /* HOST_CNTL_ID_PROM_SEL */
0840 #define CLK_LOW     0x0
0841 #define CLK_HIGH    ID_CLOCK /* HOST_CNTL_ID_PROM_CLOCK */
0842 #define SI_HIGH     ID_DIN /* HOST_CNTL_ID_PROM_DATA_IN */
0843 #define EEPROM_DELAY    400 /* microseconds */
0844 
0845 #endif /* _HE_H_ */