This source file includes following definitions.
- el3_probe
- read_eeprom
- id_read_eeprom
- el3_open
- el3_start_xmit
- el3_interrupt
- el3_get_stats
- update_stats
- el3_rx
- set_multicast_list
- el3_close
- init_module
- cleanup_module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 static char *version = "3c509.c:1.07 6/15/95 becker@cesdis.gsfc.nasa.gov\n";
33
34 #include <linux/module.h>
35
36 #include <linux/config.h>
37 #include <linux/kernel.h>
38 #include <linux/sched.h>
39 #include <linux/string.h>
40 #include <linux/interrupt.h>
41 #include <linux/ptrace.h>
42 #include <linux/errno.h>
43 #include <linux/in.h>
44 #include <linux/malloc.h>
45 #include <linux/ioport.h>
46 #include <linux/netdevice.h>
47 #include <linux/etherdevice.h>
48 #include <linux/skbuff.h>
49 #include <linux/config.h>
50
51 #include <asm/bitops.h>
52 #include <asm/io.h>
53
54
55 #ifdef EL3_DEBUG
56 int el3_debug = EL3_DEBUG;
57 #else
58 int el3_debug = 2;
59 #endif
60
61
62
63
64
65 #define EL3_DATA 0x00
66 #define EL3_CMD 0x0e
67 #define EL3_STATUS 0x0e
68 #define EEPROM_READ 0x80
69
70 #define EL3_IO_EXTENT 16
71
72 #define EL3WINDOW(win_num) outw(SelectWindow + (win_num), ioaddr + EL3_CMD)
73
74
75
76
77 enum c509cmd {
78 TotalReset = 0<<11, SelectWindow = 1<<11, StartCoax = 2<<11,
79 RxDisable = 3<<11, RxEnable = 4<<11, RxReset = 5<<11, RxDiscard = 8<<11,
80 TxEnable = 9<<11, TxDisable = 10<<11, TxReset = 11<<11,
81 FakeIntr = 12<<11, AckIntr = 13<<11, SetIntrEnb = 14<<11,
82 SetStatusEnb = 15<<11, SetRxFilter = 16<<11, SetRxThreshold = 17<<11,
83 SetTxThreshold = 18<<11, SetTxStart = 19<<11, StatsEnable = 21<<11,
84 StatsDisable = 22<<11, StopCoax = 23<<11,};
85
86 enum c509status {
87 IntLatch = 0x0001, AdapterFailure = 0x0002, TxComplete = 0x0004,
88 TxAvailable = 0x0008, RxComplete = 0x0010, RxEarly = 0x0020,
89 IntReq = 0x0040, StatsFull = 0x0080, CmdBusy = 0x1000, };
90
91
92 enum RxFilter {
93 RxStation = 1, RxMulticast = 2, RxBroadcast = 4, RxProm = 8 };
94
95
96 #define TX_FIFO 0x00
97 #define RX_FIFO 0x00
98 #define RX_STATUS 0x08
99 #define TX_STATUS 0x0B
100 #define TX_FREE 0x0C
101
102 #define WN0_IRQ 0x08
103 #define WN4_MEDIA 0x0A
104 #define MEDIA_TP 0x00C0
105
106
107
108
109
110 #define SKB_QUEUE_SIZE 64
111
112 struct el3_private {
113 struct enet_statistics stats;
114
115 int head, size;
116 struct sk_buff *queue[SKB_QUEUE_SIZE];
117 };
118 static int id_port = 0x100;
119
120 static ushort id_read_eeprom(int index);
121 static ushort read_eeprom(short ioaddr, int index);
122 static int el3_open(struct device *dev);
123 static int el3_start_xmit(struct sk_buff *skb, struct device *dev);
124 static void el3_interrupt(int irq, void *dev_id, struct pt_regs *regs);
125 static void update_stats(int addr, struct device *dev);
126 static struct enet_statistics *el3_get_stats(struct device *dev);
127 static int el3_rx(struct device *dev);
128 static int el3_close(struct device *dev);
129 #ifdef HAVE_MULTICAST
130 static void set_multicast_list(struct device *dev);
131 #endif
132
133
134
135 int el3_probe(struct device *dev)
136 {
137 short lrs_state = 0xff, i;
138 ushort ioaddr, irq, if_port;
139 short *phys_addr = (short *)dev->dev_addr;
140 static int current_tag = 0;
141
142
143
144 if (EISA_bus) {
145 static int eisa_addr = 0x1000;
146 while (eisa_addr < 0x9000) {
147 ioaddr = eisa_addr;
148 eisa_addr += 0x1000;
149
150
151 if (inw(ioaddr + 0xC80) != 0x6d50)
152 continue;
153
154
155 outw(SelectWindow | 0, ioaddr + 0xC80 + EL3_CMD);
156
157 irq = inw(ioaddr + WN0_IRQ) >> 12;
158 if_port = inw(ioaddr + 6)>>14;
159 for (i = 0; i < 3; i++)
160 phys_addr[i] = htons(read_eeprom(ioaddr, i));
161
162
163 read_eeprom(ioaddr, 3);
164
165
166 goto found;
167 }
168 }
169
170 #ifdef CONFIG_MCA
171 if (MCA_bus) {
172 mca_adaptor_select_mode(1);
173 for (i = 0; i < 8; i++)
174 if ((mca_adaptor_id(i) | 1) == 0x627c) {
175 ioaddr = mca_pos_base_addr(i);
176 irq = inw(ioaddr + WN0_IRQ) >> 12;
177 if_port = inw(ioaddr + 6)>>14;
178 for (i = 0; i < 3; i++)
179 phys_addr[i] = htons(read_eeprom(ioaddr, i));
180
181 mca_adaptor_select_mode(0);
182 goto found;
183 }
184 mca_adaptor_select_mode(0);
185
186 }
187 #endif
188
189
190 outb(0x02, 0x279);
191 outb(0x02, 0xA79);
192
193 for (id_port = 0x100; id_port < 0x200; id_port += 0x10) {
194 outb(0x00, id_port);
195 outb(0xff, id_port);
196 if (inb(id_port) & 0x01)
197 break;
198 }
199 if (id_port >= 0x200) {
200
201 printk(" WARNING: No I/O port available for 3c509 activation.\n");
202 return -ENODEV;
203 }
204
205
206
207
208
209 if (check_region(id_port,1)) {
210 static int once = 1;
211 if (once) printk("3c509: Somebody has reserved 0x%x, can't do ID_PORT lookup, nor card auto-probing\n",id_port);
212 once = 0;
213 return -ENODEV;
214 }
215
216 outb(0x00, id_port);
217 outb(0x00, id_port);
218 for(i = 0; i < 255; i++) {
219 outb(lrs_state, id_port);
220 lrs_state <<= 1;
221 lrs_state = lrs_state & 0x100 ? lrs_state ^ 0xcf : lrs_state;
222 }
223
224
225 if (current_tag == 0)
226 outb(0xd0, id_port);
227 else
228 outb(0xd8, id_port);
229
230 if (id_read_eeprom(7) != 0x6d50) {
231 return -ENODEV;
232 }
233
234
235
236
237 for (i = 0; i < 3; i++) {
238 phys_addr[i] = htons(id_read_eeprom(i));
239 }
240
241 {
242 unsigned short iobase = id_read_eeprom(8);
243 if_port = iobase >> 14;
244 ioaddr = 0x200 + ((iobase & 0x1f) << 4);
245 }
246 if (dev->irq > 1 && dev->irq < 16)
247 irq = dev->irq;
248 else
249 irq = id_read_eeprom(9) >> 12;
250
251 if (dev->base_addr != 0
252 && dev->base_addr != (unsigned short)ioaddr) {
253 return -ENODEV;
254 }
255
256
257 outb(0xd0 + ++current_tag, id_port);
258
259
260 outb((ioaddr >> 4) | 0xe0, id_port);
261
262 EL3WINDOW(0);
263 if (inw(ioaddr) != 0x6d50)
264 return -ENODEV;
265
266
267 outw(0x0f00, ioaddr + WN0_IRQ);
268 found:
269 dev->base_addr = ioaddr;
270 dev->irq = irq;
271 dev->if_port = if_port;
272 request_region(dev->base_addr, EL3_IO_EXTENT, "3c509");
273
274 {
275 const char *if_names[] = {"10baseT", "AUI", "undefined", "BNC"};
276 printk("%s: 3c509 at %#3.3lx tag %d, %s port, address ",
277 dev->name, dev->base_addr, current_tag, if_names[dev->if_port]);
278 }
279
280
281 for (i = 0; i < 6; i++)
282 printk(" %2.2x", dev->dev_addr[i]);
283 printk(", IRQ %d.\n", dev->irq);
284
285
286 dev->priv = kmalloc(sizeof(struct el3_private), GFP_KERNEL);
287 if (dev->priv == NULL)
288 return -ENOMEM;
289 memset(dev->priv, 0, sizeof(struct el3_private));
290
291 if (el3_debug > 0)
292 printk(version);
293
294
295 dev->open = &el3_open;
296 dev->hard_start_xmit = &el3_start_xmit;
297 dev->stop = &el3_close;
298 dev->get_stats = &el3_get_stats;
299 #ifdef HAVE_MULTICAST
300 dev->set_multicast_list = &set_multicast_list;
301 #endif
302
303
304 ether_setup(dev);
305 return 0;
306 }
307
308
309
310
311 static ushort read_eeprom(short ioaddr, int index)
312 {
313 int timer;
314
315 outw(EEPROM_READ + index, ioaddr + 10);
316
317 for (timer = 0; timer < 162*4 + 400; timer++)
318 SLOW_DOWN_IO;
319 return inw(ioaddr + 12);
320 }
321
322
323 static ushort id_read_eeprom(int index)
324 {
325 int timer, bit, word = 0;
326
327
328
329 outb(EEPROM_READ + index, id_port);
330
331
332 for (timer = 0; timer < 162*4 + 400; timer++)
333 SLOW_DOWN_IO;
334
335 for (bit = 15; bit >= 0; bit--)
336 word = (word << 1) + (inb(id_port) & 0x01);
337
338 if (el3_debug > 3)
339 printk(" 3c509 EEPROM word %d %#4.4x.\n", index, word);
340
341 return word;
342 }
343
344
345
346 static int
347 el3_open(struct device *dev)
348 {
349 int ioaddr = dev->base_addr;
350 int i;
351
352 outw(TxReset, ioaddr + EL3_CMD);
353 outw(RxReset, ioaddr + EL3_CMD);
354 outw(SetStatusEnb | 0x00, ioaddr + EL3_CMD);
355
356 if (request_irq(dev->irq, &el3_interrupt, 0, "3c509", dev)) {
357 irq2dev_map[dev->irq] = NULL;
358 return -EAGAIN;
359 }
360
361 EL3WINDOW(0);
362 if (el3_debug > 3)
363 printk("%s: Opening, IRQ %d status@%x %4.4x.\n", dev->name,
364 dev->irq, ioaddr + EL3_STATUS, inw(ioaddr + EL3_STATUS));
365
366
367 outw(0x0001, ioaddr + 4);
368
369
370 outw((dev->irq << 12) | 0x0f00, ioaddr + WN0_IRQ);
371
372
373 EL3WINDOW(2);
374
375 for (i = 0; i < 6; i++)
376 outb(dev->dev_addr[i], ioaddr + i);
377
378 if (dev->if_port == 3)
379
380 outw(StartCoax, ioaddr + EL3_CMD);
381 else if (dev->if_port == 0) {
382
383 EL3WINDOW(4);
384 outw(inw(ioaddr + WN4_MEDIA) | MEDIA_TP, ioaddr + WN4_MEDIA);
385 }
386
387
388 outw(StatsDisable, ioaddr + EL3_CMD);
389 EL3WINDOW(6);
390 for (i = 0; i < 9; i++)
391 inb(ioaddr + i);
392 inw(ioaddr + 10);
393 inw(ioaddr + 12);
394
395
396 EL3WINDOW(1);
397
398
399 outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD);
400 outw(StatsEnable, ioaddr + EL3_CMD);
401
402 dev->interrupt = 0;
403 dev->tbusy = 0;
404 dev->start = 1;
405
406 outw(RxEnable, ioaddr + EL3_CMD);
407 outw(TxEnable, ioaddr + EL3_CMD);
408
409 outw(SetStatusEnb | 0xff, ioaddr + EL3_CMD);
410
411 outw(AckIntr | IntLatch | TxAvailable | RxEarly | IntReq,
412 ioaddr + EL3_CMD);
413 outw(SetIntrEnb | IntLatch | TxAvailable | RxComplete | StatsFull,
414 ioaddr + EL3_CMD);
415
416 if (el3_debug > 3)
417 printk("%s: Opened 3c509 IRQ %d status %4.4x.\n",
418 dev->name, dev->irq, inw(ioaddr + EL3_STATUS));
419
420 MOD_INC_USE_COUNT;
421 return 0;
422 }
423
424 static int
425 el3_start_xmit(struct sk_buff *skb, struct device *dev)
426 {
427 struct el3_private *lp = (struct el3_private *)dev->priv;
428 int ioaddr = dev->base_addr;
429
430
431 if (dev->tbusy) {
432 int tickssofar = jiffies - dev->trans_start;
433 if (tickssofar < 40)
434 return 1;
435 printk("%s: transmit timed out, Tx_status %2.2x status %4.4x "
436 "Tx FIFO room %d.\n",
437 dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS),
438 inw(ioaddr + TX_FREE));
439 lp->stats.tx_errors++;
440 dev->trans_start = jiffies;
441
442 outw(TxReset, ioaddr + EL3_CMD);
443 outw(TxEnable, ioaddr + EL3_CMD);
444 dev->tbusy = 0;
445 }
446
447 if (skb == NULL) {
448 dev_tint(dev);
449 return 0;
450 }
451
452 if (skb->len <= 0)
453 return 0;
454
455 if (el3_debug > 4) {
456 printk("%s: el3_start_xmit(length = %ld) called, status %4.4x.\n",
457 dev->name, skb->len, inw(ioaddr + EL3_STATUS));
458 }
459 #if 0
460 #ifndef final_version
461 {
462 ushort status = inw(ioaddr + EL3_STATUS);
463 if (status & 0x0001
464 && inw(ioaddr + EL3_STATUS) & 1) {
465 printk("%s: Missed interrupt, status then %04x now %04x"
466 " Tx %2.2x Rx %4.4x.\n", dev->name, status,
467 inw(ioaddr + EL3_STATUS), inb(ioaddr + TX_STATUS),
468 inw(ioaddr + RX_STATUS));
469
470 outw(SetStatusEnb | 0x00, ioaddr + EL3_CMD);
471 outw(AckIntr | IntLatch | TxAvailable | RxEarly | IntReq,
472 ioaddr + EL3_CMD);
473 outw(SetStatusEnb | 0xff, ioaddr + EL3_CMD);
474 }
475 }
476 #endif
477 #endif
478
479 if (set_bit(0, (void*)&dev->tbusy) != 0)
480 printk("%s: Transmitter access conflict.\n", dev->name);
481 else {
482
483 outw(skb->len, ioaddr + TX_FIFO);
484 outw(0x00, ioaddr + TX_FIFO);
485
486 outsl(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >> 2);
487
488 dev->trans_start = jiffies;
489 if (inw(ioaddr + TX_FREE) > 1536) {
490 dev->tbusy = 0;
491 } else
492
493 outw(SetTxThreshold + 1536, ioaddr + EL3_CMD);
494 }
495
496 dev_kfree_skb (skb, FREE_WRITE);
497
498
499 {
500 short tx_status;
501 int i = 4;
502
503 while (--i > 0 && (tx_status = inb(ioaddr + TX_STATUS)) > 0) {
504 if (tx_status & 0x38) lp->stats.tx_aborted_errors++;
505 if (tx_status & 0x30) outw(TxReset, ioaddr + EL3_CMD);
506 if (tx_status & 0x3C) outw(TxEnable, ioaddr + EL3_CMD);
507 outb(0x00, ioaddr + TX_STATUS);
508 }
509 }
510 return 0;
511 }
512
513
514 static void
515 el3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
516 {
517 struct device *dev = (struct device *)dev_id;
518 int ioaddr, status;
519 int i = 0;
520
521 if (dev == NULL) {
522 printk ("el3_interrupt(): irq %d for unknown device.\n", irq);
523 return;
524 }
525
526 if (dev->interrupt)
527 printk("%s: Re-entering the interrupt handler.\n", dev->name);
528 dev->interrupt = 1;
529
530 ioaddr = dev->base_addr;
531 status = inw(ioaddr + EL3_STATUS);
532
533 if (el3_debug > 4)
534 printk("%s: interrupt, status %4.4x.\n", dev->name, status);
535
536 while ((status = inw(ioaddr + EL3_STATUS)) &
537 (IntLatch | RxComplete | StatsFull)) {
538
539 if (status & RxComplete)
540 el3_rx(dev);
541
542 if (status & TxAvailable) {
543 if (el3_debug > 5)
544 printk(" TX room bit was handled.\n");
545
546 outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
547 dev->tbusy = 0;
548 mark_bh(NET_BH);
549 }
550 if (status & (AdapterFailure | RxEarly | StatsFull)) {
551
552 if (status & StatsFull)
553 update_stats(ioaddr, dev);
554 if (status & RxEarly) {
555 el3_rx(dev);
556 outw(AckIntr | RxEarly, ioaddr + EL3_CMD);
557 }
558 if (status & AdapterFailure) {
559
560 outw(RxReset, ioaddr + EL3_CMD);
561
562 outw(SetRxFilter | RxStation | RxBroadcast
563 | (dev->flags & IFF_ALLMULTI ? RxMulticast : 0)
564 | (dev->flags & IFF_PROMISC ? RxProm : 0),
565 ioaddr + EL3_CMD);
566 outw(RxEnable, ioaddr + EL3_CMD);
567 outw(AckIntr | AdapterFailure, ioaddr + EL3_CMD);
568 }
569 }
570
571 if (++i > 10) {
572 printk("%s: Infinite loop in interrupt, status %4.4x.\n",
573 dev->name, status);
574
575 outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
576 break;
577 }
578
579 outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD);
580 }
581
582 if (el3_debug > 4) {
583 printk("%s: exiting interrupt, status %4.4x.\n", dev->name,
584 inw(ioaddr + EL3_STATUS));
585 }
586
587 dev->interrupt = 0;
588 return;
589 }
590
591
592 static struct enet_statistics *
593 el3_get_stats(struct device *dev)
594 {
595 struct el3_private *lp = (struct el3_private *)dev->priv;
596 unsigned long flags;
597
598 save_flags(flags);
599 cli();
600 update_stats(dev->base_addr, dev);
601 restore_flags(flags);
602 return &lp->stats;
603 }
604
605
606
607
608
609
610 static void update_stats(int ioaddr, struct device *dev)
611 {
612 struct el3_private *lp = (struct el3_private *)dev->priv;
613
614 if (el3_debug > 5)
615 printk(" Updating the statistics.\n");
616
617 outw(StatsDisable, ioaddr + EL3_CMD);
618
619 EL3WINDOW(6);
620 lp->stats.tx_carrier_errors += inb(ioaddr + 0);
621 lp->stats.tx_heartbeat_errors += inb(ioaddr + 1);
622 inb(ioaddr + 2);
623 lp->stats.collisions += inb(ioaddr + 3);
624 lp->stats.tx_window_errors += inb(ioaddr + 4);
625 lp->stats.rx_fifo_errors += inb(ioaddr + 5);
626 lp->stats.tx_packets += inb(ioaddr + 6);
627 inb(ioaddr + 7);
628 inb(ioaddr + 8);
629 inw(ioaddr + 10);
630 inw(ioaddr + 12);
631
632
633 EL3WINDOW(1);
634 outw(StatsEnable, ioaddr + EL3_CMD);
635 return;
636 }
637
638 static int
639 el3_rx(struct device *dev)
640 {
641 struct el3_private *lp = (struct el3_private *)dev->priv;
642 int ioaddr = dev->base_addr;
643 short rx_status;
644
645 if (el3_debug > 5)
646 printk(" In rx_packet(), status %4.4x, rx_status %4.4x.\n",
647 inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
648 while ((rx_status = inw(ioaddr + RX_STATUS)) > 0) {
649 if (rx_status & 0x4000) {
650 short error = rx_status & 0x3800;
651 lp->stats.rx_errors++;
652 switch (error) {
653 case 0x0000: lp->stats.rx_over_errors++; break;
654 case 0x0800: lp->stats.rx_length_errors++; break;
655 case 0x1000: lp->stats.rx_frame_errors++; break;
656 case 0x1800: lp->stats.rx_length_errors++; break;
657 case 0x2000: lp->stats.rx_frame_errors++; break;
658 case 0x2800: lp->stats.rx_crc_errors++; break;
659 }
660 } else {
661 short pkt_len = rx_status & 0x7ff;
662 struct sk_buff *skb;
663
664 skb = dev_alloc_skb(pkt_len+5);
665 if (el3_debug > 4)
666 printk("Receiving packet size %d status %4.4x.\n",
667 pkt_len, rx_status);
668 if (skb != NULL) {
669 skb->dev = dev;
670 skb_reserve(skb,2);
671
672
673 insl(ioaddr+RX_FIFO, skb_put(skb,pkt_len),
674 (pkt_len + 3) >> 2);
675
676 skb->protocol=eth_type_trans(skb,dev);
677 netif_rx(skb);
678 outw(RxDiscard, ioaddr + EL3_CMD);
679 lp->stats.rx_packets++;
680 continue;
681 } else if (el3_debug)
682 printk("%s: Couldn't allocate a sk_buff of size %d.\n",
683 dev->name, pkt_len);
684 }
685 lp->stats.rx_dropped++;
686 outw(RxDiscard, ioaddr + EL3_CMD);
687 while (inw(ioaddr + EL3_STATUS) & 0x1000)
688 printk(" Waiting for 3c509 to discard packet, status %x.\n",
689 inw(ioaddr + EL3_STATUS) );
690 }
691
692 return 0;
693 }
694
695 #ifdef HAVE_MULTICAST
696
697
698
699 static void
700 set_multicast_list(struct device *dev)
701 {
702 short ioaddr = dev->base_addr;
703 if (el3_debug > 1) {
704 static int old = 0;
705 if (old != dev->mc_count) {
706 old = dev->mc_count;
707 printk("%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count);
708 }
709 }
710 if (dev->flags&IFF_PROMISC) {
711 outw(SetRxFilter | RxStation | RxMulticast | RxBroadcast | RxProm,
712 ioaddr + EL3_CMD);
713 }
714 else if (dev->mc_count || (dev->flags&IFF_ALLMULTI)) {
715 outw(SetRxFilter | RxStation | RxMulticast | RxBroadcast, ioaddr + EL3_CMD);
716 }
717 else
718 outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD);
719 }
720 #endif
721
722 static int
723 el3_close(struct device *dev)
724 {
725 int ioaddr = dev->base_addr;
726
727 if (el3_debug > 2)
728 printk("%s: Shutting down ethercard.\n", dev->name);
729
730 dev->tbusy = 1;
731 dev->start = 0;
732
733
734 outw(StatsDisable, ioaddr + EL3_CMD);
735
736
737 outw(RxDisable, ioaddr + EL3_CMD);
738 outw(TxDisable, ioaddr + EL3_CMD);
739
740 if (dev->if_port == 3)
741
742 outw(StopCoax, ioaddr + EL3_CMD);
743 else if (dev->if_port == 0) {
744
745 EL3WINDOW(4);
746 outw(inw(ioaddr + WN4_MEDIA) & ~MEDIA_TP, ioaddr + WN4_MEDIA);
747 }
748
749 free_irq(dev->irq, dev);
750
751 EL3WINDOW(0);
752
753 outw(0x0f00, ioaddr + WN0_IRQ);
754
755 update_stats(ioaddr, dev);
756 MOD_DEC_USE_COUNT;
757 return 0;
758 }
759
760 #ifdef MODULE
761 static char devicename[9] = { 0, };
762 static struct device dev_3c509 = {
763 devicename,
764 0, 0, 0, 0,
765 0, 0,
766 0, 0, 0, NULL, el3_probe };
767
768 static int io = 0;
769 static int irq = 0;
770
771 int
772 init_module(void)
773 {
774 dev_3c509.base_addr = io;
775 dev_3c509.irq = irq;
776 if (!EISA_bus && !io) {
777 printk("3c509: WARNING! Module load-time probing works reliably only for EISA bus!!\n");
778 }
779 if (register_netdev(&dev_3c509) != 0)
780 return -EIO;
781 return 0;
782 }
783
784 void
785 cleanup_module(void)
786 {
787 if (MOD_IN_USE)
788 printk("3c509: device busy, remove delayed\n");
789 else
790 {
791 unregister_netdev(&dev_3c509);
792 kfree_s(dev_3c509.priv,sizeof(struct el3_private));
793 dev_3c509.priv=NULL;
794
795 release_region(dev_3c509.base_addr, EL3_IO_EXTENT);
796 }
797 }
798 #endif
799
800
801
802
803
804
805
806
807