aboutsummaryrefslogblamecommitdiffstats
path: root/drivers/net/atari_bionet.c
blob: 1798ce7262c9b0b0ddea69042646abc5827c8bf8 (plain) (tree)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674

































































































































































































































































































































































































































































































































































































































































































                                                                                                                           
/* bionet.c     BioNet-100 device driver for linux68k.
 *
 * Version:	@(#)bionet.c	1.0	02/06/96
 *
 * Author:	Hartmut Laue <laue@ifk-mp.uni-kiel.de>
 * and		Torsten Narjes <narjes@ifk-mp.uni-kiel.de>
 *
 * Little adaptions for integration into pl7 by Roman Hodek
 *
 * Some changes in bionet_poll_rx by Karl-Heinz Lohner
 *
	What is it ?
	------------
	This driver controls the BIONET-100 LAN-Adapter which connects
	an ATARI ST/TT via the ACSI-port to an Ethernet-based network.

	This version can be compiled as a loadable module (See the
	compile command at the bottom of this file).
	At load time, you can optionally set the debugging level and the
	fastest response time on the command line of 'insmod'.

	'bionet_debug'
		controls the amount of diagnostic messages:
	  0  : no messages
	  >0 : see code for meaning of printed messages

	'bionet_min_poll_time' (always >=1)
		gives the time (in jiffies) between polls. Low values
		increase the system load (beware!)

	When loaded, a net device with the name 'bio0' becomes available,
	which can be controlled with the usual 'ifconfig' command.

	It is possible to compile this driver into the kernel like other
	(net) drivers. For this purpose, some source files (e.g. config-files
	makefiles, Space.c) must be changed accordingly. (You may refer to
	other drivers how to do it.) In this case, the device will be detected
	at boot time and (probably) appear as 'eth0'.

	This code is based on several sources:
	- The driver code for a parallel port ethernet adapter by
	  Donald Becker (see file 'atp.c' from the PC linux distribution)
	- The ACSI code by Roman Hodek for the ATARI-ACSI harddisk support
	  and DMA handling.
	- Very limited information about moving packets in and out of the
	  BIONET-adapter from the TCP package for TOS by BioData GmbH.

	Theory of Operation
	-------------------
	Because the ATARI DMA port is usually shared between several
	devices (eg. harddisk, floppy) we cannot block the ACSI bus
	while waiting for interrupts. Therefore we use a polling mechanism
	to fetch packets from the adapter. For the same reason, we send
	packets without checking that the previous packet has been sent to
	the LAN. We rely on the higher levels of the networking code to detect
	missing packets and resend them.

	Before we access the ATARI DMA controller, we check if another
	process is using the DMA. If not, we lock the DMA, perform one or
	more packet transfers and unlock the DMA before returning.
	We do not use 'stdma_lock' unconditionally because it is unclear
	if the networking code can be set to sleep, which will happen if
	another (possibly slow) device is using the DMA controller.

	The polling is done via timer interrupts which periodically
	'simulate' an interrupt from the Ethernet adapter. The time (in jiffies)
	between polls varies depending on an estimate of the net activity.
	The allowed range is given by the variable 'bionet_min_poll_time'
	for the lower (fastest) limit and the constant 'MAX_POLL_TIME'
	for the higher (slowest) limit.

	Whenever a packet arrives, we switch to fastest response by setting
	the polling time to its lowest limit. If the following poll fails,
	because no packets have arrived, we increase the time for the next
	poll. When the net activity is low, the polling time effectively
	stays at its maximum value, resulting in the lowest load for the
	machine.
 */

#define MAX_POLL_TIME	10

static char version[] =
	"bionet.c:v1.0 06-feb-96 (c) Hartmut Laue.\n";

#include <linux/module.h>

#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/jiffies.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/bitops.h>

#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>

#include <asm/setup.h>
#include <asm/pgtable.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/atarihw.h>
#include <asm/atariints.h>
#include <asm/atari_acsi.h>
#include <asm/atari_stdma.h>


/* use 0 for production, 1 for verification, >2 for debug
 */
#ifndef NET_DEBUG
#define NET_DEBUG 0
#endif
/*
 * Global variable 'bionet_debug'. Can be set at load time by 'insmod'
 */
unsigned int bionet_debug = NET_DEBUG;
MODULE_PARM(bionet_debug, "i");
MODULE_PARM_DESC(bionet_debug, "bionet debug level (0-2)");
MODULE_LICENSE("GPL");

static unsigned int bionet_min_poll_time = 2;


/* Information that need to be kept for each board.
 */
struct net_local {
	struct net_device_stats stats;
	long open_time;			/* for debugging */
	int  poll_time;			/* polling time varies with net load */
};

static struct nic_pkt_s {		/* packet format */
	unsigned char	status;
	unsigned char	dummy;
	unsigned char	l_lo, l_hi;
	unsigned char	buffer[3000];
} *nic_packet;
unsigned char *phys_nic_packet;

/* Index to functions, as function prototypes.
 */
static int bionet_open(struct net_device *dev);
static int bionet_send_packet(struct sk_buff *skb, struct net_device *dev);
static void bionet_poll_rx(struct net_device *);
static int bionet_close(struct net_device *dev);
static struct net_device_stats *net_get_stats(struct net_device *dev);
static void bionet_tick(unsigned long);

static struct timer_list bionet_timer = TIMER_INITIALIZER(bionet_tick, 0, 0);

#define STRAM_ADDR(a)	(((a) & 0xff000000) == 0)

/* The following routines access the ethernet board connected to the
 * ACSI port via the st_dma chip.
 */
#define NODE_ADR 0x60

#define C_READ 8
#define C_WRITE 0x0a
#define C_GETEA 0x0f
#define C_SETCR 0x0e

static int
sendcmd(unsigned int a0, unsigned int mod, unsigned int cmd) {
	unsigned int c;

	dma_wd.dma_mode_status = (mod | ((a0) ? 2 : 0) | 0x88);
	dma_wd.fdc_acces_seccount = cmd;
	dma_wd.dma_mode_status = (mod | 0x8a);

	if( !acsi_wait_for_IRQ(HZ/2) )	/* wait for cmd ack */
		return -1;		/* timeout */

	c = dma_wd.fdc_acces_seccount;
	return (c & 0xff);
}


static void
set_status(int cr) {
	sendcmd(0,0x100,NODE_ADR | C_SETCR);    /* CMD: SET CR */
	sendcmd(1,0x100,cr);

	dma_wd.dma_mode_status = 0x80;
}

static int
get_status(unsigned char *adr) {
	int i,c;

	DISABLE_IRQ();
	c = sendcmd(0,0x00,NODE_ADR | C_GETEA);  /* CMD: GET ETH ADR*/
	if( c < 0 ) goto gsend;

	/* now read status bytes */

	for (i=0; i<6; i++) {
		dma_wd.fdc_acces_seccount = 0;	/* request next byte */

    		if( !acsi_wait_for_IRQ(HZ/2) ) {	/* wait for cmd ack */
			c = -1;
			goto gsend;		/* timeout */
		}
		c = dma_wd.fdc_acces_seccount;
		*adr++ = (unsigned char)c;
	}
	c = 1;
gsend:
  	dma_wd.dma_mode_status = 0x80;
	return c;
}

static irqreturn_t
bionet_intr(int irq, void *data, struct pt_regs *fp) {
	return IRQ_HANDLED;
}


static int
get_frame(unsigned long paddr, int odd) {
	int c;
	unsigned long flags;

	DISABLE_IRQ();
	local_irq_save(flags);

	dma_wd.dma_mode_status		= 0x9a;
	dma_wd.dma_mode_status		= 0x19a;
	dma_wd.dma_mode_status		= 0x9a;
	dma_wd.fdc_acces_seccount	= 0x04;		/* sector count (was 5) */
	dma_wd.dma_lo			= (unsigned char)paddr;
	paddr >>= 8;
	dma_wd.dma_md			= (unsigned char)paddr;
	paddr >>= 8;
	dma_wd.dma_hi			= (unsigned char)paddr;
	local_irq_restore(flags);

	c = sendcmd(0,0x00,NODE_ADR | C_READ);	/* CMD: READ */
	if( c < 128 ) goto rend;

	/* now read block */

	c = sendcmd(1,0x00,odd);	/* odd flag for address shift */
	dma_wd.dma_mode_status	= 0x0a;

	if( !acsi_wait_for_IRQ(100) ) {	/* wait for DMA to complete */
		c = -1;
		goto rend;
	}
	dma_wd.dma_mode_status	= 0x8a;
	dma_wd.dma_mode_status	= 0x18a;
	dma_wd.dma_mode_status	= 0x8a;
	c = dma_wd.fdc_acces_seccount;

	dma_wd.dma_mode_status	= 0x88;
	c = dma_wd.fdc_acces_seccount;
	c = 1;

rend:
	dma_wd.dma_mode_status	= 0x80;
	udelay(40);
	acsi_wait_for_noIRQ(20);
	return c;
}


static int
hardware_send_packet(unsigned long paddr, int cnt) {
	unsigned int c;
	unsigned long flags;

	DISABLE_IRQ();
	local_irq_save(flags);

	dma_wd.dma_mode_status	= 0x19a;
	dma_wd.dma_mode_status	= 0x9a;
	dma_wd.dma_mode_status	= 0x19a;
	dma_wd.dma_lo		= (unsigned char)paddr;
	paddr >>= 8;
	dma_wd.dma_md		= (unsigned char)paddr;
	paddr >>= 8;
	dma_wd.dma_hi		= (unsigned char)paddr;

	dma_wd.fdc_acces_seccount	= 0x4;		/* sector count */
	local_irq_restore(flags);

	c = sendcmd(0,0x100,NODE_ADR | C_WRITE);	/* CMD: WRITE */
	c = sendcmd(1,0x100,cnt&0xff);
	c = sendcmd(1,0x100,cnt>>8);

	/* now write block */

	dma_wd.dma_mode_status	= 0x10a;	/* DMA enable */
	if( !acsi_wait_for_IRQ(100) )		/* wait for DMA to complete */
		goto end;

	dma_wd.dma_mode_status	= 0x19a;	/* DMA disable ! */
	c = dma_wd.fdc_acces_seccount;

end:
	c = sendcmd(1,0x100,0);
	c = sendcmd(1,0x100,0);

	dma_wd.dma_mode_status	= 0x180;
	udelay(40);
	acsi_wait_for_noIRQ(20);
	return( c & 0x02);
}


/* Check for a network adaptor of this type, and return '0' if one exists.
 */
struct net_device * __init bionet_probe(int unit)
{
	struct net_device *dev;
	unsigned char station_addr[6];
	static unsigned version_printed;
	static int no_more_found;	/* avoid "Probing for..." printed 4 times */
	int i;
	int err;

	if (!MACH_IS_ATARI || no_more_found)
		return ERR_PTR(-ENODEV);

	dev = alloc_etherdev(sizeof(struct net_local));
	if (!dev)
		return ERR_PTR(-ENOMEM);
	if (unit >= 0) {
		sprintf(dev->name, "eth%d", unit);
		netdev_boot_setup_check(dev);
	}
	SET_MODULE_OWNER(dev);

	printk("Probing for BioNet 100 Adapter...\n");

	stdma_lock(bionet_intr, NULL);
	i = get_status(station_addr);	/* Read the station address PROM.  */
	ENABLE_IRQ();
	stdma_release();

	/* Check the first three octets of the S.A. for the manufactor's code.
	 */

	if( i < 0
	||  station_addr[0] != 'B'
	||  station_addr[1] != 'I'
	||  station_addr[2] != 'O' ) {
		no_more_found = 1;
		printk( "No BioNet 100 found.\n" );
		free_netdev(dev);
		return ERR_PTR(-ENODEV);
	}

	if (bionet_debug > 0 && version_printed++ == 0)
		printk(version);

	printk("%s: %s found, eth-addr: %02x-%02x-%02x:%02x-%02x-%02x.\n",
		dev->name, "BioNet 100",
		station_addr[0], station_addr[1], station_addr[2],
		station_addr[3], station_addr[4], station_addr[5]);

	/* Initialize the device structure. */

	nic_packet = (struct nic_pkt_s *)acsi_buffer;
	phys_nic_packet = (unsigned char *)phys_acsi_buffer;
	if (bionet_debug > 0) {
		printk("nic_packet at 0x%p, phys at 0x%p\n",
			nic_packet, phys_nic_packet );
	}

	dev->open		= bionet_open;
	dev->stop		= bionet_close;
	dev->hard_start_xmit	= bionet_send_packet;
	dev->get_stats		= net_get_stats;

	/* Fill in the fields of the device structure with ethernet-generic
	 * values. This should be in a common file instead of per-driver.
	 */

	for (i = 0; i < ETH_ALEN; i++) {
#if 0
		dev->broadcast[i] = 0xff;
#endif
		dev->dev_addr[i]  = station_addr[i];
	}
	err = register_netdev(dev);
	if (!err)
		return dev;
	free_netdev(dev);
	return ERR_PTR(err);
}

/* Open/initialize the board.  This is called (in the current kernel)
   sometime after booting when the 'ifconfig' program is run.

   This routine should set everything up anew at each open, even
   registers that "should" only need to be set once at boot, so that
   there is non-reboot way to recover if something goes wrong.
 */
static int
bionet_open(struct net_device *dev) {
	struct net_local *lp = netdev_priv(dev);

	if (bionet_debug > 0)
		printk("bionet_open\n");
	stdma_lock(bionet_intr, NULL);

	/* Reset the hardware here.
	 */
	set_status(4);
	lp->open_time = 0;	/*jiffies*/
	lp->poll_time = MAX_POLL_TIME;

	dev->tbusy = 0;
	dev->interrupt = 0;
	dev->start = 1;

	stdma_release();
	bionet_timer.data = (long)dev;
	bionet_timer.expires = jiffies + lp->poll_time;
	add_timer(&bionet_timer);
	return 0;
}

static int
bionet_send_packet(struct sk_buff *skb, struct net_device *dev) {
	struct net_local *lp = netdev_priv(dev);
	unsigned long flags;

	/* Block a timer-based transmit from overlapping.  This could better be
	 * done with atomic_swap(1, dev->tbusy), but set_bit() works as well.
	 */
	local_irq_save(flags);

	if (stdma_islocked()) {
		local_irq_restore(flags);
		lp->stats.tx_errors++;
	}
	else {
		int length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
		unsigned long buf = virt_to_phys(skb->data);
		int stat;

		stdma_lock(bionet_intr, NULL);
		local_irq_restore(flags);
		if( !STRAM_ADDR(buf+length-1) ) {
			memcpy(nic_packet->buffer, skb->data, length);
			buf = (unsigned long)&((struct nic_pkt_s *)phys_nic_packet)->buffer;
		}

		if (bionet_debug >1) {
			u_char *data = nic_packet->buffer, *p;
			int i;
			
			printk( "%s: TX pkt type 0x%4x from ", dev->name,
				  ((u_short *)data)[6]);

			for( p = &data[6], i = 0; i < 6; i++ )
				printk("%02x%s", *p++,i != 5 ? ":" : "" );
			printk(" to ");

			for( p = data, i = 0; i < 6; i++ )
				printk("%02x%s", *p++,i != 5 ? ":" : "" "\n" );

			printk( "%s: ", dev->name );
			printk(" data %02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x"
			       " %02x%02x%02x%02x len %d\n",
				  data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19],
				  data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27],
				  data[28], data[29], data[30], data[31], data[32], data[33],
				  length );
		}
		dma_cache_maintenance(buf, length, 1);

		stat = hardware_send_packet(buf, length);
		ENABLE_IRQ();
		stdma_release();

		dev->trans_start = jiffies;
		dev->tbusy	 = 0;
		lp->stats.tx_packets++;
		lp->stats.tx_bytes+=length;
	}
	dev_kfree_skb(skb);

	return 0;
}

/* We have a good packet(s), get it/them out of the buffers.
 */
static void
bionet_poll_rx(struct net_device *dev) {
	struct net_local *lp = netdev_priv(dev);
	int boguscount = 10;
	int pkt_len, status;
	unsigned long flags;

	local_irq_save(flags);
	/* ++roman: Take care at locking the ST-DMA... This must be done with ints
	 * off, since otherwise an int could slip in between the question and the
	 * locking itself, and then we'd go to sleep... And locking itself is
	 * necessary to keep the floppy_change timer from working with ST-DMA
	 * registers. */
	if (stdma_islocked()) {
		local_irq_restore(flags);
		return;
	}
	stdma_lock(bionet_intr, NULL);
	DISABLE_IRQ();
	local_irq_restore(flags);

	if( lp->poll_time < MAX_POLL_TIME ) lp->poll_time++;

	while(boguscount--) {
		status = get_frame((unsigned long)phys_nic_packet, 0);

		if( status == 0 ) break;

		/* Good packet... */

		dma_cache_maintenance((unsigned long)phys_nic_packet, 1520, 0);

		pkt_len = (nic_packet->l_hi << 8) | nic_packet->l_lo;

		lp->poll_time = bionet_min_poll_time;    /* fast poll */
		if( pkt_len >= 60 && pkt_len <= 1520 ) {
					/*	^^^^ war 1514  KHL */
			/* Malloc up new buffer.
			 */
			struct sk_buff *skb = dev_alloc_skb( pkt_len + 2 );
			if (skb == NULL) {
				printk("%s: Memory squeeze, dropping packet.\n",
					dev->name);
				lp->stats.rx_dropped++;
				break;
			}

			skb->dev = dev;
			skb_reserve( skb, 2 );		/* 16 Byte align  */
			skb_put( skb, pkt_len );	/* make room */

			/* 'skb->data' points to the start of sk_buff data area.
			 */
			memcpy(skb->data, nic_packet->buffer, pkt_len);
			skb->protocol = eth_type_trans( skb, dev ); 
			netif_rx(skb);
			dev->last_rx = jiffies;
			lp->stats.rx_packets++;
			lp->stats.rx_bytes+=pkt_len;

	/* If any worth-while packets have been received, dev_rint()
	   has done a mark_bh(INET_BH) for us and will work on them
	   when we get to the bottom-half routine.
	 */

 			if (bionet_debug >1) {
 				u_char *data = nic_packet->buffer, *p;
 				int i;
 				
 				printk( "%s: RX pkt type 0x%4x from ", dev->name,
 					  ((u_short *)data)[6]);
 					 
 				
 				for( p = &data[6], i = 0; i < 6; i++ )
 					printk("%02x%s", *p++,i != 5 ? ":" : "" );
 				printk(" to ");
 				for( p = data, i = 0; i < 6; i++ )
 					printk("%02x%s", *p++,i != 5 ? ":" : "" "\n" );
 
 				printk( "%s: ", dev->name );
 				printk(" data %02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x"
 				       " %02x%02x%02x%02x len %d\n",
 					  data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19],
 					  data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27],
 					  data[28], data[29], data[30], data[31], data[32], data[33],
 						  pkt_len );
 			}
 		}
 		else {
 			printk(" Packet has wrong length: %04d bytes\n", pkt_len);
 			lp->stats.rx_errors++;
 		}
 	}
	stdma_release();
	ENABLE_IRQ();
	return;
}

/* bionet_tick: called by bionet_timer. Reads packets from the adapter,
 * passes them to the higher layers and restarts the timer.
 */
static void
bionet_tick(unsigned long data) {
	struct net_device	 *dev = (struct net_device *)data;
	struct net_local *lp = netdev_priv(dev);

	if( bionet_debug > 0 && (lp->open_time++ & 7) == 8 )
		printk("bionet_tick: %ld\n", lp->open_time);

	if( !stdma_islocked() ) bionet_poll_rx(dev);

	bionet_timer.expires = jiffies + lp->poll_time;
	add_timer(&bionet_timer);
}

/* The inverse routine to bionet_open().
 */
static int
bionet_close(struct net_device *dev) {
	struct net_local *lp = netdev_priv(dev);

	if (bionet_debug > 0)
		printk("bionet_close, open_time=%ld\n", lp->open_time);
	del_timer(&bionet_timer);
	stdma_lock(bionet_intr, NULL);

	set_status(0);
	lp->open_time = 0;

	dev->tbusy = 1;
	dev->start = 0;

	stdma_release();
	return 0;
}

/* Get the current statistics.
   This may be called with the card open or closed.
 */
static struct net_device_stats *net_get_stats(struct net_device *dev) 
{
	struct net_local *lp = netdev_priv(dev);
	return &lp->stats;
}


#ifdef MODULE

static struct net_device *bio_dev;

int init_module(void)
{
	bio_dev = bionet_probe(-1);
	if (IS_ERR(bio_dev))
		return PTR_ERR(bio_dev);
	return 0;
}

void cleanup_module(void)
{
	unregister_netdev(bio_dev);
	free_netdev(bio_dev);
}

#endif /* MODULE */

/* Local variables:
 *  compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/include
	-b m68k-linuxaout -Wall -Wstrict-prototypes -O2
	-fomit-frame-pointer -pipe -DMODULE -I../../net/inet -c bionet.c"
 *  version-control: t
 *  kept-new-versions: 5
 *  tab-width: 8
 * End:
 */