Author: jhibbits
Date: Sat Feb 24 01:46:56 2018
New Revision: 329891
URL: https://svnweb.freebsd.org/changeset/base/329891

Log:
  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.

Modified:
  head/sys/powerpc/include/platform.h
  head/sys/powerpc/mpc85xx/platform_mpc85xx.c
  head/sys/powerpc/powerpc/cpu.c
  head/sys/powerpc/powerpc/platform.c
  head/sys/powerpc/powerpc/platform_if.m

Modified: head/sys/powerpc/include/platform.h
==============================================================================
--- head/sys/powerpc/include/platform.h Sat Feb 24 01:33:17 2018        
(r329890)
+++ head/sys/powerpc/include/platform.h Sat Feb 24 01:46:56 2018        
(r329891)
@@ -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_ */

Modified: head/sys/powerpc/mpc85xx/platform_mpc85xx.c
==============================================================================
--- head/sys/powerpc/mpc85xx/platform_mpc85xx.c Sat Feb 24 01:33:17 2018        
(r329890)
+++ head/sys/powerpc/mpc85xx/platform_mpc85xx.c Sat Feb 24 01:46:56 2018        
(r329891)
@@ -95,8 +95,6 @@ static int mpc85xx_smp_next_cpu(platform_t, struct cpu
 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, 
        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);
-}

Modified: head/sys/powerpc/powerpc/cpu.c
==============================================================================
--- head/sys/powerpc/powerpc/cpu.c      Sat Feb 24 01:33:17 2018        
(r329890)
+++ head/sys/powerpc/powerpc/cpu.c      Sat Feb 24 01:46:56 2018        
(r329891)
@@ -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
 }
 

Modified: head/sys/powerpc/powerpc/platform.c
==============================================================================
--- head/sys/powerpc/powerpc/platform.c Sat Feb 24 01:33:17 2018        
(r329890)
+++ head/sys/powerpc/powerpc/platform.c Sat Feb 24 01:46:56 2018        
(r329891)
@@ -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)
 {
 

Modified: head/sys/powerpc/powerpc/platform_if.m
==============================================================================
--- head/sys/powerpc/powerpc/platform_if.m      Sat Feb 24 01:33:17 2018        
(r329890)
+++ head/sys/powerpc/powerpc/platform_if.m      Sat Feb 24 01:46:56 2018        
(r329891)
@@ -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);
-       }
 };
 
 /**
@@ -217,22 +209,6 @@ METHOD cpu_group_t smp_topo {
 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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to