From 3500ea91925c21d8f2c5784094a5014ac9b7d5be Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 13 Feb 1993 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1993-02-13 --- pc/ether503.c | 10 ++++----- pc/ether8390.c | 59 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/pc/ether503.c b/pc/ether503.c index 396060705225894b5fc949e04f15514482f756a7..2096b6ec1d7962a4097a1edfa28e710fd80c4331 100644 --- a/pc/ether503.c +++ b/pc/ether503.c @@ -109,12 +109,12 @@ static Table table[] = { { 0x300, Irq2, 0, }, /* external transceiver */ { 0x310, Irq3, 0, }, { 0x330, Irq4, 0, }, - { 0x350, Irq5, 0, }, - { 0x250, Irq2, 1, }, /* BNC */ - { 0x280, Irq3, 1, }, - { 0x2A0, Irq4, 1, }, - { 0x2E0, Irq5, 1, }, + { 0x350, Irq5, Xsel, }, /* BNC */ + { 0x250, Irq2, Xsel, }, + { 0x280, Irq3, Xsel, }, + { 0x2A0, Irq4, Xsel, }, + { 0x2E0, Irq5, Xsel, }, { 0 }, }; diff --git a/pc/ether8390.c b/pc/ether8390.c index 073e86eb064ca819796b19ed765aeeab57dedd93..475e8aed96fd3bd9821f791c86dc42cd0089a0d1 100644 --- a/pc/ether8390.c +++ b/pc/ether8390.c @@ -213,7 +213,7 @@ dp8390reset(Ctlr *ctlr) /* * Leave the chip initialised, - * but in internal loopback mode. + * but in monitor mode. */ dp8390outb(ctlr->card.dp8390+Cr, Page0|RDMAabort|Sta); } @@ -224,9 +224,11 @@ dp8390attach(Ctlr *ctlr) /* * Enable the chip for transmit/receive. * The init routine leaves the chip in monitor - * mode. + * mode. Clear the missed-packet counter, it + * increments while in monitor mode. */ dp8390outb(ctlr->card.dp8390+Rcr, Ab); + dp8390inb(ctlr->card.dp8390+Cntr2); } void @@ -393,6 +395,31 @@ getcurr(Ctlr *ctlr) return curr; } +static void +cldaquiet(Ctlr *ctlr) +{ + uchar a, b, c; + + /* + * Hack to keep away from the card's memory while it is receiving + * a packet. This is only a problem on the NCR 3170 Safari. + * + * We peek at the current local DMA registers and, if they are + * changing, wait. + */ + + for(;;delay(10)){ + a = dp8390inb(ctlr->card.dp8390+Clda0); + b = dp8390inb(ctlr->card.dp8390+Clda0); + if(a != b) + continue; + c = dp8390inb(ctlr->card.dp8390+Clda0); + if(c != b) + continue; + break; + } +} + void dp8390receive(Ctlr *ctlr) { @@ -402,27 +429,8 @@ dp8390receive(Ctlr *ctlr) ulong data, len; for(curr = getcurr(ctlr); ctlr->card.nxtpkt != curr; curr = getcurr(ctlr)){ - /* - * Hack to keep away from the card's memory while it is receiving - * a packet. This is only a problem on the NCR 3170 Safari. - * - * We peek at the current local DMA registers and, if they are - * changing, wait. - */ - if(strcmp(arch->id, "NCRD.0") == 0){ - uchar a, b, c; - - for(;;delay(10)){ - a = dp8390inb(ctlr->card.dp8390+Clda0); - b = dp8390inb(ctlr->card.dp8390+Clda0); - if(a != b) - continue; - c = dp8390inb(ctlr->card.dp8390+Clda0); - if(c != b) - continue; - break; - } - } + if(strcmp(arch->id, "NCRD.0") == 0) + cldaquiet(ctlr); ctlr->inpackets++; @@ -506,11 +514,14 @@ dp8390transmit(Ctlr *ctlr) ring = &ctlr->tb[ctlr->ti]; if(ctlr->tbusy == 0 && ring->owner == Interface){ + + ctlr->tbusy = 1; + (*ctlr->card.write)(ctlr, ctlr->card.tstart*Dp8390BufSz, ring->pkt, ring->len); + dp8390outb(ctlr->card.dp8390+Tbcr0, ring->len & 0xFF); dp8390outb(ctlr->card.dp8390+Tbcr1, (ring->len>>8) & 0xFF); dp8390outb(ctlr->card.dp8390+Cr, Page0|RDMAabort|Txp|Sta); - ctlr->tbusy = 1; } }