Set up ci_cpu_freq, ci_cycles_per_hz and ci_divisor_delay in curcpu()

from platform->clock.
This commit is contained in:
tsutsui 2005-10-30 04:31:22 +00:00
parent b894baa422
commit c0caafab2b
1 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.89 2005/09/29 10:39:43 tsutsui Exp $ */
/* $NetBSD: machdep.c,v 1.90 2005/10/30 04:31:22 tsutsui Exp $ */
/* $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $ */
/*
@ -78,7 +78,7 @@
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.89 2005/09/29 10:39:43 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.90 2005/10/30 04:31:22 tsutsui Exp $");
#include "fs_mfs.h"
#include "opt_ddb.h"
@ -362,6 +362,15 @@ mach_init(int argc, char *argv[], char *envv[])
(*platform->init)();
cpuspeed = platform->clock;
curcpu()->ci_cpu_freq = platform->clock * 1000000;
curcpu()->ci_cycles_per_hz = (curcpu()->ci_cpu_freq + hz / 2) / hz;
curcpu()->ci_divisor_delay =
((curcpu()->ci_cpu_freq + 500000) / 1000000);
if (mips_cpu_flags & CPU_MIPS_DOUBLE_COUNT) {
curcpu()->ci_cycles_per_hz /= 2;
curcpu()->ci_divisor_delay /= 2;
}
MIPS_SET_CI_RECIPRICAL(curcpu());
sprintf(cpu_model, "%s %s%s",
platform->vendor, platform->model, platform->variant);