svn commit: r210315 - in stable/8/sys: amd64/acpica conf dev/acpica modules/acpi/acpi

Jung-uk Kim jkim at FreeBSD.org
Tue Jul 20 20:15:33 UTC 2010


Author: jkim
Date: Tue Jul 20 20:15:32 2010
New Revision: 210315
URL: http://svn.freebsd.org/changeset/base/210315

Log:
  MFC:	r209957, r210003, r210005
  
  - Move i386-inherited logic of building ACPI headers for acpi_wakeup.c into
  better places and remove intermediate makefile and shell scripts.  This
  makes parallel kernel build little bit safer for amd64.
  - Make SMP code path in acpi.c conditional at run-time.
  - Define SMP unconditionally for amd64 and remove opt_global.h from SRCS in
  sys/modules/acpi/acpi/Makefile.  Note it is done just for correctness sake
  because we do not build, ship, or support acpi.ko on amd64.

Deleted:
  stable/8/sys/amd64/acpica/Makefile
  stable/8/sys/amd64/acpica/genwakecode.sh
  stable/8/sys/amd64/acpica/genwakedata.sh
Modified:
  stable/8/sys/amd64/acpica/acpi_wakecode.S
  stable/8/sys/conf/files.amd64
  stable/8/sys/dev/acpica/acpi.c
  stable/8/sys/modules/acpi/acpi/Makefile
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/amd64/acpica/acpi_wakecode.S
==============================================================================
--- stable/8/sys/amd64/acpica/acpi_wakecode.S	Tue Jul 20 19:43:25 2010	(r210314)
+++ stable/8/sys/amd64/acpica/acpi_wakecode.S	Tue Jul 20 20:15:32 2010	(r210315)
@@ -29,8 +29,6 @@
  * $FreeBSD$
  */
 
-#define LOCORE
-
 #include <machine/asmacros.h>
 #include <machine/specialreg.h>
 

Modified: stable/8/sys/conf/files.amd64
==============================================================================
--- stable/8/sys/conf/files.amd64	Tue Jul 20 19:43:25 2010	(r210314)
+++ stable/8/sys/conf/files.amd64	Tue Jul 20 20:15:32 2010	(r210315)
@@ -70,17 +70,26 @@ hptrr_lib.o			optional	hptrr			\
 amd64/acpica/OsdEnvironment.c	optional	acpi
 amd64/acpica/acpi_machdep.c	optional	acpi
 amd64/acpica/acpi_switch.S	optional	acpi
-acpi_wakecode.h			optional acpi		\
-	dependency 	"$S/amd64/acpica/acpi_wakecode.S assym.s"	\
-	compile-with	"${MAKE} -f $S/amd64/acpica/Makefile ${.TARGET} MAKESRCPATH=$S/amd64/acpica"	\
+acpi_wakecode.o			optional	acpi			\
+	dependency	"$S/amd64/acpica/acpi_wakecode.S assym.s"	\
+	compile-with	"${NORMAL_S}"					\
 	no-obj no-implicit-rule before-depend				\
-	clean		"acpi_wakecode.h acpi_wakecode.o acpi_wakecode.bin"
-#
-acpi_wakedata.h			optional acpi		\
-	dependency 	"$S/amd64/acpica/acpi_wakecode.S assym.s"	\
-	compile-with	"${MAKE} -f $S/amd64/acpica/Makefile ${.TARGET} MAKESRCPATH=$S/amd64/acpica"	\
-	no-obj no-implicit-rule before-depend				\
-	clean		"acpi_wakedata.h acpi_wakecode.o acpi_wakecode.bin"
+	clean		"acpi_wakecode.o"
+acpi_wakecode.bin		optional	acpi			\
+	dependency	"acpi_wakecode.o"				\
+	compile-with	"objcopy -S -O binary acpi_wakecode.o ${.TARGET}" \
+	no-obj no-implicit-rule	before-depend				\
+	clean		"acpi_wakecode.bin"
+acpi_wakecode.h			optional	acpi			\
+	dependency	"acpi_wakecode.bin"				\
+	compile-with	"file2c -sx 'static char wakecode[] = {' '};' < acpi_wakecode.bin > ${.TARGET}" \
+	no-obj no-implicit-rule	before-depend				\
+	clean		"acpi_wakecode.h"
+acpi_wakedata.h			optional	acpi			\
+	dependency	"acpi_wakecode.o"				\
+	compile-with	'nm -n --defined-only acpi_wakecode.o | while read offset dummy what; do echo "#define	$${what}	0x$${offset}"; done > ${.TARGET}' \
+	no-obj no-implicit-rule	before-depend				\
+	clean		"acpi_wakedata.h"
 #
 amd64/acpica/acpi_wakeup.c	optional	acpi
 amd64/acpica/madt.c		optional	acpi

Modified: stable/8/sys/dev/acpica/acpi.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi.c	Tue Jul 20 19:43:25 2010	(r210314)
+++ stable/8/sys/dev/acpica/acpi.c	Tue Jul 20 20:15:32 2010	(r210315)
@@ -46,9 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/linker.h>
 #include <sys/power.h>
 #include <sys/sbuf.h>
-#ifdef SMP
 #include <sys/sched.h>
-#endif
 #include <sys/smp.h>
 #include <sys/timetc.h>
 
@@ -2536,11 +2534,11 @@ acpi_EnterSleepState(struct acpi_softc *
 	return_ACPI_STATUS (AE_OK);
     }
 
-#ifdef SMP
-    thread_lock(curthread);
-    sched_bind(curthread, 0);
-    thread_unlock(curthread);
-#endif
+    if (smp_started) {
+	thread_lock(curthread);
+	sched_bind(curthread, 0);
+	thread_unlock(curthread);
+    }
 
     /*
      * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE
@@ -2621,11 +2619,11 @@ backout:
 
     mtx_unlock(&Giant);
 
-#ifdef SMP
-    thread_lock(curthread);
-    sched_unbind(curthread);
-    thread_unlock(curthread);
-#endif
+    if (smp_started) {
+	thread_lock(curthread);
+	sched_unbind(curthread);
+	thread_unlock(curthread);
+    }
 
     /* Allow another sleep request after a while. */
     timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME);

Modified: stable/8/sys/modules/acpi/acpi/Makefile
==============================================================================
--- stable/8/sys/modules/acpi/acpi/Makefile	Tue Jul 20 19:43:25 2010	(r210314)
+++ stable/8/sys/modules/acpi/acpi/Makefile	Tue Jul 20 20:15:32 2010	(r210315)
@@ -99,15 +99,28 @@ SRCS+=	assym.s madt.c
 CLEANFILES+=	acpi_wakecode.bin acpi_wakecode.h acpi_wakecode.o
 
 .if ${MACHINE_ARCH} == "amd64"
-SRCS+=	acpi_switch.S opt_global.h
+.if !defined(KERNBUILDDIR)
+CFLAGS+=-DSMP
+.endif
+SRCS+=	acpi_switch.S acpi_wakedata.h
 CLEANFILES+=	acpi_wakedata.h
 ASM_CFLAGS=	-x assembler-with-cpp -DLOCORE ${CFLAGS}
 acpi_switch.o:	acpi_switch.S
 	${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
-.endif
-
+acpi_wakecode.o: acpi_wakecode.S assym.s
+	${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
+acpi_wakecode.bin: acpi_wakecode.o
+	objcopy -S -O binary acpi_wakecode.o ${.TARGET}
+acpi_wakecode.h: acpi_wakecode.bin
+	file2c -sx 'static char wakecode[] = {' '};' < acpi_wakecode.bin > \
+	    ${.TARGET}
+acpi_wakedata.h: acpi_wakecode.o
+	nm -n --defined-only ${.ALLSRC} | while read offset dummy what; do \
+	    echo "#define	$${what}	0x$${offset}"; done > ${.TARGET}
+.else
 acpi_wakecode.h: acpi_wakecode.S assym.s
 	${MAKE} -f ${.CURDIR}/../../../${MACHINE_ARCH}/acpica/Makefile \
 		MAKESRCPATH=${.CURDIR}/../../../${MACHINE_ARCH}/acpica
+.endif
 
 .include <bsd.kmod.mk>


More information about the svn-src-stable-8 mailing list