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
_______________________________________________
freebsd-acpi@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscr...@freebsd.org"

Reply via email to