From 66d1c2c3a5bc17a1ad4eb48b283e29be978c791f Mon Sep 17 00:00:00 2001 From: jruoho Date: Fri, 25 Feb 2011 16:54:36 +0000 Subject: [PATCH] Also declare support for APERF/MPERF during the BIOS _PDC/_OSC query. --- sys/arch/x86/acpi/acpi_cpu_md.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/sys/arch/x86/acpi/acpi_cpu_md.c b/sys/arch/x86/acpi/acpi_cpu_md.c index 23f4aa3e1309..7cb09d7ac708 100644 --- a/sys/arch/x86/acpi/acpi_cpu_md.c +++ b/sys/arch/x86/acpi/acpi_cpu_md.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_cpu_md.c,v 1.43 2011/02/25 12:08:35 jruoho Exp $ */ +/* $NetBSD: acpi_cpu_md.c,v 1.44 2011/02/25 16:54:36 jruoho Exp $ */ /*- * Copyright (c) 2010, 2011 Jukka Ruohonen @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.43 2011/02/25 12:08:35 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.44 2011/02/25 16:54:36 jruoho Exp $"); #include #include @@ -122,6 +122,7 @@ uint32_t acpicpu_md_cap(void) { struct cpu_info *ci = curcpu(); + uint32_t regs[4]; uint32_t val = 0; if (cpu_vendor != CPUVENDOR_IDT && @@ -149,6 +150,17 @@ acpicpu_md_cap(void) if ((ci->ci_feat_val[0] & CPUID_ACPI) != 0) val |= ACPICPU_PDC_T_FFH; + /* + * Declare support for APERF and MPERF. + */ + if (cpuid_level >= 0x06) { + + x86_cpuid(0x00000006, regs); + + if ((regs[2] & CPUID_DSPM_HWF) != 0) + val |= ACPICPU_PDC_P_HW; + } + return val; } @@ -212,7 +224,7 @@ acpicpu_md_flags(void) */ if (cpuid_level >= 0x06) { - x86_cpuid(0x06, regs); + x86_cpuid(0x00000006, regs); if ((regs[2] & CPUID_DSPM_HWF) != 0) val |= ACPICPU_FLAG_P_HW; @@ -300,7 +312,7 @@ acpicpu_md_flags(void) x86_cpuid(0x00000006, regs); - if ((regs[2] & __BIT(0)) != 0) + if ((regs[2] & CPUID_DSPM_HWF) != 0) val |= ACPICPU_FLAG_P_HW; }