Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Sep 2016 13:08:15 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r306263 - in head/sys/arm: allwinner arm broadcom/bcm2835 freescale/imx nvidia/tegra124 qemu ti
Message-ID:  <201609231308.u8ND8Ftr060306@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Fri Sep 23 13:08:15 2016
New Revision: 306263
URL: https://svnweb.freebsd.org/changeset/base/306263

Log:
  Move cpu_reset to be a platform method to allow multiple implementations.
  
  Reviewed by:	mmel
  Sponsored by:	ABT Systems Ltd
  Differential Revision:	https://reviews.freebsd.org/D8010

Modified:
  head/sys/arm/allwinner/aw_machdep.c
  head/sys/arm/arm/platform.c
  head/sys/arm/arm/platform_if.m
  head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
  head/sys/arm/freescale/imx/imx51_machdep.c
  head/sys/arm/freescale/imx/imx53_machdep.c
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/nvidia/tegra124/tegra124_machdep.c
  head/sys/arm/qemu/virt_machdep.c
  head/sys/arm/ti/ti_machdep.c

Modified: head/sys/arm/allwinner/aw_machdep.c
==============================================================================
--- head/sys/arm/allwinner/aw_machdep.c	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/allwinner/aw_machdep.c	Fri Sep 23 13:08:15 2016	(r306263)
@@ -146,8 +146,8 @@ allwinner_devmap_init(platform_t plat)
 	return (0);
 }
 
-void
-cpu_reset()
+static void
+allwinner_cpu_reset(platform_t plat)
 {
 	aw_wdog_watchdog_reset();
 	printf("Reset failed!\n");
@@ -159,6 +159,7 @@ static platform_method_t a10_methods[] =
 	PLATFORMMETHOD(platform_attach,         a10_attach),
 	PLATFORMMETHOD(platform_lastaddr,       allwinner_lastaddr),
 	PLATFORMMETHOD(platform_devmap_init,    allwinner_devmap_init),
+	PLATFORMMETHOD(platform_cpu_reset,	allwinner_cpu_reset),
 
 	PLATFORMMETHOD_END,
 };
@@ -170,6 +171,7 @@ static platform_method_t a13_methods[] =
 	PLATFORMMETHOD(platform_attach,         a13_attach),
 	PLATFORMMETHOD(platform_lastaddr,       allwinner_lastaddr),
 	PLATFORMMETHOD(platform_devmap_init,    allwinner_devmap_init),
+	PLATFORMMETHOD(platform_cpu_reset,	allwinner_cpu_reset),
 
 	PLATFORMMETHOD_END,
 };
@@ -181,6 +183,7 @@ static platform_method_t a20_methods[] =
 	PLATFORMMETHOD(platform_attach,         a20_attach),
 	PLATFORMMETHOD(platform_lastaddr,       allwinner_lastaddr),
 	PLATFORMMETHOD(platform_devmap_init,    allwinner_devmap_init),
+	PLATFORMMETHOD(platform_cpu_reset,	allwinner_cpu_reset),
 
 #ifdef SMP
 	PLATFORMMETHOD(platform_mp_start_ap,	aw_mp_start_ap),
@@ -196,6 +199,7 @@ static platform_method_t a31_methods[] =
 	PLATFORMMETHOD(platform_attach,         a31_attach),
 	PLATFORMMETHOD(platform_lastaddr,       allwinner_lastaddr),
 	PLATFORMMETHOD(platform_devmap_init,    allwinner_devmap_init),
+	PLATFORMMETHOD(platform_cpu_reset,	allwinner_cpu_reset),
 
 #ifdef SMP
 	PLATFORMMETHOD(platform_mp_start_ap,	aw_mp_start_ap),
@@ -211,6 +215,7 @@ static platform_method_t a31s_methods[] 
 	PLATFORMMETHOD(platform_attach,         a31s_attach),
 	PLATFORMMETHOD(platform_lastaddr,       allwinner_lastaddr),
 	PLATFORMMETHOD(platform_devmap_init,    allwinner_devmap_init),
+	PLATFORMMETHOD(platform_cpu_reset,	allwinner_cpu_reset),
 
 #ifdef SMP
 	PLATFORMMETHOD(platform_mp_start_ap,	aw_mp_start_ap),
@@ -226,6 +231,7 @@ static platform_method_t a83t_methods[] 
 	PLATFORMMETHOD(platform_attach,         a83t_attach),
 	PLATFORMMETHOD(platform_lastaddr,       allwinner_lastaddr),
 	PLATFORMMETHOD(platform_devmap_init,    allwinner_devmap_init),
+	PLATFORMMETHOD(platform_cpu_reset,	allwinner_cpu_reset),
 
 #ifdef SMP
 	PLATFORMMETHOD(platform_mp_start_ap,	a83t_mp_start_ap),
@@ -241,6 +247,7 @@ static platform_method_t h3_methods[] = 
 	PLATFORMMETHOD(platform_attach,         h3_attach),
 	PLATFORMMETHOD(platform_lastaddr,       allwinner_lastaddr),
 	PLATFORMMETHOD(platform_devmap_init,    allwinner_devmap_init),
+	PLATFORMMETHOD(platform_cpu_reset,	allwinner_cpu_reset),
 
 #ifdef SMP
 	PLATFORMMETHOD(platform_mp_start_ap,	aw_mp_start_ap),

Modified: head/sys/arm/arm/platform.c
==============================================================================
--- head/sys/arm/arm/platform.c	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/arm/platform.c	Fri Sep 23 13:08:15 2016	(r306263)
@@ -188,6 +188,20 @@ platform_late_init(void)
 	PLATFORM_LATE_INIT(plat_obj);
 }
 
+void
+cpu_reset(void)
+{
+
+	PLATFORM_CPU_RESET(plat_obj);
+
+	printf("cpu_reset failed");
+
+	intr_disable();
+	while(1) {
+		cpu_sleep(0);
+	}
+}
+
 #ifdef MULTIDELAY
 static void
 platform_delay(int usec, void *arg __unused)

Modified: head/sys/arm/arm/platform_if.m
==============================================================================
--- head/sys/arm/arm/platform_if.m	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/arm/platform_if.m	Fri Sep 23 13:08:15 2016	(r306263)
@@ -133,3 +133,10 @@ METHOD void mp_setmaxid {
 METHOD void mp_start_ap {
 	platform_t	_plat;
 };
+
+/**
+ * @brief Called by cpu_reset to reboot.
+ */
+METHOD void cpu_reset {
+	platform_t	_plat;
+};

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c	Fri Sep 23 13:08:15 2016	(r306263)
@@ -114,11 +114,10 @@ bcm2836_devmap_init(platform_t plat)
 
 
 
-void
-cpu_reset()
+static void
+bcm2835_cpu_reset(platform_t plat)
 {
 	bcmwd_watchdog_reset();
-	while (1);
 }
 
 #ifdef SOC_BCM2835
@@ -126,6 +125,7 @@ static platform_method_t bcm2835_methods
 	PLATFORMMETHOD(platform_devmap_init,	bcm2835_devmap_init),
 	PLATFORMMETHOD(platform_lastaddr,	bcm2835_lastaddr),
 	PLATFORMMETHOD(platform_late_init,	bcm2835_late_init),
+	PLATFORMMETHOD(platform_cpu_reset,	bcm2835_cpu_reset),
 
 	PLATFORMMETHOD_END,
 };

Modified: head/sys/arm/freescale/imx/imx51_machdep.c
==============================================================================
--- head/sys/arm/freescale/imx/imx51_machdep.c	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/freescale/imx/imx51_machdep.c	Fri Sep 23 13:08:15 2016	(r306263)
@@ -81,8 +81,8 @@ imx51_devmap_init(platform_t plat)
 	return (0);
 }
 
-void
-cpu_reset(void)
+static void
+imx51_cpu_reset(platform_t plat)
 {
 
 	imx_wdog_cpu_reset(0x73F98000);
@@ -97,6 +97,7 @@ static platform_method_t imx51_methods[]
 	PLATFORMMETHOD(platform_attach,		imx51_attach),
 	PLATFORMMETHOD(platform_devmap_init,	imx51_devmap_init),
 	PLATFORMMETHOD(platform_lastaddr,	imx51_lastaddr),
+	PLATFORMMETHOD(platform_cpu_reset,	imx51_cpu_reset),
 
 	PLATFORMMETHOD_END,
 };

Modified: head/sys/arm/freescale/imx/imx53_machdep.c
==============================================================================
--- head/sys/arm/freescale/imx/imx53_machdep.c	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/freescale/imx/imx53_machdep.c	Fri Sep 23 13:08:15 2016	(r306263)
@@ -81,8 +81,8 @@ imx53_devmap_init(platform_t plat)
 	return (0);
 }
 
-void
-cpu_reset(void)
+static void
+imx53_cpu_reset(platform_t plat)
 {
 
 	imx_wdog_cpu_reset(0x53F98000);
@@ -97,6 +97,7 @@ static platform_method_t imx53_methods[]
 	PLATFORMMETHOD(platform_attach,		imx53_attach),
 	PLATFORMMETHOD(platform_devmap_init,	imx53_devmap_init),
 	PLATFORMMETHOD(platform_lastaddr,	imx53_lastaddr),
+	PLATFORMMETHOD(platform_cpu_reset,	imx53_cpu_reset),
 
 	PLATFORMMETHOD_END,
 };

Modified: head/sys/arm/freescale/imx/imx6_machdep.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_machdep.c	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/freescale/imx/imx6_machdep.c	Fri Sep 23 13:08:15 2016	(r306263)
@@ -227,8 +227,8 @@ imx6_devmap_init(platform_t plat)
 	return (0);
 }
 
-void
-cpu_reset(void)
+static void
+imx6_cpu_reset(platform_t plat)
 {
 	const uint32_t IMX6_WDOG_CR_PHYS = 0x020bc000;
 
@@ -350,6 +350,7 @@ static platform_method_t imx6_methods[] 
 	PLATFORMMETHOD(platform_lastaddr,	imx6_lastaddr),
 	PLATFORMMETHOD(platform_devmap_init,	imx6_devmap_init),
 	PLATFORMMETHOD(platform_late_init,	imx6_late_init),
+	PLATFORMMETHOD(platform_cpu_reset,	imx6_cpu_reset),
 
 	PLATFORMMETHOD_END,
 };

Modified: head/sys/arm/nvidia/tegra124/tegra124_machdep.c
==============================================================================
--- head/sys/arm/nvidia/tegra124/tegra124_machdep.c	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/nvidia/tegra124/tegra124_machdep.c	Fri Sep 23 13:08:15 2016	(r306263)
@@ -97,8 +97,8 @@ tegra124_devmap_init(platform_t plat)
 	return (0);
 }
 
-void
-cpu_reset(void)
+static void
+tegra124_cpu_reset(platform_t plat)
 {
 	bus_space_handle_t pmc;
 	uint32_t reg;
@@ -148,6 +148,8 @@ static platform_method_t tegra124_method
 	PLATFORMMETHOD(platform_lastaddr,	tegra124_lastaddr),
 	PLATFORMMETHOD(platform_devmap_init,	tegra124_devmap_init),
 	PLATFORMMETHOD(platform_late_init,	tegra124_late_init),
+	PLATFORMMETHOD(platform_cpu_reset,	tegra124_cpu_reset),
+
 #ifdef SMP
 	PLATFORMMETHOD(platform_mp_start_ap,	tegra124_mp_start_ap),
 	PLATFORMMETHOD(platform_mp_setmaxid,	tegra124_mp_setmaxid),

Modified: head/sys/arm/qemu/virt_machdep.c
==============================================================================
--- head/sys/arm/qemu/virt_machdep.c	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/qemu/virt_machdep.c	Fri Sep 23 13:08:15 2016	(r306263)
@@ -44,13 +44,6 @@ __FBSDID("$FreeBSD$");
 
 #include "platform_if.h"
 
-void
-cpu_reset(void)
-{
-
-	while (1);
-}
-
 static vm_offset_t
 virt_lastaddr(platform_t plat)
 {

Modified: head/sys/arm/ti/ti_machdep.c
==============================================================================
--- head/sys/arm/ti/ti_machdep.c	Fri Sep 23 12:38:05 2016	(r306262)
+++ head/sys/arm/ti/ti_machdep.c	Fri Sep 23 13:08:15 2016	(r306263)
@@ -95,21 +95,20 @@ ti_am335x_devmap_init(platform_t plat)
 }
 #endif
 
-void
-cpu_reset()
+static void
+ti_plat_cpu_reset(platform_t plat)
 {
 	if (ti_cpu_reset)
 		(*ti_cpu_reset)();
 	else
 		printf("no cpu_reset implementation\n");
-	printf("Reset failed!\n");
-	while (1);
 }
 
 #if defined(SOC_OMAP4)
 static platform_method_t omap4_methods[] = {
 	PLATFORMMETHOD(platform_devmap_init,	ti_omap4_devmap_init),
 	PLATFORMMETHOD(platform_lastaddr,	ti_lastaddr),
+	PLATFORMMETHOD(platform_cpu_reset,	ti_plat_cpu_reset),
 
 	PLATFORMMETHOD_END,
 };
@@ -120,6 +119,7 @@ FDT_PLATFORM_DEF(omap4, "omap4", 0, "ti,
 static platform_method_t am335x_methods[] = {
 	PLATFORMMETHOD(platform_devmap_init,	ti_am335x_devmap_init),
 	PLATFORMMETHOD(platform_lastaddr,	ti_lastaddr),
+	PLATFORMMETHOD(platform_cpu_reset,	ti_plat_cpu_reset),
 
 	PLATFORMMETHOD_END,
 };



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609231308.u8ND8Ftr060306>