Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Deal with autoconfiguration madness by using co...



details:   https://anonhg.NetBSD.org/src/rev/fd43965ad9f9
branches:  trunk
changeset: 757207:fd43965ad9f9
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu Aug 19 05:09:53 2010 +0000

description:
Deal with autoconfiguration madness by using config_defer(9) to defer
config_interrupts(9) to be executed. This is necessary because: (a) the
initialization routines must be run only once after interrupts are enabled
and (b) all ACPI CPUs have attached.

diffstat:

 sys/dev/acpi/acpi_cpu.c |  23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diffs (75 lines):

diff -r 5d7161eb41d6 -r fd43965ad9f9 sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c   Thu Aug 19 04:12:45 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu.c   Thu Aug 19 05:09:53 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.19 2010/08/17 10:17:52 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.20 2010/08/19 05:09:53 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.19 2010/08/17 10:17:52 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.20 2010/08/19 05:09:53 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -51,6 +51,7 @@
 static int               acpicpu_detach(device_t, int);
 static int               acpicpu_once_attach(void);
 static int               acpicpu_once_detach(void);
+static void              acpicpu_prestart(device_t);
 static void              acpicpu_start(device_t);
 
 static int               acpicpu_object(ACPI_HANDLE, struct acpicpu_object *);
@@ -159,7 +160,7 @@
        acpicpu_pstate_attach(self);
        acpicpu_tstate_attach(self);
 
-       (void)config_defer(self, acpicpu_start);
+       (void)config_defer(self, acpicpu_prestart);
        (void)acpi_register_notify(sc->sc_node, acpicpu_notify);
        (void)pmf_device_register(self, acpicpu_suspend, acpicpu_resume);
 }
@@ -235,7 +236,7 @@
 }
 
 static void
-acpicpu_start(device_t self)
+acpicpu_prestart(device_t self)
 {
        struct acpicpu_softc *sc = device_private(self);
        static bool once = false;
@@ -245,10 +246,21 @@
                return;
        }
 
+       once = true;
+
+       (void)config_interrupts(self, acpicpu_start);
+}
+
+static void
+acpicpu_start(device_t self)
+{
+       struct acpicpu_softc *sc = device_private(self);
+
        /*
         * Run the state-specific initialization
         * routines. These should be called only
-        * once, after all ACPI CPUs have attached.
+        * once, after interrupts are enabled and
+        * all ACPI CPUs have attached.
         */
        if ((sc->sc_flags & ACPICPU_FLAG_C) != 0)
                acpicpu_cstate_start(self);
@@ -262,7 +274,6 @@
        aprint_debug_dev(sc->sc_dev, "ACPI CPUs started (cap "
            "0x%02x, flags 0x%06x)\n", sc->sc_cap, sc->sc_flags);
 
-       once = true;
        sc->sc_cold = false;
 }
 



Home | Main Index | Thread Index | Old Index