Date: Mon, 2 Apr 2018 23:19:08 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331893 - in stable/11/sys/arm: allwinner arm broadcom/bcm2835 freescale/imx nvidia/tegra124 qemu ti Message-ID: <201804022319.w32NJ8HX063205@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gonzo Date: Mon Apr 2 23:19:07 2018 New Revision: 331893 URL: https://svnweb.freebsd.org/changeset/base/331893 Log: MFC r306263, r306268 r306263 by andrew: 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 r306268 by andrew: Also implement platform_cpu_reset on bcm2836 Modified: stable/11/sys/arm/allwinner/aw_machdep.c stable/11/sys/arm/arm/platform.c stable/11/sys/arm/arm/platform_if.m stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/11/sys/arm/freescale/imx/imx51_machdep.c stable/11/sys/arm/freescale/imx/imx53_machdep.c stable/11/sys/arm/freescale/imx/imx6_machdep.c stable/11/sys/arm/nvidia/tegra124/tegra124_machdep.c stable/11/sys/arm/qemu/virt_machdep.c stable/11/sys/arm/ti/ti_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/aw_machdep.c ============================================================================== --- stable/11/sys/arm/allwinner/aw_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/allwinner/aw_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -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: stable/11/sys/arm/arm/platform.c ============================================================================== --- stable/11/sys/arm/arm/platform.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/arm/platform.c Mon Apr 2 23:19:07 2018 (r331893) @@ -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: stable/11/sys/arm/arm/platform_if.m ============================================================================== --- stable/11/sys/arm/arm/platform_if.m Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/arm/platform_if.m Mon Apr 2 23:19:07 2018 (r331893) @@ -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: stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -116,11 +116,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 @@ -128,6 +127,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, }; @@ -139,6 +139,7 @@ static platform_method_t bcm2836_methods[] = { PLATFORMMETHOD(platform_devmap_init, bcm2836_devmap_init), PLATFORMMETHOD(platform_lastaddr, bcm2835_lastaddr), PLATFORMMETHOD(platform_late_init, bcm2835_late_init), + PLATFORMMETHOD(platform_cpu_reset, bcm2835_cpu_reset), PLATFORMMETHOD_END, }; Modified: stable/11/sys/arm/freescale/imx/imx51_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx51_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/freescale/imx/imx51_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -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: stable/11/sys/arm/freescale/imx/imx53_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx53_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/freescale/imx/imx53_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -77,8 +77,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); @@ -93,6 +93,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: stable/11/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/11/sys/arm/freescale/imx/imx6_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/freescale/imx/imx6_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -199,8 +199,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; @@ -326,6 +326,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: stable/11/sys/arm/nvidia/tegra124/tegra124_machdep.c ============================================================================== --- stable/11/sys/arm/nvidia/tegra124/tegra124_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/nvidia/tegra124/tegra124_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -93,8 +93,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; @@ -144,6 +144,8 @@ static platform_method_t tegra124_methods[] = { 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: stable/11/sys/arm/qemu/virt_machdep.c ============================================================================== --- stable/11/sys/arm/qemu/virt_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/qemu/virt_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -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: stable/11/sys/arm/ti/ti_machdep.c ============================================================================== --- stable/11/sys/arm/ti/ti_machdep.c Mon Apr 2 22:59:33 2018 (r331892) +++ stable/11/sys/arm/ti/ti_machdep.c Mon Apr 2 23:19:07 2018 (r331893) @@ -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,omap4430", 0); 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?201804022319.w32NJ8HX063205>