Remove all initialization of obsolete ci_divisor_recip in

mips struct cpu_info and related macroes.
The member was prepared for a hack in MD microtime(9) implementation
but it has been superseded by MI timecounter(9).
This commit is contained in:
tsutsui 2008-05-26 15:59:29 +00:00
parent 46540aaf0e
commit 40f5425d58
15 changed files with 35 additions and 89 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: algor_p4032_intr.c,v 1.19 2008/04/28 20:23:10 martin Exp $ */
/* $NetBSD: algor_p4032_intr.c,v 1.20 2008/05/26 15:59:29 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: algor_p4032_intr.c,v 1.19 2008/04/28 20:23:10 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: algor_p4032_intr.c,v 1.20 2008/05/26 15:59:29 tsutsui Exp $");
#include "opt_ddb.h"
@ -330,7 +330,6 @@ algor_p4032_cal_timer(bus_space_tag_t st, bus_space_handle_t sh)
/* XXX assume CPU_MIPS_DOUBLE_COUNT */
curcpu()->ci_cycles_per_hz /= 2;
curcpu()->ci_divisor_delay /= 2;
MIPS_SET_CI_RECIPROCAL(curcpu());
printf("Timer calibration: %lu cycles/sec [(%lu, %lu) * 16]\n",
cps, ctrdiff[2], ctrdiff[3]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: algor_p5064_intr.c,v 1.22 2008/04/28 20:23:10 martin Exp $ */
/* $NetBSD: algor_p5064_intr.c,v 1.23 2008/05/26 15:59:29 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: algor_p5064_intr.c,v 1.22 2008/04/28 20:23:10 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: algor_p5064_intr.c,v 1.23 2008/05/26 15:59:29 tsutsui Exp $");
#include "opt_ddb.h"
@ -423,7 +423,6 @@ algor_p5064_cal_timer(bus_space_tag_t st, bus_space_handle_t sh)
/* XXX assume CPU_MIPS_DOUBLE_COUNT */
curcpu()->ci_cycles_per_hz /= 2;
curcpu()->ci_divisor_delay /= 2;
MIPS_SET_CI_RECIPROCAL(curcpu());
printf("Timer calibration: %lu cycles/sec [(%lu, %lu) * 16]\n",
cps, ctrdiff[2], ctrdiff[3]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: algor_p6032_intr.c,v 1.15 2008/04/28 20:23:10 martin Exp $ */
/* $NetBSD: algor_p6032_intr.c,v 1.16 2008/05/26 15:59:29 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: algor_p6032_intr.c,v 1.15 2008/04/28 20:23:10 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: algor_p6032_intr.c,v 1.16 2008/05/26 15:59:29 tsutsui Exp $");
#include "opt_ddb.h"
@ -291,7 +291,6 @@ algor_p6032_cal_timer(bus_space_tag_t st, bus_space_handle_t sh)
/* XXX assume CPU_MIPS_DOUBLE_COUNT */
curcpu()->ci_cycles_per_hz /= 2;
curcpu()->ci_divisor_delay /= 2;
MIPS_SET_CI_RECIPROCAL(curcpu());
printf("Timer calibration: %lu cycles/sec [(%lu, %lu) * 16]\n",
cps, ctrdiff[2], ctrdiff[3]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.110 2008/01/09 20:38:34 wiz Exp $ */
/* $NetBSD: machdep.c,v 1.111 2008/05/26 15:59:29 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.110 2008/01/09 20:38:34 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.111 2008/05/26 15:59:29 tsutsui Exp $");
#include "fs_mfs.h"
#include "opt_ddb.h"
@ -402,7 +402,6 @@ mach_init(int argc, char *argv[], u_int bim, void *bip)
curcpu()->ci_cycles_per_hz /= 2;
curcpu()->ci_divisor_delay /= 2;
}
MIPS_SET_CI_RECIPROCAL(curcpu());
sprintf(cpu_model, "%s %s%s",
platform->vendor, platform->model, platform->variant);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.96 2008/05/14 13:29:27 tsutsui Exp $ */
/* $NetBSD: machdep.c,v 1.97 2008/05/26 15:59:29 tsutsui Exp $ */
/*-
* Copyright (c) 2006 Izumi Tsutsui. All rights reserved.
@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.96 2008/05/14 13:29:27 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.97 2008/05/26 15:59:29 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -253,7 +253,6 @@ mach_init(unsigned int memsize, u_int bim, char *bip)
/* all models have Rm5200, which is CPU_MIPS_DOUBLE_COUNT */
curcpu()->ci_cycles_per_hz /= 2;
curcpu()->ci_divisor_delay /= 2;
MIPS_SET_CI_RECIPROCAL(curcpu());
physmem = btoc(memsize - MIPS_KSEG0_START);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.4 2008/01/09 20:38:35 wiz Exp $ */
/* $NetBSD: machdep.c,v 1.5 2008/05/26 15:59:29 tsutsui Exp $ */
/*-
* Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.4 2008/01/09 20:38:35 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.5 2008/05/26 15:59:29 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -199,7 +199,6 @@ adm5120_setcpufreq(void)
curcpu()->ci_cpu_freq = freq;
curcpu()->ci_cycles_per_hz = (freq + hz / 2) / hz / 2;
curcpu()->ci_divisor_delay = ((freq + 500000) / 1000000) / 2;
MIPS_SET_CI_RECIPROCAL(curcpu());
}
void mach_init(int, char **, void *, void *); /* XXX */

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.11 2008/03/08 05:05:25 imp Exp $ */
/* $NetBSD: machdep.c,v 1.12 2008/05/26 15:59:29 tsutsui Exp $ */
/*
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@ -147,7 +147,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.11 2008/03/08 05:05:25 imp Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.12 2008/05/26 15:59:29 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -213,9 +213,8 @@ cal_timer(void)
curcpu()->ci_cycles_per_hz = (cntfreq + hz / 2) / hz;
/* XXX: i don't understand this logic, it was borrowed from Malta */
/* Compute number of cycles per 1us (1/MHz). 0.5MHz is for roundup. */
curcpu()->ci_divisor_delay = ((cntfreq + 500000) / 1000000);
MIPS_SET_CI_RECIPROCAL(curcpu());
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: yamon.c,v 1.10 2008/01/09 20:38:35 wiz Exp $ */
/* $NetBSD: yamon.c,v 1.11 2008/05/26 15:59:29 tsutsui Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -38,7 +38,7 @@
/* XXX move to arch/mips/yamon/yamon.c or similar? */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: yamon.c,v 1.10 2008/01/09 20:38:35 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: yamon.c,v 1.11 2008/05/26 15:59:29 tsutsui Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -153,7 +153,6 @@ yamon_setcpufreq(int force)
curcpu()->ci_cycles_per_hz /= 2;
curcpu()->ci_divisor_delay /= 2;
}
MIPS_SET_CI_RECIPROCAL(curcpu());
return ret;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: malta_intr.c,v 1.18 2008/01/09 20:38:35 wiz Exp $ */
/* $NetBSD: malta_intr.c,v 1.19 2008/05/26 15:59:29 tsutsui Exp $ */
/*
* Copyright 2001, 2002 Wasabi Systems, Inc.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: malta_intr.c,v 1.18 2008/01/09 20:38:35 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: malta_intr.c,v 1.19 2008/05/26 15:59:29 tsutsui Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -193,10 +193,9 @@ malta_cal_timer(bus_space_tag_t st, bus_space_handle_t sh)
/* Compute the number of ticks for hz. */
curcpu()->ci_cycles_per_hz = (curcpu()->ci_cpu_freq + hz / 2) / hz;
/* Compute the delay divisor and reciprocal. */
/* Compute the delay divisor. */
curcpu()->ci_divisor_delay =
((curcpu()->ci_cpu_freq + 500000) / 1000000);
MIPS_SET_CI_RECIPROCAL(curcpu());
/*
* Get correct cpu frequency if the CPU runs at twice the

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.12 2008/04/28 20:23:18 martin Exp $ */
/* $NetBSD: machdep.c,v 1.13 2008/05/26 15:59:29 tsutsui Exp $ */
/*-
* Copyright (c) 2001, 2004, 2005 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.12 2008/04/28 20:23:18 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.13 2008/05/26 15:59:29 tsutsui Exp $");
#include "opt_ddb.h"
@ -153,7 +153,6 @@ mach_init(int argc, char *argv[], struct bootinfo *bi)
curcpu()->ci_cycles_per_hz /= 2;
curcpu()->ci_divisor_delay /= 2;
}
MIPS_SET_CI_RECIPROCAL(curcpu());
/* Load memory to UVM */
for (i = 1; i < mem_cluster_cnt; i++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: au_timer.c,v 1.8 2008/01/09 20:38:35 wiz Exp $ */
/* $NetBSD: au_timer.c,v 1.9 2008/05/26 15:59:30 tsutsui Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: au_timer.c,v 1.8 2008/01/09 20:38:35 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: au_timer.c,v 1.9 2008/05/26 15:59:30 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -118,24 +118,6 @@ au_cal_timers(bus_space_tag_t st, bus_space_handle_t sh)
curcpu()->ci_divisor_delay =
((curcpu()->ci_cpu_freq + 500000) / 1000000);
/*
* To implement a more accurate microtime using the CP0 COUNT
* register we need to divide that register by the number of
* cycles per MHz. But...
*
* DIV and DIVU are expensive on MIPS (eg 75 clocks on the
* R4000). MULT and MULTU are only 12 clocks on the same CPU.
* On the SB1 these appear to be 40-72 clocks for DIV/DIVU and 3
* clocks for MUL/MULTU.
*
* The strategy we use to to calculate the reciprocal of cycles
* per MHz, scaled by 1<<32. Then we can simply issue a MULTU
* and pluck of the HI register and have the results of the
* division.
*/
curcpu()->ci_divisor_recip =
0x100000000ULL / curcpu()->ci_divisor_delay;
/*
* Get correct cpu frequency if the CPU runs at twice the
* external/cp0-count frequency.

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.89 2008/02/27 18:26:16 xtraeme Exp $ */
/* $NetBSD: cpu.h,v 1.90 2008/05/26 15:59:29 tsutsui Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -58,8 +58,7 @@ struct cpu_info {
u_long ci_cpu_freq; /* CPU frequency */
u_long ci_cycles_per_hz; /* CPU freq / hz */
u_long ci_divisor_delay; /* for delay/DELAY */
u_long ci_divisor_recip; /* scaled reciprocal of previous;
see below */
u_long ci_divisor_recip; /* unused, for obsolete microtime(9) */
struct lwp *ci_curlwp; /* currently running lwp */
struct lwp *ci_fpcurlwp; /* the current FPU owner */
int ci_want_resched; /* user preemption pending */
@ -72,28 +71,6 @@ struct cpu_info {
#define CPU_INFO_FOREACH(cii, ci) \
(void)(cii), ci = &cpu_info_store; ci != NULL; ci = ci->ci_next
/*
* To implement a more accurate microtime using the CP0 COUNT register
* we need to divide that register by the number of cycles per MHz.
* But...
*
* DIV and DIVU are expensive on MIPS (eg 75 clocks on the R4000). MULT
* and MULTU are only 12 clocks on the same CPU.
*
* The strategy we use is to calculate the reciprocal of cycles per MHz,
* scaled by 1<<32. Then we can simply issue a MULTU and pluck of the
* HI register and have the results of the division.
*/
#define MIPS_SET_CI_RECIPROCAL(cpu) \
do { \
KASSERT((cpu)->ci_divisor_delay != 0); \
(cpu)->ci_divisor_recip = 0x100000000ULL / (cpu)->ci_divisor_delay; \
} while (0)
#define MIPS_COUNT_TO_MHZ(cpu, count, res) \
__asm volatile("multu %1,%2 ; mfhi %0" \
: "=r"((res)) : "r"((count)), "r"((cpu)->ci_divisor_recip))
#endif /* !_LOCORE */
#endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.17 2008/01/09 20:38:36 wiz Exp $ */
/* $NetBSD: cpu.c,v 1.18 2008/05/26 15:59:30 tsutsui Exp $ */
/*
* Copyright 2000, 2001
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.17 2008/01/09 20:38:36 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18 2008/05/26 15:59:30 tsutsui Exp $");
#include "opt_multiprocessor.h"
@ -117,11 +117,10 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
}
curcpu()->ci_cpu_freq = 50000000 * plldiv;
/* Compute the delay divisor and reciprocal. */
curcpu()->ci_divisor_delay = curcpu()->ci_cpu_freq / 1000000;
MIPS_SET_CI_RECIPROCAL(curcpu());
/* Compute the delay divisor. */
curcpu()->ci_divisor_delay = (curcpu()->ci_cpu_freq + 500000) / 1000000;
/* Compute clock cycles per hz */
curcpu()->ci_cycles_per_hz = curcpu()->ci_cpu_freq / hz;
curcpu()->ci_cycles_per_hz = (curcpu()->ci_cpu_freq + hz / 2 ) / hz;
printf(": %lu.%02luMHz (hz cycles = %lu, delay divisor = %lu)\n",
curcpu()->ci_cpu_freq / 1000000,

View File

@ -1,4 +1,4 @@
/* $NetBSD: crime.c,v 1.28 2008/01/09 20:38:36 wiz Exp $ */
/* $NetBSD: crime.c,v 1.29 2008/05/26 15:59:30 tsutsui Exp $ */
/*
* Copyright (c) 2004 Christopher SEKIYA
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.28 2008/01/09 20:38:36 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: crime.c,v 1.29 2008/05/26 15:59:30 tsutsui Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -158,7 +158,6 @@ crime_attach(struct device *parent, struct device *self, void *aux)
curcpu()->ci_cpu_freq = cps * 2 * hz;
curcpu()->ci_cycles_per_hz = curcpu()->ci_cpu_freq / (2 * hz);
curcpu()->ci_divisor_delay = curcpu()->ci_cpu_freq / (2 * 1000000);
MIPS_SET_CI_RECIPROCAL(curcpu());
/* Turn on memory error and crime error interrupts.
All others turned on as devices are registered. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: int.c,v 1.17 2008/01/09 20:38:36 wiz Exp $ */
/* $NetBSD: int.c,v 1.18 2008/05/26 15:59:30 tsutsui Exp $ */
/*
* Copyright (c) 2004 Christopher SEKIYA
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: int.c,v 1.17 2008/01/09 20:38:36 wiz Exp $");
__KERNEL_RCSID(0, "$NetBSD: int.c,v 1.18 2008/05/26 15:59:30 tsutsui Exp $");
#include "opt_cputype.h"
@ -187,7 +187,6 @@ int_attach(struct device *parent, struct device *self, void *aux)
curcpu()->ci_cycles_per_hz = curcpu()->ci_cpu_freq / (2 * hz);
curcpu()->ci_divisor_delay = curcpu()->ci_cpu_freq / (2 * 1000000);
MIPS_SET_CI_RECIPROCAL(curcpu());
if (mach_type == MACH_SGI_IP22) {
/* Wire interrupts 7, 11 to mappable interrupt 0,1 handlers */