13859Sml29623 /* 23859Sml29623 * CDDL HEADER START 33859Sml29623 * 43859Sml29623 * The contents of this file are subject to the terms of the 53859Sml29623 * Common Development and Distribution License (the "License"). 63859Sml29623 * You may not use this file except in compliance with the License. 73859Sml29623 * 83859Sml29623 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 93859Sml29623 * or http://www.opensolaris.org/os/licensing. 103859Sml29623 * See the License for the specific language governing permissions 113859Sml29623 * and limitations under the License. 123859Sml29623 * 133859Sml29623 * When distributing Covered Code, include this CDDL HEADER in each 143859Sml29623 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 153859Sml29623 * If applicable, add the following below this CDDL HEADER, with the 163859Sml29623 * fields enclosed by brackets "[]" replaced with your own identifying 173859Sml29623 * information: Portions Copyright [yyyy] [name of copyright owner] 183859Sml29623 * 193859Sml29623 * CDDL HEADER END 203859Sml29623 */ 213859Sml29623 /* 22*11304SJanie.Lu@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 233859Sml29623 * Use is subject to license terms. 243859Sml29623 */ 253859Sml29623 263859Sml29623 #ifndef _SYS_NXGE_NXGE_DEFS_H 273859Sml29623 #define _SYS_NXGE_NXGE_DEFS_H 283859Sml29623 293859Sml29623 #ifdef __cplusplus 303859Sml29623 extern "C" { 313859Sml29623 #endif 323859Sml29623 333859Sml29623 /* 343859Sml29623 * Block Address Assignment (24-bit base address) 353859Sml29623 * (bits [23:20]: block [19]: set to 1 for FZC ) 363859Sml29623 */ 373859Sml29623 #define PIO 0x000000 383859Sml29623 #define FZC_PIO 0x080000 393859Sml29623 #define RESERVED_1 0x100000 403859Sml29623 #define FZC_MAC 0x180000 413859Sml29623 #define RESERVED_2 0x200000 423859Sml29623 #define FZC_IPP 0x280000 433859Sml29623 #define FFLP 0x300000 443859Sml29623 #define FZC_FFLP 0x380000 453859Sml29623 #define PIO_VADDR 0x400000 463859Sml29623 #define RESERVED_3 0x480000 473859Sml29623 #define ZCP 0x500000 483859Sml29623 #define FZC_ZCP 0x580000 493859Sml29623 #define DMC 0x600000 503859Sml29623 #define FZC_DMC 0x680000 513859Sml29623 #define TXC 0x700000 523859Sml29623 #define FZC_TXC 0x780000 533859Sml29623 #define PIO_LDSV 0x800000 543859Sml29623 #define RESERVED_4 0x880000 553859Sml29623 #define PIO_LDGIM 0x900000 563859Sml29623 #define RESERVED_5 0x980000 573859Sml29623 #define PIO_IMASK0 0xa00000 583859Sml29623 #define RESERVED_6 0xa80000 593859Sml29623 #define PIO_IMASK1 0xb00000 603859Sml29623 #define RESERVED_7_START 0xb80000 613859Sml29623 #define RESERVED_7_END 0xc00000 623859Sml29623 #define FZC_PROM 0xc80000 633859Sml29623 #define RESERVED_8 0xd00000 643859Sml29623 #define FZC_PIM 0xd80000 653859Sml29623 #define RESERVED_9_START 0xe00000 663859Sml29623 #define RESERVED_9_END 0xf80000 673859Sml29623 683859Sml29623 /* PIO (0x000000) */ 693859Sml29623 703859Sml29623 713859Sml29623 /* FZC_PIO (0x080000) */ 723859Sml29623 #define LDGITMRES (FZC_PIO + 0x00008) /* timer resolution */ 733859Sml29623 #define SID (FZC_PIO + 0x10200) /* 64 LDG, INT data */ 743859Sml29623 #define LDG_NUM (FZC_PIO + 0x20000) /* 69 LDs */ 753859Sml29623 763859Sml29623 773859Sml29623 783859Sml29623 /* FZC_IPP (0x280000) */ 793859Sml29623 803859Sml29623 813859Sml29623 /* FFLP (0x300000), Header Parser */ 823859Sml29623 833859Sml29623 /* PIO_VADDR (0x400000), PIO Virtaul DMA Address */ 843859Sml29623 /* ?? how to access DMA via PIO_VADDR? */ 853859Sml29623 #define VADDR (PIO_VADDR + 0x00000) /* ?? not for driver */ 863859Sml29623 873859Sml29623 883859Sml29623 /* ZCP (0x500000), Neptune Only */ 893859Sml29623 903859Sml29623 913859Sml29623 /* FZC_ZCP (0x580000), Neptune Only */ 923859Sml29623 933859Sml29623 943859Sml29623 /* DMC (0x600000), register offset (32 DMA channels) */ 953859Sml29623 963859Sml29623 /* Transmit Ring Register Offset (32 Channels) */ 973859Sml29623 #define TX_RNG_CFIG (DMC + 0x40000) 983859Sml29623 #define TX_RING_HDH (DMC + 0x40008) 993859Sml29623 #define TX_RING_HDL (DMC + 0x40010) 1003859Sml29623 #define TX_RING_KICK (DMC + 0x40018) 1013859Sml29623 /* Transmit Operations (32 Channels) */ 1023859Sml29623 #define TX_ENT_MSK (DMC + 0x40020) 1033859Sml29623 #define TX_CS (DMC + 0x40028) 1043859Sml29623 #define TXDMA_MBH (DMC + 0x40030) 1053859Sml29623 #define TXDMA_MBL (DMC + 0x40038) 1063859Sml29623 #define TX_DMA_PRE_ST (DMC + 0x40040) 1073859Sml29623 #define TX_RNG_ERR_LOGH (DMC + 0x40048) 1083859Sml29623 #define TX_RNG_ERR_LOGL (DMC + 0x40050) 1093859Sml29623 #if OLD 1103859Sml29623 #define SH_TX_RNG_ERR_LOGH (DMC + 0x40058) 1113859Sml29623 #define SH_TX_RNG_ERR_LOGL (DMC + 0x40060) 1123859Sml29623 #endif 1133859Sml29623 1143859Sml29623 /* FZC_DMC RED Initial Random Value register offset (global) */ 1153859Sml29623 #define RED_RAN_INIT (FZC_DMC + 0x00068) 1163859Sml29623 1173859Sml29623 #define RX_ADDR_MD (FZC_DMC + 0x00070) 1183859Sml29623 1193859Sml29623 /* FZC_DMC Ethernet Timeout Countue register offset (global) */ 1203859Sml29623 #define EING_TIMEOUT (FZC_DMC + 0x00078) 1213859Sml29623 1223859Sml29623 /* RDC Table */ 1233859Sml29623 #define RDC_TBL (FZC_DMC + 0x10000) /* 256 * 8 */ 1243859Sml29623 1253859Sml29623 /* FZC_DMC partitioning support register offset (32 channels) */ 1263859Sml29623 1273859Sml29623 #define TX_LOG_PAGE_VLD (FZC_DMC + 0x40000) 1283859Sml29623 #define TX_LOG_MASK1 (FZC_DMC + 0x40008) 1293859Sml29623 #define TX_LOG_VAL1 (FZC_DMC + 0x40010) 1303859Sml29623 #define TX_LOG_MASK2 (FZC_DMC + 0x40018) 1313859Sml29623 #define TX_LOG_VAL2 (FZC_DMC + 0x40020) 1323859Sml29623 #define TX_LOG_PAGE_RELO1 (FZC_DMC + 0x40028) 1333859Sml29623 #define TX_LOG_PAGE_RELO2 (FZC_DMC + 0x40030) 1343859Sml29623 #define TX_LOG_PAGE_HDL (FZC_DMC + 0x40038) 1353859Sml29623 1363859Sml29623 #define TX_ADDR_MOD (FZC_DMC + 0x41000) /* only one? */ 1373859Sml29623 1383859Sml29623 1393859Sml29623 /* FZC_DMC RED Parameters register offset (32 channels) */ 1403859Sml29623 #define RDC_RED_PARA1 (FZC_DMC + 0x30000) 1413859Sml29623 #define RDC_RED_PARA2 (FZC_DMC + 0x30008) 1423859Sml29623 /* FZC_DMC RED Discard Cound Register offset (32 channels) */ 1433859Sml29623 #define RED_DIS_CNT (FZC_DMC + 0x30010) 1443859Sml29623 1453859Sml29623 #if OLD /* This has been moved to TXC */ 1463859Sml29623 /* Transmit Ring Scheduler (per port) */ 1473859Sml29623 #define TX_DMA_MAP0 (FZC_DMC + 0x50000) 1483859Sml29623 #define TX_DMA_MAP1 (FZC_DMC + 0x50008) 1493859Sml29623 #define TX_DMA_MAP2 (FZC_DMC + 0x50010) 1503859Sml29623 #define TX_DMA_MAP3 (FZC_DMC + 0x50018) 1513859Sml29623 #endif 1523859Sml29623 1533859Sml29623 /* Transmit Ring Scheduler: DRR Weight (32 Channels) */ 1543859Sml29623 #define DRR_WT (FZC_DMC + 0x51000) 1553859Sml29623 #if OLD 1563859Sml29623 #define TXRNG_USE (FZC_DMC + 0x51008) 1573859Sml29623 #endif 1583859Sml29623 1593859Sml29623 /* TXC (0x700000)?? */ 1603859Sml29623 1613859Sml29623 1623859Sml29623 /* FZC_TXC (0x780000)?? */ 1633859Sml29623 1643859Sml29623 1653859Sml29623 /* 1663859Sml29623 * PIO_LDSV (0x800000) 1673859Sml29623 * Logical Device State Vector 0, 1, 2. 1683859Sml29623 * (69 logical devices, 8192 apart, partitioning control) 1693859Sml29623 */ 1703859Sml29623 #define LDSV0 (PIO_LDSV + 0x00000) /* RO (64 - 69) */ 1713859Sml29623 #define LDSV1 (PIO_LDSV + 0x00008) /* RO (32 - 63) */ 1723859Sml29623 #define LDSV2 (PIO_LDSV + 0x00010) /* RO ( 0 - 31) */ 1733859Sml29623 1743859Sml29623 /* 1753859Sml29623 * PIO_LDGIM (0x900000) 1763859Sml29623 * Logical Device Group Interrupt Management (64 groups). 1773859Sml29623 * (count 64, step 8192) 1783859Sml29623 */ 1793859Sml29623 #define LDGIMGN (PIO_LDGIMGN + 0x00000) /* RW */ 1803859Sml29623 1813859Sml29623 /* 1823859Sml29623 * PIO_IMASK0 (0xA000000) 1833859Sml29623 * 1843859Sml29623 * Logical Device Masks 0, 1. 1853859Sml29623 * (64 logical devices, 8192 apart, partitioning control) 1863859Sml29623 */ 1873859Sml29623 #define LD_IM0 (PIO_IMASK0 + 0x00000) /* RW ( 0 - 63) */ 1883859Sml29623 1893859Sml29623 /* 1903859Sml29623 * PIO_IMASK0 (0xB000000) 1913859Sml29623 * 1923859Sml29623 * Logical Device Masks 0, 1. 1933859Sml29623 * (5 logical devices, 8192 apart, partitioning control) 1943859Sml29623 */ 1953859Sml29623 #define LD_IM1 (PIO_IMASK1 + 0x00000) /* RW (64 - 69) */ 1963859Sml29623 1973859Sml29623 1983859Sml29623 /* DMC/TMC CSR size */ 1996495Sspeer #define DMA_CSR_SLL 9 /* Used to calculate VR addresses */ 2006495Sspeer #define DMA_CSR_SIZE (1 << DMA_CSR_SLL) /* 512 */ 2016495Sspeer #define DMA_CSR_MASK 0xff /* Used to calculate VR addresses */ 2026495Sspeer /* 2036495Sspeer * That is, each DMA CSR set must fit into a 512 byte space. 2046495Sspeer * If you subtract DMC (0x60000) from each DMA register definition, 2056495Sspeer * what you have left over is currently less than 255 (0xff) 2066495Sspeer */ 2076495Sspeer #define DMA_CSR_MIN_PAGE_SIZE (2 * DMA_CSR_SIZE) /* 1024 */ 2086495Sspeer /* 2096495Sspeer * There are 2 subpages per page in a VR. 2106495Sspeer */ 2116495Sspeer #define VDMA_CSR_SIZE (8 * DMA_CSR_MIN_PAGE_SIZE) /* 0x2000 */ 2126495Sspeer /* 2136495Sspeer * There are 8 pages in a VR. 2146495Sspeer */ 2153859Sml29623 2163859Sml29623 /* 2173859Sml29623 * Define the Default RBR, RCR 2183859Sml29623 */ 2195770Sml29623 #define RBR_DEFAULT_MAX_BLKS 8192 /* each entry (16 blockaddr/64B) */ 2203859Sml29623 #define RBR_NBLK_PER_LINE 16 /* 16 block addresses per 64 B line */ 2213859Sml29623 #define RBR_DEFAULT_MAX_LEN (RBR_DEFAULT_MAX_BLKS) 2223859Sml29623 #define RBR_DEFAULT_MIN_LEN 1 2235770Sml29623 #define RCR_DEFAULT_MAX 8192 2243859Sml29623 2253859Sml29623 #define SW_OFFSET_NO_OFFSET 0 2263859Sml29623 #define SW_OFFSET_64 1 /* 64 bytes */ 2273859Sml29623 #define SW_OFFSET_128 2 /* 128 bytes */ 228*11304SJanie.Lu@Sun.COM /* The following additional offsets are defined for Neptune-L and RF-NIU */ 229*11304SJanie.Lu@Sun.COM #define SW_OFFSET_192 3 230*11304SJanie.Lu@Sun.COM #define SW_OFFSET_256 4 231*11304SJanie.Lu@Sun.COM #define SW_OFFSET_320 5 232*11304SJanie.Lu@Sun.COM #define SW_OFFSET_384 6 233*11304SJanie.Lu@Sun.COM #define SW_OFFSET_448 7 2343859Sml29623 2355770Sml29623 #define TDC_DEFAULT_MAX 8192 2363859Sml29623 /* 2373859Sml29623 * RBR block descriptor is 32 bits (bits [43:12] 2383859Sml29623 */ 2393859Sml29623 #define RBR_BKADDR_SHIFT 12 2403859Sml29623 2413859Sml29623 2423859Sml29623 #define RCR_DEFAULT_MAX_BLKS 4096 /* each entry (8 blockaddr/64B) */ 2433859Sml29623 #define RCR_NBLK_PER_LINE 8 /* 8 block addresses per 64 B line */ 2443859Sml29623 #define RCR_DEFAULT_MAX_LEN (RCR_DEFAULT_MAX_BLKS) 2453859Sml29623 #define RCR_DEFAULT_MIN_LEN 1 2463859Sml29623 2473859Sml29623 /* DMA Channels. */ 2483859Sml29623 #define NXGE_MAX_DMCS (NXGE_MAX_RDCS + NXGE_MAX_TDCS) 2493859Sml29623 #define NXGE_MAX_RDCS 16 2503859Sml29623 #define NXGE_MAX_TDCS 24 2513859Sml29623 #define NXGE_MAX_TDCS_NIU 16 2523859Sml29623 /* 2533859Sml29623 * original mapping from Hypervisor 2543859Sml29623 */ 2553859Sml29623 #ifdef ORIGINAL 2563859Sml29623 #define NXGE_N2_RXDMA_START_LDG 0 2573859Sml29623 #define NXGE_N2_TXDMA_START_LDG 16 2583859Sml29623 #define NXGE_N2_MIF_LDG 32 2593859Sml29623 #define NXGE_N2_MAC_0_LDG 33 2603859Sml29623 #define NXGE_N2_MAC_1_LDG 34 2613859Sml29623 #define NXGE_N2_SYS_ERROR_LDG 35 2623859Sml29623 #endif 2633859Sml29623 2643859Sml29623 #define NXGE_N2_RXDMA_START_LDG 19 2653859Sml29623 #define NXGE_N2_TXDMA_START_LDG 27 2663859Sml29623 #define NXGE_N2_MIF_LDG 17 2673859Sml29623 #define NXGE_N2_MAC_0_LDG 16 2683859Sml29623 #define NXGE_N2_MAC_1_LDG 35 2693859Sml29623 #define NXGE_N2_SYS_ERROR_LDG 18 2703859Sml29623 #define NXGE_N2_LDG_GAP 17 2713859Sml29623 2723859Sml29623 #define NXGE_MAX_RDC_GRPS 8 2733859Sml29623 2743859Sml29623 /* 2753859Sml29623 * Max. ports per Neptune and NIU 2763859Sml29623 */ 2773859Sml29623 #define NXGE_MAX_PORTS 4 2783859Sml29623 #define NXGE_PORTS_NEPTUNE 4 2793859Sml29623 #define NXGE_PORTS_NIU 2 2803859Sml29623 2816495Sspeer /* 2826495Sspeer * Virtualization Regions. 2836495Sspeer */ 2846495Sspeer #define NXGE_MAX_VRS 8 2856495Sspeer 2868275SEric Cheng /* 2878275SEric Cheng * TDC groups are used exclusively for the purpose of Hybrid I/O 2888275SEric Cheng * TX needs one group for each VR 2898275SEric Cheng */ 2908275SEric Cheng #define NXGE_MAX_TDC_GROUPS (NXGE_MAX_VRS) 2918275SEric Cheng 2923859Sml29623 /* Max. RDC table groups */ 2933859Sml29623 #define NXGE_MAX_RDC_GROUPS 8 2943859Sml29623 #define NXGE_MAX_RDCS 16 2953859Sml29623 #define NXGE_MAX_DMAS 32 2963859Sml29623 2973859Sml29623 #define NXGE_MAX_MACS_XMACS 16 2983859Sml29623 #define NXGE_MAX_MACS_BMACS 8 2993859Sml29623 #define NXGE_MAX_MACS (NXGE_MAX_PORTS * NXGE_MAX_MACS_XMACS) 3003859Sml29623 3013859Sml29623 #define NXGE_MAX_VLANS 4096 3023859Sml29623 #define VLAN_ETHERTYPE (0x8100) 3033859Sml29623 3043859Sml29623 3053859Sml29623 /* Scaling factor for RBR (receive block ring) */ 3063859Sml29623 #define RBR_SCALE_1 0 3073859Sml29623 #define RBR_SCALE_2 1 3083859Sml29623 #define RBR_SCALE_3 2 3093859Sml29623 #define RBR_SCALE_4 3 3103859Sml29623 #define RBR_SCALE_5 4 3113859Sml29623 #define RBR_SCALE_6 5 3123859Sml29623 #define RBR_SCALE_7 6 3133859Sml29623 #define RBR_SCALE_8 7 3143859Sml29623 3153859Sml29623 3163859Sml29623 #define MAX_PORTS_PER_NXGE 4 3173859Sml29623 #define MAX_MACS 32 3183859Sml29623 3193859Sml29623 #define TX_GATHER_POINTER_SZ 8 3203859Sml29623 #define TX_GP_PER_BLOCK 8 3213859Sml29623 #define TX_DEFAULT_MAX_GPS 1024 /* Max. # of gather pointers */ 3223859Sml29623 #define TX_DEFAULT_JUMBO_MAX_GPS 4096 /* Max. # of gather pointers */ 3233859Sml29623 #define TX_DEFAULT_MAX_LEN (TX_DEFAULT_MAX_GPS/TX_GP_PER_BLOCK) 3243859Sml29623 #define TX_DEFAULT_JUMBO_MAX_LEN (TX_DEFAULT_JUMBO_MAX_GPS/TX_GP_PER_BLOCK) 3253859Sml29623 3263859Sml29623 #define TX_RING_THRESHOLD (TX_DEFAULT_MAX_GPS/4) 3273859Sml29623 #define TX_RING_JUMBO_THRESHOLD (TX_DEFAULT_JUMBO_MAX_GPS/4) 3283859Sml29623 3293859Sml29623 #define TRANSMIT_HEADER_SIZE 16 /* 16 B frame header */ 3303859Sml29623 3313859Sml29623 #define TX_DESC_SAD_SHIFT 0 3323859Sml29623 #define TX_DESC_SAD_MASK 0x00000FFFFFFFFFFFULL /* start address */ 3333859Sml29623 #define TX_DESC_TR_LEN_SHIFT 44 3343859Sml29623 #define TX_DESC_TR_LEN_MASK 0x00FFF00000000000ULL /* Transfer Length */ 3353859Sml29623 #define TX_DESC_NUM_PTR_SHIFT 58 3363859Sml29623 #define TX_DESC_NUM_PTR_MASK 0x2C00000000000000ULL /* gather pointers */ 3373859Sml29623 #define TX_DESC_MASK_SHIFT 62 3383859Sml29623 #define TX_DESC_MASK_MASK 0x4000000000000000ULL /* Mark bit */ 3393859Sml29623 #define TX_DESC_SOP_SHIF 63 3403859Sml29623 #define TX_DESC_NUM_MASK 0x8000000000000000ULL /* Start of packet */ 3413859Sml29623 3423859Sml29623 #define TCAM_FLOW_KEY_MAX_CLASS 12 3433859Sml29623 #define TCAM_L3_MAX_USER_CLASS 4 344*11304SJanie.Lu@Sun.COM #define TCAM_MAX_ENTRY 256 3453859Sml29623 #define TCAM_NIU_TCAM_MAX_ENTRY 128 3463859Sml29623 #define TCAM_NXGE_TCAM_MAX_ENTRY 256 347*11304SJanie.Lu@Sun.COM #define NXGE_L2_PROG_CLS 2 348*11304SJanie.Lu@Sun.COM #define NXGE_L3_PROG_CLS 4 3493859Sml29623 3503859Sml29623 3513859Sml29623 3523859Sml29623 /* TCAM entry formats */ 3533859Sml29623 #define TCAM_IPV4_5TUPLE_FORMAT 0x00 3543859Sml29623 #define TCAM_IPV6_5TUPLE_FORMAT 0x01 3553859Sml29623 #define TCAM_ETHERTYPE_FORMAT 0x02 3563859Sml29623 3573859Sml29623 3583859Sml29623 /* TCAM */ 3593859Sml29623 #define TCAM_SELECT_IPV6 0x01 3603859Sml29623 #define TCAM_LOOKUP 0x04 3613859Sml29623 #define TCAM_DISCARD 0x08 3623859Sml29623 3633859Sml29623 /* FLOW Key */ 3643859Sml29623 #define FLOW_L4_1_34_BYTES 0x10 3653859Sml29623 #define FLOW_L4_1_78_BYTES 0x11 3663859Sml29623 #define FLOW_L4_0_12_BYTES (0x10 << 2) 3673859Sml29623 #define FLOW_L4_0_56_BYTES (0x11 << 2) 3683859Sml29623 #define FLOW_PROTO_NEXT 0x10 3693859Sml29623 #define FLOW_IPDA 0x20 3703859Sml29623 #define FLOW_IPSA 0x40 3713859Sml29623 #define FLOW_VLAN 0x80 3723859Sml29623 #define FLOW_L2DA 0x100 3733859Sml29623 #define FLOW_PORT 0x200 3743859Sml29623 3753859Sml29623 /* TCAM */ 3763859Sml29623 #define MAX_EFRAME 11 3773859Sml29623 3783859Sml29623 #define TCAM_USE_L2RDC_FLOW_LOOKUP 0x00 3793859Sml29623 #define TCAM_USE_OFFSET_DONE 0x01 3803859Sml29623 #define TCAM_OVERRIDE_L2_FLOW_LOOKUP 0x02 3813859Sml29623 #define TCAM_OVERRIDE_L2_USE_OFFSET 0x03 3823859Sml29623 3833859Sml29623 /* 3843859Sml29623 * FCRAM (Hashing): 3853859Sml29623 * 1. IPv4 exact match 3863859Sml29623 * 2. IPv6 exact match 3873859Sml29623 * 3. IPv4 Optimistic match 3883859Sml29623 * 4. IPv6 Optimistic match 3893859Sml29623 * 3903859Sml29623 */ 3913859Sml29623 #define FCRAM_IPV4_EXT_MATCH 0x00 3923859Sml29623 #define FCRAM_IPV6_EXT_MATCH 0x01 3933859Sml29623 #define FCRAM_IPV4_OPTI_MATCH 0x02 3943859Sml29623 #define FCRAM_IPV6_OPTI_MATCH 0x03 3953859Sml29623 3963859Sml29623 3973859Sml29623 #define NXGE_HASH_MAX_ENTRY 256 3983859Sml29623 3993859Sml29623 4003859Sml29623 #define MAC_ADDR_LENGTH 6 4013859Sml29623 4023859Sml29623 /* convert values */ 4033859Sml29623 #define NXGE_BASE(x, y) (((y) << (x ## _SHIFT)) & (x ## _MASK)) 4043859Sml29623 #define NXGE_VAL(x, y) (((y) & (x ## _MASK)) >> (x ## _SHIFT)) 4053859Sml29623 4063859Sml29623 /* 4073859Sml29623 * Locate the DMA channel start offset (PIO_VADDR) 4083859Sml29623 * (DMA virtual address space of the PIO block) 4093859Sml29623 */ 4103859Sml29623 #define TDMC_PIOVADDR_OFFSET(channel) (2 * DMA_CSR_SIZE * channel) 4113859Sml29623 #define RDMC_PIOVADDR_OFFSET(channel) (TDMC_OFFSET(channel) + DMA_CSR_SIZE) 4123859Sml29623 4133859Sml29623 /* 4143859Sml29623 * PIO access using the DMC block directly (DMC) 4153859Sml29623 */ 4163859Sml29623 #define DMC_OFFSET(channel) (DMA_CSR_SIZE * channel) 4173859Sml29623 #define TDMC_OFFSET(channel) (TX_RNG_CFIG + DMA_CSR_SIZE * channel) 4183859Sml29623 4193859Sml29623 /* 4203859Sml29623 * Number of logical pages. 4213859Sml29623 */ 4223859Sml29623 #define NXGE_MAX_LOGICAL_PAGES 2 4233859Sml29623 4243859Sml29623 #ifdef SOLARIS 4253859Sml29623 #ifndef i386 4263859Sml29623 #define _BIT_FIELDS_BIG_ENDIAN _BIT_FIELDS_HTOL 4273859Sml29623 #else 4283859Sml29623 #define _BIT_FIELDS_LITTLE_ENDIAN _BIT_FIELDS_LTOH 4293859Sml29623 #endif 4303859Sml29623 #else 4313859Sml29623 #define _BIT_FIELDS_LITTLE_ENDIAN _LITTLE_ENDIAN_BITFIELD 4323859Sml29623 #endif 4333859Sml29623 4343859Sml29623 #define MAX_PIO_RETRIES 32 4353859Sml29623 4363859Sml29623 #define IS_PORT_NUM_VALID(portn)\ 4373859Sml29623 (portn < 4) 4383859Sml29623 4393859Sml29623 /* 4403859Sml29623 * The following macros expect unsigned input values. 4413859Sml29623 */ 4423859Sml29623 #define TXDMA_CHANNEL_VALID(cn) (cn < NXGE_MAX_TDCS) 4433859Sml29623 #define TXDMA_PAGE_VALID(pn) (pn < NXGE_MAX_LOGICAL_PAGES) 4443859Sml29623 #define TXDMA_FUNC_VALID(fn) (fn < MAX_PORTS_PER_NXGE) 4453859Sml29623 #define FUNC_VALID(n) (n < MAX_PORTS_PER_NXGE) 4463859Sml29623 4473859Sml29623 /* 4483859Sml29623 * DMA channel binding definitions. 4493859Sml29623 */ 4503859Sml29623 #define VIR_PAGE_INDEX_MAX 8 4513859Sml29623 #define VIR_SUB_REGIONS 2 4523859Sml29623 #define VIR_DMA_BIND 1 4533859Sml29623 4543859Sml29623 #define SUBREGION_VALID(n) (n < VIR_SUB_REGIONS) 4553859Sml29623 #define VIR_PAGE_INDEX_VALID(n) (n < VIR_PAGE_INDEX_MAX) 4563859Sml29623 #define VRXDMA_CHANNEL_VALID(n) (n < NXGE_MAX_RDCS) 4573859Sml29623 4583859Sml29623 /* 4593859Sml29623 * Logical device definitions. 4603859Sml29623 */ 4613859Sml29623 #define NXGE_INT_MAX_LD 69 4623859Sml29623 #define NXGE_INT_MAX_LDG 64 4633859Sml29623 4643859Sml29623 #define NXGE_RDMA_LD_START 0 4653859Sml29623 #define NXGE_TDMA_LD_START 32 4663859Sml29623 #define NXGE_MIF_LD 63 4673859Sml29623 #define NXGE_MAC_LD_PORT0 64 4683859Sml29623 #define NXGE_MAC_LD_PORT1 65 4693859Sml29623 #define NXGE_MAC_LD_PORT2 66 4703859Sml29623 #define NXGE_MAC_LD_PORT3 67 4713859Sml29623 #define NXGE_SYS_ERROR_LD 68 4723859Sml29623 4733859Sml29623 #define LDG_VALID(n) (n < NXGE_INT_MAX_LDG) 4743859Sml29623 #define LD_VALID(n) (n < NXGE_INT_MAX_LD) 4753859Sml29623 #define LD_RXDMA_LD_VALID(n) (n < NXGE_MAX_RDCS) 4763859Sml29623 #define LD_TXDMA_LD_VALID(n) (n >= NXGE_MAX_RDCS && \ 4773859Sml29623 ((n - NXGE_MAX_RDCS) < NXGE_MAX_TDCS))) 4783859Sml29623 #define LD_MAC_VALID(n) (IS_PORT_NUM_VALID(n)) 4793859Sml29623 4803859Sml29623 #define LD_TIMER_MAX 0x3f 4813859Sml29623 #define LD_INTTIMER_VALID(n) (n <= LD_TIMER_MAX) 4823859Sml29623 4833859Sml29623 /* System Interrupt Data */ 4843859Sml29623 #define SID_VECTOR_MAX 0x1f 4853859Sml29623 #define SID_VECTOR_VALID(n) (n <= SID_VECTOR_MAX) 4863859Sml29623 4873859Sml29623 #define NXGE_COMPILE_32 4883859Sml29623 4893859Sml29623 #ifdef __cplusplus 4903859Sml29623 } 4913859Sml29623 #endif 4923859Sml29623 4933859Sml29623 #endif /* _SYS_NXGE_NXGE_DEFS_H */ 494