155723Simp/*- 255723Simp * Copyright (c) 1998, 1999 Scott Mitchell 355723Simp * All rights reserved. 455723Simp * 555723Simp * Redistribution and use in source and binary forms, with or without 655723Simp * modification, are permitted provided that the following conditions 755723Simp * are met: 855723Simp * 1. Redistributions of source code must retain the above copyright 955723Simp * notice, this list of conditions and the following disclaimer. 1055723Simp * 2. Redistributions in binary form must reproduce the above copyright 1155723Simp * notice, this list of conditions and the following disclaimer in the 1255723Simp * documentation and/or other materials provided with the distribution. 1355723Simp * 1455723Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1555723Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1655723Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1755723Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1855723Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1955723Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2055723Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2155723Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2255723Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2355723Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2455723Simp * SUCH DAMAGE. 2555723Simp * 2655723Simp * $Id: if_xe.c,v 1.20 1999/06/13 19:17:40 scott Exp $ 2755723Simp * $FreeBSD$ 2855723Simp */ 2955723Simp#ifndef DEV_XE_IF_XEDEV_H 3055723Simp#define DEV_XE_IF_XEDEV_H 3155723Simp 3255723Simp/* 3355723Simp * One of these structures per allocated device 3455723Simp */ 3555723Simpstruct xe_softc { 36179551Sjhb struct ifmedia ifmedia; 37179551Sjhb struct ifmib_iso_8802_3 mibdata; 38179551Sjhb struct callout media_timer; 39179551Sjhb struct callout wdog_timer; 40179551Sjhb int tx_timeout; 41179551Sjhb struct mtx lock; 42179551Sjhb struct ifnet *ifp; 43179551Sjhb struct ifmedia *ifm; 44179551Sjhb u_char enaddr[ETHER_ADDR_LEN]; 45179551Sjhb const char *card_type; /* Card model name */ 46179551Sjhb const char *vendor; /* Card manufacturer */ 47179551Sjhb device_t dev; /* Device */ 48179551Sjhb void *intrhand; 49179551Sjhb struct resource *irq_res; 50179551Sjhb int irq_rid; 51179551Sjhb struct resource *port_res; 52179551Sjhb int port_rid; 53179551Sjhb struct resource *ce2_port_res; 54179551Sjhb int ce2_port_rid; 55179551Sjhb int srev; /* Silicon revision */ 56179551Sjhb int tx_queued; /* Transmit packets currently waiting */ 57179551Sjhb int tx_tpr; /* Last value of TPR reg on card */ 58179551Sjhb int tx_timeouts; /* Count of transmit timeouts */ 59179551Sjhb uint16_t tx_min; /* Smallest packet for no padding */ 60179551Sjhb uint16_t tx_thres; /* Threshold bytes for early transmit */ 61179551Sjhb int autoneg_status; /* Autonegotiation progress state */ 62179551Sjhb int media; /* Private media word */ 63179551Sjhb u_char version; /* Bonding Version register from card */ 64179551Sjhb u_char modem; /* 1 = Card has a modem */ 65179551Sjhb u_char ce2; /* 1 = Card has CE2 silicon */ 66179551Sjhb u_char mohawk; /* 1 = Card has Mohawk (CE3) silicon */ 67179551Sjhb u_char dingo; /* 1 = Card has Dingo (CEM56) silicon */ 68179551Sjhb u_char phy_ok; /* 1 = MII-compliant PHY found */ 69179551Sjhb u_char gone; /* 1 = Card bailed out */ 7055723Simp}; 7155723Simp 72179492Sjhb#define XE_LOCK(sc) mtx_lock(&(sc)->lock) 73179492Sjhb#define XE_UNLOCK(sc) mtx_unlock(&(sc)->lock) 74179492Sjhb#define XE_ASSERT_LOCKED(sc) mtx_assert(&(sc)->lock, MA_OWNED) 75179492Sjhb 7655723Simp/* 7755723Simp * For accessing card registers 7855723Simp */ 79179551Sjhb#define XE_INB(r) bus_read_1(scp->port_res, (r)) 80179551Sjhb#define XE_INW(r) bus_read_2(scp->port_res, (r)) 81179551Sjhb#define XE_OUTB(r, b) bus_write_1(scp->port_res, (r), (b)) 82179551Sjhb#define XE_OUTW(r, w) bus_write_2(scp->port_res, (r), (w)) 83179551Sjhb#define XE_SELECT_PAGE(p) XE_OUTB(XE_PR, (p)) 8455723Simp 85179551Sjhbint xe_attach(device_t dev); 86179551Sjhbint xe_activate(device_t dev); 87179551Sjhbvoid xe_deactivate(device_t dev); 88179551Sjhbvoid xe_stop(struct xe_softc *scp); 8990962Sshiba 9055723Simp#endif /* DEV_XE_IF_XEVAR_H */ 91