summaryrefslogtreecommitdiff
path: root/sys/arch/armv7
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2016-10-05 07:30:00 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2016-10-05 07:30:00 +0000
commit262f0f6c1197205331edd8d3e5b0ed1c0f9e2ba0 (patch)
tree35894ad7f2114e810775afe7986e46a6f891ffdc /sys/arch/armv7
parent565b3a220000a1f28815441fc4d3add80d4234de (diff)
Introduce a global function pointer to reset the CPU akin to amd64 and
i386. As newer ARMs where we use device tree from the get go don't necessarily have a 'platform', this will allow drivers to hook themselves as a way to reset the CPU. ok jsg@ kettenis@ tom@
Diffstat (limited to 'sys/arch/armv7')
-rw-r--r--sys/arch/armv7/armv7/armv7_machdep.c10
-rw-r--r--sys/arch/armv7/armv7/armv7_machdep.h3
-rw-r--r--sys/arch/armv7/armv7/platform.c9
3 files changed, 16 insertions, 6 deletions
diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c
index e869c2c6f70..bd5ea253766 100644
--- a/sys/arch/armv7/armv7/armv7_machdep.c
+++ b/sys/arch/armv7/armv7/armv7_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_machdep.c,v 1.40 2016/09/24 13:43:25 kettenis Exp $ */
+/* $OpenBSD: armv7_machdep.c,v 1.41 2016/10/05 07:29:59 patrick Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@@ -218,6 +218,8 @@ int comcnmode = CONMODE;
int stdout_node = 0;
+void (*cpuresetfn)(void);
+
/*
* void boot(int howto, char *bootstr)
*
@@ -243,7 +245,8 @@ boot(int howto)
}
printf("rebooting...\n");
delay(500000);
- platform_watchdog_reset();
+ if (cpuresetfn)
+ (*cpuresetfn)();
printf("reboot failed; spinning\n");
while(1);
/*NOTREACHED*/
@@ -290,7 +293,8 @@ boot(int howto)
printf("rebooting...\n");
delay(500000);
- platform_watchdog_reset();
+ if (cpuresetfn)
+ (*cpuresetfn)();
printf("reboot failed; spinning\n");
for (;;) ;
/* NOTREACHED */
diff --git a/sys/arch/armv7/armv7/armv7_machdep.h b/sys/arch/armv7/armv7/armv7_machdep.h
index 616613e375d..1dc1b82f4a4 100644
--- a/sys/arch/armv7/armv7/armv7_machdep.h
+++ b/sys/arch/armv7/armv7/armv7_machdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_machdep.h,v 1.9 2016/08/15 21:04:32 patrick Exp $ */
+/* $OpenBSD: armv7_machdep.h,v 1.10 2016/10/05 07:29:59 patrick Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -28,6 +28,7 @@ void platform_init_mainbus(struct device *);
void platform_disable_l2_if_needed(void);
struct board_dev *platform_board_devs();
void *fdt_find_cons(const char *);
+extern void (*cpuresetfn)(void);
struct armv7_platform {
struct board_dev *devs;
diff --git a/sys/arch/armv7/armv7/platform.c b/sys/arch/armv7/armv7/platform.c
index 02d264ce639..dd14b00e922 100644
--- a/sys/arch/armv7/armv7/platform.c
+++ b/sys/arch/armv7/armv7/platform.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: platform.c,v 1.14 2016/08/31 16:19:40 jsg Exp $ */
+/* $OpenBSD: platform.c,v 1.15 2016/10/05 07:29:59 patrick Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
*
@@ -81,7 +81,12 @@ platform_init(void)
if (platform != NULL)
break;
}
- if (platform && platform->board_init)
+
+ if (platform == NULL)
+ return;
+
+ cpuresetfn = platform_watchdog_reset;
+ if (platform->board_init)
platform->board_init();
}