Add flag to indicate that the NIC does not have power control capability.
[dragonfly.git] / sys / dev / netif / nfe / if_nfevar.h
blob19d018c2cca156a74f4edb3e4c7305b464ea1b18
1 /* $OpenBSD: if_nfevar.h,v 1.11 2006/02/19 13:57:02 damien Exp $ */
2 /* $DragonFly: src/sys/dev/netif/nfe/if_nfevar.h,v 1.4 2008/06/27 13:30:56 sephe Exp $ */
4 /*
5 * Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #define NFE_IFQ_MAXLEN 64
22 struct nfe_tx_data {
23 bus_dmamap_t map;
24 struct mbuf *m;
27 struct nfe_tx_ring {
28 bus_dma_tag_t tag;
29 bus_dmamap_t map;
30 bus_addr_t physaddr;
31 struct nfe_desc32 *desc32;
32 struct nfe_desc64 *desc64;
34 bus_dma_tag_t data_tag;
35 struct nfe_tx_data data[NFE_TX_RING_COUNT];
36 int queued;
37 int cur;
38 int next;
41 struct nfe_softc;
43 struct nfe_jbuf {
44 struct nfe_softc *sc;
45 struct nfe_rx_ring *ring;
46 int inuse;
47 int slot;
48 caddr_t buf;
49 bus_addr_t physaddr;
50 SLIST_ENTRY(nfe_jbuf) jnext;
53 struct nfe_rx_data {
54 bus_dmamap_t map;
55 struct mbuf *m;
58 struct nfe_rx_ring {
59 bus_dma_tag_t tag;
60 bus_dmamap_t map;
61 bus_addr_t physaddr;
62 struct nfe_desc32 *desc32;
63 struct nfe_desc64 *desc64;
65 bus_dma_tag_t jtag;
66 bus_dmamap_t jmap;
67 caddr_t jpool;
68 struct nfe_jbuf *jbuf;
69 SLIST_HEAD(, nfe_jbuf) jfreelist;
71 bus_dma_tag_t data_tag;
72 bus_dmamap_t data_tmpmap;
73 struct nfe_rx_data *data;
74 int bufsz;
75 int cur;
76 int next;
79 struct nfe_softc {
80 struct arpcom arpcom;
82 int sc_mem_rid;
83 struct resource *sc_mem_res;
84 bus_space_handle_t sc_memh;
85 bus_space_tag_t sc_memt;
87 int sc_irq_rid;
88 struct resource *sc_irq_res;
89 void *sc_ih;
91 device_t sc_miibus;
92 struct callout sc_tick_ch;
93 void *sc_powerhook;
95 int sc_if_flags;
96 uint32_t sc_flags;
97 #define NFE_JUMBO_SUP 0x01
98 #define NFE_40BIT_ADDR 0x02
99 #define NFE_HW_CSUM 0x04
100 #define NFE_HW_VLAN 0x08
101 #define NFE_USE_JUMBO 0x10
102 #define NFE_NO_PWRCTL 0x20
104 uint32_t rxtxctl;
105 uint8_t mii_phyaddr;
107 struct nfe_tx_ring txq;
108 struct nfe_rx_ring rxq;
110 uint32_t sc_irq_enable;
111 int sc_imtime;
112 int sc_rx_ring_count;
113 int sc_debug;
114 struct sysctl_ctx_list sc_sysctl_ctx;
115 struct sysctl_oid *sc_sysctl_tree;
117 struct lwkt_serialize sc_jbuf_serializer;
120 #define NFE_IRQ_ENABLE(sc) \
121 ((sc)->sc_imtime < 0 ? NFE_IRQ_NOIMTIMER : NFE_IRQ_IMTIMER)