summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2002-10-25 17:42:14 +0000
committertmm <tmm@FreeBSD.org>2002-10-25 17:42:14 +0000
commitf2106ce58842c67958b74116dfdc9c008c797ec7 (patch)
tree2deab2ead4331235ac78b841bdb39b329107ad43 /sys
parent6bff02396b37ef2d411d1c03859c95155f8d22cc (diff)
downloadFreeBSD-src-f2106ce58842c67958b74116dfdc9c008c797ec7.zip
FreeBSD-src-f2106ce58842c67958b74116dfdc9c008c797ec7.tar.gz
Initialize tick_MHz and related variables much earlier. After the last
revision of tick.c, this was done at SI_SUB_CLOCKS, which is too late because tick_MHz is required for DELAY() to work. Reviewed by: jake
Diffstat (limited to 'sys')
-rw-r--r--sys/sparc64/include/tick.h3
-rw-r--r--sys/sparc64/sparc64/machdep.c11
-rw-r--r--sys/sparc64/sparc64/tick.c16
3 files changed, 17 insertions, 13 deletions
diff --git a/sys/sparc64/include/tick.h b/sys/sparc64/include/tick.h
index 924e586..e317bd8 100644
--- a/sys/sparc64/include/tick.h
+++ b/sys/sparc64/include/tick.h
@@ -31,7 +31,8 @@
typedef void tick_func_t(struct clockframe *);
-void tick_start(u_long clock, tick_func_t *func);
+void tick_init(u_long clock);
+void tick_start(tick_func_t *func);
#ifdef SMP
void tick_start_ap(void);
#endif
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index 80ad728..55ef2a9 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -149,18 +149,15 @@ CTASSERT(sizeof(struct pcpu) <= ((PCPU_PAGES * PAGE_SIZE) / 2));
static void
cpu_startup(void *arg)
{
- u_int clock;
-
- OF_getprop(PCPU_GET(node), "clock-frequency", &clock, sizeof(clock));
tick_tc.tc_get_timecount = tick_get_timecount;
tick_tc.tc_poll_pps = NULL;
tick_tc.tc_counter_mask = ~0u;
- tick_tc.tc_frequency = clock;
+ tick_tc.tc_frequency = tick_freq;
tick_tc.tc_name = "tick";
tc_init(&tick_tc);
- cpu_identify(rdpr(ver), clock, PCPU_GET(cpuid));
+ cpu_identify(rdpr(ver), tick_freq, PCPU_GET(cpuid));
vm_ksubmap_init(&kmi);
@@ -200,6 +197,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
vm_offset_t end;
vm_offset_t va;
caddr_t kmdp;
+ u_int clock;
char *env;
char type[8];
@@ -346,6 +344,9 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
mutex_init();
intr_init2();
+
+ OF_getprop(PCPU_GET(node), "clock-frequency", &clock, sizeof(clock));
+ tick_init(clock);
}
void
diff --git a/sys/sparc64/sparc64/tick.c b/sys/sparc64/sparc64/tick.c
index 241d771..a10ba01 100644
--- a/sys/sparc64/sparc64/tick.c
+++ b/sys/sparc64/sparc64/tick.c
@@ -57,10 +57,7 @@ int tick_missed; /* statistics */
void
cpu_initclocks(void)
{
- u_int clock;
-
- OF_getprop(PCPU_GET(node), "clock-frequency", &clock, sizeof(clock));
- tick_start(clock, tick_hardclock);
+ tick_start(tick_hardclock);
}
static __inline void
@@ -112,14 +109,19 @@ tick_hardclock(struct clockframe *cf)
}
void
-tick_start(u_long clock, tick_func_t *func)
+tick_init(u_long clock)
{
- intr_setup(PIL_TICK, (ih_func_t *)func, -1, NULL, NULL);
tick_freq = clock;
tick_MHz = clock / 1000000;
tick_increment = clock / hz;
+}
+
+void
+tick_start(tick_func_t *func)
+{
+ intr_setup(PIL_TICK, (ih_func_t *)func, -1, NULL, NULL);
wrpr(tick, 0, 0);
- wr(asr23, clock / hz, 0);
+ wr(asr23, tick_increment, 0);
}
#ifdef SMP
OpenPOWER on IntegriCloud