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,
23 #include <aros/debug.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>
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>
46 #include LC_LIBDEFS_FILE
55 #define __iomem volatile
57 #define e1000_TASK_NAME "%s.task"
58 #define e1000_PORT_NAME "%s.port"
62 struct Device e1kb_Device
;
65 OOP_AttrBase e1kb_PCIDeviceAttrBase
;
68 struct List e1kb_Units
;
73 struct MsgPort
*e1ksm_SyncPort
;
74 struct e1000Unit
*e1ksm_Unit
;
77 #undef HiddPCIDeviceAttrBase
78 #define HiddPCIDeviceAttrBase (LIBBASE->e1kb_PCIDeviceAttrBase)
91 struct MsgPort read_port
;
92 BOOL (*rx_function
)(APTR
, APTR
, ULONG
);
93 BOOL (*tx_function
)(APTR
, APTR
, ULONG
);
94 struct Hook
*filter_hook
;
95 struct MinList initial_stats
;
102 struct Sana2PacketTypeStats stats
;
110 struct Sana2PacketTypeStats stats
;
119 ULONG lower_bound_left
;
120 ULONG upper_bound_left
;
121 UWORD lower_bound_right
;
122 UWORD upper_bound_right
;
125 /* Standard interface flags (netdevice->flags). */
126 #define IFF_UP 0x1 /* interface is up */
127 #define IFF_BROADCAST 0x2 /* broadcast address valid */
128 #define IFF_DEBUG 0x4 /* turn on debugging */
129 #define IFF_LOOPBACK 0x8 /* is a loopback net */
130 #define IFF_POINTOPOINT 0x10 /* interface is has p-p link */
131 #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
132 #define IFF_RUNNING 0x40 /* resources allocated */
133 #define IFF_NOARP 0x80 /* no ARP protocol */
134 #define IFF_PROMISC 0x100 /* receive all packets */
135 #define IFF_ALLMULTI 0x200 /* receive all multicast packets*/
137 #define IFF_MASTER 0x400 /* master of a load balancer */
138 #define IFF_SLAVE 0x800 /* slave of a load balancer */
140 #define IFF_MULTICAST 0x1000 /* Supports multicast */
142 #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_MASTER|IFF_SLAVE|IFF_RUNNING)
144 #define IFF_PORTSEL 0x2000 /* can set media type */
145 #define IFF_AUTOMEDIA 0x4000 /* auto media select active */
146 #define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/
147 #define IFF_SHARED 0x10000 /* interface may be shared */
148 #define IFF_CONFIGURED 0x20000 /* interface already configured */
151 * We tag multicasts with these structures.
154 #define MAX_ADDR_LEN 32
158 struct dev_mc_list
*next
;
159 UBYTE dmi_addr
[MAX_ADDR_LEN
];
160 unsigned char dmi_addrlen
;
165 #define pci_name(unit) (unit->e1ku_name)
170 #define ETH_DATA_LEN 1500
172 #define ETH_ADDRESSSIZE 6
173 #define ETH_HEADERSIZE 14
174 #define ETH_CRCSIZE 4
175 #define ETH_MTU (ETH_DATA_LEN)
176 #define ETH_MAXPACKETSIZE ((ETH_HEADERSIZE) + (ETH_MTU) + (ETH_CRCSIZE))
178 #define ETH_PACKET_DEST 0
179 #define ETH_PACKET_SOURCE 6
180 #define ETH_PACKET_TYPE 12
181 #define ETH_PACKET_IEEELEN 12
182 #define ETH_PACKET_SNAPTYPE 20
183 #define ETH_PACKET_DATA 14
184 #define ETH_PACKET_CRC (ETH_PACKET_DATA + ETH_MTU)
186 #define RXTX_ALLOC_BUFSIZE (ETH_MAXPACKETSIZE + 26)
188 #define TX_LIMIT_STOP 63
189 #define TX_LIMIT_START 62
192 UBYTE eth_packet_dest
[6];
193 UBYTE eth_packet_source
[6];
194 UWORD eth_packet_type
;
195 UBYTE eth_packet_data
[ETH_MTU
];
196 UBYTE eth_packet_crc
[4];
197 UBYTE eth_pad
[RXTX_ALLOC_BUFSIZE
- ETH_MAXPACKETSIZE
];
198 } __attribute__((packed
));
199 #define eth_packet_ieeelen eth_packet_type
201 /* Media selection options. */
212 /* These flag bits are private to the generic network queueing
213 * layer, they may not be explicitly referenced by any other
221 __LINK_STATE_PRESENT
,
223 __LINK_STATE_NOCARRIER
,
224 __LINK_STATE_RX_SCHED
,
225 __LINK_STATE_LINKWATCH_PENDING
228 #include "e1000_hw.h"
230 struct e1000_buffer
{
237 struct e1000_rx_buffer
{
242 struct e1000_tx_ring
{
243 /* pointer to the descriptor ring memory */
244 struct e1000_tx_desc
*desc
;
245 /* physical address of the descriptor ring */
247 /* length of descriptor ring in bytes */
249 /* number of descriptors in the ring */
251 /* next descriptor to associate a buffer with */
252 unsigned int next_to_use
;
253 /* next descriptor to check for DD status bit */
254 unsigned int next_to_clean
;
255 struct e1000_buffer
*buffer_info
;
261 struct e1000_rx_ring
{
262 /* pointer to the descriptor ring memory */
263 struct e1000_rx_desc
*desc
;
264 /* physical address of the descriptor ring */
266 /* length of descriptor ring in bytes */
268 /* number of descriptors in the ring */
270 /* next descriptor to associate a buffer with */
271 unsigned int next_to_use
;
272 /* next descriptor to check for DD status bit */
273 unsigned int next_to_clean
;
274 struct e1000_buffer
*buffer_info
;
280 void handle_request(LIBBASETYPEPTR
, struct IOSana2Req
*);
282 #endif /* _E1000_H_ */