Module Name: src
Committed By: macallan
Date: Tue Aug 27 13:12:29 UTC 2013
Modified Files:
src/sys/arch/sparc64/sparc64: clock.c
Log Message:
sprinkle #if NPSYCHO > 0
now this builds again on kernels without psycho
To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/sparc64/sparc64/clock.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/sparc64/sparc64/clock.c
diff -u src/sys/arch/sparc64/sparc64/clock.c:1.110 src/sys/arch/sparc64/sparc64/clock.c:1.111
--- src/sys/arch/sparc64/sparc64/clock.c:1.110 Thu Aug 22 10:00:43 2013
+++ src/sys/arch/sparc64/sparc64/clock.c Tue Aug 27 13:12:29 2013
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.
#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 @@ int timerblurb = 10; /* Guess a value; u
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 @@ static struct timecounter stick_timecoun
};
/* 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 @@ static struct timecounter stick2e_timeco
0, /* private reference - UNUSED */
NULL /* next timecounter */
};
-
+#endif
/*
* tick_get_timecount provide current tick counter value
@@ -205,11 +209,13 @@ stick_get_timecount(struct timecounter *
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 @@ stickintr_establish(int pil, int (*fun)(
intr_restore(s);
}
+#if NPSYCHO > 0
void
stick2eintr_establish(int pil, int (*fun)(void *))
{
@@ -419,6 +426,7 @@ stick2eintr_establish(int pil, int (*fun
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 @@ cpu_initclocks(void)
/* 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 @@ cpu_initclocks(void)
/*
* 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 @@ cpu_initclocks(void)
/* 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 @@ stickintr(void *cap)
return (1);
}
+#if NPSYCHO > 0
int
stick2eintr(void *cap)
{
@@ -678,6 +698,7 @@ stick2eintr(void *cap)
return (1);
}
+#endif
#ifndef MULTIPROCESSOR
/*