Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbmips Set the CPU frequency parameters from YAMON...
details: https://anonhg.NetBSD.org/src/rev/2047da79430c
branches: trunk
changeset: 554412:2047da79430c
user: simonb <simonb%NetBSD.org@localhost>
date: Mon Oct 27 23:47:00 2003 +0000
description:
Set the CPU frequency parameters from YAMON if available, and fall back
to the timer/RTC based calibration loops otherwise.
diffstat:
sys/arch/evbmips/alchemy/machdep.c | 23 ++++++++++++++++-------
sys/arch/evbmips/malta/machdep.c | 21 ++++++++++++++-------
2 files changed, 30 insertions(+), 14 deletions(-)
diffs (121 lines):
diff -r 12d23792c28b -r 2047da79430c sys/arch/evbmips/alchemy/machdep.c
--- a/sys/arch/evbmips/alchemy/machdep.c Mon Oct 27 23:41:42 2003 +0000
+++ b/sys/arch/evbmips/alchemy/machdep.c Mon Oct 27 23:47:00 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.12 2003/09/26 16:00:28 simonb Exp $ */
+/* $NetBSD: machdep.c,v 1.13 2003/10/27 23:47:00 simonb Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.12 2003/09/26 16:00:28 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.13 2003/10/27 23:47:00 simonb Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -165,7 +165,7 @@
const char *cp;
u_long first, last;
caddr_t v;
- int howto, i;
+ int freqok, howto, i;
extern char edata[], end[]; /* XXX */
@@ -187,6 +187,8 @@
* vectors early on. We need the wbflush() vector set up
* before comcnattach() is called (or at least before the
* first printf() after that is called).
+ * Sets up mips_cpu_flags that may be queried by other
+ * functions called during startup.
* Also clears the I+D caches.
*/
mips_vector_init();
@@ -197,17 +199,24 @@
uvm_setpagesize();
/*
+ * Use YAMON's CPU frequency if available.
+ */
+ freqok = yamon_setcpufreq(1);
+
+ /*
* Initialize bus space tags.
*/
au_cpureg_bus_mem_init(&pbc->pc_cpuregt, pbc);
aubus_st = &pbc->pc_cpuregt; /* XXX: for aubus.c */
/*
- * Calibrate the timer, delay() relies on this.
+ * Calibrate the timer if YAMON failed to tell us.
*/
- bus_space_map(&pbc->pc_cpuregt, PC_BASE, PC_SIZE, 0, &sh);
- au_cal_timers(&pbc->pc_cpuregt, sh);
- bus_space_unmap(&pbc->pc_cpuregt, sh, PC_SIZE);
+ if (!freqok) {
+ bus_space_map(&pbc->pc_cpuregt, PC_BASE, PC_SIZE, 0, &sh);
+ au_cal_timers(&pbc->pc_cpuregt, sh);
+ bus_space_unmap(&pbc->pc_cpuregt, sh, PC_SIZE);
+ }
/*
* Bring up the console.
diff -r 12d23792c28b -r 2047da79430c sys/arch/evbmips/malta/machdep.c
--- a/sys/arch/evbmips/malta/machdep.c Mon Oct 27 23:41:42 2003 +0000
+++ b/sys/arch/evbmips/malta/machdep.c Mon Oct 27 23:47:00 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.15 2003/10/27 18:36:26 simonb Exp $ */
+/* $NetBSD: machdep.c,v 1.16 2003/10/27 23:47:00 simonb Exp $ */
/*
* Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.15 2003/10/27 18:36:26 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.16 2003/10/27 23:47:00 simonb Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -204,7 +204,7 @@
u_long first, last;
vsize_t size;
char *cp;
- int i, howto;
+ int freqok, i, howto;
uint8_t *brkres = (uint8_t *)MIPS_PHYS_TO_KSEG1(MALTA_BRKRES);
extern char edata[], end[];
@@ -240,17 +240,24 @@
physmem = btoc(memsize);
+ /*
+ * Use YAMON's CPU frequency if available.
+ */
+ freqok = yamon_setcpufreq(1);
+
gt_pci_init(&mcp->mc_pc, &mcp->mc_gt);
malta_bus_io_init(&mcp->mc_iot, mcp);
malta_bus_mem_init(&mcp->mc_memt, mcp);
malta_dma_init(mcp);
/*
- * Calibrate the timer, delay() relies on this.
+ * Calibrate the timer if YAMON failed to tell us.
*/
- bus_space_map(&mcp->mc_iot, MALTA_RTCADR, 2, 0, &sh);
- malta_cal_timer(&mcp->mc_iot, sh);
- bus_space_unmap(&mcp->mc_iot, sh, 2);
+ if (!freqok) {
+ bus_space_map(&mcp->mc_iot, MALTA_RTCADR, 2, 0, &sh);
+ malta_cal_timer(&mcp->mc_iot, sh);
+ bus_space_unmap(&mcp->mc_iot, sh, 2);
+ }
#if NCOM > 0
/*
Home |
Main Index |
Thread Index |
Old Index