Date: Thu, 11 Nov 2010 17:37:28 -0500 From: Jung-uk Kim <jkim@FreeBSD.org> To: freebsd-acpi@FreeBSD.org Cc: Andriy Gapon <avg@freebsd.org> Subject: Re: fixup for missing C1 in _CST Message-ID: <201011111737.32399.jkim@FreeBSD.org> In-Reply-To: <4CDC25F2.6080409@freebsd.org> References: <4CDC25F2.6080409@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_sAH3MdBLPPS3Zg/ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thursday 11 November 2010 12:20 pm, Andriy Gapon wrote: > 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. Can you please try the attached patch instead? Thanks, Jung-uk Kim --Boundary-00=_sAH3MdBLPPS3Zg/ Content-Type: text/plain; charset="iso-8859-1"; name="acpi_cpu.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="acpi_cpu.diff" Index: sys/dev/acpica/acpi_cpu.c =================================================================== --- sys/dev/acpica/acpi_cpu.c (revision 215135) +++ sys/dev/acpica/acpi_cpu.c (working copy) @@ -635,12 +635,13 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *s static int acpi_cpu_cx_cst(struct acpi_cpu_softc *sc) { + static const struct acpi_cx def_c1 = { .type = ACPI_STATE_C1 }; struct acpi_cx *cx_ptr; ACPI_STATUS status; ACPI_BUFFER buf; ACPI_OBJECT *top; ACPI_OBJECT *pkg; - uint32_t count; + uint32_t count, power, trans_lat, type; int i; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -671,23 +672,29 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *sc) /* Set up all valid states. */ sc->cpu_cx_count = 0; cx_ptr = sc->cpu_cx_states; + *cx_ptr = def_c1; + sc->cpu_non_c3 = 0; + if ((AcpiGbl_FADT.Flags & ACPI_FADT_C1_SUPPORTED) != 0) + sc->cpu_cx_count++; + cx_ptr++; for (i = 0; i < count; i++) { pkg = &top->Package.Elements[i + 1]; if (!ACPI_PKG_VALID(pkg, 4) || - acpi_PkgInt32(pkg, 1, &cx_ptr->type) != 0 || - acpi_PkgInt32(pkg, 2, &cx_ptr->trans_lat) != 0 || - acpi_PkgInt32(pkg, 3, &cx_ptr->power) != 0) { + acpi_PkgInt32(pkg, 1, &type) != 0 || + acpi_PkgInt32(pkg, 2, &trans_lat) != 0 || + acpi_PkgInt32(pkg, 3, &power) != 0) { device_printf(sc->cpu_dev, "skipping invalid Cx state package\n"); continue; } /* Validate the state to see if we should use it. */ - switch (cx_ptr->type) { + switch (type) { case ACPI_STATE_C1: - sc->cpu_non_c3 = i; - cx_ptr++; - sc->cpu_cx_count++; + sc->cpu_cx_states[0].trans_lat = trans_lat; + sc->cpu_cx_states[0].power = power; + if ((AcpiGbl_FADT.Flags & ACPI_FADT_C1_SUPPORTED) == 0) + sc->cpu_cx_count++; continue; case ACPI_STATE_C2: sc->cpu_non_c3 = i; @@ -716,6 +723,9 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *sc) &cx_ptr->p_lvlx, RF_SHAREABLE); if (cx_ptr->p_lvlx) { sc->cpu_rid++; + cx_ptr->type = type; + cx_ptr->trans_lat = trans_lat; + cx_ptr->power = power; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "acpi_cpu%d: Got C%d - %d latency\n", device_get_unit(sc->cpu_dev), cx_ptr->type, --Boundary-00=_sAH3MdBLPPS3Zg/--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011111737.32399.jkim>