Page MenuHomeFreeBSD

D51820.diff
No OneTemporary

D51820.diff

diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c
--- a/sys/arm/arm/generic_timer.c
+++ b/sys/arm/arm/generic_timer.c
@@ -231,6 +231,25 @@
return (val);
}
+#ifdef __aarch64__
+/*
+ * Read the self-syncronized counter. These cannot be read speculatively so
+ * don't need an isb before them.
+ */
+static uint64_t
+get_cntxctss(bool physical)
+{
+ uint64_t val;
+
+ if (physical)
+ val = READ_SPECIALREG(CNTPCTSS_EL0_REG);
+ else
+ val = READ_SPECIALREG(CNTVCTSS_EL0_REG);
+
+ return (val);
+}
+#endif
+
static int
set_ctrl(uint32_t val, bool physical)
{
@@ -631,6 +650,7 @@
pcell_t clock;
#endif
#ifdef __aarch64__
+ uint64_t id_aa64mmfr0_el1;
int user_phys;
#endif
int error;
@@ -641,6 +661,11 @@
return (ENXIO);
sc->get_cntxct = &get_cntxct;
+#ifdef __aarch64__
+ if (get_kernel_reg(ID_AA64MMFR0_EL1, &id_aa64mmfr0_el1) &&
+ ID_AA64MMFR0_ECV_VAL(id_aa64mmfr0_el1) >= ID_AA64MMFR0_ECV_IMPL)
+ sc->get_cntxct = &get_cntxctss;
+#endif
#ifdef FDT
/* Get the base clock frequency */
node = ofw_bus_get_node(dev);

File Metadata

Mime Type
text/plain
Expires
Fri, Aug 21, 1:37 PM (3 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37034396
Default Alt Text
D51820.diff (1 KB)

Event Timeline