Move schedintr() to clock.c and initialise schedhz in initclocks(), so
these are available to all timer implementations.
This commit is contained in:
parent
e840d74cd0
commit
67998a8646
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu.h,v 1.55 2003/01/03 16:21:05 mrg Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.56 2003/01/06 12:50:43 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -188,6 +188,7 @@ caddr_t reserve_dumppages(caddr_t);
|
|||
/* clock.c */
|
||||
struct timeval;
|
||||
void lo_microtime(struct timeval *);
|
||||
void schedintr(void *);
|
||||
/* locore.s */
|
||||
struct fpstate;
|
||||
void savefpstate(struct fpstate *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clock.c,v 1.89 2002/05/02 13:01:45 martin Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.90 2003/01/06 12:50:45 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -213,6 +213,15 @@ cpu_initclocks()
|
|||
|
||||
if (timer_init != NULL)
|
||||
(*timer_init)();
|
||||
|
||||
/*
|
||||
* The scheduler clock runs every 8 statclock ticks,
|
||||
* assuming stathz == 100. If it's not, compute a mask
|
||||
* for use in the various statintr() functions approx.
|
||||
* like this:
|
||||
* mask = round_power2(stathz / schedhz) - 1
|
||||
*/
|
||||
schedhz = 12;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -227,6 +236,19 @@ setstatclockrate(newhz)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Scheduler pseudo-clock interrupt handler.
|
||||
* Runs off a soft interrupt at IPL_SCHED, scheduled by statintr().
|
||||
*/
|
||||
void schedintr(void *v)
|
||||
{
|
||||
struct proc *p = curproc;
|
||||
|
||||
/* XXX - should consult a cpuinfo.schedtickpending */
|
||||
if (p != NULL)
|
||||
schedclock(p);
|
||||
}
|
||||
|
||||
/*
|
||||
* `sparc_clock_time_is_ok' is used in cpu_reboot() to determine
|
||||
* whether it is appropriate to call resettodr() to consolidate
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: timer.c,v 1.15 2002/12/31 16:45:53 pk Exp $ */
|
||||
/* $NetBSD: timer.c,v 1.16 2003/01/06 12:50:45 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -74,14 +74,6 @@ static struct intrhand level10;
|
|||
static struct intrhand level14;
|
||||
|
||||
|
||||
void schedintr(void *v)
|
||||
{
|
||||
struct proc *p = curproc;
|
||||
|
||||
if (p != NULL)
|
||||
schedclock(p);
|
||||
}
|
||||
|
||||
/*
|
||||
* sun4/sun4c/sun4m common timer attach code
|
||||
*/
|
||||
|
@ -141,8 +133,6 @@ timerattach(cntreg, limreg)
|
|||
sched_cookie = softintr_establish(IPL_SCHED, schedintr, NULL);
|
||||
if (sched_cookie == NULL)
|
||||
panic("timerattach: cannot establish schedintr");
|
||||
|
||||
schedhz = 12;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: timer_msiiep.c,v 1.6 2002/12/31 16:45:53 pk Exp $ */
|
||||
/* $NetBSD: timer_msiiep.c,v 1.7 2003/01/06 12:50:47 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -154,9 +154,8 @@ statintr_msiiep(void *cap)
|
|||
msiiep->pcic_pclr_nr = tmr_ustolimIIep(newint);
|
||||
|
||||
/*
|
||||
* The factor 8 is only valid for stathz==100. For other
|
||||
* values we should compute a mask, approx.
|
||||
* mask = round_power2(stathz / schedhz) - 1
|
||||
* The factor 8 is only valid for stathz==100.
|
||||
* See also clock.c
|
||||
*/
|
||||
if (curproc && (++cpuinfo.ci_schedstate.spc_schedticks & 7) == 0)
|
||||
softintr_schedule(sched_cookie);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: timer_sun4.c,v 1.6 2002/12/31 16:45:53 pk Exp $ */
|
||||
/* $NetBSD: timer_sun4.c,v 1.7 2003/01/06 12:50:46 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -128,9 +128,8 @@ statintr_4(void *cap)
|
|||
timerreg4->t_c14.t_limit = tmr_ustolim(newint);
|
||||
|
||||
/*
|
||||
* The factor 8 is only valid for stathz==100. For other
|
||||
* values we should compute a mask, approx.
|
||||
* mask = round_power2(stathz / schedhz) - 1
|
||||
* The factor 8 is only valid for stathz==100.
|
||||
* See also clock.c
|
||||
*/
|
||||
if (curproc && (++cpuinfo.ci_schedstate.spc_schedticks & 7) == 0)
|
||||
softintr_schedule(sched_cookie);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: timer_sun4m.c,v 1.4 2002/12/31 16:45:52 pk Exp $ */
|
||||
/* $NetBSD: timer_sun4m.c,v 1.5 2003/01/06 12:50:46 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -157,9 +157,8 @@ statintr_4m(void *cap)
|
|||
counterreg4m->t_limit_nr = tmr_ustolim4m(newint);
|
||||
|
||||
/*
|
||||
* The factor 8 is only valid for stathz==100. For other
|
||||
* values we should compute a mask, approx.
|
||||
* mask = round_power2(stathz / schedhz) - 1
|
||||
* The factor 8 is only valid for stathz==100.
|
||||
* See also clock.c
|
||||
*/
|
||||
if (curproc && (++cpuinfo.ci_schedstate.spc_schedticks & 7) == 0)
|
||||
raise_ipi(&cpuinfo, IPL_SCHED); /* sched_cookie->pil */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: timervar.h,v 1.3 2002/12/31 16:45:53 pk Exp $ */
|
||||
/* $NetBSD: timervar.h,v 1.4 2003/01/06 12:50:44 pk Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -68,7 +68,6 @@ extern void (*timer_init)(void);
|
|||
|
||||
/* Common timer attach routine in timer.c: */
|
||||
void timerattach(volatile int *, volatile int *);
|
||||
void schedintr(void *);
|
||||
void *sched_cookie; /* for schedclock() interrupts */
|
||||
|
||||
static __inline u_long __attribute__((__unused__))
|
||||
|
|
Loading…
Reference in New Issue