diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-08-25 08:00:10 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-08-25 08:00:10 +0000 |
commit | 1462321a7eb4afd69017e16f256fdcdef72de02f (patch) | |
tree | 71e255720ecae3e9a216355fceb3c746084b11d9 /sys | |
parent | d9fb74324ae0d45c7232456e4a7240de3a6fb36d (diff) |
Use a simpler delay() routine for MVME188, from Mach via Luna88k
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mvme88k/dev/clock.c | 12 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore.S | 30 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 14 |
3 files changed, 39 insertions, 17 deletions
diff --git a/sys/arch/mvme88k/dev/clock.c b/sys/arch/mvme88k/dev/clock.c index b964137b67c..98a4bd98dbb 100644 --- a/sys/arch/mvme88k/dev/clock.c +++ b/sys/arch/mvme88k/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.38 2004/08/24 22:01:29 miod Exp $ */ +/* $OpenBSD: clock.c,v 1.39 2004/08/25 08:00:06 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1995 Theo de Raadt @@ -580,15 +580,9 @@ void delay(int us) { if (brdtyp == BRD_188) { - extern int cpuspeed; + extern void m188_delay(int); - /* - * Unable to use a real timer, use a tight loop. - * XXX not accurate! - */ - volatile int c = (3 * us) / (cpuspeed == 25 ? 4 : 5); - while (--c > 0) - ; + m188_delay(us); } else { /* * On MVME187 and MVME197, use the VMEchip for the diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S index 3c5a05886f9..62c3b7468a5 100644 --- a/sys/arch/mvme88k/mvme88k/locore.S +++ b/sys/arch/mvme88k/mvme88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.37 2004/08/09 20:52:11 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.38 2004/08/25 08:00:08 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -406,6 +406,34 @@ GLOBAL(spin_cpu) tb0 0, r0, 0x200-16 /* call 188Bug */ jmp r1 +#ifdef MVME188 +/* + * void m188_delay(int us) + * + * The processor loops (busy waits) for the given number of microseconds: + * Thus, delay(1000000) will delay for one second. + * (originally from Mach 2.5) + * + * REGISTER USAGE: + * IN r1 - return address + * IN r2 - number of microseconds + * r3 - cpu speed in MHz + * r4 - number of cycles to delay + */ +GLOBAL(m188_delay) + or.u r3, r0, hi16(_cpuspeed) + ld r3, r3, lo16(_cpuspeed) + mul r4, r2, r3 + subu r4, r4, 4 /* overhead of these instructions */ + + /* now loop for the given number of cycles */ +1: + bcnd.n gt0, r4, 1b + subu r4, r4, 2 /* two cycles per iteration */ + + jmp r1 +#endif + /*****************************************************************************/ data diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 4f92e02a7f7..a66011171c8 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.154 2004/08/02 14:38:42 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.155 2004/08/25 08:00:09 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -233,12 +233,12 @@ char cpu_model[120]; extern char *esym; #endif -int boothowto; /* set in locore.S */ -int bootdev; /* set in locore.S */ -int cputyp; /* set in locore.S */ -int brdtyp; /* set in locore.S */ -int cpumod; /* set in mvme_bootstrap() */ -int cpuspeed; +int boothowto; /* set in locore.S */ +int bootdev; /* set in locore.S */ +int cputyp; /* set in locore.S */ +int brdtyp; /* set in locore.S */ +int cpumod; /* set in mvme_bootstrap() */ +int cpuspeed = 25; /* safe guess */ vaddr_t first_addr; vaddr_t last_addr; |