From 7d93e79a048e54676a0ede79b9bc005acbb9dd9c Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sat, 30 Dec 2017 19:17:58 +0100 Subject: [PATCH] Latest ACPI update removed some essential configuration * The global lock, needed for hw <-> os to sync, was a no op. This means that OS and HW could read and write to same value at the same time, causing garbled data and crashes. This is easiest to see in battery status, where battery values and OEM name would become garbage. It also causes instability and failure to shutdown * ACPI used 64 bit addressing (which it normally should) on 32 bit. This would cause page faults as it would jump to incorrect addresses --- .../acpi/acpica/include/platform/achaiku.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/achaiku.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/achaiku.h index d9eb971484..65259b1599 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/achaiku.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/achaiku.h @@ -181,6 +181,11 @@ struct mutex; #define ACPI_MACHINE_WIDTH 64 #else #define ACPI_MACHINE_WIDTH 32 +/* TODO: Temporary fix for #12377 + DO NOT REMOVE as otherwise we get address overflows + Use 32 bit addresses to match addr_t for now. +*/ +#define ACPI_32BIT_PHYSICAL_ADDRESS #endif @@ -192,6 +197,21 @@ struct mutex; #define ACPI_FLUSH_CPU_CACHE() __asm __volatile("wbinvd"); +/* Based on FreeBSD's due to lack of documentation + DO NOT REMOVE, the fallback is no ops, which means + HW <-> OS sync is not done => garbled data.. +*/ +extern int AcpiOsAcquireGlobalLock(uint32 *lock); +extern int AcpiOsReleaseGlobalLock(uint32 *lock); + +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) do { \ + (Acq) = AcpiOsAcquireGlobalLock((uint32 *)&((GLptr)->GlobalLock)); \ +} while (0) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) do { \ + (Acq) = AcpiOsReleaseGlobalLock((uint32 *)&((GLptr)->GlobalLock)); \ +} while (0) + #else /* _KERNEL_MODE */ /* Host-dependent types and defines for user-space ACPICA */