From 9745f424d15667d6e7adac11ad1044f5524ff5bc Mon Sep 17 00:00:00 2001 From: jhibbits Date: Sat, 9 Feb 2019 21:19:53 +0000 Subject: [PATCH] powerpc: Split out the e500mc idling from rest of Book-E The e500v2 and e500mc (and derivatives) have different idling procedures, so make them different functions. MFC after: 2 weeks --- sys/powerpc/powerpc/cpu.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c index da2f94da1a92..fe9600818533 100644 --- a/sys/powerpc/powerpc/cpu.c +++ b/sys/powerpc/powerpc/cpu.c @@ -89,6 +89,7 @@ int powerpc_pow_enabled; void (*cpu_idle_hook)(sbintime_t) = NULL; static void cpu_idle_60x(sbintime_t); static void cpu_idle_booke(sbintime_t); +static void cpu_idle_e500mc(sbintime_t sbt); #if defined(__powerpc64__) && defined(AIM) static void cpu_idle_powerx(sbintime_t); static void cpu_idle_power9(sbintime_t); @@ -585,10 +586,12 @@ cpu_booke_setup(int cpuid, uint16_t vers) switch (vers) { case FSL_E500mc: bitmask = HID0_E500MC_BITMASK; + cpu_idle_hook = cpu_idle_e500mc; break; case FSL_E5500: case FSL_E6500: bitmask = HID0_E5500_BITMASK; + cpu_idle_hook = cpu_idle_e500mc; break; case FSL_E500v1: case FSL_E500v2: @@ -753,26 +756,26 @@ cpu_idle_60x(sbintime_t sbt) #endif } +static void +cpu_idle_e500mc(sbintime_t sbt) +{ + /* + * Base binutils doesn't know what the 'wait' instruction is, so + * use the opcode encoding here. + */ + __asm __volatile(".long 0x7c00007c"); +} + static void cpu_idle_booke(sbintime_t sbt) { register_t msr; - uint16_t vers; msr = mfmsr(); - vers = mfpvr() >> 16; -#ifdef BOOKE - switch (vers) { - case FSL_E500mc: - case FSL_E5500: - case FSL_E6500: - break; - default: - powerpc_sync(); - mtmsr(msr | PSL_WE); - break; - } +#ifdef BOOKE_E500 + powerpc_sync(); + mtmsr(msr | PSL_WE); #endif }