Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode/dev get rid of clock softintr and move set...



details:   https://anonhg.NetBSD.org/src/rev/b0dfcbefc613
branches:  trunk
changeset: 769396:b0dfcbefc613
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Sep 08 12:10:13 2011 +0000

description:
get rid of clock softintr and move setitimer call to cpu_initclocks

diffstat:

 sys/arch/usermode/dev/clock.c |  27 +++++----------------------
 sys/arch/usermode/dev/cpu.c   |  11 +++++++++--
 2 files changed, 14 insertions(+), 24 deletions(-)

diffs (124 lines):

diff -r e054cfddcd21 -r b0dfcbefc613 sys/arch/usermode/dev/clock.c
--- a/sys/arch/usermode/dev/clock.c     Thu Sep 08 12:08:13 2011 +0000
+++ b/sys/arch/usermode/dev/clock.c     Thu Sep 08 12:10:13 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.15 2011/09/08 11:11:18 jmcneill Exp $ */
+/* $NetBSD: clock.c,v 1.16 2011/09/08 12:10:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -26,10 +26,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "opt_hz.h"
-
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.15 2011/09/08 11:11:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.16 2011/09/08 12:10:13 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -46,7 +44,6 @@
 static int     clock_match(device_t, cfdata_t, void *);
 static void    clock_attach(device_t, device_t, void *);
 
-static void    clock_softint(void *);
 static void    clock_signal(int sig);
 static unsigned int clock_getcounter(struct timecounter *);
 
@@ -55,7 +52,6 @@
 typedef struct clock_softc {
        device_t                sc_dev;
        struct todr_chip_handle sc_todr;
-       void                    *sc_ih;
 } clock_softc_t;
 
 static struct timecounter clock_timecounter = {
@@ -90,7 +86,6 @@
 {
        static struct sigaction sa;
        clock_softc_t *sc = device_private(self);
-       struct thunk_itimerval itimer;
        stack_t ss;
        long tcres;
 
@@ -101,7 +96,6 @@
        clock_sc = sc;
 
        sc->sc_dev = self;
-       sc->sc_ih = softint_establish(SOFTINT_CLOCK, clock_softint, sc);
 
        sc->sc_todr.todr_gettime = clock_todr_gettime;
        todr_attach(&sc->sc_todr);
@@ -122,11 +116,6 @@
                panic("couldn't register SIGALRM handler : %d",
                    thunk_geterrno());
 
-       itimer.it_interval.tv_sec = 0;
-       itimer.it_interval.tv_usec = 1000000 / HZ;
-       itimer.it_value = itimer.it_interval;
-       thunk_setitimer(ITIMER_REAL, &itimer, NULL);
-
        tcres = thunk_clock_getres_monotonic();
        if (tcres > 0) {
                clock_timecounter.tc_quality = 1000;
@@ -138,21 +127,15 @@
 static void
 clock_signal(int sig)
 {
+       struct clockframe cf;
+
        curcpu()->ci_idepth++;
 
-       softint_schedule(clock_sc->sc_ih);
+       hardclock(&cf);
 
        curcpu()->ci_idepth--;
 }
 
-static void
-clock_softint(void *priv)
-{
-       struct clockframe cf;
-
-       hardclock(&cf);
-}
-
 static unsigned int
 clock_getcounter(struct timecounter *tc)
 {
diff -r e054cfddcd21 -r b0dfcbefc613 sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Thu Sep 08 12:08:13 2011 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Thu Sep 08 12:10:13 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.36 2011/09/08 12:08:13 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.37 2011/09/08 12:10:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,9 +27,10 @@
  */
 
 #include "opt_cpu.h"
+#include "opt_hz.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.36 2011/09/08 12:08:13 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.37 2011/09/08 12:10:13 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -346,6 +347,12 @@
 void
 cpu_initclocks(void)
 {
+       struct thunk_itimerval itimer;
+
+       itimer.it_interval.tv_sec = 0;
+       itimer.it_interval.tv_usec = 1000000 / HZ;
+       itimer.it_value = itimer.it_interval;
+       thunk_setitimer(ITIMER_REAL, &itimer, NULL);
 }
 
 void



Home | Main Index | Thread Index | Old Index