Wrong buffer structure type was referenced in e1000_rx_ring. Fixes
[AROS.git] / workbench / devs / networks / e1000 / e1000.h
blob8e0e25e59a1048b87a9f6033b289930cf2e3143c
1 #ifndef _E1000_H_
2 #define _E1000_H_
3 /*
4 * $Id$
5 */
6 /*
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 MA 02111-1307, USA.
23 #include <aros/debug.h>
25 #include <aros/io.h>
27 #include <exec/types.h>
28 #include <exec/libraries.h>
29 #include <exec/semaphores.h>
30 #include <exec/devices.h>
31 #include <exec/interrupts.h>
32 #include <dos/bptr.h>
34 #include <devices/timer.h>
35 #include <devices/sana2.h>
36 #include <devices/sana2specialstats.h>
38 #include <proto/exec.h>
39 #include <proto/oop.h>
41 #include <oop/oop.h>
43 #include <hidd/pci.h>
44 #include <hidd/irq.h>
46 #include LC_LIBDEFS_FILE
48 typedef BOOL bool;
49 typedef UBYTE u8;
50 typedef UWORD u16;
51 typedef ULONG u32;
52 typedef LONG s32;
53 typedef UQUAD u64;
55 typedef UQUAD __le64;
56 typedef ULONG __le32;
57 typedef UWORD __le16;
59 #define false FALSE
60 #define true TRUE
62 #define __iomem volatile
64 #define e1000_TASK_NAME "%s.task"
65 #define e1000_PORT_NAME "%s.port"
67 struct e1000Base
69 struct Device e1kb_Device;
71 OOP_Object *e1kb_PCI;
72 OOP_AttrBase e1kb_PCIDeviceAttrBase;
74 ULONG e1kb_UnitCount;
75 struct List e1kb_Units;
78 struct e1000Startup
80 struct MsgPort *e1ksm_SyncPort;
81 struct e1000Unit *e1ksm_Unit;
84 #undef HiddPCIDeviceAttrBase
85 #define HiddPCIDeviceAttrBase (LIBBASE->e1kb_PCIDeviceAttrBase)
87 enum {
88 WRITE_QUEUE,
89 ADOPT_QUEUE,
90 EVENT_QUEUE,
91 GENERAL_QUEUE,
92 REQUEST_QUEUE_COUNT
95 struct Opener
97 struct MinNode node;
98 struct MsgPort read_port;
99 BOOL (*rx_function)(APTR, APTR, ULONG);
100 BOOL (*tx_function)(APTR, APTR, ULONG);
101 struct Hook *filter_hook;
102 struct MinList initial_stats;
105 struct TypeStats
107 struct MinNode node;
108 ULONG packet_type;
109 struct Sana2PacketTypeStats stats;
113 struct TypeTracker
115 struct MinNode node;
116 ULONG packet_type;
117 struct Sana2PacketTypeStats stats;
118 ULONG user_count;
122 struct AddressRange
124 struct MinNode node;
125 ULONG add_count;
126 ULONG lower_bound_left;
127 ULONG upper_bound_left;
128 UWORD lower_bound_right;
129 UWORD upper_bound_right;
132 /* Standard interface flags (netdevice->flags). */
133 #define IFF_UP 0x1 /* interface is up */
134 #define IFF_BROADCAST 0x2 /* broadcast address valid */
135 #define IFF_DEBUG 0x4 /* turn on debugging */
136 #define IFF_LOOPBACK 0x8 /* is a loopback net */
137 #define IFF_POINTOPOINT 0x10 /* interface is has p-p link */
138 #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
139 #define IFF_RUNNING 0x40 /* resources allocated */
140 #define IFF_NOARP 0x80 /* no ARP protocol */
141 #define IFF_PROMISC 0x100 /* receive all packets */
142 #define IFF_ALLMULTI 0x200 /* receive all multicast packets*/
144 #define IFF_MASTER 0x400 /* master of a load balancer */
145 #define IFF_SLAVE 0x800 /* slave of a load balancer */
147 #define IFF_MULTICAST 0x1000 /* Supports multicast */
149 #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_MASTER|IFF_SLAVE|IFF_RUNNING)
151 #define IFF_PORTSEL 0x2000 /* can set media type */
152 #define IFF_AUTOMEDIA 0x4000 /* auto media select active */
153 #define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/
154 #define IFF_SHARED 0x10000 /* interface may be shared */
155 #define IFF_CONFIGURED 0x20000 /* interface already configured */
158 * We tag multicasts with these structures.
161 #define MAX_ADDR_LEN 32
163 struct dev_mc_list
165 struct dev_mc_list *next;
166 UBYTE dmi_addr[MAX_ADDR_LEN];
167 unsigned char dmi_addrlen;
168 int dmi_users;
169 int dmi_gusers;
172 #define pci_name(unit) (unit->e1ku_name)
174 /* ENET defines */
176 #define HZ 1000000
177 #define ETH_DATA_LEN 1500
179 #define ETH_ADDRESSSIZE 6
180 #define ETH_HEADERSIZE 14
181 #define ETH_CRCSIZE 4
182 #define ETH_MTU (ETH_DATA_LEN)
183 #define ETH_MAXPACKETSIZE ((ETH_HEADERSIZE) + (ETH_MTU) + (ETH_CRCSIZE))
185 #define ETH_PACKET_DEST 0
186 #define ETH_PACKET_SOURCE 6
187 #define ETH_PACKET_TYPE 12
188 #define ETH_PACKET_IEEELEN 12
189 #define ETH_PACKET_SNAPTYPE 20
190 #define ETH_PACKET_DATA 14
191 #define ETH_PACKET_CRC (ETH_PACKET_DATA + ETH_MTU)
193 #define RXTX_ALLOC_BUFSIZE (ETH_MAXPACKETSIZE + 26)
195 #define TX_LIMIT_STOP 63
196 #define TX_LIMIT_START 62
198 struct eth_frame {
199 UBYTE eth_packet_dest[6];
200 UBYTE eth_packet_source[6];
201 UWORD eth_packet_type;
202 UBYTE eth_packet_data[ETH_MTU];
203 UBYTE eth_packet_crc[4];
204 UBYTE eth_pad[RXTX_ALLOC_BUFSIZE - ETH_MAXPACKETSIZE];
205 } __attribute__((packed));
206 #define eth_packet_ieeelen eth_packet_type
208 /* Media selection options. */
209 enum {
210 IF_PORT_UNKNOWN = 0,
211 IF_PORT_10BASE2,
212 IF_PORT_10BASET,
213 IF_PORT_AUI,
214 IF_PORT_100BASET,
215 IF_PORT_100BASETX,
216 IF_PORT_100BASEFX
219 /* These flag bits are private to the generic network queueing
220 * layer, they may not be explicitly referenced by any other
221 * code.
224 enum netdev_state_t
226 __LINK_STATE_XOFF=0,
227 __LINK_STATE_START,
228 __LINK_STATE_PRESENT,
229 __LINK_STATE_SCHED,
230 __LINK_STATE_NOCARRIER,
231 __LINK_STATE_RX_SCHED,
232 __LINK_STATE_LINKWATCH_PENDING
235 #include "e1000_hw.h"
237 struct e1000_buffer {
238 APTR buffer;
239 APTR dma;
240 UWORD length;
241 UWORD next_to_watch;
244 struct e1000_rx_buffer {
245 APTR buffer;
246 APTR dma;
249 struct e1000_tx_ring {
250 /* pointer to the descriptor ring memory */
251 struct e1000_tx_desc *desc;
252 /* physical address of the descriptor ring */
253 APTR dma;
254 /* length of descriptor ring in bytes */
255 ULONG size;
256 /* number of descriptors in the ring */
257 ULONG count;
258 /* next descriptor to associate a buffer with */
259 unsigned int next_to_use;
260 /* next descriptor to check for DD status bit */
261 unsigned int next_to_clean;
262 struct e1000_buffer *buffer_info;
264 UWORD tdh;
265 UWORD tdt;
268 struct e1000_rx_ring {
269 /* pointer to the descriptor ring memory */
270 struct e1000_rx_desc *desc;
271 /* physical address of the descriptor ring */
272 APTR dma;
273 /* length of descriptor ring in bytes */
274 ULONG size;
275 /* number of descriptors in the ring */
276 ULONG count;
277 /* next descriptor to associate a buffer with */
278 unsigned int next_to_use;
279 /* next descriptor to check for DD status bit */
280 unsigned int next_to_clean;
281 struct e1000_rx_buffer *buffer_info;
283 UWORD rdh;
284 UWORD rdt;
287 void handle_request(LIBBASETYPEPTR, struct IOSana2Req *);
289 #endif /* _E1000_H_ */