diff options
author | njl <njl@FreeBSD.org> | 2005-04-10 19:57:47 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2005-04-10 19:57:47 +0000 |
commit | 28eaeb94784ef949ae97fd3dbaccd92cf862ce68 (patch) | |
tree | e142c203b73d42406636167964c6bcaad5436134 /sys/i386/cpufreq | |
parent | 0f20d4e17b51d30b6de608f147471f9334edfe04 (diff) | |
download | FreeBSD-src-28eaeb94784ef949ae97fd3dbaccd92cf862ce68.zip FreeBSD-src-28eaeb94784ef949ae97fd3dbaccd92cf862ce68.tar.gz |
Properly terminate the table generated from ACPI info. The cpufreq
settings are length-counted while the EST table is null-terminated.
This fixes extra garbage states being reported with ACPI probing.
Diffstat (limited to 'sys/i386/cpufreq')
-rw-r--r-- | sys/i386/cpufreq/est.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/i386/cpufreq/est.c b/sys/i386/cpufreq/est.c index cb8c7fe..51f5de8 100644 --- a/sys/i386/cpufreq/est.c +++ b/sys/i386/cpufreq/est.c @@ -738,18 +738,15 @@ est_acpi_info(device_t dev, freq_info **freqs) goto out; /* Parse settings into our local table format. */ - table = malloc(count * sizeof(freq_info), M_DEVBUF, M_NOWAIT); + table = malloc((count + 1) * sizeof(freq_info), M_DEVBUF, M_NOWAIT); if (table == NULL) { error = ENOMEM; goto out; } for (i = 0; i < count; i++) { /* - * XXX Figure out validity checks for id16. At least some - * systems support both SMM access via SystemIO and the - * direct MSR access but only report the SystemIO values - * via _PSS. However, since we don't know what should be - * valid for this processor, it's hard to know what to check. + * TODO: Figure out validity checks for id16. Linux checks + * that the control and status values match. */ table[i].freq = sets[i].freq; table[i].volts = sets[i].volts; @@ -757,6 +754,9 @@ est_acpi_info(device_t dev, freq_info **freqs) table[i].power = sets[i].power; } + /* Mark end of table with a terminator. */ + bzero(&table[i], sizeof(freq_info)); + sc->acpi_settings = TRUE; *freqs = table; error = 0; |