Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Add __HAVE_GENERIC_CPU_INITCLOCKS option. If se...
details: https://anonhg.NetBSD.org/src/rev/6d79a4c7827f
branches: trunk
changeset: 355959:6d79a4c7827f
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Thu Aug 24 13:06:23 2017 +0000
description:
Add __HAVE_GENERIC_CPU_INITCLOCKS option. If set, don't export
cpu_initclocks from device drivers as common code (in this case FDT) will
provide its own copy.
diffstat:
sys/arch/arm/conf/files.arm | 5 ++++-
sys/arch/arm/cortex/gtmr.c | 6 +++---
sys/arch/arm/cortex/gtmr_var.h | 8 +++++++-
sys/arch/arm/fdt/arm_fdt.c | 29 +++++++++++++++++++++++++++--
sys/arch/arm/fdt/arm_fdtvar.h | 4 +++-
sys/arch/arm/fdt/gtmr_fdt.c | 5 +++--
6 files changed, 47 insertions(+), 10 deletions(-)
diffs (179 lines):
diff -r 9074086e9df7 -r 6d79a4c7827f sys/arch/arm/conf/files.arm
--- a/sys/arch/arm/conf/files.arm Thu Aug 24 11:37:25 2017 +0000
+++ b/sys/arch/arm/conf/files.arm Thu Aug 24 13:06:23 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.arm,v 1.133 2017/06/28 23:48:23 jmcneill Exp $
+# $NetBSD: files.arm,v 1.134 2017/08/24 13:06:23 jmcneill Exp $
# temporary define to allow easy moving to ../arch/arm/arm32
defflag ARM32
@@ -84,6 +84,9 @@
_ARM32_NEED_BUS_DMA_BOUNCE
BUSDMA_COUNTERS
+# Timer options
+defflag opt_arm_timer.h __HAVE_GENERIC_CPU_INITCLOCKS
+
# Floating point emulator
obsolete defflag ARMFPE
diff -r 9074086e9df7 -r 6d79a4c7827f sys/arch/arm/cortex/gtmr.c
--- a/sys/arch/arm/cortex/gtmr.c Thu Aug 24 11:37:25 2017 +0000
+++ b/sys/arch/arm/cortex/gtmr.c Thu Aug 24 13:06:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr.c,v 1.18 2017/06/17 22:49:37 jmcneill Exp $ */
+/* $NetBSD: gtmr.c,v 1.19 2017/08/24 13:06:23 jmcneill Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.18 2017/06/17 22:49:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.19 2017/08/24 13:06:23 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -223,7 +223,7 @@
}
void
-cpu_initclocks(void)
+gtmr_cpu_initclocks(void)
{
struct gtmr_softc * const sc = >mr_sc;
diff -r 9074086e9df7 -r 6d79a4c7827f sys/arch/arm/cortex/gtmr_var.h
--- a/sys/arch/arm/cortex/gtmr_var.h Thu Aug 24 11:37:25 2017 +0000
+++ b/sys/arch/arm/cortex/gtmr_var.h Thu Aug 24 13:06:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_var.h,v 1.6 2015/04/02 03:11:21 matt Exp $ */
+/* $NetBSD: gtmr_var.h,v 1.7 2017/08/24 13:06:23 jmcneill Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -45,11 +45,17 @@
};
#ifdef _KERNEL
+#include "opt_arm_timer.h"
struct cpu_info;
int gtmr_intr(void *);
void gtmr_init_cpu_clock(struct cpu_info *);
void gtmr_delay(unsigned int n);
void gtmr_bootdelay(unsigned int n);
+#ifdef __HAVE_GENERIC_CPU_INITCLOCKS
+void gtmr_cpu_initclocks(void);
+#else
+#define gtmr_cpu_initclocks cpu_initclocks
+#endif
#endif
#endif /* _ARM_CORTEX_GTMR_VAR_ */
diff -r 9074086e9df7 -r 6d79a4c7827f sys/arch/arm/fdt/arm_fdt.c
--- a/sys/arch/arm/fdt/arm_fdt.c Thu Aug 24 11:37:25 2017 +0000
+++ b/sys/arch/arm/fdt/arm_fdt.c Thu Aug 24 13:06:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_fdt.c,v 1.4 2017/06/29 20:55:10 jmcneill Exp $ */
+/* $NetBSD: arm_fdt.c,v 1.5 2017/08/24 13:06:23 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -26,8 +26,10 @@
* SUCH DAMAGE.
*/
+#include "opt_arm_timer.h"
+
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.4 2017/06/29 20:55:10 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.5 2017/08/24 13:06:23 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -61,6 +63,7 @@
TAILQ_HEAD_INITIALIZER(arm_fdt_cpu_hatch_cbs);
static void (*_arm_fdt_irq_handler)(void *) = NULL;
+static void (*_arm_fdt_timer_init)(void) = NULL;
int
arm_fdt_match(device_t parent, cfdata_t cf, void *aux)
@@ -145,6 +148,18 @@
}
void
+arm_fdt_timer_register(void (*timerfn)(void))
+{
+ if (_arm_fdt_timer_init != NULL) {
+#ifdef DIAGNOSTIC
+ aprint_verbose("%s: timer already registered\n", __func__);
+#endif
+ return;
+ }
+ _arm_fdt_timer_init = timerfn;
+}
+
+void
arm_fdt_memory_dump(paddr_t pa)
{
const struct arm_platform *plat = arm_fdt_platform();
@@ -166,3 +181,13 @@
bus_space_read_4(bst, bsh, i + 12));
}
}
+
+#ifdef __HAVE_GENERIC_CPU_INITCLOCKS
+void
+cpu_initclocks(void)
+{
+ if (_arm_fdt_timer_init == NULL)
+ panic("cpu_initclocks: no timer registered");
+ _arm_fdt_timer_init();
+}
+#endif
diff -r 9074086e9df7 -r 6d79a4c7827f sys/arch/arm/fdt/arm_fdtvar.h
--- a/sys/arch/arm/fdt/arm_fdtvar.h Thu Aug 24 11:37:25 2017 +0000
+++ b/sys/arch/arm/fdt/arm_fdtvar.h Thu Aug 24 13:06:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_fdtvar.h,v 1.6 2017/06/29 20:55:10 jmcneill Exp $ */
+/* $NetBSD: arm_fdtvar.h,v 1.7 2017/08/24 13:06:23 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -68,6 +68,8 @@
void arm_fdt_cpu_hatch_register(void *, void (*)(void *, struct cpu_info *));
void arm_fdt_cpu_hatch(struct cpu_info *);
+void arm_fdt_timer_register(void (*)(void));
+
void arm_fdt_irq_set_handler(void (*)(void *));
void arm_fdt_irq_handler(void *);
diff -r 9074086e9df7 -r 6d79a4c7827f sys/arch/arm/fdt/gtmr_fdt.c
--- a/sys/arch/arm/fdt/gtmr_fdt.c Thu Aug 24 11:37:25 2017 +0000
+++ b/sys/arch/arm/fdt/gtmr_fdt.c Thu Aug 24 13:06:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_fdt.c,v 1.4 2017/07/20 01:52:17 jmcneill Exp $ */
+/* $NetBSD: gtmr_fdt.c,v 1.5 2017/08/24 13:06:23 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmr_fdt.c,v 1.4 2017/07/20 01:52:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr_fdt.c,v 1.5 2017/08/24 13:06:23 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -78,6 +78,7 @@
config_found(self, &mpcaa, NULL);
arm_fdt_cpu_hatch_register(self, gtmr_fdt_cpu_hatch);
+ arm_fdt_timer_register(gtmr_cpu_initclocks);
}
static void
Home |
Main Index |
Thread Index |
Old Index