From d58cfd17b00a5f5d9d8df46dccb720f469165593 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 29 Apr 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-04-29 --- pc/devhard.c | 21 +++++++++++++++++++-- pc/fns.h | 2 ++ pc/main.c | 7 ++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/pc/devhard.c b/pc/devhard.c index 8116c65b9ede31ad07253df418944ad9d27baf07..56a5b560a721a1cbc7520248a320568c6e63019f 100644 --- a/pc/devhard.c +++ b/pc/devhard.c @@ -35,6 +35,7 @@ enum Cread= 0x20, Cwrite= 0x30, Cident= 0xEC, + Cident2= 0xFF, /* pseudo command for post Cident interrupt */ Csetbuf= 0xEF, /* file types */ @@ -587,7 +588,16 @@ hardident(Drive *dp) error(Eio); } memmove(&dp->id, cp->buf, dp->bytes); - + /* + * this function appears to respond with an extra interrupt after + * the indent information is read, except on the safari. The following + * delay gives this extra interrupt a chance to happen while we are quiet. + * Otherwise, the interrupt may come during a subsequent read or write, + * causing a panic and much confusion. + */ + if (cp->cmd == Cident2) + tsleep(&cp->r, return0, 0, 10); + cp->cmd = 0; poperror(); qunlock(cp); } @@ -735,7 +745,10 @@ hardintr(Ureg *ur) cp->sofar++; if(cp->sofar >= cp->nsecs){ cp->lastcmd = cp->cmd; - cp->cmd = 0; + if (cp->cmd == Cread) + cp->cmd = 0; + else + cp->cmd = Cident2; wakeup(&cp->r); } break; @@ -744,6 +757,10 @@ hardintr(Ureg *ur) cp->cmd = 0; wakeup(&cp->r); break; + case Cident2: + cp->lastcmd = cp->cmd; + cp->cmd = 0; + break; case 0: print("interrupt cmd=0, lastcmd=%02x status=%02x\n", cp->lastcmd, cp->status); diff --git a/pc/fns.h b/pc/fns.h index 598720c59171c5b8af415782abcbba750d5c7706..e975ede15494fc8b6fee781a7064224cfb894378 100644 --- a/pc/fns.h +++ b/pc/fns.h @@ -7,6 +7,7 @@ void bootargs(ulong); void clock(Ureg*); void clockinit(void); void config(int); +void confinit1(void); int cpuspeed(int); void delay(int); void dmaend(int); @@ -32,6 +33,7 @@ void idle(void); int inb(int); void inss(int, void*, int); void kbdinit(void); +void ksetpcinfo(void); void mathinit(void); void mmuinit(void); int modem(int); diff --git a/pc/main.c b/pc/main.c index a95c1276713be6efdca8337b74cb1c3b9b0a4084..c1bfe00fca22a92985dccdd0602e56a8d523aafb 100644 --- a/pc/main.c +++ b/pc/main.c @@ -89,7 +89,7 @@ init0(void) chandevinit(); if(!waserror()){ - ksetterm("at&t %s"); + ksetpcinfo(); ksetenv("cputype", "386"); poperror(); } @@ -206,7 +206,7 @@ confinit(void) /* * the first 640k is the standard useful memory * the next 128K is the display - * the last 256k belongs to the roms + * the last 256k belongs to the roms and other devices */ conf.npage0 = 640/4; conf.base0 = 0; @@ -275,9 +275,10 @@ confinit(void) conf.arp = 32; conf.frag = 32; conf.cntrlp = 0; - conf.nfloppy = 1; + conf.nfloppy = 2; conf.nhard = 1; conf.dkif = 1; + confinit1(); } char *mathmsg[] =