summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-03-26 17:30:34 +0000
committernjl <njl@FreeBSD.org>2005-03-26 17:30:34 +0000
commit3c111664fba85c4ee50c32d224d0618404c002b7 (patch)
tree6cd562bd44ad26b5f980a7b0973e93d010b798ed
parent9129b5403c06b0d32da39ef248fab00e169f3df1 (diff)
downloadFreeBSD-src-3c111664fba85c4ee50c32d224d0618404c002b7.zip
FreeBSD-src-3c111664fba85c4ee50c32d224d0618404c002b7.tar.gz
Check for invalid frequencies after parsing the package. Keep a running
count of valid frequencies and use that as the final package count, don't give up when the first invalid state is found. Also, add 0x9999 and expand our upper check to >= 0xffff Mhz [2]. Submitted by: Bruno Ducrot, Jung-uk Kim [2]
-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 0fc67ca..b7cd2e7 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;
OpenPOWER on IntegriCloud