Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sgimips/sgimips Initialize ci_divisor_delay by temp...



details:   https://anonhg.NetBSD.org/src/rev/3e1e79331fbb
branches:  trunk
changeset: 433328:3e1e79331fbb
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Sep 08 02:33:33 2018 +0000

description:
Initialize ci_divisor_delay by temporary cpufreq for early delay(9) calls.

This is actually required for Indigo R3k.
Reported by Naruaki Etomi in PR port-sgimips/53520.

diffstat:

 sys/arch/sgimips/sgimips/machdep.c |  23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diffs (44 lines):

diff -r e75e61e5bfbb -r 3e1e79331fbb sys/arch/sgimips/sgimips/machdep.c
--- a/sys/arch/sgimips/sgimips/machdep.c        Sat Sep 08 00:51:57 2018 +0000
+++ b/sys/arch/sgimips/sgimips/machdep.c        Sat Sep 08 02:33:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.146 2018/09/02 09:57:33 tsutsui Exp $    */
+/*     $NetBSD: machdep.c,v 1.147 2018/09/08 02:33:33 tsutsui Exp $    */
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.146 2018/09/02 09:57:33 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.147 2018/09/08 02:33:33 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -334,6 +334,25 @@
        curcpu()->ci_cpu_freq = strtoul(cpufreq, NULL, 10) * 1000000;
 
        /*
+        * Also initialize ci members for delay and clock by the temporary
+        * ci_cpu_freq value for early use of delay(9).
+        * These values will be calibrated later in MD code:
+        *  - int_attach() in dev/int.c for IP6/10/12/20/22
+        *  - crime_attach() in dev/crime.c for IP32
+        *
+        * XXX: ci_divisor_delay is for mips3_delay() in mips/mips3_clock.c
+        *      but sgimips abuse it as "instructions per microsecond"
+        *      for traditional delay(9) implementation derived from
+        *      4.4BSD/mips (also used in pmax and news3400).
+        *      (see sys/arch/mips/mips/mips_mcclock.c etc.)
+        *
+        * Note ci_cycles_per_hz is for mips3_clockintr.c for MIPS3 so
+        * there is no early use, but initialize it as a sane default.
+        */
+       curcpu()->ci_cycles_per_hz = curcpu()->ci_cpu_freq / (2 * hz);
+       curcpu()->ci_divisor_delay = curcpu()->ci_cpu_freq / (2 * 1000000);
+
+       /*
         * Check machine (IPn) type.
         *
         * Note even on IP12 (which doesn't have ARCBIOS),



Home | Main Index | Thread Index | Old Index