fixup for missing C1 in _CST
Jung-uk Kim
jkim at FreeBSD.org
Thu Nov 11 22:37:39 UTC 2010
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
-------------- next part --------------
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,
More information about the freebsd-acpi
mailing list