From 2819a016fc486ebfc271ce0fd465254dcc13380b Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 15 Feb 1994 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1994-02-15 --- carrera/screen.c | 2 ++ pc/ether509.c | 59 ++++++++++++++++++++++++++++++++++-------------- port/devproc.c | 2 +- port/qio.c | 2 +- 4 files changed, 46 insertions(+), 19 deletions(-) diff --git a/carrera/screen.c b/carrera/screen.c index 09f1def55c7806925a08e31b7cecf7ea964da443..b883f5454e8a2ad237556f18667fac5ca6755793 100644 --- a/carrera/screen.c +++ b/carrera/screen.c @@ -120,6 +120,8 @@ screenwin(void) Dac *d; ulong zbuf[16]; + memset(Screenvirt, 0, 3*1024*1024); + gtexture(&gscreen, gscreen.r, &bgrnd, S); w = defont0.info[' '].width; h = defont0.height; diff --git a/pc/ether509.c b/pc/ether509.c index b8c370885904ada960942fd8e8202ce7319de34a..c02dbb2c70fe0b224b9287b0a039aded7222b1cb 100644 --- a/pc/ether509.c +++ b/pc/ether509.c @@ -10,8 +10,7 @@ #include "etherif.h" enum { - IDport = 0x0100, /* anywhere between 0x0100 and 0x01F0 */ - + IDport = 0x0110, /* anywhere between 0x0100 and 0x01F0 */ /* Commands */ GlobalReset = 0x00, /* Global Reset */ SelectWindow = 0x01, /* SelectWindow command */ @@ -39,13 +38,13 @@ enum { Command = 0x0E, /* all windows */ Status = 0x0E, - EEPROMdata = 0x0C, /* window 0 */ - EEPROMcmd = 0x0A, - ResourceConfig = 0x08, - AddressConfig = 0x06, - ConfigControl = 0x04, + ManufacturerID = 0x00, /* window 0 */ ProductID = 0x02, - ManufacturerID = 0x00, + ConfigControl = 0x04, + AddressConfig = 0x06, + ResourceConfig = 0x08, + EEPROMcmd = 0x0A, + EEPROMdata = 0x0C, /* AddressConfig Bits */ XcvrTypeMask = 0xC000, /* Transceiver Type Select */ @@ -53,6 +52,10 @@ enum { XcvrAUI = 0x4000, XcvrBNC = 0xC000, + /* ConfigControl */ + Rst = 0x04, /* Reset Adapter */ + Ena = 0x01, /* Enable Adapter */ + TxFreeBytes = 0x0C, /* window 1 */ TxStatus = 0x0B, Timer = 0x0A, @@ -402,8 +405,7 @@ activate(void) * The data comes back 1 bit at a time. * We seem to need a delay here between reading the bits. * - * If the ID doesn't match, the adapter - * probably isn't there, so barf. + * If the ID doesn't match, there are no more adapters. */ outb(IDport, 0x87); for(x = 0, i = 0; i < 16; i++){ @@ -417,6 +419,7 @@ activate(void) /* * 3. Read the Address Configuration from the EEPROM. * The Address Configuration field is at offset 0x08 in the EEPROM). + * 6. Tag the adapter so it won't respond in future. * 6. Activate the adapter by writing the Activate command * (0xFF). */ @@ -426,6 +429,7 @@ activate(void) acr <<= 1; acr |= inb(IDport) & 0x01; } + outb(IDport, 0xD1); outb(IDport, 0xFF); /* @@ -435,7 +439,7 @@ activate(void) * Enable the adapter. */ port = (acr & 0x1F)*0x10 + 0x200; - outb(port+ConfigControl, 0x01); + outs(port+ConfigControl, Ena); return port; } @@ -443,18 +447,39 @@ activate(void) static ulong tcm509(Ether *ether) { - USED(ether); - return 0; - -#ifdef notdef + static int reset; ulong port; Adapter *ap; + /* + * One time only: + * write ID sequence to get the attention of all adapters; + * global-reset all adapters; + * untag all adapters. + */ + if(reset == 0){ + idseq(); + outb(IDport, 0xC0); + delay(2); + outb(IDport, 0xD0); + reset = 1; + } + + /* + * Attempt to activate adapters until one matches our + * address criteria. + */ while(port = activate()){ + if(ether->port == 0 || ether->port == port) + return port; + + ap = malloc(sizeof(Adapter)); + ap->port = port; + ap->next = adapter; + adapter = ap; } return 0; -#endif /* notdef */ } static ulong @@ -472,7 +497,7 @@ tcm579(Ether *ether) continue; COMMAND(port+0xC80, GlobalReset, 0); delay(1000); - outb(port+0xC80+ConfigControl, 0x01); + outs(port+0xC80+ConfigControl, Ena); COMMAND(port+0xC80, SelectWindow, 0); if(ether->port == 0 || ether->port == port) return port; diff --git a/port/devproc.c b/port/devproc.c index 0c4ce2a08dca61947d2c2ade93993f33e0755dfe..38114e89acc2dbe7665f845410bb1c1c663e8681 100644 --- a/port/devproc.c +++ b/port/devproc.c @@ -34,7 +34,7 @@ Dirtab procdir[] = "counters", {Qcounters}, 0, 0444, "ctl", {Qctl}, 0, 0000, "fpregs", {Qfpregs}, sizeof(FPsave), 0000, - "kregs", {Qkregs}, sizeof(Ureg), 0000, + "kregs", {Qkregs}, sizeof(Ureg), 0400, "mem", {Qmem}, 0, 0000, "note", {Qnote}, 0, 0000, "noteid", {Qnoteid}, 0, 0666, diff --git a/port/qio.c b/port/qio.c index 20e468cd6ec9d0c6b93e3e457a2161c9a5102b8e..e2e10a0ba987c112eab67ff19f0e418aa3620f5c 100644 --- a/port/qio.c +++ b/port/qio.c @@ -591,7 +591,7 @@ qnotfull(void *a) { Queue *q = a; - return q->len < q->limit; + return q->len < q->limit || (q->state & Qclosed); } /*