Module Name: src
Committed By: jruoho
Date: Fri Jul 23 05:32:02 UTC 2010
Modified Files:
src/sys/dev/acpi: acpi_cpu.c acpi_cpu.h acpi_cpu_cstate.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpi_cpu.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_cpu.h
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpi_cpu_cstate.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/acpi/acpi_cpu.c
diff -u src/sys/dev/acpi/acpi_cpu.c:1.4 src/sys/dev/acpi/acpi_cpu.c:1.5
--- src/sys/dev/acpi/acpi_cpu.c:1.4 Wed Jul 21 14:59:31 2010
+++ src/sys/dev/acpi/acpi_cpu.c Fri Jul 23 05:32:02 2010
@@ -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 <[email protected]>
@@ -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:
Index: src/sys/dev/acpi/acpi_cpu.h
diff -u src/sys/dev/acpi/acpi_cpu.h:1.3 src/sys/dev/acpi/acpi_cpu.h:1.4
--- src/sys/dev/acpi/acpi_cpu.h:1.3 Mon Jul 19 00:59:32 2010
+++ src/sys/dev/acpi/acpi_cpu.h Fri Jul 23 05:32:02 2010
@@ -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 <[email protected]>
@@ -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;
Index: src/sys/dev/acpi/acpi_cpu_cstate.c
diff -u src/sys/dev/acpi/acpi_cpu_cstate.c:1.5 src/sys/dev/acpi/acpi_cpu_cstate.c:1.6
--- src/sys/dev/acpi/acpi_cpu_cstate.c:1.5 Mon Jul 19 00:59:32 2010
+++ src/sys/dev/acpi/acpi_cpu_cstate.c Fri Jul 23 05:32:02 2010
@@ -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 <[email protected]>
@@ -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;
}