Przeglądaj źródła

Merge commit 'origin/mdc-working'

tags/v0.9.3
Michael Brown 17 lat temu
rodzic
commit
b53ee1eb16

+ 1
- 0
src/Makefile Wyświetl plik

@@ -147,6 +147,7 @@ SRCDIRS		+= net net/tcp net/udp
147 147
 SRCDIRS		+= image
148 148
 SRCDIRS		+= drivers/bus
149 149
 SRCDIRS		+= drivers/net
150
+SRCDIRS		+= drivers/net/e1000
150 151
 SRCDIRS		+= drivers/block
151 152
 SRCDIRS		+= drivers/scsi
152 153
 SRCDIRS		+= drivers/ata

src/drivers/net/e1000.c → src/drivers/net/e1000-old/e1000.c Wyświetl plik


src/drivers/net/e1000_hw.h → src/drivers/net/e1000-old/e1000_hw.h Wyświetl plik


+ 1192
- 0
src/drivers/net/e1000/e1000.c
Plik diff jest za duży
Wyświetl plik


+ 304
- 0
src/drivers/net/e1000/e1000.h Wyświetl plik

@@ -0,0 +1,304 @@
1
+/*******************************************************************************
2
+
3
+  Intel PRO/1000 Linux driver
4
+  Copyright(c) 1999 - 2006 Intel Corporation.
5
+
6
+  This program is free software; you can redistribute it and/or modify it
7
+  under the terms and conditions of the GNU General Public License,
8
+  version 2, as published by the Free Software Foundation.
9
+
10
+  This program is distributed in the hope it will be useful, but WITHOUT
11
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13
+  more details.
14
+
15
+  You should have received a copy of the GNU General Public License along with
16
+  this program; if not, write to the Free Software Foundation, Inc.,
17
+  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
+
19
+  The full GNU General Public License is included in this distribution in
20
+  the file called "COPYING".
21
+
22
+  Contact Information:
23
+  Linux NICS <linux.nics@intel.com>
24
+  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25
+  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26
+
27
+*******************************************************************************/
28
+
29
+/* Linux PRO/1000 Ethernet Driver main header file */
30
+
31
+#ifndef _E1000_H_
32
+#define _E1000_H_
33
+
34
+#include <stdint.h>
35
+#include <stdlib.h>
36
+#include <stdio.h>
37
+#include <io.h>
38
+#include <errno.h>
39
+#include <timer.h>
40
+#include <byteswap.h>
41
+#include <gpxe/pci.h>
42
+#include <gpxe/malloc.h>
43
+#include <gpxe/if_ether.h>
44
+#include <gpxe/ethernet.h>
45
+#include <gpxe/iobuf.h>
46
+#include <gpxe/netdevice.h>
47
+
48
+#define BAR_0		0
49
+#define BAR_1		1
50
+#define BAR_5		5
51
+
52
+struct e1000_adapter;
53
+
54
+#include "e1000_hw.h"
55
+
56
+/* Supported Rx Buffer Sizes */
57
+#define E1000_RXBUFFER_128   128    /* Used for packet split */
58
+#define E1000_RXBUFFER_256   256    /* Used for packet split */
59
+#define E1000_RXBUFFER_512   512
60
+#define E1000_RXBUFFER_1024  1024
61
+#define E1000_RXBUFFER_2048  2048
62
+#define E1000_RXBUFFER_4096  4096
63
+#define E1000_RXBUFFER_8192  8192
64
+#define E1000_RXBUFFER_16384 16384
65
+
66
+/* SmartSpeed delimiters */
67
+#define E1000_SMARTSPEED_DOWNSHIFT 3
68
+#define E1000_SMARTSPEED_MAX       15
69
+
70
+/* Packet Buffer allocations */
71
+#define E1000_PBA_BYTES_SHIFT 0xA
72
+#define E1000_TX_HEAD_ADDR_SHIFT 7
73
+#define E1000_PBA_TX_MASK 0xFFFF0000
74
+
75
+/* Flow Control Watermarks */
76
+#define E1000_FC_HIGH_DIFF 0x1638  /* High: 5688 bytes below Rx FIFO size */
77
+#define E1000_FC_LOW_DIFF 0x1640   /* Low:  5696 bytes below Rx FIFO size */
78
+
79
+#define E1000_FC_PAUSE_TIME 0x0680 /* 858 usec */
80
+
81
+/* this is the size past which hardware will drop packets when setting LPE=0 */
82
+#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
83
+
84
+/* How many Tx Descriptors do we need to call netif_wake_queue ? */
85
+#define E1000_TX_QUEUE_WAKE	16
86
+/* How many Rx Buffers do we bundle into one write to the hardware ? */
87
+#define E1000_RX_BUFFER_WRITE	16	/* Must be power of 2 */
88
+
89
+#define AUTO_ALL_MODES            0
90
+#define E1000_EEPROM_82544_APM    0x0004
91
+#define E1000_EEPROM_ICH8_APME    0x0004
92
+#define E1000_EEPROM_APME         0x0400
93
+
94
+#ifndef E1000_MASTER_SLAVE
95
+/* Switch to override PHY master/slave setting */
96
+#define E1000_MASTER_SLAVE	e1000_ms_hw_default
97
+#endif
98
+
99
+/* wrapper around a pointer to a socket buffer,
100
+ * so a DMA handle can be stored along with the buffer */
101
+struct e1000_buffer {
102
+	struct sk_buff *skb;
103
+	unsigned long time_stamp;
104
+	uint16_t length;
105
+	uint16_t next_to_watch;
106
+};
107
+
108
+struct e1000_tx_ring {
109
+	/* pointer to the descriptor ring memory */
110
+	void *desc;
111
+	/* length of descriptor ring in bytes */
112
+	unsigned int size;
113
+	/* number of descriptors in the ring */
114
+	unsigned int count;
115
+	/* next descriptor to associate a buffer with */
116
+	unsigned int next_to_use;
117
+	/* next descriptor to check for DD status bit */
118
+	unsigned int next_to_clean;
119
+	/* array of buffer information structs */
120
+	struct e1000_buffer *buffer_info;
121
+
122
+	uint16_t tdh;
123
+	uint16_t tdt;
124
+	boolean_t last_tx_tso;
125
+};
126
+
127
+struct e1000_rx_ring {
128
+	/* pointer to the descriptor ring memory */
129
+	void *desc;
130
+	/* length of descriptor ring in bytes */
131
+	unsigned int size;
132
+	/* number of descriptors in the ring */
133
+	unsigned int count;
134
+	/* next descriptor to associate a buffer with */
135
+	unsigned int next_to_use;
136
+	/* next descriptor to check for DD status bit */
137
+	unsigned int next_to_clean;
138
+	/* array of buffer information structs */
139
+	struct e1000_buffer *buffer_info;
140
+	/* arrays of page information for packet split */
141
+	struct e1000_ps_page *ps_page;
142
+	struct e1000_ps_page_dma *ps_page_dma;
143
+
144
+	/* cpu for rx queue */
145
+	int cpu;
146
+
147
+	uint16_t rdh;
148
+	uint16_t rdt;
149
+};
150
+
151
+#define E1000_DESC_UNUSED(R) \
152
+	((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
153
+	(R)->next_to_clean - (R)->next_to_use - 1)
154
+
155
+#define E1000_RX_DESC_PS(R, i)	    \
156
+	(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
157
+#define E1000_RX_DESC_EXT(R, i)	    \
158
+	(&(((union e1000_rx_desc_extended *)((R).desc))[i]))
159
+#define E1000_GET_DESC(R, i, type)	(&(((struct type *)((R).desc))[i]))
160
+#define E1000_RX_DESC(R, i)		E1000_GET_DESC(R, i, e1000_rx_desc)
161
+#define E1000_TX_DESC(R, i)		E1000_GET_DESC(R, i, e1000_tx_desc)
162
+#define E1000_CONTEXT_DESC(R, i)	E1000_GET_DESC(R, i, e1000_context_desc)
163
+
164
+/* board specific private data structure */
165
+
166
+struct e1000_adapter {
167
+	struct vlan_group *vlgrp;
168
+	uint16_t mng_vlan_id;
169
+	uint32_t bd_number;
170
+	uint32_t rx_buffer_len;
171
+	uint32_t wol;
172
+	uint32_t smartspeed;
173
+	uint32_t en_mng_pt;
174
+	uint16_t link_speed;
175
+	uint16_t link_duplex;
176
+
177
+	unsigned int total_tx_bytes;
178
+	unsigned int total_tx_packets;
179
+	unsigned int total_rx_bytes;
180
+	unsigned int total_rx_packets;
181
+	/* Interrupt Throttle Rate */
182
+	uint32_t itr;
183
+	uint32_t itr_setting;
184
+	uint16_t tx_itr;
185
+	uint16_t rx_itr;
186
+
187
+	uint8_t fc_autoneg;
188
+
189
+	unsigned long led_status;
190
+
191
+	/* TX */
192
+	struct e1000_tx_ring *tx_ring;      /* One per active queue */
193
+	unsigned int restart_queue;
194
+	unsigned long tx_queue_len;
195
+	uint32_t txd_cmd;
196
+	uint32_t tx_int_delay;
197
+	uint32_t tx_abs_int_delay;
198
+	uint32_t gotcl;
199
+	uint64_t gotcl_old;
200
+	uint64_t tpt_old;
201
+	uint64_t colc_old;
202
+	uint32_t tx_timeout_count;
203
+	uint32_t tx_fifo_head;
204
+	uint32_t tx_head_addr;
205
+	uint32_t tx_fifo_size;
206
+	uint8_t  tx_timeout_factor;
207
+	boolean_t pcix_82544;
208
+	boolean_t detect_tx_hung;
209
+
210
+	/* RX */
211
+	boolean_t (*clean_rx) (struct e1000_adapter *adapter,
212
+			       struct e1000_rx_ring *rx_ring);
213
+	void (*alloc_rx_buf) (struct e1000_adapter *adapter,
214
+			      struct e1000_rx_ring *rx_ring,
215
+				int cleaned_count);
216
+	struct e1000_rx_ring *rx_ring;      /* One per active queue */
217
+	int num_tx_queues;
218
+	int num_rx_queues;
219
+
220
+	uint64_t hw_csum_err;
221
+	uint64_t hw_csum_good;
222
+	uint64_t rx_hdr_split;
223
+	uint32_t alloc_rx_buff_failed;
224
+	uint32_t rx_int_delay;
225
+	uint32_t rx_abs_int_delay;
226
+	boolean_t rx_csum;
227
+	unsigned int rx_ps_pages;
228
+	uint32_t gorcl;
229
+	uint64_t gorcl_old;
230
+	uint16_t rx_ps_bsize0;
231
+
232
+
233
+	/* OS defined structs */
234
+	struct net_device *netdev;
235
+	struct pci_device *pdev;
236
+	struct net_device_stats net_stats;
237
+
238
+	/* structs defined in e1000_hw.h */
239
+	struct e1000_hw hw;
240
+	struct e1000_hw_stats stats;
241
+	struct e1000_phy_info phy_info;
242
+	struct e1000_phy_stats phy_stats;
243
+
244
+	uint32_t test_icr;
245
+	struct e1000_tx_ring test_tx_ring;
246
+	struct e1000_rx_ring test_rx_ring;
247
+
248
+	int msg_enable;
249
+	boolean_t have_msi;
250
+
251
+	/* to not mess up cache alignment, always add to the bottom */
252
+	boolean_t tso_force;
253
+	boolean_t smart_power_down;	/* phy smart power down */
254
+	boolean_t quad_port_a;
255
+	unsigned long flags;
256
+	uint32_t eeprom_wol;
257
+	
258
+#define NUM_TX_DESC	8
259
+#define NUM_RX_DESC	8
260
+
261
+	struct io_buffer *tx_iobuf[NUM_TX_DESC];
262
+	struct io_buffer *rx_iobuf[NUM_RX_DESC];
263
+
264
+	struct e1000_tx_desc *tx_base;
265
+	struct e1000_rx_desc *rx_base;
266
+	
267
+	uint32_t tx_ring_size;
268
+	uint32_t rx_ring_size;
269
+
270
+	uint32_t tx_head;
271
+	uint32_t tx_tail;
272
+	uint32_t tx_fill_ctr;
273
+	
274
+	uint32_t rx_tail;
275
+
276
+	uint32_t ioaddr;
277
+	uint32_t irqno;
278
+
279
+};
280
+
281
+enum e1000_state_t {
282
+	__E1000_TESTING,
283
+	__E1000_RESETTING,
284
+	__E1000_DOWN
285
+};
286
+
287
+#define E1000_MNG2HOST_PORT_623 (1 << 5)
288
+#define E1000_MNG2HOST_PORT_664 (1 << 6)
289
+
290
+#define E1000_ERT_2048 0x100
291
+
292
+#define IORESOURCE_IO		0x00000100
293
+#define IORESOURCE_MEM          0x00000200
294
+#define IORESOURCE_PREFETCH     0x00001000
295
+
296
+#endif /* _E1000_H_ */
297
+
298
+/*
299
+ * Local variables:
300
+ *  c-basic-offset: 8
301
+ *  c-indent-level: 8
302
+ *  tab-width: 8
303
+ * End:
304
+ */

+ 9050
- 0
src/drivers/net/e1000/e1000_hw.c
Plik diff jest za duży
Wyświetl plik


+ 3413
- 0
src/drivers/net/e1000/e1000_hw.h
Plik diff jest za duży
Wyświetl plik


+ 142
- 0
src/drivers/net/e1000/e1000_osdep.h Wyświetl plik

@@ -0,0 +1,142 @@
1
+/*******************************************************************************
2
+
3
+  Intel PRO/1000 Linux driver
4
+  Copyright(c) 1999 - 2006 Intel Corporation.
5
+
6
+  This program is free software; you can redistribute it and/or modify it
7
+  under the terms and conditions of the GNU General Public License,
8
+  version 2, as published by the Free Software Foundation.
9
+
10
+  This program is distributed in the hope it will be useful, but WITHOUT
11
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13
+  more details.
14
+
15
+  You should have received a copy of the GNU General Public License along with
16
+  this program; if not, write to the Free Software Foundation, Inc.,
17
+  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
+
19
+  The full GNU General Public License is included in this distribution in
20
+  the file called "COPYING".
21
+
22
+  Contact Information:
23
+  Linux NICS <linux.nics@intel.com>
24
+  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25
+  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26
+
27
+*******************************************************************************/
28
+
29
+
30
+/* glue for the OS independent part of e1000
31
+ * includes register access macros
32
+ */
33
+
34
+#ifndef _E1000_OSDEP_H_
35
+#define _E1000_OSDEP_H_
36
+
37
+#include <stdint.h>
38
+#include <stdlib.h>
39
+#include <stdio.h>
40
+#include <io.h>
41
+#include <errno.h>
42
+#include <timer.h>
43
+#include <byteswap.h>
44
+#include <gpxe/pci.h>
45
+#include <gpxe/if_ether.h>
46
+#include <gpxe/ethernet.h>
47
+#include <gpxe/iobuf.h>
48
+#include <gpxe/netdevice.h>
49
+
50
+typedef enum {
51
+#undef FALSE
52
+    FALSE = 0,
53
+#undef TRUE
54
+    TRUE = 1
55
+} boolean_t;
56
+
57
+/* Debugging #defines */
58
+
59
+#if 1
60
+#define DEBUGFUNC(F) DBG(F "\n")
61
+#else
62
+#define DEBUGFUNC(F)
63
+#endif
64
+
65
+#if 1
66
+#define DEBUGOUT(S)             DBG(S)
67
+#define DEBUGOUT1(S, A...)      DBG(S, A)
68
+#else
69
+#define DEBUGOUT(S)
70
+#define DEBUGOUT1(S, A...)
71
+#endif
72
+
73
+#define DEBUGOUT2 DEBUGOUT1
74
+#define DEBUGOUT3 DEBUGOUT1
75
+#define DEBUGOUT7 DEBUGOUT1
76
+
77
+#define E1000_WRITE_REG(a, reg, value) ( \
78
+    writel((value), ((a)->hw_addr + \
79
+        (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg))))
80
+
81
+#define E1000_READ_REG(a, reg) ( \
82
+    readl((a)->hw_addr + \
83
+        (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg)))
84
+
85
+#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
86
+    writel((value), ((a)->hw_addr + \
87
+        (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
88
+        ((offset) << 2))))
89
+
90
+#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
91
+    readl((a)->hw_addr + \
92
+        (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
93
+        ((offset) << 2)))
94
+
95
+#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
96
+#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
97
+
98
+#define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
99
+    writew((value), ((a)->hw_addr + \
100
+        (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
101
+        ((offset) << 1))))
102
+
103
+#define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
104
+    readw((a)->hw_addr + \
105
+        (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
106
+        ((offset) << 1)))
107
+
108
+#define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
109
+    writeb((value), ((a)->hw_addr + \
110
+        (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
111
+        (offset))))
112
+
113
+#define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
114
+    readb((a)->hw_addr + \
115
+        (((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
116
+        (offset)))
117
+
118
+#define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS)
119
+
120
+#define E1000_WRITE_ICH_FLASH_REG(a, reg, value) ( \
121
+    writel((value), ((a)->flash_address + reg)))
122
+
123
+#define E1000_READ_ICH_FLASH_REG(a, reg) ( \
124
+    readl((a)->flash_address + reg))
125
+
126
+#define E1000_WRITE_ICH_FLASH_REG16(a, reg, value) ( \
127
+    writew((value), ((a)->flash_address + reg)))
128
+
129
+#define E1000_READ_ICH_FLASH_REG16(a, reg) ( \
130
+    readw((a)->flash_address + reg))
131
+
132
+#define	msleep(n) 	mdelay(n)
133
+
134
+#endif /* _E1000_OSDEP_H_ */
135
+
136
+/*
137
+ * Local variables:
138
+ *  c-basic-offset: 8
139
+ *  c-indent-level: 8
140
+ *  tab-width: 8
141
+ * End:
142
+ */

+ 2
- 1
src/include/gpxe/errfile.h Wyświetl plik

@@ -85,7 +85,6 @@
85 85
 #define ERRFILE_davicom		     ( ERRFILE_DRIVER | 0x00340000 )
86 86
 #define ERRFILE_depca		     ( ERRFILE_DRIVER | 0x00350000 )
87 87
 #define ERRFILE_dmfe		     ( ERRFILE_DRIVER | 0x00360000 )
88
-#define ERRFILE_e1000		     ( ERRFILE_DRIVER | 0x00370000 )
89 88
 #define ERRFILE_eepro100	     ( ERRFILE_DRIVER | 0x00380000 )
90 89
 #define ERRFILE_epic100		     ( ERRFILE_DRIVER | 0x00390000 )
91 90
 #define ERRFILE_forcedeth	     ( ERRFILE_DRIVER | 0x003a0000 )
@@ -102,6 +101,8 @@
102 101
 #define ERRFILE_via_velocity	     ( ERRFILE_DRIVER | 0x00450000 )
103 102
 #define ERRFILE_w89c840		     ( ERRFILE_DRIVER | 0x00460000 )
104 103
 #define ERRFILE_ipoib		     ( ERRFILE_DRIVER | 0x00470000 )
104
+#define ERRFILE_e1000		     ( ERRFILE_DRIVER | 0x00480000 )
105
+#define ERRFILE_e1000_hw	     ( ERRFILE_DRIVER | 0x00490000 )
105 106
 
106 107
 #define ERRFILE_scsi		     ( ERRFILE_DRIVER | 0x00700000 )
107 108
 #define ERRFILE_arbel		     ( ERRFILE_DRIVER | 0x00710000 )

Ładowanie…
Anuluj
Zapisz