if_bgereg.h (117659) | if_bgereg.h (118026) |
---|---|
1/* 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2001 4 * Bill Paul <wpaul@windriver.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2001 4 * Bill Paul <wpaul@windriver.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/dev/bge/if_bgereg.h 117659 2003-07-16 00:09:56Z wpaul $ | 33 * $FreeBSD: head/sys/dev/bge/if_bgereg.h 118026 2003-07-25 19:42:44Z wpaul $ |
34 */ 35 36/* 37 * BCM570x memory map. The internal memory layout varies somewhat 38 * depending on whether or not we have external SSRAM attached. 39 * The BCM5700 can have up to 16MB of external memory. The BCM5701 40 * is apparently not designed to use external SSRAM. The mappings 41 * up to the first 4 send rings are the same for both internal and --- 1654 unchanged lines hidden (view full) --- 1696 * code from running. 1697 */ 1698#define BGE_MAGIC_NUMBER 0x4B657654 1699 1700typedef struct { 1701 u_int32_t bge_addr_hi; 1702 u_int32_t bge_addr_lo; 1703} bge_hostaddr; | 34 */ 35 36/* 37 * BCM570x memory map. The internal memory layout varies somewhat 38 * depending on whether or not we have external SSRAM attached. 39 * The BCM5700 can have up to 16MB of external memory. The BCM5701 40 * is apparently not designed to use external SSRAM. The mappings 41 * up to the first 4 send rings are the same for both internal and --- 1654 unchanged lines hidden (view full) --- 1696 * code from running. 1697 */ 1698#define BGE_MAGIC_NUMBER 0x4B657654 1699 1700typedef struct { 1701 u_int32_t bge_addr_hi; 1702 u_int32_t bge_addr_lo; 1703} bge_hostaddr; |
1704 |
|
1704#define BGE_HOSTADDR(x, y) \ 1705 do { \ 1706 (x).bge_addr_lo = ((u_int64_t) (y) & 0xffffffff); \ 1707 (x).bge_addr_hi = ((u_int64_t) (y) >> 32); \ 1708 } while(0) 1709 | 1705#define BGE_HOSTADDR(x, y) \ 1706 do { \ 1707 (x).bge_addr_lo = ((u_int64_t) (y) & 0xffffffff); \ 1708 (x).bge_addr_hi = ((u_int64_t) (y) >> 32); \ 1709 } while(0) 1710 |
1711#define BGE_ADDR_LO(y) \ 1712 ((u_int64_t) (y) & 0xFFFFFFFF) 1713#define BGE_ADDR_HI(y) \ 1714 ((u_int64_t) (y) >> 32) 1715 |
|
1710/* Ring control block structure */ 1711struct bge_rcb { 1712 bge_hostaddr bge_hostaddr; 1713 u_int32_t bge_maxlen_flags; 1714 u_int32_t bge_nicaddr; 1715}; 1716#define BGE_RCB_MAXLEN_FLAGS(maxlen, flags) ((maxlen) << 16 | (flags)) 1717 --- 424 unchanged lines hidden (view full) --- 2142#define BGE_JMEM ((BGE_JLEN * BGE_JSLOTS) + BGE_RESID) 2143 2144/* 2145 * Ring structures. Most of these reside in host memory and we tell 2146 * the NIC where they are via the ring control blocks. The exceptions 2147 * are the tx and command rings, which live in NIC memory and which 2148 * we access via the shared memory window. 2149 */ | 1716/* Ring control block structure */ 1717struct bge_rcb { 1718 bge_hostaddr bge_hostaddr; 1719 u_int32_t bge_maxlen_flags; 1720 u_int32_t bge_nicaddr; 1721}; 1722#define BGE_RCB_MAXLEN_FLAGS(maxlen, flags) ((maxlen) << 16 | (flags)) 1723 --- 424 unchanged lines hidden (view full) --- 2148#define BGE_JMEM ((BGE_JLEN * BGE_JSLOTS) + BGE_RESID) 2149 2150/* 2151 * Ring structures. Most of these reside in host memory and we tell 2152 * the NIC where they are via the ring control blocks. The exceptions 2153 * are the tx and command rings, which live in NIC memory and which 2154 * we access via the shared memory window. 2155 */ |
2156 |
|
2150struct bge_ring_data { | 2157struct bge_ring_data { |
2151 struct bge_rx_bd bge_rx_std_ring[BGE_STD_RX_RING_CNT]; 2152 struct bge_rx_bd bge_rx_jumbo_ring[BGE_JUMBO_RX_RING_CNT]; 2153 struct bge_rx_bd bge_rx_return_ring[BGE_RETURN_RING_CNT]; 2154 struct bge_tx_bd bge_tx_ring[BGE_TX_RING_CNT]; 2155 struct bge_status_block bge_status_block; 2156 struct bge_tx_desc *bge_tx_ring_nic;/* pointer to shared mem */ 2157 struct bge_cmd_desc *bge_cmd_ring; /* pointer to shared mem */ | 2158 struct bge_rx_bd *bge_rx_std_ring; 2159 bus_addr_t bge_rx_std_ring_paddr; 2160 struct bge_rx_bd *bge_rx_jumbo_ring; 2161 bus_addr_t bge_rx_jumbo_ring_paddr; 2162 struct bge_rx_bd *bge_rx_return_ring; 2163 bus_addr_t bge_rx_return_ring_paddr; 2164 struct bge_tx_bd *bge_tx_ring; 2165 bus_addr_t bge_tx_ring_paddr; 2166 struct bge_status_block *bge_status_block; 2167 bus_addr_t bge_status_block_paddr; 2168 struct bge_stats *bge_stats; 2169 bus_addr_t bge_stats_paddr; 2170 void *bge_jumbo_buf; |
2158 struct bge_gib bge_info; 2159}; 2160 | 2171 struct bge_gib bge_info; 2172}; 2173 |
2174#define BGE_STD_RX_RING_SZ \ 2175 (sizeof(struct bge_rx_bd) * BGE_STD_RX_RING_CNT) 2176#define BGE_JUMBO_RX_RING_SZ \ 2177 (sizeof(struct bge_rx_bd) * BGE_JUMBO_RX_RING_CNT) 2178#define BGE_TX_RING_SZ \ 2179 (sizeof(struct bge_tx_bd) * BGE_TX_RING_CNT) 2180#define BGE_RX_RTN_RING_SZ(x) \ 2181 (sizeof(struct bge_rx_bd) * x->bge_return_ring_cnt) 2182 2183#define BGE_STATUS_BLK_SZ sizeof (struct bge_status_block) 2184 2185#define BGE_STATS_SZ sizeof (struct bge_stats) 2186 |
|
2161/* 2162 * Mbuf pointers. We need these to keep track of the virtual addresses 2163 * of our mbuf chains since we can only convert from physical to virtual, 2164 * not the other way around. 2165 */ 2166struct bge_chain_data { | 2187/* 2188 * Mbuf pointers. We need these to keep track of the virtual addresses 2189 * of our mbuf chains since we can only convert from physical to virtual, 2190 * not the other way around. 2191 */ 2192struct bge_chain_data { |
2193 bus_dma_tag_t bge_parent_tag; 2194 bus_dma_tag_t bge_rx_std_ring_tag; 2195 bus_dma_tag_t bge_rx_jumbo_ring_tag; 2196 bus_dma_tag_t bge_rx_return_ring_tag; 2197 bus_dma_tag_t bge_tx_ring_tag; 2198 bus_dma_tag_t bge_status_tag; 2199 bus_dma_tag_t bge_stats_tag; 2200 bus_dma_tag_t bge_jumbo_tag; 2201 bus_dma_tag_t bge_mtag; /* mbuf mapping tag */ 2202 bus_dma_tag_t bge_mtag_jumbo; /* mbuf mapping tag */ 2203 bus_dmamap_t bge_tx_dmamap[BGE_TX_RING_CNT]; 2204 bus_dmamap_t bge_rx_std_dmamap[BGE_STD_RX_RING_CNT]; 2205 bus_dmamap_t bge_rx_jumbo_dmamap[BGE_JUMBO_RX_RING_CNT]; 2206 bus_dmamap_t bge_rx_std_ring_map; 2207 bus_dmamap_t bge_rx_jumbo_ring_map; 2208 bus_dmamap_t bge_tx_ring_map; 2209 bus_dmamap_t bge_rx_return_ring_map; 2210 bus_dmamap_t bge_status_map; 2211 bus_dmamap_t bge_stats_map; 2212 bus_dmamap_t bge_jumbo_map; |
|
2167 struct mbuf *bge_tx_chain[BGE_TX_RING_CNT]; 2168 struct mbuf *bge_rx_std_chain[BGE_STD_RX_RING_CNT]; 2169 struct mbuf *bge_rx_jumbo_chain[BGE_JUMBO_RX_RING_CNT]; | 2213 struct mbuf *bge_tx_chain[BGE_TX_RING_CNT]; 2214 struct mbuf *bge_rx_std_chain[BGE_STD_RX_RING_CNT]; 2215 struct mbuf *bge_rx_jumbo_chain[BGE_JUMBO_RX_RING_CNT]; |
2170 struct mbuf *bge_rx_mini_chain[BGE_MINI_RX_RING_CNT]; | |
2171 /* Stick the jumbo mem management stuff here too. */ 2172 caddr_t bge_jslots[BGE_JSLOTS]; | 2216 /* Stick the jumbo mem management stuff here too. */ 2217 caddr_t bge_jslots[BGE_JSLOTS]; |
2173 void *bge_jumbo_buf; | |
2174}; 2175 | 2218}; 2219 |
2220struct bge_dmamap_arg { 2221 struct bge_softc *sc; 2222 bus_addr_t bge_busaddr; 2223 u_int16_t bge_flags; 2224 int bge_idx; 2225 int bge_maxsegs; 2226 struct bge_tx_bd *bge_ring; 2227}; 2228 |
|
2176struct bge_type { 2177 u_int16_t bge_vid; 2178 u_int16_t bge_did; 2179 char *bge_name; 2180}; 2181 2182#define BGE_HWREV_TIGON 0x01 2183#define BGE_HWREV_TIGON_II 0x02 --- 23 unchanged lines hidden (view full) --- 2207 struct ifmedia bge_ifmedia; /* TBI media info */ 2208 u_int8_t bge_unit; /* interface number */ 2209 u_int8_t bge_extram; /* has external SSRAM */ 2210 u_int8_t bge_tbi; 2211 u_int8_t bge_rx_alignment_bug; 2212 u_int32_t bge_chipid; 2213 u_int8_t bge_asicrev; 2214 u_int8_t bge_chiprev; | 2229struct bge_type { 2230 u_int16_t bge_vid; 2231 u_int16_t bge_did; 2232 char *bge_name; 2233}; 2234 2235#define BGE_HWREV_TIGON 0x01 2236#define BGE_HWREV_TIGON_II 0x02 --- 23 unchanged lines hidden (view full) --- 2260 struct ifmedia bge_ifmedia; /* TBI media info */ 2261 u_int8_t bge_unit; /* interface number */ 2262 u_int8_t bge_extram; /* has external SSRAM */ 2263 u_int8_t bge_tbi; 2264 u_int8_t bge_rx_alignment_bug; 2265 u_int32_t bge_chipid; 2266 u_int8_t bge_asicrev; 2267 u_int8_t bge_chiprev; |
2215 struct bge_ring_data *bge_rdata; /* rings */ | 2268 struct bge_ring_data bge_ldata; /* rings */ |
2216 struct bge_chain_data bge_cdata; /* mbufs */ 2217 u_int16_t bge_tx_saved_considx; 2218 u_int16_t bge_rx_saved_considx; 2219 u_int16_t bge_ev_saved_considx; 2220 u_int16_t bge_return_ring_cnt; 2221 u_int16_t bge_std; /* current std ring head */ 2222 u_int16_t bge_jumbo; /* current jumo ring head */ 2223 SLIST_HEAD(__bge_jfreehead, bge_jpool_entry) bge_jfree_listhead; --- 19 unchanged lines hidden --- | 2269 struct bge_chain_data bge_cdata; /* mbufs */ 2270 u_int16_t bge_tx_saved_considx; 2271 u_int16_t bge_rx_saved_considx; 2272 u_int16_t bge_ev_saved_considx; 2273 u_int16_t bge_return_ring_cnt; 2274 u_int16_t bge_std; /* current std ring head */ 2275 u_int16_t bge_jumbo; /* current jumo ring head */ 2276 SLIST_HEAD(__bge_jfreehead, bge_jpool_entry) bge_jfree_listhead; --- 19 unchanged lines hidden --- |