summaryrefslogtreecommitdiff
path: root/sys/arch/arm64
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2017-02-18 00:19:34 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2017-02-18 00:19:34 +0000
commit5698bf5884920d5fc18e299cac7bf2397d0050e5 (patch)
tree672af1667002d171831d4e4db0771c28c9f1e0d2 /sys/arch/arm64
parent13e1f077b34eaed44729319c2dc19b7ac63b3f54 (diff)
Initialize the generic timer early so that its delay function can be
used early, similar to the armv7 implementation.
Diffstat (limited to 'sys/arch/arm64')
-rw-r--r--sys/arch/arm64/dev/agtimer.c6
-rw-r--r--sys/arch/arm64/dev/mainbus.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/arch/arm64/dev/agtimer.c b/sys/arch/arm64/dev/agtimer.c
index bbcb37ee038..a5cf9ffbfed 100644
--- a/sys/arch/arm64/dev/agtimer.c
+++ b/sys/arch/arm64/dev/agtimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agtimer.c,v 1.4 2017/02/07 21:51:03 patrick Exp $ */
+/* $OpenBSD: agtimer.c,v 1.5 2017/02/18 00:19:33 patrick Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
@@ -393,10 +393,10 @@ agtimer_startclock(void)
void
agtimer_init(void)
{
- uint32_t cntfrq = 0;
+ uint64_t cntfrq = 0;
/* XXX: Check for Generic Timer support. */
- __asm volatile("MRS %x0, CNTFRQ_EL0" : "=r" (cntfrq));
+ cntfrq = agtimer_get_freq();
if (cntfrq != 0) {
agtimer_frequency = cntfrq;
diff --git a/sys/arch/arm64/dev/mainbus.c b/sys/arch/arm64/dev/mainbus.c
index fea6a960510..6714d116967 100644
--- a/sys/arch/arm64/dev/mainbus.c
+++ b/sys/arch/arm64/dev/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.1 2016/12/17 23:38:33 patrick Exp $ */
+/* $OpenBSD: mainbus.c,v 1.2 2017/02/18 00:19:33 patrick Exp $ */
/*
* Copyright (c) 2016 Patrick Wildt <patrick@blueri.se>
*
@@ -81,6 +81,7 @@ mainbus_match(struct device *parent, void *cfdata, void *aux)
}
extern char *hw_prod;
+void agtimer_init(void);
void
mainbus_attach(struct device *parent, struct device *self, void *aux)
@@ -93,6 +94,7 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
panic("mainbus: no device tree");
arm_intr_init_fdt();
+ agtimer_init();
sc->sc_iot = &arm64_bs_tag;
sc->sc_dmat = &mainbus_dma_tag;