From 77e84d0e621726a6a5ee40f4bed56848b804a75c Mon Sep 17 00:00:00 2001 From: jruoho Date: Thu, 20 Oct 2011 06:57:23 +0000 Subject: [PATCH] Initialize P-states to P0 (i.e. the highest frequency). --- sys/dev/acpi/acpi_cpu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/dev/acpi/acpi_cpu.c b/sys/dev/acpi/acpi_cpu.c index 839b8539db37..185d7e10fc6c 100644 --- a/sys/dev/acpi/acpi_cpu.c +++ b/sys/dev/acpi/acpi_cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_cpu.c,v 1.45 2011/10/18 05:08:24 jruoho Exp $ */ +/* $NetBSD: acpi_cpu.c,v 1.46 2011/10/20 06:57:23 jruoho Exp $ */ /*- * Copyright (c) 2010, 2011 Jukka Ruohonen @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.45 2011/10/18 05:08:24 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.46 2011/10/20 06:57:23 jruoho Exp $"); #include #include @@ -249,24 +249,18 @@ acpicpu_once_attach(void) static int acpicpu_once_detach(void) { - struct cpu_info *ci = curcpu(); struct acpicpu_softc *sc; if (acpicpu_count != 0) return EDEADLK; + cpufreq_deregister(); + if (acpicpu_log != NULL) sysctl_teardown(&acpicpu_log); - if (acpicpu_sc != NULL) { - - sc = acpicpu_sc[ci->ci_acpiid]; - - if ((sc->sc_flags & ACPICPU_FLAG_P) != 0) - cpufreq_deregister(); - + if (acpicpu_sc != NULL) kmem_free(acpicpu_sc, maxcpus * sizeof(*sc)); - } return 0; } @@ -333,6 +327,12 @@ acpicpu_start(device_t self) if (cpufreq_register(&cf) != 0) aprint_error_dev(self, "failed to register cpufreq\n"); + else { + /* + * Initialize the states to P0. + */ + cpufreq_set_all(sc->sc_pstate[0].ps_freq); + } } }