Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc/sparc Move timer{match, attach}_mainbus() back...
details: https://anonhg.NetBSD.org/src/rev/b90dce04ed47
branches: trunk
changeset: 539875:b90dce04ed47
user: pk <pk%NetBSD.org@localhost>
date: Thu Nov 28 14:18:31 2002 +0000
description:
Move timer{match,attach}_mainbus() back into timer.c, since the `timer at
mainbus' configuration declaration is orthogonal to the configured SUN4[CM]
platform options.
diffstat:
sys/arch/sparc/sparc/timer.c | 28 ++++++++++++++++-
sys/arch/sparc/sparc/timer_sun4.c | 63 ++++++++++++++++----------------------
sys/arch/sparc/sparc/timervar.h | 4 +-
3 files changed, 56 insertions(+), 39 deletions(-)
diffs (145 lines):
diff -r 0a09c3a96e8a -r b90dce04ed47 sys/arch/sparc/sparc/timer.c
--- a/sys/arch/sparc/sparc/timer.c Thu Nov 28 11:21:16 2002 +0000
+++ b/sys/arch/sparc/sparc/timer.c Thu Nov 28 14:18:31 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: timer.c,v 1.11 2002/11/26 14:43:39 pk Exp $ */
+/* $NetBSD: timer.c,v 1.12 2002/11/28 14:18:31 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -194,3 +194,29 @@
CFATTACH_DECL(timer_obio, sizeof(struct device),
timermatch_obio, timerattach_obio, NULL, NULL);
+
+/*
+ * Only sun4c attaches a timer at mainbus
+ */
+static int
+timermatch_mainbus(struct device *parent, struct cfdata *cf, void *aux)
+{
+#if defined(SUN4C)
+ struct mainbus_attach_args *ma = aux;
+
+ return (strcmp("counter-timer", ma->ma_name) == 0);
+#else
+ return (0);
+#endif
+}
+
+static void
+timerattach_mainbus(struct device *parent, struct device *self, void *aux)
+{
+#if defined(SUN4C)
+ timerattach_mainbus_4c(parent, self, aux);
+#endif /* SUN4C */
+}
+
+CFATTACH_DECL(timer_mainbus, sizeof(struct device),
+ timermatch_mainbus, timerattach_mainbus, NULL, NULL);
diff -r 0a09c3a96e8a -r b90dce04ed47 sys/arch/sparc/sparc/timer_sun4.c
--- a/sys/arch/sparc/sparc/timer_sun4.c Thu Nov 28 11:21:16 2002 +0000
+++ b/sys/arch/sparc/sparc/timer_sun4.c Thu Nov 28 14:18:31 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: timer_sun4.c,v 1.4 2002/10/02 16:02:12 thorpej Exp $ */
+/* $NetBSD: timer_sun4.c,v 1.5 2002/11/28 14:18:31 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -129,42 +129,6 @@
return (1);
}
-#if defined(SUN4C)
-static int
-timermatch_mainbus(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct mainbus_attach_args *ma = aux;
-
- return (strcmp("counter-timer", ma->ma_name) == 0);
-}
-
-static void
-timerattach_mainbus(struct device *parent, struct device *self, void *aux)
-{
- struct mainbus_attach_args *ma = aux;
- bus_space_handle_t bh;
-
- /*
- * This time we ignore any existing virtual address because
- * we have a fixed virtual address for the timer, to make
- * microtime() faster.
- */
- if (bus_space_map2(ma->ma_bustag,
- ma->ma_paddr,
- sizeof(struct timerreg_4),
- BUS_SPACE_MAP_LINEAR,
- TIMERREG_VA, &bh) != 0) {
- printf(": can't map registers\n");
- return;
- }
-
- timerattach(&timerreg4->t_c14.t_counter, &timerreg4->t_c14.t_limit);
-}
-
-CFATTACH_DECL(timer_mainbus, sizeof(struct device),
- timermatch_mainbus, timerattach_mainbus, NULL, NULL);
-#endif /* SUN4C */
-
#if defined(SUN4)
void
timerattach_obio_4(struct device *parent, struct device *self, void *aux)
@@ -186,3 +150,28 @@
timerattach(&timerreg4->t_c14.t_counter, &timerreg4->t_c14.t_limit);
}
#endif /* SUN4 */
+
+#if defined(SUN4C)
+void
+timerattach_mainbus_4c(struct device *parent, struct device *self, void *aux)
+{
+ struct mainbus_attach_args *ma = aux;
+ bus_space_handle_t bh;
+
+ /*
+ * This time we ignore any existing virtual address because
+ * we have a fixed virtual address for the timer, to make
+ * microtime() faster.
+ */
+ if (bus_space_map2(ma->ma_bustag,
+ ma->ma_paddr,
+ sizeof(struct timerreg_4),
+ BUS_SPACE_MAP_LINEAR,
+ TIMERREG_VA, &bh) != 0) {
+ printf(": can't map registers\n");
+ return;
+ }
+
+ timerattach(&timerreg4->t_c14.t_counter, &timerreg4->t_c14.t_limit);
+}
+#endif /* SUN4C */
diff -r 0a09c3a96e8a -r b90dce04ed47 sys/arch/sparc/sparc/timervar.h
--- a/sys/arch/sparc/sparc/timervar.h Thu Nov 28 11:21:16 2002 +0000
+++ b/sys/arch/sparc/sparc/timervar.h Thu Nov 28 14:18:31 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: timervar.h,v 1.1 2002/08/25 16:10:36 thorpej Exp $ */
+/* $NetBSD: timervar.h,v 1.2 2002/11/28 14:18:31 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -50,6 +50,7 @@
void timer_init_4(void);
void timerattach_obio_4(struct device *, struct device *, void *);
+void timerattach_mainbus_4c(struct device *, struct device *, void *);
#endif /* SUN4 || SUN4C */
#if defined(SUN4M)
@@ -65,6 +66,7 @@
extern int timerblurb;
extern void (*timer_init)(void);
+/* Common timer attach routine in timer.c: */
void timerattach(volatile int *, volatile int *);
static __inline u_long __attribute__((__unused__))
Home |
Main Index |
Thread Index |
Old Index