powerpc/powermac: Constrain 'cpu_sleep()' for AIM to mpc745x

Rename cpu_sleep() to mpc745x_sleep() to denote what it's actually
intended for.  This function is very G4-specific, and will not work on
any other CPU.  This will afterward eliminate a
platform_smp_timebase_sync() call by directly updating the timebase
instead.
This commit is contained in:
Justin Hibbits 2021-03-31 11:54:11 -05:00
parent 95e56d31e3
commit b6d8f3b517
3 changed files with 20 additions and 3 deletions

View File

@ -721,8 +721,9 @@ flush_disable_caches(void)
mtmsr(msr);
}
#ifndef __powerpc64__
void
cpu_sleep()
mpc745x_sleep()
{
static u_quad_t timebase = 0;
static register_t sprgs[4];
@ -785,3 +786,4 @@ cpu_sleep()
enable_vec(curthread);
powerpc_sync();
}
#endif

View File

@ -144,10 +144,14 @@ extern register_t lpcr;
void cpu_halt(void);
void cpu_reset(void);
void cpu_sleep(void);
void flush_disable_caches(void);
void fork_trampoline(void);
void swi_vm(void *);
int cpu_machine_check(struct thread *, struct trapframe *, int *);
#ifndef __powerpc64__
void mpc745x_sleep(void);
#endif
#endif /* _MACHINE_CPU_H_ */

View File

@ -68,7 +68,9 @@ static int powermac_smp_get_bsp(platform_t, struct cpuref *cpuref);
static int powermac_smp_start_cpu(platform_t, struct pcpu *cpu);
static void powermac_smp_timebase_sync(platform_t, u_long tb, int ap);
static void powermac_reset(platform_t);
#ifndef __powerpc64__
static void powermac_sleep(platform_t);
#endif
static platform_method_t powermac_methods[] = {
PLATFORMMETHOD(platform_probe, powermac_probe),
@ -83,7 +85,9 @@ static platform_method_t powermac_methods[] = {
PLATFORMMETHOD(platform_smp_timebase_sync, powermac_smp_timebase_sync),
PLATFORMMETHOD(platform_reset, powermac_reset),
#ifndef __powerpc64__
PLATFORMMETHOD(platform_sleep, powermac_sleep),
#endif
PLATFORMMETHOD_END
};
@ -404,10 +408,17 @@ powermac_reset(platform_t platform)
OF_reboot();
}
#ifndef __powerpc64__
void
powermac_sleep(platform_t platform)
{
/* Only supports MPC745x for now. */
if (!MPC745X_P(mfspr(SPR_PVR) >> 16)) {
printf("sleep only supported for G4 PowerMac hardware.\n");
return;
}
*(unsigned long *)0x80 = 0x100;
cpu_sleep();
mpc745x_sleep();
}
#endif