if_epvar.h revision 121249
151673Smdodd/* 251673Smdodd * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved. 351673Smdodd * 451673Smdodd * Redistribution and use in source and binary forms, with or without 551673Smdodd * modification, are permitted provided that the following conditions are 651673Smdodd * met: 1. Redistributions of source code must retain the above copyright 751673Smdodd * notice, this list of conditions and the following disclaimer. 2. The name 851673Smdodd * of the author may not be used to endorse or promote products derived from 951673Smdodd * this software without specific prior written permission 1051673Smdodd * 1151673Smdodd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 1251673Smdodd * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1351673Smdodd * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 1451673Smdodd * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1551673Smdodd * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 1651673Smdodd * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 1751673Smdodd * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 1851673Smdodd * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1951673Smdodd * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 2051673Smdodd * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2151673Smdodd * 2251673Smdodd * $FreeBSD: head/sys/dev/ep/if_epvar.h 121249 2003-10-19 17:38:04Z imp $ 2351673Smdodd */ 2451673Smdodd 2552549Smdoddstruct ep_board { 26117700Smarkm u_short prod_id; /* product ID */ 27117700Smarkm int cmd_off; /* command offset (bit shift) */ 28117700Smarkm int mii_trans; /* activate MII transiever */ 29117700Smarkm u_short res_cfg; /* resource configuration */ 3052549Smdodd}; 3152549Smdodd 3251673Smdodd/* 3351673Smdodd * Ethernet software status per interface. 3451673Smdodd */ 3551673Smdoddstruct ep_softc { 36117700Smarkm struct arpcom arpcom; /* Ethernet common part */ 37117700Smarkm struct ifmedia ifmedia; /* media info */ 3851673Smdodd 39117700Smarkm device_t dev; 4052549Smdodd 41117700Smarkm struct resource *iobase; 42117700Smarkm struct resource *irq; 4352549Smdodd 44121231Simp bus_space_handle_t bsh; 45121231Simp bus_space_tag_t bst; 46117700Smarkm void *ep_intrhand; 4752549Smdodd 48117700Smarkm u_short ep_connectors; /* Connectors on this card. */ 49117700Smarkm u_char ep_connector; /* Configured connector. */ 5052549Smdodd 51117700Smarkm struct mbuf *top; 52117700Smarkm struct mbuf *mcur; 53117700Smarkm short cur_len; 5452549Smdodd 55117700Smarkm int stat; /* some flags */ 5652549Smdodd#define F_RX_FIRST 0x001 5752549Smdodd#define F_PROMISC 0x008 5851673Smdodd#define F_ACCESS_32_BITS 0x100 5951673Smdodd 60117700Smarkm int gone; /* adapter is not present (for PCCARD) */ 6151673Smdodd 62117700Smarkm struct ep_board epb; 6351673Smdodd 64117700Smarkm int unit; 6552549Smdodd 6651673Smdodd#ifdef EP_LOCAL_STATS 67117700Smarkm short tx_underrun; 68117700Smarkm short rx_no_first; 69117700Smarkm short rx_no_mbuf; 70117700Smarkm short rx_overrunf; 71117700Smarkm short rx_overrunl; 7251673Smdodd#endif 7351673Smdodd}; 7451673Smdodd 75117700Smarkmint ep_alloc(device_t); 76117700Smarkmvoid ep_free(device_t); 77117700Smarkmint ep_detach(device_t); 78117700Smarkmvoid ep_get_media(struct ep_softc *); 79117700Smarkmint ep_attach(struct ep_softc *); 80117700Smarkmvoid ep_intr(void *); 81117700Smarkmint get_e(struct ep_softc *, u_int16_t, u_int16_t *); 82117700Smarkmint ep_get_macaddr(struct ep_softc *, u_char *); 83121206Simp 84121249Simp#define EP_READ_1(sc, off) (bus_space_read_1((sc)->bst, (sc)->bsh, off)) 85121249Simp#define EP_READ_2(sc, off) (bus_space_read_2((sc)->bst, (sc)->bsh, off)) 86121206Simp#define EP_WRITE_1(sc, off, val) \ 87121249Simp bus_space_write_1(sc->bst, sc->bsh, off, val) 88121206Simp#define EP_WRITE_2(sc, off, val) \ 89121249Simp bus_space_write_2(sc->bst, sc->bsh, off, val) 90121206Simp#define EP_WRITE_MULTI_1(sc, off, addr, count) \ 91121249Simp bus_space_write_multi_1(sc->bst, sc->bsh, off, addr, count) 92121206Simp#define EP_WRITE_MULTI_2(sc, off, addr, count) \ 93121249Simp bus_space_write_multi_2(sc->bst, sc->bsh, off, addr, count) 94121206Simp#define EP_WRITE_MULTI_4(sc, off, addr, count) \ 95121249Simp bus_space_write_multi_4(sc->bst, sc->bsh, off, addr, count) 96121206Simp#define EP_READ_MULTI_1(sc, off, addr, count) \ 97121249Simp bus_space_read_multi_1(sc->bst, sc->bsh, off, addr, count) 98121206Simp#define EP_READ_MULTI_2(sc, off, addr, count) \ 99121249Simp bus_space_read_multi_2(sc->bst, sc->bsh, off, addr, count) 100121206Simp#define EP_READ_MULTI_4(sc, off, addr, count) \ 101121249Simp bus_space_read_multi_4(sc->bst, sc->bsh, off, addr, count) 102