18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _FORE200E_H 38c2ecf20Sopenharmony_ci#define _FORE200E_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#ifdef __KERNEL__ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci/* rx buffer sizes */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define SMALL_BUFFER_SIZE 384 /* size of small buffers (multiple of 48 (PCA) and 64 (SBA) bytes) */ 108c2ecf20Sopenharmony_ci#define LARGE_BUFFER_SIZE 4032 /* size of large buffers (multiple of 48 (PCA) and 64 (SBA) bytes) */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define RBD_BLK_SIZE 32 /* nbr of supplied rx buffers per rbd */ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#define MAX_PDU_SIZE 65535 /* maximum PDU size supported by AALs */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define BUFFER_S1_SIZE SMALL_BUFFER_SIZE /* size of small buffers, scheme 1 */ 208c2ecf20Sopenharmony_ci#define BUFFER_L1_SIZE LARGE_BUFFER_SIZE /* size of large buffers, scheme 1 */ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define BUFFER_S2_SIZE SMALL_BUFFER_SIZE /* size of small buffers, scheme 2 */ 238c2ecf20Sopenharmony_ci#define BUFFER_L2_SIZE LARGE_BUFFER_SIZE /* size of large buffers, scheme 2 */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define BUFFER_S1_NBR (RBD_BLK_SIZE * 6) 268c2ecf20Sopenharmony_ci#define BUFFER_L1_NBR (RBD_BLK_SIZE * 4) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define BUFFER_S2_NBR (RBD_BLK_SIZE * 6) 298c2ecf20Sopenharmony_ci#define BUFFER_L2_NBR (RBD_BLK_SIZE * 4) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define QUEUE_SIZE_CMD 16 /* command queue capacity */ 338c2ecf20Sopenharmony_ci#define QUEUE_SIZE_RX 64 /* receive queue capacity */ 348c2ecf20Sopenharmony_ci#define QUEUE_SIZE_TX 256 /* transmit queue capacity */ 358c2ecf20Sopenharmony_ci#define QUEUE_SIZE_BS 32 /* buffer supply queue capacity */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define FORE200E_VPI_BITS 0 388c2ecf20Sopenharmony_ci#define FORE200E_VCI_BITS 10 398c2ecf20Sopenharmony_ci#define NBR_CONNECT (1 << (FORE200E_VPI_BITS + FORE200E_VCI_BITS)) /* number of connections */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define TSD_FIXED 2 438c2ecf20Sopenharmony_ci#define TSD_EXTENSION 0 448c2ecf20Sopenharmony_ci#define TSD_NBR (TSD_FIXED + TSD_EXTENSION) 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/* the cp starts putting a received PDU into one *small* buffer, 488c2ecf20Sopenharmony_ci then it uses a number of *large* buffers for the trailing data. 498c2ecf20Sopenharmony_ci we compute here the total number of receive segment descriptors 508c2ecf20Sopenharmony_ci required to hold the largest possible PDU */ 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define RSD_REQUIRED (((MAX_PDU_SIZE - SMALL_BUFFER_SIZE + LARGE_BUFFER_SIZE) / LARGE_BUFFER_SIZE) + 1) 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define RSD_FIXED 3 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* RSD_REQUIRED receive segment descriptors are enough to describe a max-sized PDU, 578c2ecf20Sopenharmony_ci but we have to keep the size of the receive PDU descriptor multiple of 32 bytes, 588c2ecf20Sopenharmony_ci so we add one extra RSD to RSD_EXTENSION 598c2ecf20Sopenharmony_ci (WARNING: THIS MAY CHANGE IF BUFFER SIZES ARE MODIFIED) */ 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#define RSD_EXTENSION ((RSD_REQUIRED - RSD_FIXED) + 1) 628c2ecf20Sopenharmony_ci#define RSD_NBR (RSD_FIXED + RSD_EXTENSION) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define FORE200E_DEV(d) ((struct fore200e*)((d)->dev_data)) 668c2ecf20Sopenharmony_ci#define FORE200E_VCC(d) ((struct fore200e_vcc*)((d)->dev_data)) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/* bitfields endian games */ 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#if defined(__LITTLE_ENDIAN_BITFIELD) 718c2ecf20Sopenharmony_ci#define BITFIELD2(b1, b2) b1; b2; 728c2ecf20Sopenharmony_ci#define BITFIELD3(b1, b2, b3) b1; b2; b3; 738c2ecf20Sopenharmony_ci#define BITFIELD4(b1, b2, b3, b4) b1; b2; b3; b4; 748c2ecf20Sopenharmony_ci#define BITFIELD5(b1, b2, b3, b4, b5) b1; b2; b3; b4; b5; 758c2ecf20Sopenharmony_ci#define BITFIELD6(b1, b2, b3, b4, b5, b6) b1; b2; b3; b4; b5; b6; 768c2ecf20Sopenharmony_ci#elif defined(__BIG_ENDIAN_BITFIELD) 778c2ecf20Sopenharmony_ci#define BITFIELD2(b1, b2) b2; b1; 788c2ecf20Sopenharmony_ci#define BITFIELD3(b1, b2, b3) b3; b2; b1; 798c2ecf20Sopenharmony_ci#define BITFIELD4(b1, b2, b3, b4) b4; b3; b2; b1; 808c2ecf20Sopenharmony_ci#define BITFIELD5(b1, b2, b3, b4, b5) b5; b4; b3; b2; b1; 818c2ecf20Sopenharmony_ci#define BITFIELD6(b1, b2, b3, b4, b5, b6) b6; b5; b4; b3; b2; b1; 828c2ecf20Sopenharmony_ci#else 838c2ecf20Sopenharmony_ci#error unknown bitfield endianess 848c2ecf20Sopenharmony_ci#endif 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci/* ATM cell header (minus HEC byte) */ 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_citypedef struct atm_header { 908c2ecf20Sopenharmony_ci BITFIELD5( 918c2ecf20Sopenharmony_ci u32 clp : 1, /* cell loss priority */ 928c2ecf20Sopenharmony_ci u32 plt : 3, /* payload type */ 938c2ecf20Sopenharmony_ci u32 vci : 16, /* virtual channel identifier */ 948c2ecf20Sopenharmony_ci u32 vpi : 8, /* virtual path identifier */ 958c2ecf20Sopenharmony_ci u32 gfc : 4 /* generic flow control */ 968c2ecf20Sopenharmony_ci ) 978c2ecf20Sopenharmony_ci} atm_header_t; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci/* ATM adaptation layer id */ 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_citypedef enum fore200e_aal { 1038c2ecf20Sopenharmony_ci FORE200E_AAL0 = 0, 1048c2ecf20Sopenharmony_ci FORE200E_AAL34 = 4, 1058c2ecf20Sopenharmony_ci FORE200E_AAL5 = 5, 1068c2ecf20Sopenharmony_ci} fore200e_aal_t; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci/* transmit PDU descriptor specification */ 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_citypedef struct tpd_spec { 1128c2ecf20Sopenharmony_ci BITFIELD4( 1138c2ecf20Sopenharmony_ci u32 length : 16, /* total PDU length */ 1148c2ecf20Sopenharmony_ci u32 nseg : 8, /* number of transmit segments */ 1158c2ecf20Sopenharmony_ci enum fore200e_aal aal : 4, /* adaptation layer */ 1168c2ecf20Sopenharmony_ci u32 intr : 4 /* interrupt requested */ 1178c2ecf20Sopenharmony_ci ) 1188c2ecf20Sopenharmony_ci} tpd_spec_t; 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci/* transmit PDU rate control */ 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_citypedef struct tpd_rate 1248c2ecf20Sopenharmony_ci{ 1258c2ecf20Sopenharmony_ci BITFIELD2( 1268c2ecf20Sopenharmony_ci u32 idle_cells : 16, /* number of idle cells to insert */ 1278c2ecf20Sopenharmony_ci u32 data_cells : 16 /* number of data cells to transmit */ 1288c2ecf20Sopenharmony_ci ) 1298c2ecf20Sopenharmony_ci} tpd_rate_t; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci/* transmit segment descriptor */ 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_citypedef struct tsd { 1358c2ecf20Sopenharmony_ci u32 buffer; /* transmit buffer DMA address */ 1368c2ecf20Sopenharmony_ci u32 length; /* number of bytes in buffer */ 1378c2ecf20Sopenharmony_ci} tsd_t; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci/* transmit PDU descriptor */ 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_citypedef struct tpd { 1438c2ecf20Sopenharmony_ci struct atm_header atm_header; /* ATM header minus HEC byte */ 1448c2ecf20Sopenharmony_ci struct tpd_spec spec; /* tpd specification */ 1458c2ecf20Sopenharmony_ci struct tpd_rate rate; /* tpd rate control */ 1468c2ecf20Sopenharmony_ci u32 pad; /* reserved */ 1478c2ecf20Sopenharmony_ci struct tsd tsd[ TSD_NBR ]; /* transmit segment descriptors */ 1488c2ecf20Sopenharmony_ci} tpd_t; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci/* receive segment descriptor */ 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_citypedef struct rsd { 1548c2ecf20Sopenharmony_ci u32 handle; /* host supplied receive buffer handle */ 1558c2ecf20Sopenharmony_ci u32 length; /* number of bytes in buffer */ 1568c2ecf20Sopenharmony_ci} rsd_t; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci/* receive PDU descriptor */ 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_citypedef struct rpd { 1628c2ecf20Sopenharmony_ci struct atm_header atm_header; /* ATM header minus HEC byte */ 1638c2ecf20Sopenharmony_ci u32 nseg; /* number of receive segments */ 1648c2ecf20Sopenharmony_ci struct rsd rsd[ RSD_NBR ]; /* receive segment descriptors */ 1658c2ecf20Sopenharmony_ci} rpd_t; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci/* buffer scheme */ 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_citypedef enum buffer_scheme { 1718c2ecf20Sopenharmony_ci BUFFER_SCHEME_ONE, 1728c2ecf20Sopenharmony_ci BUFFER_SCHEME_TWO, 1738c2ecf20Sopenharmony_ci BUFFER_SCHEME_NBR /* always last */ 1748c2ecf20Sopenharmony_ci} buffer_scheme_t; 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci/* buffer magnitude */ 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_citypedef enum buffer_magn { 1808c2ecf20Sopenharmony_ci BUFFER_MAGN_SMALL, 1818c2ecf20Sopenharmony_ci BUFFER_MAGN_LARGE, 1828c2ecf20Sopenharmony_ci BUFFER_MAGN_NBR /* always last */ 1838c2ecf20Sopenharmony_ci} buffer_magn_t; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci/* receive buffer descriptor */ 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_citypedef struct rbd { 1898c2ecf20Sopenharmony_ci u32 handle; /* host supplied handle */ 1908c2ecf20Sopenharmony_ci u32 buffer_haddr; /* host DMA address of host buffer */ 1918c2ecf20Sopenharmony_ci} rbd_t; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci/* receive buffer descriptor block */ 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_citypedef struct rbd_block { 1978c2ecf20Sopenharmony_ci struct rbd rbd[ RBD_BLK_SIZE ]; /* receive buffer descriptor */ 1988c2ecf20Sopenharmony_ci} rbd_block_t; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* tpd DMA address */ 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_citypedef struct tpd_haddr { 2048c2ecf20Sopenharmony_ci BITFIELD3( 2058c2ecf20Sopenharmony_ci u32 size : 4, /* tpd size expressed in 32 byte blocks */ 2068c2ecf20Sopenharmony_ci u32 pad : 1, /* reserved */ 2078c2ecf20Sopenharmony_ci u32 haddr : 27 /* tpd DMA addr aligned on 32 byte boundary */ 2088c2ecf20Sopenharmony_ci ) 2098c2ecf20Sopenharmony_ci} tpd_haddr_t; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci#define TPD_HADDR_SHIFT 5 /* addr aligned on 32 byte boundary */ 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci/* cp resident transmit queue entry */ 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_citypedef struct cp_txq_entry { 2168c2ecf20Sopenharmony_ci struct tpd_haddr tpd_haddr; /* host DMA address of tpd */ 2178c2ecf20Sopenharmony_ci u32 status_haddr; /* host DMA address of completion status */ 2188c2ecf20Sopenharmony_ci} cp_txq_entry_t; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci/* cp resident receive queue entry */ 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_citypedef struct cp_rxq_entry { 2248c2ecf20Sopenharmony_ci u32 rpd_haddr; /* host DMA address of rpd */ 2258c2ecf20Sopenharmony_ci u32 status_haddr; /* host DMA address of completion status */ 2268c2ecf20Sopenharmony_ci} cp_rxq_entry_t; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci/* cp resident buffer supply queue entry */ 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_citypedef struct cp_bsq_entry { 2328c2ecf20Sopenharmony_ci u32 rbd_block_haddr; /* host DMA address of rbd block */ 2338c2ecf20Sopenharmony_ci u32 status_haddr; /* host DMA address of completion status */ 2348c2ecf20Sopenharmony_ci} cp_bsq_entry_t; 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci/* completion status */ 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_citypedef volatile enum status { 2408c2ecf20Sopenharmony_ci STATUS_PENDING = (1<<0), /* initial status (written by host) */ 2418c2ecf20Sopenharmony_ci STATUS_COMPLETE = (1<<1), /* completion status (written by cp) */ 2428c2ecf20Sopenharmony_ci STATUS_FREE = (1<<2), /* initial status (written by host) */ 2438c2ecf20Sopenharmony_ci STATUS_ERROR = (1<<3) /* completion status (written by cp) */ 2448c2ecf20Sopenharmony_ci} status_t; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci/* cp operation code */ 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_citypedef enum opcode { 2508c2ecf20Sopenharmony_ci OPCODE_INITIALIZE = 1, /* initialize board */ 2518c2ecf20Sopenharmony_ci OPCODE_ACTIVATE_VCIN, /* activate incoming VCI */ 2528c2ecf20Sopenharmony_ci OPCODE_ACTIVATE_VCOUT, /* activate outgoing VCI */ 2538c2ecf20Sopenharmony_ci OPCODE_DEACTIVATE_VCIN, /* deactivate incoming VCI */ 2548c2ecf20Sopenharmony_ci OPCODE_DEACTIVATE_VCOUT, /* deactivate incoing VCI */ 2558c2ecf20Sopenharmony_ci OPCODE_GET_STATS, /* get board statistics */ 2568c2ecf20Sopenharmony_ci OPCODE_SET_OC3, /* set OC-3 registers */ 2578c2ecf20Sopenharmony_ci OPCODE_GET_OC3, /* get OC-3 registers */ 2588c2ecf20Sopenharmony_ci OPCODE_RESET_STATS, /* reset board statistics */ 2598c2ecf20Sopenharmony_ci OPCODE_GET_PROM, /* get expansion PROM data (PCI specific) */ 2608c2ecf20Sopenharmony_ci OPCODE_SET_VPI_BITS, /* set x bits of those decoded by the 2618c2ecf20Sopenharmony_ci firmware to be low order bits from 2628c2ecf20Sopenharmony_ci the VPI field of the ATM cell header */ 2638c2ecf20Sopenharmony_ci OPCODE_REQUEST_INTR = (1<<7) /* request interrupt */ 2648c2ecf20Sopenharmony_ci} opcode_t; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci/* virtual path / virtual channel identifiers */ 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_citypedef struct vpvc { 2708c2ecf20Sopenharmony_ci BITFIELD3( 2718c2ecf20Sopenharmony_ci u32 vci : 16, /* virtual channel identifier */ 2728c2ecf20Sopenharmony_ci u32 vpi : 8, /* virtual path identifier */ 2738c2ecf20Sopenharmony_ci u32 pad : 8 /* reserved */ 2748c2ecf20Sopenharmony_ci ) 2758c2ecf20Sopenharmony_ci} vpvc_t; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci/* activate VC command opcode */ 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_citypedef struct activate_opcode { 2818c2ecf20Sopenharmony_ci BITFIELD4( 2828c2ecf20Sopenharmony_ci enum opcode opcode : 8, /* cp opcode */ 2838c2ecf20Sopenharmony_ci enum fore200e_aal aal : 8, /* adaptation layer */ 2848c2ecf20Sopenharmony_ci enum buffer_scheme scheme : 8, /* buffer scheme */ 2858c2ecf20Sopenharmony_ci u32 pad : 8 /* reserved */ 2868c2ecf20Sopenharmony_ci ) 2878c2ecf20Sopenharmony_ci} activate_opcode_t; 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci/* activate VC command block */ 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_citypedef struct activate_block { 2938c2ecf20Sopenharmony_ci struct activate_opcode opcode; /* activate VC command opcode */ 2948c2ecf20Sopenharmony_ci struct vpvc vpvc; /* VPI/VCI */ 2958c2ecf20Sopenharmony_ci u32 mtu; /* for AAL0 only */ 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci} activate_block_t; 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci/* deactivate VC command opcode */ 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_citypedef struct deactivate_opcode { 3038c2ecf20Sopenharmony_ci BITFIELD2( 3048c2ecf20Sopenharmony_ci enum opcode opcode : 8, /* cp opcode */ 3058c2ecf20Sopenharmony_ci u32 pad : 24 /* reserved */ 3068c2ecf20Sopenharmony_ci ) 3078c2ecf20Sopenharmony_ci} deactivate_opcode_t; 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci/* deactivate VC command block */ 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_citypedef struct deactivate_block { 3138c2ecf20Sopenharmony_ci struct deactivate_opcode opcode; /* deactivate VC command opcode */ 3148c2ecf20Sopenharmony_ci struct vpvc vpvc; /* VPI/VCI */ 3158c2ecf20Sopenharmony_ci} deactivate_block_t; 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci/* OC-3 registers */ 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_citypedef struct oc3_regs { 3218c2ecf20Sopenharmony_ci u32 reg[ 128 ]; /* see the PMC Sierra PC5346 S/UNI-155-Lite 3228c2ecf20Sopenharmony_ci Saturn User Network Interface documentation 3238c2ecf20Sopenharmony_ci for a description of the OC-3 chip registers */ 3248c2ecf20Sopenharmony_ci} oc3_regs_t; 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci/* set/get OC-3 regs command opcode */ 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_citypedef struct oc3_opcode { 3308c2ecf20Sopenharmony_ci BITFIELD4( 3318c2ecf20Sopenharmony_ci enum opcode opcode : 8, /* cp opcode */ 3328c2ecf20Sopenharmony_ci u32 reg : 8, /* register index */ 3338c2ecf20Sopenharmony_ci u32 value : 8, /* register value */ 3348c2ecf20Sopenharmony_ci u32 mask : 8 /* register mask that specifies which 3358c2ecf20Sopenharmony_ci bits of the register value field 3368c2ecf20Sopenharmony_ci are significant */ 3378c2ecf20Sopenharmony_ci ) 3388c2ecf20Sopenharmony_ci} oc3_opcode_t; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ci/* set/get OC-3 regs command block */ 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_citypedef struct oc3_block { 3448c2ecf20Sopenharmony_ci struct oc3_opcode opcode; /* set/get OC-3 regs command opcode */ 3458c2ecf20Sopenharmony_ci u32 regs_haddr; /* host DMA address of OC-3 regs buffer */ 3468c2ecf20Sopenharmony_ci} oc3_block_t; 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci/* physical encoding statistics */ 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_citypedef struct stats_phy { 3528c2ecf20Sopenharmony_ci __be32 crc_header_errors; /* cells received with bad header CRC */ 3538c2ecf20Sopenharmony_ci __be32 framing_errors; /* cells received with bad framing */ 3548c2ecf20Sopenharmony_ci __be32 pad[ 2 ]; /* i960 padding */ 3558c2ecf20Sopenharmony_ci} stats_phy_t; 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci/* OC-3 statistics */ 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_citypedef struct stats_oc3 { 3618c2ecf20Sopenharmony_ci __be32 section_bip8_errors; /* section 8 bit interleaved parity */ 3628c2ecf20Sopenharmony_ci __be32 path_bip8_errors; /* path 8 bit interleaved parity */ 3638c2ecf20Sopenharmony_ci __be32 line_bip24_errors; /* line 24 bit interleaved parity */ 3648c2ecf20Sopenharmony_ci __be32 line_febe_errors; /* line far end block errors */ 3658c2ecf20Sopenharmony_ci __be32 path_febe_errors; /* path far end block errors */ 3668c2ecf20Sopenharmony_ci __be32 corr_hcs_errors; /* correctable header check sequence */ 3678c2ecf20Sopenharmony_ci __be32 ucorr_hcs_errors; /* uncorrectable header check sequence */ 3688c2ecf20Sopenharmony_ci __be32 pad[ 1 ]; /* i960 padding */ 3698c2ecf20Sopenharmony_ci} stats_oc3_t; 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci/* ATM statistics */ 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_citypedef struct stats_atm { 3758c2ecf20Sopenharmony_ci __be32 cells_transmitted; /* cells transmitted */ 3768c2ecf20Sopenharmony_ci __be32 cells_received; /* cells received */ 3778c2ecf20Sopenharmony_ci __be32 vpi_bad_range; /* cell drops: VPI out of range */ 3788c2ecf20Sopenharmony_ci __be32 vpi_no_conn; /* cell drops: no connection for VPI */ 3798c2ecf20Sopenharmony_ci __be32 vci_bad_range; /* cell drops: VCI out of range */ 3808c2ecf20Sopenharmony_ci __be32 vci_no_conn; /* cell drops: no connection for VCI */ 3818c2ecf20Sopenharmony_ci __be32 pad[ 2 ]; /* i960 padding */ 3828c2ecf20Sopenharmony_ci} stats_atm_t; 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci/* AAL0 statistics */ 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_citypedef struct stats_aal0 { 3878c2ecf20Sopenharmony_ci __be32 cells_transmitted; /* cells transmitted */ 3888c2ecf20Sopenharmony_ci __be32 cells_received; /* cells received */ 3898c2ecf20Sopenharmony_ci __be32 cells_dropped; /* cells dropped */ 3908c2ecf20Sopenharmony_ci __be32 pad[ 1 ]; /* i960 padding */ 3918c2ecf20Sopenharmony_ci} stats_aal0_t; 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci/* AAL3/4 statistics */ 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_citypedef struct stats_aal34 { 3978c2ecf20Sopenharmony_ci __be32 cells_transmitted; /* cells transmitted from segmented PDUs */ 3988c2ecf20Sopenharmony_ci __be32 cells_received; /* cells reassembled into PDUs */ 3998c2ecf20Sopenharmony_ci __be32 cells_crc_errors; /* payload CRC error count */ 4008c2ecf20Sopenharmony_ci __be32 cells_protocol_errors; /* SAR or CS layer protocol errors */ 4018c2ecf20Sopenharmony_ci __be32 cells_dropped; /* cells dropped: partial reassembly */ 4028c2ecf20Sopenharmony_ci __be32 cspdus_transmitted; /* CS PDUs transmitted */ 4038c2ecf20Sopenharmony_ci __be32 cspdus_received; /* CS PDUs received */ 4048c2ecf20Sopenharmony_ci __be32 cspdus_protocol_errors; /* CS layer protocol errors */ 4058c2ecf20Sopenharmony_ci __be32 cspdus_dropped; /* reassembled PDUs drop'd (in cells) */ 4068c2ecf20Sopenharmony_ci __be32 pad[ 3 ]; /* i960 padding */ 4078c2ecf20Sopenharmony_ci} stats_aal34_t; 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci 4108c2ecf20Sopenharmony_ci/* AAL5 statistics */ 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_citypedef struct stats_aal5 { 4138c2ecf20Sopenharmony_ci __be32 cells_transmitted; /* cells transmitted from segmented SDUs */ 4148c2ecf20Sopenharmony_ci __be32 cells_received; /* cells reassembled into SDUs */ 4158c2ecf20Sopenharmony_ci __be32 cells_dropped; /* reassembled PDUs dropped (in cells) */ 4168c2ecf20Sopenharmony_ci __be32 congestion_experienced; /* CRC error and length wrong */ 4178c2ecf20Sopenharmony_ci __be32 cspdus_transmitted; /* CS PDUs transmitted */ 4188c2ecf20Sopenharmony_ci __be32 cspdus_received; /* CS PDUs received */ 4198c2ecf20Sopenharmony_ci __be32 cspdus_crc_errors; /* CS PDUs CRC errors */ 4208c2ecf20Sopenharmony_ci __be32 cspdus_protocol_errors; /* CS layer protocol errors */ 4218c2ecf20Sopenharmony_ci __be32 cspdus_dropped; /* reassembled PDUs dropped */ 4228c2ecf20Sopenharmony_ci __be32 pad[ 3 ]; /* i960 padding */ 4238c2ecf20Sopenharmony_ci} stats_aal5_t; 4248c2ecf20Sopenharmony_ci 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci/* auxiliary statistics */ 4278c2ecf20Sopenharmony_ci 4288c2ecf20Sopenharmony_citypedef struct stats_aux { 4298c2ecf20Sopenharmony_ci __be32 small_b1_failed; /* receive BD allocation failures */ 4308c2ecf20Sopenharmony_ci __be32 large_b1_failed; /* receive BD allocation failures */ 4318c2ecf20Sopenharmony_ci __be32 small_b2_failed; /* receive BD allocation failures */ 4328c2ecf20Sopenharmony_ci __be32 large_b2_failed; /* receive BD allocation failures */ 4338c2ecf20Sopenharmony_ci __be32 rpd_alloc_failed; /* receive PDU allocation failures */ 4348c2ecf20Sopenharmony_ci __be32 receive_carrier; /* no carrier = 0, carrier = 1 */ 4358c2ecf20Sopenharmony_ci __be32 pad[ 2 ]; /* i960 padding */ 4368c2ecf20Sopenharmony_ci} stats_aux_t; 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci 4398c2ecf20Sopenharmony_ci/* whole statistics buffer */ 4408c2ecf20Sopenharmony_ci 4418c2ecf20Sopenharmony_citypedef struct stats { 4428c2ecf20Sopenharmony_ci struct stats_phy phy; /* physical encoding statistics */ 4438c2ecf20Sopenharmony_ci struct stats_oc3 oc3; /* OC-3 statistics */ 4448c2ecf20Sopenharmony_ci struct stats_atm atm; /* ATM statistics */ 4458c2ecf20Sopenharmony_ci struct stats_aal0 aal0; /* AAL0 statistics */ 4468c2ecf20Sopenharmony_ci struct stats_aal34 aal34; /* AAL3/4 statistics */ 4478c2ecf20Sopenharmony_ci struct stats_aal5 aal5; /* AAL5 statistics */ 4488c2ecf20Sopenharmony_ci struct stats_aux aux; /* auxiliary statistics */ 4498c2ecf20Sopenharmony_ci} stats_t; 4508c2ecf20Sopenharmony_ci 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci/* get statistics command opcode */ 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_citypedef struct stats_opcode { 4558c2ecf20Sopenharmony_ci BITFIELD2( 4568c2ecf20Sopenharmony_ci enum opcode opcode : 8, /* cp opcode */ 4578c2ecf20Sopenharmony_ci u32 pad : 24 /* reserved */ 4588c2ecf20Sopenharmony_ci ) 4598c2ecf20Sopenharmony_ci} stats_opcode_t; 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci 4628c2ecf20Sopenharmony_ci/* get statistics command block */ 4638c2ecf20Sopenharmony_ci 4648c2ecf20Sopenharmony_citypedef struct stats_block { 4658c2ecf20Sopenharmony_ci struct stats_opcode opcode; /* get statistics command opcode */ 4668c2ecf20Sopenharmony_ci u32 stats_haddr; /* host DMA address of stats buffer */ 4678c2ecf20Sopenharmony_ci} stats_block_t; 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci 4708c2ecf20Sopenharmony_ci/* expansion PROM data (PCI specific) */ 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_citypedef struct prom_data { 4738c2ecf20Sopenharmony_ci u32 hw_revision; /* hardware revision */ 4748c2ecf20Sopenharmony_ci u32 serial_number; /* board serial number */ 4758c2ecf20Sopenharmony_ci u8 mac_addr[ 8 ]; /* board MAC address */ 4768c2ecf20Sopenharmony_ci} prom_data_t; 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_ci/* get expansion PROM data command opcode */ 4808c2ecf20Sopenharmony_ci 4818c2ecf20Sopenharmony_citypedef struct prom_opcode { 4828c2ecf20Sopenharmony_ci BITFIELD2( 4838c2ecf20Sopenharmony_ci enum opcode opcode : 8, /* cp opcode */ 4848c2ecf20Sopenharmony_ci u32 pad : 24 /* reserved */ 4858c2ecf20Sopenharmony_ci ) 4868c2ecf20Sopenharmony_ci} prom_opcode_t; 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci/* get expansion PROM data command block */ 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_citypedef struct prom_block { 4928c2ecf20Sopenharmony_ci struct prom_opcode opcode; /* get PROM data command opcode */ 4938c2ecf20Sopenharmony_ci u32 prom_haddr; /* host DMA address of PROM buffer */ 4948c2ecf20Sopenharmony_ci} prom_block_t; 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_ci/* cp command */ 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_citypedef union cmd { 5008c2ecf20Sopenharmony_ci enum opcode opcode; /* operation code */ 5018c2ecf20Sopenharmony_ci struct activate_block activate_block; /* activate VC */ 5028c2ecf20Sopenharmony_ci struct deactivate_block deactivate_block; /* deactivate VC */ 5038c2ecf20Sopenharmony_ci struct stats_block stats_block; /* get statistics */ 5048c2ecf20Sopenharmony_ci struct prom_block prom_block; /* get expansion PROM data */ 5058c2ecf20Sopenharmony_ci struct oc3_block oc3_block; /* get/set OC-3 registers */ 5068c2ecf20Sopenharmony_ci u32 pad[ 4 ]; /* i960 padding */ 5078c2ecf20Sopenharmony_ci} cmd_t; 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_ci 5108c2ecf20Sopenharmony_ci/* cp resident command queue */ 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_citypedef struct cp_cmdq_entry { 5138c2ecf20Sopenharmony_ci union cmd cmd; /* command */ 5148c2ecf20Sopenharmony_ci u32 status_haddr; /* host DMA address of completion status */ 5158c2ecf20Sopenharmony_ci u32 pad[ 3 ]; /* i960 padding */ 5168c2ecf20Sopenharmony_ci} cp_cmdq_entry_t; 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci/* host resident transmit queue entry */ 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_citypedef struct host_txq_entry { 5228c2ecf20Sopenharmony_ci struct cp_txq_entry __iomem *cp_entry; /* addr of cp resident tx queue entry */ 5238c2ecf20Sopenharmony_ci enum status* status; /* addr of host resident status */ 5248c2ecf20Sopenharmony_ci struct tpd* tpd; /* addr of transmit PDU descriptor */ 5258c2ecf20Sopenharmony_ci u32 tpd_dma; /* DMA address of tpd */ 5268c2ecf20Sopenharmony_ci struct sk_buff* skb; /* related skb */ 5278c2ecf20Sopenharmony_ci void* data; /* copy of misaligned data */ 5288c2ecf20Sopenharmony_ci unsigned long incarn; /* vc_map incarnation when submitted for tx */ 5298c2ecf20Sopenharmony_ci struct fore200e_vc_map* vc_map; 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_ci} host_txq_entry_t; 5328c2ecf20Sopenharmony_ci 5338c2ecf20Sopenharmony_ci 5348c2ecf20Sopenharmony_ci/* host resident receive queue entry */ 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_citypedef struct host_rxq_entry { 5378c2ecf20Sopenharmony_ci struct cp_rxq_entry __iomem *cp_entry; /* addr of cp resident rx queue entry */ 5388c2ecf20Sopenharmony_ci enum status* status; /* addr of host resident status */ 5398c2ecf20Sopenharmony_ci struct rpd* rpd; /* addr of receive PDU descriptor */ 5408c2ecf20Sopenharmony_ci u32 rpd_dma; /* DMA address of rpd */ 5418c2ecf20Sopenharmony_ci} host_rxq_entry_t; 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_ci 5448c2ecf20Sopenharmony_ci/* host resident buffer supply queue entry */ 5458c2ecf20Sopenharmony_ci 5468c2ecf20Sopenharmony_citypedef struct host_bsq_entry { 5478c2ecf20Sopenharmony_ci struct cp_bsq_entry __iomem *cp_entry; /* addr of cp resident buffer supply queue entry */ 5488c2ecf20Sopenharmony_ci enum status* status; /* addr of host resident status */ 5498c2ecf20Sopenharmony_ci struct rbd_block* rbd_block; /* addr of receive buffer descriptor block */ 5508c2ecf20Sopenharmony_ci u32 rbd_block_dma; /* DMA address od rdb */ 5518c2ecf20Sopenharmony_ci} host_bsq_entry_t; 5528c2ecf20Sopenharmony_ci 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_ci/* host resident command queue entry */ 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_citypedef struct host_cmdq_entry { 5578c2ecf20Sopenharmony_ci struct cp_cmdq_entry __iomem *cp_entry; /* addr of cp resident cmd queue entry */ 5588c2ecf20Sopenharmony_ci enum status *status; /* addr of host resident status */ 5598c2ecf20Sopenharmony_ci} host_cmdq_entry_t; 5608c2ecf20Sopenharmony_ci 5618c2ecf20Sopenharmony_ci 5628c2ecf20Sopenharmony_ci/* chunk of memory */ 5638c2ecf20Sopenharmony_ci 5648c2ecf20Sopenharmony_citypedef struct chunk { 5658c2ecf20Sopenharmony_ci void* alloc_addr; /* base address of allocated chunk */ 5668c2ecf20Sopenharmony_ci void* align_addr; /* base address of aligned chunk */ 5678c2ecf20Sopenharmony_ci dma_addr_t dma_addr; /* DMA address of aligned chunk */ 5688c2ecf20Sopenharmony_ci int direction; /* direction of DMA mapping */ 5698c2ecf20Sopenharmony_ci u32 alloc_size; /* length of allocated chunk */ 5708c2ecf20Sopenharmony_ci u32 align_size; /* length of aligned chunk */ 5718c2ecf20Sopenharmony_ci} chunk_t; 5728c2ecf20Sopenharmony_ci 5738c2ecf20Sopenharmony_ci#define dma_size align_size /* DMA useable size */ 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci 5768c2ecf20Sopenharmony_ci/* host resident receive buffer */ 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_citypedef struct buffer { 5798c2ecf20Sopenharmony_ci struct buffer* next; /* next receive buffer */ 5808c2ecf20Sopenharmony_ci enum buffer_scheme scheme; /* buffer scheme */ 5818c2ecf20Sopenharmony_ci enum buffer_magn magn; /* buffer magnitude */ 5828c2ecf20Sopenharmony_ci struct chunk data; /* data buffer */ 5838c2ecf20Sopenharmony_ci#ifdef FORE200E_BSQ_DEBUG 5848c2ecf20Sopenharmony_ci unsigned long index; /* buffer # in queue */ 5858c2ecf20Sopenharmony_ci int supplied; /* 'buffer supplied' flag */ 5868c2ecf20Sopenharmony_ci#endif 5878c2ecf20Sopenharmony_ci} buffer_t; 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_ci 5908c2ecf20Sopenharmony_ci#if (BITS_PER_LONG == 32) 5918c2ecf20Sopenharmony_ci#define FORE200E_BUF2HDL(buffer) ((u32)(buffer)) 5928c2ecf20Sopenharmony_ci#define FORE200E_HDL2BUF(handle) ((struct buffer*)(handle)) 5938c2ecf20Sopenharmony_ci#else /* deal with 64 bit pointers */ 5948c2ecf20Sopenharmony_ci#define FORE200E_BUF2HDL(buffer) ((u32)((u64)(buffer))) 5958c2ecf20Sopenharmony_ci#define FORE200E_HDL2BUF(handle) ((struct buffer*)(((u64)(handle)) | PAGE_OFFSET)) 5968c2ecf20Sopenharmony_ci#endif 5978c2ecf20Sopenharmony_ci 5988c2ecf20Sopenharmony_ci 5998c2ecf20Sopenharmony_ci/* host resident command queue */ 6008c2ecf20Sopenharmony_ci 6018c2ecf20Sopenharmony_citypedef struct host_cmdq { 6028c2ecf20Sopenharmony_ci struct host_cmdq_entry host_entry[ QUEUE_SIZE_CMD ]; /* host resident cmd queue entries */ 6038c2ecf20Sopenharmony_ci int head; /* head of cmd queue */ 6048c2ecf20Sopenharmony_ci struct chunk status; /* array of completion status */ 6058c2ecf20Sopenharmony_ci} host_cmdq_t; 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_ci 6088c2ecf20Sopenharmony_ci/* host resident transmit queue */ 6098c2ecf20Sopenharmony_ci 6108c2ecf20Sopenharmony_citypedef struct host_txq { 6118c2ecf20Sopenharmony_ci struct host_txq_entry host_entry[ QUEUE_SIZE_TX ]; /* host resident tx queue entries */ 6128c2ecf20Sopenharmony_ci int head; /* head of tx queue */ 6138c2ecf20Sopenharmony_ci int tail; /* tail of tx queue */ 6148c2ecf20Sopenharmony_ci struct chunk tpd; /* array of tpds */ 6158c2ecf20Sopenharmony_ci struct chunk status; /* arry of completion status */ 6168c2ecf20Sopenharmony_ci int txing; /* number of pending PDUs in tx queue */ 6178c2ecf20Sopenharmony_ci} host_txq_t; 6188c2ecf20Sopenharmony_ci 6198c2ecf20Sopenharmony_ci 6208c2ecf20Sopenharmony_ci/* host resident receive queue */ 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_citypedef struct host_rxq { 6238c2ecf20Sopenharmony_ci struct host_rxq_entry host_entry[ QUEUE_SIZE_RX ]; /* host resident rx queue entries */ 6248c2ecf20Sopenharmony_ci int head; /* head of rx queue */ 6258c2ecf20Sopenharmony_ci struct chunk rpd; /* array of rpds */ 6268c2ecf20Sopenharmony_ci struct chunk status; /* array of completion status */ 6278c2ecf20Sopenharmony_ci} host_rxq_t; 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_ci/* host resident buffer supply queues */ 6318c2ecf20Sopenharmony_ci 6328c2ecf20Sopenharmony_citypedef struct host_bsq { 6338c2ecf20Sopenharmony_ci struct host_bsq_entry host_entry[ QUEUE_SIZE_BS ]; /* host resident buffer supply queue entries */ 6348c2ecf20Sopenharmony_ci int head; /* head of buffer supply queue */ 6358c2ecf20Sopenharmony_ci struct chunk rbd_block; /* array of rbds */ 6368c2ecf20Sopenharmony_ci struct chunk status; /* array of completion status */ 6378c2ecf20Sopenharmony_ci struct buffer* buffer; /* array of rx buffers */ 6388c2ecf20Sopenharmony_ci struct buffer* freebuf; /* list of free rx buffers */ 6398c2ecf20Sopenharmony_ci volatile int freebuf_count; /* count of free rx buffers */ 6408c2ecf20Sopenharmony_ci} host_bsq_t; 6418c2ecf20Sopenharmony_ci 6428c2ecf20Sopenharmony_ci 6438c2ecf20Sopenharmony_ci/* header of the firmware image */ 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_citypedef struct fw_header { 6468c2ecf20Sopenharmony_ci __le32 magic; /* magic number */ 6478c2ecf20Sopenharmony_ci __le32 version; /* firmware version id */ 6488c2ecf20Sopenharmony_ci __le32 load_offset; /* fw load offset in board memory */ 6498c2ecf20Sopenharmony_ci __le32 start_offset; /* fw execution start address in board memory */ 6508c2ecf20Sopenharmony_ci} fw_header_t; 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_ci#define FW_HEADER_MAGIC 0x65726f66 /* 'fore' */ 6538c2ecf20Sopenharmony_ci 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_ci/* receive buffer supply queues scheme specification */ 6568c2ecf20Sopenharmony_ci 6578c2ecf20Sopenharmony_citypedef struct bs_spec { 6588c2ecf20Sopenharmony_ci u32 queue_length; /* queue capacity */ 6598c2ecf20Sopenharmony_ci u32 buffer_size; /* host buffer size */ 6608c2ecf20Sopenharmony_ci u32 pool_size; /* number of rbds */ 6618c2ecf20Sopenharmony_ci u32 supply_blksize; /* num of rbds in I/O block (multiple 6628c2ecf20Sopenharmony_ci of 4 between 4 and 124 inclusive) */ 6638c2ecf20Sopenharmony_ci} bs_spec_t; 6648c2ecf20Sopenharmony_ci 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_ci/* initialization command block (one-time command, not in cmd queue) */ 6678c2ecf20Sopenharmony_ci 6688c2ecf20Sopenharmony_citypedef struct init_block { 6698c2ecf20Sopenharmony_ci enum opcode opcode; /* initialize command */ 6708c2ecf20Sopenharmony_ci enum status status; /* related status word */ 6718c2ecf20Sopenharmony_ci u32 receive_threshold; /* not used */ 6728c2ecf20Sopenharmony_ci u32 num_connect; /* ATM connections */ 6738c2ecf20Sopenharmony_ci u32 cmd_queue_len; /* length of command queue */ 6748c2ecf20Sopenharmony_ci u32 tx_queue_len; /* length of transmit queue */ 6758c2ecf20Sopenharmony_ci u32 rx_queue_len; /* length of receive queue */ 6768c2ecf20Sopenharmony_ci u32 rsd_extension; /* number of extra 32 byte blocks */ 6778c2ecf20Sopenharmony_ci u32 tsd_extension; /* number of extra 32 byte blocks */ 6788c2ecf20Sopenharmony_ci u32 conless_vpvc; /* not used */ 6798c2ecf20Sopenharmony_ci u32 pad[ 2 ]; /* force quad alignment */ 6808c2ecf20Sopenharmony_ci struct bs_spec bs_spec[ BUFFER_SCHEME_NBR ][ BUFFER_MAGN_NBR ]; /* buffer supply queues spec */ 6818c2ecf20Sopenharmony_ci} init_block_t; 6828c2ecf20Sopenharmony_ci 6838c2ecf20Sopenharmony_ci 6848c2ecf20Sopenharmony_citypedef enum media_type { 6858c2ecf20Sopenharmony_ci MEDIA_TYPE_CAT5_UTP = 0x06, /* unshielded twisted pair */ 6868c2ecf20Sopenharmony_ci MEDIA_TYPE_MM_OC3_ST = 0x16, /* multimode fiber ST */ 6878c2ecf20Sopenharmony_ci MEDIA_TYPE_MM_OC3_SC = 0x26, /* multimode fiber SC */ 6888c2ecf20Sopenharmony_ci MEDIA_TYPE_SM_OC3_ST = 0x36, /* single-mode fiber ST */ 6898c2ecf20Sopenharmony_ci MEDIA_TYPE_SM_OC3_SC = 0x46 /* single-mode fiber SC */ 6908c2ecf20Sopenharmony_ci} media_type_t; 6918c2ecf20Sopenharmony_ci 6928c2ecf20Sopenharmony_ci#define FORE200E_MEDIA_INDEX(media_type) ((media_type)>>4) 6938c2ecf20Sopenharmony_ci 6948c2ecf20Sopenharmony_ci 6958c2ecf20Sopenharmony_ci/* cp resident queues */ 6968c2ecf20Sopenharmony_ci 6978c2ecf20Sopenharmony_citypedef struct cp_queues { 6988c2ecf20Sopenharmony_ci u32 cp_cmdq; /* command queue */ 6998c2ecf20Sopenharmony_ci u32 cp_txq; /* transmit queue */ 7008c2ecf20Sopenharmony_ci u32 cp_rxq; /* receive queue */ 7018c2ecf20Sopenharmony_ci u32 cp_bsq[ BUFFER_SCHEME_NBR ][ BUFFER_MAGN_NBR ]; /* buffer supply queues */ 7028c2ecf20Sopenharmony_ci u32 imask; /* 1 enables cp to host interrupts */ 7038c2ecf20Sopenharmony_ci u32 istat; /* 1 for interrupt posted */ 7048c2ecf20Sopenharmony_ci u32 heap_base; /* offset form beginning of ram */ 7058c2ecf20Sopenharmony_ci u32 heap_size; /* space available for queues */ 7068c2ecf20Sopenharmony_ci u32 hlogger; /* non zero for host logging */ 7078c2ecf20Sopenharmony_ci u32 heartbeat; /* cp heartbeat */ 7088c2ecf20Sopenharmony_ci u32 fw_release; /* firmware version */ 7098c2ecf20Sopenharmony_ci u32 mon960_release; /* i960 monitor version */ 7108c2ecf20Sopenharmony_ci u32 tq_plen; /* transmit throughput measurements */ 7118c2ecf20Sopenharmony_ci /* make sure the init block remains on a quad word boundary */ 7128c2ecf20Sopenharmony_ci struct init_block init; /* one time cmd, not in cmd queue */ 7138c2ecf20Sopenharmony_ci enum media_type media_type; /* media type id */ 7148c2ecf20Sopenharmony_ci u32 oc3_revision; /* OC-3 revision number */ 7158c2ecf20Sopenharmony_ci} cp_queues_t; 7168c2ecf20Sopenharmony_ci 7178c2ecf20Sopenharmony_ci 7188c2ecf20Sopenharmony_ci/* boot status */ 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_citypedef enum boot_status { 7218c2ecf20Sopenharmony_ci BSTAT_COLD_START = (u32) 0xc01dc01d, /* cold start */ 7228c2ecf20Sopenharmony_ci BSTAT_SELFTEST_OK = (u32) 0x02201958, /* self-test ok */ 7238c2ecf20Sopenharmony_ci BSTAT_SELFTEST_FAIL = (u32) 0xadbadbad, /* self-test failed */ 7248c2ecf20Sopenharmony_ci BSTAT_CP_RUNNING = (u32) 0xce11feed, /* cp is running */ 7258c2ecf20Sopenharmony_ci BSTAT_MON_TOO_BIG = (u32) 0x10aded00 /* i960 monitor is too big */ 7268c2ecf20Sopenharmony_ci} boot_status_t; 7278c2ecf20Sopenharmony_ci 7288c2ecf20Sopenharmony_ci 7298c2ecf20Sopenharmony_ci/* software UART */ 7308c2ecf20Sopenharmony_ci 7318c2ecf20Sopenharmony_citypedef struct soft_uart { 7328c2ecf20Sopenharmony_ci u32 send; /* write register */ 7338c2ecf20Sopenharmony_ci u32 recv; /* read register */ 7348c2ecf20Sopenharmony_ci} soft_uart_t; 7358c2ecf20Sopenharmony_ci 7368c2ecf20Sopenharmony_ci#define FORE200E_CP_MONITOR_UART_FREE 0x00000000 7378c2ecf20Sopenharmony_ci#define FORE200E_CP_MONITOR_UART_AVAIL 0x01000000 7388c2ecf20Sopenharmony_ci 7398c2ecf20Sopenharmony_ci 7408c2ecf20Sopenharmony_ci/* i960 monitor */ 7418c2ecf20Sopenharmony_ci 7428c2ecf20Sopenharmony_citypedef struct cp_monitor { 7438c2ecf20Sopenharmony_ci struct soft_uart soft_uart; /* software UART */ 7448c2ecf20Sopenharmony_ci enum boot_status bstat; /* boot status */ 7458c2ecf20Sopenharmony_ci u32 app_base; /* application base offset */ 7468c2ecf20Sopenharmony_ci u32 mon_version; /* i960 monitor version */ 7478c2ecf20Sopenharmony_ci} cp_monitor_t; 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_ci 7508c2ecf20Sopenharmony_ci/* device state */ 7518c2ecf20Sopenharmony_ci 7528c2ecf20Sopenharmony_citypedef enum fore200e_state { 7538c2ecf20Sopenharmony_ci FORE200E_STATE_BLANK, /* initial state */ 7548c2ecf20Sopenharmony_ci FORE200E_STATE_REGISTER, /* device registered */ 7558c2ecf20Sopenharmony_ci FORE200E_STATE_CONFIGURE, /* bus interface configured */ 7568c2ecf20Sopenharmony_ci FORE200E_STATE_MAP, /* board space mapped in host memory */ 7578c2ecf20Sopenharmony_ci FORE200E_STATE_RESET, /* board resetted */ 7588c2ecf20Sopenharmony_ci FORE200E_STATE_START_FW, /* firmware started */ 7598c2ecf20Sopenharmony_ci FORE200E_STATE_INITIALIZE, /* initialize command successful */ 7608c2ecf20Sopenharmony_ci FORE200E_STATE_INIT_CMDQ, /* command queue initialized */ 7618c2ecf20Sopenharmony_ci FORE200E_STATE_INIT_TXQ, /* transmit queue initialized */ 7628c2ecf20Sopenharmony_ci FORE200E_STATE_INIT_RXQ, /* receive queue initialized */ 7638c2ecf20Sopenharmony_ci FORE200E_STATE_INIT_BSQ, /* buffer supply queue initialized */ 7648c2ecf20Sopenharmony_ci FORE200E_STATE_ALLOC_BUF, /* receive buffers allocated */ 7658c2ecf20Sopenharmony_ci FORE200E_STATE_IRQ, /* host interrupt requested */ 7668c2ecf20Sopenharmony_ci FORE200E_STATE_COMPLETE /* initialization completed */ 7678c2ecf20Sopenharmony_ci} fore200e_state; 7688c2ecf20Sopenharmony_ci 7698c2ecf20Sopenharmony_ci 7708c2ecf20Sopenharmony_ci/* PCA-200E registers */ 7718c2ecf20Sopenharmony_ci 7728c2ecf20Sopenharmony_citypedef struct fore200e_pca_regs { 7738c2ecf20Sopenharmony_ci volatile u32 __iomem * hcr; /* address of host control register */ 7748c2ecf20Sopenharmony_ci volatile u32 __iomem * imr; /* address of host interrupt mask register */ 7758c2ecf20Sopenharmony_ci volatile u32 __iomem * psr; /* address of PCI specific register */ 7768c2ecf20Sopenharmony_ci} fore200e_pca_regs_t; 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_ci 7798c2ecf20Sopenharmony_ci/* SBA-200E registers */ 7808c2ecf20Sopenharmony_ci 7818c2ecf20Sopenharmony_citypedef struct fore200e_sba_regs { 7828c2ecf20Sopenharmony_ci u32 __iomem *hcr; /* address of host control register */ 7838c2ecf20Sopenharmony_ci u32 __iomem *bsr; /* address of burst transfer size register */ 7848c2ecf20Sopenharmony_ci u32 __iomem *isr; /* address of interrupt level selection register */ 7858c2ecf20Sopenharmony_ci} fore200e_sba_regs_t; 7868c2ecf20Sopenharmony_ci 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_ci/* model-specific registers */ 7898c2ecf20Sopenharmony_ci 7908c2ecf20Sopenharmony_citypedef union fore200e_regs { 7918c2ecf20Sopenharmony_ci struct fore200e_pca_regs pca; /* PCA-200E registers */ 7928c2ecf20Sopenharmony_ci struct fore200e_sba_regs sba; /* SBA-200E registers */ 7938c2ecf20Sopenharmony_ci} fore200e_regs; 7948c2ecf20Sopenharmony_ci 7958c2ecf20Sopenharmony_ci 7968c2ecf20Sopenharmony_cistruct fore200e; 7978c2ecf20Sopenharmony_ci 7988c2ecf20Sopenharmony_ci/* bus-dependent data */ 7998c2ecf20Sopenharmony_ci 8008c2ecf20Sopenharmony_citypedef struct fore200e_bus { 8018c2ecf20Sopenharmony_ci char* model_name; /* board model name */ 8028c2ecf20Sopenharmony_ci char* proc_name; /* board name under /proc/atm */ 8038c2ecf20Sopenharmony_ci int descr_alignment; /* tpd/rpd/rbd DMA alignment requirement */ 8048c2ecf20Sopenharmony_ci int buffer_alignment; /* rx buffers DMA alignment requirement */ 8058c2ecf20Sopenharmony_ci int status_alignment; /* status words DMA alignment requirement */ 8068c2ecf20Sopenharmony_ci u32 (*read)(volatile u32 __iomem *); 8078c2ecf20Sopenharmony_ci void (*write)(u32, volatile u32 __iomem *); 8088c2ecf20Sopenharmony_ci int (*configure)(struct fore200e*); 8098c2ecf20Sopenharmony_ci int (*map)(struct fore200e*); 8108c2ecf20Sopenharmony_ci void (*reset)(struct fore200e*); 8118c2ecf20Sopenharmony_ci int (*prom_read)(struct fore200e*, struct prom_data*); 8128c2ecf20Sopenharmony_ci void (*unmap)(struct fore200e*); 8138c2ecf20Sopenharmony_ci void (*irq_enable)(struct fore200e*); 8148c2ecf20Sopenharmony_ci int (*irq_check)(struct fore200e*); 8158c2ecf20Sopenharmony_ci void (*irq_ack)(struct fore200e*); 8168c2ecf20Sopenharmony_ci int (*proc_read)(struct fore200e*, char*); 8178c2ecf20Sopenharmony_ci} fore200e_bus_t; 8188c2ecf20Sopenharmony_ci 8198c2ecf20Sopenharmony_ci/* vc mapping */ 8208c2ecf20Sopenharmony_ci 8218c2ecf20Sopenharmony_citypedef struct fore200e_vc_map { 8228c2ecf20Sopenharmony_ci struct atm_vcc* vcc; /* vcc entry */ 8238c2ecf20Sopenharmony_ci unsigned long incarn; /* vcc incarnation number */ 8248c2ecf20Sopenharmony_ci} fore200e_vc_map_t; 8258c2ecf20Sopenharmony_ci 8268c2ecf20Sopenharmony_ci#define FORE200E_VC_MAP(fore200e, vpi, vci) \ 8278c2ecf20Sopenharmony_ci (& (fore200e)->vc_map[ ((vpi) << FORE200E_VCI_BITS) | (vci) ]) 8288c2ecf20Sopenharmony_ci 8298c2ecf20Sopenharmony_ci 8308c2ecf20Sopenharmony_ci/* per-device data */ 8318c2ecf20Sopenharmony_ci 8328c2ecf20Sopenharmony_citypedef struct fore200e { 8338c2ecf20Sopenharmony_ci struct list_head entry; /* next device */ 8348c2ecf20Sopenharmony_ci const struct fore200e_bus* bus; /* bus-dependent code and data */ 8358c2ecf20Sopenharmony_ci union fore200e_regs regs; /* bus-dependent registers */ 8368c2ecf20Sopenharmony_ci struct atm_dev* atm_dev; /* ATM device */ 8378c2ecf20Sopenharmony_ci 8388c2ecf20Sopenharmony_ci enum fore200e_state state; /* device state */ 8398c2ecf20Sopenharmony_ci 8408c2ecf20Sopenharmony_ci char name[16]; /* device name */ 8418c2ecf20Sopenharmony_ci struct device *dev; 8428c2ecf20Sopenharmony_ci int irq; /* irq number */ 8438c2ecf20Sopenharmony_ci unsigned long phys_base; /* physical base address */ 8448c2ecf20Sopenharmony_ci void __iomem * virt_base; /* virtual base address */ 8458c2ecf20Sopenharmony_ci 8468c2ecf20Sopenharmony_ci unsigned char esi[ ESI_LEN ]; /* end system identifier */ 8478c2ecf20Sopenharmony_ci 8488c2ecf20Sopenharmony_ci struct cp_monitor __iomem * cp_monitor; /* i960 monitor address */ 8498c2ecf20Sopenharmony_ci struct cp_queues __iomem * cp_queues; /* cp resident queues */ 8508c2ecf20Sopenharmony_ci struct host_cmdq host_cmdq; /* host resident cmd queue */ 8518c2ecf20Sopenharmony_ci struct host_txq host_txq; /* host resident tx queue */ 8528c2ecf20Sopenharmony_ci struct host_rxq host_rxq; /* host resident rx queue */ 8538c2ecf20Sopenharmony_ci /* host resident buffer supply queues */ 8548c2ecf20Sopenharmony_ci struct host_bsq host_bsq[ BUFFER_SCHEME_NBR ][ BUFFER_MAGN_NBR ]; 8558c2ecf20Sopenharmony_ci 8568c2ecf20Sopenharmony_ci u32 available_cell_rate; /* remaining pseudo-CBR bw on link */ 8578c2ecf20Sopenharmony_ci 8588c2ecf20Sopenharmony_ci int loop_mode; /* S/UNI loopback mode */ 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_ci struct stats* stats; /* last snapshot of the stats */ 8618c2ecf20Sopenharmony_ci 8628c2ecf20Sopenharmony_ci struct mutex rate_mtx; /* protects rate reservation ops */ 8638c2ecf20Sopenharmony_ci spinlock_t q_lock; /* protects queue ops */ 8648c2ecf20Sopenharmony_ci#ifdef FORE200E_USE_TASKLET 8658c2ecf20Sopenharmony_ci struct tasklet_struct tx_tasklet; /* performs tx interrupt work */ 8668c2ecf20Sopenharmony_ci struct tasklet_struct rx_tasklet; /* performs rx interrupt work */ 8678c2ecf20Sopenharmony_ci#endif 8688c2ecf20Sopenharmony_ci unsigned long tx_sat; /* tx queue saturation count */ 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_ci unsigned long incarn_count; 8718c2ecf20Sopenharmony_ci struct fore200e_vc_map vc_map[ NBR_CONNECT ]; /* vc mapping */ 8728c2ecf20Sopenharmony_ci} fore200e_t; 8738c2ecf20Sopenharmony_ci 8748c2ecf20Sopenharmony_ci 8758c2ecf20Sopenharmony_ci/* per-vcc data */ 8768c2ecf20Sopenharmony_ci 8778c2ecf20Sopenharmony_citypedef struct fore200e_vcc { 8788c2ecf20Sopenharmony_ci enum buffer_scheme scheme; /* rx buffer scheme */ 8798c2ecf20Sopenharmony_ci struct tpd_rate rate; /* tx rate control data */ 8808c2ecf20Sopenharmony_ci int rx_min_pdu; /* size of smallest PDU received */ 8818c2ecf20Sopenharmony_ci int rx_max_pdu; /* size of largest PDU received */ 8828c2ecf20Sopenharmony_ci int tx_min_pdu; /* size of smallest PDU transmitted */ 8838c2ecf20Sopenharmony_ci int tx_max_pdu; /* size of largest PDU transmitted */ 8848c2ecf20Sopenharmony_ci unsigned long tx_pdu; /* nbr of tx pdus */ 8858c2ecf20Sopenharmony_ci unsigned long rx_pdu; /* nbr of rx pdus */ 8868c2ecf20Sopenharmony_ci} fore200e_vcc_t; 8878c2ecf20Sopenharmony_ci 8888c2ecf20Sopenharmony_ci 8898c2ecf20Sopenharmony_ci 8908c2ecf20Sopenharmony_ci/* 200E-series common memory layout */ 8918c2ecf20Sopenharmony_ci 8928c2ecf20Sopenharmony_ci#define FORE200E_CP_MONITOR_OFFSET 0x00000400 /* i960 monitor interface */ 8938c2ecf20Sopenharmony_ci#define FORE200E_CP_QUEUES_OFFSET 0x00004d40 /* cp resident queues */ 8948c2ecf20Sopenharmony_ci 8958c2ecf20Sopenharmony_ci 8968c2ecf20Sopenharmony_ci/* PCA-200E memory layout */ 8978c2ecf20Sopenharmony_ci 8988c2ecf20Sopenharmony_ci#define PCA200E_IOSPACE_LENGTH 0x00200000 8998c2ecf20Sopenharmony_ci 9008c2ecf20Sopenharmony_ci#define PCA200E_HCR_OFFSET 0x00100000 /* board control register */ 9018c2ecf20Sopenharmony_ci#define PCA200E_IMR_OFFSET 0x00100004 /* host IRQ mask register */ 9028c2ecf20Sopenharmony_ci#define PCA200E_PSR_OFFSET 0x00100008 /* PCI specific register */ 9038c2ecf20Sopenharmony_ci 9048c2ecf20Sopenharmony_ci 9058c2ecf20Sopenharmony_ci/* PCA-200E host control register */ 9068c2ecf20Sopenharmony_ci 9078c2ecf20Sopenharmony_ci#define PCA200E_HCR_RESET (1<<0) /* read / write */ 9088c2ecf20Sopenharmony_ci#define PCA200E_HCR_HOLD_LOCK (1<<1) /* read / write */ 9098c2ecf20Sopenharmony_ci#define PCA200E_HCR_I960FAIL (1<<2) /* read */ 9108c2ecf20Sopenharmony_ci#define PCA200E_HCR_INTRB (1<<2) /* write */ 9118c2ecf20Sopenharmony_ci#define PCA200E_HCR_HOLD_ACK (1<<3) /* read */ 9128c2ecf20Sopenharmony_ci#define PCA200E_HCR_INTRA (1<<3) /* write */ 9138c2ecf20Sopenharmony_ci#define PCA200E_HCR_OUTFULL (1<<4) /* read */ 9148c2ecf20Sopenharmony_ci#define PCA200E_HCR_CLRINTR (1<<4) /* write */ 9158c2ecf20Sopenharmony_ci#define PCA200E_HCR_ESPHOLD (1<<5) /* read */ 9168c2ecf20Sopenharmony_ci#define PCA200E_HCR_INFULL (1<<6) /* read */ 9178c2ecf20Sopenharmony_ci#define PCA200E_HCR_TESTMODE (1<<7) /* read */ 9188c2ecf20Sopenharmony_ci 9198c2ecf20Sopenharmony_ci 9208c2ecf20Sopenharmony_ci/* PCA-200E PCI bus interface regs (offsets in PCI config space) */ 9218c2ecf20Sopenharmony_ci 9228c2ecf20Sopenharmony_ci#define PCA200E_PCI_LATENCY 0x40 /* maximum slave latenty */ 9238c2ecf20Sopenharmony_ci#define PCA200E_PCI_MASTER_CTRL 0x41 /* master control */ 9248c2ecf20Sopenharmony_ci#define PCA200E_PCI_THRESHOLD 0x42 /* burst / continuous req threshold */ 9258c2ecf20Sopenharmony_ci 9268c2ecf20Sopenharmony_ci/* PBI master control register */ 9278c2ecf20Sopenharmony_ci 9288c2ecf20Sopenharmony_ci#define PCA200E_CTRL_DIS_CACHE_RD (1<<0) /* disable cache-line reads */ 9298c2ecf20Sopenharmony_ci#define PCA200E_CTRL_DIS_WRT_INVAL (1<<1) /* disable writes and invalidates */ 9308c2ecf20Sopenharmony_ci#define PCA200E_CTRL_2_CACHE_WRT_INVAL (1<<2) /* require 2 cache-lines for writes and invalidates */ 9318c2ecf20Sopenharmony_ci#define PCA200E_CTRL_IGN_LAT_TIMER (1<<3) /* ignore the latency timer */ 9328c2ecf20Sopenharmony_ci#define PCA200E_CTRL_ENA_CONT_REQ_MODE (1<<4) /* enable continuous request mode */ 9338c2ecf20Sopenharmony_ci#define PCA200E_CTRL_LARGE_PCI_BURSTS (1<<5) /* force large PCI bus bursts */ 9348c2ecf20Sopenharmony_ci#define PCA200E_CTRL_CONVERT_ENDIAN (1<<6) /* convert endianess of slave RAM accesses */ 9358c2ecf20Sopenharmony_ci 9368c2ecf20Sopenharmony_ci 9378c2ecf20Sopenharmony_ci 9388c2ecf20Sopenharmony_ci#define SBA200E_PROM_NAME "FORE,sba-200e" /* device name in openprom tree */ 9398c2ecf20Sopenharmony_ci 9408c2ecf20Sopenharmony_ci 9418c2ecf20Sopenharmony_ci/* size of SBA-200E registers */ 9428c2ecf20Sopenharmony_ci 9438c2ecf20Sopenharmony_ci#define SBA200E_HCR_LENGTH 4 9448c2ecf20Sopenharmony_ci#define SBA200E_BSR_LENGTH 4 9458c2ecf20Sopenharmony_ci#define SBA200E_ISR_LENGTH 4 9468c2ecf20Sopenharmony_ci#define SBA200E_RAM_LENGTH 0x40000 9478c2ecf20Sopenharmony_ci 9488c2ecf20Sopenharmony_ci 9498c2ecf20Sopenharmony_ci/* SBA-200E SBUS burst transfer size register */ 9508c2ecf20Sopenharmony_ci 9518c2ecf20Sopenharmony_ci#define SBA200E_BSR_BURST4 0x04 9528c2ecf20Sopenharmony_ci#define SBA200E_BSR_BURST8 0x08 9538c2ecf20Sopenharmony_ci#define SBA200E_BSR_BURST16 0x10 9548c2ecf20Sopenharmony_ci 9558c2ecf20Sopenharmony_ci 9568c2ecf20Sopenharmony_ci/* SBA-200E host control register */ 9578c2ecf20Sopenharmony_ci 9588c2ecf20Sopenharmony_ci#define SBA200E_HCR_RESET (1<<0) /* read / write (sticky) */ 9598c2ecf20Sopenharmony_ci#define SBA200E_HCR_HOLD_LOCK (1<<1) /* read / write (sticky) */ 9608c2ecf20Sopenharmony_ci#define SBA200E_HCR_I960FAIL (1<<2) /* read */ 9618c2ecf20Sopenharmony_ci#define SBA200E_HCR_I960SETINTR (1<<2) /* write */ 9628c2ecf20Sopenharmony_ci#define SBA200E_HCR_OUTFULL (1<<3) /* read */ 9638c2ecf20Sopenharmony_ci#define SBA200E_HCR_INTR_CLR (1<<3) /* write */ 9648c2ecf20Sopenharmony_ci#define SBA200E_HCR_INTR_ENA (1<<4) /* read / write (sticky) */ 9658c2ecf20Sopenharmony_ci#define SBA200E_HCR_ESPHOLD (1<<5) /* read */ 9668c2ecf20Sopenharmony_ci#define SBA200E_HCR_INFULL (1<<6) /* read */ 9678c2ecf20Sopenharmony_ci#define SBA200E_HCR_TESTMODE (1<<7) /* read */ 9688c2ecf20Sopenharmony_ci#define SBA200E_HCR_INTR_REQ (1<<8) /* read */ 9698c2ecf20Sopenharmony_ci 9708c2ecf20Sopenharmony_ci#define SBA200E_HCR_STICKY (SBA200E_HCR_RESET | SBA200E_HCR_HOLD_LOCK | SBA200E_HCR_INTR_ENA) 9718c2ecf20Sopenharmony_ci 9728c2ecf20Sopenharmony_ci 9738c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */ 9748c2ecf20Sopenharmony_ci#endif /* _FORE200E_H */ 975