if PCLOCK isn't setted, use estimated value calculated by kernel.

This commit is contained in:
uch 2002-02-01 17:52:54 +00:00
parent 706b8b345a
commit 4202622d3c
9 changed files with 39 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.1 2001/04/23 11:20:41 uch Exp $ */
/* $NetBSD: clock.c,v 1.2 2002/02/01 17:52:54 uch Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles Hannum.
@ -89,7 +89,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* Primitive clock interrupt routines.
*/
#include "opt_pclock.h"
#include "wdog.h"
#include <sys/param.h>
@ -100,6 +99,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <dev/clock_subr.h>
#include <sh3/pclock.h>
#include <sh3/rtcreg.h>
#include <sh3/tmureg.h>
#include <sh3/wdogvar.h>

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.16 2002/01/27 13:23:17 jdolecek Exp $
# $NetBSD: GENERIC,v 1.17 2002/02/01 17:52:55 uch Exp $
#
# GENERIC machine description file
#
@ -32,7 +32,6 @@ options KLOADER_DEBUG
options SH7709A # 133MHz
options SH7709A_BROKEN_IPR
options PCLOCK=22000000 # 22MHz
options DDB # in-kernel debugger
#options DIAGNOSTIC # extra kernel debugging checks

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.3 2002/01/27 05:15:37 uch Exp $ */
/* $NetBSD: clock.c,v 1.4 2002/02/01 17:52:55 uch Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -166,12 +166,14 @@ clock_init()
int
clock_get_cpuclock()
{
return __cpuclock;
}
int
clock_get_pclock()
{
return __pclock;
}
@ -209,6 +211,7 @@ microtime(struct timeval *tv)
void
delay(int n)
{
DELAY_LOOP(__cnt_delay * n);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.18 2002/01/31 16:25:55 uch Exp $ */
/* $NetBSD: machdep.c,v 1.19 2002/02/01 17:52:55 uch Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -77,6 +77,7 @@
#include <hpcsh/hpcsh/clockvar.h>
#include <sh3/pclock.h>
#include <sh3/intcreg.h>
#ifdef DEBUG
@ -244,7 +245,13 @@ machine_startup(int argc, char *argv[], struct bootinfo *bi)
}
#endif
/* start console */
/*
* start console
*/
/* serial console requires PCLOCK. estimate here */
clock_init();
sh3_pclock = clock_get_pclock();
if (bootinfo->magic == BOOTINFO_MAGIC) {
platid.dw.dw0 = bootinfo->platid_cpu;
platid.dw.dw1 = bootinfo->platid_machine;
@ -362,11 +369,9 @@ machine_startup(int argc, char *argv[], struct bootinfo *bi)
void
cpu_startup()
{
int cpuclock, pclock;
int cpuclock;
clock_init();
cpuclock = clock_get_cpuclock();
pclock = clock_get_pclock();
sh3_startup();
#define CPUIDMATCH(p) \
@ -383,8 +388,8 @@ cpu_startup()
platid_name(&platid));
#define MHZ(x) ((x) / 1000000), (((x) % 1000000) / 1000)
DPRINTF(("%s %d.%02d MHz PCLOCK %d.%02d MHz\n", cpu_model,
MHZ(cpuclock), MHZ(pclock)));
printf("%s %d.%02d MHz PCLOCK %d.%02d MHz\n", cpu_model,
MHZ(cpuclock), MHZ(PCLOCK));
#ifdef SYSCALL_DEBUG
scdebug |= SCDEBUG_ALL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sci.c,v 1.16 2001/09/10 08:50:33 msaitoh Exp $ */
/* $NetBSD: sci.c,v 1.17 2002/02/01 17:52:56 uch Exp $ */
/*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@ -104,7 +104,6 @@
*/
#include "opt_kgdb.h"
#include "opt_pclock.h"
#include "opt_sci.h"
#include <sys/param.h>
@ -121,6 +120,7 @@
#include <dev/cons.h>
#include <machine/cpu.h>
#include <sh3/pclock.h>
#include <sh3/scireg.h>
#include <sh3/tmureg.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: scif.c,v 1.18 2001/06/12 15:17:20 wiz Exp $ */
/* $NetBSD: scif.c,v 1.19 2002/02/01 17:52:56 uch Exp $ */
/*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@ -104,7 +104,6 @@
*/
#include "opt_kgdb.h"
#include "opt_pclock.h"
#include "opt_scif.h"
#include <sys/param.h>
@ -121,6 +120,7 @@
#include <dev/cons.h>
#include <machine/cpu.h>
#include <sh3/pclock.h>
#include <sh3/scifreg.h>
#include <sh3/tmureg.h>

View File

@ -0,0 +1,8 @@
/* $NetBSD: pclock.h,v 1.1 2002/02/01 17:52:56 uch Exp $ */
#include "opt_pclock.h"
extern int sh3_pclock; /* defined in sh3/sh3_machdep.c */
#ifndef PCLOCK
#define PCLOCK sh3_pclock
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.17 2001/07/22 14:20:13 tsubai Exp $ */
/* $NetBSD: clock.c,v 1.18 2002/02/01 17:52:56 uch Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles Hannum.
@ -89,7 +89,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* Primitive clock interrupt routines.
*/
#include "opt_pclock.h"
#include "wdog.h"
#include <sys/param.h>
@ -100,6 +99,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <dev/clock_subr.h>
#include <sh3/pclock.h>
#include <sh3/rtcreg.h>
#include <sh3/tmureg.h>
#include <sh3/wdogvar.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: sh3_machdep.c,v 1.19 2001/09/28 11:59:53 chs Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.20 2002/02/01 17:52:56 uch Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -99,6 +99,11 @@
char cpu_model[120];
/*
* if PCLOCK isn't defined in config file, use this.
*/
int sh3_pclock;
/* Our exported CPU info; we can have only one. */
struct cpu_info cpu_info_store;