Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Sep 2012 09:32:30 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        "freebsd-acpi@freebsd.org" <freebsd-acpi@FreeBSD.org>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   do we always have acpi_cpu for a cpu?
Message-ID:  <504EDAFE.3000601@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

I think that we always expect to have a one-to-one correspondence between
acpi_cpu devices and actual (APIC) CPUs.  acpi_pcpu_get_id() seems to even
assert that, if I am reading the code correctly.

The following patch adds the assert to acpi_cpu_idle as well and also removes
what I believe to be an obsolete comment about HTT CPUs.

    acpi_cpu: expect every cpu to have a corresponding acpi_cpu object

    ... via Processor object in ASL namespace.

diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 15201f9..203ed02 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -925,23 +925,15 @@ acpi_cpu_idle()
     uint32_t	start_time, end_time;
     int		bm_active, cx_next_idx, i;

+    sc = cpu_softc[PCPU_GET(cpuid)];
+    KASSERT(sc != NULL, ("acpi_cpu_idle: CPU without ACPI CPU"));
+
     /* If disabled, return immediately. */
     if (cpu_disable_idle) {
 	ACPI_ENABLE_IRQS();
 	return;
     }

-    /*
-     * Look up our CPU id to get our softc.  If it's NULL, we'll use C1
-     * since there is no ACPI processor object for this CPU.  This occurs
-     * for logical CPUs in the HTT case.
-     */
-    sc = cpu_softc[PCPU_GET(cpuid)];
-    if (sc == NULL) {
-	acpi_cpu_c1();
-	return;
-    }
-
     /* Find the lowest state that has small enough latency. */
     cx_next_idx = 0;
     if (cpu_disable_deep_sleep)

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?504EDAFE.3000601>