Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Nov 2004 19:45:08 -0800
From:      Nate Lawson <nate@root.org>
To:        Adam K Kirchhoff <adamk@voicenet.com>
Cc:        freebsd-acpi@freebsd.org
Subject:   Re: Laptop troubles...
Message-ID:  <419977C4.2010403@root.org>
In-Reply-To: <41990786.2070604@voicenet.com>
References:  <41910F00.3070402@voicenet.com> <419113BA.9000806@root.org> <41911D01.1090303@voicenet.com> <4191201A.4080406@root.org> <4191330A.7040707@voicenet.com> <41913F15.9060701@root.org> <419145A7.3000406@voicenet.com> <41914DCC.8000100@root.org> <20041112181038.GK31422@poupinou.org> <4198EDCD.8070306@root.org> <41990786.2070604@voicenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------060106050805090904050203
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Adam K Kirchhoff wrote:
> Nate Lawson wrote:
>> Right, thanks for the reminder.  I actually have quirk code to do this 
>> but it wasn't enabled since I wanted to find an actual test case 
>> before turning it on.  Adam, please recompile with the attached 
>> patch.  Also, send me pciconf -l.  The patch will disable C3 and you 
>> should only get C1/C2 if your system is truly a PIIX4.
>>
>> Thanks,
>> Nate
> 
> 
> 
> With that patch, I still have the option of setting C3.  And, if I do, I 
> get the lockups.  I'm attaching the output of pciconf -l.

Take 2.  This patch defers quirks till later.

-Nate

--------------060106050805090904050203
Content-Type: text/plain;
 name="cpu_quirks.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="cpu_quirks.diff"

Index: sys/dev/acpica/acpi_cpu.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/acpica/acpi_cpu.c,v
retrieving revision 1.45
diff -u -r1.45 acpi_cpu.c
--- sys/dev/acpica/acpi_cpu.c	11 Oct 2004 21:15:10 -0000	1.45
+++ sys/dev/acpica/acpi_cpu.c	16 Nov 2004 02:30:36 -0000
@@ -299,10 +299,6 @@
 				SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree),
 				OID_AUTO, "cpu", CTLFLAG_RD, 0, "");
 
-    /* If this is the first device probed, check for quirks. */
-    if (device_get_unit(dev) == 0)
-	acpi_cpu_quirks(sc);
-
     /*
      * Probe for throttling and Cx state support.
      * If none of these is present, free up unused resources.
@@ -674,6 +670,10 @@
     /* Get set of CPU devices */
     devclass_get_devices(acpi_cpu_devclass, &cpu_devices, &cpu_ndevices);
 
+    /* Check for quirks via the first CPU device. */
+    sc = device_get_softc(cpu_devices[0]);
+    acpi_cpu_quirks(sc);
+
     /*
      * Make sure all the processors' Cx counts match.  We should probably
      * also check the contents of each.  However, no known systems have
@@ -702,6 +702,10 @@
 acpi_cpu_startup_throttling()
 {
 
+    /* If throttling is not usable, don't initialize it. */
+    if (cpu_quirks & CPU_QUIRK_NO_THROTTLE)
+	return;
+
     /* Initialise throttling states */
     cpu_throttle_max = CPU_MAX_SPEED;
     cpu_throttle_state = CPU_MAX_SPEED;
@@ -737,13 +741,22 @@
 acpi_cpu_startup_cx()
 {
     struct acpi_cpu_softc *sc;
-    struct sbuf		 sb;
+    struct sbuf	sb;
     int i;
 
+    /*
+     * Set up the list of Cx states, eliminating C3 states by truncating
+     * cpu_cx_count if quirks indicate C3 is not usable.
+     */
     sc = device_get_softc(cpu_devices[0]);
     sbuf_new(&sb, cpu_cx_supported, sizeof(cpu_cx_supported), SBUF_FIXEDLEN);
-    for (i = 0; i < cpu_cx_count; i++)
-	sbuf_printf(&sb, "C%d/%d ", i + 1, sc->cpu_cx_states[i].trans_lat);
+    for (i = 0; i < cpu_cx_count; i++) {
+	if ((cpu_quirks & CPU_QUIRK_NO_C3) == 0 ||
+	    sc->cpu_cx_states[i].type != ACPI_STATE_C3)
+	    sbuf_printf(&sb, "C%d/%d ", i + 1, sc->cpu_cx_states[i].trans_lat);
+	else
+	    cpu_cx_count = i;
+    }
     sbuf_trim(&sb);
     sbuf_finish(&sb);
     SYSCTL_ADD_STRING(&acpi_cpu_sysctl_ctx,
@@ -966,6 +979,7 @@
 static int
 acpi_cpu_quirks(struct acpi_cpu_softc *sc)
 {
+    device_t acpi_dev;
 
     /*
      * C3 on multiple CPUs requires using the expensive flush cache
@@ -974,7 +988,6 @@
     if (mp_ncpus > 1)
 	cpu_quirks |= CPU_QUIRK_NO_BM_CTRL;
 
-#ifdef notyet
     /* Look for various quirks of the PIIX4 part. */
     acpi_dev = pci_find_device(PCI_VENDOR_INTEL, PCI_DEVICE_82371AB_3);
     if (acpi_dev != NULL) {
@@ -1011,7 +1024,6 @@
 	    break;
 	}
     }
-#endif
 
     return (0);
 }

--------------060106050805090904050203--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?419977C4.2010403>