2 * Copyright (c) 1998, Larry Lile
5 * For latest sources and information on this driver, please
6 * go to http://anarchy.stdio.com.
8 * Questions, comments or suggestions should be directed to
9 * Larry Lile <lile@stdio.com>.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice unmodified, this list of conditions, and the following
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.
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
36 /*#define DEBUG_MASK DEBUG_POLL*/
39 #define DEBUG_MASK 0x0000
42 #define DEBUG_POLL 0x0001
43 #define DEBUG_INT 0x0002
44 #define DEBUG_INIT 0x0004
45 #define DEBUG_FN_ENT 0x8000
47 #define PCI_VENDOR_OLICOM 0x108D
49 #define OLTR_PORT_COUNT 0x20
51 #define MIN3(A,B,C) (MIN(A, (MIN(B, C))))
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
72 struct ifmedia ifmedia;
73 bus_space_handle_t oltr_bhandle;
74 bus_space_tag_t oltr_btag;
77 struct resource *irq_res;
79 struct resource *port_res;
81 struct resource *drq_res;
82 bus_dma_tag_t bus_tag;
83 bus_dma_tag_t mem_tag;
85 bus_addr_t queue_phys;
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;
110 u_long FunctionalAddress;
111 struct callout_handle oltr_poll_ch;
112 /*struct callout_handle oltr_stat_ch;*/
116 #define SELF_TEST_POLLS 32
118 void oltr_poll __P((void *));
119 /*void oltr_stat __P((void *));*/
121 int oltr_attach __P((device_t dev));
122 void oltr_stop __P((struct oltr_softc *));