summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_perf.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-02-22 06:34:53 +0000
committernjl <njl@FreeBSD.org>2005-02-22 06:34:53 +0000
commit4c91c9444e854831f0c6f31609ab97d8629317fe (patch)
tree562fda36e0d6f8a2a410851fd84d8152e9e42152 /sys/dev/acpica/acpi_perf.c
parent7cb8584285d7b23026713439d4c82d55c6d92934 (diff)
downloadFreeBSD-src-4c91c9444e854831f0c6f31609ab97d8629317fe.zip
FreeBSD-src-4c91c9444e854831f0c6f31609ab97d8629317fe.tar.gz
Increase the maximum to wait for a transition from 1 to 10 ms. In some
modes, systems may take longer. If the status values don't match, try matching just the lowest 8 bits if no bits above 8 are set in the desired value. The IBM R32 has other bits set in the status register that are irrelevant to the expected value.
Diffstat (limited to 'sys/dev/acpica/acpi_perf.c')
-rw-r--r--sys/dev/acpica/acpi_perf.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c
index e7d2e8a..a570e44 100644
--- a/sys/dev/acpica/acpi_perf.c
+++ b/sys/dev/acpica/acpi_perf.c
@@ -448,15 +448,27 @@ acpi_px_set(device_t dev, const struct cf_setting *set)
/* Write the appropriate value to the register. */
PX_SET_REG(sc->perf_ctrl, sc->px_states[i].ctrl_val);
- /* Try for up to 1 ms to verify the desired state was selected. */
+ /*
+ * Try for up to 10 ms to verify the desired state was selected.
+ * This is longer than the standard says (1 ms) but in some modes,
+ * systems may take longer to respond.
+ */
sts_val = sc->px_states[i].sts_val;
- for (tries = 0; tries < 100; tries++) {
+ for (tries = 0; tries < 1000; tries++) {
status = PX_GET_REG(sc->perf_status);
- if (status == sts_val)
+
+ /*
+ * If we match the status or the desired status is 8 bits
+ * and matches the relevant bits, assume we succeeded. It
+ * appears some systems (IBM R32) expect byte-wide access
+ * even though the standard says the register is 32-bit.
+ */
+ if (status == sts_val ||
+ ((sts_val & ~0xff) == 0 && (status & 0xff) == sts_val))
break;
DELAY(10);
}
- if (tries == 100) {
+ if (tries == 1000) {
device_printf(dev, "Px transition to %d failed\n",
sc->px_states[i].core_freq);
return (ENXIO);
OpenPOWER on IntegriCloud