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