Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jun 2012 19:19:04 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236419 - in head/sys: amd64/acpica i386/acpica
Message-ID:  <201206011919.q51JJ4Gf038269@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Fri Jun  1 19:19:04 2012
New Revision: 236419
URL: http://svn.freebsd.org/changeset/base/236419

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

Modified:
  head/sys/amd64/acpica/acpi_wakeup.c
  head/sys/i386/acpica/acpi_wakeup.c

Modified: head/sys/amd64/acpica/acpi_wakeup.c
==============================================================================
--- head/sys/amd64/acpica/acpi_wakeup.c	Fri Jun  1 19:09:17 2012	(r236418)
+++ head/sys/amd64/acpica/acpi_wakeup.c	Fri Jun  1 19:19:04 2012	(r236419)
@@ -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, in
 #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, 
 
 	/* 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
 	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 *s
 			PCPU_SET(switchticks, ticks);
 #ifdef SMP
 			if (!CPU_EMPTY(&suspcpus))
-				acpi_wakeup_cpus(sc, &suspcpus);
+				acpi_wakeup_cpus(sc);
 #endif
 		}
 

Modified: head/sys/i386/acpica/acpi_wakeup.c
==============================================================================
--- head/sys/i386/acpica/acpi_wakeup.c	Fri Jun  1 19:09:17 2012	(r236418)
+++ head/sys/i386/acpica/acpi_wakeup.c	Fri Jun  1 19:19:04 2012	(r236419)
@@ -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, in
 #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, 
 
 	/* 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
 
 	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 *s
 			PCPU_SET(switchticks, ticks);
 #ifdef SMP
 			if (!CPU_EMPTY(&suspcpus))
-				acpi_wakeup_cpus(sc, &suspcpus);
+				acpi_wakeup_cpus(sc);
 #endif
 		}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206011919.q51JJ4Gf038269>