From 6708989b604f7a3fee32190ce7e7e8d0d8f571c7 Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Sat, 24 Feb 2018 01:46:56 +0000 Subject: [PATCH] Remove platform_cpu_idle() and platform_cpu_idle_wakeup() interfaces These interfaces were put in place to let QorIQ SoCs dictate CPU idling semantics, in order to support capabilities such as NAP mode and deep sleep. However, this never stabilized, and the idling support reverted back to CPU-level rather than SoC level. Move this code back to cpu.c instead. If at a later date the lower power modes do come to fruition, it should be done by overriding the cpu_idle_hook instead of this platform hook. --- sys/powerpc/include/platform.h | 2 -- sys/powerpc/mpc85xx/platform_mpc85xx.c | 29 -------------------------- sys/powerpc/powerpc/cpu.c | 24 +++++++++++++++++++-- sys/powerpc/powerpc/platform.c | 13 ------------ sys/powerpc/powerpc/platform_if.m | 24 --------------------- 5 files changed, 22 insertions(+), 70 deletions(-) diff --git a/sys/powerpc/include/platform.h b/sys/powerpc/include/platform.h index 6e2d615853e..d34c9c2d1e4 100644 --- a/sys/powerpc/include/platform.h +++ b/sys/powerpc/include/platform.h @@ -62,8 +62,6 @@ void platform_smp_ap_init(void); const char *installed_platform(void); void platform_probe_and_attach(void); -void platform_cpu_idle(int); - void platform_sleep(void); #endif /* _MACHINE_PLATFORM_H_ */ diff --git a/sys/powerpc/mpc85xx/platform_mpc85xx.c b/sys/powerpc/mpc85xx/platform_mpc85xx.c index 0acdbc2c38a..beca85d8111 100644 --- a/sys/powerpc/mpc85xx/platform_mpc85xx.c +++ b/sys/powerpc/mpc85xx/platform_mpc85xx.c @@ -95,8 +95,6 @@ static int mpc85xx_smp_next_cpu(platform_t, struct cpuref *cpuref); static int mpc85xx_smp_get_bsp(platform_t, struct cpuref *cpuref); static int mpc85xx_smp_start_cpu(platform_t, struct pcpu *cpu); static void mpc85xx_smp_timebase_sync(platform_t, u_long tb, int ap); -static void mpc85xx_idle(platform_t, int cpu); -static int mpc85xx_idle_wakeup(platform_t plat, int cpu); static void mpc85xx_reset(platform_t); @@ -113,8 +111,6 @@ static platform_method_t mpc85xx_methods[] = { PLATFORMMETHOD(platform_smp_timebase_sync, mpc85xx_smp_timebase_sync), PLATFORMMETHOD(platform_reset, mpc85xx_reset), - PLATFORMMETHOD(platform_idle, mpc85xx_idle), - PLATFORMMETHOD(platform_idle_wakeup, mpc85xx_idle_wakeup), PLATFORMMETHOD_END }; @@ -539,28 +535,3 @@ mpc85xx_smp_timebase_sync(platform_t plat, u_long tb, int ap) mttb(tb); } -static void -mpc85xx_idle(platform_t plat, int cpu) -{ - uint32_t reg; - - if (mpc85xx_is_qoriq()) { - /* - * Base binutils doesn't know what the 'wait' instruction is, so - * use the opcode encoding here. - */ - __asm __volatile("wrteei 1; .long 0x7c00007c"); - } else { - reg = mfmsr(); - /* Freescale E500 core RM section 6.4.1. */ - __asm __volatile("msync; mtmsr %0; isync" :: - "r" (reg | PSL_WE)); - } -} - -static int -mpc85xx_idle_wakeup(platform_t plat, int cpu) -{ - - return (0); -} diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c index 725e4601770..b26bf7f375e 100644 --- a/sys/powerpc/powerpc/cpu.c +++ b/sys/powerpc/powerpc/cpu.c @@ -719,9 +719,29 @@ cpu_idle_60x(sbintime_t sbt) static void cpu_idle_booke(sbintime_t sbt) { + register_t msr; + uint16_t vers; -#ifdef BOOKE_E500 - platform_cpu_idle(PCPU_GET(cpuid)); + msr = mfmsr(); + vers = mfpvr() >> 16; + +#ifdef BOOKE + switch (vers) { + case FSL_E500mc: + case FSL_E5500: + case FSL_E6500: + /* + * Base binutils doesn't know what the 'wait' instruction is, so + * use the opcode encoding here. + */ + __asm __volatile(".long 0x7c00007c"); + break; + default: + powerpc_sync(); + mtmsr(msr | PSL_WE); + isync(); + break; + } #endif } diff --git a/sys/powerpc/powerpc/platform.c b/sys/powerpc/powerpc/platform.c index ef9f2039edd..ab239c1f0eb 100644 --- a/sys/powerpc/powerpc/platform.c +++ b/sys/powerpc/powerpc/platform.c @@ -255,19 +255,6 @@ cpu_reset() PLATFORM_RESET(plat_obj); } -int -cpu_idle_wakeup(int cpu) -{ - return (PLATFORM_IDLE_WAKEUP(plat_obj, cpu)); -} - -void -platform_cpu_idle(int cpu) -{ - - PLATFORM_IDLE(plat_obj, cpu); -} - void platform_smp_timebase_sync(u_long tb, int ap) { diff --git a/sys/powerpc/powerpc/platform_if.m b/sys/powerpc/powerpc/platform_if.m index 691e79dca15..6b5b64689fb 100644 --- a/sys/powerpc/powerpc/platform_if.m +++ b/sys/powerpc/powerpc/platform_if.m @@ -84,14 +84,6 @@ CODE { { return; } - static void platform_null_idle(platform_t plat, int cpu) - { - return; - } - static int platform_null_idle_wakeup(platform_t plat, int cpu) - { - return (0); - } }; /** @@ -218,22 +210,6 @@ METHOD void reset { platform_t _plat; }; -/** - * @brief Idle a CPU - */ -METHOD void idle { - platform_t _plat; - int _cpu; -} DEFAULT platform_null_idle; - -/** - * @brief Wake up an idle CPU - */ -METHOD int idle_wakeup { - platform_t _plat; - int _cpu; -} DEFAULT platform_null_idle_wakeup; - /** * @brief Suspend the CPU */