1*86d7f5d3SJohn Marino /*- 2*86d7f5d3SJohn Marino * Copyright (c) 1998, 1999 Scott Mitchell 3*86d7f5d3SJohn Marino * All rights reserved. 4*86d7f5d3SJohn Marino * 5*86d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without 6*86d7f5d3SJohn Marino * modification, are permitted provided that the following conditions 7*86d7f5d3SJohn Marino * are met: 8*86d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright 9*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer. 10*86d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 11*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the 12*86d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution. 13*86d7f5d3SJohn Marino * 14*86d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15*86d7f5d3SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*86d7f5d3SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*86d7f5d3SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18*86d7f5d3SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*86d7f5d3SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*86d7f5d3SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*86d7f5d3SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*86d7f5d3SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*86d7f5d3SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*86d7f5d3SJohn Marino * SUCH DAMAGE. 25*86d7f5d3SJohn Marino * 26*86d7f5d3SJohn Marino * $Id: if_xe.c,v 1.20 1999/06/13 19:17:40 scott Exp $ 27*86d7f5d3SJohn Marino * $FreeBSD: src/sys/dev/xe/if_xevar.h,v 1.4 2003/10/14 22:51:35 rsm Exp $ 28*86d7f5d3SJohn Marino * $DragonFly: src/sys/dev/netif/xe/if_xevar.h,v 1.6 2005/11/20 10:16:56 sephe Exp $ 29*86d7f5d3SJohn Marino */ 30*86d7f5d3SJohn Marino #ifndef DEV_XE_IF_XEDEV_H 31*86d7f5d3SJohn Marino #define DEV_XE_IF_XEDEV_H 32*86d7f5d3SJohn Marino 33*86d7f5d3SJohn Marino /* 34*86d7f5d3SJohn Marino * One of these structures per allocated device 35*86d7f5d3SJohn Marino */ 36*86d7f5d3SJohn Marino struct xe_softc { 37*86d7f5d3SJohn Marino struct arpcom arpcom; 38*86d7f5d3SJohn Marino struct ifmedia ifmedia; 39*86d7f5d3SJohn Marino struct ifmib_iso_8802_3 mibdata; 40*86d7f5d3SJohn Marino struct callout xe_timer; 41*86d7f5d3SJohn Marino struct ifnet *ifp; 42*86d7f5d3SJohn Marino struct ifmedia *ifm; 43*86d7f5d3SJohn Marino const char *card_type; /* Card model name */ 44*86d7f5d3SJohn Marino const char *vendor; /* Card manufacturer */ 45*86d7f5d3SJohn Marino bus_space_tag_t bst; /* Bus space tag for card */ 46*86d7f5d3SJohn Marino bus_space_handle_t bsh; /* Bus space handle for card */ 47*86d7f5d3SJohn Marino void *intrhand; 48*86d7f5d3SJohn Marino struct resource *irq_res; 49*86d7f5d3SJohn Marino int irq_rid; 50*86d7f5d3SJohn Marino struct resource *port_res; 51*86d7f5d3SJohn Marino int port_rid; 52*86d7f5d3SJohn Marino struct resource *ce2_port_res; 53*86d7f5d3SJohn Marino int ce2_port_rid; 54*86d7f5d3SJohn Marino int srev; /* Silicon revision */ 55*86d7f5d3SJohn Marino int tx_queued; /* Packets currently waiting to transmit */ 56*86d7f5d3SJohn Marino int tx_tpr; /* Last value of TPR reg on card */ 57*86d7f5d3SJohn Marino int tx_timeouts; /* Count of transmit timeouts */ 58*86d7f5d3SJohn Marino uint16_t tx_min; /* Smallest packet we can send without padding */ 59*86d7f5d3SJohn Marino uint16_t tx_thres; /* Threshold bytes for early transmit */ 60*86d7f5d3SJohn Marino int autoneg_status; /* Autonegotiation progress state */ 61*86d7f5d3SJohn Marino int media; /* Private media word */ 62*86d7f5d3SJohn Marino u_char version; /* Bonding Version register from card */ 63*86d7f5d3SJohn Marino u_char modem; /* 1 = Card has a modem */ 64*86d7f5d3SJohn Marino u_char ce2; /* 1 = Card has CE2 silicon */ 65*86d7f5d3SJohn Marino u_char mohawk; /* 1 = Card has Mohawk (CE3) silicon */ 66*86d7f5d3SJohn Marino u_char dingo; /* 1 = Card has Dingo (CEM56) silicon */ 67*86d7f5d3SJohn Marino u_char phy_ok; /* 1 = MII-compliant PHY found and initialised */ 68*86d7f5d3SJohn Marino u_char gone; /* 1 = Card bailed out */ 69*86d7f5d3SJohn Marino }; 70*86d7f5d3SJohn Marino 71*86d7f5d3SJohn Marino /* 72*86d7f5d3SJohn Marino * For accessing card registers 73*86d7f5d3SJohn Marino */ 74*86d7f5d3SJohn Marino #define XE_INB(r) bus_space_read_1(scp->bst, scp->bsh, (r)) 75*86d7f5d3SJohn Marino #define XE_INW(r) bus_space_read_2(scp->bst, scp->bsh, (r)) 76*86d7f5d3SJohn Marino #define XE_OUTB(r, b) bus_space_write_1(scp->bst, scp->bsh, (r), (b)) 77*86d7f5d3SJohn Marino #define XE_OUTW(r, w) bus_space_write_2(scp->bst, scp->bsh, (r), (w)) 78*86d7f5d3SJohn Marino #define XE_SELECT_PAGE(p) XE_OUTB(XE_PR, (p)) 79*86d7f5d3SJohn Marino 80*86d7f5d3SJohn Marino /* 81*86d7f5d3SJohn Marino * Horrid stuff for accessing CIS tuples 82*86d7f5d3SJohn Marino */ 83*86d7f5d3SJohn Marino #define CISTPL_BUFSIZE 512 84*86d7f5d3SJohn Marino #define CISTPL_TYPE(tpl) bus_space_read_1(bst, bsh, tpl + 0) 85*86d7f5d3SJohn Marino #define CISTPL_LEN(tpl) bus_space_read_1(bst, bsh, tpl + 2) 86*86d7f5d3SJohn Marino #define CISTPL_DATA(tpl,pos) bus_space_read_1(bst, bsh, tpl+ 4 + ((pos)<<1)) 87*86d7f5d3SJohn Marino 88*86d7f5d3SJohn Marino int xe_attach(device_t); 89*86d7f5d3SJohn Marino int xe_detach(device_t); 90*86d7f5d3SJohn Marino int xe_activate(device_t); 91*86d7f5d3SJohn Marino void xe_deactivate(device_t); 92*86d7f5d3SJohn Marino 93*86d7f5d3SJohn Marino /* Debugging level */ 94*86d7f5d3SJohn Marino extern int xe_debug; 95*86d7f5d3SJohn Marino 96*86d7f5d3SJohn Marino #endif /* DEV_XE_IF_XEVAR_H */ 97