From 28eaeb94784ef949ae97fd3dbaccd92cf862ce68 Mon Sep 17 00:00:00 2001 From: njl Date: Sun, 10 Apr 2005 19:57:47 +0000 Subject: 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. --- sys/i386/cpufreq/est.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sys/i386/cpufreq') 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; -- cgit v1.1