do we always have acpi_cpu for a cpu?

Andriy Gapon avg at FreeBSD.org
Tue Sep 11 06:32:34 UTC 2012


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


More information about the freebsd-acpi mailing list