piix4e: quirk/fix for proper throttling duty width

Andriy Gapon avg at icyb.net.ua
Mon Mar 16 09:11:09 PDT 2009


Intel documentation on PIIX4E unambiguously specifies CPU throttling duty offset
and width. It seems that some vendor BIOS specify an incorrect (smaller) value for
the width for unknown reason.
I have a private patch for this.
This is unlikely to be ever committed to freebsd source because of minor
importance (of both the feature and the very old hardware) and potential risks.
But someone might find this useful, so I am sharing.


diff --git a/sys/dev/acpica/acpi_throttle.c b/sys/dev/acpica/acpi_throttle.c
index d79d7ae..a0ad5ae 100644
--- a/sys/dev/acpica/acpi_throttle.c
+++ b/sys/dev/acpica/acpi_throttle.c
@@ -80,11 +80,14 @@ struct acpi_throttle_softc {
 				(CPU_SPEED_PERCENT(x) % 10)
 #define CPU_P_CNT_THT_EN	(1<<4)
 #define CPU_QUIRK_NO_THROTTLE	(1<<1)	/* Throttling is not usable. */
+#define CPU_QUIRK_PIIX4_WIDTH	(1<<2)

 #define PCI_VENDOR_INTEL	0x8086
 #define PCI_DEVICE_82371AB_3	0x7113	/* PIIX4 chipset for quirks. */
 #define PCI_REVISION_A_STEP	0
 #define PCI_REVISION_B_STEP	1
+#define PCI_REVISION_4E		2
+#define PCI_REVISION_4M		3

 static uint32_t	cpu_duty_offset;	/* Offset in P_CNT of throttle val. */
 static uint32_t	cpu_duty_width;		/* Bit width of throttle value. */
@@ -247,6 +250,8 @@ acpi_throttle_evaluate(struct acpi_throttle_softc *sc)
 	}
 	if (cpu_duty_width == 0 || (thr_quirks & CPU_QUIRK_NO_THROTTLE) != 0)
 		return (ENXIO);
+	if ((thr_quirks & CPU_QUIRK_PIIX4_WIDTH) != 0)
+		cpu_duty_width = 3;

 	/* Validate the duty offset/width. */
 	duty_end = cpu_duty_offset + cpu_duty_width - 1;
@@ -333,8 +338,14 @@ acpi_throttle_quirks(struct acpi_throttle_softc *sc)
 		case PCI_REVISION_A_STEP:
 		case PCI_REVISION_B_STEP:
 			thr_quirks |= CPU_QUIRK_NO_THROTTLE;
+			device_printf(sc->cpu_dev,
+			    "throttling is disabled for PIIX4 rev. A/B\n");
 			break;
-		default:
+		case PCI_REVISION_4E:
+		case PCI_REVISION_4M:
+			thr_quirks |= CPU_QUIRK_PIIX4_WIDTH;
+			device_printf(sc->cpu_dev,
+			    "throttling has 12.5%% step for PIIX4E/M\n");
 			break;
 		}
 	}

-- 
Andriy Gapon


More information about the freebsd-acpi mailing list