Fix kernel boot issue on cats. The delay(9) loop, used before the clock device is probed and a hardware timer is available, was out by a factor of 625. This wasn't an issue until revision 1.45 of sys/dev/ic/pckbc.c which switched to using delay(9) when polling the keyboard controller. Cats attaches the console (and pckbc) before the clock has been probed, and so the delay loop code is used causing issue with the keyboard polling.diff -r1.24 -r1.25 src/sys/arch/arm/footbridge/footbridge_clock.c
(chris)
--- src/sys/arch/arm/footbridge/footbridge_clock.c 2007/12/03 15:33:17 1.24
+++ src/sys/arch/arm/footbridge/footbridge_clock.c 2008/09/20 14:53:37 1.25
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: footbridge_clock.c,v 1.24 2007/12/03 15:33:17 ad Exp $ */ | 1 | /* $NetBSD: footbridge_clock.c,v 1.25 2008/09/20 14:53:37 chris Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997 Mark Brinicombe. | 4 | * Copyright (c) 1997 Mark Brinicombe. | |
5 | * Copyright (c) 1997 Causality Limited. | 5 | * Copyright (c) 1997 Causality Limited. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 25 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
26 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 26 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
27 | * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | 27 | * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
28 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 28 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
29 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 29 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
34 | * SUCH DAMAGE. | 34 | * SUCH DAMAGE. | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: footbridge_clock.c,v 1.24 2007/12/03 15:33:17 ad Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: footbridge_clock.c,v 1.25 2008/09/20 14:53:37 chris Exp $"); | |
39 | 39 | |||
40 | /* Include header files */ | 40 | /* Include header files */ | |
41 | 41 | |||
42 | #include <sys/types.h> | 42 | #include <sys/types.h> | |
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/kernel.h> | 45 | #include <sys/kernel.h> | |
46 | #include <sys/time.h> | 46 | #include <sys/time.h> | |
47 | #include <sys/timetc.h> | 47 | #include <sys/timetc.h> | |
48 | #include <sys/device.h> | 48 | #include <sys/device.h> | |
49 | 49 | |||
50 | #include <machine/intr.h> | 50 | #include <machine/intr.h> | |
51 | 51 | |||
@@ -365,27 +365,33 @@ delay(unsigned n) | @@ -365,27 +365,33 @@ delay(unsigned n) | |||
365 | return; | 365 | return; | |
366 | 366 | |||
367 | /* | 367 | /* | |
368 | * not calibrated the timer yet, so try to live with this horrible | 368 | * not calibrated the timer yet, so try to live with this horrible | |
369 | * loop! | 369 | * loop! | |
370 | * | 370 | * | |
371 | * Note: a much better solution might be to have the timers | 371 | * Note: a much better solution might be to have the timers | |
372 | * get get calibrated out of mach_init. Of course, the | 372 | * get get calibrated out of mach_init. Of course, the | |
373 | * clock_sc needs to be set up, so we can read/write the clock | 373 | * clock_sc needs to be set up, so we can read/write the clock | |
374 | * registers. | 374 | * registers. | |
375 | */ | 375 | */ | |
376 | if (!delay_count_per_usec) | 376 | if (!delay_count_per_usec) | |
377 | { | 377 | { | |
378 | int delaycount = 25000; | 378 | /* | |
379 | * the loop below has a core of 6 instructions | |||
380 | * StrongArms top out at 233Mhz, so one instruction takes | |||
381 | * 0.004 us, and 6 take 0.025 us, so we need to loop 40 | |||
382 | * times to make one usec | |||
383 | */ | |||
384 | int delaycount = 40; | |||
379 | volatile int i; | 385 | volatile int i; | |
380 | 386 | |||
381 | while (n-- > 0) { | 387 | while (n-- > 0) { | |
382 | for (i = delaycount; --i;); | 388 | for (i = delaycount; --i;); | |
383 | } | 389 | } | |
384 | return; | 390 | return; | |
385 | } | 391 | } | |
386 | 392 | |||
387 | last = bus_space_read_4(clock_sc->sc_iot, clock_sc->sc_ioh, | 393 | last = bus_space_read_4(clock_sc->sc_iot, clock_sc->sc_ioh, | |
388 | TIMER_3_VALUE); | 394 | TIMER_3_VALUE); | |
389 | delta = usecs = 0; | 395 | delta = usecs = 0; | |
390 | 396 | |||
391 | while (n > usecs) { | 397 | while (n > usecs) { |