浏览代码

Symbol fixups

tags/v0.9.3
Michael Brown 19 年前
父节点
当前提交
c112f12c5b

+ 10
- 6
src/drivers/net/davicom.c 查看文件

@@ -141,13 +141,17 @@ static unsigned long ioaddr;
141 141
 
142 142
 /* transmit descriptor and buffer */
143 143
 #define NTXD 2
144
-static struct txdesc txd[NTXD] __attribute__ ((aligned(4)));
145
-static unsigned char txb[BUFLEN] __attribute__ ((aligned(4)));
146
-
147
-/* receive descriptor(s) and buffer(s) */
148 144
 #define NRXD 4
149
-static struct rxdesc rxd[NRXD] __attribute__ ((aligned(4)));
150
-static unsigned char rxb[NRXD * BUFLEN] __attribute__ ((aligned(4)));
145
+struct {
146
+	struct txdesc txd[NTXD] __attribute__ ((aligned(4)));
147
+	unsigned char txb[BUFLEN] __attribute__ ((aligned(4)));
148
+	struct rxdesc rxd[NRXD] __attribute__ ((aligned(4)));
149
+	unsigned char rxb[NRXD * BUFLEN] __attribute__ ((aligned(4)));
150
+} davicom_bufs __shared;
151
+#define txd davicom_bufs.txd
152
+#define txb davicom_bufs.txb
153
+#define rxd davicom_bufs.rxd
154
+#define rxb davicom_bufs.rxb
151 155
 static int rxd_tail;
152 156
 static int TxPtr;
153 157
 

+ 14
- 19
src/drivers/net/dmfe.c 查看文件

@@ -150,7 +150,7 @@ struct rx_desc {
150 150
 	 u32 /* struct rx_desc * */ next_rx_desc;
151 151
 } __attribute__ ((aligned(32)));
152 152
 
153
-struct dmfe_private {
153
+static struct dmfe_private {
154 154
 	u32 chip_id;		/* Chip vendor/Device ID */
155 155
 	u32 chip_revision;	/* Chip revision */
156 156
 	u32 cr0_data;
@@ -214,26 +214,21 @@ static u8 SF_mode;		/* Special Function: 1:VLAN, 2:RX Flow Control
214 214
 /**********************************************
215 215
 * Descriptor Ring and Buffer defination
216 216
 ***********************************************/
217
-/* Define the TX Descriptor */
218
-static struct tx_desc txd[TX_DESC_CNT]
219
-    __attribute__ ((aligned(32)));
220
-
221
-/* Create a static buffer of size PKT_BUF_SZ for each TX Descriptor.
222
-  All descriptors point to a part of this buffer */
223
-static unsigned char txb[TX_BUF_ALLOC * TX_DESC_CNT]
224
-    __attribute__ ((aligned(32)));
225
-
226
-/* Define the RX Descriptor */
227
-static struct rx_desc rxd[RX_DESC_CNT]
228
-__attribute__ ((aligned(32)));
229
-
230
-/* Create a static buffer of size PKT_BUF_SZ for each RX Descriptor.
231
-   All descriptors point to a part of this buffer */
232
-static unsigned char rxb[RX_ALLOC_SIZE * RX_DESC_CNT]
233
-__attribute__ ((aligned(32)));
217
+struct {
218
+	struct tx_desc txd[TX_DESC_CNT] __attribute__ ((aligned(32)));
219
+	unsigned char txb[TX_BUF_ALLOC * TX_DESC_CNT]
220
+	__attribute__ ((aligned(32)));
221
+	struct rx_desc rxd[RX_DESC_CNT] __attribute__ ((aligned(32)));
222
+	unsigned char rxb[RX_ALLOC_SIZE * RX_DESC_CNT]
223
+	__attribute__ ((aligned(32)));
224
+} dmfe_bufs __shared;
225
+#define txd dmfe_bufs.txd
226
+#define txb dmfe_bufs.txb
227
+#define rxd dmfe_bufs.rxd
228
+#define rxb dmfe_bufs.rxb
234 229
 
235 230
 /* NIC specific static variables go here */
236
-long int BASE;
231
+static long int BASE;
237 232
 
238 233
 static u16 read_srom_word(long ioaddr, int offset);
239 234
 static void dmfe_init_dm910x(struct nic *nic);

+ 16
- 14
src/drivers/net/e1000.c 查看文件

@@ -89,9 +89,12 @@ static struct nic_operations e1000_operations;
89 89
 static struct pci_driver e1000_driver;
90 90
 
91 91
 static struct e1000_hw hw;
92
-static char tx_pool[128 + 16];
93
-static char rx_pool[128 + 16];
94
-static char packet[2096];
92
+
93
+struct {
94
+	char tx_pool[128 + 16];
95
+	char rx_pool[128 + 16];
96
+	char packet[2096];
97
+} e1000_bufs __shared;
95 98
 
96 99
 static struct e1000_tx_desc *tx_base;
97 100
 static struct e1000_rx_desc *rx_base;
@@ -171,13 +174,13 @@ static void e1000_irq(struct nic *nic, irq_action_t action);
171 174
 
172 175
 #define E1000_WRITE_FLUSH(a) {uint32_t x; x = E1000_READ_REG(a, STATUS);}
173 176
 
174
-uint32_t
177
+static inline uint32_t
175 178
 e1000_io_read(struct e1000_hw *hw __unused, uint32_t port)
176 179
 {
177 180
         return inl(port);
178 181
 }
179 182
 
180
-void
183
+static inline void
181 184
 e1000_io_write(struct e1000_hw *hw __unused, uint32_t port, uint32_t value)
182 185
 {
183 186
         outl(value, port);
@@ -724,11 +727,10 @@ e1000_clear_vfta(struct e1000_hw *hw)
724 727
 * hw - Struct containing variables accessed by shared code
725 728
 * offset - offset to write to * value - value to write
726 729
 *****************************************************************************/
727
-void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, uint32_t value){
728
-	uint32_t io_addr = hw->io_base;
729
-	uint32_t io_data = hw->io_base + 4;
730
-	e1000_io_write(hw, io_addr, offset);
731
-	e1000_io_write(hw, io_data, value);
730
+static inline void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset,
731
+				      uint32_t value){
732
+	e1000_io_write(hw, hw->io_base, offset);
733
+	e1000_io_write(hw, hw->io_base + 4, value);
732 734
 }
733 735
 
734 736
 /******************************************************************************
@@ -3362,7 +3364,7 @@ static void fill_rx (void)
3362 3364
 	rd = rx_base + rx_tail;
3363 3365
 	rx_tail = (rx_tail + 1) % 8;
3364 3366
 	memset (rd, 0, 16);
3365
-	rd->buffer_addr = virt_to_bus(&packet);
3367
+	rd->buffer_addr = virt_to_bus(&e1000_bufs.packet);
3366 3368
 	E1000_WRITE_REG (&hw, RDT, rx_tail);
3367 3369
 }
3368 3370
 
@@ -3371,7 +3373,7 @@ static void init_descriptor (void)
3371 3373
 	unsigned long ptr;
3372 3374
 	unsigned long tctl;
3373 3375
 
3374
-	ptr = virt_to_phys(tx_pool);
3376
+	ptr = virt_to_phys(e1000_bufs.tx_pool);
3375 3377
 	if (ptr & 0xf)
3376 3378
 		ptr = (ptr + 0x10) & (~0xf);
3377 3379
 
@@ -3409,7 +3411,7 @@ static void init_descriptor (void)
3409 3411
 	rx_tail = 0;
3410 3412
 	/* disable receive */
3411 3413
 	E1000_WRITE_REG (&hw, RCTL, 0);
3412
-	ptr = virt_to_phys(rx_pool);
3414
+	ptr = virt_to_phys(e1000_bufs.rx_pool);
3413 3415
 	if (ptr & 0xf)
3414 3416
 		ptr = (ptr + 0x10) & (~0xf);
3415 3417
 	rx_base = phys_to_virt(ptr);
@@ -3454,7 +3456,7 @@ e1000_poll (struct nic *nic, int retrieve)
3454 3456
 	if ( ! retrieve ) return 1;
3455 3457
 
3456 3458
 	//      printf("recv: packet %! -> %! len=%d \n", packet+6, packet,rd->Length);
3457
-	memcpy (nic->packet, packet, rd->length);
3459
+	memcpy (nic->packet, e1000_bufs.packet, rd->length);
3458 3460
 	nic->packetlen = rd->length;
3459 3461
 	fill_rx ();
3460 3462
 

+ 4
- 1
src/drivers/net/eepro100.c 查看文件

@@ -262,7 +262,10 @@ static struct nic_operations eepro100_operations;
262 262
 static struct pci_driver eepro100_driver;
263 263
 
264 264
 #define RXFD_COUNT 4
265
-static struct RxFD rxfds[RXFD_COUNT];
265
+struct {
266
+	struct RxFD rxfds[RXFD_COUNT];
267
+} eepro100_bufs __shared;
268
+#define rxfds eepro100_bufs.rxfds
266 269
 static unsigned int rxfd = 0;
267 270
 
268 271
 static int congenb = 0;         /* Enable congestion control in the DP83840. */

+ 10
- 4
src/drivers/net/epic100.c 查看文件

@@ -86,12 +86,18 @@ static unsigned int	cur_rx, cur_tx;		/* The next free ring entry */
86 86
 static unsigned short	eeprom[64];
87 87
 #endif
88 88
 static signed char	phys[4];		/* MII device addresses. */
89
-static struct epic_rx_desc	rx_ring[RX_RING_SIZE]
89
+struct {
90
+	struct epic_rx_desc	rx_ring[RX_RING_SIZE]
90 91
 	__attribute__ ((aligned(4)));
91
-static struct epic_tx_desc	tx_ring[TX_RING_SIZE]
92
+	struct epic_tx_desc	tx_ring[TX_RING_SIZE]
92 93
 	__attribute__ ((aligned(4)));
93
-static unsigned char	 	rx_packet[PKT_BUF_SZ * RX_RING_SIZE];
94
-static unsigned char		tx_packet[PKT_BUF_SZ * TX_RING_SIZE];
94
+	unsigned char	 	rx_packet[PKT_BUF_SZ * RX_RING_SIZE];
95
+	unsigned char		tx_packet[PKT_BUF_SZ * TX_RING_SIZE];
96
+} epic100_bufs __shared;
97
+#define rx_ring epic100_bufs.rx_ring
98
+#define tx_ring epic100_bufs.tx_ring
99
+#define rx_packet epic100_bufs.rx_packet
100
+#define tx_packet epic100_bufs.tx_packet
95 101
 
96 102
 /***********************************************************************/
97 103
 /*                    Externally visible functions                     */

+ 13
- 23
src/drivers/net/forcedeth.c 查看文件

@@ -71,7 +71,7 @@ typedef signed int s32;
71 71
 #define virt_to_le32desc(addr)  cpu_to_le32(virt_to_bus(addr))
72 72
 #define le32desc_to_virt(addr)  bus_to_virt(le32_to_cpu(addr))
73 73
 
74
-unsigned long BASE;
74
+static unsigned long BASE;
75 75
 /* NIC specific static variables go here */
76 76
 
77 77
 
@@ -290,24 +290,20 @@ struct ring_desc {
290 290
 };
291 291
 
292 292
 
293
-/* Define the TX Descriptor */
294
-static struct ring_desc tx_ring[TX_RING];
295
-
296
-/* Create a static buffer of size RX_BUF_SZ for each
297
-TX Descriptor.  All descriptors point to a
298
-part of this buffer */
299
-static unsigned char txb[TX_RING * RX_NIC_BUFSIZE];
300
-
301
-/* Define the TX Descriptor */
302
-static struct ring_desc rx_ring[RX_RING];
303
-
304
-/* Create a static buffer of size RX_BUF_SZ for each
305
-RX Descriptor   All descriptors point to a
306
-part of this buffer */
307
-static unsigned char rxb[RX_RING * RX_NIC_BUFSIZE];
293
+/* Define the TX and RX Descriptor and Buffers */
294
+struct {
295
+	struct ring_desc tx_ring[TX_RING];
296
+	unsigned char txb[TX_RING * RX_NIC_BUFSIZE];
297
+	struct ring_desc rx_ring[RX_RING];
298
+	unsigned char rxb[RX_RING * RX_NIC_BUFSIZE];
299
+} forcedeth_bufs __shared;
300
+#define tx_ring forcedeth_bufs.tx_ring
301
+#define rx_ring forcedeth_bufs.rx_ring
302
+#define txb forcedeth_bufs.txb
303
+#define rxb forcedeth_bufs.rxb
308 304
 
309 305
 /* Private Storage for the NIC */
310
-struct forcedeth_private {
306
+static struct forcedeth_private {
311 307
 	/* General data:
312 308
 	 * Locking: spin_lock(&np->lock); */
313 309
 	int in_shutdown;
@@ -322,19 +318,13 @@ struct forcedeth_private {
322 318
 	/* rx specific fields.
323 319
 	 * Locking: Within irq hander or disable_irq+spin_lock(&np->lock);
324 320
 	 */
325
-	struct ring_desc *rx_ring;
326 321
 	unsigned int cur_rx, refill_rx;
327
-	struct sk_buff *rx_skbuff[RX_RING];
328
-	u32 rx_dma[RX_RING];
329 322
 	unsigned int rx_buf_sz;
330 323
 
331 324
 	/*
332 325
 	 * tx specific fields.
333 326
 	 */
334
-	struct ring_desc *tx_ring;
335 327
 	unsigned int next_tx, nic_tx;
336
-	struct sk_buff *tx_skbuff[TX_RING];
337
-	u32 tx_dma[TX_RING];
338 328
 	u16 tx_flags;
339 329
 } npx;
340 330
 

+ 7
- 9
src/drivers/net/mtd80x.c 查看文件

@@ -368,16 +368,14 @@ enum tx_desc_control_bits {
368 368
 #define LinkIsUp2 0x00040000
369 369
 
370 370
 /* Create a static buffer of size PKT_BUF_SZ for each
371
-TX Descriptor.  All descriptors point to a
371
+RX and TX Descriptor.  All descriptors point to a
372 372
 part of this buffer */
373
-static u8 txb[PKT_BUF_SZ * TX_RING_SIZE]
374
-__attribute__ ((aligned(8)));
375
-
376
-/* Create a static buffer of size PKT_BUF_SZ for each
377
-RX Descriptor   All descriptors point to a
378
-part of this buffer */
379
-static u8 rxb[PKT_BUF_SZ * RX_RING_SIZE]
380
-__attribute__ ((aligned(8)));
373
+struct {
374
+	u8 txb[PKT_BUF_SZ * TX_RING_SIZE] __attribute__ ((aligned(8)));
375
+	u8 rxb[PKT_BUF_SZ * RX_RING_SIZE] __attribute__ ((aligned(8)));
376
+} mtd80x_bufs __shared;
377
+#define txb mtd80x_bufs.txb
378
+#define rxb mtd80x_bufs.rxb
381 379
 
382 380
 /* The Tulip Rx and Tx buffer descriptors. */
383 381
 struct mtd_desc

+ 10
- 5
src/drivers/net/natsemi.c 查看文件

@@ -205,11 +205,16 @@ static unsigned int tx_config;
205 205
    longword aligned 
206 206
 */
207 207
 
208
-static BufferDesc txd              __attribute__ ((aligned(4)));
209
-static BufferDesc rxd[NUM_RX_DESC] __attribute__ ((aligned(4)));
210
-
211
-static unsigned char txb[TX_BUF_SIZE] __attribute__ ((aligned(4)));
212
-static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE] __attribute__ ((aligned(4)));
208
+struct {
209
+    BufferDesc txd              __attribute__ ((aligned(4)));
210
+    BufferDesc rxd[NUM_RX_DESC] __attribute__ ((aligned(4)));
211
+    unsigned char txb[TX_BUF_SIZE] __attribute__ ((aligned(4)));
212
+    unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE] __attribute__ ((aligned(4)));
213
+} natsemi_bufs __shared;
214
+#define txd natsemi_bufs.txd
215
+#define rxd natsemi_bufs.rxd
216
+#define txb natsemi_bufs.txb
217
+#define rxb natsemi_bufs.rxb
213 218
 
214 219
 /* Function Prototypes */
215 220
 

+ 12
- 18
src/drivers/net/ns83820.c 查看文件

@@ -393,24 +393,18 @@ struct ns83820_private {
393 393
 } nsx;
394 394
 static struct ns83820_private *ns;
395 395
 
396
-/* Define the TX Descriptor */
397
-static struct ring_desc tx_ring[NR_TX_DESC]
398
-    __attribute__ ((aligned(8)));
399
-
400
-/* Create a static buffer of size REAL_RX_BUF_SIZE for each
401
-TX Descriptor.  All descriptors point to a
402
-part of this buffer */
403
-static unsigned char txb[NR_TX_DESC * REAL_RX_BUF_SIZE];
404
-
405
-/* Define the TX Descriptor */
406
-static struct ring_desc rx_ring[NR_RX_DESC]
407
-    __attribute__ ((aligned(8)));
408
-
409
-/* Create a static buffer of size REAL_RX_BUF_SIZE for each
410
-RX Descriptor   All descriptors point to a
411
-part of this buffer */
412
-static unsigned char rxb[NR_RX_DESC * REAL_RX_BUF_SIZE]
413
-    __attribute__ ((aligned(8)));
396
+/* Define the TX and RX Descriptor and Buffers */
397
+struct {
398
+	struct ring_desc tx_ring[NR_TX_DESC] __attribute__ ((aligned(8)));
399
+	unsigned char txb[NR_TX_DESC * REAL_RX_BUF_SIZE];
400
+	struct ring_desc rx_ring[NR_RX_DESC] __attribute__ ((aligned(8)));
401
+	unsigned char rxb[NR_RX_DESC * REAL_RX_BUF_SIZE]
402
+	__attribute__ ((aligned(8)));
403
+} ns83820_bufs __shared;
404
+#define tx_ring ns83820_bufs.tx_ring
405
+#define rx_ring ns83820_bufs.rx_ring
406
+#define txb ns83820_bufs.txb
407
+#define rxb ns83820_bufs.rxb
414 408
 
415 409
 static void phy_intr(struct nic *nic __unused)
416 410
 {

+ 36
- 45
src/drivers/net/pcnet32.c 查看文件

@@ -182,20 +182,6 @@ static int full_duplex[MAX_UNITS];
182 182
 
183 183
 #define PCNET32_TOTAL_SIZE	0x20
184 184
 
185
-/* Buffers for the tx and Rx */
186
-
187
-/* Create a static buffer of size PKT_BUF_SZ for each
188
-TX Descriptor.  All descriptors point to a
189
-part of this buffer */
190
-static unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE];
191
-//    __attribute__ ((aligned(16)));
192
-
193
-/* Create a static buffer of size PKT_BUF_SZ for each
194
-RX Descriptor   All descriptors point to a
195
-part of this buffer */
196
-static unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ];
197
-//    __attribute__ ((aligned(16)));
198
-
199 185
 /* The PCNET32 Rx and Tx ring descriptors. */
200 186
 struct pcnet32_rx_head {
201 187
 	u32 base;
@@ -235,14 +221,15 @@ struct pcnet32_access {
235 221
 	void (*reset) (unsigned long);
236 222
 };
237 223
 
238
-/* Define the TX Descriptor */
239
-static struct pcnet32_tx_head tx_ring[TX_RING_SIZE]
240
-    __attribute__ ((aligned(16)));
241
-
242
-
243
-/* Define the RX Descriptor */
244
-static struct pcnet32_rx_head rx_ring[RX_RING_SIZE]
245
-    __attribute__ ((aligned(16)));
224
+/* Define the TX and RX Descriptors and Rings */
225
+struct {
226
+	struct pcnet32_tx_head tx_ring[TX_RING_SIZE]
227
+	__attribute__ ((aligned(16)));
228
+	struct pcnet32_rx_head rx_ring[RX_RING_SIZE]
229
+	__attribute__ ((aligned(16)));
230
+	unsigned char txb[PKT_BUF_SZ * TX_RING_SIZE];
231
+	unsigned char rxb[RX_RING_SIZE * PKT_BUF_SZ];
232
+} pcnet32_bufs __shared;
246 233
 
247 234
 /* May need to be moved to mii.h */
248 235
 struct mii_if_info {
@@ -411,16 +398,17 @@ static int pcnet32_init_ring(struct nic *nic)
411 398
 	lp->cur_rx = lp->cur_tx = 0;
412 399
 
413 400
 	for (i = 0; i < RX_RING_SIZE; i++) {
414
-		rx_ring[i].base = (u32) virt_to_le32desc(&rxb[i]);
415
-		rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ);
416
-		rx_ring[i].status = le16_to_cpu(0x8000);
401
+		pcnet32_bufs.rx_ring[i].base =
402
+			virt_to_le32desc(&pcnet32_bufs.rxb[i]);
403
+		pcnet32_bufs.rx_ring[i].buf_length = le16_to_cpu(-PKT_BUF_SZ);
404
+		pcnet32_bufs.rx_ring[i].status = le16_to_cpu(0x8000);
417 405
 	}
418 406
 
419 407
 	/* The Tx buffer address is filled in as needed, but we do need to clear
420 408
 	   the upper ownership bit. */
421 409
 	for (i = 0; i < TX_RING_SIZE; i++) {
422
-		tx_ring[i].base = 0;
423
-		tx_ring[i].status = 0;
410
+		pcnet32_bufs.tx_ring[i].base = 0;
411
+		pcnet32_bufs.tx_ring[i].status = 0;
424 412
 	}
425 413
 
426 414
 
@@ -428,8 +416,8 @@ static int pcnet32_init_ring(struct nic *nic)
428 416
 	    le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS);
429 417
 	for (i = 0; i < 6; i++)
430 418
 		lp->init_block.phys_addr[i] = nic->node_addr[i];
431
-	lp->init_block.rx_ring = (u32) virt_to_le32desc(&rx_ring[0]);
432
-	lp->init_block.tx_ring = (u32) virt_to_le32desc(&tx_ring[0]);
419
+	lp->init_block.rx_ring = virt_to_le32desc(&pcnet32_bufs.rx_ring[0]);
420
+	lp->init_block.tx_ring = virt_to_le32desc(&pcnet32_bufs.tx_ring[0]);
433 421
 	return 0;
434 422
 }
435 423
 
@@ -547,11 +535,11 @@ static int pcnet32_poll(struct nic *nic __unused, int retrieve)
547 535
 	/* nic->packet should contain data on return */
548 536
 	/* nic->packetlen should contain length of data */
549 537
 
550
-	int status;
538
+	signed char status;
551 539
 	int entry;
552 540
 
553 541
 	entry = lp->cur_rx & RX_RING_MOD_MASK;
554
-	status = ((short) le16_to_cpu(rx_ring[entry].status) >> 8);
542
+	status = (le16_to_cpu(pcnet32_bufs.rx_ring[entry].status) >> 8);
555 543
 
556 544
 	if (status < 0)
557 545
 		return 0;
@@ -560,13 +548,16 @@ static int pcnet32_poll(struct nic *nic __unused, int retrieve)
560 548
 
561 549
 	if (status == 0x03) {
562 550
 		nic->packetlen =
563
-		    (le32_to_cpu(rx_ring[entry].msg_length) & 0xfff) - 4;
564
-		memcpy(nic->packet, &rxb[entry], nic->packetlen);
551
+			(le32_to_cpu(pcnet32_bufs.rx_ring[entry].msg_length)
552
+			 & 0xfff) - 4;
553
+		memcpy(nic->packet, &pcnet32_bufs.rxb[entry], nic->packetlen);
565 554
 
566 555
 		/* Andrew Boyd of QNX reports that some revs of the 79C765
567 556
 		 * clear the buffer length */
568
-		rx_ring[entry].buf_length = le16_to_cpu(-PKT_BUF_SZ);
569
-		rx_ring[entry].status |= le16_to_cpu(0x8000);	/* prime for next receive */
557
+		pcnet32_bufs.rx_ring[entry].buf_length
558
+			= le16_to_cpu(-PKT_BUF_SZ);
559
+		/* prime for next receive */
560
+		pcnet32_bufs.rx_ring[entry].status |= le16_to_cpu(0x8000);
570 561
 		/* Switch to the next Rx ring buffer */
571 562
 		lp->cur_rx++;
572 563
 
@@ -594,7 +585,7 @@ static void pcnet32_transmit(struct nic *nic __unused, const char *d,	/* Destina
594 585
 
595 586
 	status = 0x8300;
596 587
 	/* point to the current txb incase multiple tx_rings are used */
597
-	ptxb = txb + (lp->cur_tx * PKT_BUF_SZ);
588
+	ptxb = pcnet32_bufs.txb + (lp->cur_tx * PKT_BUF_SZ);
598 589
 
599 590
 	/* copy the packet to ring buffer */
600 591
 	memcpy(ptxb, d, ETH_ALEN);	/* dst */
@@ -607,12 +598,12 @@ static void pcnet32_transmit(struct nic *nic __unused, const char *d,	/* Destina
607 598
 	while (s < ETH_ZLEN)	/* pad to min length */
608 599
 		ptxb[s++] = '\0';
609 600
 
610
-	tx_ring[entry].length = le16_to_cpu(-s);
611
-	tx_ring[entry].misc = 0x00000000;
612
-	tx_ring[entry].base = (u32) virt_to_le32desc(ptxb);
601
+	pcnet32_bufs.tx_ring[entry].length = le16_to_cpu(-s);
602
+	pcnet32_bufs.tx_ring[entry].misc = 0x00000000;
603
+	pcnet32_bufs.tx_ring[entry].base = (u32) virt_to_le32desc(ptxb);
613 604
 
614 605
 	/* we set the top byte as the very last thing */
615
-	tx_ring[entry].status = le16_to_cpu(status);
606
+	pcnet32_bufs.tx_ring[entry].status = le16_to_cpu(status);
616 607
 
617 608
 
618 609
 	/* Trigger an immediate send poll */
@@ -622,14 +613,14 @@ static void pcnet32_transmit(struct nic *nic __unused, const char *d,	/* Destina
622 613
 	lp->cur_tx = 0;		/* (lp->cur_tx + 1); */
623 614
 	time = currticks() + TICKS_PER_SEC;	/* wait one second */
624 615
 	while (currticks() < time &&
625
-	       ((short) le16_to_cpu(tx_ring[entry].status) < 0));
616
+	       ((short) le16_to_cpu(pcnet32_bufs.tx_ring[entry].status) < 0));
626 617
 
627
-	if ((short) le16_to_cpu(tx_ring[entry].status) < 0)
618
+	if ((short) le16_to_cpu(pcnet32_bufs.tx_ring[entry].status) < 0)
628 619
 		printf("PCNET32 timed out on transmit\n");
629 620
 
630 621
 	/* Stop pointing at the current txb
631 622
 	 * otherwise the card continues to send the packet */
632
-	tx_ring[entry].base = 0;
623
+	pcnet32_bufs.tx_ring[entry].base = 0;
633 624
 
634 625
 }
635 626
 
@@ -882,8 +873,8 @@ static int pcnet32_probe ( struct nic *nic, struct pci_device *pci ) {
882 873
 		lp->init_block.phys_addr[i] = nic->node_addr[i];
883 874
 	lp->init_block.filter[0] = 0xffffffff;
884 875
 	lp->init_block.filter[1] = 0xffffffff;
885
-	lp->init_block.rx_ring = virt_to_bus(&rx_ring);
886
-	lp->init_block.tx_ring = virt_to_bus(&tx_ring);
876
+	lp->init_block.rx_ring = virt_to_bus(&pcnet32_bufs.rx_ring);
877
+	lp->init_block.tx_ring = virt_to_bus(&pcnet32_bufs.tx_ring);
887 878
 
888 879
 	/* switch pcnet32 to 32bit mode */
889 880
 	a->write_bcr(ioaddr, 20, 2);

+ 6
- 2
src/drivers/net/rtl8139.c 查看文件

@@ -169,8 +169,12 @@ enum rx_mode_bits {
169 169
 static unsigned int cur_rx,cur_tx;
170 170
 
171 171
 /* The RTL8139 can only transmit from a contiguous, aligned memory block.  */
172
-static unsigned char tx_buffer[TX_BUF_SIZE] __attribute__((aligned(4)));
173
-static unsigned char rx_ring[RX_BUF_LEN+16] __attribute__((aligned(4)));
172
+struct {
173
+	unsigned char tx_buffer[TX_BUF_SIZE] __attribute__((aligned(4)));
174
+	unsigned char rx_ring[RX_BUF_LEN+16] __attribute__((aligned(4)));
175
+} rtl8139_bufs __shared;
176
+#define tx_buffer rtl8139_bufs.tx_buffer
177
+#define rx_ring rtl8139_bufs.rx_ring
174 178
 
175 179
 static int rtl8139_probe(struct nic *nic,struct pci_device *pci);
176 180
 static int read_eeprom(struct nic *nic, int location, int addr_len);

+ 10
- 4
src/drivers/net/sis900.c 查看文件

@@ -64,10 +64,16 @@ static unsigned int cur_phy;
64 64
 
65 65
 static unsigned int cur_rx;
66 66
 
67
-static BufferDesc txd;
68
-static BufferDesc rxd[NUM_RX_DESC];
69
-static unsigned char txb[TX_BUF_SIZE];
70
-static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE];
67
+struct {
68
+    BufferDesc txd;
69
+    BufferDesc rxd[NUM_RX_DESC];
70
+    unsigned char txb[TX_BUF_SIZE];
71
+    unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE];
72
+} sis900_bufs __shared;
73
+#define txd sis900_bufs.txd
74
+#define rxd sis900_bufs.rxd
75
+#define txb sis900_bufs.txb
76
+#define rxb sis900_bufs.rxb
71 77
 
72 78
 #if 0
73 79
 static struct mac_chip_info {

+ 15
- 10
src/drivers/net/tlan.c 查看文件

@@ -100,7 +100,7 @@ static void TLan_MiiSync(u16);
100 100
 static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16);
101 101
 
102 102
 
103
-const char *media[] = {
103
+static const char *media[] = {
104 104
 	"10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
105 105
 	"100baseTx-FD", "100baseT4", 0
106 106
 };
@@ -187,21 +187,26 @@ struct TLanList {
187 187
 	} buffer[TLAN_BUFFERS_PER_LIST];
188 188
 };
189 189
 
190
-struct TLanList tx_ring[TLAN_NUM_TX_LISTS];
191
-static unsigned char txb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_TX_LISTS];
192
-
193
-struct TLanList rx_ring[TLAN_NUM_RX_LISTS];
194
-static unsigned char rxb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_RX_LISTS];
190
+struct {
191
+	struct TLanList tx_ring[TLAN_NUM_TX_LISTS];
192
+	unsigned char txb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_TX_LISTS];
193
+	struct TLanList rx_ring[TLAN_NUM_RX_LISTS];
194
+	unsigned char rxb[TLAN_MAX_FRAME_SIZE * TLAN_NUM_RX_LISTS];
195
+} tlan_buffers __shared;
196
+#define tx_ring tlan_buffers.tx_ring
197
+#define txb tlan_buffers.txb
198
+#define rx_ring tlan_buffers.rx_ring
199
+#define rxb tlan_buffers.rxb
195 200
 
196 201
 typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE];
197 202
 
198
-int chip_idx;
203
+static int chip_idx;
199 204
 
200 205
 /*****************************************************************
201 206
 * TLAN Private Information Structure
202 207
 *
203 208
 ****************************************************************/
204
-struct tlan_private {
209
+static struct tlan_private {
205 210
 	unsigned short vendor_id;	/* PCI Vendor code */
206 211
 	unsigned short dev_id;	/* PCI Device code */
207 212
 	const char *nic_name;
@@ -226,7 +231,7 @@ struct tlan_private {
226 231
 
227 232
 static struct tlan_private *priv;
228 233
 
229
-u32 BASE;
234
+static u32 BASE;
230 235
 
231 236
 /***************************************************************
232 237
 *	TLan_ResetLists
@@ -242,7 +247,7 @@ u32 BASE;
242 247
 *
243 248
 **************************************************************/
244 249
 
245
-void TLan_ResetLists(struct nic *nic __unused)
250
+static void TLan_ResetLists(struct nic *nic __unused)
246 251
 {
247 252
 
248 253
 	int i;

+ 12
- 12
src/drivers/net/tlan.h 查看文件

@@ -393,7 +393,7 @@ typedef struct tlan_adapter_entry {
393 393
 
394 394
 /* Routines to access internal registers. */
395 395
 
396
-inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
396
+static inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
397 397
 {
398 398
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
399 399
 	return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3)));
@@ -403,7 +403,7 @@ inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
403 403
 
404 404
 
405 405
 
406
-inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
406
+static inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
407 407
 {
408 408
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
409 409
 	return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2)));
@@ -413,7 +413,7 @@ inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
413 413
 
414 414
 
415 415
 
416
-inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
416
+static inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
417 417
 {
418 418
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
419 419
 	return (inl(base_addr + TLAN_DIO_DATA));
@@ -423,7 +423,7 @@ inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
423 423
 
424 424
 
425 425
 
426
-inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
426
+static inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
427 427
 {
428 428
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
429 429
 	outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3));
@@ -433,7 +433,7 @@ inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
433 433
 
434 434
 
435 435
 
436
-inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
436
+static inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
437 437
 {
438 438
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
439 439
 	outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
@@ -443,7 +443,7 @@ inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
443 443
 
444 444
 
445 445
 
446
-inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
446
+static inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
447 447
 {
448 448
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
449 449
 	outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
@@ -453,7 +453,7 @@ inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
453 453
 
454 454
 
455 455
 #if 0
456
-inline void TLan_ClearBit(u8 bit, u16 port)
456
+static inline void TLan_ClearBit(u8 bit, u16 port)
457 457
 {
458 458
 	outb_p(inb_p(port) & ~bit, port);
459 459
 }
@@ -461,7 +461,7 @@ inline void TLan_ClearBit(u8 bit, u16 port)
461 461
 
462 462
 
463 463
 
464
-inline int TLan_GetBit(u8 bit, u16 port)
464
+static inline int TLan_GetBit(u8 bit, u16 port)
465 465
 {
466 466
 	return ((int) (inb_p(port) & bit));
467 467
 }
@@ -469,7 +469,7 @@ inline int TLan_GetBit(u8 bit, u16 port)
469 469
 
470 470
 
471 471
 
472
-inline void TLan_SetBit(u8 bit, u16 port)
472
+static inline void TLan_SetBit(u8 bit, u16 port)
473 473
 {
474 474
 	outb_p(inb_p(port) | bit, port);
475 475
 }
@@ -482,7 +482,7 @@ inline void TLan_SetBit(u8 bit, u16 port)
482 482
 #ifdef I_LIKE_A_FAST_HASH_FUNCTION
483 483
 /* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */
484 484
 /* the code below is about seven times as fast as the original code */
485
-inline u32 TLan_HashFunc(u8 * a)
485
+static inline u32 TLan_HashFunc(u8 * a)
486 486
 {
487 487
 	u8 hash;
488 488
 
@@ -498,7 +498,7 @@ inline u32 TLan_HashFunc(u8 * a)
498 498
 
499 499
 #else				/* original code */
500 500
 
501
-inline u32 xor(u32 a, u32 b)
501
+static inline u32 xor(u32 a, u32 b)
502 502
 {
503 503
 	return ((a && !b) || (!a && b));
504 504
 }
@@ -506,7 +506,7 @@ inline u32 xor(u32 a, u32 b)
506 506
 #define XOR8( a, b, c, d, e, f, g, h )	xor( a, xor( b, xor( c, xor( d, xor( e, xor( f, xor( g, h ) ) ) ) ) ) )
507 507
 #define DA( a, bit )					( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) )
508 508
 
509
-inline u32 TLan_HashFunc(u8 * a)
509
+static inline u32 TLan_HashFunc(u8 * a)
510 510
 {
511 511
 	u32 hash;
512 512
 

+ 10
- 5
src/drivers/net/tulip.c 查看文件

@@ -400,12 +400,17 @@ static u32 ioaddr;
400 400
    longword divisable */
401 401
 
402 402
 #define TX_RING_SIZE	2
403
-static struct tulip_tx_desc tx_ring[TX_RING_SIZE] __attribute__ ((aligned(4)));
404
-static unsigned char txb[BUFLEN] __attribute__ ((aligned(4)));
405
-
406 403
 #define RX_RING_SIZE	4
407
-static struct tulip_rx_desc rx_ring[RX_RING_SIZE] __attribute__ ((aligned(4)));
408
-static unsigned char rxb[RX_RING_SIZE * BUFLEN] __attribute__ ((aligned(4)));
404
+struct {
405
+    struct tulip_tx_desc tx_ring[TX_RING_SIZE];
406
+    unsigned char txb[BUFLEN];
407
+    struct tulip_rx_desc rx_ring[RX_RING_SIZE];
408
+    unsigned char rxb[RX_RING_SIZE * BUFLEN];
409
+} tulip_buffers __shared __attribute__ ((aligned(4)));
410
+#define tx_ring tulip_buffers.tx_ring
411
+#define txb tulip_buffers.txb
412
+#define rx_ring tulip_buffers.rx_ring
413
+#define rxb tulip_buffers.rxb
409 414
 
410 415
 static struct tulip_private {
411 416
     int cur_rx;

正在加载...
取消
保存