M pc/devhard.c => pc/devhard.c +19 -2
@@ 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);
M pc/fns.h => pc/fns.h +2 -0
@@ 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);
M pc/main.c => pc/main.c +4 -3
@@ 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[] =