]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - sys/contrib/dev/oltr/if_oltrvar.h
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / sys / contrib / dev / oltr / if_oltrvar.h
1 /*
2  * Copyright (c) 1998, Larry Lile
3  * All rights reserved.
4  *
5  * For latest sources and information on this driver, please
6  * go to http://anarchy.stdio.com.
7  *
8  * Questions, comments or suggestions should be directed to
9  * Larry Lile <lile@stdio.com>.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice unmodified, this list of conditions, and the following
16  *    disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  * $FreeBSD$
34  */
35
36 /*#define DEBUG_MASK DEBUG_POLL*/
37
38 #ifndef DEBUG_MASK
39 #define DEBUG_MASK 0x0000
40 #endif
41
42 #define DEBUG_POLL      0x0001
43 #define DEBUG_INT       0x0002
44 #define DEBUG_INIT      0x0004
45 #define DEBUG_FN_ENT    0x8000
46
47 #define PCI_VENDOR_OLICOM 0x108D
48
49 #define OLTR_PORT_COUNT 0x20
50
51 #define MIN3(A,B,C) (MIN(A, (MIN(B, C))))
52
53 struct oltr_rx_buf {
54         int                     index;
55         char                    *data;
56         u_long                  address;
57 };
58
59 struct oltr_tx_buf {
60         int                     index;
61         char                    *data;
62         u_long                  address;
63 };
64
65 #define RING_BUFFER_LEN         16
66 #define RING_BUFFER(x)          ((RING_BUFFER_LEN - 1) & x)
67 #define RX_BUFFER_LEN           2048
68 #define TX_BUFFER_LEN           2048
69
70 struct oltr_softc {
71         struct ifnet            *ifp;
72         struct ifmedia          ifmedia;
73         bus_space_handle_t      oltr_bhandle;
74         bus_space_tag_t         oltr_btag;
75         void                    *oltr_intrhand;
76         int                     irq_rid;
77         struct resource         *irq_res;
78         int                     port_rid;
79         struct resource         *port_res;
80         int                     drq_rid;
81         struct resource         *drq_res;
82         bus_dma_tag_t           bus_tag;
83         bus_dma_tag_t           mem_tag;
84         bus_dmamap_t            mem_map;
85         bus_addr_t              queue_phys;
86         char *                  queue_addr;
87         int                     unit;
88         int                     state;
89 #define OL_UNKNOWN      0
90 #define OL_INIT         1
91 #define OL_READY        2
92 #define OL_CLOSING      3
93 #define OL_CLOSED       4
94 #define OL_OPENING      5
95 #define OL_OPEN         6
96 #define OL_PROMISC      7
97 #define OL_DEAD         8
98         struct oltr_rx_buf      rx_ring[RING_BUFFER_LEN];
99         int                     tx_head, tx_avail, tx_frame;
100         struct oltr_tx_buf      tx_ring[RING_BUFFER_LEN];
101         TRlldTransmit_t         frame_ring[RING_BUFFER_LEN];
102         struct mbuf             *restart;
103         TRlldAdapter_t          TRlldAdapter;
104         unsigned long           TRlldAdapter_phys;
105         TRlldStatistics_t       statistics;
106         TRlldStatistics_t       current;
107         TRlldAdapterConfig_t    config;
108         u_short                 AdapterMode;
109         u_long                  GroupAddress;
110         u_long                  FunctionalAddress;
111         struct callout_handle   oltr_poll_ch;
112         /*struct callout_handle oltr_stat_ch;*/
113         void                    *work_memory;
114 };
115
116 #define SELF_TEST_POLLS 32
117
118 void oltr_poll                  __P((void *));
119 /*void oltr_stat                __P((void *));*/
120
121 int oltr_attach                 __P((device_t dev));
122 void oltr_stop                  __P((struct oltr_softc *));