summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2015-12-25 06:18:51 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2015-12-25 06:18:51 +0000
commit356233b1591a8b5fc32f1a9b8b2a227fe81c76c8 (patch)
tree1705419905b9b30291346ab8f51501e982a67a88 /sys/arch
parentbfd8da91aee9b00e5e89b62e7fe5632c485c9ec4 (diff)
Add timecounter for MP.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sgi/sgi/ip27_machdep.c34
-rw-r--r--sys/arch/sgi/xbow/hub.h4
2 files changed, 35 insertions, 3 deletions
diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c
index ef8d320faac..c2e052ce48f 100644
--- a/sys/arch/sgi/sgi/ip27_machdep.c
+++ b/sys/arch/sgi/sgi/ip27_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip27_machdep.c,v 1.66 2015/09/08 10:21:50 deraadt Exp $ */
+/* $OpenBSD: ip27_machdep.c,v 1.67 2015/12/25 06:18:50 visa Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -24,11 +24,12 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/atomic.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/reboot.h>
+#include <sys/timetc.h>
#include <sys/tty.h>
-#include <sys/atomic.h>
#include <mips64/arcbios.h>
#include <mips64/archtype.h>
@@ -89,6 +90,21 @@ void ip27_attach_node(struct device *, int16_t);
int ip27_print(void *, const char *);
void ip27_nmi(void *);
+#ifdef MULTIPROCESSOR
+
+uint ip27_hub_get_timecount(struct timecounter *);
+
+struct timecounter ip27_hub_timecounter = {
+ .tc_get_timecount = ip27_hub_get_timecount,
+ .tc_poll_pps = NULL,
+ .tc_counter_mask = 0xffffffff, /* truncated to 32 bits. */
+ .tc_frequency = 1250000,
+ .tc_name = "hubrt",
+ .tc_quality = 100
+};
+
+#endif /* MULTIPROCESSOR */
+
/*
* IP27 interrupt handling declarations: 128 hw sources, plus timers and
* hub error sources; 5 levels.
@@ -304,6 +320,10 @@ ip27_setup()
IP27_NODE_IO_BASE(0)) /* HUB register offset */;
_device_register = dksc_device_register;
+
+#ifdef MULTIPROCESSOR
+ tc_init(&ip27_hub_timecounter);
+#endif
}
/*
@@ -938,3 +958,13 @@ ip27_nmi(void *arg)
panic("NMI");
/* NOTREACHED */
}
+
+#ifdef MULTIPROCESSOR
+
+uint
+ip27_hub_get_timecount(struct timecounter *tc)
+{
+ return IP27_RHUB_L(masternasid, HUBPI_RT_COUNT);
+}
+
+#endif /* MULTIPROCESSOR */
diff --git a/sys/arch/sgi/xbow/hub.h b/sys/arch/sgi/xbow/hub.h
index c50df7fd62f..2d26c7c6c95 100644
--- a/sys/arch/sgi/xbow/hub.h
+++ b/sys/arch/sgi/xbow/hub.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hub.h,v 1.8 2015/12/12 16:48:19 visa Exp $ */
+/* $OpenBSD: hub.h,v 1.9 2015/12/25 06:18:50 visa Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -105,6 +105,8 @@
#define HUBPI_CPU1_IMR0 0x000000b8
#define HUBPI_CPU1_IMR1 0x000000c0
+#define HUBPI_RT_COUNT 0x00030100
+
/*
* Offset to use to access the second PI over the remote hub interface
* on IP35.