From 65f94796edf400666e966d5ecfa2ac4598e7067d Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 28 Apr 1994 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1994-04-28 --- carrera/io.h | 6 +++--- carrera/kbd.c | 2 +- pc/devhard.c | 20 ++++++++++++++------ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/carrera/io.h b/carrera/io.h index 33caf3486656e904ca213d25d445e7c4304ee296..a7eb9e140adc98923e9353a00e0161d0fe299140 100644 --- a/carrera/io.h +++ b/carrera/io.h @@ -65,9 +65,9 @@ enum Promvirt = 0xE1000000, /* From ARCS chipset */ Promphys = 0x1FC00000, /* MIPs processors */ - Ttbr = 0x8000001C, /* Translation table base address */ - Tlrb = 0x80000024, /* Translation table limit address */ - Tir = 0x8000002c, /* Translation invalidate register */ + Ttbr = 0xE000001C, /* Translation table base address */ + Tlrb = 0xE0000024, /* Translation table limit address */ + Tir = 0xE000002C, /* Translation invalidate register */ Ntranslation = 4096, /* Number of translation registers */ }; diff --git a/carrera/kbd.c b/carrera/kbd.c index 4a87f318f4cf7873d556f7d49204fc4477216fd3..76282160022b8a74679334de21ccc641405f8f54 100644 --- a/carrera/kbd.c +++ b/carrera/kbd.c @@ -369,7 +369,7 @@ int kbdinit(void) { int i; -return 0; + /* * empty the buffer */ diff --git a/pc/devhard.c b/pc/devhard.c index 6eb88003abe90f286a2e309366adbc54b3a63abd..66d9d14cbf481c2a2a0037c28f3f5573c371c857 100644 --- a/pc/devhard.c +++ b/pc/devhard.c @@ -432,13 +432,21 @@ cmddone(void *a) * wait for the controller to be ready to accept a command */ static void -cmdreadywait(Controller *cp) +cmdreadywait(Drive *dp) { long start; + int period; + Controller *cp = dp->cp; + + /* give it 2 seconds to spin down and up */ + if(dp->state == Sspinning) + period = 10; + else + period = 2000; start = m->ticks; while((inb(cp->pbase+Pstatus) & (Sready|Sbusy)) != Sready) - if(TK2MS(m->ticks - start) > 10){ + if(TK2MS(m->ticks - start) > period){ DPRINT("cmdreadywait failed\n"); error(Eio); } @@ -502,7 +510,7 @@ hardxfer(Drive *dp, Partition *pp, int cmd, long start, long len, char *buf) nexterror(); } - cmdreadywait(cp); + cmdreadywait(dp); /* * splhi to make command atomic @@ -582,7 +590,7 @@ hardsetbuf(Drive *dp, int on) nexterror(); } - cmdreadywait(cp); + cmdreadywait(dp); cp->cmd = Csetbuf; outb(cp->pbase+Pprecomp, on ? 0xAA : 0x55); @@ -656,7 +664,7 @@ hardident(Drive *dp) nexterror(); } - cmdreadywait(cp); + cmdreadywait(dp); s = splhi(); cp->nsecs = 1; @@ -716,7 +724,7 @@ hardprobe(Drive *dp, int cyl, int sec, int head) nexterror(); } - cmdreadywait(cp); + cmdreadywait(dp); cp->cmd = Cread; cp->dp = dp;