1*69b3e104SGarrett D'Amore /* 2*69b3e104SGarrett D'Amore * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 3*69b3e104SGarrett D'Amore * Use is subject to license terms. 4*69b3e104SGarrett D'Amore */ 5*69b3e104SGarrett D'Amore 6*69b3e104SGarrett D'Amore /* 7*69b3e104SGarrett D'Amore * Copyright (c) 1998 The NetBSD Foundation, Inc. 8*69b3e104SGarrett D'Amore * All rights reserved. 9*69b3e104SGarrett D'Amore * 10*69b3e104SGarrett D'Amore * This code is derived from software contributed to The NetBSD Foundation 11*69b3e104SGarrett D'Amore * by Frank van der Linden. 12*69b3e104SGarrett D'Amore * 13*69b3e104SGarrett D'Amore * Redistribution and use in source and binary forms, with or without 14*69b3e104SGarrett D'Amore * modification, are permitted provided that the following conditions 15*69b3e104SGarrett D'Amore * are met: 16*69b3e104SGarrett D'Amore * 1. Redistributions of source code must retain the above copyright 17*69b3e104SGarrett D'Amore * notice, this list of conditions and the following disclaimer. 18*69b3e104SGarrett D'Amore * 2. Redistributions in binary form must reproduce the above copyright 19*69b3e104SGarrett D'Amore * notice, this list of conditions and the following disclaimer in the 20*69b3e104SGarrett D'Amore * documentation and/or other materials provided with the distribution. 21*69b3e104SGarrett D'Amore * 22*69b3e104SGarrett D'Amore * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 23*69b3e104SGarrett D'Amore * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 24*69b3e104SGarrett D'Amore * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25*69b3e104SGarrett D'Amore * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 26*69b3e104SGarrett D'Amore * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27*69b3e104SGarrett D'Amore * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28*69b3e104SGarrett D'Amore * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29*69b3e104SGarrett D'Amore * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30*69b3e104SGarrett D'Amore * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31*69b3e104SGarrett D'Amore * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32*69b3e104SGarrett D'Amore * POSSIBILITY OF SUCH DAMAGE. 33*69b3e104SGarrett D'Amore */ 34*69b3e104SGarrett D'Amore 35*69b3e104SGarrett D'Amore 36*69b3e104SGarrett D'Amore #ifndef ELXL_H 37*69b3e104SGarrett D'Amore #define ELXL_H 38*69b3e104SGarrett D'Amore 39*69b3e104SGarrett D'Amore /* 40*69b3e104SGarrett D'Amore * This file defines the registers specific to the EtherLink XL family 41*69b3e104SGarrett D'Amore * of NICs. 42*69b3e104SGarrett D'Amore */ 43*69b3e104SGarrett D'Amore 44*69b3e104SGarrett D'Amore #define REG_CMD_STAT 0x0e /* Write command, read status */ 45*69b3e104SGarrett D'Amore 46*69b3e104SGarrett D'Amore #define CMD_GLOBAL_RESET 0x0000 47*69b3e104SGarrett D'Amore #define CMD_SELECT_WINDOW 0x0800 48*69b3e104SGarrett D'Amore #define CMD_BNC_ENABLE 0x1000 /* enable 10BASE2 DC-DC converter */ 49*69b3e104SGarrett D'Amore #define CMD_RX_DISABLE 0x1800 50*69b3e104SGarrett D'Amore #define CMD_RX_ENABLE 0x2000 51*69b3e104SGarrett D'Amore #define CMD_RX_RESET 0x2800 52*69b3e104SGarrett D'Amore #define CMD_UP_STALL 0x3000 53*69b3e104SGarrett D'Amore #define CMD_UP_UNSTALL 0x3001 54*69b3e104SGarrett D'Amore #define CMD_DN_STALL 0x3002 55*69b3e104SGarrett D'Amore #define CMD_DN_UNSTALL 0x3003 56*69b3e104SGarrett D'Amore #define CMD_TX_ENABLE 0x4800 57*69b3e104SGarrett D'Amore #define CMD_TX_DISABLE 0x5000 58*69b3e104SGarrett D'Amore #define CMD_TX_RESET 0x5800 59*69b3e104SGarrett D'Amore #define CMD_INT_REQ 0x6000 60*69b3e104SGarrett D'Amore #define CMD_INT_ACK 0x6800 61*69b3e104SGarrett D'Amore #define CMD_INT_ENABLE 0x7000 62*69b3e104SGarrett D'Amore #define CMD_IND_ENABLE 0x7800 63*69b3e104SGarrett D'Amore #define CMD_SET_FILTER 0x8000 64*69b3e104SGarrett D'Amore #define CMD_SET_RXEARLY 0x8800 65*69b3e104SGarrett D'Amore #define CMD_SET_TXSTART 0x9800 66*69b3e104SGarrett D'Amore #define CMD_STATS_ENABLE 0xa800 67*69b3e104SGarrett D'Amore #define CMD_STATS_DISABLE 0xb000 68*69b3e104SGarrett D'Amore #define CMD_BNC_DISABLE 0xb800 /* disable 10BASE2 DC-DC converter */ 69*69b3e104SGarrett D'Amore #define CMD_SET_TXRECLAIM 0xc000 70*69b3e104SGarrett D'Amore #define CMD_CLEAR_HASHBIT 0xc800 71*69b3e104SGarrett D'Amore #define CMD_SET_HASHBIT 0xcc00 72*69b3e104SGarrett D'Amore 73*69b3e104SGarrett D'Amore /* 74*69b3e104SGarrett D'Amore * Defines for the interrupt status register 75*69b3e104SGarrett D'Amore */ 76*69b3e104SGarrett D'Amore #define INT_LATCH 0x0001 77*69b3e104SGarrett D'Amore #define INT_HOST_ERROR 0x0002 78*69b3e104SGarrett D'Amore #define INT_TX_COMPLETE 0x0004 79*69b3e104SGarrett D'Amore #define INT_RX_COMPLETE 0x0010 80*69b3e104SGarrett D'Amore #define INT_RX_EARLY 0x0020 81*69b3e104SGarrett D'Amore #define INT_REQUESTED 0x0040 82*69b3e104SGarrett D'Amore #define INT_STATS 0x0080 83*69b3e104SGarrett D'Amore #define INT_LINK 0x0100 /* NB: most NICs don't implement it! */ 84*69b3e104SGarrett D'Amore #define INT_DN_COMPLETE 0x0200 85*69b3e104SGarrett D'Amore #define INT_UP_COMPLETE 0x0400 86*69b3e104SGarrett D'Amore #define STAT_CMD_IN_PROGRESS 0x1000 87*69b3e104SGarrett D'Amore 88*69b3e104SGarrett D'Amore #define INT_WATCHED \ 89*69b3e104SGarrett D'Amore (INT_HOST_ERROR | INT_STATS | INT_DN_COMPLETE | INT_UP_COMPLETE) 90*69b3e104SGarrett D'Amore 91*69b3e104SGarrett D'Amore 92*69b3e104SGarrett D'Amore /* 93*69b3e104SGarrett D'Amore * Flat address space registers (outside the windows) 94*69b3e104SGarrett D'Amore */ 95*69b3e104SGarrett D'Amore 96*69b3e104SGarrett D'Amore #define REG_TXPKTID 0x18 /* 90xB only */ 97*69b3e104SGarrett D'Amore #define REG_TIMER 0x1a 98*69b3e104SGarrett D'Amore #define REG_TXSTATUS 0x1b 99*69b3e104SGarrett D'Amore #define TXSTATUS_RECLAIM_ERR 0x02 100*69b3e104SGarrett D'Amore #define TXSTATUS_STATUS_OFLOW 0x04 /* bad news! */ 101*69b3e104SGarrett D'Amore #define TXSTATUS_MAXCOLLISIONS 0x08 102*69b3e104SGarrett D'Amore #define TXSTATUS_UNDERRUN 0x10 103*69b3e104SGarrett D'Amore #define TXSTATUS_JABBER 0x20 104*69b3e104SGarrett D'Amore #define TXSTATUS_INT_REQ 0x40 105*69b3e104SGarrett D'Amore #define TXSTATUS_COMPLETE 0x80 106*69b3e104SGarrett D'Amore #define TXSTATUS_ERRS 0x32 107*69b3e104SGarrett D'Amore 108*69b3e104SGarrett D'Amore #define REG_INTSTATUSAUTO 0x1e 109*69b3e104SGarrett D'Amore #define REG_DMACTRL 0x20 110*69b3e104SGarrett D'Amore #define DMACTRL_DNCMPLREQ 0x00000002 111*69b3e104SGarrett D'Amore #define DMACTRL_DNSTALLED 0x00000004 112*69b3e104SGarrett D'Amore #define DMACTRL_UPCOMPLETE 0x00000008 113*69b3e104SGarrett D'Amore #define DMACTRL_DNCOMPLETE 0x00000010 114*69b3e104SGarrett D'Amore #define DMACTRL_UPRXEAREN 0x00000020 115*69b3e104SGarrett D'Amore #define DMACTRL_ARNCNTDN 0x00000040 116*69b3e104SGarrett D'Amore #define DMACTRL_DNINPROG 0x00000080 117*69b3e104SGarrett D'Amore #define DMACTRL_CNTSPEED 0x00000100 118*69b3e104SGarrett D'Amore #define DMACTRL_CNTDNMODE 0x00000200 119*69b3e104SGarrett D'Amore #define DMACTRL_ALTSEQDIS 0x00010000 120*69b3e104SGarrett D'Amore #define DMACTRL_DEFEATMWI 0x00100000 121*69b3e104SGarrett D'Amore #define DMACTRL_DEFEATMRL 0x00200000 122*69b3e104SGarrett D'Amore #define DMACTRL_UPOVERDIS 0x00400000 123*69b3e104SGarrett D'Amore #define DMACTRL_TARGABORT 0x40000000 124*69b3e104SGarrett D'Amore #define DMACTRL_MSTRABORT 0x80000000 125*69b3e104SGarrett D'Amore #define REG_DNLISTPTR 0x24 126*69b3e104SGarrett D'Amore #define REG_DNBURSTTHRESH 0x2a /* 90xB only */ 127*69b3e104SGarrett D'Amore #define REG_DNPRIOTHRESH 0x2c /* 90xB only */ 128*69b3e104SGarrett D'Amore #define REG_DNPOLL 0x2d /* 90xB only */ 129*69b3e104SGarrett D'Amore #define REG_TXFREETHRESH 0x2f /* 90x only */ 130*69b3e104SGarrett D'Amore #define REG_UPPKTSTATUS 0x30 131*69b3e104SGarrett D'Amore #define REG_FREETIMER 0x34 132*69b3e104SGarrett D'Amore #define REG_COUNTDOWN 0x36 133*69b3e104SGarrett D'Amore #define REG_UPLISTPTR 0x38 134*69b3e104SGarrett D'Amore #define REG_UPPRIOTHRESH 0x3c /* 90xB only */ 135*69b3e104SGarrett D'Amore #define REG_UPPOLL 0x3d /* 90xB only */ 136*69b3e104SGarrett D'Amore #define REG_UPBURSTTHRESH 0x3e /* 90xB only */ 137*69b3e104SGarrett D'Amore #define REG_REALTIMECNT 0x40 /* 90xB only */ 138*69b3e104SGarrett D'Amore #define REG_DNMAXBURST 0x78 /* 90xB only */ 139*69b3e104SGarrett D'Amore #define REG_UPMAXBURST 0x7a /* 90xB only */ 140*69b3e104SGarrett D'Amore 141*69b3e104SGarrett D'Amore /* 142*69b3e104SGarrett D'Amore * Window 0. Eeprom access. 143*69b3e104SGarrett D'Amore */ 144*69b3e104SGarrett D'Amore #define W0_MFG_ID 0x00 145*69b3e104SGarrett D'Amore #define W0_EE_CMD 0x0a 146*69b3e104SGarrett D'Amore #define EE_CMD_ADDR 0x001f 147*69b3e104SGarrett D'Amore #define EE_CMD_WRITE_EN 0x0000 148*69b3e104SGarrett D'Amore #define EE_CMD_READ 0x0080 149*69b3e104SGarrett D'Amore #define EE_CMD_READ8 0x0200 150*69b3e104SGarrett D'Amore #define EE_CMD_BUSY 0x8000 151*69b3e104SGarrett D'Amore #define W0_EE_DATA 0x0c 152*69b3e104SGarrett D'Amore /* 153*69b3e104SGarrett D'Amore * Window 2. 154*69b3e104SGarrett D'Amore */ 155*69b3e104SGarrett D'Amore #define W2_STATION_ADDRESS 0x00 156*69b3e104SGarrett D'Amore #define W2_STATION_MASK 0x06 157*69b3e104SGarrett D'Amore #define W2_RESET_OPTIONS 0x0c /* Reset options (90xB only) */ 158*69b3e104SGarrett D'Amore #define W2_RESET_OPT_LEDPOLAR 0x0010 /* invert LED polarity */ 159*69b3e104SGarrett D'Amore #define W2_RESET_OPT_PHYPOWER 0x4000 /* turn on PHY power */ 160*69b3e104SGarrett D'Amore 161*69b3e104SGarrett D'Amore 162*69b3e104SGarrett D'Amore /* 163*69b3e104SGarrett D'Amore * Window 3. 164*69b3e104SGarrett D'Amore */ 165*69b3e104SGarrett D'Amore #define W3_INTERNAL_CONFIG 0x00 /* 32 bits */ 166*69b3e104SGarrett D'Amore #define W3_MAX_PKT_SIZE 0x04 /* 90xB only */ 167*69b3e104SGarrett D'Amore #define W3_MAC_CONTROL 0x06 168*69b3e104SGarrett D'Amore #define MAC_CONTROL_FDX 0x0020 169*69b3e104SGarrett D'Amore #define MAC_CONTROL_ALLOW_LARGE 0x0040 170*69b3e104SGarrett D'Amore #define MAC_CONTROL_FLOW_EN 0x0100 /* 90xB only */ 171*69b3e104SGarrett D'Amore #define MAC_CONTROL_VLT_EN 0x0200 /* 90xB only */ 172*69b3e104SGarrett D'Amore 173*69b3e104SGarrett D'Amore /* 174*69b3e104SGarrett D'Amore * This is reset options for the other cards, media options for 175*69b3e104SGarrett D'Amore * the 90xB NICs. Reset options are in a separate register for 176*69b3e104SGarrett D'Amore * the 90xB. 177*69b3e104SGarrett D'Amore * 178*69b3e104SGarrett D'Amore * Note that these bit values are also the same as the 179*69b3e104SGarrett D'Amore * W3_RESET_OPTIONS media selection bits on 90x NICs, which 180*69b3e104SGarrett D'Amore * conviently occupies the same register, and pretty much is 181*69b3e104SGarrett D'Amore * the same thing. There are some differences in the upper bits, 182*69b3e104SGarrett D'Amore * but we don't care about those. 183*69b3e104SGarrett D'Amore */ 184*69b3e104SGarrett D'Amore #define W3_MEDIAOPT 0x08 185*69b3e104SGarrett D'Amore #define MEDIAOPT_100T4 0x0001 186*69b3e104SGarrett D'Amore #define MEDIAOPT_100TX 0x0002 187*69b3e104SGarrett D'Amore #define MEDIAOPT_100FX 0x0004 188*69b3e104SGarrett D'Amore #define MEDIAOPT_10T 0x0008 189*69b3e104SGarrett D'Amore #define MEDIAOPT_BNC 0x0010 190*69b3e104SGarrett D'Amore #define MEDIAOPT_AUI 0x0020 191*69b3e104SGarrett D'Amore #define MEDIAOPT_MII 0x0040 192*69b3e104SGarrett D'Amore #define MEDIAOPT_10FL 0x0080 193*69b3e104SGarrett D'Amore #define MEDIAOPT_MASK 0x00ff /* excludes 10BASEFL */ 194*69b3e104SGarrett D'Amore 195*69b3e104SGarrett D'Amore /* 196*69b3e104SGarrett D'Amore * Window 4 registers. 197*69b3e104SGarrett D'Amore */ 198*69b3e104SGarrett D'Amore #define W4_MEDIASTAT 0xa 199*69b3e104SGarrett D'Amore #define MEDIASTAT_SQE_EN 0x0008 200*69b3e104SGarrett D'Amore #define MEDIASTAT_JABGUARD_EN 0x0040 201*69b3e104SGarrett D'Amore #define MEDIASTAT_LINKBEAT_EN 0x0080 202*69b3e104SGarrett D'Amore #define MEDIASTAT_LINKDETECT 0x0800 203*69b3e104SGarrett D'Amore #define MEDIASTAT_AUI_DIS 0x8000 204*69b3e104SGarrett D'Amore 205*69b3e104SGarrett D'Amore /* 206*69b3e104SGarrett D'Amore * Window 4, offset 8 is defined for MII/PHY access for EtherLink XL 207*69b3e104SGarrett D'Amore * cards. 208*69b3e104SGarrett D'Amore */ 209*69b3e104SGarrett D'Amore #define W4_PHYSMGMT 0x08 210*69b3e104SGarrett D'Amore #define PHYSMGMT_CLK 0x0001 211*69b3e104SGarrett D'Amore #define PHYSMGMT_DATA 0x0002 212*69b3e104SGarrett D'Amore #define PHYSMGMT_DIR 0x0004 213*69b3e104SGarrett D'Amore 214*69b3e104SGarrett D'Amore /* 215*69b3e104SGarrett D'Amore * Counter in window 4 for packets with a bad start-of-stream delimiter/ 216*69b3e104SGarrett D'Amore */ 217*69b3e104SGarrett D'Amore #define W4_BADSSD 0x0c 218*69b3e104SGarrett D'Amore 219*69b3e104SGarrett D'Amore /* 220*69b3e104SGarrett D'Amore * Upper bits of 20-bit byte counters. 221*69b3e104SGarrett D'Amore */ 222*69b3e104SGarrett D'Amore #define W4_UBYTESOK 0x0d 223*69b3e104SGarrett D'Amore 224*69b3e104SGarrett D'Amore /* 225*69b3e104SGarrett D'Amore * W6 registers, used for statistics 226*69b3e104SGarrett D'Amore */ 227*69b3e104SGarrett D'Amore #define W6_TX_BYTES 0x0c 228*69b3e104SGarrett D'Amore #define W6_RX_BYTES 0x0a 229*69b3e104SGarrett D'Amore #define W6_UPPER_FRAMES 0x09 230*69b3e104SGarrett D'Amore #define W6_DEFER 0x08 231*69b3e104SGarrett D'Amore #define W6_RX_FRAMES 0x07 232*69b3e104SGarrett D'Amore #define W6_TX_FRAMES 0x06 233*69b3e104SGarrett D'Amore #define W6_RX_OVERRUNS 0x05 234*69b3e104SGarrett D'Amore #define W6_TX_LATE_COL 0x04 235*69b3e104SGarrett D'Amore #define W6_SINGLE_COL 0x03 236*69b3e104SGarrett D'Amore #define W6_MULT_COL 0x02 237*69b3e104SGarrett D'Amore #define W6_SQE_ERRORS 0x01 238*69b3e104SGarrett D'Amore #define W6_NO_CARRIER 0x00 239*69b3e104SGarrett D'Amore 240*69b3e104SGarrett D'Amore /* 241*69b3e104SGarrett D'Amore * Receive filter bits for use with CMD_SET_FILTER. 242*69b3e104SGarrett D'Amore */ 243*69b3e104SGarrett D'Amore #define FILTER_UNICAST 0x01 244*69b3e104SGarrett D'Amore #define FILTER_ALLMULTI 0x02 245*69b3e104SGarrett D'Amore #define FILTER_ALLBCAST 0x04 246*69b3e104SGarrett D'Amore #define FILTER_PROMISC 0x08 247*69b3e104SGarrett D'Amore #define FILTER_MULTIHASH 0x10 /* only on 90xB */ 248*69b3e104SGarrett D'Amore 249*69b3e104SGarrett D'Amore /* 250*69b3e104SGarrett D'Amore * Window 7 registers. These are different for 90x and 90xB than 251*69b3e104SGarrett D'Amore * for the EtherLink III / Fast EtherLink cards. 252*69b3e104SGarrett D'Amore */ 253*69b3e104SGarrett D'Amore 254*69b3e104SGarrett D'Amore #define W7_VLANMASK 0x00 /* 90xB only */ 255*69b3e104SGarrett D'Amore #define W7_VLANTYPE 0x04 /* 90xB only */ 256*69b3e104SGarrett D'Amore #define W7_TIMER 0x0a /* 90x only */ 257*69b3e104SGarrett D'Amore #define W7_TX_STATUS 0x0b /* 90x only */ 258*69b3e104SGarrett D'Amore #define W7_POWEREVENT 0x0c /* 90xB only */ 259*69b3e104SGarrett D'Amore #define W7_INTSTATUS 0x0e 260*69b3e104SGarrett D'Amore 261*69b3e104SGarrett D'Amore /* 262*69b3e104SGarrett D'Amore * The Internal Config register is different on 90xB cards. The 263*69b3e104SGarrett D'Amore * different masks / shifts are defined here. 264*69b3e104SGarrett D'Amore */ 265*69b3e104SGarrett D'Amore 266*69b3e104SGarrett D'Amore /* 267*69b3e104SGarrett D'Amore * Lower 16 bits. 268*69b3e104SGarrett D'Amore */ 269*69b3e104SGarrett D'Amore #define CONFIG_TXLARGE 0x4000 270*69b3e104SGarrett D'Amore #define CONFIG_TXLARGE_SHIFT 14 271*69b3e104SGarrett D'Amore 272*69b3e104SGarrett D'Amore #define CONFIG_RXLARGE 0x8000 273*69b3e104SGarrett D'Amore #define CONFIG_RXLARGE_SHIFT 15 274*69b3e104SGarrett D'Amore 275*69b3e104SGarrett D'Amore /* 276*69b3e104SGarrett D'Amore * Upper 16 bits. 277*69b3e104SGarrett D'Amore */ 278*69b3e104SGarrett D'Amore #define XCVR_SEL_10T 0x00000000U 279*69b3e104SGarrett D'Amore #define XCVR_SEL_AUI 0x00100000U 280*69b3e104SGarrett D'Amore #define XCVR_SEL_BNC 0x00300000U 281*69b3e104SGarrett D'Amore #define XCVR_SEL_100TX 0x00400000U /* 3com says don't use this! */ 282*69b3e104SGarrett D'Amore #define XCVR_SEL_100FX 0x00500000U 283*69b3e104SGarrett D'Amore #define XCVR_SEL_MII 0x00600000U 284*69b3e104SGarrett D'Amore #define XCVR_SEL_AUTO 0x00800000U 285*69b3e104SGarrett D'Amore #define XCVR_SEL_MASK 0x00f00000U 286*69b3e104SGarrett D'Amore 287*69b3e104SGarrett D'Amore #define RAM_PARTITION_5_3 0x00000000U 288*69b3e104SGarrett D'Amore #define RAM_PARTITION_3_1 0x00010000U 289*69b3e104SGarrett D'Amore #define RAM_PARTITION_1_1 0x00020000U 290*69b3e104SGarrett D'Amore #define RAM_PARTITION_3_5 0x00030000U 291*69b3e104SGarrett D'Amore #define RAM_PARTITION_MASK 0x00030000U 292*69b3e104SGarrett D'Amore 293*69b3e104SGarrett D'Amore #define CONFIG_AUTOSEL 0x0100 294*69b3e104SGarrett D'Amore #define CONFIG_AUTOSEL_SHIFT 8 295*69b3e104SGarrett D'Amore 296*69b3e104SGarrett D'Amore #define CONFIG_DISABLEROM 0x0200 297*69b3e104SGarrett D'Amore #define CONFIG_DISABLEROM_SHIFT 9 298*69b3e104SGarrett D'Amore 299*69b3e104SGarrett D'Amore /* 300*69b3e104SGarrett D'Amore * ID of internal PHY. 301*69b3e104SGarrett D'Amore */ 302*69b3e104SGarrett D'Amore 303*69b3e104SGarrett D'Amore #define INTPHY_ID 24 304*69b3e104SGarrett D'Amore 305*69b3e104SGarrett D'Amore /* 306*69b3e104SGarrett D'Amore * Fragment header as laid out in memory for DMA access. 307*69b3e104SGarrett D'Amore */ 308*69b3e104SGarrett D'Amore 309*69b3e104SGarrett D'Amore #define EX_FR_LENMASK 0x00001fff /* mask for length in fr_len field */ 310*69b3e104SGarrett D'Amore #define EX_FR_LAST 0x80000000 /* indicates last fragment */ 311*69b3e104SGarrett D'Amore 312*69b3e104SGarrett D'Amore /* 313*69b3e104SGarrett D'Amore * 3Com NICs have separate structures for packet upload (receive) and 314*69b3e104SGarrett D'Amore * download (transmit) descriptors. However, the structures for the 315*69b3e104SGarrett D'Amore * "legacy" transmit format are nearly identical except for the fact 316*69b3e104SGarrett D'Amore * that the third field is named differently and the bit fields are 317*69b3e104SGarrett D'Amore * different. To maximize code reuse, we use a single type to cover 318*69b3e104SGarrett D'Amore * both uses. Note that for receive we can arrange these in a loop, 319*69b3e104SGarrett D'Amore * but not for transmit. Note also that for simplicity, we only use 320*69b3e104SGarrett D'Amore * the "type 0" legacy DPD format -- the features offered by the newer 321*69b3e104SGarrett D'Amore * type 1 format are not something we need. 322*69b3e104SGarrett D'Amore */ 323*69b3e104SGarrett D'Amore typedef struct ex_pd { 324*69b3e104SGarrett D'Amore uint32_t pd_link; 325*69b3e104SGarrett D'Amore uint32_t pd_shared; 326*69b3e104SGarrett D'Amore uint32_t pd_addr; 327*69b3e104SGarrett D'Amore uint32_t pd_len; 328*69b3e104SGarrett D'Amore } ex_pd_t; 329*69b3e104SGarrett D'Amore #define pd_fsh pd_shared 330*69b3e104SGarrett D'Amore #define pd_status pd_shared 331*69b3e104SGarrett D'Amore 332*69b3e104SGarrett D'Amore /* 333*69b3e104SGarrett D'Amore * Type 0 Download Packet Descriptor (DPD). We don't use the other 334*69b3e104SGarrett D'Amore * type, since it isn't supported by older 90x ASICs. 335*69b3e104SGarrett D'Amore */ 336*69b3e104SGarrett D'Amore struct ex_dpd { 337*69b3e104SGarrett D'Amore uint32_t dpd_nextptr; /* prt to next fragheader */ 338*69b3e104SGarrett D'Amore uint32_t dpd_fsh; /* frame start header */ 339*69b3e104SGarrett D'Amore uint32_t dpd_addr; 340*69b3e104SGarrett D'Amore uint32_t dpd_len; 341*69b3e104SGarrett D'Amore }; 342*69b3e104SGarrett D'Amore 343*69b3e104SGarrett D'Amore struct ex_upd { 344*69b3e104SGarrett D'Amore uint32_t upd_nextptr; 345*69b3e104SGarrett D'Amore uint32_t upd_pktstatus; 346*69b3e104SGarrett D'Amore uint32_t upd_addr; /* phys addr of frag */ 347*69b3e104SGarrett D'Amore uint32_t upd_len; /* length of frag */ 348*69b3e104SGarrett D'Amore }; 349*69b3e104SGarrett D'Amore 350*69b3e104SGarrett D'Amore #define DPD_DMADDR(s, t) \ 351*69b3e104SGarrett D'Amore ((s)->sc_dpddma + ((char *)((t)->tx_dpd) - (char *)((s)->sc_dpd))) 352*69b3e104SGarrett D'Amore 353*69b3e104SGarrett D'Amore /* 354*69b3e104SGarrett D'Amore * Frame Start Header bitfields. 355*69b3e104SGarrett D'Amore */ 356*69b3e104SGarrett D'Amore 357*69b3e104SGarrett D'Amore #define EX_DPD_DNIND 0x80000000 /* intr on download done */ 358*69b3e104SGarrett D'Amore #define EX_DPD_TXIND 0x00008000 /* intr on tx done */ 359*69b3e104SGarrett D'Amore #define EX_DPD_NOCRC 0x00002000 /* no CRC append */ 360*69b3e104SGarrett D'Amore 361*69b3e104SGarrett D'Amore /* 362*69b3e104SGarrett D'Amore * Lower 12 bits are the tx length for the 90x family. The 90xB 363*69b3e104SGarrett D'Amore * assumes that the tx length is the sum of all frame lengths, 364*69b3e104SGarrett D'Amore * and uses the bits as below. It also defines some more bits in 365*69b3e104SGarrett D'Amore * the upper part. 366*69b3e104SGarrett D'Amore */ 367*69b3e104SGarrett D'Amore #define EX_DPD_EMPTY 0x20000000 /* no data in this DPD */ 368*69b3e104SGarrett D'Amore #define EX_DPD_UPDEFEAT 0x10000000 /* don't round tx lengths up */ 369*69b3e104SGarrett D'Amore #define EX_DPD_UDPCKSUM 0x08000000 /* do hardware UDP checksum */ 370*69b3e104SGarrett D'Amore #define EX_DPD_TCPCKSUM 0x04000000 /* do hardware TCP checksum */ 371*69b3e104SGarrett D'Amore #define EX_DPD_IPCKSUM 0x02000000 /* do hardware IP checksum */ 372*69b3e104SGarrett D'Amore #define EX_DPD_DNCMPLT 0x01000000 /* packet has been downloaded */ 373*69b3e104SGarrett D'Amore #define EX_DPD_IDMASK 0x000003fc /* mask for packet id */ 374*69b3e104SGarrett D'Amore #define EX_DPD_IDSHIFT 2 375*69b3e104SGarrett D'Amore #define EX_DPD_RNDMASK 0x00000003 /* mask for rounding */ 376*69b3e104SGarrett D'Amore /* 0 -> dword, 2 -> word, 1,3 -> none */ 377*69b3e104SGarrett D'Amore /* 378*69b3e104SGarrett D'Amore * upd_pktstatus bitfields. 379*69b3e104SGarrett D'Amore * The *CKSUMERR fields are only valid if the matching *CHECKED field 380*69b3e104SGarrett D'Amore * is set. 381*69b3e104SGarrett D'Amore */ 382*69b3e104SGarrett D'Amore #define EX_UPD_PKTLENMASK 0x00001fff /* 12:0 -> packet length */ 383*69b3e104SGarrett D'Amore #define EX_UPD_ERROR 0x00004000 /* rcv error */ 384*69b3e104SGarrett D'Amore #define EX_UPD_COMPLETE 0x00008000 /* rcv complete */ 385*69b3e104SGarrett D'Amore #define EX_UPD_OVERRUN 0x00010000 /* rcv overrun */ 386*69b3e104SGarrett D'Amore #define EX_UPD_RUNT 0x00020000 /* pkt < 60 bytes */ 387*69b3e104SGarrett D'Amore #define EX_UPD_ALIGNERR 0x00040000 /* alignment error */ 388*69b3e104SGarrett D'Amore #define EX_UPD_CRCERR 0x00080000 /* CRC error */ 389*69b3e104SGarrett D'Amore #define EX_UPD_OVERSIZED 0x00100000 /* oversize frame */ 390*69b3e104SGarrett D'Amore #define EX_UPD_DRIBBLEBITS 0x00800000 /* pkt had dribble bits */ 391*69b3e104SGarrett D'Amore #define EX_UPD_OVERFLOW 0x01000000 /* insufficient space for pkt */ 392*69b3e104SGarrett D'Amore #define EX_UPD_IPCKSUMERR 0x02000000 /* IP cksum error (90xB) */ 393*69b3e104SGarrett D'Amore #define EX_UPD_TCPCKSUMERR 0x04000000 /* TCP cksum error (90xB) */ 394*69b3e104SGarrett D'Amore #define EX_UPD_UDPCKSUMERR 0x08000000 /* UDP cksum error (90xB) */ 395*69b3e104SGarrett D'Amore #define EX_UPD_IPCHECKED 0x20000000 /* IP cksum done */ 396*69b3e104SGarrett D'Amore #define EX_UPD_TCPCHECKED 0x40000000 /* TCP cksum done */ 397*69b3e104SGarrett D'Amore #define EX_UPD_UDPCHECKED 0x80000000 /* UDP cksum done */ 398*69b3e104SGarrett D'Amore 399*69b3e104SGarrett D'Amore #define EX_UPD_ERR 0x001f4000 /* Errors we check for */ 400*69b3e104SGarrett D'Amore #define EX_UPD_ERR_VLAN 0x000f0000 /* same for 802.1q */ 401*69b3e104SGarrett D'Amore 402*69b3e104SGarrett D'Amore #define EX_UPD_CKSUMERR 0x0e000000 /* any IP checksum error */ 403*69b3e104SGarrett D'Amore 404*69b3e104SGarrett D'Amore /* 405*69b3e104SGarrett D'Amore * EEPROM offsets. These are 16-bit word addresses. There are a lot of 406*69b3e104SGarrett D'Amore * other things in here, but we only care about the OEM address. 407*69b3e104SGarrett D'Amore */ 408*69b3e104SGarrett D'Amore #define EE_3COM_ADDR_0 0x00 409*69b3e104SGarrett D'Amore #define EE_3COM_ADDR_1 0x01 410*69b3e104SGarrett D'Amore #define EE_3COM_ADDR_2 0x02 411*69b3e104SGarrett D'Amore #define EE_OEM_ADDR_0 0x0a 412*69b3e104SGarrett D'Amore #define EE_OEM_ADDR_1 0x0b 413*69b3e104SGarrett D'Amore #define EE_OEM_ADDR_2 0x0c 414*69b3e104SGarrett D'Amore #define EE_CAPABILITIES 0x10 415*69b3e104SGarrett D'Amore 416*69b3e104SGarrett D'Amore #define EX_NTX 256 417*69b3e104SGarrett D'Amore #define EX_NRX 128 418*69b3e104SGarrett D'Amore #define EX_BUFSZ 1536 419*69b3e104SGarrett D'Amore 420*69b3e104SGarrett D'Amore typedef struct ex_desc { 421*69b3e104SGarrett D'Amore struct ex_desc *ed_next; 422*69b3e104SGarrett D'Amore struct ex_desc *ed_prev; 423*69b3e104SGarrett D'Amore ddi_dma_handle_t ed_dmah; 424*69b3e104SGarrett D'Amore ddi_acc_handle_t ed_acch; 425*69b3e104SGarrett D'Amore caddr_t ed_buf; 426*69b3e104SGarrett D'Amore uint32_t ed_bufaddr; 427*69b3e104SGarrett D'Amore uint32_t ed_descaddr; 428*69b3e104SGarrett D'Amore uint32_t ed_off; /* offset of pd */ 429*69b3e104SGarrett D'Amore ex_pd_t *ed_pd; 430*69b3e104SGarrett D'Amore } ex_desc_t; 431*69b3e104SGarrett D'Amore 432*69b3e104SGarrett D'Amore typedef struct ex_ring { 433*69b3e104SGarrett D'Amore int r_count; 434*69b3e104SGarrett D'Amore int r_avail; 435*69b3e104SGarrett D'Amore ddi_dma_handle_t r_dmah; 436*69b3e104SGarrett D'Amore ddi_acc_handle_t r_acch; 437*69b3e104SGarrett D'Amore uint32_t r_paddr; 438*69b3e104SGarrett D'Amore ex_pd_t *r_pd; 439*69b3e104SGarrett D'Amore ex_desc_t *r_desc; 440*69b3e104SGarrett D'Amore ex_desc_t *r_head; 441*69b3e104SGarrett D'Amore ex_desc_t *r_tail; 442*69b3e104SGarrett D'Amore } ex_ring_t; 443*69b3e104SGarrett D'Amore 444*69b3e104SGarrett D'Amore /* 445*69b3e104SGarrett D'Amore * Higher level linked list of upload packet descriptors. 446*69b3e104SGarrett D'Amore */ 447*69b3e104SGarrett D'Amore struct ex_rxdesc { 448*69b3e104SGarrett D'Amore ddi_dma_handle_t rx_dmah; 449*69b3e104SGarrett D'Amore ddi_acc_handle_t rx_acch; 450*69b3e104SGarrett D'Amore caddr_t rx_buf; 451*69b3e104SGarrett D'Amore uint32_t rx_paddr; 452*69b3e104SGarrett D'Amore struct ex_upd *rx_upd; 453*69b3e104SGarrett D'Amore }; 454*69b3e104SGarrett D'Amore 455*69b3e104SGarrett D'Amore /* 456*69b3e104SGarrett D'Amore * Ethernet software status per interface. 457*69b3e104SGarrett D'Amore */ 458*69b3e104SGarrett D'Amore typedef struct ex_softc { 459*69b3e104SGarrett D'Amore dev_info_t *ex_dip; 460*69b3e104SGarrett D'Amore mac_handle_t ex_mach; 461*69b3e104SGarrett D'Amore mii_handle_t ex_miih; 462*69b3e104SGarrett D'Amore ddi_periodic_t ex_linkcheck; 463*69b3e104SGarrett D'Amore 464*69b3e104SGarrett D'Amore ddi_acc_handle_t ex_pcih; 465*69b3e104SGarrett D'Amore ddi_acc_handle_t ex_regsh; 466*69b3e104SGarrett D'Amore caddr_t ex_regsva; 467*69b3e104SGarrett D'Amore 468*69b3e104SGarrett D'Amore kmutex_t ex_txlock; 469*69b3e104SGarrett D'Amore kmutex_t ex_intrlock; 470*69b3e104SGarrett D'Amore 471*69b3e104SGarrett D'Amore ddi_intr_handle_t ex_intrh; 472*69b3e104SGarrett D'Amore 473*69b3e104SGarrett D'Amore uint8_t ex_curraddr[6]; 474*69b3e104SGarrett D'Amore uint8_t ex_factaddr[6]; 475*69b3e104SGarrett D'Amore boolean_t ex_promisc; 476*69b3e104SGarrett D'Amore unsigned ex_mccount; 477*69b3e104SGarrett D'Amore 478*69b3e104SGarrett D'Amore boolean_t ex_running; 479*69b3e104SGarrett D'Amore boolean_t ex_suspended; 480*69b3e104SGarrett D'Amore 481*69b3e104SGarrett D'Amore ex_ring_t ex_rxring; 482*69b3e104SGarrett D'Amore ex_ring_t ex_txring; 483*69b3e104SGarrett D'Amore 484*69b3e104SGarrett D'Amore uint32_t ex_xcvr; 485*69b3e104SGarrett D'Amore uint32_t ex_speed; 486*69b3e104SGarrett D'Amore link_duplex_t ex_duplex; 487*69b3e104SGarrett D'Amore boolean_t ex_fdx; 488*69b3e104SGarrett D'Amore link_state_t ex_link; 489*69b3e104SGarrett D'Amore boolean_t ex_mii_active; 490*69b3e104SGarrett D'Amore uint32_t ex_mediaopt; 491*69b3e104SGarrett D'Amore char ex_medias[128]; 492*69b3e104SGarrett D'Amore uint16_t ex_capab; 493*69b3e104SGarrett D'Amore 494*69b3e104SGarrett D'Amore /* 495*69b3e104SGarrett D'Amore * Kstats. 496*69b3e104SGarrett D'Amore */ 497*69b3e104SGarrett D'Amore uint64_t ex_ipackets; 498*69b3e104SGarrett D'Amore uint64_t ex_opackets; 499*69b3e104SGarrett D'Amore uint64_t ex_ibytes; 500*69b3e104SGarrett D'Amore uint64_t ex_obytes; 501*69b3e104SGarrett D'Amore uint64_t ex_brdcstrcv; 502*69b3e104SGarrett D'Amore uint64_t ex_multircv; 503*69b3e104SGarrett D'Amore uint64_t ex_brdcstxmt; 504*69b3e104SGarrett D'Amore uint64_t ex_multixmt; 505*69b3e104SGarrett D'Amore unsigned ex_toolong; 506*69b3e104SGarrett D'Amore unsigned ex_runt; 507*69b3e104SGarrett D'Amore unsigned ex_oflo; 508*69b3e104SGarrett D'Amore unsigned ex_fcs; 509*69b3e104SGarrett D'Amore unsigned ex_align; 510*69b3e104SGarrett D'Amore unsigned ex_allocbfail; 511*69b3e104SGarrett D'Amore unsigned ex_txerr; 512*69b3e104SGarrett D'Amore unsigned ex_uflo; 513*69b3e104SGarrett D'Amore unsigned ex_jabber; 514*69b3e104SGarrett D'Amore unsigned ex_excoll; 515*69b3e104SGarrett D'Amore unsigned ex_sqe; 516*69b3e104SGarrett D'Amore unsigned ex_nocarrier; 517*69b3e104SGarrett D'Amore unsigned ex_multcol; 518*69b3e104SGarrett D'Amore unsigned ex_defer; 519*69b3e104SGarrett D'Amore unsigned ex_latecol; 520*69b3e104SGarrett D'Amore unsigned ex_singlecol; 521*69b3e104SGarrett D'Amore 522*69b3e104SGarrett D'Amore uint_t ex_conf; /* config flags */ 523*69b3e104SGarrett D'Amore 524*69b3e104SGarrett D'Amore #define CONF_INTPHY 0x0001 /* has internal PHY at address 24 */ 525*69b3e104SGarrett D'Amore #define CONF_90XB 0x0002 /* is 90xB */ 526*69b3e104SGarrett D'Amore 527*69b3e104SGarrett D'Amore } elxl_t; 528*69b3e104SGarrett D'Amore 529*69b3e104SGarrett D'Amore #define WAIT_CMD(sc) \ 530*69b3e104SGarrett D'Amore { \ 531*69b3e104SGarrett D'Amore int stat; \ 532*69b3e104SGarrett D'Amore do { \ 533*69b3e104SGarrett D'Amore stat = GET16(REG_CMD_STAT); \ 534*69b3e104SGarrett D'Amore } while ((stat & STAT_CMD_IN_PROGRESS) && (stat != 0xffff)); \ 535*69b3e104SGarrett D'Amore } 536*69b3e104SGarrett D'Amore 537*69b3e104SGarrett D'Amore #define GET8(off) \ 538*69b3e104SGarrett D'Amore ddi_get8(sc->ex_regsh, (void *)(sc->ex_regsva + (off))) 539*69b3e104SGarrett D'Amore #define GET16(off) \ 540*69b3e104SGarrett D'Amore ddi_get16(sc->ex_regsh, (void *)(sc->ex_regsva + (off))) 541*69b3e104SGarrett D'Amore #define GET32(off) \ 542*69b3e104SGarrett D'Amore ddi_get32(sc->ex_regsh, (void *)(sc->ex_regsva + (off))) 543*69b3e104SGarrett D'Amore #define PUT8(off, val) \ 544*69b3e104SGarrett D'Amore ddi_put8(sc->ex_regsh, (void *)(sc->ex_regsva + (off)), val) 545*69b3e104SGarrett D'Amore #define PUT16(off, val) \ 546*69b3e104SGarrett D'Amore ddi_put16(sc->ex_regsh, (void *)(sc->ex_regsva + (off)), val) 547*69b3e104SGarrett D'Amore #define PUT32(off, val) \ 548*69b3e104SGarrett D'Amore ddi_put32(sc->ex_regsh, (void *)(sc->ex_regsva + (off)), val) 549*69b3e104SGarrett D'Amore 550*69b3e104SGarrett D'Amore #define SET16(off, val) PUT16(off, GET16(off) | val) 551*69b3e104SGarrett D'Amore #define CLR16(off, val) PUT16(off, GET16(off) & ~(val)) 552*69b3e104SGarrett D'Amore 553*69b3e104SGarrett D'Amore #define PUT_CMD(x) PUT16(REG_CMD_STAT, (x)) 554*69b3e104SGarrett D'Amore #define SET_WIN(x) PUT16(REG_CMD_STAT, CMD_SELECT_WINDOW | (x)) 555*69b3e104SGarrett D'Amore 556*69b3e104SGarrett D'Amore #define PUT_PD(ring, member, val) ddi_put32(ring->r_acch, &member, (val)) 557*69b3e104SGarrett D'Amore #define GET_PD(ring, member) ddi_get32(ring->r_acch, &member) 558*69b3e104SGarrett D'Amore 559*69b3e104SGarrett D'Amore #endif /* ELXL_H */ 560