if_gemvar.h (174987) | if_gemvar.h (177560) |
---|---|
1/*- 2 * Copyright (C) 2001 Eduardo Horvath. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * from: NetBSD: gemvar.h,v 1.8 2002/05/15 02:36:12 matt Exp 27 * | 1/*- 2 * Copyright (C) 2001 Eduardo Horvath. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * from: NetBSD: gemvar.h,v 1.8 2002/05/15 02:36:12 matt Exp 27 * |
28 * $FreeBSD: head/sys/dev/gem/if_gemvar.h 174987 2007-12-30 01:32:03Z marius $ | 28 * $FreeBSD: head/sys/dev/gem/if_gemvar.h 177560 2008-03-24 17:23:53Z marius $ |
29 */ 30 31#ifndef _IF_GEMVAR_H 32#define _IF_GEMVAR_H 33 34#include <sys/queue.h> 35#include <sys/callout.h> 36 --- 73 unchanged lines hidden (view full) --- 110 struct mii_data *sc_mii; /* MII media control */ 111 device_t sc_dev; /* generic device information */ 112 u_char sc_enaddr[ETHER_ADDR_LEN]; 113 struct callout sc_tick_ch; /* tick callout */ 114 struct callout sc_rx_ch; /* delayed RX callout */ 115 int sc_wdog_timer; /* watchdog timer */ 116 117 void *sc_ih; | 29 */ 30 31#ifndef _IF_GEMVAR_H 32#define _IF_GEMVAR_H 33 34#include <sys/queue.h> 35#include <sys/callout.h> 36 --- 73 unchanged lines hidden (view full) --- 110 struct mii_data *sc_mii; /* MII media control */ 111 device_t sc_dev; /* generic device information */ 112 u_char sc_enaddr[ETHER_ADDR_LEN]; 113 struct callout sc_tick_ch; /* tick callout */ 114 struct callout sc_rx_ch; /* delayed RX callout */ 115 int sc_wdog_timer; /* watchdog timer */ 116 117 void *sc_ih; |
118 struct resource *sc_res[2]; | 118 struct resource *sc_res[3]; 119#define GEM_RES_INTR 0 120#define GEM_RES_BANK1 1 121#define GEM_RES_BANK2 2 122 |
119 bus_dma_tag_t sc_pdmatag; /* parent bus DMA tag */ 120 bus_dma_tag_t sc_rdmatag; /* RX bus DMA tag */ 121 bus_dma_tag_t sc_tdmatag; /* TX bus DMA tag */ 122 bus_dma_tag_t sc_cdmatag; /* control data bus DMA tag */ 123 bus_dmamap_t sc_dmamap; /* bus DMA handle */ 124 125 int sc_phyad; /* PHY to use or -1 for any */ 126 --- 44 unchanged lines hidden (view full) --- 171 172 int sc_rxptr; /* next ready RX desc./descsoft */ 173 int sc_rxfifosize; /* RX FIFO size (bytes) */ 174 175 int sc_ifflags; 176 int sc_csum_features; 177}; 178 | 123 bus_dma_tag_t sc_pdmatag; /* parent bus DMA tag */ 124 bus_dma_tag_t sc_rdmatag; /* RX bus DMA tag */ 125 bus_dma_tag_t sc_tdmatag; /* TX bus DMA tag */ 126 bus_dma_tag_t sc_cdmatag; /* control data bus DMA tag */ 127 bus_dmamap_t sc_dmamap; /* bus DMA handle */ 128 129 int sc_phyad; /* PHY to use or -1 for any */ 130 --- 44 unchanged lines hidden (view full) --- 175 176 int sc_rxptr; /* next ready RX desc./descsoft */ 177 int sc_rxfifosize; /* RX FIFO size (bytes) */ 178 179 int sc_ifflags; 180 int sc_csum_features; 181}; 182 |
183#define GEM_BANKN_BARRIER(n, sc, offs, len, flags) \ 184 bus_barrier((sc)->sc_res[(n)], (offs), (len), (flags)) 185#define GEM_BANK1_BARRIER(sc, offs, len, flags) \ 186 GEM_BANKN_BARRIER(GEM_RES_BANK1, (sc), (offs), (len), (flags)) 187#define GEM_BANK2_BARRIER(sc, offs, len, flags) \ 188 GEM_BANKN_BARRIER(GEM_RES_BANK2, (sc), (offs), (len), (flags)) 189 190#define GEM_BANKN_READ_M(n, m, sc, offs) \ 191 bus_read_ ## m((sc)->sc_res[(n)], (offs)) 192#define GEM_BANK1_READ_1(sc, offs) \ 193 GEM_BANKN_READ_M(GEM_RES_BANK1, 1, (sc), (offs)) 194#define GEM_BANK1_READ_2(sc, offs) \ 195 GEM_BANKN_READ_M(GEM_RES_BANK1, 2, (sc), (offs)) 196#define GEM_BANK1_READ_4(sc, offs) \ 197 GEM_BANKN_READ_M(GEM_RES_BANK1, 4, (sc), (offs)) 198#define GEM_BANK2_READ_1(sc, offs) \ 199 GEM_BANKN_READ_M(GEM_RES_BANK2, 1, (sc), (offs)) 200#define GEM_BANK2_READ_2(sc, offs) \ 201 GEM_BANKN_READ_M(GEM_RES_BANK2, 2, (sc), (offs)) 202#define GEM_BANK2_READ_4(sc, offs) \ 203 GEM_BANKN_READ_M(GEM_RES_BANK2, 4, (sc), (offs)) 204 205#define GEM_BANKN_WRITE_M(n, m, sc, offs, v) \ 206 bus_write_ ## m((sc)->sc_res[n], (offs), (v)) 207#define GEM_BANK1_WRITE_1(sc, offs, v) \ 208 GEM_BANKN_WRITE_M(GEM_RES_BANK1, 1, (sc), (offs), (v)) 209#define GEM_BANK1_WRITE_2(sc, offs, v) \ 210 GEM_BANKN_WRITE_M(GEM_RES_BANK1, 2, (sc), (offs), (v)) 211#define GEM_BANK1_WRITE_4(sc, offs, v) \ 212 GEM_BANKN_WRITE_M(GEM_RES_BANK1, 4, (sc), (offs), (v)) 213#define GEM_BANK2_WRITE_1(sc, offs, v) \ 214 GEM_BANKN_WRITE_M(GEM_RES_BANK2, 1, (sc), (offs), (v)) 215#define GEM_BANK2_WRITE_2(sc, offs, v) \ 216 GEM_BANKN_WRITE_M(GEM_RES_BANK2, 2, (sc), (offs), (v)) 217#define GEM_BANK2_WRITE_4(sc, offs, v) \ 218 GEM_BANKN_WRITE_M(GEM_RES_BANK2, 4, (sc), (offs), (v)) 219 |
|
179/* XXX this should be handled by bus_dma(9). */ 180#define GEM_DMA_READ(sc, v) \ 181 ((((sc)->sc_flags & GEM_PCI) != 0) ? le64toh(v) : be64toh(v)) 182#define GEM_DMA_WRITE(sc, v) \ 183 ((((sc)->sc_flags & GEM_PCI) != 0) ? htole64(v) : htobe64(v)) 184 185#define GEM_CDTXADDR(sc, x) ((sc)->sc_cddma + GEM_CDTXOFF((x))) 186#define GEM_CDRXADDR(sc, x) ((sc)->sc_cddma + GEM_CDRXOFF((x))) --- 58 unchanged lines hidden --- | 220/* XXX this should be handled by bus_dma(9). */ 221#define GEM_DMA_READ(sc, v) \ 222 ((((sc)->sc_flags & GEM_PCI) != 0) ? le64toh(v) : be64toh(v)) 223#define GEM_DMA_WRITE(sc, v) \ 224 ((((sc)->sc_flags & GEM_PCI) != 0) ? htole64(v) : htobe64(v)) 225 226#define GEM_CDTXADDR(sc, x) ((sc)->sc_cddma + GEM_CDTXOFF((x))) 227#define GEM_CDRXADDR(sc, x) ((sc)->sc_cddma + GEM_CDRXOFF((x))) --- 58 unchanged lines hidden --- |