Tidy up code clutter in SMP case a bit. No functional change.

This commit is contained in:
jkim 2012-06-01 19:19:04 +00:00
parent fde5297347
commit 9f23b1491f
2 changed files with 12 additions and 20 deletions

View File

@ -71,15 +71,12 @@ extern int acpi_reset_video;
#ifdef SMP
extern struct pcb **susppcbs;
extern void **suspfpusave;
static cpuset_t suspcpus;
#else
static struct pcb **susppcbs;
static void **suspfpusave;
#endif
#ifdef SMP
static cpuset_t suspcpus;
#endif
int acpi_restorecpu(uint64_t, vm_offset_t);
static void *acpi_alloc_wakeup_handler(void);
@ -87,7 +84,7 @@ static void acpi_stop_beep(void *);
#ifdef SMP
static int acpi_wakeup_ap(struct acpi_softc *, int);
static void acpi_wakeup_cpus(struct acpi_softc *, const cpuset_t *);
static void acpi_wakeup_cpus(struct acpi_softc *);
#endif
#define WAKECODE_VADDR(sc) ((sc)->acpi_wakeaddr + (3 * PAGE_SIZE))
@ -184,7 +181,7 @@ acpi_wakeup_ap(struct acpi_softc *sc, int cpu)
#define BIOS_WARM (0x0a)
static void
acpi_wakeup_cpus(struct acpi_softc *sc, const cpuset_t *wakeup_cpus)
acpi_wakeup_cpus(struct acpi_softc *sc)
{
uint32_t mpbioswarmvec;
int cpu;
@ -203,7 +200,7 @@ acpi_wakeup_cpus(struct acpi_softc *sc, const cpuset_t *wakeup_cpus)
/* Wake up each AP. */
for (cpu = 1; cpu < mp_ncpus; cpu++) {
if (!CPU_ISSET(cpu, wakeup_cpus))
if (!CPU_ISSET(cpu, &suspcpus))
continue;
if (acpi_wakeup_ap(sc, cpu) == 0) {
/* restore the warmstart vector */
@ -244,8 +241,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
if (savectx(susppcbs[0])) {
ctx_fpusave(suspfpusave[0]);
#ifdef SMP
if (!CPU_EMPTY(&suspcpus) &&
suspend_cpus(suspcpus) == 0) {
if (!CPU_EMPTY(&suspcpus) && suspend_cpus(suspcpus) == 0) {
device_printf(sc->acpi_dev, "Failed to suspend APs\n");
return (0); /* couldn't sleep */
}
@ -300,7 +296,7 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result,
PCPU_SET(switchticks, ticks);
#ifdef SMP
if (!CPU_EMPTY(&suspcpus))
acpi_wakeup_cpus(sc, &suspcpus);
acpi_wakeup_cpus(sc);
#endif
}

View File

@ -70,20 +70,17 @@ extern int acpi_reset_video;
#ifdef SMP
extern struct pcb **susppcbs;
static cpuset_t suspcpus;
#else
static struct pcb **susppcbs;
#endif
#ifdef SMP
static cpuset_t suspcpus;
#endif
static void *acpi_alloc_wakeup_handler(void);
static void acpi_stop_beep(void *);
#ifdef SMP
static int acpi_wakeup_ap(struct acpi_softc *, int);
static void acpi_wakeup_cpus(struct acpi_softc *, const cpuset_t *);
static void acpi_wakeup_cpus(struct acpi_softc *);
#endif
#define ACPI_PAGETABLES 0
@ -176,7 +173,7 @@ acpi_wakeup_ap(struct acpi_softc *sc, int cpu)
#define BIOS_WARM (0x0a)
static void
acpi_wakeup_cpus(struct acpi_softc *sc, const cpuset_t *wakeup_cpus)
acpi_wakeup_cpus(struct acpi_softc *sc)
{
uint32_t mpbioswarmvec;
int cpu;
@ -195,7 +192,7 @@ acpi_wakeup_cpus(struct acpi_softc *sc, const cpuset_t *wakeup_cpus)
/* Wake up each AP. */
for (cpu = 1; cpu < mp_ncpus; cpu++) {
if (!CPU_ISSET(cpu, wakeup_cpus))
if (!CPU_ISSET(cpu, &suspcpus))
continue;
if (acpi_wakeup_ap(sc, cpu) == 0) {
/* restore the warmstart vector */
@ -235,8 +232,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
if (suspendctx(susppcbs[0])) {
#ifdef SMP
if (!CPU_EMPTY(&suspcpus) &&
suspend_cpus(suspcpus) == 0) {
if (!CPU_EMPTY(&suspcpus) && suspend_cpus(suspcpus) == 0) {
device_printf(sc->acpi_dev, "Failed to suspend APs\n");
return (0); /* couldn't sleep */
}
@ -286,7 +282,7 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result,
PCPU_SET(switchticks, ticks);
#ifdef SMP
if (!CPU_EMPTY(&suspcpus))
acpi_wakeup_cpus(sc, &suspcpus);
acpi_wakeup_cpus(sc);
#endif
}