1*11651fceSdamien /* $OpenBSD: if_nfevar.h,v 1.8 2006/02/12 10:28:07 damien Exp $ */ 2c0967baeSdamien 3c0967baeSdamien /*- 4fbc14a03Sjsg * Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org> 5fbc14a03Sjsg * 6fbc14a03Sjsg * Permission to use, copy, modify, and distribute this software for any 7fbc14a03Sjsg * purpose with or without fee is hereby granted, provided that the above 8fbc14a03Sjsg * copyright notice and this permission notice appear in all copies. 9fbc14a03Sjsg * 10fbc14a03Sjsg * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11fbc14a03Sjsg * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12fbc14a03Sjsg * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13fbc14a03Sjsg * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14fbc14a03Sjsg * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15fbc14a03Sjsg * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16fbc14a03Sjsg * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17fbc14a03Sjsg */ 18fbc14a03Sjsg 19fbc14a03Sjsg #define NFE_IFQ_MAXLEN 64 20fbc14a03Sjsg 21fbc14a03Sjsg struct nfe_tx_data { 22fbc14a03Sjsg bus_dmamap_t map; 23ae0a03e3Sdamien bus_dmamap_t active; 24fbc14a03Sjsg struct mbuf *m; 25fbc14a03Sjsg }; 26fbc14a03Sjsg 27fbc14a03Sjsg struct nfe_tx_ring { 28fbc14a03Sjsg bus_dmamap_t map; 29fbc14a03Sjsg bus_dma_segment_t seg; 30fbc14a03Sjsg bus_addr_t physaddr; 31ae0a03e3Sdamien struct nfe_desc32 *desc32; 32ae0a03e3Sdamien struct nfe_desc64 *desc64; 33519bb2aaSjsg struct nfe_tx_data data[NFE_TX_RING_COUNT]; 34fbc14a03Sjsg int queued; 35fbc14a03Sjsg int cur; 36fbc14a03Sjsg int next; 37fbc14a03Sjsg }; 38fbc14a03Sjsg 39*11651fceSdamien struct nfe_jbuf { 40*11651fceSdamien caddr_t buf; 41*11651fceSdamien bus_addr_t physaddr; 42*11651fceSdamien SLIST_ENTRY(nfe_jbuf) jnext; 43*11651fceSdamien }; 44*11651fceSdamien 45fbc14a03Sjsg struct nfe_rx_data { 46fbc14a03Sjsg bus_dmamap_t map; 47fbc14a03Sjsg struct mbuf *m; 48fbc14a03Sjsg }; 49fbc14a03Sjsg 50fbc14a03Sjsg struct nfe_rx_ring { 51fbc14a03Sjsg bus_dmamap_t map; 52fbc14a03Sjsg bus_dma_segment_t seg; 53*11651fceSdamien bus_dmamap_t jmap; 54*11651fceSdamien bus_dma_segment_t jseg; 55fbc14a03Sjsg bus_addr_t physaddr; 56ae0a03e3Sdamien struct nfe_desc32 *desc32; 57ae0a03e3Sdamien struct nfe_desc64 *desc64; 58*11651fceSdamien caddr_t jpool; 59519bb2aaSjsg struct nfe_rx_data data[NFE_RX_RING_COUNT]; 60*11651fceSdamien struct nfe_jbuf jbuf[NFE_JPOOL_COUNT]; 61*11651fceSdamien SLIST_HEAD(, nfe_jbuf) jfreelist; 62*11651fceSdamien int bufsz; 63fbc14a03Sjsg int cur; 64fbc14a03Sjsg int next; 65fbc14a03Sjsg }; 66fbc14a03Sjsg 67fbc14a03Sjsg struct nfe_softc { 68fbc14a03Sjsg struct device sc_dev; 69fbc14a03Sjsg struct arpcom sc_arpcom; 70ae0a03e3Sdamien bus_space_handle_t sc_memh; 71ae0a03e3Sdamien bus_space_tag_t sc_memt; 72fbc14a03Sjsg void *sc_ih; 73fbc14a03Sjsg bus_dma_tag_t sc_dmat; 74fbc14a03Sjsg struct mii_data sc_mii; 75c0967baeSdamien struct timeout sc_tick_ch; 76cd7f2204Sdamien void *sc_powerhook; 77fbc14a03Sjsg 7818830ae9Sdamien int sc_if_flags; 79fbc14a03Sjsg u_int sc_flags; 80fbc14a03Sjsg #define NFE_JUMBO_SUP 0x01 81fbc14a03Sjsg #define NFE_40BIT_ADDR 0x02 82ae0a03e3Sdamien #define NFE_HW_CSUM 0x04 83*11651fceSdamien #define NFE_USE_JUMBO 0x08 84fbc14a03Sjsg 85ae0a03e3Sdamien uint8_t phyaddr; 86fbc14a03Sjsg 87fbc14a03Sjsg struct nfe_tx_ring txq; 88fbc14a03Sjsg struct nfe_rx_ring rxq; 89fbc14a03Sjsg }; 90