From db08ae007dcfc1fba06aae1343a7448288e9c37e Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Fri, 1 Jun 2012 19:19:04 +0000 Subject: [PATCH] Tidy up code clutter in SMP case a bit. No functional change. --- sys/amd64/acpica/acpi_wakeup.c | 16 ++++++---------- sys/i386/acpica/acpi_wakeup.c | 16 ++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c index 3e869250cc6b..4a78a9596d6c 100644 --- a/sys/amd64/acpica/acpi_wakeup.c +++ b/sys/amd64/acpica/acpi_wakeup.c @@ -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 } diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c index 488226f35cb0..398ab4ca0c0b 100644 --- a/sys/i386/acpica/acpi_wakeup.c +++ b/sys/i386/acpica/acpi_wakeup.c @@ -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 }