Add some changes from Patrick Wildt in bitrig that are required to make
authorjsg <jsg@openbsd.org>
Sat, 6 Jun 2015 16:49:04 +0000 (16:49 +0000)
committerjsg <jsg@openbsd.org>
Sat, 6 Jun 2015 16:49:04 +0000 (16:49 +0000)
the qemu cortex a15 useable without trustzone.

Establish the interrupt for the non-secure physical timer (30), in
addition to the secure physical timer (29).

Stop masking the timer output signal in the interrupt handler.

sys/arch/arm/cortex/agtimer.c

index 8aa6da3..17d1d18 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: agtimer.c,v 1.3 2015/05/29 05:48:07 jsg Exp $ */
+/* $OpenBSD: agtimer.c,v 1.4 2015/06/06 16:49:04 jsg Exp $ */
 /*
  * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
  * Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
@@ -203,7 +203,7 @@ agtimer_intr(void *frame)
        struct agtimer_pcpu_softc *pc = &sc->sc_pstat[CPU_INFO_UNIT(curcpu())];
        uint64_t                 now;
        uint64_t                 nextevent;
-       uint32_t                 r, reg;
+       uint32_t                 r;
 #if defined(USE_GTIMER_CMP)
        int                      skip = 1;
 #else
@@ -261,12 +261,6 @@ agtimer_intr(void *frame)
 
        agtimer_set_tval(delay);
 
-       reg = agtimer_get_ctrl();
-       if (reg & GTIMER_CNTP_CTL_ISTATUS) {
-               reg |= GTIMER_CNTP_CTL_IMASK;
-               agtimer_set_ctrl(reg);
-       }
-
        return (rc);
 }
 
@@ -309,8 +303,13 @@ agtimer_cpu_initclocks()
 
        /* establish interrupts */
        /* XXX - irq */
+
+       /* secure physical timer */
        ampintc_intr_establish(29, IPL_CLOCK, agtimer_intr,
            NULL, "tick");
+       /* non-secure physical timer */
+       ampintc_intr_establish(30, IPL_CLOCK, agtimer_intr,
+           NULL, "tick");
 
        next = agtimer_readcnt64(sc) + sc->sc_ticks_per_intr;
        pc->pc_nexttickevent = pc->pc_nextstatevent = next;