diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c index 0556643032c..b1924832768 100644 --- a/sys/arm/arm/generic_timer.c +++ b/sys/arm/arm/generic_timer.c @@ -54,15 +54,13 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include #include #include +#include #include -#if defined(__arm__) -#include /* For arm_set_delay */ -#endif - #if defined(__aarch64__) #include #endif @@ -138,11 +136,13 @@ static struct timecounter arm_tmr_timecount = { #define get_el1(x) cp15_## x ##_get() #define set_el0(x, val) cp15_## x ##_set(val) #define set_el1(x, val) cp15_## x ##_set(val) +#define HAS_PHYS true #else /* __aarch64__ */ #define get_el0(x) READ_SPECIALREG(x ##_el0) #define get_el1(x) READ_SPECIALREG(x ##_el1) #define set_el0(x, val) WRITE_SPECIALREG(x ##_el0, val) #define set_el1(x, val) WRITE_SPECIALREG(x ##_el1, val) +#define HAS_PHYS has_hyp() #endif static int @@ -521,8 +521,8 @@ arm_tmr_attach(device_t dev) if (sc->res[GT_VIRT] != NULL) arm_tmr_disable(false); /* And the physical */ - if (sc->res[GT_PHYS_SECURE] != NULL || - sc->res[GT_PHYS_NONSECURE] != NULL) + if ((sc->res[GT_PHYS_SECURE] != NULL || + sc->res[GT_PHYS_NONSECURE] != NULL) && HAS_PHYS) arm_tmr_disable(true); arm_tmr_timecount.tc_frequency = sc->clkfreq;