1 1.52 riastrad /* $NetBSD: i82557var.h,v 1.52 2015/04/13 16:33:24 riastradh Exp $ */ 2 1.1 thorpej 3 1.1 thorpej /*- 4 1.23 thorpej * Copyright (c) 1997, 1998, 1999, 2001 The NetBSD Foundation, Inc. 5 1.1 thorpej * All rights reserved. 6 1.1 thorpej * 7 1.1 thorpej * This code is derived from software contributed to The NetBSD Foundation 8 1.1 thorpej * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 9 1.1 thorpej * NASA Ames Research Center. 10 1.1 thorpej * 11 1.1 thorpej * Redistribution and use in source and binary forms, with or without 12 1.1 thorpej * modification, are permitted provided that the following conditions 13 1.1 thorpej * are met: 14 1.1 thorpej * 1. Redistributions of source code must retain the above copyright 15 1.1 thorpej * notice, this list of conditions and the following disclaimer. 16 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright 17 1.1 thorpej * notice, this list of conditions and the following disclaimer in the 18 1.1 thorpej * documentation and/or other materials provided with the distribution. 19 1.1 thorpej * 20 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 1.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE. 31 1.1 thorpej */ 32 1.1 thorpej 33 1.34 perry /* 34 1.1 thorpej * Copyright (c) 1995, David Greenman 35 1.1 thorpej * All rights reserved. 36 1.34 perry * 37 1.1 thorpej * Redistribution and use in source and binary forms, with or without 38 1.1 thorpej * modification, are permitted provided that the following conditions 39 1.34 perry * are met: 40 1.1 thorpej * 1. Redistributions of source code must retain the above copyright 41 1.1 thorpej * notice unmodified, this list of conditions, and the following 42 1.34 perry * disclaimer. 43 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright 44 1.1 thorpej * notice, this list of conditions and the following disclaimer in the 45 1.1 thorpej * documentation and/or other materials provided with the distribution. 46 1.1 thorpej * 47 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 48 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 49 1.1 thorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 50 1.1 thorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 51 1.1 thorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 52 1.1 thorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 53 1.1 thorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 54 1.1 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 55 1.1 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 56 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 57 1.1 thorpej * SUCH DAMAGE. 58 1.1 thorpej * 59 1.1 thorpej * Id: if_fxpvar.h,v 1.4 1997/11/29 08:11:01 davidg Exp 60 1.1 thorpej */ 61 1.1 thorpej 62 1.12 thorpej #include <sys/callout.h> 63 1.52 riastrad #include <sys/rndsource.h> 64 1.12 thorpej 65 1.1 thorpej /* 66 1.30 wiz * Misc. definitions for the Intel i82557 fast Ethernet controller 67 1.1 thorpej * driver. 68 1.1 thorpej */ 69 1.1 thorpej 70 1.1 thorpej /* 71 1.2 thorpej * Transmit descriptor list size. 72 1.1 thorpej */ 73 1.19 thorpej #define FXP_NTXCB 256 74 1.2 thorpej #define FXP_NTXCB_MASK (FXP_NTXCB - 1) 75 1.2 thorpej #define FXP_NEXTTX(x) ((x + 1) & FXP_NTXCB_MASK) 76 1.28 thorpej #define FXP_NTXSEG 16 77 1.31 yamt #define FXP_IPCB_NTXSEG (FXP_NTXSEG - 1) 78 1.1 thorpej 79 1.1 thorpej /* 80 1.1 thorpej * Number of receive frame area buffers. These are large, so 81 1.1 thorpej * choose wisely. 82 1.1 thorpej */ 83 1.19 thorpej #define FXP_NRFABUFS 128 84 1.1 thorpej 85 1.1 thorpej /* 86 1.25 wiz * Maximum number of seconds that the receiver can be idle before we 87 1.1 thorpej * assume it's dead and attempt to reset it by reprogramming the 88 1.1 thorpej * multicast filter. This is part of a work-around for a bug in the 89 1.1 thorpej * NIC. See fxp_stats_update(). 90 1.1 thorpej */ 91 1.1 thorpej #define FXP_MAX_RX_IDLE 15 92 1.1 thorpej 93 1.1 thorpej /* 94 1.1 thorpej * Misc. DMA'd data structures are allocated in a single clump, that 95 1.1 thorpej * maps to a single DMA segment, to make several things easier (computing 96 1.1 thorpej * offsets, setting up DMA maps, etc.) 97 1.1 thorpej */ 98 1.1 thorpej struct fxp_control_data { 99 1.1 thorpej /* 100 1.20 thorpej * The transmit control blocks and transmit buffer descriptors. 101 1.20 thorpej * We arrange them like this so that everything is all lined 102 1.20 thorpej * up to use the extended TxCB feature. 103 1.20 thorpej */ 104 1.20 thorpej struct fxp_txdesc { 105 1.20 thorpej struct fxp_cb_tx txd_txcb; 106 1.31 yamt union { 107 1.31 yamt struct fxp_ipcb txdu_ipcb; 108 1.31 yamt struct fxp_tbd txdu_tbd[FXP_NTXSEG]; 109 1.31 yamt } txd_u; 110 1.20 thorpej } fcd_txdescs[FXP_NTXCB]; 111 1.2 thorpej 112 1.2 thorpej /* 113 1.2 thorpej * The configuration CB. 114 1.2 thorpej */ 115 1.2 thorpej struct fxp_cb_config fcd_configcb; 116 1.2 thorpej 117 1.2 thorpej /* 118 1.2 thorpej * The Individual Address CB. 119 1.2 thorpej */ 120 1.2 thorpej struct fxp_cb_ias fcd_iascb; 121 1.2 thorpej 122 1.2 thorpej /* 123 1.1 thorpej * The multicast setup CB. 124 1.1 thorpej */ 125 1.1 thorpej struct fxp_cb_mcs fcd_mcscb; 126 1.1 thorpej 127 1.1 thorpej /* 128 1.27 thorpej * The microcode setup CB. 129 1.27 thorpej */ 130 1.27 thorpej struct fxp_cb_ucode fcd_ucode; 131 1.27 thorpej 132 1.27 thorpej /* 133 1.1 thorpej * The NIC statistics. 134 1.1 thorpej */ 135 1.1 thorpej struct fxp_stats fcd_stats; 136 1.41 tsutsui 137 1.41 tsutsui /* 138 1.41 tsutsui * TX pad buffer for ip4csum-tx bug workaround. 139 1.41 tsutsui */ 140 1.41 tsutsui uint8_t fcd_txpad[FXP_IP4CSUMTX_PADLEN]; 141 1.1 thorpej }; 142 1.1 thorpej 143 1.31 yamt #define txd_tbd txd_u.txdu_tbd 144 1.31 yamt 145 1.1 thorpej #define FXP_CDOFF(x) offsetof(struct fxp_control_data, x) 146 1.20 thorpej #define FXP_CDTXOFF(x) FXP_CDOFF(fcd_txdescs[(x)].txd_txcb) 147 1.20 thorpej #define FXP_CDTBDOFF(x) FXP_CDOFF(fcd_txdescs[(x)].txd_tbd) 148 1.2 thorpej #define FXP_CDCONFIGOFF FXP_CDOFF(fcd_configcb) 149 1.2 thorpej #define FXP_CDIASOFF FXP_CDOFF(fcd_iascb) 150 1.2 thorpej #define FXP_CDMCSOFF FXP_CDOFF(fcd_mcscb) 151 1.27 thorpej #define FXP_CDUCODEOFF FXP_CDOFF(fcd_ucode) 152 1.2 thorpej #define FXP_CDSTATSOFF FXP_CDOFF(fcd_stats) 153 1.41 tsutsui #define FXP_CDTXPADOFF FXP_CDOFF(fcd_txpad) 154 1.2 thorpej 155 1.2 thorpej /* 156 1.2 thorpej * Software state for transmit descriptors. 157 1.2 thorpej */ 158 1.2 thorpej struct fxp_txsoft { 159 1.2 thorpej struct mbuf *txs_mbuf; /* head of mbuf chain */ 160 1.2 thorpej bus_dmamap_t txs_dmamap; /* our DMA map */ 161 1.2 thorpej }; 162 1.1 thorpej 163 1.1 thorpej /* 164 1.2 thorpej * Software state per device. 165 1.2 thorpej */ 166 1.1 thorpej struct fxp_softc { 167 1.40 joerg device_t sc_dev; 168 1.1 thorpej bus_space_tag_t sc_st; /* bus space tag */ 169 1.1 thorpej bus_space_handle_t sc_sh; /* bus space handle */ 170 1.48 dyoung bus_size_t sc_size; /* bus space size */ 171 1.1 thorpej bus_dma_tag_t sc_dmat; /* bus dma tag */ 172 1.1 thorpej struct ethercom sc_ethercom; /* ethernet common part */ 173 1.14 jhawk void *sc_ih; /* interrupt handler cookie */ 174 1.2 thorpej 175 1.2 thorpej struct mii_data sc_mii; /* MII/media information */ 176 1.12 thorpej struct callout sc_callout; /* MII callout */ 177 1.1 thorpej 178 1.1 thorpej /* 179 1.1 thorpej * We create a single DMA map that maps all data structure 180 1.1 thorpej * overhead, except for RFAs, which are mapped by the 181 1.1 thorpej * fxp_rxdesc DMA map on a per-mbuf basis. 182 1.1 thorpej */ 183 1.1 thorpej bus_dmamap_t sc_dmamap; 184 1.1 thorpej #define sc_cddma sc_dmamap->dm_segs[0].ds_addr 185 1.1 thorpej 186 1.1 thorpej /* 187 1.5 thorpej * Software state for transmit descriptors. 188 1.1 thorpej */ 189 1.2 thorpej struct fxp_txsoft sc_txsoft[FXP_NTXCB]; 190 1.2 thorpej 191 1.24 thorpej int sc_rfa_size; /* size of the RFA structure */ 192 1.5 thorpej struct ifqueue sc_rxq; /* receive buffer queue */ 193 1.5 thorpej bus_dmamap_t sc_rxmaps[FXP_NRFABUFS]; /* free receive buffer DMA maps */ 194 1.5 thorpej int sc_rxfree; /* free map index */ 195 1.5 thorpej int sc_rxidle; /* # of seconds RX has been idle */ 196 1.45 tsutsui uint16_t sc_txcmd; /* transmit command (LITTLE ENDIAN) */ 197 1.1 thorpej 198 1.1 thorpej /* 199 1.2 thorpej * Control data structures. 200 1.1 thorpej */ 201 1.2 thorpej struct fxp_control_data *sc_control_data; 202 1.2 thorpej 203 1.26 thorpej #ifdef FXP_EVENT_COUNTERS 204 1.26 thorpej struct evcnt sc_ev_txstall; /* Tx stalled */ 205 1.26 thorpej struct evcnt sc_ev_txintr; /* Tx interrupts */ 206 1.26 thorpej struct evcnt sc_ev_rxintr; /* Rx interrupts */ 207 1.33 thorpej struct evcnt sc_ev_txpause; /* Tx PAUSE frames */ 208 1.33 thorpej struct evcnt sc_ev_rxpause; /* Rx PAUSE frames */ 209 1.26 thorpej #endif /* FXP_EVENT_COUNTERS */ 210 1.26 thorpej 211 1.10 joda bus_dma_segment_t sc_cdseg; /* control dma segment */ 212 1.10 joda int sc_cdnseg; 213 1.10 joda 214 1.22 thorpej int sc_rev; /* chip revision */ 215 1.2 thorpej int sc_flags; /* misc. flags */ 216 1.2 thorpej 217 1.23 thorpej #define FXPF_MII 0x0001 /* device uses MII */ 218 1.23 thorpej #define FXPF_ATTACHED 0x0002 /* attach has succeeded */ 219 1.23 thorpej #define FXPF_WANTINIT 0x0004 /* want a re-init */ 220 1.23 thorpej #define FXPF_HAS_RESUME_BUG 0x0008 /* has the resume bug */ 221 1.29 mycroft #define FXPF_MWI 0x0010 /* enable PCI MWI */ 222 1.29 mycroft #define FXPF_READ_ALIGN 0x0020 /* align read access w/ cacheline */ 223 1.29 mycroft #define FXPF_WRITE_ALIGN 0x0040 /* end write on cacheline */ 224 1.46 tsutsui #define FXPF_EXT_TXCB 0x0080 /* has extended TxCB */ 225 1.29 mycroft #define FXPF_UCODE_LOADED 0x0100 /* microcode is loaded */ 226 1.46 tsutsui #define FXPF_EXT_RFA 0x0200 /* has extended RFD and IPCB (82550) */ 227 1.32 thorpej #define FXPF_RECV_WORKAROUND 0x0800 /* receiver lock-up workaround */ 228 1.42 mrg #define FXPF_FC 0x1000 /* has flow control */ 229 1.46 tsutsui #define FXPF_82559_RXCSUM 0x2000 /* has 82559 compat RX checksum */ 230 1.27 thorpej 231 1.27 thorpej int sc_int_delay; /* interrupt delay */ 232 1.27 thorpej int sc_bundle_max; /* max packet bundle */ 233 1.2 thorpej 234 1.2 thorpej int sc_txpending; /* number of TX requests pending */ 235 1.2 thorpej int sc_txdirty; /* first dirty TX descriptor */ 236 1.2 thorpej int sc_txlast; /* last used TX descriptor */ 237 1.1 thorpej 238 1.1 thorpej int phy_primary_device; /* device type of primary PHY */ 239 1.8 sommerfe 240 1.8 sommerfe int sc_enabled; /* boolean; power enabled on interface */ 241 1.17 thorpej int (*sc_enable)(struct fxp_softc *); 242 1.17 thorpej void (*sc_disable)(struct fxp_softc *); 243 1.8 sommerfe 244 1.10 joda int sc_eeprom_size; /* log2 size of EEPROM */ 245 1.49 tls krndsource_t rnd_source; /* random source */ 246 1.1 thorpej }; 247 1.26 thorpej 248 1.26 thorpej #ifdef FXP_EVENT_COUNTERS 249 1.26 thorpej #define FXP_EVCNT_INCR(ev) (ev)->ev_count++ 250 1.26 thorpej #else 251 1.26 thorpej #define FXP_EVCNT_INCR(ev) /* nothing */ 252 1.26 thorpej #endif 253 1.2 thorpej 254 1.5 thorpej #define FXP_RXMAP_GET(sc) ((sc)->sc_rxmaps[(sc)->sc_rxfree++]) 255 1.5 thorpej #define FXP_RXMAP_PUT(sc, map) (sc)->sc_rxmaps[--(sc)->sc_rxfree] = (map) 256 1.5 thorpej 257 1.2 thorpej #define FXP_CDTXADDR(sc, x) ((sc)->sc_cddma + FXP_CDTXOFF((x))) 258 1.2 thorpej #define FXP_CDTBDADDR(sc, x) ((sc)->sc_cddma + FXP_CDTBDOFF((x))) 259 1.41 tsutsui #define FXP_CDTXPADADDR(sc) ((sc)->sc_cddma + FXP_CDTXPADOFF) 260 1.2 thorpej 261 1.20 thorpej #define FXP_CDTX(sc, x) (&(sc)->sc_control_data->fcd_txdescs[(x)]) 262 1.2 thorpej 263 1.2 thorpej #define FXP_DSTX(sc, x) (&(sc)->sc_txsoft[(x)]) 264 1.2 thorpej 265 1.2 thorpej #define FXP_CDTXSYNC(sc, x, ops) \ 266 1.2 thorpej bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ 267 1.20 thorpej FXP_CDTXOFF((x)), sizeof(struct fxp_txdesc), (ops)) 268 1.2 thorpej 269 1.2 thorpej #define FXP_CDCONFIGSYNC(sc, ops) \ 270 1.2 thorpej bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ 271 1.2 thorpej FXP_CDCONFIGOFF, sizeof(struct fxp_cb_config), (ops)) 272 1.2 thorpej 273 1.2 thorpej #define FXP_CDIASSYNC(sc, ops) \ 274 1.2 thorpej bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ 275 1.2 thorpej FXP_CDIASOFF, sizeof(struct fxp_cb_ias), (ops)) 276 1.2 thorpej 277 1.2 thorpej #define FXP_CDMCSSYNC(sc, ops) \ 278 1.2 thorpej bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ 279 1.2 thorpej FXP_CDMCSOFF, sizeof(struct fxp_cb_mcs), (ops)) 280 1.27 thorpej 281 1.27 thorpej #define FXP_CDUCODESYNC(sc, ops) \ 282 1.27 thorpej bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ 283 1.27 thorpej FXP_CDUCODEOFF, sizeof(struct fxp_cb_ucode), (ops)) 284 1.15 tsutsui 285 1.15 tsutsui #define FXP_CDSTATSSYNC(sc, ops) \ 286 1.15 tsutsui bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_dmamap, \ 287 1.15 tsutsui FXP_CDSTATSOFF, sizeof(struct fxp_stats), (ops)) 288 1.5 thorpej 289 1.24 thorpej #define FXP_RXBUFSIZE(sc, m) ((m)->m_ext.ext_size - \ 290 1.24 thorpej (sc->sc_rfa_size + \ 291 1.5 thorpej RFA_ALIGNMENT_FUDGE)) 292 1.5 thorpej 293 1.5 thorpej #define FXP_RFASYNC(sc, m, ops) \ 294 1.5 thorpej bus_dmamap_sync((sc)->sc_dmat, M_GETCTX((m), bus_dmamap_t), \ 295 1.24 thorpej RFA_ALIGNMENT_FUDGE, (sc)->sc_rfa_size, (ops)) 296 1.5 thorpej 297 1.5 thorpej #define FXP_RXBUFSYNC(sc, m, ops) \ 298 1.5 thorpej bus_dmamap_sync((sc)->sc_dmat, M_GETCTX((m), bus_dmamap_t), \ 299 1.24 thorpej RFA_ALIGNMENT_FUDGE + (sc)->sc_rfa_size, \ 300 1.24 thorpej FXP_RXBUFSIZE((sc), (m)), (ops)) 301 1.5 thorpej 302 1.5 thorpej #define FXP_MTORFA(m) (struct fxp_rfa *)((m)->m_ext.ext_buf + \ 303 1.5 thorpej RFA_ALIGNMENT_FUDGE) 304 1.5 thorpej 305 1.5 thorpej #define FXP_INIT_RFABUF(sc, m) \ 306 1.5 thorpej do { \ 307 1.5 thorpej bus_dmamap_t __rxmap = M_GETCTX((m), bus_dmamap_t); \ 308 1.5 thorpej struct mbuf *__p_m; \ 309 1.5 thorpej struct fxp_rfa *__rfa, *__p_rfa; \ 310 1.45 tsutsui uint32_t __v; \ 311 1.5 thorpej \ 312 1.24 thorpej (m)->m_data = (m)->m_ext.ext_buf + (sc)->sc_rfa_size + \ 313 1.5 thorpej RFA_ALIGNMENT_FUDGE; \ 314 1.5 thorpej \ 315 1.5 thorpej __rfa = FXP_MTORFA((m)); \ 316 1.24 thorpej __rfa->size = htole16(FXP_RXBUFSIZE((sc), (m))); \ 317 1.9 thorpej /* BIG_ENDIAN: no need to swap to store 0 */ \ 318 1.5 thorpej __rfa->rfa_status = 0; \ 319 1.36 tsutsui __rfa->rfa_control = \ 320 1.36 tsutsui htole16(FXP_RFA_CONTROL_EL | FXP_RFA_CONTROL_S); \ 321 1.9 thorpej /* BIG_ENDIAN: no need to swap to store 0 */ \ 322 1.5 thorpej __rfa->actual_size = 0; \ 323 1.5 thorpej \ 324 1.5 thorpej /* NOTE: the RFA is misaligned, so we must copy. */ \ 325 1.9 thorpej /* BIG_ENDIAN: no need to swap to store 0xffffffff */ \ 326 1.9 thorpej __v = 0xffffffff; \ 327 1.51 joerg memcpy(__UNVOLATILE(&__rfa->link_addr), &__v, sizeof(__v)); \ 328 1.51 joerg memcpy(__UNVOLATILE(&__rfa->rbd_addr), &__v, sizeof(__v)); \ 329 1.5 thorpej \ 330 1.5 thorpej FXP_RFASYNC((sc), (m), \ 331 1.5 thorpej BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); \ 332 1.5 thorpej \ 333 1.5 thorpej FXP_RXBUFSYNC((sc), (m), BUS_DMASYNC_PREREAD); \ 334 1.5 thorpej \ 335 1.5 thorpej if ((__p_m = (sc)->sc_rxq.ifq_tail) != NULL) { \ 336 1.5 thorpej __p_rfa = FXP_MTORFA(__p_m); \ 337 1.9 thorpej __v = htole32(__rxmap->dm_segs[0].ds_addr + \ 338 1.9 thorpej RFA_ALIGNMENT_FUDGE); \ 339 1.5 thorpej FXP_RFASYNC((sc), __p_m, \ 340 1.5 thorpej BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); \ 341 1.51 joerg memcpy(__UNVOLATILE(&__p_rfa->link_addr), &__v, \ 342 1.5 thorpej sizeof(__v)); \ 343 1.36 tsutsui __p_rfa->rfa_control &= htole16(~(FXP_RFA_CONTROL_EL| \ 344 1.36 tsutsui FXP_RFA_CONTROL_S)); \ 345 1.5 thorpej FXP_RFASYNC((sc), __p_m, \ 346 1.5 thorpej BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); \ 347 1.5 thorpej } \ 348 1.5 thorpej IF_ENQUEUE(&(sc)->sc_rxq, (m)); \ 349 1.5 thorpej } while (0) 350 1.1 thorpej 351 1.1 thorpej /* Macros to ease CSR access. */ 352 1.1 thorpej #define CSR_READ_1(sc, reg) \ 353 1.1 thorpej bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg)) 354 1.1 thorpej #define CSR_READ_2(sc, reg) \ 355 1.1 thorpej bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg)) 356 1.1 thorpej #define CSR_READ_4(sc, reg) \ 357 1.1 thorpej bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg)) 358 1.1 thorpej #define CSR_WRITE_1(sc, reg, val) \ 359 1.1 thorpej bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 360 1.1 thorpej #define CSR_WRITE_2(sc, reg, val) \ 361 1.1 thorpej bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 362 1.1 thorpej #define CSR_WRITE_4(sc, reg, val) \ 363 1.1 thorpej bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val)) 364 1.1 thorpej 365 1.17 thorpej void fxp_attach(struct fxp_softc *); 366 1.47 cegger int fxp_activate(device_t, enum devact); 367 1.48 dyoung int fxp_detach(struct fxp_softc *, int); 368 1.17 thorpej int fxp_intr(void *); 369 1.8 sommerfe 370 1.17 thorpej int fxp_enable(struct fxp_softc*); 371 1.17 thorpej void fxp_disable(struct fxp_softc*); 372