Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Remove the recently added ACPICPU_FLAG_INIT and...



details:   https://anonhg.NetBSD.org/src/rev/f9654314b60e
branches:  trunk
changeset: 756556:f9654314b60e
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Jul 23 05:32:02 2010 +0000

description:
Remove the recently added ACPICPU_FLAG_INIT and instead operate with the
existing ACPICPU_FLAG_C, as was intended. Set that flag only after the
idle-loop has been installed, so that the notify handler errors out if an
interrupt is received before the idle-loop is in place.

diffstat:

 sys/dev/acpi/acpi_cpu.c        |  19 ++++++++++---------
 sys/dev/acpi/acpi_cpu.h        |   3 +--
 sys/dev/acpi/acpi_cpu_cstate.c |  15 +++++++--------
 3 files changed, 18 insertions(+), 19 deletions(-)

diffs (148 lines):

diff -r 58165b207e93 -r f9654314b60e sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c   Fri Jul 23 02:46:12 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu.c   Fri Jul 23 05:32:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.4 2010/07/21 14:59:31 cegger Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.5 2010/07/23 05:32:02 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.4 2010/07/21 14:59:31 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.5 2010/07/23 05:32:02 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -78,6 +78,7 @@
 {
        struct acpi_attach_args *aa = aux;
        struct acpicpu_object ao;
+       int rv;
 
        if (aa->aa_node->ad_type != ACPI_TYPE_PROCESSOR)
                return 0;
@@ -85,9 +86,11 @@
        if (acpi_match_hid(aa->aa_node->ad_devinfo, acpicpu_hid) != 0)
                return 1;
 
-       int rv = acpicpu_object(aa->aa_node->ad_handle, &ao);
-       if (rv == 0 || acpicpu_id(ao.ao_procid) == 0xFFFFFF)
+       rv = acpicpu_object(aa->aa_node->ad_handle, &ao);
+
+       if (rv != 0 || acpicpu_id(ao.ao_procid) == 0xFFFFFF)
                return 0;
+
        return 1;
 }
 
@@ -101,7 +104,7 @@
 
        rv = acpicpu_object(aa->aa_node->ad_handle, &sc->sc_object);
 
-       if (rv == 0)
+       if (rv != 0)
                return;
 
        rv = RUN_ONCE(&once_attach, acpicpu_once_attach);
@@ -262,7 +265,7 @@
        if (buf.Pointer != NULL)
                ACPI_FREE(buf.Pointer);
 
-       return ACPI_FAILURE(rv) ? 0 : 1;
+       return ACPI_FAILURE(rv) ? 1 : 0;
 }
 
 static cpuid_t
@@ -272,6 +275,7 @@
        struct cpu_info *ci;
 
        for (CPU_INFO_FOREACH(cii, ci)) {
+
                if (id == ci->ci_cpuid)
                        return id;
        }
@@ -437,9 +441,6 @@
 
        sc = device_private(self);
 
-       if ((sc->sc_flags & ACPICPU_FLAG_INIT) == 0)
-               return;
-
        switch (evt) {
 
        case ACPICPU_C_NOTIFY:
diff -r 58165b207e93 -r f9654314b60e sys/dev/acpi/acpi_cpu.h
--- a/sys/dev/acpi/acpi_cpu.h   Fri Jul 23 02:46:12 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu.h   Fri Jul 23 05:32:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.h,v 1.3 2010/07/19 00:59:32 christos Exp $ */
+/* $NetBSD: acpi_cpu.h,v 1.4 2010/07/23 05:32:02 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -86,7 +86,6 @@
 #define ACPICPU_FLAG_C_NOC3     __BIT(7)
 #define ACPICPU_FLAG_C_MWAIT    __BIT(8)
 #define ACPICPU_FLAG_C_C1E      __BIT(9)
-#define ACPICPU_FLAG_INIT       __BIT(31)
 
 struct acpicpu_cstate {
        uint64_t                 cs_stat;
diff -r 58165b207e93 -r f9654314b60e sys/dev/acpi/acpi_cpu_cstate.c
--- a/sys/dev/acpi/acpi_cpu_cstate.c    Fri Jul 23 02:46:12 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu_cstate.c    Fri Jul 23 05:32:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_cstate.c,v 1.5 2010/07/19 00:59:32 christos Exp $ */
+/* $NetBSD: acpi_cpu_cstate.c,v 1.6 2010/07/23 05:32:02 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_cstate.c,v 1.5 2010/07/19 00:59:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.6 2010/07/23 05:32:02 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -94,12 +94,12 @@
        switch (rv) {
 
        case AE_OK:
-               sc->sc_flags |= ACPICPU_FLAG_C | ACPICPU_FLAG_C_CST;
+               sc->sc_flags |= ACPICPU_FLAG_C_CST;
                acpicpu_cstate_cst_bios();
                break;
 
        default:
-               sc->sc_flags |= ACPICPU_FLAG_C | ACPICPU_FLAG_C_FADT;
+               sc->sc_flags |= ACPICPU_FLAG_C_FADT;
                acpicpu_cstate_fadt(sc);
                break;
        }
@@ -192,9 +192,6 @@
        static ONCE_DECL(once_save);
        int rv;
 
-       if ((sc->sc_flags & ACPICPU_FLAG_C) == 0)
-               return 0;
-
        /*
         * Save the existing idle-mechanism and claim the idle_loop(9).
         * This should be called after all ACPI CPUs have been attached.
@@ -205,8 +202,10 @@
                return rv;
 
        rv = RUN_ONCE(&once_start, acpicpu_md_idle_start);
+
        if (rv == 0)
-               sc->sc_flags |= ACPICPU_FLAG_INIT;
+               sc->sc_flags |= ACPICPU_FLAG_C;
+
        return rv;
 }
 



Home | Main Index | Thread Index | Old Index