This source file includes following definitions.
- ei_open
- ei_start_xmit
- ei_interrupt
- ei_tx_intr
- ei_receive
- ei_rx_overrun
- get_stats
- ethif_init
- ethdev_init
- NS8390_init
- NS8390_trigger_send
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 static char *version =
17 "8390.c:v0.99-12 8/9/93 for 0.99.12+ Donald Becker (becker@super.org)\n";
18 #include <linux/config.h>
19 #if !defined(EL2) && !defined(NE2000) && !defined(WD80x3) && !defined(HPLAN)
20
21 #define EL2
22 #define NE2000
23 #define WD80x3
24 #define HPLAN
25 #endif
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 #include <linux/config.h>
43 #include <linux/kernel.h>
44 #include <linux/sched.h>
45 #include <linux/fs.h>
46 #include <linux/tty.h>
47 #include <linux/types.h>
48 #include <linux/ptrace.h>
49 #include <linux/string.h>
50 #include <asm/system.h>
51 #include <asm/segment.h>
52 #include <asm/io.h>
53 #include <errno.h>
54 #include <linux/fcntl.h>
55 #include <linux/in.h>
56 #include <linux/interrupt.h>
57
58 #include "dev.h"
59 #include "eth.h"
60 #include "ip.h"
61 #include "protocol.h"
62 #include "tcp.h"
63 #include "skbuff.h"
64 #include "sock.h"
65 #include "arp.h"
66
67 #include "8390.h"
68
69 #define ei_reset_8390 (ei_local->reset_8390)
70 #define ei_block_output (ei_local->block_output)
71 #define ei_block_input (ei_local->block_input)
72
73
74 #ifdef EI_DEBUG
75 int ei_debug = EI_DEBUG;
76 #else
77 int ei_debug = 1;
78 #endif
79
80
81
82
83
84
85 int ei_open(struct device *dev);
86
87 void ei_interrupt(int reg_ptr);
88 static void ei_tx_intr(struct device *dev);
89 static void ei_receive(struct device *dev);
90 static void ei_rx_overrun(struct device *dev);
91
92
93 void NS8390_init(struct device *dev, int startp);
94 static void NS8390_trigger_send(struct device *dev, unsigned int length,
95 int start_page);
96
97 extern int el2autoprobe(int ioaddr, struct device *dev);
98 extern int el2probe(int ioaddr, struct device *dev);
99 extern int neprobe(int ioaddr, struct device *dev);
100 extern int wdprobe(int ioaddr, struct device *dev);
101 extern int hpprobe(int ioaddr, struct device *dev);
102
103 struct sigaction ei_sigaction = { ei_interrupt, 0, 0, NULL, };
104
105
106
107
108
109 int
110 ei_open(struct device *dev)
111 {
112 struct ei_device *ei_local = (struct ei_device *) dev->priv;
113
114 if ( ! ei_local) {
115 printk("%s: Opening a non-existent physical device\n", dev->name);
116 return 1;
117 }
118
119 irq2dev_map[dev->irq] = dev;
120 NS8390_init(dev, 1);
121 ei_local->tx1 = ei_local->tx2 = 0;
122
123 ei_local->txing = 0;
124
125 dev->tbusy = 0;
126 dev->interrupt = 0;
127 dev->start = 1;
128 ei_local->irqlock = 0;
129 return 0;
130 }
131
132 static int
133 ei_start_xmit(struct sk_buff *skb, struct device *dev)
134 {
135 int e8390_base = dev->base_addr;
136 struct ei_device *ei_local = (struct ei_device *) dev->priv;
137 int length, send_length;
138 int tmp_tbusy;
139
140
141 if (dev->tbusy) {
142 int txsr = inb(e8390_base+EN0_TSR), isr;
143 int tickssofar = jiffies - dev->trans_start;
144 if (tickssofar < 5 || (tickssofar < 15 && ! (txsr & ENTSR_PTX))) {
145 return 1;
146 }
147 isr = inb(e8390_base+EN0_ISR);
148 printk("%s: transmit timed out, TX status %#2x, ISR %#2x.\n",
149 dev->name, txsr, isr);
150
151
152 if (isr)
153 printk("%s: Possible IRQ conflict on IRQ%d?", dev->name, dev->irq);
154 else
155 printk("%s: Possible network cable problem?\n", dev->name);
156
157 ei_reset_8390(dev);
158 NS8390_init(dev, 1);
159 printk("\n");
160 }
161
162
163
164
165 if (skb == NULL) {
166 dev_tint(dev);
167 return 0;
168 }
169
170 if (!skb->arp && dev->rebuild_header(skb+1, dev)) {
171 skb->dev = dev;
172 arp_queue (skb);
173 return 0;
174 }
175
176 if (skb->len <= 0)
177 return 0;
178 length = skb->len;
179 send_length = ETH_ZLEN < length ? length : ETH_ZLEN;
180
181 cli();
182 if (dev->interrupt || ei_local->irqlock) {
183
184 sti();
185 if (ei_debug > 2)
186 printk("%s: Attempt to reenter critical zone%s.\n",
187 dev->name, ei_local->irqlock ? " during interrupt" : "");
188 return 1;
189 }
190 outb(0x00, e8390_base + EN0_IMR);
191 tmp_tbusy=dev->tbusy;
192 dev->tbusy = 1;
193 ei_local->irqlock = 1;
194 sti();
195 if (ei_local->pingpong) {
196 int output_page;
197 if (ei_local->tx1 == 0) {
198 output_page = ei_local->tx_start_page;
199 ei_local->tx1 = send_length;
200 if (ei_debug && ei_local->tx2 > 0)
201 printk("%s: idle transmitter tx2=%d, lasttx=%d, txing=%d.\n",
202 dev->name, ei_local->tx2, ei_local->lasttx,
203 ei_local->txing);
204 } else if (ei_local->tx2 == 0) {
205 output_page = ei_local->tx_start_page + 6;
206 ei_local->tx2 = send_length;
207 if (ei_debug && ei_local->tx1 > 0)
208 printk("%s: idle transmitter, tx1=%d, lasttx=%d, txing=%d.\n",
209 dev->name, ei_local->tx1, ei_local->lasttx,
210 ei_local->txing);
211 } else {
212
213
214 if (ei_debug > 2)
215 printk("%s: No packet buffer space for ping-pong use.\n",
216 dev->name);
217 cli();
218 ei_local->irqlock = 0;
219 dev->tbusy = tmp_tbusy;
220 outb_p(ENISR_ALL, e8390_base + EN0_IMR);
221 sti();
222 return 1;
223 }
224 dev->trans_start = jiffies;
225 ei_block_output(dev, length, (unsigned char *)(skb+1), output_page);
226 if (! ei_local->txing) {
227 NS8390_trigger_send(dev, send_length, output_page);
228 if (output_page == ei_local->tx_start_page)
229 ei_local->tx1 = -1, ei_local->lasttx = -1;
230 else
231 ei_local->tx2 = -1, ei_local->lasttx = -2;
232 ei_local->txing = 1;
233 } else
234 ei_local->txqueue++;
235 if (ei_local->tx1 && ei_local->tx2)
236 tmp_tbusy = 1;
237 } else {
238 dev->trans_start = jiffies;
239 ei_block_output(dev, length, (unsigned char *)(skb+1),
240 ei_local->tx_start_page);
241 NS8390_trigger_send(dev, send_length, ei_local->tx_start_page);
242 tmp_tbusy = 1;
243 }
244
245 if (skb->free)
246 kfree_skb (skb, FREE_WRITE);
247
248
249 cli();
250 outb_p(ENISR_ALL, e8390_base + EN0_IMR);
251 ei_local->irqlock = 0;
252 dev->tbusy=tmp_tbusy;
253 sti();
254 return 0;
255 }
256
257
258
259 void
260 ei_interrupt(int reg_ptr)
261 {
262 int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2);
263 struct device *dev = irq2dev_map[irq];
264 int e8390_base;
265 int interrupts, boguscount = 0;
266 struct ei_device *ei_local;
267
268 if (dev == NULL) {
269 printk ("net_interrupt(): irq %d for unknown device.\n", irq);
270 return;
271 }
272 e8390_base = dev->base_addr;
273 ei_local = (struct ei_device *) dev->priv;
274 if (dev->interrupt || ei_local->irqlock) {
275
276 sti();
277 printk(ei_local->irqlock
278 ? "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n"
279 : "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
280 dev->name, inb_p(e8390_base + EN0_ISR),
281 inb_p(e8390_base + EN0_IMR));
282 return;
283 }
284
285 dev->interrupt = 1;
286 sti();
287
288
289 outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
290 if (ei_debug > 3)
291 printk("%s: interrupt(isr=%#2.2x).\n", dev->name,
292 inb_p(e8390_base + EN0_ISR));
293
294
295 while ((interrupts = inb_p(e8390_base + EN0_ISR)) != 0
296 && ++boguscount < 20) {
297 if (interrupts & ENISR_RDC) {
298
299 outb_p(ENISR_RDC, e8390_base + EN0_ISR);
300 }
301 if (interrupts & ENISR_OVER) {
302 ei_rx_overrun(dev);
303 } else if (interrupts & (ENISR_RX+ENISR_RX_ERR)) {
304
305 ei_receive(dev);
306 }
307
308 if (interrupts & ENISR_TX) {
309 ei_tx_intr(dev);
310 } else if (interrupts & ENISR_COUNTERS) {
311 struct ei_device *ei_local = (struct ei_device *) dev->priv;
312 ei_local->stat.rx_frame_errors += inb_p(e8390_base + EN0_COUNTER0);
313 ei_local->stat.rx_crc_errors += inb_p(e8390_base + EN0_COUNTER1);
314 ei_local->stat.rx_missed_errors+= inb_p(e8390_base + EN0_COUNTER2);
315 outb_p(ENISR_COUNTERS, e8390_base + EN0_ISR);
316 }
317
318
319 if (interrupts & ENISR_TX_ERR) {
320 outb_p(ENISR_TX_ERR, e8390_base + EN0_ISR);
321 }
322 outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
323 }
324
325 if (interrupts && ei_debug) {
326 printk("%s: unknown interrupt %#2x\n", dev->name, interrupts);
327 outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
328 outb_p(0xff, e8390_base + EN0_ISR);
329 }
330 dev->interrupt = 0;
331 return;
332 }
333
334
335
336 static void
337 ei_tx_intr(struct device *dev)
338 {
339 int e8390_base = dev->base_addr;
340 int status = inb(e8390_base + EN0_TSR);
341 struct ei_device *ei_local = (struct ei_device *) dev->priv;
342
343 outb_p(ENISR_TX, e8390_base + EN0_ISR);
344
345 if (ei_local->pingpong) {
346 ei_local->txqueue--;
347 if (ei_local->tx1 < 0) {
348 if (ei_local->lasttx != 1 && ei_local->lasttx != -1)
349 printk("%s: bogus last_tx_buffer %d, tx1=%d.\n",
350 ei_local->name, ei_local->lasttx, ei_local->tx1);
351 ei_local->tx1 = 0;
352 dev->tbusy = 0;
353 if (ei_local->tx2 > 0) {
354 NS8390_trigger_send(dev, ei_local->tx2, ei_local->tx_start_page + 6);
355 dev->trans_start = jiffies;
356 ei_local->txing = 1;
357 ei_local->tx2 = -1,
358 ei_local->lasttx = 2;
359 } else
360 ei_local->lasttx = 20, ei_local->txing = 0;
361 } else if (ei_local->tx2 < 0) {
362 if (ei_local->lasttx != 2 && ei_local->lasttx != -2)
363 printk("%s: bogus last_tx_buffer %d, tx2=%d.\n",
364 ei_local->name, ei_local->lasttx, ei_local->tx2);
365 ei_local->tx2 = 0;
366 dev->tbusy = 0;
367 if (ei_local->tx1 > 0) {
368 NS8390_trigger_send(dev, ei_local->tx1, ei_local->tx_start_page);
369 dev->trans_start = jiffies;
370 ei_local->txing = 1;
371 ei_local->tx1 = -1;
372 ei_local->lasttx = 1;
373 } else
374 ei_local->lasttx = 10, ei_local->txing = 0;
375 } else
376 printk("%s: unexpected TX-done interrupt, lasttx=%d.\n",
377 dev->name, ei_local->lasttx);
378 } else {
379 ei_local->txing = 0;
380 dev->tbusy = 0;
381 }
382
383
384 if (status & ENTSR_PTX)
385 ei_local->stat.tx_packets++;
386 else
387 ei_local->stat.tx_errors++;
388 if (status & ENTSR_COL)
389 ei_local->stat.collisions++;
390 if (status & ENTSR_ABT)
391 ei_local->stat.tx_aborted_errors++;
392 if (status & ENTSR_CRS)
393 ei_local->stat.tx_carrier_errors++;
394 if (status & ENTSR_FU)
395 ei_local->stat.tx_fifo_errors++;
396 if (status & ENTSR_CDH)
397 ei_local->stat.tx_heartbeat_errors++;
398 if (status & ENTSR_OWC)
399 ei_local->stat.tx_window_errors++;
400
401 mark_bh (INET_BH);
402 }
403
404
405
406 static void
407 ei_receive(struct device *dev)
408 {
409 int e8390_base = dev->base_addr;
410 struct ei_device *ei_local = (struct ei_device *) dev->priv;
411 int rxing_page, this_frame, next_frame, current_offset;
412 int boguscount = 0;
413 struct e8390_pkt_hdr rx_frame;
414 int num_rx_pages = ei_local->stop_page-ei_local->rx_start_page;
415
416 while (++boguscount < 10) {
417 int size;
418
419
420 outb_p(E8390_NODMA+E8390_PAGE1, e8390_base + E8390_CMD);
421 rxing_page = inb_p(e8390_base + EN1_CURPAG);
422 outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
423
424
425 this_frame = inb_p(e8390_base + EN0_BOUNDARY) + 1;
426 if (this_frame >= ei_local->stop_page)
427 this_frame = ei_local->rx_start_page;
428
429
430 if (ei_debug > 0 && this_frame != ei_local->current_page)
431 printk("%s: mismatched read page pointers %2x vs %2x.\n",
432 dev->name, this_frame, ei_local->current_page);
433
434 if (this_frame == rxing_page)
435 break;
436
437 current_offset = this_frame << 8;
438 ei_block_input(dev, sizeof(rx_frame), (char *)&rx_frame,
439 current_offset);
440
441 size = rx_frame.count - sizeof(rx_frame);
442
443 next_frame = this_frame + 1 + ((size+4)>>8);
444
445
446
447
448 if ( rx_frame.next != next_frame
449 && rx_frame.next != next_frame + 1
450 && rx_frame.next != next_frame - num_rx_pages
451 && rx_frame.next != next_frame + 1 - num_rx_pages) {
452 #ifndef EI_DEBUG
453 ei_local->current_page = rxing_page;
454 outb(ei_local->current_page-1, e8390_base+EN0_BOUNDARY);
455 continue;
456 #else
457 static int last_rx_bogosity = -1;
458 printk("%s: bogus packet header, status=%#2x nxpg=%#2x sz=%#x (at %#4x)\n",
459 dev->name, rx_frame.status, rx_frame.next, rx_frame.count,
460 current_offset);
461
462 if (ei_local->stat.rx_packets != last_rx_bogosity) {
463
464 ei_local->current_page = rxing_page;
465 printk("%s: setting next frame to %#2x (nxt=%#2x, rx_frm.nx=%#2x rx_frm.stat=%#2x).\n",
466 dev->name, ei_local->current_page, next_frame,
467 rx_frame.next, rx_frame.status);
468 last_rx_bogosity = ei_local->stat.rx_packets;
469 outb(ei_local->current_page-1, e8390_base+EN0_BOUNDARY);
470 continue;
471 } else {
472
473 printk("%s: recovery failed, resetting at packet #%d..",
474 dev->name, ei_local->stat.rx_packets);
475 sti();
476 ei_reset_8390(dev);
477 NS8390_init(dev, 1);
478 printk("restarting.\n");
479 return;
480 }
481 #endif
482 }
483
484 if ((size < 32 || size > 1535) && ei_debug)
485 printk("%s: bogus packet size, status=%#2x nxpg=%#2x size=%#x\n",
486 dev->name, rx_frame.status, rx_frame.next, rx_frame.count);
487 if ((rx_frame.status & 0x0F) == ENRSR_RXOK) {
488 int sksize = sizeof(struct sk_buff) + size;
489 struct sk_buff *skb;
490 skb = (struct sk_buff *) kmalloc(sksize, GFP_ATOMIC);
491 if (skb != NULL) {
492 skb->lock = 0;
493 skb->mem_len = sksize;
494 skb->mem_addr = skb;
495
496 ei_block_input(dev, size, (char *)(skb+1),
497 current_offset + sizeof(rx_frame));
498 if (dev_rint((unsigned char *)skb, size, IN_SKBUFF, dev)) {
499 printk("%s: receive buffers full.\n", dev->name);
500 kfree_s(skb, sksize);
501 break;
502 }
503 } else if (ei_debug) {
504 printk("%s: Couldn't allocate a sk_buff of size %d.\n",
505 dev->name, sksize);
506 break;
507 }
508 ei_local->stat.rx_packets++;
509 } else {
510 int errs = rx_frame.status;
511 if (ei_debug)
512 printk("%s: bogus packet, status=%#2x nxpg=%#2x size=%d\n",
513 dev->name, rx_frame.status, rx_frame.next, rx_frame.count);
514 if (errs & ENRSR_FO)
515 ei_local->stat.rx_fifo_errors++;
516 }
517 next_frame = rx_frame.next;
518
519
520 if (next_frame >= ei_local->stop_page) {
521 printk("%s: next frame inconsistency, %#2x..", dev->name, next_frame);
522 next_frame = ei_local->rx_start_page;
523 }
524 ei_local->current_page += 1 + ((size+4)>>8);
525 ei_local->current_page = next_frame;
526 outb(next_frame-1, e8390_base+EN0_BOUNDARY);
527 }
528
529
530
531
532
533 outb_p(ENISR_RX+ENISR_RX_ERR+ENISR_OVER, e8390_base+EN0_ISR);
534 return;
535 }
536
537
538
539 static void
540 ei_rx_overrun(struct device *dev)
541 {
542 int e8390_base = dev->base_addr;
543 int reset_start_time = jiffies;
544 struct ei_device *ei_local = (struct ei_device *) dev->priv;
545
546
547 outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
548
549 if (ei_debug)
550 printk("%s: Receiver overrun.\n", dev->name);
551 ei_local->stat.rx_over_errors++;
552
553
554
555
556
557
558
559 while ((inb_p(e8390_base+EN0_ISR) & ENISR_RESET) == 0)
560 if (jiffies - reset_start_time > 1) {
561 printk("%s: reset did not complete at ei_rx_overrun.\n",
562 dev->name);
563 NS8390_init(dev, 1);
564 return;
565 };
566
567
568 ei_receive(dev);
569
570 outb_p(0xff, e8390_base+EN0_ISR);
571
572 outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START, e8390_base + E8390_CMD);
573 outb_p(E8390_TXCONFIG, e8390_base + EN0_TXCR);
574 }
575
576 static struct enet_statistics *
577 get_stats(struct device *dev)
578 {
579 struct ei_device *ei_local = (struct ei_device *) dev->priv;
580 return &ei_local->stat;
581 }
582
583 int
584 ethif_init(struct device *dev)
585 {
586 if (1
587 #ifdef WD80x3
588 && ! wdprobe(dev->base_addr, dev)
589 #endif
590 #ifdef EL2
591 && ! el2autoprobe(dev->base_addr, dev)
592 #endif
593 #ifdef NE2000
594 && ! neprobe(dev->base_addr, dev)
595 #endif
596 #ifdef HPLAN
597 && ! hpprobe(dev->base_addr, dev)
598 #endif
599 && 1 ) {
600 return 1;
601 }
602 if (ei_debug > 1)
603 printk(version);
604 return 0;
605 }
606
607
608 int
609 ethdev_init(struct device *dev)
610 {
611 int i;
612
613 for (i = 0; i < DEV_NUMBUFFS; i++)
614 dev->buffs[i] = NULL;
615
616
617 if (dev->open == NULL)
618 dev->open = &ei_open;
619
620 dev->get_stats = get_stats;
621 dev->hard_header = eth_header;
622 dev->add_arp = eth_add_arp;
623 dev->queue_xmit = dev_queue_xmit;
624 dev->rebuild_header = eth_rebuild_header;
625 dev->type_trans = eth_type_trans;
626
627 if (dev->priv == NULL) {
628 struct ei_device *ei_local;
629
630 dev->priv = kmalloc(sizeof(struct ei_device), GFP_KERNEL);
631 memset(dev->priv, 0, sizeof(struct ei_device));
632 ei_local = (struct ei_device *)dev->priv;
633 #ifndef NO_PINGPONG
634 ei_local->pingpong = 1;
635 #endif
636 }
637
638 dev->hard_start_xmit = &ei_start_xmit;
639
640 dev->type = ARPHRD_ETHER;
641 dev->hard_header_len = ETH_HLEN;
642 dev->mtu = 1500;
643 dev->addr_len = ETH_ALEN;
644 for (i = 0; i < dev->addr_len; i++) {
645 dev->broadcast[i]=0xff;
646 }
647
648
649 dev->flags = IFF_BROADCAST;
650 dev->family = AF_INET;
651 dev->pa_addr = 0;
652 dev->pa_brdaddr = 0;
653 dev->pa_mask = 0;
654 dev->pa_alen = sizeof(unsigned long);
655
656 return 0;
657 }
658
659
660
661
662 void NS8390_init(struct device *dev, int startp)
663 {
664 int e8390_base = dev->base_addr;
665 struct ei_device *ei_local = (struct ei_device *) dev->priv;
666 int i;
667 int endcfg = ei_local->word16 ? (0x48 | ENDCFG_WTS) : 0x48;
668
669
670 outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base);
671 outb_p(endcfg, e8390_base + EN0_DCFG);
672
673 outb_p(0x00, e8390_base + EN0_RCNTLO);
674 outb_p(0x00, e8390_base + EN0_RCNTHI);
675
676 outb_p(E8390_RXOFF, e8390_base + EN0_RXCR);
677 outb_p(E8390_TXOFF, e8390_base + EN0_TXCR);
678
679 outb_p(ei_local->tx_start_page, e8390_base + EN0_TPSR);
680 ei_local->tx1 = ei_local->tx2 = 0;
681 outb_p(ei_local->rx_start_page, e8390_base + EN0_STARTPG);
682 outb_p(ei_local->stop_page-1, e8390_base + EN0_BOUNDARY);
683 ei_local->current_page = ei_local->rx_start_page;
684 outb_p(ei_local->stop_page, e8390_base + EN0_STOPPG);
685
686 outb_p(0xFF, e8390_base + EN0_ISR);
687 outb_p(0x00, e8390_base + EN0_IMR);
688
689
690
691 cli();
692 outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base);
693 for(i = 0; i < 6; i++) {
694 outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS + i);
695 }
696 for(i = 0; i < 8; i++)
697 outb_p(0xff, e8390_base + EN1_MULT + i);
698
699 outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG);
700 outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base);
701 sti();
702 if (startp) {
703 outb_p(0xff, e8390_base + EN0_ISR);
704 outb_p(ENISR_ALL, e8390_base + EN0_IMR);
705 outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base);
706 outb_p(E8390_TXCONFIG, e8390_base + EN0_TXCR);
707
708 outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
709 }
710 return;
711 }
712
713
714 static void NS8390_trigger_send(struct device *dev, unsigned int length,
715 int start_page)
716 {
717 int e8390_base = dev->base_addr;
718
719 ei_status.txing = 1;
720 outb_p(E8390_NODMA+E8390_PAGE0, e8390_base);
721
722 if (inb_p(e8390_base) & E8390_TRANS) {
723 printk("%s: trigger_send() called with the transmitter busy.\n",
724 dev->name);
725 return;
726 }
727 outb_p(length & 0xff, e8390_base + EN0_TCNTLO);
728 outb_p(length >> 8, e8390_base + EN0_TCNTHI);
729 outb_p(start_page, e8390_base + EN0_TPSR);
730 outb_p(E8390_NODMA+E8390_TRANS+E8390_START, e8390_base);
731 return;
732 }
733
734
735
736
737
738
739
740
741