if_fxpvar.h revision 51821
129138Sdg/* 229138Sdg * Copyright (c) 1995, David Greenman 329138Sdg * All rights reserved. 429138Sdg * 529138Sdg * Modifications to support NetBSD: 629138Sdg * Copyright (c) 1997 Jason R. Thorpe. All rights reserved. 729138Sdg * 829138Sdg * Redistribution and use in source and binary forms, with or without 929138Sdg * modification, are permitted provided that the following conditions 1029138Sdg * are met: 1129138Sdg * 1. Redistributions of source code must retain the above copyright 1229138Sdg * notice unmodified, this list of conditions, and the following 1329138Sdg * disclaimer. 1429138Sdg * 2. Redistributions in binary form must reproduce the above copyright 1529138Sdg * notice, this list of conditions and the following disclaimer in the 1629138Sdg * documentation and/or other materials provided with the distribution. 1729138Sdg * 1829138Sdg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1929138Sdg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2029138Sdg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2129138Sdg * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2229138Sdg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2329138Sdg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2429138Sdg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2529138Sdg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2629138Sdg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2729138Sdg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2829138Sdg * SUCH DAMAGE. 2929138Sdg * 3050477Speter * $FreeBSD: head/sys/dev/fxp/if_fxpvar.h 51821 1999-09-30 19:03:12Z gallatin $ 3129138Sdg */ 3229138Sdg 3329138Sdg/* 3429138Sdg * Misc. defintions for the Intel EtherExpress Pro/100B PCI Fast 3529138Sdg * Ethernet driver 3629138Sdg */ 3738006Sdg/* 3838006Sdg * NOTE: Elements are ordered for optimal cacheline behavior, and NOT 3938006Sdg * for functional grouping. 4038006Sdg */ 4129138Sdgstruct fxp_softc { 4229138Sdg#if defined(__NetBSD__) 4329138Sdg struct device sc_dev; /* generic device structures */ 4429138Sdg void *sc_ih; /* interrupt handler cookie */ 4529138Sdg struct ethercom sc_ethercom; /* ethernet common part */ 4629138Sdg#else 4729138Sdg struct arpcom arpcom; /* per-interface network data */ 4845720Speter struct resource *mem; /* resource descriptor for registers */ 4945720Speter struct resource *irq; /* resource descriptor for interrupt */ 5045720Speter void *ih; /* interrupt handler cookie */ 5129138Sdg#endif /* __NetBSD__ */ 5251821Sgallatin bus_space_tag_t sc_st; /* bus space tag */ 5351821Sgallatin bus_space_handle_t sc_sh; /* bus space handle */ 5438006Sdg struct mbuf *rfa_headm; /* first mbuf in receive frame area */ 5538006Sdg struct mbuf *rfa_tailm; /* last mbuf in receive frame area */ 5629138Sdg struct fxp_cb_tx *cbl_first; /* first active TxCB in list */ 5731447Sdg int tx_queued; /* # of active TxCB's */ 5831447Sdg int need_mcsetup; /* multicast filter needs programming */ 5938006Sdg struct fxp_cb_tx *cbl_last; /* last active TxCB in list */ 6029138Sdg struct fxp_stats *fxp_stats; /* Pointer to interface stats */ 6131447Sdg int rx_idle_secs; /* # of seconds RX has been idle */ 6229681Sgibbs struct callout_handle stat_ch; /* Handle for canceling our stat timeout */ 6338006Sdg struct fxp_cb_tx *cbl_base; /* base of TxCB list */ 6431447Sdg struct fxp_cb_mcs *mcsp; /* Pointer to mcast setup descriptor */ 6531447Sdg int all_mcasts; /* receive all multicasts */ 6638006Sdg struct ifmedia sc_media; /* media information */ 6729138Sdg int phy_primary_addr; /* address of primary PHY */ 6829138Sdg int phy_primary_device; /* device type of primary PHY */ 6929138Sdg int phy_10Mbps_only; /* PHY is 10Mbps-only device */ 7029138Sdg}; 7129138Sdg 7229138Sdg/* Macros to ease CSR access. */ 7329138Sdg#define CSR_READ_1(sc, reg) \ 7429138Sdg bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg)) 7529138Sdg#define CSR_READ_2(sc, reg) \ 7629138Sdg bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg)) 7729138Sdg#define CSR_READ_4(sc, reg) \ 7829138Sdg bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg)) 7929138Sdg#define CSR_WRITE_1(sc, reg, val) \ 8029138Sdg bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 8129138Sdg#define CSR_WRITE_2(sc, reg, val) \ 8229138Sdg bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 8329138Sdg#define CSR_WRITE_4(sc, reg, val) \ 8429138Sdg bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 8529138Sdg 8629138Sdg/* Deal with slight differences in software interfaces. */ 8729138Sdg#if defined(__NetBSD__) 8829138Sdg#define sc_if sc_ethercom.ec_if 8929138Sdg#define FXP_FORMAT "%s" 9029138Sdg#define FXP_ARGS(sc) (sc)->sc_dev.dv_xname 9129138Sdg#define FXP_INTR_TYPE int 9229138Sdg#define FXP_IOCTLCMD_TYPE u_long 9329138Sdg#define FXP_BPFTAP_ARG(ifp) (ifp)->if_bpf 9429138Sdg#else /* __FreeBSD__ */ 9529138Sdg#define sc_if arpcom.ac_if 9629138Sdg#define FXP_FORMAT "fxp%d" 9729138Sdg#define FXP_ARGS(sc) (sc)->arpcom.ac_if.if_unit 9829138Sdg#define FXP_INTR_TYPE void 9936735Sdfr#define FXP_IOCTLCMD_TYPE u_long 10029138Sdg#define FXP_BPFTAP_ARG(ifp) ifp 10129138Sdg#endif /* __NetBSD__ */ 102