From 194add6117dd4b0cbb1d2101d22f635c4d374095 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 5 Oct 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-10-05 --- pc/devi82365.c | 77 +++++++++++++++++++++++++++++++++----------------- pc/mouse.c | 4 --- 2 files changed, 51 insertions(+), 30 deletions(-) diff --git a/pc/devi82365.c b/pc/devi82365.c index 58c89a41b2c22c7695ad7496dd5c50b6d61446c8..f84e17b19edd0fabc4f334a7bd6a3a6f637642fc 100644 --- a/pc/devi82365.c +++ b/pc/devi82365.c @@ -121,6 +121,7 @@ struct I82365 int nslot; int xreg; /* index register address */ int dreg; /* data register address */ + int irq; }; static I82365 *controller[4]; static int ncontroller; @@ -259,13 +260,20 @@ slotena(Slot *pp) if(pp->enabled) return; +print("-enabling<"); /* power up and unreset, wait's are empirical (???) */ wrreg(pp, Rpc, Fautopower|Foutena|Fcardena); +print(">"); delay(300); +print("<"); wrreg(pp, Rigc, 0); +print(">"); delay(100); +print("<"); wrreg(pp, Rigc, Fnotreset); +print(">"); delay(500); +print("..."); /* get configuration */ slotinfo(pp); @@ -274,6 +282,7 @@ slotena(Slot *pp) pp->enabled = 1; } else wrreg(pp, Rpc, Fautopower); +print("done-"); } /* @@ -439,20 +448,24 @@ pcmspecial(char *idstr, ISAConf *isa) extern char *strstr(char*, char*); i82365reset(); +print("Looking for %s ...", idstr); for(pp = slot; pp < lastslot; pp++){ if(pp->special) continue; /* already taken */ increfp(pp); - if(pp->occupied) - if(strstr(pp->verstr, idstr)) - if(isa == 0 || pcmio(pp->slotno, isa) == 0){ - pp->special = 1; - return pp->slotno; + if(pp->occupied) { +print("[%s] ", pp->verstr); + if(strstr(pp->verstr, idstr)) + if(isa == 0 || pcmio(pp->slotno, isa) == 0){ + pp->special = 1; +print("done\n"); + return pp->slotno; + } } - decrefp(pp); } +print("not found\n"); return -1; } @@ -531,10 +544,12 @@ static char *chipname[] = }; static I82365* -i82386probe(int x, int d, int dev) +i82365probe(int x, int d, int dev) { uchar c, id; I82365 *cp; + ISAConf isa; + int i, nslot; outb(x, Rid + (dev<<7)); id = inb(d); @@ -592,6 +607,21 @@ i82386probe(int x, int d, int dev) c = inb(d); outb(d, c & ~Flowpow); + memset(&isa, 0, sizeof(ISAConf)); + if(isaconfig("pcmcia", ncontroller, &isa) && isa.irq) + cp->irq = isa.irq; + else + cp->irq = IrqPCMCIA; + + for(i = 0; i < isa.nopt; i++){ + if(cistrncmp(isa.opt[i], "nslot=", 6)) + continue; + nslot = strtol(&isa.opt[i][6], nil, 0); + if(nslot > 0 && nslot <= 2) + cp->nslot = nslot; + } +print("%uX/%d: nslot = %d\n", x, dev, cp->nslot); + controller[ncontroller++] = cp; return cp; } @@ -618,31 +648,26 @@ static void i82365reset(void) { static int already; - int i, j, irq; + int i, j; I82365 *cp; Slot *pp; - ISAConf isa; + char buf[NAMELEN]; if(already) return; already = 1; - memset(&isa, 0, sizeof(ISAConf)); - irq = IrqPCMCIA; - if(isaconfig("pcmcia", 0, &isa) && isa.irq) - irq = isa.irq; - /* look for controllers if the ports aren't already taken */ - if(ioalloc(0x3E0, 2, 0, "i82386.0") >= 0){ - i82386probe(0x3E0, 0x3E1, 0); - i82386probe(0x3E0, 0x3E1, 1); + if(ioalloc(0x3E0, 2, 0, "i82365.0") >= 0){ + i82365probe(0x3E0, 0x3E1, 0); + i82365probe(0x3E0, 0x3E1, 1); if(ncontroller == 0) iofree(0x3E0); } - if(ioalloc(0x3E2, 2, 0, "i82386.1") >= 0){ + if(ioalloc(0x3E2, 2, 0, "i82365.1") >= 0){ i = ncontroller; - i82386probe(0x3E2, 0x3E3, 0); - i82386probe(0x3E2, 0x3E3, 1); + i82365probe(0x3E2, 0x3E3, 0); + i82365probe(0x3E2, 0x3E3, 1); if(ncontroller == i) iofree(0x3E2); } @@ -655,7 +680,7 @@ i82365reset(void) for(i = 0; i < ncontroller; i++){ cp = controller[i]; print("#y%d: %d slot %s: port 0x%uX irq %d\n", - i, cp->nslot, chipname[cp->type], cp->xreg, irq); + i, cp->nslot, chipname[cp->type], cp->xreg, cp->irq); for(j = 0; j < cp->nslot; j++){ pp = lastslot++; pp->slotno = pp - slot; @@ -665,14 +690,14 @@ i82365reset(void) slotdis(pp); /* interrupt on status change */ - wrreg(pp, Rcscic, (irq<<4) | Fchangeena); + wrreg(pp, Rcscic, (cp->irq<<4) | Fchangeena); rdreg(pp, Rcsc); } - } - /* for card management interrupts */ - if(ncontroller) - intrenable(irq, i82365intr, 0, BUSUNKNOWN, "i82365"); + /* for card management interrupts */ + sprint(buf, "i82365.%d", i); + intrenable(cp->irq, i82365intr, 0, BUSUNKNOWN, buf); + } } static Chan* diff --git a/pc/mouse.c b/pc/mouse.c index bcc1a8ec74c9470057ba0142bcc245c5984b0d08..e895cbfcbc41f5a9c62c4861d9aa2c0abeb20214 100644 --- a/pc/mouse.c +++ b/pc/mouse.c @@ -101,10 +101,6 @@ ps2mouse(void) mousetype = MousePS2; } -static int intellimouse; -static int resolution; -static int accelerated; - static void setaccelerated(int x) {