This source file includes following definitions.
- el16_probe
- el16_probe1
- el16_open
- el16_send_packet
- el16_interrupt
- el16_close
- el16_get_stats
- init_rx_bufs
- init_82586_mem
- hardware_send_packet
- el16_rx
- 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 static const char *version =
27 "3c507.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
28
29
30 #ifdef MODULE
31 #include <linux/module.h>
32 #include <linux/version.h>
33 #endif
34
35 #include <linux/config.h>
36
37
38
39
40
41
42
43
44
45
46
47
48 #include <linux/kernel.h>
49 #include <linux/sched.h>
50 #include <linux/types.h>
51 #include <linux/fcntl.h>
52 #include <linux/interrupt.h>
53 #include <linux/ptrace.h>
54 #include <linux/ioport.h>
55 #include <linux/in.h>
56 #include <linux/string.h>
57 #include <asm/system.h>
58 #include <asm/bitops.h>
59 #include <asm/io.h>
60 #include <asm/dma.h>
61 #include <linux/errno.h>
62
63 #include <linux/netdevice.h>
64 #include <linux/etherdevice.h>
65 #include <linux/skbuff.h>
66 #include <linux/malloc.h>
67
68
69
70 #ifndef NET_DEBUG
71 #define NET_DEBUG 1
72 #endif
73 static unsigned int net_debug = NET_DEBUG;
74
75
76 static unsigned int netcard_portlist[] =
77 { 0x300, 0x320, 0x340, 0x280, 0};
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94 #define CUC_START 0x0100
95 #define CUC_RESUME 0x0200
96 #define CUC_SUSPEND 0x0300
97 #define RX_START 0x0010
98 #define RX_RESUME 0x0020
99 #define RX_SUSPEND 0x0030
100
101
102
103
104
105
106
107
108
109
110
111
112
113 #define CMD_EOL 0x8000
114 #define CMD_SUSP 0x4000
115 #define CMD_INTR 0x2000
116
117 enum commands {
118 CmdNOp = 0, CmdSASetup = 1, CmdConfigure = 2, CmdMulticastList = 3,
119 CmdTx = 4, CmdTDR = 5, CmdDump = 6, CmdDiagnose = 7};
120
121
122 struct net_local {
123 struct enet_statistics stats;
124 int last_restart;
125 ushort rx_head;
126 ushort rx_tail;
127 ushort tx_head;
128 ushort tx_cmd_link;
129 ushort tx_reap;
130 };
131
132
133
134
135
136
137
138
139
140 #define SA_DATA 0
141 #define MISC_CTRL 6
142 #define RESET_IRQ 10
143 #define SIGNAL_CA 11
144 #define ROM_CONFIG 13
145 #define MEM_CONFIG 14
146 #define IRQ_CONFIG 15
147 #define EL16_IO_EXTENT 16
148
149
150 #define ID_PORT 0x100
151
152
153 #define iSCB_STATUS 0x8
154 #define iSCB_CMD 0xA
155 #define iSCB_CBL 0xC
156 #define iSCB_RFA 0xE
157
158
159
160
161
162
163
164
165
166
167 #define SCB_BASE ((unsigned)64*1024 - (dev->mem_end - dev->mem_start))
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185 #define CONFIG_CMD 0x0018
186 #define SET_SA_CMD 0x0024
187 #define SA_OFFSET 0x002A
188 #define IDLELOOP 0x30
189 #define TDR_CMD 0x38
190 #define TDR_TIME 0x3C
191 #define DUMP_CMD 0x40
192 #define DIAG_CMD 0x48
193 #define SET_MC_CMD 0x4E
194 #define DUMP_DATA 0x56
195
196 #define TX_BUF_START 0x0100
197 #define NUM_TX_BUFS 4
198 #define TX_BUF_SIZE (1518+14+20+16)
199
200 #define RX_BUF_START 0x2000
201 #define RX_BUF_SIZE (1518+14+18)
202 #define RX_BUF_END (dev->mem_end - dev->mem_start)
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237 unsigned short init_words[] = {
238
239 0x0000,
240 0,0,
241 0x0000,0x0000,
242
243
244 0x0001,
245 0x0008,0,0,
246
247
248 0,0xf000|RX_START|CUC_START,
249 CONFIG_CMD,
250 RX_BUF_START,
251 0,0,0,0,
252
253
254 0, CmdConfigure,
255 SET_SA_CMD,
256 0x0804,
257 0x2e40,
258 0,
259
260
261 0, CmdSASetup,
262 SET_MC_CMD,
263 0xaa00,0xb000,0x0bad,
264
265
266 0, CmdNOp, IDLELOOP, 0 ,
267
268
269 0, CmdTDR, IDLELOOP, 0,
270
271
272 0, CmdDump, IDLELOOP, DUMP_DATA,
273
274
275 0, CmdDiagnose, IDLELOOP,
276
277
278 0, CmdMulticastList, IDLELOOP, 0,
279 };
280
281
282
283 extern int el16_probe(struct device *dev);
284
285 static int el16_probe1(struct device *dev, int ioaddr);
286 static int el16_open(struct device *dev);
287 static int el16_send_packet(struct sk_buff *skb, struct device *dev);
288 static void el16_interrupt(int irq, struct pt_regs *regs);
289 static void el16_rx(struct device *dev);
290 static int el16_close(struct device *dev);
291 static struct enet_statistics *el16_get_stats(struct device *dev);
292
293 static void hardware_send_packet(struct device *dev, void *buf, short length);
294 void init_82586_mem(struct device *dev);
295
296
297 #ifdef HAVE_DEVLIST
298 struct netdev_entry netcard_drv =
299 {"3c507", el16_probe1, EL16_IO_EXTENT, netcard_portlist};
300 #endif
301
302
303
304
305
306
307
308 int
309 el16_probe(struct device *dev)
310 {
311 int base_addr = dev ? dev->base_addr : 0;
312 int i;
313
314 if (base_addr > 0x1ff)
315 return el16_probe1(dev, base_addr);
316 else if (base_addr != 0)
317 return ENXIO;
318
319 for (i = 0; netcard_portlist[i]; i++) {
320 int ioaddr = netcard_portlist[i];
321 if (check_region(ioaddr, EL16_IO_EXTENT))
322 continue;
323 if (el16_probe1(dev, ioaddr) == 0)
324 return 0;
325 }
326
327 return ENODEV;
328 }
329
330 int el16_probe1(struct device *dev, int ioaddr)
331 {
332 static unsigned char init_ID_done = 0, version_printed = 0;
333 int i, irq, irqval;
334
335 if (init_ID_done == 0) {
336 ushort lrs_state = 0xff;
337
338 outb(0x00, ID_PORT);
339 for(i = 0; i < 255; i++) {
340 outb(lrs_state, ID_PORT);
341 lrs_state <<= 1;
342 if (lrs_state & 0x100)
343 lrs_state ^= 0xe7;
344 }
345 outb(0x00, ID_PORT);
346 init_ID_done = 1;
347 }
348
349 if (inb(ioaddr) == '*' && inb(ioaddr+1) == '3'
350 && inb(ioaddr+2) == 'C' && inb(ioaddr+3) == 'O')
351 ;
352 else
353 return ENODEV;
354
355
356 if (dev == NULL)
357 dev = init_etherdev(0, sizeof(struct net_local), 0);
358
359 if (net_debug && version_printed++ == 0)
360 printk(version);
361
362 printk("%s: 3c507 at %#x,", dev->name, ioaddr);
363
364
365
366
367 irq = inb(ioaddr + IRQ_CONFIG) & 0x0f;
368
369 irqval = request_irq(irq, &el16_interrupt, 0, "3c507");
370 if (irqval) {
371 printk ("unable to get IRQ %d (irqval=%d).\n", irq, irqval);
372 return EAGAIN;
373 }
374
375
376 request_region(ioaddr, EL16_IO_EXTENT, "3c507");
377 dev->base_addr = ioaddr;
378
379 outb(0x01, ioaddr + MISC_CTRL);
380 for (i = 0; i < 6; i++) {
381 dev->dev_addr[i] = inb(ioaddr + i);
382 printk(" %02x", dev->dev_addr[i]);
383 }
384
385 if ((dev->mem_start & 0xf) > 0)
386 net_debug = dev->mem_start & 7;
387
388 #ifdef MEM_BASE
389 dev->mem_start = MEM_BASE;
390 dev->mem_end = dev->mem_start + 0x10000;
391 #else
392 {
393 int base;
394 int size;
395 char mem_config = inb(ioaddr + MEM_CONFIG);
396 if (mem_config & 0x20) {
397 size = 64*1024;
398 base = 0xf00000 + (mem_config & 0x08 ? 0x080000
399 : ((mem_config & 3) << 17));
400 } else {
401 size = ((mem_config & 3) + 1) << 14;
402 base = 0x0c0000 + ( (mem_config & 0x18) << 12);
403 }
404 dev->mem_start = base;
405 dev->mem_end = base + size;
406 }
407 #endif
408
409 dev->if_port = (inb(ioaddr + ROM_CONFIG) & 0x80) ? 1 : 0;
410 dev->irq = inb(ioaddr + IRQ_CONFIG) & 0x0f;
411
412 printk(", IRQ %d, %sternal xcvr, memory %#lx-%#lx.\n", dev->irq,
413 dev->if_port ? "ex" : "in", dev->mem_start, dev->mem_end-1);
414
415 if (net_debug)
416 printk(version);
417
418
419 dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL);
420 if (dev->priv == NULL)
421 return -ENOMEM;
422 memset(dev->priv, 0, sizeof(struct net_local));
423
424 dev->open = el16_open;
425 dev->stop = el16_close;
426 dev->hard_start_xmit = el16_send_packet;
427 dev->get_stats = el16_get_stats;
428
429 ether_setup(dev);
430
431 return 0;
432 }
433
434
435
436 static int
437 el16_open(struct device *dev)
438 {
439 irq2dev_map[dev->irq] = dev;
440
441
442 init_82586_mem(dev);
443
444 dev->tbusy = 0;
445 dev->interrupt = 0;
446 dev->start = 1;
447
448 #ifdef MODULE
449 MOD_INC_USE_COUNT;
450 #endif
451
452 return 0;
453 }
454
455 static int
456 el16_send_packet(struct sk_buff *skb, struct device *dev)
457 {
458 struct net_local *lp = (struct net_local *)dev->priv;
459 int ioaddr = dev->base_addr;
460 short *shmem = (short*)dev->mem_start;
461
462 if (dev->tbusy) {
463
464
465 int tickssofar = jiffies - dev->trans_start;
466 if (tickssofar < 5)
467 return 1;
468 if (net_debug > 1)
469 printk("%s: transmit timed out, %s? ", dev->name,
470 shmem[iSCB_STATUS>>1] & 0x8000 ? "IRQ conflict" :
471 "network cable problem");
472
473 if (lp->last_restart == lp->stats.tx_packets) {
474 if (net_debug > 1) printk("Resetting board.\n");
475
476 init_82586_mem(dev);
477 } else {
478
479 if (net_debug > 1) printk("Kicking board.\n");
480 shmem[iSCB_CMD>>1] = 0xf000|CUC_START|RX_START;
481 outb(0, ioaddr + SIGNAL_CA);
482 lp->last_restart = lp->stats.tx_packets;
483 }
484 dev->tbusy=0;
485 dev->trans_start = jiffies;
486 }
487
488
489
490
491 if (skb == NULL) {
492 dev_tint(dev);
493 return 0;
494 }
495
496
497 if (set_bit(0, (void*)&dev->tbusy) != 0)
498 printk("%s: Transmitter access conflict.\n", dev->name);
499 else {
500 short length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
501 unsigned char *buf = skb->data;
502
503
504 outb(0x80, ioaddr + MISC_CTRL);
505 hardware_send_packet(dev, buf, length);
506 dev->trans_start = jiffies;
507
508 outb(0x84, ioaddr + MISC_CTRL);
509 }
510
511 dev_kfree_skb (skb, FREE_WRITE);
512
513
514
515 return 0;
516 }
517
518
519
520 static void
521 el16_interrupt(int irq, struct pt_regs *regs)
522 {
523 struct device *dev = (struct device *)(irq2dev_map[irq]);
524 struct net_local *lp;
525 int ioaddr, status, boguscount = 0;
526 ushort ack_cmd = 0;
527 ushort *shmem;
528
529 if (dev == NULL) {
530 printk ("net_interrupt(): irq %d for unknown device.\n", irq);
531 return;
532 }
533 dev->interrupt = 1;
534
535 ioaddr = dev->base_addr;
536 lp = (struct net_local *)dev->priv;
537 shmem = ((ushort*)dev->mem_start);
538
539 status = shmem[iSCB_STATUS>>1];
540
541 if (net_debug > 4) {
542 printk("%s: 3c507 interrupt, status %4.4x.\n", dev->name, status);
543 }
544
545
546 outb(0x80, ioaddr + MISC_CTRL);
547
548
549 while (lp->tx_reap != lp->tx_head) {
550 unsigned short tx_status = shmem[lp->tx_reap>>1];
551
552 if (tx_status == 0) {
553 if (net_debug > 5) printk("Couldn't reap %#x.\n", lp->tx_reap);
554 break;
555 }
556 if (tx_status & 0x2000) {
557 lp->stats.tx_packets++;
558 lp->stats.collisions += tx_status & 0xf;
559 dev->tbusy = 0;
560 mark_bh(NET_BH);
561 } else {
562 lp->stats.tx_errors++;
563 if (tx_status & 0x0600) lp->stats.tx_carrier_errors++;
564 if (tx_status & 0x0100) lp->stats.tx_fifo_errors++;
565 if (!(tx_status & 0x0040)) lp->stats.tx_heartbeat_errors++;
566 if (tx_status & 0x0020) lp->stats.tx_aborted_errors++;
567 }
568 if (net_debug > 5)
569 printk("Reaped %x, Tx status %04x.\n" , lp->tx_reap, tx_status);
570 lp->tx_reap += TX_BUF_SIZE;
571 if (lp->tx_reap > RX_BUF_START - TX_BUF_SIZE)
572 lp->tx_reap = TX_BUF_START;
573 if (++boguscount > 4)
574 break;
575 }
576
577 if (status & 0x4000) {
578 if (net_debug > 5)
579 printk("Received packet, rx_head %04x.\n", lp->rx_head);
580 el16_rx(dev);
581 }
582
583
584 ack_cmd = status & 0xf000;
585
586 if ((status & 0x0700) != 0x0200 && dev->start) {
587 if (net_debug)
588 printk("%s: Command unit stopped, status %04x, restarting.\n",
589 dev->name, status);
590
591
592
593 ack_cmd |= CUC_RESUME;
594 }
595
596 if ((status & 0x0070) != 0x0040 && dev->start) {
597 static void init_rx_bufs(struct device *);
598
599
600 if (net_debug)
601 printk("%s: Rx unit stopped, status %04x, restarting.\n",
602 dev->name, status);
603 init_rx_bufs(dev);
604 shmem[iSCB_RFA >> 1] = RX_BUF_START;
605 ack_cmd |= RX_START;
606 }
607
608 shmem[iSCB_CMD>>1] = ack_cmd;
609 outb(0, ioaddr + SIGNAL_CA);
610
611
612 outb(0, ioaddr + RESET_IRQ);
613
614
615 outb(0x84, ioaddr + MISC_CTRL);
616
617 return;
618 }
619
620 static int
621 el16_close(struct device *dev)
622 {
623 int ioaddr = dev->base_addr;
624 ushort *shmem = (short*)dev->mem_start;
625
626 dev->tbusy = 1;
627 dev->start = 0;
628
629
630 shmem[iSCB_CMD >> 1] = RX_SUSPEND | CUC_SUSPEND;
631 outb(0, ioaddr + SIGNAL_CA);
632
633
634 outb(0x80, ioaddr + MISC_CTRL);
635
636
637
638
639 irq2dev_map[dev->irq] = 0;
640
641
642
643 #ifdef MODULE
644 MOD_DEC_USE_COUNT;
645 #endif
646
647 return 0;
648 }
649
650
651
652 static struct enet_statistics *
653 el16_get_stats(struct device *dev)
654 {
655 struct net_local *lp = (struct net_local *)dev->priv;
656
657
658
659 return &lp->stats;
660 }
661
662
663 static void
664 init_rx_bufs(struct device *dev)
665 {
666 struct net_local *lp = (struct net_local *)dev->priv;
667 unsigned short *write_ptr;
668 unsigned short SCB_base = SCB_BASE;
669
670 int cur_rxbuf = lp->rx_head = RX_BUF_START;
671
672
673 do {
674
675 write_ptr = (unsigned short *)(dev->mem_start + cur_rxbuf);
676
677 *write_ptr++ = 0x0000;
678 *write_ptr++ = 0x0000;
679 *write_ptr++ = cur_rxbuf + RX_BUF_SIZE;
680 *write_ptr++ = cur_rxbuf + 22;
681 *write_ptr++ = 0x0000;
682 *write_ptr++ = 0x0000;
683 *write_ptr++ = 0x0000;
684 *write_ptr++ = 0x0000;
685 *write_ptr++ = 0x0000;
686 *write_ptr++ = 0x0000;
687 *write_ptr++ = 0x0000;
688
689 *write_ptr++ = 0x0000;
690 *write_ptr++ = -1;
691 *write_ptr++ = cur_rxbuf + 0x20 + SCB_base;
692 *write_ptr++ = 0x0000;
693
694 *write_ptr++ = 0x8000 + RX_BUF_SIZE-0x20;
695
696 lp->rx_tail = cur_rxbuf;
697 cur_rxbuf += RX_BUF_SIZE;
698 } while (cur_rxbuf <= RX_BUF_END - RX_BUF_SIZE);
699
700
701
702 write_ptr = (unsigned short *)
703 (dev->mem_start + lp->rx_tail + 2);
704 *write_ptr++ = 0xC000;
705 *write_ptr++ = lp->rx_head;
706
707 }
708
709 void
710 init_82586_mem(struct device *dev)
711 {
712 struct net_local *lp = (struct net_local *)dev->priv;
713 short ioaddr = dev->base_addr;
714 ushort *shmem = (short*)dev->mem_start;
715
716
717
718 outb(0x20, ioaddr + MISC_CTRL);
719
720
721 init_words[3] = SCB_BASE;
722 init_words[7] = SCB_BASE;
723
724
725 memcpy((void*)dev->mem_end-10, init_words, 10);
726
727
728 memcpy((char*)dev->mem_start, init_words + 5, sizeof(init_words) - 10);
729
730
731 memcpy((char*)dev->mem_start+SA_OFFSET, dev->dev_addr,
732 sizeof(dev->dev_addr));
733
734
735 lp->tx_cmd_link = IDLELOOP + 4;
736 lp->tx_head = lp->tx_reap = TX_BUF_START;
737
738 init_rx_bufs(dev);
739
740
741 outb(0xA0, ioaddr + MISC_CTRL);
742
743
744
745 outb(0, ioaddr + SIGNAL_CA);
746
747 {
748 int boguscnt = 50;
749 while (shmem[iSCB_STATUS>>1] == 0)
750 if (--boguscnt == 0) {
751 printk("%s: i82586 initialization timed out with status %04x,"
752 "cmd %04x.\n", dev->name,
753 shmem[iSCB_STATUS>>1], shmem[iSCB_CMD>>1]);
754 break;
755 }
756
757 outb(0, ioaddr + SIGNAL_CA);
758 }
759
760
761 outb(0x84, ioaddr + MISC_CTRL);
762 if (net_debug > 4)
763 printk("%s: Initialized 82586, status %04x.\n", dev->name,
764 shmem[iSCB_STATUS>>1]);
765 return;
766 }
767
768 static void
769 hardware_send_packet(struct device *dev, void *buf, short length)
770 {
771 struct net_local *lp = (struct net_local *)dev->priv;
772 short ioaddr = dev->base_addr;
773 ushort tx_block = lp->tx_head;
774 ushort *write_ptr = (ushort *)(dev->mem_start + tx_block);
775
776
777 *write_ptr++ = 0x0000;
778 *write_ptr++ = CMD_INTR|CmdTx;
779 *write_ptr++ = tx_block+16;
780 *write_ptr++ = tx_block+8;
781
782
783 *write_ptr++ = length | 0x8000;
784 *write_ptr++ = -1;
785 *write_ptr++ = tx_block+22+SCB_BASE;
786 *write_ptr++ = 0x0000;
787
788
789 *write_ptr++ = 0x0000;
790 *write_ptr++ = CmdNOp;
791 *write_ptr++ = tx_block+16;
792
793
794 memcpy(write_ptr, buf, length);
795
796
797 *(ushort*)(dev->mem_start + lp->tx_cmd_link) = tx_block;
798 lp->tx_cmd_link = tx_block + 20;
799
800
801 lp->tx_head = tx_block + TX_BUF_SIZE;
802 if (lp->tx_head > RX_BUF_START - TX_BUF_SIZE)
803 lp->tx_head = TX_BUF_START;
804
805 if (net_debug > 4) {
806 printk("%s: 3c507 @%x send length = %d, tx_block %3x, next %3x.\n",
807 dev->name, ioaddr, length, tx_block, lp->tx_head);
808 }
809
810 if (lp->tx_head != lp->tx_reap)
811 dev->tbusy = 0;
812 }
813
814 static void
815 el16_rx(struct device *dev)
816 {
817 struct net_local *lp = (struct net_local *)dev->priv;
818 short *shmem = (short*)dev->mem_start;
819 ushort rx_head = lp->rx_head;
820 ushort rx_tail = lp->rx_tail;
821 ushort boguscount = 10;
822 short frame_status;
823
824 while ((frame_status = shmem[rx_head>>1]) < 0) {
825 ushort *read_frame = (short *)(dev->mem_start + rx_head);
826 ushort rfd_cmd = read_frame[1];
827 ushort next_rx_frame = read_frame[2];
828 ushort data_buffer_addr = read_frame[3];
829 ushort *data_frame = (short *)(dev->mem_start + data_buffer_addr);
830 ushort pkt_len = data_frame[0];
831
832 if (rfd_cmd != 0 || data_buffer_addr != rx_head + 22
833 || pkt_len & 0xC000 != 0xC000) {
834 printk("%s: Rx frame at %#x corrupted, status %04x cmd %04x"
835 "next %04x data-buf @%04x %04x.\n", dev->name, rx_head,
836 frame_status, rfd_cmd, next_rx_frame, data_buffer_addr,
837 pkt_len);
838 } else if ((frame_status & 0x2000) == 0) {
839
840 lp->stats.rx_errors++;
841 if (frame_status & 0x0800) lp->stats.rx_crc_errors++;
842 if (frame_status & 0x0400) lp->stats.rx_frame_errors++;
843 if (frame_status & 0x0200) lp->stats.rx_fifo_errors++;
844 if (frame_status & 0x0100) lp->stats.rx_over_errors++;
845 if (frame_status & 0x0080) lp->stats.rx_length_errors++;
846 } else {
847
848 struct sk_buff *skb;
849
850 pkt_len &= 0x3fff;
851 skb = dev_alloc_skb(pkt_len+2);
852 if (skb == NULL) {
853 printk("%s: Memory squeeze, dropping packet.\n", dev->name);
854 lp->stats.rx_dropped++;
855 break;
856 }
857
858 skb_reserve(skb,2);
859 skb->dev = dev;
860
861
862 memcpy(skb_put(skb,pkt_len), data_frame + 5, pkt_len);
863
864 skb->protocol=eth_type_trans(skb,dev);
865 netif_rx(skb);
866 lp->stats.rx_packets++;
867 }
868
869
870 read_frame[0] = 0;
871 read_frame[1] = 0xC000;
872
873 *(short*)(dev->mem_start + rx_tail + 2) = 0x0000;
874
875 rx_tail = rx_head;
876 rx_head = next_rx_frame;
877 if (--boguscount == 0)
878 break;
879 }
880
881 lp->rx_head = rx_head;
882 lp->rx_tail = rx_tail;
883 }
884 #ifdef MODULE
885 char kernel_version[] = UTS_RELEASE;
886 static char devicename[9] = { 0, };
887 static struct device dev_3c507 = {
888 devicename,
889 0, 0, 0, 0,
890 0, 0,
891 0, 0, 0, NULL, el16_probe
892 };
893
894 int io = 0x300;
895 int irq = 0;
896
897 int init_module(void)
898 {
899 if (io == 0)
900 printk("3c507: You should not use auto-probing with insmod!\n");
901 dev_3c507.base_addr = io;
902 dev_3c507.irq = irq;
903 if (register_netdev(&dev_3c507) != 0) {
904 printk("3c507: register_netdev() returned non-zero.\n");
905 return -EIO;
906 }
907 return 0;
908 }
909
910 void
911 cleanup_module(void)
912 {
913 if (MOD_IN_USE)
914 printk("3c507: device busy, remove delayed\n");
915 else
916 {
917 unregister_netdev(&dev_3c507);
918 kfree(dev_3c507.priv);
919 dev_3c507.priv = NULL;
920
921
922 free_irq(dev_3c507.irq);
923 release_region(dev_3c507.base_addr, EL16_IO_EXTENT);
924 }
925 }
926 #endif
927
928
929
930
931
932
933
934
935
936