Module Name:    src
Committed By:   jmcneill
Date:           Sat Nov  5 17:30:20 UTC 2022

Modified Files:
        src/sys/arch/arm/cortex: a9ptmr.c a9ptmr_var.h

Log Message:
Handle speed change events


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/cortex/a9ptmr.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/cortex/a9ptmr_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/cortex/a9ptmr.c
diff -u src/sys/arch/arm/cortex/a9ptmr.c:1.2 src/sys/arch/arm/cortex/a9ptmr.c:1.3
--- src/sys/arch/arm/cortex/a9ptmr.c:1.2	Wed Aug 14 09:20:00 2019
+++ src/sys/arch/arm/cortex/a9ptmr.c	Sat Nov  5 17:30:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9ptmr.c,v 1.2 2019/08/14 09:20:00 skrll Exp $	*/
+/*	$NetBSD: a9ptmr.c,v 1.3 2022/11/05 17:30:20 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,13 +30,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: a9ptmr.c,v 1.2 2019/08/14 09:20:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9ptmr.c,v 1.3 2022/11/05 17:30:20 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/cpu.h>
 #include <sys/device.h>
 #include <sys/kernel.h>
+#include <sys/xcall.h>
 
 #include <prop/proplib.h>
 
@@ -265,3 +266,25 @@ a9ptmr_intr(void *arg)
 
 	return 1;
 }
+
+static void
+a9ptmr_update_freq_cb(void *arg1, void *arg2)
+{
+	a9ptmr_init_cpu_clock(curcpu());
+}
+
+void
+a9ptmr_update_freq(uint32_t freq)
+{
+	struct a9ptmr_softc * const sc = a9ptmr_sc;
+	uint64_t xc;
+
+	KASSERT(sc->sc_dev != NULL);
+	KASSERT(freq != 0);
+
+	sc->sc_freq = freq;
+	sc->sc_load = (sc->sc_freq / hz) - 1;
+
+	xc = xc_broadcast(0, a9ptmr_update_freq_cb, NULL, NULL);
+	xc_wait(xc);
+}

Index: src/sys/arch/arm/cortex/a9ptmr_var.h
diff -u src/sys/arch/arm/cortex/a9ptmr_var.h:1.1 src/sys/arch/arm/cortex/a9ptmr_var.h:1.2
--- src/sys/arch/arm/cortex/a9ptmr_var.h:1.1	Sat Aug 10 17:03:59 2019
+++ src/sys/arch/arm/cortex/a9ptmr_var.h	Sat Nov  5 17:30:20 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: a9ptmr_var.h,v 1.1 2019/08/10 17:03:59 skrll Exp $ */
+/* $NetBSD: a9ptmr_var.h,v 1.2 2022/11/05 17:30:20 jmcneill Exp $ */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -39,6 +39,7 @@ struct cpu_info;
 void	a9ptmr_init_cpu_clock(struct cpu_info *);
 
 int	a9ptmr_intr(void *);
+void	a9ptmr_update_freq(uint32_t);
 void	a9ptmr_delay(unsigned int n);
 #endif
 

Reply via email to