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