Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 sprinkle #if NPSYCHO > 0



details:   https://anonhg.NetBSD.org/src/rev/d80efe8ee684
branches:  trunk
changeset: 789618:d80efe8ee684
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Aug 27 13:12:29 2013 +0000

description:
sprinkle #if NPSYCHO > 0
now this builds again on kernels without psycho

diffstat:

 sys/arch/sparc64/sparc64/clock.c |  31 ++++++++++++++++++++++++++-----
 1 files changed, 26 insertions(+), 5 deletions(-)

diffs (151 lines):

diff -r 5c7b1b917722 -r d80efe8ee684 sys/arch/sparc64/sparc64/clock.c
--- a/sys/arch/sparc64/sparc64/clock.c  Tue Aug 27 13:11:12 2013 +0000
+++ b/sys/arch/sparc64/sparc64/clock.c  Tue Aug 27 13:12:29 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.110 2013/08/22 10:00:43 nakayama Exp $ */
+/*     $NetBSD: clock.c,v 1.111 2013/08/27 13:12:29 macallan Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.110 2013/08/22 10:00:43 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.111 2013/08/27 13:12:29 macallan Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -90,14 +90,16 @@
 #include <sparc64/sparc64/timerreg.h>
 #include <sparc64/dev/iommureg.h>
 
+#include "psycho.h"
 /* just because US-IIe STICK registers live in psycho space */
+#if NPSYCHO > 0
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pcireg.h>
 #include <sparc64/dev/iommureg.h>
 #include <sparc64/dev/iommuvar.h>
 #include <sparc64/dev/psychoreg.h>
 #include <sparc64/dev/psychovar.h>
-
+#endif
 
 /*
  * Clock assignments:
@@ -146,7 +148,9 @@
 
 static u_int tick_get_timecount(struct timecounter *);
 static u_int stick_get_timecount(struct timecounter *);
+#if NPSYCHO > 0
 static u_int stick2e_get_timecount(struct timecounter *);
+#endif
 
 /*
  * define timecounter "tick-counter"
@@ -177,7 +181,7 @@
 };
 
 /* US-IIe STICK counter */
-
+#if NPSYCHO > 0
 static struct timecounter stick2e_timecounter = {
        stick2e_get_timecount,  /* get_timecount */
        0,                      /* no poll_pps */
@@ -188,7 +192,7 @@
        0,                      /* private reference - UNUSED */
        NULL                    /* next timecounter */
 };
-
+#endif
 
 /*
  * tick_get_timecount provide current tick counter value
@@ -205,11 +209,13 @@
        return getstick();
 }
 
+#if NPSYCHO > 0
 static u_int
 stick2e_get_timecount(struct timecounter *tc)
 {
        return psycho_getstick();
 }
+#endif
 
 #ifdef MULTIPROCESSOR
 static u_int counter_get_timecount(struct timecounter *);
@@ -399,6 +405,7 @@
        intr_restore(s);
 }
 
+#if NPSYCHO > 0
 void
 stick2eintr_establish(int pil, int (*fun)(void *))
 {
@@ -419,6 +426,7 @@
        psycho_nextstick(ci->ci_tick_increment);
        intr_restore(s);
 }
+#endif
 
 /*
  * Set up the real-time and statistics clocks.  Leave stathz 0 only if
@@ -469,10 +477,12 @@
        /* Register timecounter "stick-counter" */
        if (ci->ci_system_clockrate[0] != 0) {
                if (CPU_IS_HUMMINGBIRD()) {
+#if NPSYCHO > 0
                        psycho_setstick(0);
                        stick2e_timecounter.tc_frequency =
                            ci->ci_system_clockrate[0];
                        tc_init(&stick2e_timecounter);
+#endif
                } else {
                        setstick(0);
                        stick_timecounter.tc_frequency =
@@ -483,6 +493,11 @@
 
        /*
         * Now handle machines w/o counter-timers.
+        * XXX
+        * If the CPU is an US-IIe and we don't have a psycho we need to fall
+        * back to %tick. Not that a kernel like that would get very far on any
+        * supported hardware ( without PCI... ) - I'm not sure if such hardware
+        * even exists.
         */
 
        if (!timerreg_4u.t_timer || !timerreg_4u.t_clrintr) {
@@ -495,11 +510,15 @@
                        /* We don't have a counter-timer -- use %tick */
                        tickintr_establish(PIL_CLOCK, tickintr);
                } else if (CPU_IS_HUMMINGBIRD()) {
+#if NPSYCHO > 0
                        aprint_normal("No counter-timer -- using STICK "
                            "at %luMHz as system clock.\n",
                            (unsigned long)ci->ci_system_clockrate[1]);
                        /* We don't have a counter-timer -- use STICK */
                        stick2eintr_establish(PIL_CLOCK, stick2eintr);
+#else
+                       panic("trying to use STICK without psycho?!");
+#endif
                } else {
                        aprint_normal("No counter-timer -- using %%stick "
                            "at %luMHz as system clock.\n",
@@ -663,6 +682,7 @@
        return (1);
 }
 
+#if NPSYCHO > 0
 int
 stick2eintr(void *cap)
 {
@@ -678,6 +698,7 @@
 
        return (1);
 }
+#endif
 
 #ifndef MULTIPROCESSOR
 /*



Home | Main Index | Thread Index | Old Index