From owner-freebsd-acpi@FreeBSD.ORG Thu Nov 11 17:20:53 2010 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 910ED106564A for ; Thu, 11 Nov 2010 17:20:53 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D9AE98FC0C for ; Thu, 11 Nov 2010 17:20:52 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA15988 for ; Thu, 11 Nov 2010 19:20:51 +0200 (EET) (envelope-from avg@freebsd.org) Message-ID: <4CDC25F2.6080409@freebsd.org> Date: Thu, 11 Nov 2010 19:20:50 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101029 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: freebsd-acpi@freebsd.org X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: fixup for missing C1 in _CST X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Nov 2010 17:20:53 -0000 Dear fellow FreeBSD ACPI hackers, what is your opinion about the following patch? The idea is to add a C1 state to available states if a bugggy BIOS supplies us with _CST that has states with C2, C3, etc types, but no state with C1 type. Thanks! diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 3c675df..6c771d9 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -724,8 +724,21 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *sc) sc->cpu_cx_count++; } } - AcpiOsFree(buf.Pointer); + if (sc->cpu_cx_count > 0 && sc->cpu_cx_states[0].type != ACPI_STATE_C1) { + memmove(&sc->cpu_cx_states[1], &sc->cpu_cx_states[0], + sc->cpu_cx_count * sizeof(sc->cpu_cx_states[0])); + sc->cpu_cx_states[0].type = ACPI_STATE_C1; + sc->cpu_cx_states[0].trans_lat = 0; + sc->cpu_cx_states[0].power = 0; + sc->cpu_cx_states[0].p_lvlx = NULL; + sc->cpu_cx_states[0].res_type = 0; + sc->cpu_cx_count++; + if (sc->cpu_cx_states[1].type <= ACPI_STATE_C2) + sc->cpu_non_c3++; + } + + AcpiOsFree(buf.Pointer); return (0); } -- Andriy Gapon