Browse Source

Symbol fixups

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
c112f12c5b

+ 10
- 6
src/drivers/net/davicom.c View File

141
 
141
 
142
 /* transmit descriptor and buffer */
142
 /* transmit descriptor and buffer */
143
 #define NTXD 2
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
 #define NRXD 4
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
 static int rxd_tail;
155
 static int rxd_tail;
152
 static int TxPtr;
156
 static int TxPtr;
153
 
157
 

+ 14
- 19
src/drivers/net/dmfe.c View File

150
 	 u32 /* struct rx_desc * */ next_rx_desc;
150
 	 u32 /* struct rx_desc * */ next_rx_desc;
151
 } __attribute__ ((aligned(32)));
151
 } __attribute__ ((aligned(32)));
152
 
152
 
153
-struct dmfe_private {
153
+static struct dmfe_private {
154
 	u32 chip_id;		/* Chip vendor/Device ID */
154
 	u32 chip_id;		/* Chip vendor/Device ID */
155
 	u32 chip_revision;	/* Chip revision */
155
 	u32 chip_revision;	/* Chip revision */
156
 	u32 cr0_data;
156
 	u32 cr0_data;
214
 /**********************************************
214
 /**********************************************
215
 * Descriptor Ring and Buffer defination
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
 /* NIC specific static variables go here */
230
 /* NIC specific static variables go here */
236
-long int BASE;
231
+static long int BASE;
237
 
232
 
238
 static u16 read_srom_word(long ioaddr, int offset);
233
 static u16 read_srom_word(long ioaddr, int offset);
239
 static void dmfe_init_dm910x(struct nic *nic);
234
 static void dmfe_init_dm910x(struct nic *nic);

+ 16
- 14
src/drivers/net/e1000.c View File

89
 static struct pci_driver e1000_driver;
89
 static struct pci_driver e1000_driver;
90
 
90
 
91
 static struct e1000_hw hw;
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
 static struct e1000_tx_desc *tx_base;
99
 static struct e1000_tx_desc *tx_base;
97
 static struct e1000_rx_desc *rx_base;
100
 static struct e1000_rx_desc *rx_base;
171
 
174
 
172
 #define E1000_WRITE_FLUSH(a) {uint32_t x; x = E1000_READ_REG(a, STATUS);}
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
 e1000_io_read(struct e1000_hw *hw __unused, uint32_t port)
178
 e1000_io_read(struct e1000_hw *hw __unused, uint32_t port)
176
 {
179
 {
177
         return inl(port);
180
         return inl(port);
178
 }
181
 }
179
 
182
 
180
-void
183
+static inline void
181
 e1000_io_write(struct e1000_hw *hw __unused, uint32_t port, uint32_t value)
184
 e1000_io_write(struct e1000_hw *hw __unused, uint32_t port, uint32_t value)
182
 {
185
 {
183
         outl(value, port);
186
         outl(value, port);
724
 * hw - Struct containing variables accessed by shared code
727
 * hw - Struct containing variables accessed by shared code
725
 * offset - offset to write to * value - value to write
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
 	rd = rx_base + rx_tail;
3364
 	rd = rx_base + rx_tail;
3363
 	rx_tail = (rx_tail + 1) % 8;
3365
 	rx_tail = (rx_tail + 1) % 8;
3364
 	memset (rd, 0, 16);
3366
 	memset (rd, 0, 16);
3365
-	rd->buffer_addr = virt_to_bus(&packet);
3367
+	rd->buffer_addr = virt_to_bus(&e1000_bufs.packet);
3366
 	E1000_WRITE_REG (&hw, RDT, rx_tail);
3368
 	E1000_WRITE_REG (&hw, RDT, rx_tail);
3367
 }
3369
 }
3368
 
3370
 
3371
 	unsigned long ptr;
3373
 	unsigned long ptr;
3372
 	unsigned long tctl;
3374
 	unsigned long tctl;
3373
 
3375
 
3374
-	ptr = virt_to_phys(tx_pool);
3376
+	ptr = virt_to_phys(e1000_bufs.tx_pool);
3375
 	if (ptr & 0xf)
3377
 	if (ptr & 0xf)
3376
 		ptr = (ptr + 0x10) & (~0xf);
3378
 		ptr = (ptr + 0x10) & (~0xf);
3377
 
3379
 
3409
 	rx_tail = 0;
3411
 	rx_tail = 0;
3410
 	/* disable receive */
3412
 	/* disable receive */
3411
 	E1000_WRITE_REG (&hw, RCTL, 0);
3413
 	E1000_WRITE_REG (&hw, RCTL, 0);
3412
-	ptr = virt_to_phys(rx_pool);
3414
+	ptr = virt_to_phys(e1000_bufs.rx_pool);
3413
 	if (ptr & 0xf)
3415
 	if (ptr & 0xf)
3414
 		ptr = (ptr + 0x10) & (~0xf);
3416
 		ptr = (ptr + 0x10) & (~0xf);
3415
 	rx_base = phys_to_virt(ptr);
3417
 	rx_base = phys_to_virt(ptr);
3454
 	if ( ! retrieve ) return 1;
3456
 	if ( ! retrieve ) return 1;
3455
 
3457
 
3456
 	//      printf("recv: packet %! -> %! len=%d \n", packet+6, packet,rd->Length);
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
 	nic->packetlen = rd->length;
3460
 	nic->packetlen = rd->length;
3459
 	fill_rx ();
3461
 	fill_rx ();
3460
 
3462
 

+ 4
- 1
src/drivers/net/eepro100.c View File

262
 static struct pci_driver eepro100_driver;
262
 static struct pci_driver eepro100_driver;
263
 
263
 
264
 #define RXFD_COUNT 4
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
 static unsigned int rxfd = 0;
269
 static unsigned int rxfd = 0;
267
 
270
 
268
 static int congenb = 0;         /* Enable congestion control in the DP83840. */
271
 static int congenb = 0;         /* Enable congestion control in the DP83840. */

+ 10
- 4
src/drivers/net/epic100.c View File

86
 static unsigned short	eeprom[64];
86
 static unsigned short	eeprom[64];
87
 #endif
87
 #endif
88
 static signed char	phys[4];		/* MII device addresses. */
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
 	__attribute__ ((aligned(4)));
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
 	__attribute__ ((aligned(4)));
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
 /*                    Externally visible functions                     */
103
 /*                    Externally visible functions                     */

+ 13
- 23
src/drivers/net/forcedeth.c View File

71
 #define virt_to_le32desc(addr)  cpu_to_le32(virt_to_bus(addr))
71
 #define virt_to_le32desc(addr)  cpu_to_le32(virt_to_bus(addr))
72
 #define le32desc_to_virt(addr)  bus_to_virt(le32_to_cpu(addr))
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
 /* NIC specific static variables go here */
75
 /* NIC specific static variables go here */
76
 
76
 
77
 
77
 
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
 /* Private Storage for the NIC */
305
 /* Private Storage for the NIC */
310
-struct forcedeth_private {
306
+static struct forcedeth_private {
311
 	/* General data:
307
 	/* General data:
312
 	 * Locking: spin_lock(&np->lock); */
308
 	 * Locking: spin_lock(&np->lock); */
313
 	int in_shutdown;
309
 	int in_shutdown;
322
 	/* rx specific fields.
318
 	/* rx specific fields.
323
 	 * Locking: Within irq hander or disable_irq+spin_lock(&np->lock);
319
 	 * Locking: Within irq hander or disable_irq+spin_lock(&np->lock);
324
 	 */
320
 	 */
325
-	struct ring_desc *rx_ring;
326
 	unsigned int cur_rx, refill_rx;
321
 	unsigned int cur_rx, refill_rx;
327
-	struct sk_buff *rx_skbuff[RX_RING];
328
-	u32 rx_dma[RX_RING];
329
 	unsigned int rx_buf_sz;
322
 	unsigned int rx_buf_sz;
330
 
323
 
331
 	/*
324
 	/*
332
 	 * tx specific fields.
325
 	 * tx specific fields.
333
 	 */
326
 	 */
334
-	struct ring_desc *tx_ring;
335
 	unsigned int next_tx, nic_tx;
327
 	unsigned int next_tx, nic_tx;
336
-	struct sk_buff *tx_skbuff[TX_RING];
337
-	u32 tx_dma[TX_RING];
338
 	u16 tx_flags;
328
 	u16 tx_flags;
339
 } npx;
329
 } npx;
340
 
330
 

+ 7
- 9
src/drivers/net/mtd80x.c View File

368
 #define LinkIsUp2 0x00040000
368
 #define LinkIsUp2 0x00040000
369
 
369
 
370
 /* Create a static buffer of size PKT_BUF_SZ for each
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
 part of this buffer */
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
 /* The Tulip Rx and Tx buffer descriptors. */
380
 /* The Tulip Rx and Tx buffer descriptors. */
383
 struct mtd_desc
381
 struct mtd_desc

+ 10
- 5
src/drivers/net/natsemi.c View File

205
    longword aligned 
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
 /* Function Prototypes */
219
 /* Function Prototypes */
215
 
220
 

+ 12
- 18
src/drivers/net/ns83820.c View File

393
 } nsx;
393
 } nsx;
394
 static struct ns83820_private *ns;
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
 static void phy_intr(struct nic *nic __unused)
409
 static void phy_intr(struct nic *nic __unused)
416
 {
410
 {

+ 36
- 45
src/drivers/net/pcnet32.c View File

182
 
182
 
183
 #define PCNET32_TOTAL_SIZE	0x20
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
 /* The PCNET32 Rx and Tx ring descriptors. */
185
 /* The PCNET32 Rx and Tx ring descriptors. */
200
 struct pcnet32_rx_head {
186
 struct pcnet32_rx_head {
201
 	u32 base;
187
 	u32 base;
235
 	void (*reset) (unsigned long);
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
 /* May need to be moved to mii.h */
234
 /* May need to be moved to mii.h */
248
 struct mii_if_info {
235
 struct mii_if_info {
411
 	lp->cur_rx = lp->cur_tx = 0;
398
 	lp->cur_rx = lp->cur_tx = 0;
412
 
399
 
413
 	for (i = 0; i < RX_RING_SIZE; i++) {
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
 	/* The Tx buffer address is filled in as needed, but we do need to clear
407
 	/* The Tx buffer address is filled in as needed, but we do need to clear
420
 	   the upper ownership bit. */
408
 	   the upper ownership bit. */
421
 	for (i = 0; i < TX_RING_SIZE; i++) {
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
 	    le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS);
416
 	    le16_to_cpu(TX_RING_LEN_BITS | RX_RING_LEN_BITS);
429
 	for (i = 0; i < 6; i++)
417
 	for (i = 0; i < 6; i++)
430
 		lp->init_block.phys_addr[i] = nic->node_addr[i];
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
 	return 0;
421
 	return 0;
434
 }
422
 }
435
 
423
 
547
 	/* nic->packet should contain data on return */
535
 	/* nic->packet should contain data on return */
548
 	/* nic->packetlen should contain length of data */
536
 	/* nic->packetlen should contain length of data */
549
 
537
 
550
-	int status;
538
+	signed char status;
551
 	int entry;
539
 	int entry;
552
 
540
 
553
 	entry = lp->cur_rx & RX_RING_MOD_MASK;
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
 	if (status < 0)
544
 	if (status < 0)
557
 		return 0;
545
 		return 0;
560
 
548
 
561
 	if (status == 0x03) {
549
 	if (status == 0x03) {
562
 		nic->packetlen =
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
 		/* Andrew Boyd of QNX reports that some revs of the 79C765
555
 		/* Andrew Boyd of QNX reports that some revs of the 79C765
567
 		 * clear the buffer length */
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
 		/* Switch to the next Rx ring buffer */
561
 		/* Switch to the next Rx ring buffer */
571
 		lp->cur_rx++;
562
 		lp->cur_rx++;
572
 
563
 
594
 
585
 
595
 	status = 0x8300;
586
 	status = 0x8300;
596
 	/* point to the current txb incase multiple tx_rings are used */
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
 	/* copy the packet to ring buffer */
590
 	/* copy the packet to ring buffer */
600
 	memcpy(ptxb, d, ETH_ALEN);	/* dst */
591
 	memcpy(ptxb, d, ETH_ALEN);	/* dst */
607
 	while (s < ETH_ZLEN)	/* pad to min length */
598
 	while (s < ETH_ZLEN)	/* pad to min length */
608
 		ptxb[s++] = '\0';
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
 	/* we set the top byte as the very last thing */
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
 	/* Trigger an immediate send poll */
609
 	/* Trigger an immediate send poll */
622
 	lp->cur_tx = 0;		/* (lp->cur_tx + 1); */
613
 	lp->cur_tx = 0;		/* (lp->cur_tx + 1); */
623
 	time = currticks() + TICKS_PER_SEC;	/* wait one second */
614
 	time = currticks() + TICKS_PER_SEC;	/* wait one second */
624
 	while (currticks() < time &&
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
 		printf("PCNET32 timed out on transmit\n");
619
 		printf("PCNET32 timed out on transmit\n");
629
 
620
 
630
 	/* Stop pointing at the current txb
621
 	/* Stop pointing at the current txb
631
 	 * otherwise the card continues to send the packet */
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
 		lp->init_block.phys_addr[i] = nic->node_addr[i];
873
 		lp->init_block.phys_addr[i] = nic->node_addr[i];
883
 	lp->init_block.filter[0] = 0xffffffff;
874
 	lp->init_block.filter[0] = 0xffffffff;
884
 	lp->init_block.filter[1] = 0xffffffff;
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
 	/* switch pcnet32 to 32bit mode */
879
 	/* switch pcnet32 to 32bit mode */
889
 	a->write_bcr(ioaddr, 20, 2);
880
 	a->write_bcr(ioaddr, 20, 2);

+ 6
- 2
src/drivers/net/rtl8139.c View File

169
 static unsigned int cur_rx,cur_tx;
169
 static unsigned int cur_rx,cur_tx;
170
 
170
 
171
 /* The RTL8139 can only transmit from a contiguous, aligned memory block.  */
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
 static int rtl8139_probe(struct nic *nic,struct pci_device *pci);
179
 static int rtl8139_probe(struct nic *nic,struct pci_device *pci);
176
 static int read_eeprom(struct nic *nic, int location, int addr_len);
180
 static int read_eeprom(struct nic *nic, int location, int addr_len);

+ 10
- 4
src/drivers/net/sis900.c View File

64
 
64
 
65
 static unsigned int cur_rx;
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
 #if 0
78
 #if 0
73
 static struct mac_chip_info {
79
 static struct mac_chip_info {

+ 15
- 10
src/drivers/net/tlan.c View File

100
 static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16);
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
 	"10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
104
 	"10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
105
 	"100baseTx-FD", "100baseT4", 0
105
 	"100baseTx-FD", "100baseT4", 0
106
 };
106
 };
187
 	} buffer[TLAN_BUFFERS_PER_LIST];
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
 typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE];
201
 typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE];
197
 
202
 
198
-int chip_idx;
203
+static int chip_idx;
199
 
204
 
200
 /*****************************************************************
205
 /*****************************************************************
201
 * TLAN Private Information Structure
206
 * TLAN Private Information Structure
202
 *
207
 *
203
 ****************************************************************/
208
 ****************************************************************/
204
-struct tlan_private {
209
+static struct tlan_private {
205
 	unsigned short vendor_id;	/* PCI Vendor code */
210
 	unsigned short vendor_id;	/* PCI Vendor code */
206
 	unsigned short dev_id;	/* PCI Device code */
211
 	unsigned short dev_id;	/* PCI Device code */
207
 	const char *nic_name;
212
 	const char *nic_name;
226
 
231
 
227
 static struct tlan_private *priv;
232
 static struct tlan_private *priv;
228
 
233
 
229
-u32 BASE;
234
+static u32 BASE;
230
 
235
 
231
 /***************************************************************
236
 /***************************************************************
232
 *	TLan_ResetLists
237
 *	TLan_ResetLists
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
 	int i;
253
 	int i;

+ 12
- 12
src/drivers/net/tlan.h View File

393
 
393
 
394
 /* Routines to access internal registers. */
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
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
398
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
399
 	return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3)));
399
 	return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3)));
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
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
408
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
409
 	return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2)));
409
 	return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2)));
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
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
418
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
419
 	return (inl(base_addr + TLAN_DIO_DATA));
419
 	return (inl(base_addr + TLAN_DIO_DATA));
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
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
428
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
429
 	outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3));
429
 	outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3));
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
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
438
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
439
 	outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
439
 	outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
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
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
448
 	outw(internal_addr, base_addr + TLAN_DIO_ADR);
449
 	outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
449
 	outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
453
 
453
 
454
 
454
 
455
 #if 0
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
 	outb_p(inb_p(port) & ~bit, port);
458
 	outb_p(inb_p(port) & ~bit, port);
459
 }
459
 }
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
 	return ((int) (inb_p(port) & bit));
466
 	return ((int) (inb_p(port) & bit));
467
 }
467
 }
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
 	outb_p(inb_p(port) | bit, port);
474
 	outb_p(inb_p(port) | bit, port);
475
 }
475
 }
482
 #ifdef I_LIKE_A_FAST_HASH_FUNCTION
482
 #ifdef I_LIKE_A_FAST_HASH_FUNCTION
483
 /* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */
483
 /* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */
484
 /* the code below is about seven times as fast as the original code */
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
 	u8 hash;
487
 	u8 hash;
488
 
488
 
498
 
498
 
499
 #else				/* original code */
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
 	return ((a && !b) || (!a && b));
503
 	return ((a && !b) || (!a && b));
504
 }
504
 }
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 ) ) ) ) ) ) )
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
 #define DA( a, bit )					( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) )
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
 	u32 hash;
511
 	u32 hash;
512
 
512
 

+ 10
- 5
src/drivers/net/tulip.c View File

400
    longword divisable */
400
    longword divisable */
401
 
401
 
402
 #define TX_RING_SIZE	2
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
 #define RX_RING_SIZE	4
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
 static struct tulip_private {
415
 static struct tulip_private {
411
     int cur_rx;
416
     int cur_rx;

Loading…
Cancel
Save