1*9b829552Sclaudio /* $OpenBSD: elink3var.h,v 1.19 2009/11/23 16:36:22 claudio Exp $ */ 2c3ae1c22Sniklas /* $NetBSD: elink3var.h,v 1.12 1997/03/30 22:47:11 jonathan Exp $ */ 3aeabe1beSderaadt 4aeabe1beSderaadt /* 5f1a5e2beSderaadt * Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org> 6aeabe1beSderaadt * All rights reserved. 7aeabe1beSderaadt * 8aeabe1beSderaadt * Redistribution and use in source and binary forms, with or without 9aeabe1beSderaadt * modification, are permitted provided that the following conditions 10aeabe1beSderaadt * are met: 11aeabe1beSderaadt * 1. Redistributions of source code must retain the above copyright 12aeabe1beSderaadt * notice, this list of conditions and the following disclaimer. 13aeabe1beSderaadt * 2. Redistributions in binary form must reproduce the above copyright 14aeabe1beSderaadt * notice, this list of conditions and the following disclaimer in the 15aeabe1beSderaadt * documentation and/or other materials provided with the distribution. 16aeabe1beSderaadt * 3. All advertising materials mentioning features or use of this software 17aeabe1beSderaadt * must display the following acknowledgement: 18aeabe1beSderaadt * This product includes software developed by Herb Peyerl. 19aeabe1beSderaadt * 4. The name of Herb Peyerl may not be used to endorse or promote products 20aeabe1beSderaadt * derived from this software without specific prior written permission. 21aeabe1beSderaadt * 22aeabe1beSderaadt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23aeabe1beSderaadt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24aeabe1beSderaadt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25aeabe1beSderaadt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26aeabe1beSderaadt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27aeabe1beSderaadt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28aeabe1beSderaadt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29aeabe1beSderaadt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30aeabe1beSderaadt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31aeabe1beSderaadt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32aeabe1beSderaadt */ 33aeabe1beSderaadt 34aeabe1beSderaadt /* 35aeabe1beSderaadt * Ethernet software status per interface. 36aeabe1beSderaadt */ 37aeabe1beSderaadt struct ep_softc { 38aeabe1beSderaadt struct device sc_dev; 39aeabe1beSderaadt void *sc_ih; 4093852194Smickey struct timeout sc_epmbuffill_tmo; 41aeabe1beSderaadt 42aeabe1beSderaadt struct arpcom sc_arpcom; /* Ethernet common part */ 435b5c4e1aSaaron struct mii_data sc_mii; /* MII/media control */ 44c0981ad2Sniklas bus_space_tag_t sc_iot; /* bus cookie */ 45c0981ad2Sniklas bus_space_handle_t sc_ioh; /* bus i/o handle */ 46c3ae1c22Sniklas u_int ep_connectors; /* Connectors on this card. */ 47aeabe1beSderaadt #define MAX_MBS 8 /* # of mbufs we keep around */ 48aeabe1beSderaadt struct mbuf *mb[MAX_MBS]; /* spare mbuf storage. */ 49aeabe1beSderaadt int next_mb; /* Which mbuf to use next. */ 50aeabe1beSderaadt int tx_start_thresh; /* Current TX_start_thresh. */ 51aeabe1beSderaadt int tx_succ_ok; /* # packets sent in sequence */ 52aeabe1beSderaadt /* w/o underrun */ 53b708c379Sderaadt 54c3ae1c22Sniklas u_int ep_flags; /* capabilities flag (from EEPROM) */ 55c3ae1c22Sniklas #define EP_FLAGS_PNP 0x0001 56c3ae1c22Sniklas #define EP_FLAGS_FULLDUPLEX 0x0002 57c3ae1c22Sniklas #define EP_FLAGS_LARGEPKT 0x0004 /* 4k packet support */ 58c3ae1c22Sniklas #define EP_FLAGS_SLAVEDMA 0x0008 59c3ae1c22Sniklas #define EP_FLAGS_SECONDDMA 0x0010 60c3ae1c22Sniklas #define EP_FLAGS_FULLDMA 0x0020 61c3ae1c22Sniklas #define EP_FLAGS_FRAGMENTDMA 0x0040 62c3ae1c22Sniklas #define EP_FLAGS_CRC_PASSTHRU 0x0080 63c3ae1c22Sniklas #define EP_FLAGS_TXDONE 0x0100 64c3ae1c22Sniklas #define EP_FLAGS_NO_TXLENGTH 0x0200 65c3ae1c22Sniklas #define EP_FLAGS_RXREPEAT 0x0400 66c3ae1c22Sniklas #define EP_FLAGS_SNOOPING 0x0800 67c3ae1c22Sniklas #define EP_FLAGS_100MBIT 0x1000 68c3ae1c22Sniklas #define EP_FLAGS_POWERMGMT 0x2000 69b7e0ee72Sfgsch #define EP_FLAGS_MII 0x4000 70c3ae1c22Sniklas 71c3ae1c22Sniklas u_short ep_chipset; /* Chipset family on this board */ 72c3ae1c22Sniklas #define EP_CHIPSET_UNKNOWN 0x00 /* unknown (assume 3c509) */ 73c3ae1c22Sniklas #define EP_CHIPSET_3C509 0x01 /* PIO: 3c509, 3c589 */ 74c3ae1c22Sniklas #define EP_CHIPSET_VORTEX 0x02 /* 100mbit, single-pkt dma */ 75c3ae1c22Sniklas #define EP_CHIPSET_BOOMERANG 0x03 /* Saner dma plus PIO */ 76c3ae1c22Sniklas #define EP_CHIPSET_BOOMERANG2 0x04 /* Saner dma, no PIO */ 775b5c4e1aSaaron #define EP_CHIPSET_ROADRUNNER 0x05 /* Like Boomerang, but PCMCIA */ 78c3ae1c22Sniklas 79aeabe1beSderaadt u_char bustype; 80aeabe1beSderaadt #define EP_BUS_ISA 0x0 81aeabe1beSderaadt #define EP_BUS_PCMCIA 0x1 82aeabe1beSderaadt #define EP_BUS_EISA 0x2 83aeabe1beSderaadt #define EP_BUS_PCI 0x3 84aeabe1beSderaadt 85aeabe1beSderaadt #define EP_IS_BUS_32(a) ((a) & 0x2) 863c72141eSderaadt 87c3ae1c22Sniklas u_char txashift; /* shift in SET_TX_AVAIL_THRESH */ 88aeabe1beSderaadt }; 89aeabe1beSderaadt 90c4071fd1Smillert u_int16_t epreadeeprom(bus_space_tag_t, bus_space_handle_t, int); 91c4071fd1Smillert void epconfig(struct ep_softc *, u_short, u_int8_t *); 92c4071fd1Smillert int epintr(void *); 93c4071fd1Smillert void epstop(struct ep_softc *); 94c4071fd1Smillert void epinit(struct ep_softc *); 95c4071fd1Smillert int ep_detach(struct device *); 96