From 838bef5496ab7bb5073d3bea6a05c52c213f7800 Mon Sep 17 00:00:00 2001 From: YONETANI Tomokazu Date: Fri, 23 Sep 2005 02:28:50 +0000 Subject: [PATCH] - Catch up with rev 1.157 of sys/dev/acpica/acpi.c in FreeBSD: Don't forget to pass shutdown events down to children first now that we handle them at the bus level too. This should prevent acpi_cpu_idle() from doing something nasty in the middle of shutdown procedure(by turning of cpu_cx_count). - Move prototype for cpu_idle_hook into . - In acpi_cpu_shutdown(), use lwkt_cpusync_simple() to synchronize CPUs instead of dropping into DDB. Reported-by: Rumko --- sys/dev/acpica5/acpi.c | 9 ++++----- sys/dev/acpica5/acpi_cpu.c | 9 ++++----- sys/i386/include/md_var.h | 3 ++- sys/platform/pc32/include/md_var.h | 3 ++- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/dev/acpica5/acpi.c b/sys/dev/acpica5/acpi.c index 9ff86f9aa8..f05c1cba9c 100644 --- a/sys/dev/acpica5/acpi.c +++ b/sys/dev/acpica5/acpi.c @@ -26,8 +26,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.156 2004/06/05 07:25:58 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi.c,v 1.13 2005/09/17 23:53:47 dillon Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.157 2004/06/05 09:56:04 njl Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi.c,v 1.14 2005/09/23 02:28:50 y0netan1 Exp $ */ #include "opt_acpi.h" @@ -60,8 +60,6 @@ #include MALLOC_DEFINE(M_ACPIDEV, "acpidev", "ACPI devices"); -extern void cpu_idle_default_hook(void); -extern void (*cpu_idle_hook)(void); /* Hooks for the ACPI CA debugging infrastructure */ #define _COMPONENT ACPI_BUS @@ -624,6 +622,8 @@ acpi_attach(device_t dev) static int acpi_shutdown(device_t dev) { + /* Allow children to shutdown first. */ + bus_generic_shutdown(dev); /* Disable all wake GPEs not appropriate for reboot/poweroff. */ acpi_wake_limit_walk(ACPI_STATE_S5); @@ -1209,7 +1209,6 @@ acpi_shutdown_final(void *arg, int howto) acpi_shutdown_poweroff(NULL); } else { printf("Shutting down ACPI\n"); - cpu_idle_hook = cpu_idle_default_hook; AcpiTerminate(); } } diff --git a/sys/dev/acpica5/acpi_cpu.c b/sys/dev/acpica5/acpi_cpu.c index 7e65d7998b..b9bd46b604 100644 --- a/sys/dev/acpica5/acpi_cpu.c +++ b/sys/dev/acpica5/acpi_cpu.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/acpica/acpi_cpu.c,v 1.41 2004/06/24 00:38:51 njl Exp $ - * $DragonFly: src/sys/dev/acpica5/acpi_cpu.c,v 1.10 2005/08/29 21:07:59 dillon Exp $ + * $DragonFly: src/sys/dev/acpica5/acpi_cpu.c,v 1.11 2005/09/23 02:28:50 y0netan1 Exp $ */ #include "opt_acpi.h" @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -372,7 +373,8 @@ acpi_cpu_shutdown(device_t dev) /* Signal and wait for all processors to exit acpi_cpu_idle(). */ #ifdef SMP - KKASSERT(0); /* XXX use rendezvous */ + if (mycpu->gd_cpuid == 0) + lwkt_cpusync_simple(0, NULL, NULL); #endif DELAY(1); @@ -783,9 +785,6 @@ acpi_cpu_startup_throttling() CPU_SPEED_PRINTABLE(cpu_throttle_state)); } -/* XXX: not here */ -extern void (*cpu_idle_hook)(void); - static void acpi_cpu_startup_cx() { diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h index b04c80437c..73088dceec 100644 --- a/sys/i386/include/md_var.h +++ b/sys/i386/include/md_var.h @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/md_var.h,v 1.35.2.4 2003/01/22 20:14:53 jhb Exp $ - * $DragonFly: src/sys/i386/include/Attic/md_var.h,v 1.15 2005/06/20 17:43:39 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/md_var.h,v 1.16 2005/09/23 02:28:50 y0netan1 Exp $ */ #ifndef _MACHINE_MD_VAR_H_ @@ -46,6 +46,7 @@ extern int (*copyin_vector) (const void *udaddr, void *kaddr, size_t len); extern int (*copyout_vector) (const void *kaddr, void *udaddr, size_t len); +extern void (*cpu_idle_hook)(void); extern u_int cpu_exthigh; extern u_int cpu_feature; extern u_int cpu_fxsr; diff --git a/sys/platform/pc32/include/md_var.h b/sys/platform/pc32/include/md_var.h index 441e363abe..8058525a61 100644 --- a/sys/platform/pc32/include/md_var.h +++ b/sys/platform/pc32/include/md_var.h @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/md_var.h,v 1.35.2.4 2003/01/22 20:14:53 jhb Exp $ - * $DragonFly: src/sys/platform/pc32/include/md_var.h,v 1.15 2005/06/20 17:43:39 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/md_var.h,v 1.16 2005/09/23 02:28:50 y0netan1 Exp $ */ #ifndef _MACHINE_MD_VAR_H_ @@ -46,6 +46,7 @@ extern int (*copyin_vector) (const void *udaddr, void *kaddr, size_t len); extern int (*copyout_vector) (const void *kaddr, void *udaddr, size_t len); +extern void (*cpu_idle_hook)(void); extern u_int cpu_exthigh; extern u_int cpu_feature; extern u_int cpu_fxsr; -- 2.11.4.GIT