aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorNate Lawson <njl@FreeBSD.org>2005-03-26 17:30:34 +0000
committerNate Lawson <njl@FreeBSD.org>2005-03-26 17:30:34 +0000
commit55fa5feab7af4454a81bed9fae4d70983bc697ce (patch)
tree6cd562bd44ad26b5f980a7b0973e93d010b798ed /sys/dev
parent34cb1517965877541ce499f5a283596526c73a22 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpica/acpi_perf.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c
index 0fc67ca71c3a..b7cd2e77f93b 100644
--- a/sys/dev/acpica/acpi_perf.c
+++ b/sys/dev/acpica/acpi_perf.c
@@ -243,7 +243,7 @@ acpi_perf_evaluate(device_t dev)
ACPI_BUFFER buf;
ACPI_OBJECT *pkg, *res;
ACPI_STATUS status;
- int error, i, j;
+ int count, error, i, j;
uint32_t *p;
/* Get the control values and parameters for each state. */
@@ -272,6 +272,7 @@ acpi_perf_evaluate(device_t dev)
* BusMasterLatency, ControlVal, StatusVal}, sorted from highest
* performance to lowest.
*/
+ count = 0;
for (i = 0; i < sc->px_count; i++) {
res = &pkg->Package.Elements[i];
if (!ACPI_PKG_VALID(res, 6)) {
@@ -279,19 +280,29 @@ acpi_perf_evaluate(device_t dev)
continue;
}
+ /* Parse the rest of the package into the struct. */
+ p = &sc->px_states[count].core_freq;
+ for (j = 0; j < 6; j++, p++)
+ acpi_PkgInt32(res, j, p);
+
/*
* Check for some impossible frequencies that some systems
- * use to indicate they don't actually support Px states.
+ * use to indicate they don't actually support this Px state.
*/
- p = &sc->px_states[i].core_freq;
- if (*p == 9999 || *p == 0xffff)
- goto out;
+ if (sc->px_states[count].core_freq == 0 ||
+ sc->px_states[count].core_freq == 9999 ||
+ sc->px_states[count].core_freq == 0x9999 ||
+ sc->px_states[count].core_freq >= 0xffff)
+ continue;
- /* Parse the rest of the package into the struct. */
- for (j = 0; j < 6; j++, p++)
- acpi_PkgInt32(res, j, p);
+ count++;
}
AcpiOsFree(buf.Pointer);
+ sc->px_count = count;
+
+ /* No valid Px state found. */
+ if (count == 0)
+ goto out;
/* Get the control and status registers (one of each). */
buf.Pointer = NULL;